@nice-code/state 0.4.2 → 0.4.4

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.
@@ -1,7 +1,10 @@
1
1
  /**
2
- * Test-framework-style diff: only the paths that changed, with removed values in
3
- * error red on a `−` line and added values in success green on a `+` line. A
4
- * `changed` entry renders both lines so old new reads top-to-bottom.
2
+ * Test-framework-style diff: only the paths that changed. Changed paths are
3
+ * grouped into a hierarchy by their shared parents `countHistory.0` and
4
+ * `countHistory.1` nest under a single `countHistory` node, each shown by its
5
+ * direct key only. Single-child chains collapse to a dotted path (`a.b.c`) so
6
+ * lone deep changes stay on one line. Short values render inline with the key
7
+ * (`count: 0 → 1`); long ones keep the removed/added line block.
5
8
  */
6
9
  export declare function DiffView({ before, after }: {
7
10
  before: unknown;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Unified, git-style diff of the entire state snapshot. Both sides are rendered
3
+ * as pretty JSON and line-diffed, so unchanged structure stays visible for
4
+ * context while removed lines (red, `−`) and added lines (green, `+`) call out
5
+ * exactly which sections of the whole state moved.
6
+ */
7
+ export declare function JsonDiffView({ before, after }: {
8
+ before: unknown;
9
+ after: unknown;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ /**
12
+ * The full JSON of one snapshot with the lines that differ from the other side
13
+ * highlighted in place — red behind removed lines on the "before" side, green
14
+ * behind added lines on the "after" side. Lines common to both render plainly so
15
+ * the highlight reads as "here is what changed within the whole state".
16
+ */
17
+ export declare function HighlightedJsonView({ before, after, side, }: {
18
+ before: unknown;
19
+ after: unknown;
20
+ side: "before" | "after";
21
+ }): import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,7 @@ export declare function summarizeChange(change: IDevtoolsStateChange): string;
16
16
  export type TDiffKind = "added" | "removed" | "changed";
17
17
  export interface IDiffEntry {
18
18
  path: string;
19
+ segments: (string | number)[];
19
20
  kind: TDiffKind;
20
21
  before?: unknown;
21
22
  after?: unknown;
@@ -27,3 +28,15 @@ export interface IDiffEntry {
27
28
  * means equal branches keep their reference, so this stays cheap).
28
29
  */
29
30
  export declare function computeDiff(before: unknown, after: unknown): IDiffEntry[];
31
+ export type TLineDiffKind = "common" | "removed" | "added";
32
+ export interface ILineDiffOp {
33
+ kind: TLineDiffKind;
34
+ text: string;
35
+ }
36
+ /**
37
+ * Classic LCS line diff between two blocks of text — the data behind the unified
38
+ * git-style "Diff View" and the per-line highlighting in the Before / After
39
+ * panels. Snapshots rendered as pretty JSON stay small, so the O(n·m) table is
40
+ * comfortably cheap.
41
+ */
42
+ export declare function computeLineDiff(beforeText: string, afterText: string): ILineDiffOp[];
@@ -23,6 +23,13 @@ export interface IDockDevtoolInput extends IDockDevtoolSync {
23
23
  export interface IDockView {
24
24
  /** Offset (px) from the docked edge — stacks open panels on the same side. */
25
25
  dockOffset: number;
26
+ /**
27
+ * True when this panel shares its dock side with another open panel (stacked
28
+ * either nearer or further from the edge). Stacked panels square off all their
29
+ * corners so they sit flush as one continuous block — only a panel alone on
30
+ * its side keeps its rounded, page-facing corners.
31
+ */
32
+ stacked: boolean;
26
33
  /** Is any devtool on the page currently open? */
27
34
  anyOpen: boolean;
28
35
  /** First-registered devtool — the one that renders the combined launcher. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-code/state",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {