@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.js CHANGED
@@ -38682,14 +38682,17 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref11) {
38682
38682
  }
38683
38683
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
38684
38684
  className: "flex flex-col gap-4 p-6 flex-1 min-h-0 overflow-hidden",
38685
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
38686
- value: wizardName,
38687
- onChange: function onChange(val) {
38688
- return setWizardName(val);
38689
- },
38690
- placeholder: "Theme name..."
38685
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
38686
+ className: "shrink-0",
38687
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
38688
+ value: wizardName,
38689
+ onChange: function onChange(val) {
38690
+ return setWizardName(val);
38691
+ },
38692
+ placeholder: "Theme name..."
38693
+ })
38691
38694
  }), showMethodPicker && /*#__PURE__*/jsxRuntime.jsxs("div", {
38692
- className: "flex flex-col gap-2",
38695
+ className: "flex flex-col gap-2 shrink-0",
38693
38696
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
38694
38697
  className: "text-sm font-semibold opacity-50",
38695
38698
  children: "Generation Method"
@@ -38729,33 +38732,39 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref11) {
38729
38732
  }
38730
38733
  })]
38731
38734
  })]
38732
- }), wizardMethod === "presets" && /*#__PURE__*/jsxRuntime.jsx(PresetGallery, {
38733
- onSelect: function onSelect(preset) {
38734
- return setWizardTheme(preset);
38735
- },
38736
- selectedPresetId: wizardTheme === null || wizardTheme === void 0 ? void 0 : wizardTheme.name,
38737
- inline: true
38738
- }), wizardMethod === "random" && /*#__PURE__*/jsxRuntime.jsx(RandomPreview, {
38739
- onCommit: function onCommit(theme) {
38740
- return setWizardTheme(theme);
38741
- }
38742
- }), wizardMethod === "color" && /*#__PURE__*/jsxRuntime.jsx(ColorHarmonyPicker, {
38743
- onGenerate: function onGenerate(theme) {
38744
- return setWizardTheme(theme);
38745
- },
38746
- inline: true
38747
- }), wizardMethod === "from-url" && onExtract && /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeFromUrlPane, {
38748
- onExtract: onExtract,
38749
- onMapToTheme: onMapToTheme,
38750
- onGenerate: function onGenerate(theme) {
38751
- return setWizardTheme(theme);
38752
- },
38753
- inline: true
38754
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
38755
- title: "Create Theme",
38756
- onClick: onComplete,
38757
- disabled: !canCreate,
38758
- block: true
38735
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
38736
+ className: "flex-1 min-h-0 overflow-y-auto",
38737
+ children: [wizardMethod === "presets" && /*#__PURE__*/jsxRuntime.jsx(PresetGallery, {
38738
+ onSelect: function onSelect(preset) {
38739
+ return setWizardTheme(preset);
38740
+ },
38741
+ selectedPresetId: wizardTheme === null || wizardTheme === void 0 ? void 0 : wizardTheme.name,
38742
+ inline: true
38743
+ }), wizardMethod === "random" && /*#__PURE__*/jsxRuntime.jsx(RandomPreview, {
38744
+ onCommit: function onCommit(theme) {
38745
+ return setWizardTheme(theme);
38746
+ }
38747
+ }), wizardMethod === "color" && /*#__PURE__*/jsxRuntime.jsx(ColorHarmonyPicker, {
38748
+ onGenerate: function onGenerate(theme) {
38749
+ return setWizardTheme(theme);
38750
+ },
38751
+ inline: true
38752
+ }), wizardMethod === "from-url" && onExtract && /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeFromUrlPane, {
38753
+ onExtract: onExtract,
38754
+ onMapToTheme: onMapToTheme,
38755
+ onGenerate: function onGenerate(theme) {
38756
+ return setWizardTheme(theme);
38757
+ },
38758
+ inline: true
38759
+ })]
38760
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
38761
+ className: "shrink-0",
38762
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
38763
+ title: "Create Theme",
38764
+ onClick: onComplete,
38765
+ disabled: !canCreate,
38766
+ block: true
38767
+ })
38759
38768
  })]
38760
38769
  });
38761
38770
  };
@@ -39616,6 +39625,10 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39616
39625
  _useState10 = _slicedToArray(_useState1, 2),
39617
39626
  isChoosingMode = _useState10[0],
39618
39627
  setIsChoosingMode = _useState10[1];
39628
+ // `startInCreate` should auto-open the chooser ONCE per modal open. Without
39629
+ // this guard the effect re-fires after a theme is created (themes change →
39630
+ // isCreating flips false) and bounces the user back to the chooser.
39631
+ var startInCreateHandledRef = React.useRef(false);
39619
39632
  var _useState11 = React.useState(false),
39620
39633
  _useState12 = _slicedToArray(_useState11, 2),
