@trops/dash-core 0.1.634 → 0.1.636

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
@@ -2651,11 +2651,22 @@ var ThemeWrapper = function ThemeWrapper(_ref) {
2651
2651
  written.push(name);
2652
2652
  }
2653
2653
  }
2654
+ // Expose the active light/dark variant as a data attribute so the
2655
+ // design system (dash-electron's design.css `[data-mode="light"]`
2656
+ // block) can flip its surface/text tokens to match. Nothing else
2657
+ // keys off this today, so it's purely additive.
2658
+ var prevMode = root.getAttribute("data-mode");
2659
+ root.setAttribute("data-mode", themeVariant);
2654
2660
  return function () {
2655
2661
  for (var _i2 = 0, _written = written; _i2 < _written.length; _i2++) {
2656
2662
  var _name = _written[_i2];
2657
2663
  root.style.removeProperty(_name);
2658
2664
  }
2665
+ if (prevMode === null) {
2666
+ root.removeAttribute("data-mode");
2667
+ } else {
2668
+ root.setAttribute("data-mode", prevMode);
2669
+ }
2659
2670
  };
2660
2671
  }, [chosenTheme, themeVariant]);
2661
2672
 
@@ -29629,6 +29640,21 @@ var ThemeModel = function ThemeModel() {
29629
29640
  cssVarsAll["--".concat(type, "-").concat(shade)] = hex;
29630
29641
  }
29631
29642
  }
29643
+ } else {
29644
+ // Named channel (e.g. "blue"): emit the shade-500 (brand) hex so
29645
+ // the design system's accent tokens — `var(--primary-500)` /
29646
+ // `var(--secondary-500)` in dash-electron's design.css — bind to
29647
+ // named themes too. Previously only hex themes produced cssVars,
29648
+ // so the Aurora accent fell back to a hardcoded default under any
29649
+ // named theme. cssValueFor resolves named colors via
29650
+ // TAILWIND_PALETTE and is variant-independent, so the accent stays
29651
+ // the same brand color in both light and dark (only surfaces flip).
29652
+ // Components still render via Tailwind class strings (bg-blue-700),
29653
+ // so this is purely additive — no named-theme rendering changes.
29654
+ var hex500 = cssValueFor(type, 500, channelValue);
29655
+ if (hex500) {
29656
+ cssVarsAll["--".concat(type, "-500")] = hex500;
29657
+ }
29632
29658
  }
29633
29659
  });
29634
29660
  // Merge base channel vars with per-token override vars (collected
@@ -47338,21 +47364,45 @@ var PROVIDER_LABELS = {
47338
47364
  xai: "xAI"
47339
47365
  };
47340
47366
  var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47341
- function providerOptionsFrom(providers) {
47342
- var present = new Set();
47367
+ function presentProviderTypes(providers) {
47368
+ var present = [];
47343
47369
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
47344
47370
  var p = _Object$values[_i];
47345
- if (p && AI_PROVIDER_TYPES.includes(p.type)) present.add(p.type);
47371
+ if (p && AI_PROVIDER_TYPES.includes(p.type) && !present.includes(p.type)) {
47372
+ present.push(p.type);
47373
+ }
47346
47374
  }
47347
- return [{
47348
- value: "",
47349
- label: "Default provider"
47350
- }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47375
+ return present;
47376
+ }
47377
+ function providerOptionsFrom(providers) {
47378
+ return [].concat(_toConsumableArray(presentProviderTypes(providers).map(function (t) {
47351
47379
  return {
47352
47380
  value: t,
47353
47381
  label: PROVIDER_LABELS[t] || t
47354
47382
  };
47355
- })));
47383
+ })), [
47384
+ // Auth via the logged-in Claude Code CLI — no API key needed. Runs on the
47385
+ // Claude Agent engine (native tools).
47386
+ {
47387
+ value: "claude-code",
47388
+ label: "Claude Code (CLI) — no API key"
47389
+ }]);
47390
+ }
47391
+
47392
+ /**
47393
+ * The provider to pre-select for a new bot: the user's configured default AI
47394
+ * (its `isDefaultForType`, else the first configured). If none is configured,
47395
+ * fall back to the always-available Claude Code (CLI) — it's the only option in
47396
+ * that case and needs no API key.
47397
+ */
47398
+ function defaultProviderId(providers) {
47399
+ var list = Object.values(providers || {}).filter(function (p) {
47400
+ return p && AI_PROVIDER_TYPES.includes(p.type);
47401
+ });
47402
+ var def = list.find(function (p) {
47403
+ return p.isDefaultForType;
47404
+ }) || list[0];
47405
+ return def ? def.type : "claude-code";
47356
47406
  }
47357
47407
  var APPROVAL_OPTIONS = [{
47358
47408
  value: "ask",
@@ -47411,7 +47461,7 @@ var BotDetail = function BotDetail(_ref) {
47411
47461
  _useState4 = _slicedToArray(_useState3, 2),
47412
47462
  instructions = _useState4[0],
47413
47463
  setInstructions = _useState4[1];
47414
- var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || ""),
47464
+ var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || defaultProviderId(providers)),
47415
47465
  _useState6 = _slicedToArray(_useState5, 2),
47416
47466
  provider = _useState6[0],
47417
47467
  setProvider = _useState6[1];
@@ -47680,12 +47730,17 @@ var BotDetail = function BotDetail(_ref) {
47680
47730
  placeholder: "What should this bot do?",
47681
47731
  rows: 5
47682
47732
  })]
47683
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47684
- label: "Provider",
47685
- value: provider,
47686
- onChange: setProvider,
47687
- options: providerOptionsFrom(providers),
47688
- placeholder: "Default provider"
47733
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47734
+ className: "flex flex-col gap-1",
47735
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47736
+ label: "Provider",
47737
+ value: provider,
47738
+ onChange: setProvider,
47739
+ options: providerOptionsFrom(providers)
47740
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
47741
+ className: "text-xs opacity-50",
47742
+ children: "The AI that runs this bot. \"Claude Code (CLI)\" uses your Claude login \u2014 no API key needed."
47743
+ })]
47689
47744
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47690
47745
  label: "Model",
47691
47746
  value: model,