@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.esm.js CHANGED
@@ -40421,36 +40421,57 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40421
40421
  depSelections = _useState28[0],
40422
40422
  setDepSelections = _useState28[1];
40423
40423
 
40424
- // Step 5: Publish
40425
- var _useState29 = useState(false),
40424
+ // Step 5: Defaults verification — surfaced values from each owned
40425
+ // widget package's `.dash.js` userConfig[field].defaultValue. Lets
40426
+ // the publisher review (and optionally blank/edit) values set
40427
+ // during development before the ZIP ships.
40428
+ // defaultsByPackage: { [packageId]: Array<{widgetName, field, currentDefault, displayName, type, instructions}> }
40429
+ // defaultsOverrides: { [packageId]: { [widgetName]: { [field]: newValue } } }
40430
+ // — only fields the user actually edited appear here. Undefined
40431
+ // = "no change"; explicit empty-string = "blank it out".
40432
+ var _useState29 = useState({}),
40426
40433
  _useState30 = _slicedToArray(_useState29, 2),
40427
- isPublishing = _useState30[0],
40428
- setIsPublishing = _useState30[1];
40429
- var _useState31 = useState(null),
40434
+ defaultsByPackage = _useState30[0],
40435
+ setDefaultsByPackage = _useState30[1];
40436
+ var _useState31 = useState(false),
40430
40437
  _useState32 = _slicedToArray(_useState31, 2),
40431
- result = _useState32[0],
40432
- setResult = _useState32[1];
40433
- // Per-step progress during batch publish
40434
- var _useState33 = useState([]),
40438
+ defaultsLoading = _useState32[0],
40439
+ setDefaultsLoading = _useState32[1];
40440
+ var _useState33 = useState({}),
40435
40441
  _useState34 = _slicedToArray(_useState33, 2),
40436
- publishSteps = _useState34[0],
40437
- setPublishSteps = _useState34[1];
40442
+ defaultsOverrides = _useState34[0],
40443
+ setDefaultsOverrides = _useState34[1];
40438
40444
 
40439
- // Visibility chosen on the Details step. Defaults to public.
40440
- var _useState35 = useState("public"),
40445
+ // Step 6: Publish
40446
+ var _useState35 = useState(false),
40441
40447
  _useState36 = _slicedToArray(_useState35, 2),
40442
- visibility = _useState36[0],
40443
- setVisibility = _useState36[1];
40448
+ isPublishing = _useState36[0],
40449
+ setIsPublishing = _useState36[1];
40450
+ var _useState37 = useState(null),
40451
+ _useState38 = _slicedToArray(_useState37, 2),
40452
+ result = _useState38[0],
40453
+ setResult = _useState38[1];
40454
+ // Per-step progress during batch publish
40455
+ var _useState39 = useState([]),
40456
+ _useState40 = _slicedToArray(_useState39, 2),
40457
+ publishSteps = _useState40[0],
40458
+ setPublishSteps = _useState40[1];
40459
+
40460
+ // Visibility — chosen on the Details step. Defaults to public.
40461
+ var _useState41 = useState("public"),
40462
+ _useState42 = _slicedToArray(_useState41, 2),
40463
+ visibility = _useState42[0],
40464
+ setVisibility = _useState42[1];
40444
40465
 
40445
40466
  // Dashboard version bump — chosen on the Details step. Defaults to
40446
40467
  // "patch" so repeat-publishes auto-increment the registry's
40447
40468
  // latestVersion. Without this, every republish used the same
40448
40469
  // version string, the registry never saw a new version, and update
40449
40470
  // notifications never fired on installers.
40450
- var _useState37 = useState("patch"),
40451
- _useState38 = _slicedToArray(_useState37, 2),
40452
- dashboardBump = _useState38[0],
40453
- setDashboardBump = _useState38[1];
40471
+ var _useState43 = useState("patch"),
40472
+ _useState44 = _slicedToArray(_useState43, 2),
40473
+ dashboardBump = _useState44[0],
40474
+ setDashboardBump = _useState44[1];
40454
40475
 
40455
40476
  // Fetch publish preview (widget names) on open
40456
40477
  useEffect(function () {
@@ -40586,6 +40607,97 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40586
40607
  });
40587
40608
  // eslint-disable-next-line react-hooks/exhaustive-deps
40588
40609
  }, [step, isOpen]);
