ccstatusline 2.0.2 → 2.0.3

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.
@@ -51035,7 +51035,7 @@ import { execSync as execSync3 } from "child_process";
51035
51035
  import * as fs5 from "fs";
51036
51036
  import * as path4 from "path";
51037
51037
  var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
51038
- var PACKAGE_VERSION = "2.0.2";
51038
+ var PACKAGE_VERSION = "2.0.3";
51039
51039
  function getPackageVersion() {
51040
51040
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51041
51041
  return PACKAGE_VERSION;
@@ -52963,7 +52963,6 @@ var import_react30 = __toESM(require_react(), 1);
52963
52963
  var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
52964
52964
 
52965
52965
  class CustomCommandWidget {
52966
- currentAction = "edit-command";
52967
52966
  getDefaultColor() {
52968
52967
  return "white";
52969
52968
  }
@@ -52992,9 +52991,6 @@ class CustomCommandWidget {
52992
52991
  modifierText: modifiers.length > 0 ? `(${modifiers.join(", ")})` : undefined
52993
52992
  };
52994
52993
  }
52995
- setEditorAction(action) {
52996
- this.currentAction = action;
52997
- }
52998
52994
  handleEditorAction(action, item) {
52999
52995
  if (action === "toggle-preserve") {
53000
52996
  return { ...item, preserveColors: !item.preserveColors };
@@ -53052,8 +53048,7 @@ class CustomCommandWidget {
53052
53048
  }
53053
53049
  renderEditor(props) {
53054
53050
  return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(CustomCommandEditor, {
53055
- ...props,
53056
- action: this.currentAction
53051
+ ...props
53057
53052
  }, undefined, false, undefined, this);
53058
53053
  }
53059
53054
  supportsRawValue() {
@@ -54647,12 +54642,11 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
54647
54642
  const newWidgets = [...widgets];
54648
54643
  newWidgets[selectedIndex] = updatedWidget;
54649
54644
  onUpdate(newWidgets);
54645
+ } else if (widgetImpl.renderEditor) {
54646
+ setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl, action: matchedKeybind.action });
54650
54647
  }
54651
54648
  } else if (widgetImpl.renderEditor) {
54652
- if (widgetImpl.setEditorAction) {
54653
- widgetImpl.setEditorAction(matchedKeybind.action);
54654
- }
54655
- setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl });
54649
+ setCustomEditorWidget({ widget: currentWidget2, impl: widgetImpl, action: matchedKeybind.action });
54656
54650
  }
54657
54651
  }
54658
54652
  }
@@ -54710,7 +54704,8 @@ var ItemsEditor = ({ widgets, onUpdate, onBack, lineNumber, settings }) => {
54710
54704
  return customEditorWidget.impl.renderEditor({
54711
54705
  widget: customEditorWidget.widget,
54712
54706
  onComplete: handleEditorComplete,
54713
- onCancel: handleEditorCancel
54707
+ onCancel: handleEditorCancel,
54708
+ action: customEditorWidget.action
54714
54709
  });
54715
54710
  }
54716
54711
  return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
@@ -57931,7 +57926,7 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
57931
57926
  if (!mostRecentTimestamp) {
57932
57927
  return null;
57933
57928
  }
57934
- let blockStartTimestamp = mostRecentTimestamp;
57929
+ let actualStartTimestamp = mostRecentTimestamp;
57935
57930
  for (let i = 1;i < timestamps.length; i++) {
57936
57931
  const currentTimestamp = timestamps[i];
57937
57932
  const previousTimestamp = timestamps[i - 1];
@@ -57942,14 +57937,11 @@ function findMostRecentBlockStartTime(rootDir, sessionDurationHours = 5) {
57942
57937
  if (gap > sessionDurationMs) {
57943
57938
  break;
57944
57939
  }
57945
- const timeFromMostRecent = mostRecentTimestamp.getTime() - currentTimestamp.getTime();
57946
- if (timeFromMostRecent < sessionDurationMs) {
57947
- blockStartTimestamp = currentTimestamp;
57948
- } else {
57949
- break;
57950
- }
57940
+ actualStartTimestamp = currentTimestamp;
57951
57941
  }
57952
- const blockStart = floorToHour(blockStartTimestamp);
57942
+ const elapsedSinceStart = now.getTime() - actualStartTimestamp.getTime();
57943
+ const timeInCurrentBlock = elapsedSinceStart % sessionDurationMs;
57944
+ const blockStart = new Date(now.getTime() - timeInCurrentBlock);
57953
57945
  const timeSinceActivity = now.getTime() - mostRecentTimestamp.getTime();
57954
57946
  const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
57955
57947
  const isActive = timeSinceActivity < sessionDurationMs && now < blockEnd;
@@ -57983,11 +57975,6 @@ function getAllTimestampsFromFile(filePath) {
57983
57975
  return [];
57984
57976
  }
57985
57977
  }
57986
- function floorToHour(timestamp) {
57987
- const floored = new Date(timestamp);
57988
- floored.setUTCMinutes(0, 0, 0);
57989
- return floored;
57990
- }
57991
57978
 
57992
57979
  // src/ccstatusline.ts
57993
57980
  async function readStdin() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",