Skip to content

Commit d4f5d72

Browse files
committed
chore(core): delete old dist folder
1 parent e61bd58 commit d4f5d72

File tree

6 files changed

+94
-111
lines changed

6 files changed

+94
-111
lines changed

eslint.config.mjs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
import pluginJs from "@eslint/js"
1+
import js from "@eslint/js"
22
import typescript from "@typescript-eslint/eslint-plugin"
3+
import typescriptParser from "@typescript-eslint/parser"
4+
import globals from "globals"
35

46
export default [
7+
js.configs.recommended,
58
{
6-
files: ["**/*.{ts,tsx}"],
9+
files: ["**/*.{ts,js}"],
10+
languageOptions: {
11+
parser: typescriptParser,
12+
parserOptions: {
13+
ecmaVersion: "latest",
14+
sourceType: "module",
15+
},
16+
globals: {
17+
// Web Components globals
18+
...globals.browser,
19+
customElements: "readonly",
20+
HTMLElement: "readonly",
21+
CustomEvent: "readonly",
22+
ShadowRoot: "readonly",
23+
},
24+
},
725
plugins: {
826
"@typescript-eslint": typescript,
927
},
10-
28+
},
29+
{
1130
ignores: ["**/dist/*"],
1231
},
1332
]

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
"@eslint/js": "^9.32.0",
5151
"@types/node": "^22.14.1",
5252
"@typescript-eslint/eslint-plugin": "^8.38.0",
53+
"@typescript-eslint/parser": "^8.38.0",
54+
"globals": "^16.3.0",
5355
"jsdom": "^26.1.0",
56+
"prettier": "^3.6.2",
5457
"typescript": "~5.7.2",
5558
"vite": "^6.3.1",
5659
"vitest": "^3.1.1"

pnpm-lock.yaml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package/components/json-viewer.ts

