pi-studio 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/index.ts +14 -11
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -1569,8 +1569,8 @@ function buildStudioHtml(initialDocument: InitialStudioDocument | null, theme?:
1569
1569
  <button id="sendEditorBtn" type="button">Send to pi editor</button>
1570
1570
  <button id="copyDraftBtn" type="button">Copy editor text</button>
1571
1571
  <select id="highlightSelect" aria-label="Editor syntax highlighting">
1572
- <option value="off" selected>Highlight markdown: Off</option>
1573
- <option value="on">Highlight markdown: On</option>
1572
+ <option value="off">Highlight markdown: Off</option>
1573
+ <option value="on" selected>Highlight markdown: On</option>
1574
1574
  </select>
1575
1575
  </div>
1576
1576
  </div>
@@ -1595,8 +1595,8 @@ function buildStudioHtml(initialDocument: InitialStudioDocument | null, theme?:
1595
1595
  <option value="off">Auto-update response: Off</option>
1596
1596
  </select>
1597
1597
  <select id="responseHighlightSelect" aria-label="Response markdown highlighting">
1598
- <option value="off" selected>Highlight markdown: Off</option>
1599
- <option value="on">Highlight markdown: On</option>
1598
+ <option value="off">Highlight markdown: Off</option>
1599
+ <option value="on" selected>Highlight markdown: On</option>
1600
1600
  </select>
1601
1601
  <button id="pullLatestBtn" type="button" title="Fetch the latest assistant response when auto-update is off.">Get latest response</button>
1602
1602
  <button id="loadResponseBtn" type="button">Load response into editor</button>
@@ -2454,11 +2454,14 @@ function buildStudioHtml(initialDocument: InitialStudioDocument | null, theme?:
2454
2454
  }
2455
2455
 
2456
2456
  function readStoredToggle(storageKey) {
2457
- if (!window.localStorage) return false;
2457
+ if (!window.localStorage) return null;
2458
2458
  try {
2459
- return window.localStorage.getItem(storageKey) === "on";
2459
+ const value = window.localStorage.getItem(storageKey);
2460
+ if (value === "on") return true;
2461
+ if (value === "off") return false;
2462
+ return null;
2460
2463
  } catch {
2461
- return false;
2464
+ return null;
2462
2465
  }
2463
2466
  }
2464
2467
 
@@ -3232,12 +3235,12 @@ function buildStudioHtml(initialDocument: InitialStudioDocument | null, theme?:
3232
3235
  refreshResponseUi();
3233
3236
  setActivePane("left");
3234
3237
 
3235
- const initialHighlightEnabled = readStoredEditorHighlightEnabled()
3236
- || Boolean(highlightSelect && highlightSelect.value === "on");
3238
+ const storedEditorHighlightEnabled = readStoredEditorHighlightEnabled();
3239
+ const initialHighlightEnabled = storedEditorHighlightEnabled ?? Boolean(highlightSelect && highlightSelect.value === "on");
3237
3240
  setEditorHighlightEnabled(initialHighlightEnabled);
3238
3241
 
3239
- const initialResponseHighlightEnabled = readStoredResponseHighlightEnabled()
3240
- || Boolean(responseHighlightSelect && responseHighlightSelect.value === "on");
3242
+ const storedResponseHighlightEnabled = readStoredResponseHighlightEnabled();
3243
+ const initialResponseHighlightEnabled = storedResponseHighlightEnabled ?? Boolean(responseHighlightSelect && responseHighlightSelect.value === "on");
3241
3244
  setResponseHighlightEnabled(initialResponseHighlightEnabled);
3242
3245
 
3243
3246
  setEditorView(editorView);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Browser GUI for structured critique workflows in pi",
5
5
  "type": "module",
6
6
  "license": "MIT",