40610
+
40611
+ // Load per-package default-value scans when the user arrives at the
40612
+ // Defaults step. We only scan packages that are actually going to be
40613
+ // republished (include + owned) to keep the step focused — a
40614
+ // third-party package the user isn't republishing can't have its
40615
+ // defaults changed anyway.
40616
+ useEffect(function () {
40617
+ if (!isOpen || step !== 5 || !plan || defaultsLoading) return;
40618
+ var packagesToScan = [];
40619
+ var _iterator2 = _createForOfIteratorHelper$c(plan.widgets || []),
40620
+ _step2;
40621
+ try {
40622
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
40623
+ var w = _step2.value;
40624
+ if (!w.scope || !w.packageName) continue;
40625
+ var key = "".concat(w.scope, "/").concat(w.packageName);
40626
+ var sel = depSelections[key];
40627
+ if (!(sel !== null && sel !== void 0 && sel.include) || !(sel !== null && sel !== void 0 && sel.owned)) continue;
40628
+ // Resolve the local package id the scanner expects — same shape
40629
+ // the inspect IPC already takes.
40630
+ var localPkgId = w.packageId || "@".concat(w.scope, "/").concat(w.packageName);
40631
+ if (!defaultsByPackage[localPkgId]) packagesToScan.push(localPkgId);
40632
+ }
40633
+ } catch (err) {
40634
+ _iterator2.e(err);
40635
+ } finally {
40636
+ _iterator2.f();
40637
+ }
40638
+ if (packagesToScan.length === 0) return;
40639
+ setDefaultsLoading(true);
40640
+ Promise.all(packagesToScan.map(function (pkgId) {
40641
+ return window.mainApi.registry.scanWidgetDefaults(pkgId).then(function (res) {
40642
+ return {
40643
+ pkgId: pkgId,
40644
+ res: res
40645
+ };
40646
+ })["catch"](function (err) {
40647
+ return {
40648
+ pkgId: pkgId,
40649
+ res: {
40650
+ success: false,
40651
+ error: (err === null || err === void 0 ? void 0 : err.message) || String(err)
40652
+ }
40653
+ };
40654
+ });
40655
+ })).then(function (results) {
40656
+ setDefaultsByPackage(function (prev) {
40657
+ var next = _objectSpread$r({}, prev);
40658
+ var _iterator3 = _createForOfIteratorHelper$c(results),
40659
+ _step3;
40660
+ try {
40661
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
40662
+ var _step3$value = _step3.value,
40663
+ pkgId = _step3$value.pkgId,
40664
+ res = _step3$value.res;
40665
+ next[pkgId] = res !== null && res !== void 0 && res.success ? res.defaults || [] : [];
40666
+ }
40667
+ } catch (err) {
40668
+ _iterator3.e(err);
40669
+ } finally {
40670
+ _iterator3.f();
40671
+ }
40672
+ return next;
40673
+ });
40674
+ setDefaultsLoading(false);
40675
+ });
40676
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40677
+ }, [step, isOpen, plan, depSelections]);
40678
+ function setDefaultOverride(packageId, widgetName, field, newValue) {
40679
+ setDefaultsOverrides(function (prev) {
40680
+ var next = _objectSpread$r({}, prev);
40681
+ var forPkg = _objectSpread$r({}, next[packageId] || {});
40682
+ var forWidget = _objectSpread$r({}, forPkg[widgetName] || {});
40683
+ if (newValue === undefined) {
40684
+ delete forWidget[field];
40685
+ } else {
40686
+ forWidget[field] = newValue;
40687
+ }
40688
+ if (Object.keys(forWidget).length === 0) {
40689
+ delete forPkg[widgetName];
40690
+ } else {
40691
+ forPkg[widgetName] = forWidget;
40692
+ }
40693
+ if (Object.keys(forPkg).length === 0) {
40694
+ delete next[packageId];
40695
+ } else {
40696
+ next[packageId] = forPkg;
40697
+ }
40698
+ return next;
40699
+ });
40700
+ }
40589
40701
  function updateDepSelection(key, patch) {
40590
40702
  setDepSelections(function (prev) {
40591
40703
  return _objectSpread$r(_objectSpread$r({}, prev), {}, _defineProperty({}, key, _objectSpread$r(_objectSpread$r({}, prev[key]), patch)));
@@ -40603,7 +40715,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40603
40715
  }
40604
40716
  function _handlePublish() {
40605
40717
  _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
40606
- var steps, seenPackages, _iterator2, _step2, w, _key2, _sel, key, sel, updateStep, i, _step3, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
40718
+ var steps, seenPackages, _iterator4, _step4, w, _key2, _sel, key, sel, updateStep, i, _step5, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
40607
40719
  return _regeneratorRuntime.wrap(function (_context2) {
40608
40720
  while (1) switch (_context2.prev = _context2.next) {
40609
40721
  case 0:
@@ -40625,15 +40737,15 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40625
40737
  break;
40626
40738
  }
40627
40739
  seenPackages = new Set();
40628
- _iterator2 = _createForOfIteratorHelper$c(plan.widgets || []);
40740
+ _iterator4 = _createForOfIteratorHelper$c(plan.widgets || []);
40629
40741
  _context2.prev = 2;
40630
- _iterator2.s();
40742
+ _iterator4.s();
40631
40743
  case 3:
40632
- if ((_step2 = _iterator2.n()).done) {
40744
+ if ((_step4 = _iterator4.n()).done) {
40633
40745
  _context2.next = 8;
40634
40746
  break;
40635
40747
  }
40636
- w = _step2.value;
40748
+ w = _step4.value;
40637
40749
  if (!(!w.scope || !w.packageName)) {
40638
40750
  _context2.next = 4;
40639
40751
  break;
@@ -40671,10 +40783,10 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40671
40783
  case 9:
40672
40784
  _context2.prev = 9;
40673
40785
  _t2 = _context2["catch"](2);
40674
- _iterator2.e(_t2);
40786
+ _iterator4.e(_t2);
40675
40787
  case 10:
40676
40788
  _context2.prev = 10;
40677
- _iterator2.f();
40789
+ _iterator4.f();
40678
40790
  return _context2.finish(10);
40679
40791
  case 11:
40680
40792
  if (plan.theme && plan.theme.scope && plan.theme.name) {
@@ -40718,28 +40830,30 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40718
40830
  _context2.next = 24;
40719
40831
  break;
40720
40832
  }
40721
- _step3 = steps[i];
40833
+ _step5 = steps[i];
40722
40834
  updateStep(i, {
40723
40835
  status: "running"
40724
40836
  });
40725
- if (!(_step3.kind === "widget")) {
40837
+ if (!(_step5.kind === "widget")) {
40726
40838
  _context2.next = 17;
40727
40839
  break;
40728
40840
  }
40729
- bump = _step3.selection.bump;
40841
+ bump = _step5.selection.bump;
40730
40842
  options = _objectSpread$r(_objectSpread$r({}, bump && bump !== "none" ? {
40731
40843
  bump: bump
40732
40844
  } : {}), {}, {
40733
- visibility: _step3.selection.visibility,
40845
+ visibility: _step5.selection.visibility,
40734
40846
  // Plumb the publisher's display name through to the widget
40735
40847
  // publish call so the manifest — and the rewritten dash.json
40736
40848
  // inside the zipped package — records the actual human who
40737
40849
  // published, not the AI Widget Builder's "AI Assistant"
40738
40850
  // placeholder.
40739
40851
  authorName: authorName.trim() || undefined
40740
- });
40852
+ }, defaultsOverrides[_step5.packageId] ? {
40853
+ defaultsOverride: defaultsOverrides[_step5.packageId]
40854
+ } : {});
40741
40855
  _context2.next = 15;
40742
- return window.mainApi.registry.publishWidget(appId, _step3.packageId, options);
40856
+ return window.mainApi.registry.publishWidget(appId, _step5.packageId, options);
40743
40857
  case 15:
40744
40858
  res = _context2.sent;
40745
40859
  if (res !== null && res !== void 0 && res.success) {
@@ -40752,7 +40866,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40752
40866
  });
40753
40867
  setResult({
40754
40868
  success: false,
40755
- error: "Failed to publish widget ".concat(_step3.key, ": ").concat((res === null || res === void 0 ? void 0 : res.error) || "unknown error")
40869
+ error: "Failed to publish widget ".concat(_step5.key, ": ").concat((res === null || res === void 0 ? void 0 : res.error) || "unknown error")
40756
40870
  });
40757
40871
  setIsPublishing(false);
40758
40872
  return _context2.abrupt("return");
@@ -40764,13 +40878,13 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40764
40878
  _context2.next = 23;
40765
40879
  break;
40766
40880
  case 17:
40767
- if (!(_step3.kind === "theme")) {
40881
+ if (!(_step5.kind === "theme")) {
40768
40882
  _context2.next = 20;
40769
40883
  break;
40770
40884
  }
40771
40885
  _context2.next = 18;
40772
- return window.mainApi.themes.publishTheme(appId, _step3.themeKey, {
40773
- visibility: _step3.selection.visibility
40886
+ return window.mainApi.themes.publishTheme(appId, _step5.themeKey, {
40887
+ visibility: _step5.selection.visibility
40774
40888
  });
40775
40889
  case 18:
40776
40890
  _res = _context2.sent;
@@ -40784,7 +40898,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40784
40898
  });
40785
40899
  setResult({
40786
40900
  success: false,
40787
- error: "Failed to publish theme ".concat(_step3.themeKey, ": ").concat((_res === null || _res === void 0 ? void 0 : _res.error) || "unknown error")
40901
+ error: "Failed to publish theme ".concat(_step5.themeKey, ": ").concat((_res === null || _res === void 0 ? void 0 : _res.error) || "unknown error")
40788
40902
  });
40789
40903
  setIsPublishing(false);
40790
40904
  return _context2.abrupt("return");
@@ -40796,7 +40910,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40796
40910
  _context2.next = 23;
40797
40911
  break;
40798
40912
  case 20:
40799
- if (!(_step3.kind === "dashboard")) {
40913
+ if (!(_step5.kind === "dashboard")) {
40800
40914
  _context2.next = 23;
40801
40915
  break;
40802
40916
  }
@@ -40950,7 +41064,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40950
41064
  }
40951
41065
  function handleSignOut() {
40952
41066
  return _handleSignOut.apply(this, arguments);
40953
- } // Steps: 0=Account, 1=Details, 2=Tags, 3=Icon, 4=Dependencies, 5=Publish
41067
+ } // Steps: 0=Account, 1=Details, 2=Tags, 3=Icon, 4=Dependencies, 5=Defaults, 6=Publish
40954
41068
  function _handleSignOut() {
40955
41069
  _handleSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
40956
41070
  return _regeneratorRuntime.wrap(function (_context5) {
@@ -40975,8 +41089,8 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
40975
41089
  }));
40976
41090
  return _handleSignOut.apply(this, arguments);
40977
41091
  }
40978
- var isLastStep = step === 5;
40979
- var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : step === 4 ? !planLoading : true;
41092
+ var isLastStep = step === 6;
41093
+ var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : step === 4 ? !planLoading : step === 5 ? !defaultsLoading : true;
40980
41094
  return /*#__PURE__*/jsx(Modal, {
40981
41095
  isOpen: isOpen,
40982
41096
  setIsOpen: handleClose,
@@ -41237,6 +41351,26 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
41237
41351
  onChange: updateDepSelection
41238
41352
  })]
41239
41353
  })
41354
+ }), /*#__PURE__*/jsx(Stepper.Step, {
41355
+ label: "Defaults",
41356
+ children: /*#__PURE__*/jsxs("div", {
41357
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-4",
41358
+ children: [/*#__PURE__*/jsxs("p", {
41359
+ className: "text-sm opacity-70",
41360
+ children: ["Review ", /*#__PURE__*/jsx("code", {
41361
+ children: "userConfig"
41362
+ }), " 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."]
41363
+ }), defaultsLoading && /*#__PURE__*/jsx("div", {
41364
+ className: "text-sm opacity-60 py-6 text-center",
41365
+ children: "Scanning widget configs for default values\u2026"
41366
+ }), !defaultsLoading && /*#__PURE__*/jsx(DefaultsReviewList, {
41367
+ plan: plan,
41368
+ depSelections: depSelections,
41369
+ defaultsByPackage: defaultsByPackage,
41370
+ overrides: defaultsOverrides,
41371
+ onChange: setDefaultOverride
41372
+ })]
41373
+ })
41240
41374
  }), /*#__PURE__*/jsx(Stepper.Step, {
41241
41375
  label: "Publish",
41242
41376
  children: /*#__PURE__*/jsxs("div", {
@@ -41426,7 +41560,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
41426
41560
  className: "flex-1 text-center",
41427
41561
  children: /*#__PURE__*/jsxs("span", {
41428
41562
  className: "text-xs opacity-40",
41429
- children: ["Step ", step + 1, " of 6"]
41563
+ children: ["Step ", step + 1, " of 7"]
41430
41564
  })
41431
41565
  }), /*#__PURE__*/jsx("div", {
41432
41566
  className: "flex flex-row gap-2",
@@ -41515,11 +41649,11 @@ function DependencyTable(_ref4) {
41515
41649
  // row. Each row shows the list of component widgets that live inside it
41516
41650
  // so the user knows what's getting published.
41517
41651
  var byKey = new Map();
41518
- var _iterator3 = _createForOfIteratorHelper$c(plan.widgets || []),
41519
- _step4;
41652
+ var _iterator5 = _createForOfIteratorHelper$c(plan.widgets || []),
41653
+ _step6;
41520
41654
  try {
41521
- for (_iterator3.s(); !(_step4 = _iterator3.n()).done;) {
41522
- var w = _step4.value;
41655
+ for (_iterator5.s(); !(_step6 = _iterator5.n()).done;) {
41656
+ var w = _step6.value;
41523
41657
  if (!w.scope || !w.packageName) continue;
41524
41658
  var _key3 = "".concat(w.scope, "/").concat(w.packageName);
41525
41659
  var entry = byKey.get(_key3) || {
@@ -41532,9 +41666,9 @@ function DependencyTable(_ref4) {
41532
41666
  byKey.set(_key3, entry);
41533
41667
  }
41534
41668
  } catch (err) {
41535
- _iterator3.e(err);
41669
+ _iterator5.e(err);
41536
41670
  } finally {
41537
- _iterator3.f();
41671
+ _iterator5.f();
41538
41672
  }
41539
41673
  var rows = Array.from(byKey.values()).map(function (e) {
41540
41674
  return _objectSpread$r(_objectSpread$r({}, e), {}, {
@@ -41668,6 +41802,134 @@ function DependencyTable(_ref4) {
41668
41802
  });
41669
41803
  }
41670
41804
 
41805
+ /**
41806
+ * Per-package editable list of every non-empty userConfig default.
41807
+ * Renders once per owned package selected for republish. Edits are
41808
+ * two-way: typing into a field stages an override; hitting "Reset"
41809
+ * clears the override so the original defaultValue ships. The
41810
+ * outside world treats `overrides[packageId][widgetName][field]` as
41811
+ * the source of truth for the publish call.
41812
+ */
41813
+ function DefaultsReviewList(_ref6) {
41814
+ var plan = _ref6.plan,
41815
+ depSelections = _ref6.depSelections,
41816
+ defaultsByPackage = _ref6.defaultsByPackage,
41817
+ overrides = _ref6.overrides,
41818
+ _onChange2 = _ref6.onChange;
41819
+ // Collect the packages we're actually about to republish so the UI
41820
+ // stays aligned with Dependencies — no surprises about WHICH
41821
+ // package's defaults you're editing.
41822
+ var rows = [];
41823
+ var _iterator6 = _createForOfIteratorHelper$c((plan === null || plan === void 0 ? void 0 : plan.widgets) || []),
41824
+ _step7;
41825
+ try {
41826
+ for (_iterator6.s(); !(_step7 = _iterator6.n()).done;) {
41827
+ var w = _step7.value;
41828
+ if (!w.scope || !w.packageName) continue;
41829
+ var key = "".concat(w.scope, "/").concat(w.packageName);
41830
+ var sel = depSelections[key];
41831
+ if (!(sel !== null && sel !== void 0 && sel.include) || !(sel !== null && sel !== void 0 && sel.owned)) continue;
41832
+ var localPkgId = w.packageId || "@".concat(w.scope, "/").concat(w.packageName);
41833
+ var defaults = defaultsByPackage[localPkgId];
41834
+ if (!Array.isArray(defaults)) continue;
41835
+ rows.push({
41836
+ key: key,
41837
+ localPkgId: localPkgId,
41838
+ label: "@".concat(w.scope, "/").concat(w.packageName),
41839
+ defaults: defaults
41840
+ });
41841
+ }
41842
+ } catch (err) {
41843
+ _iterator6.e(err);
41844
+ } finally {
41845
+ _iterator6.f();
41846
+ }
41847
+ if (rows.length === 0) {
41848
+ return /*#__PURE__*/jsx("div", {
41849
+ className: "text-sm opacity-60 py-6 text-center",
41850
+ children: "No non-empty defaults found in any owned widget. Nothing to review."
41851
+ });
41852
+ }
41853
+ return /*#__PURE__*/jsx("div", {
41854
+ className: "flex flex-col gap-4",
41855
+ children: rows.map(function (_ref7) {
41856
+ var key = _ref7.key,
41857
+ localPkgId = _ref7.localPkgId,
41858
+ label = _ref7.label,
41859
+ defaults = _ref7.defaults;
41860
+ if (defaults.length === 0) {
41861
+ return /*#__PURE__*/jsxs("div", {
41862
+ className: "border border-white/10 rounded-lg px-4 py-3 bg-white/5",
41863
+ children: [/*#__PURE__*/jsx("div", {
41864
+ className: "text-sm font-semibold font-mono",
41865
+ children: label
41866
+ }), /*#__PURE__*/jsxs("div", {
41867
+ className: "text-xs opacity-60 mt-1",
41868
+ children: ["No non-empty ", /*#__PURE__*/jsx("code", {
41869
+ children: "defaultValue"
41870
+ }), " entries detected."]
41871
+ })]
41872
+ }, key);
41873
+ }
41874
+ return /*#__PURE__*/jsxs("div", {
41875
+ className: "border border-white/10 rounded-lg px-4 py-3 bg-white/5",
41876
+ children: [/*#__PURE__*/jsx("div", {
41877
+ className: "text-sm font-semibold font-mono mb-2",
41878
+ children: label
41879
+ }), /*#__PURE__*/jsx("div", {
41880
+ className: "flex flex-col gap-3",
41881
+ children: defaults.map(function (d) {
41882
+ var _overrides$localPkgId, _d$currentDefault;
41883
+ 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];
41884
+ var isOverridden = overriddenValue !== undefined;
41885
+ var displayValue = isOverridden ? String(overriddenValue !== null && overriddenValue !== void 0 ? overriddenValue : "") : String((_d$currentDefault = d.currentDefault) !== null && _d$currentDefault !== void 0 ? _d$currentDefault : "");
41886
+ return /*#__PURE__*/jsxs("div", {
41887
+ className: "flex flex-col gap-1",
41888
+ children: [/*#__PURE__*/jsxs("div", {
41889
+ className: "flex items-center gap-2 flex-wrap",
41890
+ children: [/*#__PURE__*/jsxs("code", {
41891
+ className: "text-xs opacity-70",
41892
+ children: [d.widgetName, ".", d.field]
41893
+ }), /*#__PURE__*/jsxs("span", {
41894
+ className: "text-[10px] opacity-50",
41895
+ children: ["(", d.type, ")"]
41896
+ }), /*#__PURE__*/jsx("span", {
41897
+ className: "text-[10px] opacity-50",
41898
+ children: d.displayName
41899
+ }), isOverridden && /*#__PURE__*/jsx("span", {
41900
+ className: "text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-900/40 text-amber-200",
41901
+ children: "edited"
41902
+ })]
41903
+ }), /*#__PURE__*/jsxs("div", {
41904
+ className: "flex items-center gap-2",
41905
+ children: [/*#__PURE__*/jsx("input", {
41906
+ type: "text",
41907
+ value: displayValue,
41908
+ onChange: function onChange(e) {
41909
+ return _onChange2(localPkgId, d.widgetName, d.field, e.target.value);
41910
+ },
41911
+ className: "flex-1 bg-gray-900 border border-white/10 rounded px-2 py-1 text-xs font-mono"
41912
+ }), isOverridden && /*#__PURE__*/jsx("button", {
41913
+ type: "button",
41914
+ onClick: function onClick() {
41915
+ return _onChange2(localPkgId, d.widgetName, d.field, undefined);
41916
+ },
41917
+ className: "text-xs opacity-60 hover:opacity-100 underline underline-offset-2",
41918
+ title: "Discard edit \u2014 ship the original defaultValue",
41919
+ children: "Reset"
41920
+ })]
41921
+ }), d.instructions && /*#__PURE__*/jsx("div", {
41922
+ className: "text-[10px] opacity-50",
41923
+ children: d.instructions
41924
+ })]
41925
+ }, "".concat(d.widgetName, "|").concat(d.field));
41926
+ })
41927
+ })]
41928
+ }, key);
41929
+ })
41930
+ });
41931
+ }
41932
+
41671
41933
  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; }
41672
41934
  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; }
41673
41935
  var LayoutPreview = function LayoutPreview(_ref) {