@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.esm.js CHANGED
@@ -2633,11 +2633,22 @@ var ThemeWrapper = function ThemeWrapper(_ref) {
2633
2633
  written.push(name);
2634
2634
  }
2635
2635
  }
2636
+ // Expose the active light/dark variant as a data attribute so the
2637
+ // design system (dash-electron's design.css `[data-mode="light"]`
2638
+ // block) can flip its surface/text tokens to match. Nothing else
2639
+ // keys off this today, so it's purely additive.
2640
+ var prevMode = root.getAttribute("data-mode");
2641
+ root.setAttribute("data-mode", themeVariant);
2636
2642
  return function () {
2637
2643
  for (var _i2 = 0, _written = written; _i2 < _written.length; _i2++) {
2638
2644
  var _name = _written[_i2];
2639
2645
  root.style.removeProperty(_name);
2640
2646
  }
2647
+ if (prevMode === null) {
2648
+ root.removeAttribute("data-mode");
2649
+ } else {
2650
+ root.setAttribute("data-mode", prevMode);
2651
+ }
2641
2652
  };
2642
2653
  }, [chosenTheme, themeVariant]);
2643
2654
 
@@ -29611,6 +29622,21 @@ var ThemeModel = function ThemeModel() {
29611
29622
  cssVarsAll["--".concat(type, "-").concat(shade)] = hex;
29612
29623
  }
29613
29624
  }
29625
+ } else {
29626
+ // Named channel (e.g. "blue"): emit the shade-500 (brand) hex so
29627
+ // the design system's accent tokens — `var(--primary-500)` /
29628
+ // `var(--secondary-500)` in dash-electron's design.css — bind to
29629
+ // named themes too. Previously only hex themes produced cssVars,
29630
+ // so the Aurora accent fell back to a hardcoded default under any
29631
+ // named theme. cssValueFor resolves named colors via
29632
+ // TAILWIND_PALETTE and is variant-independent, so the accent stays
29633
+ // the same brand color in both light and dark (only surfaces flip).
29634
+ // Components still render via Tailwind class strings (bg-blue-700),
29635
+ // so this is purely additive — no named-theme rendering changes.
29636
+ var hex500 = cssValueFor(type, 500, channelValue);
29637
+ if (hex500) {
29638
+ cssVarsAll["--".concat(type, "-500")] = hex500;
29639
+ }
29614
29640
  }
29615
29641
  });
29616
29642
  // Merge base channel vars with per-token override vars (collected
@@ -47320,21 +47346,45 @@ var PROVIDER_LABELS = {
47320
47346
  xai: "xAI"
47321
47347
  };
47322
47348
  var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47323
- function providerOptionsFrom(providers) {
47324
- var present = new Set();
47349
+ function presentProviderTypes(providers) {
47350
+ var present = [];
47325
47351
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
47326
47352
  var p = _Object$values[_i];
47327
- if (p && AI_PROVIDER_TYPES.includes(p.type)) present.add(p.type);
47353
+ if (p && AI_PROVIDER_TYPES.includes(p.type) && !present.includes(p.type)) {
47354
+ present.push(p.type);
47355
+ }
47328
47356
  }
47329
- return [{
47330
- value: "",
47331
- label: "Default provider"
47332
- }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47357
+ return present;
47358
+ }
47359
+ function providerOptionsFrom(providers) {
47360
+ return [].concat(_toConsumableArray(presentProviderTypes(providers).map(function (t) {
47333
47361
  return {
47334
47362
  value: t,
47335
47363
  label: PROVIDER_LABELS[t] || t
47336
47364
  };
47337
- })));
47365
+ })), [
47366
+ // Auth via the logged-in Claude Code CLI — no API key needed. Runs on the
47367
+ // Claude Agent engine (native tools).
47368
+ {
47369
+ value: "claude-code",
47370
+ label: "Claude Code (CLI) — no API key"
47371
+ }]);
47372
+ }
47373
+
47374
+ /**
47375
+ * The provider to pre-select for a new bot: the user's configured default AI
47376
+ * (its `isDefaultForType`, else the first configured). If none is configured,
47377
+ * fall back to the always-available Claude Code (CLI) — it's the only option in
47378
+ * that case and needs no API key.
47379
+ */
47380
+ function defaultProviderId(providers) {
47381
+ var list = Object.values(providers || {}).filter(function (p) {
47382
+ return p && AI_PROVIDER_TYPES.includes(p.type);
47383
+ });
47384
+ var def = list.find(function (p) {
47385
+ return p.isDefaultForType;
47386
+ }) || list[0];
47387
+ return def ? def.type : "claude-code";
47338
47388
  }
47339
47389
  var APPROVAL_OPTIONS = [{
47340
47390
  value: "ask",
@@ -47393,7 +47443,7 @@ var BotDetail = function BotDetail(_ref) {
47393
47443
  _useState4 = _slicedToArray(_useState3, 2),
47394
47444
  instructions = _useState4[0],
47395
47445
  setInstructions = _useState4[1];
47396
- var _useState5 = useState((bot === null || bot === void 0 ? void 0 : bot.provider) || ""),
47446
+ var _useState5 = useState((bot === null || bot === void 0 ? void 0 : bot.provider) || defaultProviderId(providers)),
47397
47447
  _useState6 = _slicedToArray(_useState5, 2),
47398
47448
  provider = _useState6[0],
47399
47449
  setProvider = _useState6[1];
@@ -47662,12 +47712,17 @@ var BotDetail = function BotDetail(_ref) {
47662
47712
  placeholder: "What should this bot do?",
47663
47713
  rows: 5
47664
47714
  })]
47665
- }), /*#__PURE__*/jsx(SelectInput, {
47666
- label: "Provider",
47667
- value: provider,
47668
- onChange: setProvider,
47669
- options: providerOptionsFrom(providers),
47670
- placeholder: "Default provider"
47715
+ }), /*#__PURE__*/jsxs("div", {
47716
+ className: "flex flex-col gap-1",
47717
+ children: [/*#__PURE__*/jsx(SelectInput, {
47718
+ label: "Provider",
47719
+ value: provider,
47720
+ onChange: setProvider,
47721
+ options: providerOptionsFrom(providers)
47722
+ }), /*#__PURE__*/jsx("span", {
47723
+ className: "text-xs opacity-50",
47724
+ children: "The AI that runs this bot. \"Claude Code (CLI)\" uses your Claude login \u2014 no API key needed."
47725
+ })]
47671
47726
  }), /*#__PURE__*/jsx(SelectInput, {
47672
47727
  label: "Model",
47673
47728
  value: model,