@gamflaz/opencode-todolist 1.0.11 → 1.0.12

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.
@@ -10,15 +10,16 @@ import { createElement as _$createElement } from "@opentui/solid";
10
10
  import { usePlugin } from "@opencode/plugin/tui";
11
11
  import { rgbToHex } from "@opentui/core";
12
12
  import { Resvg } from "@resvg/resvg-js";
13
- import { createMemo, createSignal, onCleanup, Show } from "solid-js";
13
+ import { createMemo, createSignal, onCleanup, Show, splitProps } from "solid-js";
14
14
  import { supportsImageRendering } from "./image-capabilities.js";
15
15
  export function SvgIcon(props) {
16
- const {
17
- source: _,
18
- color: __,
19
- fallback,
20
- ...prop
21
- } = props;
16
+ // Solid props are getters. Destructuring them reads each value exactly once
17
+ // at creation time, which freezes the prop instead of tracking it. That made
18
+ // the collapsed `▶` / expanded `▼` fallback glyph stick on terminals without
19
+ // image support, where the text fallback is the branch that renders.
20
+ // splitProps keeps every accessor live while still separating the props this
21
+ // component consumes from the ones forwarded to the rendered element.
22
+ const [local, rest] = splitProps(props, ["source", "color", "fallback"]);
22
23
  const context = usePlugin();
23
24
  const [imageSupported, setImageSupported] = createSignal(supportsImageRendering(context.renderer.capabilities));
24
25
  const updateImageSupport = capabilities => {
@@ -26,11 +27,11 @@ export function SvgIcon(props) {
26
27
  };
27
28
  context.renderer.on("capabilities", updateImageSupport);
28
29
  onCleanup(() => context.renderer.off("capabilities", updateImageSupport));
29
- const iconColor = () => props.color ? typeof props.color === "string" ? props.color : rgbToHex(props.color) : "currentColor";
30
+ const iconColor = () => local.color ? typeof local.color === "string" ? local.color : rgbToHex(local.color) : "currentColor";
30
31
  const pngBuffer = createMemo(() => {
31
32
  const bgToken = context.theme.background.base;
32
33
  const bg = rgbToHex(bgToken);
33
- let svg = props.source.replace(/stroke="[^"]*"/g, `stroke="${iconColor()}"`).replace(/color="[^"]*"/g, `color="${iconColor()}"`);
34
+ let svg = local.source.replace(/stroke="[^"]*"/g, `stroke="${iconColor()}"`).replace(/color="[^"]*"/g, `color="${iconColor()}"`);
34
35
  const resvg = new Resvg(svg, {
35
36
  fitTo: {
36
37
  mode: "width",
@@ -49,7 +50,7 @@ export function SvgIcon(props) {
49
50
  var _el$2 = _$createElement("text"),
50
51
  _el$3 = _$createElement("span");
51
52
  _$insertNode(_el$2, _el$3);
52
- _$insert(_el$3, fallback);
53
+ _$insert(_el$3, () => local.fallback);
53
54
  _$effect(_$p => _$setProp(_el$3, "style", {
54
55
  fg: iconColor()
55
56
  }, _$p));
@@ -68,7 +69,7 @@ export function SvgIcon(props) {
68
69
  get height() {
69
70
  return props.height ?? 1;
70
71
  }
71
- }, prop), false);
72
+ }, rest), false);
72
73
  return _el$;
73
74
  }
74
75
  });
@@ -382,9 +382,9 @@ function watchSessionTodos(sessionID, onChange) {
382
382
  });
383
383
  }
384
384
  export function TodoProgress(props) {
385
- const {
386
- context
387
- } = props;
385
+ // `context` is a stable reference for the lifetime of the plugin, so reading
386
+ // it once is safe. Reactive props below are read through accessors instead.
387
+ const context = props.context;
388
388
  const sessionID = () => props.sessionID ?? "";
389
389
  const theme = () => context.theme;
390
390
  const [refresh, setRefresh] = createSignal(0);
@@ -562,7 +562,7 @@ export function TodoProgress(props) {
562
562
  _$setProp(_el$17, "flexGrow", 1);
563
563
  _$setProp(_el$17, "onMouseDown", e => {
564
564
  if (e.button === 0) {
565
- e.stopPropagation?.();
565
+ e.stopPropagation();
566
566
  setIsCollapsed(v => !v);
567
567
  }
568
568
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamflaz/opencode-todolist",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Hierarchical todo list plugin for OpenCode with a real-time TUI widget.",
5
5
  "type": "module",
6
6
  "files": [
@@ -45,7 +45,8 @@
45
45
  "compile": "bun run build && node scripts/build-jsx.mjs",
46
46
  "build:jsx": "node scripts/build-jsx.mjs",
47
47
  "dev": "tsc-watch -p tsconfig.build.json --onSuccess \"node scripts/build-jsx.mjs\"",
48
- "test": "bun test/todo.test.ts",
48
+ "test": "bun test/icon.test.ts && bun test/skill.test.ts && bun test/skill.folder.test.ts",
49
+ "test:todo": "bun test/todo.test.ts",
49
50
  "typecheck": "tsc --noEmit",
50
51
  "check": "bun run typecheck && bun run test",
51
52
  "update": "git pull && bun run check && bun run compile"