39621
39634
  isSearching = _useState12[0],
@@ -39652,6 +39665,7 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39652
39665
  setIsChoosingMode(false);
39653
39666
  setIsSearching(false);
39654
39667
  setSelectedMethod(null);
39668
+ startInCreateHandledRef.current = false;
39655
39669
  } else {
39656
39670
  if (themeKeySelected === null && themes) {
39657
39671
  var themeKeyTemp = settings && "theme" in settings ? settings["theme"] in themes ? settings["theme"] : Object.keys(themes)[0] : Object.keys(themes)[0];
@@ -39666,7 +39680,8 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
39666
39680
  return rawThemes[themeKeyTemp];
39667
39681
  });
39668
39682
  }
39669
- if (startInCreate && !isChoosingMode && !isCreating) {
39683
+ if (startInCreate && !startInCreateHandledRef.current && !isChoosingMode && !isCreating) {
39684
+ startInCreateHandledRef.current = true;
39670
39685
  setIsChoosingMode(true);
39671
39686
  setIsCreating(false);
39672
39687
  setIsSearching(false);
@@ -47323,21 +47338,45 @@ var PROVIDER_LABELS = {
47323
47338
  xai: "xAI"
47324
47339
  };
47325
47340
  var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47326
- function providerOptionsFrom(providers) {
47327
- var present = new Set();
47341
+ function presentProviderTypes(providers) {
47342
+ var present = [];
47328
47343
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
47329
47344
  var p = _Object$values[_i];
47330
- if (p && AI_PROVIDER_TYPES.includes(p.type)) present.add(p.type);
47345
+ if (p && AI_PROVIDER_TYPES.includes(p.type) && !present.includes(p.type)) {
47346
+ present.push(p.type);
47347
+ }
47331
47348
  }
47332
- return [{
47333
- value: "",
47334
- label: "Default provider"
47335
- }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47349
+ return present;
47350
+ }
47351
+ function providerOptionsFrom(providers) {
47352
+ return [].concat(_toConsumableArray(presentProviderTypes(providers).map(function (t) {
47336
47353
  return {
47337
47354
  value: t,
47338
47355
  label: PROVIDER_LABELS[t] || t
47339
47356
  };
47340
- })));
47357
+ })), [
47358
+ // Auth via the logged-in Claude Code CLI — no API key needed. Runs on the
47359
+ // Claude Agent engine (native tools).
47360
+ {
47361
+ value: "claude-code",
47362
+ label: "Claude Code (CLI) — no API key"
47363
+ }]);
47364
+ }
47365
+
47366
+ /**
47367
+ * The provider to pre-select for a new bot: the user's configured default AI
47368
+ * (its `isDefaultForType`, else the first configured). If none is configured,
47369
+ * fall back to the always-available Claude Code (CLI) — it's the only option in
47370
+ * that case and needs no API key.
47371
+ */
47372
+ function defaultProviderId(providers) {
47373
+ var list = Object.values(providers || {}).filter(function (p) {
47374
+ return p && AI_PROVIDER_TYPES.includes(p.type);
47375
+ });
47376
+ var def = list.find(function (p) {
47377
+ return p.isDefaultForType;
47378
+ }) || list[0];
47379
+ return def ? def.type : "claude-code";
47341
47380
  }
47342
47381
  var APPROVAL_OPTIONS = [{
47343
47382
  value: "ask",
@@ -47396,7 +47435,7 @@ var BotDetail = function BotDetail(_ref) {
47396
47435
  _useState4 = _slicedToArray(_useState3, 2),
47397
47436
  instructions = _useState4[0],
47398
47437
  setInstructions = _useState4[1];
47399
- var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || ""),
47438
+ var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || defaultProviderId(providers)),
47400
47439
  _useState6 = _slicedToArray(_useState5, 2),
47401
47440
  provider = _useState6[0],
47402
47441
  setProvider = _useState6[1];
@@ -47665,12 +47704,17 @@ var BotDetail = function BotDetail(_ref) {
47665
47704
  placeholder: "What should this bot do?",
47666
47705
  rows: 5
47667
47706
  })]
47668
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47669
- label: "Provider",
47670
- value: provider,
47671
- onChange: setProvider,
47672
- options: providerOptionsFrom(providers),
47673
- placeholder: "Default provider"
47707
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47708
+ className: "flex flex-col gap-1",
47709
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47710
+ label: "Provider",
47711
+ value: provider,
47712
+ onChange: setProvider,
47713
+ options: providerOptionsFrom(providers)
47714
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
47715
+ className: "text-xs opacity-50",
47716
+ children: "The AI that runs this bot. \"Claude Code (CLI)\" uses your Claude login \u2014 no API key needed."
47717
+ })]
47674
47718
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47675
47719
  label: "Model",
47676
47720
  value: model,