@trops/dash-core 0.1.633 → 0.1.635

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
@@ -38664,14 +38664,17 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref11) {
38664
38664
  }
38665
38665
  return /*#__PURE__*/jsxs("div", {
38666
38666
  className: "flex flex-col gap-4 p-6 flex-1 min-h-0 overflow-hidden",
38667
- children: [/*#__PURE__*/jsx(InputText, {
38668
- value: wizardName,
38669
- onChange: function onChange(val) {
38670
- return setWizardName(val);
38671
- },
38672
- placeholder: "Theme name..."
38667
+ children: [/*#__PURE__*/jsx("div", {
38668
+ className: "shrink-0",
38669
+ children: /*#__PURE__*/jsx(InputText, {
38670
+ value: wizardName,
38671
+ onChange: function onChange(val) {
38672
+ return setWizardName(val);
38673
+ },
38674
+ placeholder: "Theme name..."
38675
+ })
38673
38676
  }), showMethodPicker && /*#__PURE__*/jsxs("div", {
38674
- className: "flex flex-col gap-2",
38677
+ className: "flex flex-col gap-2 shrink-0",
38675
38678
  children: [/*#__PURE__*/jsx("span", {
38676
38679
  className: "text-sm font-semibold opacity-50",
38677
38680
  children: "Generation Method"
@@ -38711,33 +38714,39 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref11) {
38711
38714
  }
38712
38715
  })]
38713
38716
  })]
38714
- }), wizardMethod === "presets" && /*#__PURE__*/jsx(PresetGallery, {
38715
- onSelect: function onSelect(preset) {
38716
- return setWizardTheme(preset);
38717
- },
38718
- selectedPresetId: wizardTheme === null || wizardTheme === void 0 ? void 0 : wizardTheme.name,
38719
- inline: true
38720
- }), wizardMethod === "random" && /*#__PURE__*/jsx(RandomPreview, {
38721
- onCommit: function onCommit(theme) {
38722
- return setWizardTheme(theme);
38723
- }
38724
- }), wizardMethod === "color" && /*#__PURE__*/jsx(ColorHarmonyPicker, {
38725
- onGenerate: function onGenerate(theme) {
38726
- return setWizardTheme(theme);
38727
- },
38728
- inline: true
38729
- }), wizardMethod === "from-url" && onExtract && /*#__PURE__*/jsx(ThemeFromUrlPane, {
38730
- onExtract: onExtract,
38731
- onMapToTheme: onMapToTheme,
38732
- onGenerate: function onGenerate(theme) {
38733
- return setWizardTheme(theme);
38734
- },
38735
- inline: true
38736
- }), /*#__PURE__*/jsx(Button2, {
38737
- title: "Create Theme",
38738
- onClick: onComplete,
38739
- disabled: !canCreate,
38740
- block: true
38717
+ }), /*#__PURE__*/jsxs("div", {
38718
+ className: "flex-1 min-h-0 overflow-y-auto",
38719
+ children: [wizardMethod === "presets" && /*#__PURE__*/jsx(PresetGallery, {
38720
+ onSelect: function onSelect(preset) {
38721
+ return setWizardTheme(preset);
38722
+ },
38723
+ selectedPresetId: wizardTheme === null || wizardTheme === void 0 ? void 0 : wizardTheme.name,
38724
+ inline: true
38725
+ }), wizardMethod === "random" && /*#__PURE__*/jsx(RandomPreview, {
38726
+ onCommit: function onCommit(theme) {
38727
+ return setWizardTheme(theme);
38728
+ }
38729
+ }), wizardMethod === "color" && /*#__PURE__*/jsx(ColorHarmonyPicker, {
38730
+ onGenerate: function onGenerate(theme) {
38731
+ return setWizardTheme(theme);
38732
+ },
38733
+ inline: true
38734
+ }), wizardMethod === "from-url" && onExtract && /*#__PURE__*/jsx(ThemeFromUrlPane, {
38735
+ onExtract: onExtract,
38736
+ onMapToTheme: onMapToTheme,
38737
+ onGenerate: function onGenerate(theme) {
38738
+ return setWizardTheme(theme);
38739
+ },
38740
+ inline: true
38741
+ })]
38742
+ }), /*#__PURE__*/jsx("div", {
38743
+ className: "shrink-0",
38744
+ children: /*#__PURE__*/jsx(Button2, {
38745
+ title: "Create Theme",
38746
+ onClick: onComplete,
38747
+ disabled: !canCreate,
38748
+ block: true
38749
+ })
38741
38750
  })]
38742
38751
  });
38743
38752
  };
@@ -39598,6 +39607,10 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39598
39607
  _useState10 = _slicedToArray(_useState1, 2),
39599
39608
  isChoosingMode = _useState10[0],
39600
39609
  setIsChoosingMode = _useState10[1];
39610
+ // `startInCreate` should auto-open the chooser ONCE per modal open. Without
39611
+ // this guard the effect re-fires after a theme is created (themes change →
39612
+ // isCreating flips false) and bounces the user back to the chooser.
39613
+ var startInCreateHandledRef = useRef(false);
39601
39614
  var _useState11 = useState(false),
39602
39615
  _useState12 = _slicedToArray(_useState11, 2),
