json-diff-viewer-component 0.1.0 → 0.1.1

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/README.md +50 -37
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,21 @@
1
- # json-diff-viewer
2
-
3
- **Compare JSON side-by-side, visually**
4
-
5
- A zero-dependency web component for visualizing JSON differences with synchronized scrolling, collapsible nodes, and syntax highlighting. Perfect for debugging, API comparisons, and configuration diffs
1
+ <div align="center">
2
+ <img src="public/logo.svg" alt="logo" height="128" />
3
+ <h2>json-diff-viewer</h2>
4
+ <h5>
5
+ Compare JSON side-by-side, visually
6
+ </h5>
7
+ <p>
8
+ A zero-dependency web component for visualizing JSON differences
9
+ <br>
10
+ with synchronized scrolling, collapsible nodes, and syntax highlighting
11
+ <br>
12
+ Perfect for debugging, API comparisons, and configuration diffs
13
+ </p>
14
+ <img src="public/screenshot.png" alt="demo" width="80%" />
15
+ <h5>
16
+ <a href="https://metaory.github.io/json-diff-viewer-component/" target="_blank">metaory.github.io/json-diff-viewer-component</a>
17
+ </h5>
18
+ </div>
6
19
 
7
20
  ## Features
8
21
 
@@ -101,7 +114,7 @@ watch(
101
114
  viewerRef.value.setData(props.left, props.right);
102
115
  }
103
116
  },
104
- { immediate: true }
117
+ { immediate: true },
105
118
  );
106
119
  </script>
107
120
  ```
@@ -119,52 +132,52 @@ watch(
119
132
 
120
133
  ## Styling
121
134
 
122
- Override CSS custom properties:
135
+ Customize the component by overriding CSS custom properties (design tokens) on the `json-diff-viewer` element. All tokens are defined on `:host` and can be overridden from outside the shadow DOM.
136
+
137
+ ### Design Tokens
123
138
 
124
139
  ```css
125
140
  json-diff-viewer {
126
141
  /* Diff colors */
127
- --added: #22c55e;
128
- --removed: #ef4444;
129
- --modified: #eab308;
130
- --type-changed: #f97316;
131
- --unchanged: #71717a;
142
+ --add: #22c55e; /* Added items */
143
+ --rem: #ef4444; /* Removed items */
144
+ --mod: #eab308; /* Modified items */
145
+ --typ: #f97316; /* Type changed items */
146
+
147
+ /* Backgrounds */
148
+ --bg: #18181b; /* Main background */
149
+ --bg2: #27272a; /* Panel background */
132
150
 
133
- /* Background */
134
- --bg: #18181b;
135
- --bg-panel: #27272a;
136
- --border: #3f3f46;
151
+ /* Borders */
152
+ --bdr: #3f3f46; /* Border color */
137
153
 
138
154
  /* Text */
139
- --text: #fafafa;
140
- --text-dim: #a1a1aa;
141
-
142
- /* Syntax */
143
- --key: #38bdf8;
144
- --string: #a78bfa;
145
- --number: #34d399;
146
- --boolean: #fb923c;
147
- --null: #f472b6;
148
- --bracket: #71717a;
149
-
150
- /* Layout */
151
- --radius: 12px;
152
- --font: "JetBrains Mono", monospace;
155
+ --txt: #fafafa; /* Primary text */
156
+ --dim: #a1a1aa; /* Dimmed/secondary text */
157
+
158
+ /* Syntax highlighting */
159
+ --key: #38bdf8; /* Object keys */
160
+ --str: #a78bfa; /* String values */
161
+ --num: #34d399; /* Number values */
162
+ --bool: #fb923c; /* Boolean values */
163
+ --nul: #f472b6; /* Null values */
164
+ --br: #71717a; /* Brackets and braces */
153
165
  }
154
166
  ```
155
167
 
156
- ### Light Theme
168
+ Create your own theme by overriding these tokens. For example, a light theme:
157
169
 
158
170
  ```css
159
171
  json-diff-viewer {
160
172
  --bg: #fafafa;
161
- --bg-panel: #ffffff;
162
- --border: #e4e4e7;
163
- --text: #18181b;
164
- --text-dim: #71717a;
173
+ --bg2: #ffffff;
174
+ --bdr: #e4e4e7;
175
+ --txt: #18181b;
176
+ --dim: #71717a;
165
177
  --key: #0284c7;
166
- --string: #7c3aed;
167
- --number: #059669;
178
+ --str: #7c3aed;
179
+ --num: #059669;
180
+ /* ... override other tokens as needed */
168
181
  }
169
182
  ```
170
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-diff-viewer-component",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Vanilla JS web component for side-by-side JSON diff visualization",
6
6
  "keywords": [