Lines changed: 9 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ export class JsonViewer extends HTMLElement {
3636

3737
// Boolean attributes
3838
get expanded(): boolean {
39-
return (
40-
this.hasAttribute("expanded") && this.getAttribute("expanded") !== "false"
41-
)
39+
return this.hasAttribute("expanded") && this.getAttribute("expanded") !== "false"
4240
}
4341
set expanded(value: boolean) {
4442
if (value) {
@@ -49,59 +47,41 @@ export class JsonViewer extends HTMLElement {
4947
}
5048

5149
get showDataTypes(): boolean {
52-
return (
53-
this.hasAttribute("show-data-types") &&
54-
this.getAttribute("show-data-types") !== "false"
55-
)
50+
return this.hasAttribute("show-data-types") && this.getAttribute("show-data-types") !== "false"
5651
}
5752
set showDataTypes(value: boolean) {
5853
this.setAttribute("show-data-types", value.toString())
5954
}
6055

6156
get showLoadingStatus(): boolean {
62-
return (
63-
this.hasAttribute("show-loading-status") &&
64-
this.getAttribute("show-loading-status") !== "false"
65-
)
57+
return this.hasAttribute("show-loading-status") && this.getAttribute("show-loading-status") !== "false"
6658
}
6759
set showLoadingStatus(value: boolean) {
6860
this.setAttribute("show-loading-status", value.toString())
6961
}
7062
get showErrors(): boolean {
71-
return (
72-
this.hasAttribute("show-errors") &&
73-
this.getAttribute("show-errors") !== "false"
74-
)
63+
return this.hasAttribute("show-errors") && this.getAttribute("show-errors") !== "false"
7564
}
7665
set showErrors(value: boolean) {
7766
this.setAttribute("show-errors", value.toString())
7867
}
7968

8069
get showToolbar(): boolean {
81-
return (
82-
this.hasAttribute("show-toolbar") &&
83-
this.getAttribute("show-toolbar") !== "false"
84-
)
70+
return this.hasAttribute("show-toolbar") && this.getAttribute("show-toolbar") !== "false"
8571
}
8672
set showToolbar(value: boolean) {
8773
this.setAttribute("show-toolbar", value.toString())
8874
}
8975

9076
get showCopy(): boolean {
91-
return (
92-
this.hasAttribute("show-copy") &&
93-
this.getAttribute("show-copy") !== "false"
94-
)
77+
return this.hasAttribute("show-copy") && this.getAttribute("show-copy") !== "false"
9578
}
9679
set showCopy(value: boolean) {
9780
this.setAttribute("show-copy", value.toString())
9881
}
9982

10083
get showSize(): boolean {
101-
return (
102-
this.hasAttribute("show-size") &&
103-
this.getAttribute("show-size") !== "false"
104-
)
84+
return this.hasAttribute("show-size") && this.getAttribute("show-size") !== "false"
10585
}
10686
set showSize(value: boolean) {
10787
this.setAttribute("show-size", value.toString())
@@ -150,11 +130,7 @@ export class JsonViewer extends HTMLElement {
150130
return content || ""
151131
}
152132

153-
attributeChangedCallback(
154-
_name: string,
155-
oldValue: string | null,
156-
newValue: string | null
157-
) {
133+
attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null) {
158134
if (oldValue !== newValue) {
159135
this.render()
160136
}
@@ -211,9 +187,7 @@ export class JsonViewer extends HTMLElement {
211187
Invalid JSON data
212188
<details style="margin-top: 8px;">
213189
<summary>Raw data:</summary>
214-
<pre style="background: #f5f5f5; padding: 8px; margin-top: 4px;">${
215-
this.data
216-
}</pre>
190+
<pre style="background: #f5f5f5; padding: 8px; margin-top: 4px;">${this.data}</pre>
217191
<p>Error: ${result.error || "Unknown error"}</p>
218192
</details>
219193
</div>
@@ -223,35 +197,6 @@ export class JsonViewer extends HTMLElement {
223197

224198
const parsedData = result.data
225199

226-
if (this.showToolbar) {
227-
if (!this.toolbar) {
228-
this.toolbar = new Toolbar()
229-
this.toolbar.onChange(({ key, value }) => {
230-
if (key === "indent") {
231-
this.indent = value as number
232-
} else if (key === "expanded") {
233-
this.expanded = value as boolean
234-
} else if (key === "showDataTypes") {
235-
this.showDataTypes = value as boolean
236-
} else if (key === "expandIconType") {
237-
this.expandIconType = value as string
238-
} else if (key === "showCopy") {
239-
this.showCopy = value as boolean
240-
} else if (key === "showSize") {
241-
this.showSize = value as boolean
242-
}
243-
})
244-
}
245-
this.toolbar.updateProps({
246-
indent: this.indent,
247-
expanded: this.expanded,
248-
showDataTypes: this.showDataTypes,
249-
expandIconType: this.expandIconType,
250-
showCopy: this.showCopy,
251-
showSize: this.showSize,
252-
})
253-
}
254-
255200
this.shadowRoot.innerHTML = `
256201
<style>
257202
:host {
@@ -295,7 +240,6 @@ export class JsonViewer extends HTMLElement {
295240
</style>
296241
297242
<div class="json-viewer" data-theme="${this.theme}">
298-
${this.showToolbar ? this.toolbar?.render() : ""}
299243
${this.renderJson(parsedData)}
300244
</div>
301245
`

src/package/components/toolbar.ts

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
1-
interface ToolbarProps {
2-
indent: number
3-
expanded: boolean
4-
showDataTypes: boolean
5-
expandIconType: string
6-
showCopy: boolean
7-
showSize: boolean
8-
}
1+
// interface ToolbarProps {
2+
// indent: number
3+
// expanded: boolean
4+
// showDataTypes: boolean
5+
// expandIconType: string
6+
// showCopy: boolean
7+
// showSize: boolean
8+
// }
9+
10+
// type OnChangeCallbackParams = Record<keyof ToolbarProps, number | boolean | string>
911

10-
type OnChangeCallback = ({
11-
key,
12-
value,
13-
}: {
14-
key: keyof ToolbarProps
15-
value: number | boolean | string
16-
}) => void
12+
// type OnChangeCallback = (change: OnChangeCallbackParams) => void
1713

1814
export class Toolbar {
19-
private props: ToolbarProps | null = null
20-
private onChangeCallback: OnChangeCallback | null = null
15+
// private props: ToolbarProps | null = null
16+
// //private onChangeCallback: OnChangeCallback | null = null
2117

2218
constructor() {}
2319

24-
public updateProps(props: ToolbarProps): void {
25-
this.props = props
26-
this.render()
27-
}
28-
29-
public onChange(callback: OnChangeCallback): void {
30-
this.onChangeCallback = callback
31-
}
32-
33-
public render(): string | null {
34-
if (!this.props) return null
35-
36-
// Render the toolbar based on the current props
37-
return `
38-
<div class="toolbar">
39-
Indent<input type="number" min="0" max="10" value="${
40-
this.props.indent
41-
}" />
42-
<button>${this.props.expanded ? "Collapse" : "Expand"}</button>
43-
<span>Data Types: ${this.props.showDataTypes ? "On" : "Off"}</span>
44-
<span>Icon Type: ${this.props.expandIconType}</span>
45-
<button>${this.props.showCopy ? "Copy" : "No Copy"}</button>
46-
<span>Size: ${this.props.showSize ? "Visible" : "Hidden"}</span>
47-
</div>
48-
`
49-
}
20+
// public updateProps(props: ToolbarProps): void {
21+
// this.props = props
22+
// this.render()
23+
// }
24+
25+
// public onChange(callback: OnChangeCallback): void {
26+
// //this.onChangeCallback = callback
27+
// }
28+
29+
// public render(): string | null {
30+
// if (!this.props) return null
31+
32+
// // Render the toolbar based on the current props
33+
// return `
34+
// <div class="toolbar">
35+
// Indent<input type="number" min="0" max="10" value="${this.props.indent}" />
36+
// <button>${this.props.expanded ? "Collapse" : "Expand"}</button>
37+
// <span>Data Types: ${this.props.showDataTypes ? "On" : "Off"}</span>
38+
// <span>Icon Type: ${this.props.expandIconType}</span>
39+
// <button>${this.props.showCopy ? "Copy" : "No Copy"}</button>
40+
// <span>Size: ${this.props.showSize ? "Visible" : "Hidden"}</span>
41+
// </div>
42+
// `
43+
// }
5044
}

src/package/utils/data-parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class DataParser {
7272
const data = JSON.parse(this.data)
7373
return { data, source: "json" }
7474
} catch (error) {
75+
console.log("JSON parsing error:", error)
7576
return {
7677
data: null,
7778
source: "json",

0 commit comments

Comments
 (0)