39603
39616
  isSearching = _useState12[0],
@@ -39634,6 +39647,7 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39634
39647
  setIsChoosingMode(false);
39635
39648
  setIsSearching(false);
39636
39649
  setSelectedMethod(null);
39650
+ startInCreateHandledRef.current = false;
39637
39651
  } else {
39638
39652
  if (themeKeySelected === null && themes) {
39639
39653
  var themeKeyTemp = settings && "theme" in settings ? settings["theme"] in themes ? settings["theme"] : Object.keys(themes)[0] : Object.keys(themes)[0];
@@ -39648,7 +39662,8 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39648
39662
  return rawThemes[themeKeyTemp];
39649
39663
  });
39650
39664
  }
39651
- if (startInCreate && !isChoosingMode && !isCreating) {
39665
+ if (startInCreate && !startInCreateHandledRef.current && !isChoosingMode && !isCreating) {
39666
+ startInCreateHandledRef.current = true;
39652
39667
  setIsChoosingMode(true);
39653
39668
  setIsCreating(false);
39654
39669
  setIsSearching(false);
@@ -47305,21 +47320,45 @@ var PROVIDER_LABELS = {
47305
47320
  xai: "xAI"
47306
47321
  };
47307
47322
  var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47308
- function providerOptionsFrom(providers) {
47309
- var present = new Set();
47323
+ function presentProviderTypes(providers) {
47324
+ var present = [];
47310
47325
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
47311
47326
  var p = _Object$values[_i];
47312
- if (p && AI_PROVIDER_TYPES.includes(p.type)) present.add(p.type);
47327
+ if (p && AI_PROVIDER_TYPES.includes(p.type) && !present.includes(p.type)) {
47328
+ present.push(p.type);
47329
+ }
47313
47330
  }
47314
- return [{
47315
- value: "",
47316
- label: "Default provider"
47317
- }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47331
+ return present;
47332
+ }
47333
+ function providerOptionsFrom(providers) {
47334
+ return [].concat(_toConsumableArray(presentProviderTypes(providers).map(function (t) {
47318
47335
  return {
47319
47336
  value: t,
47320
47337
  label: PROVIDER_LABELS[t] || t
47321
47338
  };
47322
- })));
47339
+ })), [
47340
+ // Auth via the logged-in Claude Code CLI — no API key needed. Runs on the
47341
+ // Claude Agent engine (native tools).
47342
+ {
47343
+ value: "claude-code",
47344
+ label: "Claude Code (CLI) — no API key"
47345
+ }]);
47346
+ }
47347
+
47348
+ /**
47349
+ * The provider to pre-select for a new bot: the user's configured default AI
47350
+ * (its `isDefaultForType`, else the first configured). If none is configured,
47351
+ * fall back to the always-available Claude Code (CLI) — it's the only option in
47352
+ * that case and needs no API key.
47353
+ */
47354
+ function defaultProviderId(providers) {
47355
+ var list = Object.values(providers || {}).filter(function (p) {
47356
+ return p && AI_PROVIDER_TYPES.includes(p.type);
47357
+ });
47358
+ var def = list.find(function (p) {
47359
+ return p.isDefaultForType;
47360
+ }) || list[0];
47361
+ return def ? def.type : "claude-code";
47323
47362
  }
47324
47363
  var APPROVAL_OPTIONS = [{
47325
47364
  value: "ask",
@@ -47378,7 +47417,7 @@ var BotDetail = function BotDetail(_ref) {
47378
47417
  _useState4 = _slicedToArray(_useState3, 2),
47379
47418
  instructions = _useState4[0],
47380
47419
  setInstructions = _useState4[1];
47381
- var _useState5 = useState((bot === null || bot === void 0 ? void 0 : bot.provider) || ""),
47420
+ var _useState5 = useState((bot === null || bot === void 0 ? void 0 : bot.provider) || defaultProviderId(providers)),
47382
47421
  _useState6 = _slicedToArray(_useState5, 2),
47383
47422
  provider = _useState6[0],
47384
47423
  setProvider = _useState6[1];
@@ -47647,12 +47686,17 @@ var BotDetail = function BotDetail(_ref) {
47647
47686
  placeholder: "What should this bot do?",
47648
47687
  rows: 5
47649
47688
  })]
47650
- }), /*#__PURE__*/jsx(SelectInput, {
47651
- label: "Provider",
47652
- value: provider,
47653
- onChange: setProvider,
47654
- options: providerOptionsFrom(providers),
47655
- placeholder: "Default provider"
47689
+ }), /*#__PURE__*/jsxs("div", {
47690
+ className: "flex flex-col gap-1",
47691
+ children: [/*#__PURE__*/jsx(SelectInput, {
47692
+ label: "Provider",
47693
+ value: provider,
47694
+ onChange: setProvider,
47695
+ options: providerOptionsFrom(providers)
47696
+ }), /*#__PURE__*/jsx("span", {
47697
+ className: "text-xs opacity-50",
47698
+ children: "The AI that runs this bot. \"Claude Code (CLI)\" uses your Claude login \u2014 no API key needed."
47699
+ })]
47656
47700
  }), /*#__PURE__*/jsx(SelectInput, {
47657
47701
  label: "Model",
47658
47702
  value: model,