├── .env
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── docs
├── assets
│ ├── feather-sprite-BfIm3Xr9.svg
│ ├── index-BDoPEOr-.js
│ └── index-DbaNkN54.css
├── favicon.ico
├── images
│ ├── feather-sprite.svg
│ ├── json-editor-app-icon.png
│ ├── json-editor-app-icon.webp
│ ├── json-editor-banner.webp
│ └── json-editor-icon.png
└── index.html
├── lib
├── json-editor.css
├── json-editor.d.ts
├── json-editor.js
└── json-editor.umd.cjs
├── package.json
├── src
├── dev
│ ├── assets
│ │ ├── global.scss
│ │ └── resource.js
│ ├── index.html
│ ├── main.js
│ ├── main.scss
│ └── util.js
├── docs
│ ├── app.scss
│ ├── app.svelte
│ ├── assets
│ │ └── scss
│ │ │ ├── main.scss
│ │ │ ├── mixins.scss
│ │ │ └── normalize.scss
│ ├── components
│ │ ├── about
│ │ │ ├── index.scss
│ │ │ └── index.svelte
│ │ ├── assets
│ │ │ ├── button.scss
│ │ │ ├── button.svelte
│ │ │ ├── icon.svelte
│ │ │ ├── logo-label.svelte
│ │ │ └── logo-symbol.svelte
│ │ ├── data
│ │ │ ├── common.scss
│ │ │ ├── export.svelte
│ │ │ ├── import.svelte
│ │ │ └── index.js
│ │ ├── editor
│ │ │ ├── index.scss
│ │ │ └── index.svelte
│ │ ├── header
│ │ │ ├── index.scss
│ │ │ ├── index.svelte
│ │ │ ├── menu-item.svelte
│ │ │ ├── sub-menu.scss
│ │ │ ├── sub-menu.svelte
│ │ │ ├── theme.scss
│ │ │ └── theme.svelte
│ │ ├── modal-window
│ │ │ ├── index.scss
│ │ │ └── index.svelte
│ │ └── preview
│ │ │ ├── index.scss
│ │ │ └── index.svelte
│ ├── index.html
│ ├── libs
│ │ ├── lang.js
│ │ ├── storage.js
│ │ └── util.js
│ ├── main.js
│ ├── public
│ │ ├── favicon.ico
│ │ └── images
│ │ │ ├── feather-sprite.svg
│ │ │ ├── json-editor-app-icon.png
│ │ │ ├── json-editor-app-icon.webp
│ │ │ ├── json-editor-banner.webp
│ │ │ └── json-editor-icon.png
│ └── store
│ │ ├── service.js
│ │ └── visible.js
└── json-editor
│ ├── assets
│ ├── context.scss
│ ├── icons.js
│ ├── main.scss
│ ├── mixins.scss
│ └── node.scss
│ ├── context.js
│ ├── exports.js
│ ├── index.d.ts
│ ├── index.js
│ └── libs
│ ├── assets.js
│ ├── lang.js
│ └── util.js
└── vite.config
├── dev.js
├── docs.js
└── lib.js
/.env:
--------------------------------------------------------------------------------
1 | # server
2 | VITE_HOST="0.0.0.0"
3 | VITE_PORT="4000"
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # directories
2 | .idea/
3 | .vscode/
4 | node_modules/
5 | dist/
6 |
7 | # files
8 | .DS_Store
9 | yarn.lock
10 | package-lock.json
11 | bun.lockb
12 | .env.local
13 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # directories
2 | .idea/
3 | .vscode/
4 | node_modules/
5 | dist/
6 |
7 | # files
8 | .DS_Store
9 | yarn.lock
10 | package-lock.json
11 | bun.lockb
12 | .env
13 | .env.local
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 redgoose
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JSON Editor
2 |
3 | "json-editor"는 웹브라우저에서 json 데이터를 편집하는 에디터입니다.
4 | 텍스트 편집툴을 사용할 수 없거나 json 데이터를 손쉽게 다루기 위하여 만들어진 프로그램 입니다.
5 | 이 에디터는 독립적으로 동작하며 메서드를 실행하여 에디터의 기능을 조작할 수 있습니다.
6 |
7 | 권장되는 사용환경은 다음과 같습니다.
8 |
9 | - 데스크탑
10 | - 큰 화면의 태블릿
11 |
12 | 에디터가 어떻게 사용되는지 데모를 확인해볼 수 있습니다. 데모페이지에서 임시로 에디터로 사용할 수 있습니다.
13 |
14 | > 데모링크: https://redgoose-dev.github.io/json-editor/
15 |
16 |
17 | ## Using
18 |
19 | javascript와 css를 불러와서 클래스 인스턴스를 만드는 방식으로 시작합니다.
20 |
21 | ```javascript
22 | import JsonEditor from '@redgoose/json-editor'
23 | import '@redgoose/json-editor/css'
24 |
25 | const jsonEditor = new JsonEditor(document.getElementById('target'), {
26 | live: true,
27 | theme: 'system',
28 | edit: 'all',
29 | node: {},
30 | openDepth: 2,
31 | })
32 | ```
33 |
34 |
35 | ## Options
36 |
37 | 컴포넌트를 사용할때에 사용하는 옵션값입니다.
38 |
39 | - `live` / (true,false)
40 | 이 값을 사용하면 데이터가 업데이트 될때마다 `update` 메서드가 호출되면서 업데이트 이벤트를 호출합니다.
41 | - `theme` / (system,light,dark)
42 | 다크모드를 사용하는지에 대한 값입니다.
43 | - `edit` / (all,value,none)
44 | 컨트롤할 수 있는 범위를 정합니다.
45 | - `node` / ({},[])
46 | 클래스를 초기화할때 사용하는 노드 데이터 값입니다.
47 | - `openDepth` / 0
48 | x번째 뎁스의 노드가 열리는지에 대하여 정합니다.
49 |
50 |
51 | ## Methods
52 |
53 | 인스턴스에서 사용할 수 있는 메서드들이며 필요할때에 적절히 사용할 수 있습니다. (아니면 클래스 프로토타입으로 미리 확장해둘 수 있습니다.)
54 | 사용할 수 있는 공개 메서드들은 다음과 같습니다.
55 |
56 | > ps. 먼저 소스코드는 다음과 같이 정의합니다.
57 | >
58 | > ```javascript
59 | > const jsonEditor = new JsonEditor()
60 | > const node = document.querySelector('.node') // node
61 | > ```
62 |
63 | ### addNode
64 |
65 | `object`, `array` 노드에서 자식 노드를 추가합니다.
66 |
67 | ```javascript
68 | jsonEditor.addNode(node, data, options, useUpdate, useUpdateCount)
69 | ```
70 |
71 | - `node`: 데이터를 추가할 노드 엘리먼트
72 | - `data`: 추가할 데이터
73 | - `options`: 추가옵션
74 | - `useUpdate`: 노드를 추가하고 업데이트 메서드를 실행합니다.
75 | - `useUpdateCount`: 부모노드 데이터 갯수를 업데이트합니다.
76 |
77 | 다음과 같이 사용할 수 있습니다.
78 |
79 | ```javascript
80 | jsonEditor.addNode(
81 | node,
82 | { key: '', type: 'string', value: 'metal' },
83 | options,
84 | true,
85 | true
86 | )
87 | ```
88 |
89 | ### removeNode
90 |
91 | 노드를 삭제합니다.
92 |
93 | ```javascript
94 | jsonEditor.removeNode(node, useUpdate)
95 | ```
96 |
97 | - `node`: 데이터를 추가할 노드 엘리먼트
98 | - `useUpdate`: 노드를 삭제하고 업데이트 메서드를 실행합니다.
99 |
100 | 다음과 같이 사용할 수 있습니다.
101 |
102 | ```javascript
103 | jsonEditor.removeNode(node, true)
104 | ```
105 |
106 | ### changeType
107 |
108 | 노드의 타입을 변경합니다.
109 |
110 | ```javascript
111 | jsonEditor.changeType(node, type, useUpdate)
112 | ```
113 |
114 | - `node`: 타입을 변경할 노드 엘리먼트
115 | - `type`: 타입의 이름 (object,array,string,number,boolean,null)
116 | - `useUpdate`: 노드 타입을 변경하고 업데이트 메서드를 실행합니다.
117 |
118 | 다음과 같이 사용할 수 있습니다.
119 |
120 | ```javascript
121 | jsonEditor.changeType(node, 'boolean', true)
122 | ```
123 |
124 | ### changeKey
125 |
126 | 노드의 `key`를 변경합니다.
127 |
128 | ```javascript
129 | jsonEditor.changeKey(node, keyword)
130 | ```
131 |
132 | - `node`: 타입을 변경할 노드 엘리먼트
133 | - `keyword`: 키워드
134 |
135 | ### changeValue
136 |
137 | 노드의 `value`를 변경합니다.
138 |
139 | ```javascript
140 | jsonEditor.changeValue(node, value)
141 | ```
142 |
143 | - `node`: 타입을 변경할 노드 엘리먼트
144 | - `value`: 값
145 |
146 | ### duplicate
147 |
148 | 노드를 복제합니다.
149 |
150 | ```javascript
151 | jsonEditor.duplicate(node, useUpdate)
152 | ```
153 |
154 | - `node`: 복제할 노드 엘리먼트
155 | - `useUpdate`: 실행하고 업데이트 메서드를 실행합니다.
156 |
157 | 다음과 같이 사용할 수 있습니다.
158 |
159 | ```javascript
160 | jsonEditor.duplicate(node, true)
161 | ```
162 |
163 | ### fold
164 |
165 | 노드를 접거나 펼칩니다.
166 |
167 | ```javascript
168 | jsonEditor.fold(node, true)
169 | ```
170 |
171 | ### import
172 |
173 | 데이터를 가져옵니다.
174 |
175 | ```javascript
176 | jsonEditor.import(node, data, useUpdate, useUpdateCount)
177 | ```
178 |
179 | - `node`: 데이터를 추가할 노드 엘리먼트
180 | - `data`: 가져올 데이터
181 | - `useUpdate`: 노드를 추가하고 업데이트 메서드를 실행합니다.
182 | - `useUpdateCount`: 부모노드 데이터 갯수를 업데이트합니다.
183 |
184 | 다음과 같이 사용할 수 있습니다.
185 |
186 | ```javascript
187 | jsonEditor.import(node, { foo: 'bar' }, true, true)
188 | ```
189 |
190 | ### replace
191 |
192 | 데이터를 모두 교체합니다.
193 |
194 | ```javascript
195 | jsonEditor.replace(data, options, useUpdate)
196 | ```
197 |
198 | - `data`: 새로 교체할 데이터
199 | - `options`: 옵션
200 | - `openDepth`: 데이터가 교체될때 노드가 열리는 x번째 뎁스
201 | - `useUpdate`: 노드를 수정하고 업데이트 메서드를 실행합니다.
202 |
203 | 다음과 같이 사용할 수 있습니다.
204 |
205 | ```javascript
206 | jsonEditor.replace({ foo: 'bar' }, {
207 | openDepth: 2,
208 | }, true)
209 | ```
210 |
211 | ### export
212 |
213 | 에디터의 데이터를 가져옵니다.
214 |
215 | ```javascript
216 | jsonEditor.export(node, json, space)
217 | ```
218 |
219 | - `node`: 가져올 데이터의 노드 엘리먼트
220 | - `json`: json 형식의 데이터 변환여부
221 | - `space`: json 공백
222 |
223 | 다음과 같이 사용할 수 있습니다.
224 |
225 | ```javascript
226 | const space = 2 // null,2,'\t'
227 | jsonEditor.export(node, true, space)
228 | ```
229 |
230 | ### clear
231 |
232 | 노드의 내용을 비웁니다.
233 |
234 | ```javascript
235 | jsonEditor.clear()
236 | ```
237 |
238 | ### destroy
239 |
240 | 만들어진 인스턴스를 파괴합니다.
241 |
242 | ```javascript
243 | jsonEditor.destroy()
244 | ```
245 |
246 |
247 | ## Events
248 |
249 | 에디터에서 일어난 일들을 외부에서 이벤트리스너로 받아올 수 있습니다.
250 |
251 | > ps. 먼저 소스코드는 다음과 같이 정의합니다.
252 | >
253 | > ```javascript
254 | > const jsonEditor = new JsonEditor()
255 | > const wrap = jsonEditor.el.wrap.get(0) // wrap element
256 | > ```
257 |
258 | ### update
259 |
260 | 에디터의 내용이 수정된다면 실행되는 이벤트입니다.
261 |
262 | ```javascript
263 | wrap.addEventListener('update', ({ detail }) => {
264 | console.log('updated data', src)
265 | })
266 | ```
267 |
268 | - `detail`: 데이터 객체
269 |
270 | ### context
271 |
272 | 컨텍스트 메뉴가 열릴때마다 실행되는 이벤트입니다.
273 | 메뉴를 커스터마이즈 할 수 있으며 제공된 파라메터 값을 이용하여 상황에 맞게 메뉴를 조작할 수 있습니다.
274 |
275 | ```javascript
276 | wrap.addEventListener('context', ({ detail: { body, node, type, isRoot, $ } }) => {
277 | if (!isRoot) return
278 | const $ul = $(body).children()
279 | const $items = $(`
280 |
281 |
282 | `)
283 | $items.find('button').on('click', (e) => {
284 | console.log('click item-key:', $(e.currentTarget).data('key'))
285 | jsonEditor.context.close()
286 | })
287 | $ul.append($items)
288 | })
289 | ```
290 |
291 | - `body`: 열린 컨텍스트 메뉴 영역. 이 엘리먼트에다 항목을 조작하면 됩니다.
292 | - `node`: 선택된 노드 엘리먼트
293 | - `type`: 선택된 노드의 타입
294 | - `isRoot`: 현재 선택된 노드가 루트인지 구분하는 값
295 | - `$`: 컴포넌트 내부에서 사용하는 [Cash](https://github.com/fabiospampinato/cash)를 이용하여 손쉽게 dom을 다룰 수 있습니다.
296 |
297 |
298 | ## Exports guide
299 |
300 | 다음 경로를 참고하여 모듈들을 import 기능을 이용하는데 참고할 수 있습니다.
301 |
302 | - `@redgoose/json-editor`: 코어 라이브러리
303 | - `@redgoose/json-editor/css`: 스타일시트
304 | - `@redgoose/json-editor/lib/umd`: 코어 라이브러리 UMD
305 |
306 |
307 | ## Custom style
308 |
309 | 에디터의 디자인을 수정할 수 있는 요소들을 변수화 시켰습니다.
310 | 다음과 같이 외부 영역에서 에디터 스타일을 커스터마이즈 할 수 있습니다.
311 |
312 | ```css
313 | .editor {
314 | --json-editor-color-base: red;
315 | --json-editor-color-focus: blue;
316 | }
317 | @media (prefers-color-scheme: dark) {
318 | .editor {
319 | --json-editor-color-base: green;
320 | --json-editor-color-focus: yellow;
321 | }
322 | }
323 | ```
324 |
325 | [main.scss](https://github.com/redgoose-dev/json-editor/blob/main/src/json-editor/assets/main.scss) 파일의 코드를 참고하여 직접 스타일을 편집할 수 있습니다.
326 |
327 |
328 | ## Extention language
329 |
330 | 클래스 메서드를 교체하여 에디터 텍스트를 변경할 수 있습니다.
331 |
332 | ```javascript
333 | JsonEditor.prototype.updateLanguage = function()
334 | {
335 | this.lang = Object.assign(this.lang, {
336 | nodeChangeSort: '노드 순서변경',
337 | nodeContextMenu: '노드메뉴',
338 | nodeFold: '접기/펼치기',
339 | contextChangeType: '타입변경',
340 | contextInsertNode: '노드추가',
341 | contextTypeObject: '객체',
342 | contextTypeArray: '배열',
343 | contextTypeString: '문자',
344 | contextTypeNumber: '번호',
345 | contextTypeBoolean: '부울',
346 | contextTypeNull: '널',
347 | contextDuplicate: '노드복제',
348 | contextRemove: '노드삭제',
349 | })
350 | }
351 | ```
352 |
353 |
354 | ## Developing a wrapper
355 |
356 | `JSON Editor` 에디터를 `web component`, `react`, `vue`, `svelte` 같은 환경에서 사용할 수 있도록 컴포넌트를 래핑할 수 있습니다.
357 | 다음 링크를 참고하여 개발할 수 있습니다.
358 |
359 | - [web component](https://github.com/redgoose-dev/json-editor/wiki/json%E2%80%90editor-for-web-component)
360 | - [react](https://github.com/redgoose-dev/json-editor/wiki/json%E2%80%90editor-for-react)
361 | - [vue](https://github.com/redgoose-dev/json-editor/wiki/json%E2%80%90editor-for-vue)
362 | - [svelte](https://github.com/redgoose-dev/json-editor/wiki/json%E2%80%90editor-for-svelte)
363 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redgoose-dev/json-editor/ddf64587751ccadc5b789aca9298edefc0ab3735/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/images/json-editor-app-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redgoose-dev/json-editor/ddf64587751ccadc5b789aca9298edefc0ab3735/docs/images/json-editor-app-icon.png
--------------------------------------------------------------------------------
/docs/images/json-editor-app-icon.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redgoose-dev/json-editor/ddf64587751ccadc5b789aca9298edefc0ab3735/docs/images/json-editor-app-icon.webp
--------------------------------------------------------------------------------
/docs/images/json-editor-banner.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redgoose-dev/json-editor/ddf64587751ccadc5b789aca9298edefc0ab3735/docs/images/json-editor-banner.webp
--------------------------------------------------------------------------------
/docs/images/json-editor-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redgoose-dev/json-editor/ddf64587751ccadc5b789aca9298edefc0ab3735/docs/images/json-editor-icon.png
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JSON Editor
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/json-editor.css:
--------------------------------------------------------------------------------
1 | .json-editor{--font-base: var(--json-editor-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol");--font-code: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;--color-base: var(--json-editor-color-base, hsl(0 0% 13%));--color-input-empty: var(--json-editor-color-input-empty, hsl(0 0% 78%));--color-input-hover: var(--json-editor-color-input-active, hsla(0 0% 0% / 6%));--color-focus: var(--json-editor-color-focus, hsl(10, 95%, 54%));--color-count: var(--json-editor-color-count, hsl(0 0% 67%));--color-bullet: var(--json-editor-color-bullet, hsl(0 0% 13%));--color-tree: var(--json-editor-color-tree, hsl(0 0% 67%));--color-null: var(--json-editor-color-null, hsl(0 0% 72%));--object: var(--json-editor-object, hsl(168 73% 43%));--array: var(--json-editor-array, hsl(191 75% 53%));--string: var(--json-editor-string, hsl(5 87% 59%));--number: var(--json-editor-number, hsl(33 89% 55%));--boolean: var(--json-editor-boolean, hsl(45 89% 54%));--null: var(--json-editor-null, hsl(0 0% 58%));--color-drag-target-bg: var(--json-editor-color-drag-target-bg, hsla(0 0% 0% / 6%));--color-drag-line: var(--json-editor-color-drag-line, hsl(0 0% 65%));--switch-bg: var(--json-editor-switch-bg, hsla(0 0% 100% / 0%));--switch-outline: var(--json-editor-switch-outline, hsl(0 0% 67%));--switch-outline-active: var(--json-editor-switch-outline-active, hsla(0 0% 67% / 50%));--switch-ball: var(--json-editor-switch-ball, hsl(0 0% 56%));--switch-ball-active: var(--json-editor-switch-ball-active, hsl(0 0% 13%));--context-color-bg: var(--json-editor-context-color-bg, hsl(0 0% 100%));--context-color-inner: var(--json-editor-context-color-inner, hsl(0 0% 88%));--context-color-active: var(--json-editor-context-color-active, hsl(0 0% 92%));--context-color-remove: var(--json-editor-context-color-remove, hsl(0 96% 52%));--context-color-text: var(--json-editor-context-color-text, hsl(0 0% 13%));--context-color-bullet: var(--json-editor-context-color-bullet, hsl(0 0% 13%));--context-shadow: var(--json-editor-context-shadow, 0 4px 36px 0 hsla(0 0% 0% / 12%), 0 2px 12px 0 hsla(0 0% 0% / 20%), 0 0 0 1px hsla(0 0% 0% / 8%));--context-radius: var(--json-editor-radius, 2px);color:var(--color-base);font-size:16px;line-height:1.15}.json-editor,.json-editor button,.json-editor input,.json-editor select{font-family:var(--font-base)}.json-editor>ul{position:relative;margin:-4px 0;padding:0;list-style:none}.json-editor.dragging{cursor:move;-webkit-user-select:none;user-select:none}.json-editor.dragging *{cursor:move!important;-webkit-user-select:none!important;user-select:none!important}.json-editor[data-theme=dark]{--color-base: var(--json-editor-color-base, hsl(0 0% 92%));--color-input-empty: var(--json-editor-color-input-empty, hsl(0 0% 48%));--color-input-hover: var(--json-editor-color-input-active, hsla(0 0% 100% / 12%));--color-count: var(--json-editor-color-count, hsl(0 0% 56%));--color-bullet: var(--json-editor-color-bullet, hsl(0 0% 92%));--color-tree: var(--json-editor-color-tree, hsl(0 0% 42%));--color-null: var(--json-editor-color-null, hsl(0 0% 48%));--color-drag-target-bg: var(--json-editor-color-drag-target-bg, hsla(0 0% 100% / 8%));--color-drag-line: var(--json-editor-color-drag-line, hsl(0 0% 75%));--switch-bg: var(--json-editor-switch-bg, hsla(0 0% 0% / 0%));--switch-outline: var(--json-editor-switch-outline, hsl(0 0% 78%));--switch-outline-active: var(--json-editor-switch-outline-active, hsla(0 0% 62% / 50%));--switch-ball: var(--json-editor-switch-ball, hsl(0 0% 54%));--switch-ball-active: var(--json-editor-switch-ball-active, hsl(0 0% 100%));--context-color-bg: var(--json-editor-context-color-bg, hsl(0 0% 24%));--context-color-inner: var(--json-editor-context-color-inner, hsl(0 0% 16%));--context-color-active: var(--json-editor-context-color-active, hsl(0 0% 36%));--context-color-remove: var(--json-editor-context-color-remove, hsl(0 98% 60%));--context-color-text: var(--json-editor-context-color-text, hsl(0 0% 92%));--context-color-bullet: var(--json-editor-context-color-bullet, hsl(0 0% 92%));--context-shadow: var(--json-editor-context-shadow, 0 4px 36px 0 hsla(0 0% 0% / 32%), 0 2px 8px 0 hsla(0 0% 0% / 52%), 0 0 0 1px hsla(0 0% 0% / 75%))}@media (prefers-color-scheme: dark){.json-editor[data-theme=system],.json-editor:not([data-theme]),.json-editor[data-theme=""]{--color-base: var(--json-editor-color-base, hsl(0 0% 92%));--color-input-empty: var(--json-editor-color-input-empty, hsl(0 0% 48%));--color-input-hover: var(--json-editor-color-input-active, hsla(0 0% 100% / 12%));--color-count: var(--json-editor-color-count, hsl(0 0% 56%));--color-bullet: var(--json-editor-color-bullet, hsl(0 0% 92%));--color-tree: var(--json-editor-color-tree, hsl(0 0% 42%));--color-null: var(--json-editor-color-null, hsl(0 0% 48%));--color-drag-target-bg: var(--json-editor-color-drag-target-bg, hsla(0 0% 100% / 8%));--color-drag-line: var(--json-editor-color-drag-line, hsl(0 0% 75%));--switch-bg: var(--json-editor-switch-bg, hsla(0 0% 0% / 0%));--switch-outline: var(--json-editor-switch-outline, hsl(0 0% 78%));--switch-outline-active: var(--json-editor-switch-outline-active, hsla(0 0% 62% / 50%));--switch-ball: var(--json-editor-switch-ball, hsl(0 0% 54%));--switch-ball-active: var(--json-editor-switch-ball-active, hsl(0 0% 100%));--context-color-bg: var(--json-editor-context-color-bg, hsl(0 0% 24%));--context-color-inner: var(--json-editor-context-color-inner, hsl(0 0% 16%));--context-color-active: var(--json-editor-context-color-active, hsl(0 0% 36%));--context-color-remove: var(--json-editor-context-color-remove, hsl(0 98% 60%));--context-color-text: var(--json-editor-context-color-text, hsl(0 0% 92%));--context-color-bullet: var(--json-editor-context-color-bullet, hsl(0 0% 92%));--context-shadow: var(--json-editor-context-shadow, 0 4px 36px 0 hsla(0 0% 0% / 32%), 0 2px 8px 0 hsla(0 0% 0% / 52%), 0 0 0 1px hsla(0 0% 0% / 75%))}}.json-editor .type-icon{display:grid;width:var(--type-size, 24px);height:var(--type-size, 24px);place-content:center;box-sizing:border-box;border-radius:4px;background:var(--type-icon-color, #aaa)}.json-editor .type-icon svg{display:block;box-sizing:border-box;color:#fff;width:var(--type-icon-width)}.json-editor .type-icon--object{--type-icon-color: var(--object);--type-icon-width: calc(var(--type-icon-size, 10px) + 1px)}.json-editor .type-icon--array{--type-icon-color: var(--array);--type-icon-width: var(--type-icon-size, 10px)}.json-editor .type-icon--string{--type-icon-color: var(--string);--type-icon-width: calc(var(--type-icon-size, 10px) - 2px)}.json-editor .type-icon--number{--type-icon-color: var(--number);--type-icon-width: calc(var(--type-icon-size, 10px) - 1px)}.json-editor .type-icon--boolean{--type-icon-color: var(--boolean);--type-icon-width: calc(var(--type-icon-size, 10px) - 3px)}.json-editor .type-icon--null{--type-icon-color: var(--null);--type-icon-width: calc(var(--type-icon-size, 10px) - 2px)}.json-editor .label-field{margin:-4px 0;padding:4px 6px;min-width:var(--label-min-width, unset);min-height:24px;outline:none;font-size:13px;color:var(--color-base);line-height:1.42;box-sizing:border-box;border-radius:2px;background-color:#0000;box-shadow:0 0 0 .5px #0000;transition:background-color .16s ease-out,box-shadow .2s ease-out;cursor:text;word-break:break-all}@media (hover: hover) and (pointer: fine){.json-editor .label-field:hover{background-color:var(--color-input-hover)}}.json-editor .label-field:focus{outline:2px solid var(--color-focus);outline-offset:-1px}.json-editor .label-field:empty:before{content:attr(data-placeholder);color:var(--color-input-empty)}.json-editor .label-field[type=number]{border:none;width:160px}.json-editor .label-field[type=number]::-webkit-outer-spin-button,.json-editor .label-field[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.json-editor .label-null{display:block;padding:0 6px;color:var(--color-null);font-style:normal;letter-spacing:-.5px;-webkit-user-select:none;user-select:none;font-size:13px}.json-editor .label-switch{--switch-width: 36px;--switch-height: 18px;--switch-offset: 3px;--switch-speed: .1s;--switch-unit-size: calc(var(--switch-height) - (var(--switch-offset) * 2));display:block;margin:0 0 0 6px;padding:2px 0;background:none;border:none;font-size:0;cursor:pointer;-webkit-tap-highlight-color:transparent}.json-editor .label-switch span{display:block;position:relative;padding:var(--switch-offset);width:var(--switch-width);height:var(--switch-height);border-radius:calc(var(--switch-height) * .5);box-shadow:inset 0 0 0 1px var(--switch-outline);background-color:var(--switch-bg);transition:box-shadow .16s ease-out;box-sizing:border-box}.json-editor .label-switch i{display:block;width:var(--switch-unit-size);height:var(--switch-unit-size);background-color:var(--switch-unit-color, var(--switch-ball));border-radius:var(--switch-unit-size);pointer-events:none;transform:translate(var(--switch-unit-x));transition:transform var(--switch-speed) ease-out,width var(--switch-speed) ease-out,background-color .24s ease-out}.json-editor .label-switch:active span{box-shadow:inset 0 0 0 1px var(--switch-outline-active)}.json-editor .label-switch:active[data-value=false] i{width:calc(var(--switch-unit-size) + 6px)}.json-editor .label-switch:active[data-value=true] i{width:calc(var(--switch-unit-size) + 6px);transform:translate(calc(var(--switch-width) - var(--switch-offset) * 2 - var(--switch-unit-size) - 6px))}.json-editor .label-switch:focus-visible{outline:none}.json-editor .label-switch:focus-visible span{outline:2px solid var(--color-focus);outline-offset:1px}.json-editor .label-switch[data-value=false]{--switch-unit-x: 0}.json-editor .label-switch[data-value=true]{--switch-unit-x: calc(var(--switch-width) - (var(--switch-offset) * 2) - var(--switch-unit-size));--switch-unit-color: var(--switch-ball-active)}.json-editor .node{position:relative}@supports (-webkit-touch-callout: none){.json-editor .node{-webkit-user-select:none}}.json-editor .node__body{position:relative;display:flex;align-items:center;box-sizing:border-box;padding:4px 0;transition:opacity .12s ease-out}.json-editor .node__body>.sort{display:block;box-sizing:border-box;cursor:move;margin:-4px 4px -4px 0;padding:4px 0;touch-action:none}.json-editor .node__body>.sort svg{display:block;width:24px;color:var(--color-bullet)}.json-editor .node__body>.sort:active{opacity:.5}.json-editor .node__body>.type{position:relative}.json-editor .node__body>.type>button{display:block;margin:-2px;padding:2px;box-sizing:border-box;border:none;background:none;outline:none;cursor:pointer;transition:opacity .12s ease-out;border-radius:6px;-webkit-tap-highlight-color:transparent}.json-editor .node__body>.type>button:active{opacity:.5}.json-editor .node__body>.type>button:focus-visible{outline:2px solid var(--color-focus);outline-offset:-1px}.json-editor .node__body>.type.open>button{opacity:.5}.json-editor .node__body>.fold{display:block;width:28px;height:28px;margin:-8px -8px -8px 0;padding:0;background:none;border:none;box-sizing:border-box;cursor:pointer;-webkit-tap-highlight-color:transparent}.json-editor .node__body>.fold:focus-visible{outline:2px solid var(--color-focus);outline-offset:-6px}.json-editor .node__body>.fold:active{opacity:.5}.json-editor .node__body>.fold svg{display:block;margin:0 auto;width:20px;rotate:0deg;box-sizing:border-box;transition:rotate,.16s ease-out;color:var(--color-bullet)}.json-editor .node__body>.key{margin-left:6px;--label-min-width: 48px}.json-editor .node__body>.count{display:block;margin:0;pointer-events:none;padding:0 0 0 8px;color:var(--color-count);font-style:normal;-webkit-user-select:none;user-select:none;font-size:13px;line-height:normal;font-family:var(--font-code)}.json-editor .node__body>.value{position:relative;flex:1;display:flex;align-items:center;gap:0 6px;font-size:13px;line-height:1.42;--label-min-width: 78px}.json-editor .node__body>.value:before{content:":"}.json-editor .node__children>.tree{position:relative;display:none;margin:0;padding:0 0 0 26px;list-style:none;box-sizing:border-box}.json-editor .node__children>.tree:not(:empty):before{content:"";display:block;position:absolute;left:11px;top:6px;bottom:14px;width:4px;border-width:0 0 0 1px;border-style:dashed;border-color:var(--color-tree)}.json-editor .node__children>.tree:not(:empty):after{content:"";display:block;position:absolute;left:9px;bottom:13px;width:5px;height:5px;background:var(--color-tree);border-radius:50%}.json-editor .node.open>.node__body .fold svg{rotate:90deg}.json-editor .node.open>.node__children>.tree{display:grid}.json-editor .node.open>.node__children>.tree:empty{display:none}.json-editor .node[data-type=object]>.node__body .count:before{content:"{"}.json-editor .node[data-type=object]>.node__body .count:after{content:"}"}.json-editor .node[data-type=object]>.node__body .value{display:none}.json-editor .node[data-type=array]>.node__body .count:before{content:"["}.json-editor .node[data-type=array]>.node__body .count:after{content:"]"}.json-editor .node[data-type=array]>.node__body .value{display:none}.json-editor .node[data-type=array]>.node__children>.tree>.node>.node__body>.key{display:none}.json-editor .node[data-type=string]>.node__body .fold,.json-editor .node[data-type=number]>.node__body .fold,.json-editor .node[data-type=boolean]>.node__body .fold,.json-editor .node[data-type=null]>.node__body .fold{display:none}.json-editor .node[data-type=string]>.node__children>.tree,.json-editor .node[data-type=number]>.node__children>.tree,.json-editor .node[data-type=boolean]>.node__children>.tree,.json-editor .node[data-type=null]>.node__children>.tree{display:none}.json-editor .node:before,.json-editor .node:after{display:none;content:"";position:absolute;left:0;right:0;height:2px;background-color:var(--color-drag-line);border-radius:2px}.json-editor .node:before{top:-1px}.json-editor .node:after{bottom:-1px}.json-editor .node.drag-over-start:before{display:block}.json-editor .node.drag-over-end:after{display:block}.json-editor.dragging .node:not(.root)>.node__body{opacity:.25}.json-editor.dragging .drag-area>.node>.node__body{opacity:unset}.json-editor .drag-select{background-color:var(--color-drag-target-bg)}.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.sort{display:none}.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.type>button{opacity:unset;cursor:default;outline:unset}.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.fold{outline:unset}.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.key .label-field{caret-color:transparent}@media (hover: hover) and (pointer: fine){.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.key .label-field:hover{background-color:unset}}.json-editor:is([data-edit=none],[data-edit=value]) .node__body>.key .label-field:focus{outline:unset}.json-editor[data-edit=none] .node__body>.value .label-field{caret-color:transparent}@media (hover: hover) and (pointer: fine){.json-editor[data-edit=none] .node__body>.value .label-field:hover{background-color:unset}}.json-editor[data-edit=none] .node__body>.value .label-field:focus{outline:unset}.json-editor[data-edit=none] .node__body>.value .label-switch{cursor:default}.json-editor[data-edit=none] .node__body>.value .label-switch span{box-shadow:inset 0 0 0 1px var(--switch-outline)}.json-editor[data-edit=none] .node__body>.value .label-switch i{width:var(--switch-unit-size);transform:translate(var(--switch-unit-x))}.json-editor .context{position:absolute;top:-8px;right:-6px;z-index:2}.json-editor .context.is-root{left:28px}.json-editor .context ol{position:absolute;left:0;margin:0;padding:0;list-style:none;background:var(--context-color-inner);border-radius:var(--context-radius);box-shadow:var(--context-shadow)}.json-editor .context li{position:relative}.json-editor .context li:not(:first-child){margin-top:1px}.json-editor .context li:first-child>button{border-top-left-radius:var(--context-radius);border-top-right-radius:var(--context-radius)}.json-editor .context li:last-child>button{border-bottom-left-radius:var(--context-radius);border-bottom-right-radius:var(--context-radius)}.json-editor .context li.type>button{grid-template-columns:auto 1fr;gap:8px}.json-editor .context li.type>button:disabled>*{opacity:.25}.json-editor .context li.dropdown:hover>button,.json-editor .context li.dropdown:focus-within>button{background-color:var(--context-color-active)}.json-editor .context li.dropdown:hover>.children,.json-editor .context li.dropdown:focus-within>.children{opacity:1;pointer-events:auto}.json-editor .context li.dropdown>button{grid-template-columns:1fr auto}.json-editor .context li.remove .label{color:var(--context-color-remove)}.json-editor .context button{display:grid;align-items:center;margin:0;padding:8px 12px;min-width:150px;text-align:left;box-sizing:border-box;background-color:var(--context-color-bg);border:none;cursor:pointer;border-radius:0;transition:background-color .12s ease-out;font-size:12px;letter-spacing:-.25px;outline:none;color:var(--context-color-text);-webkit-tap-highlight-color:transparent}.json-editor .context button:hover:not(:disabled),.json-editor .context button:active:not(:disabled){background-color:var(--context-color-active)}.json-editor .context button:not(.parent):focus-visible{outline:2px solid var(--color-focus);outline-offset:-2px}.json-editor .context button:disabled{cursor:default}.json-editor .context .label{display:block;font-style:normal;pointer-events:none;-webkit-user-select:none;user-select:none}.json-editor .context .type-icon{--type-size: 16px;--type-icon-size: 8px}.json-editor .context .arrow{display:block;margin:0 -4px 0 0;pointer-events:none}.json-editor .context .arrow svg{display:block;width:16px;color:var(--color-bullet);stroke-width:1.5}.json-editor .context .children{position:absolute;top:-12px;right:4px;z-index:2;pointer-events:none;opacity:0;transition:opacity .24s ease-out}.json-editor .context .children ol{top:0;left:0}
2 |
--------------------------------------------------------------------------------
/lib/json-editor.d.ts:
--------------------------------------------------------------------------------
1 | declare module '@redgoose/json-editor' {
2 |
3 | type typeOptions = {
4 | live?: boolean
5 | theme?: 'system' | 'light' | 'dark'
6 | edit?: 'all' | 'value' | 'none'
7 | openDepth?: boolean
8 | node?: object | any[]
9 | }
10 | type typeData = any[] | object
11 | type typeAddNodeOptions = {
12 | open?: boolean
13 | callback?: Function
14 | }
15 | type typeNames = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null'
16 |
17 | export default class JsonEditor {
18 | // properties
19 | options: typeOptions
20 | context: Context
21 | // class units
22 | constructor(wrap: HTMLElement, options?: typeOptions)
23 | // public methods
24 | addNode(target: HTMLElement, data: typeData, options?: typeAddNodeOptions, useUpdate?: boolean, useUpdateCount?: boolean): void
25 | removeNode(node: HTMLElement, useUpdate?: boolean): void
26 | changeType(node: HTMLElement, type: typeNames, useUpdate?: boolean): void
27 | changeKey(node: HTMLElement, keyword: string): void
28 | changeValue(node: HTMLElement, value: string|number|boolean|null): void
29 | duplicate(target: HTMLElement, useUpdate?: boolean): void
30 | fold(node: HTMLElement, sw?: boolean): void
31 | clear(): void
32 | destroy(): void
33 | replace(data: typeData, options?: object, useUpdate?: boolean): void
34 | import(target: HTMLElement, data: typeData, useUpdate?: boolean): void
35 | export(node: HTMLElement, json?: boolean, space?: number): any[]|object
36 | updateLanguage(): void
37 | }
38 |
39 | export class Context {
40 | constructor(parent: JsonEditor, node: HTMLElement, isRoot: boolean)
41 | close(): void
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/lib/json-editor.umd.cjs:
--------------------------------------------------------------------------------
1 | (function(y,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(y=typeof globalThis<"u"?globalThis:y||self,y.JsonEditor=C())})(this,function(){"use strict";var bn=Object.defineProperty;var le=y=>{throw TypeError(y)};var Cn=(y,C,N)=>C in y?bn(y,C,{enumerable:!0,configurable:!0,writable:!0,value:N}):y[C]=N;var j=(y,C,N)=>Cn(y,typeof C!="symbol"?C+"":C,N),Rt=(y,C,N)=>C.has(y)||le("Cannot "+N);var m=(y,C,N)=>(Rt(y,C,"read from private field"),N?N.call(y):C.get(y)),F=(y,C,N)=>C.has(y)?le("Cannot add the same private member more than once"):C instanceof WeakSet?C.add(y):C.set(y,N),U=(y,C,N,O)=>(Rt(y,C,"write to private field"),O?O.call(y,N):C.set(y,N),N),h=(y,C,N)=>(Rt(y,C,"access private method"),N);var Y,Z,B,ue,fe,de,he,b,G,l,pe,At,lt,ge,ye,ut,tt,Lt,A,Ot,et,St,_t,nt,ft,dt,me,be,Ce;const y=document,C=window,N=y.documentElement,O=y.createElement.bind(y),Bt=O("div"),ht=O("table"),we=O("tbody"),$t=O("tr"),{isArray:it,prototype:Mt}=Array,{concat:ve,filter:pt,indexOf:Dt,map:It,push:Ne,slice:Pt,some:gt,splice:xe}=Mt,Ee=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,Te=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,ke=/<.+>/,Re=/^\w+$/;function yt(t,e){const n=Ae(e);return!t||!n&&!H(e)&&!E(e)?[]:!n&&Te.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!n&&Re.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t)}class st{constructor(e,n){if(!e)return;if(mt(e))return e;let i=e;if(k(e)){const s=n||y;if(i=Ee.test(e)&&H(s)?s.getElementById(e.slice(1).replace(/\\/g,"")):ke.test(e)?Ft(e):mt(s)?s.find(e):k(s)?o(s).find(e):yt(e,s),!i)return}else if(V(e))return this.ready(e);(i.nodeType||i===C)&&(i=[i]),this.length=i.length;for(let s=0,r=this.length;s{for(;e.firstChild;)e.removeChild(e.firstChild)})};function rt(...t){const e=Oe(t[0])?t.shift():!1,n=t.shift(),i=t.length;if(!n)return{};if(!i)return rt(e,o,n);for(let s=0;s{E(r)&&T(n,(u,a)=>{i?e?r.classList.add(a):r.classList.remove(a):r.classList.toggle(a)})})},c.addClass=function(t){return this.toggleClass(t,!0)},c.removeAttr=function(t){const e=ot(t);return this.each((n,i)=>{E(i)&&T(e,(s,r)=>{i.removeAttribute(r)})})};function _e(t,e){if(t){if(k(t)){if(arguments.length<2){if(!this[0]||!E(this[0]))return;const n=this[0].getAttribute(t);return X(n)?void 0:n}return R(e)?this:X(e)?this.removeAttr(t):this.each((n,i)=>{E(i)&&i.setAttribute(t,e)})}for(const n in t)this.attr(n,t[n]);return this}}c.attr=_e,c.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},c.hasClass=function(t){return!!t&>.call(this,e=>E(e)&&e.classList.contains(t))},c.get=function(t){return R(t)?Pt.call(this):(t=Number(t),this[t<0?t+this.length:t])},c.eq=function(t){return o(this.get(t))},c.first=function(){return this.eq(0)},c.last=function(){return this.eq(-1)};function Be(t){return R(t)?this.get().map(e=>E(e)||Le(e)?e.textContent:"").join(""):this.each((e,n)=>{E(n)&&(n.textContent=t)})}c.text=Be;function $(t,e,n){if(!E(t))return;const i=C.getComputedStyle(t,null);return n?i.getPropertyValue(e)||void 0:i[e]||t.style[e]}function S(t,e){return parseInt($(t,e),10)||0}function Ut(t,e){return S(t,`border${e?"Left":"Top"}Width`)+S(t,`padding${e?"Left":"Top"}`)+S(t,`padding${e?"Right":"Bottom"}`)+S(t,`border${e?"Right":"Bottom"}Width`)}const Ct={};function $e(t){if(Ct[t])return Ct[t];const e=O(t);y.body.insertBefore(e,null);const n=$(e,"display");return y.body.removeChild(e),Ct[t]=n!=="none"?n:"block"}function Ht(t){return $(t,"display")==="none"}function Vt(t,e){const n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function ct(t){return k(t)?(e,n)=>Vt(n,t):V(t)?t:mt(t)?(e,n)=>t.is(n):t?(e,n)=>n===t:()=>!1}c.filter=function(t){const e=ct(t);return o(pt.call(this,(n,i)=>e.call(n,i,n)))};function D(t,e){return e?t.filter(e):t}c.detach=function(t){return D(this,t).each((e,n)=>{n.parentNode&&n.parentNode.removeChild(n)}),this};const Me=/^\s*<(\w+)[^>]*>/,De=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Yt={"*":Bt,tr:we,td:$t,th:$t,thead:ht,tbody:ht,tfoot:ht};function Ft(t){if(!k(t))return[];if(De.test(t))return[O(RegExp.$1)];const e=Me.test(t)&&RegExp.$1,n=Yt[e]||Yt["*"];return n.innerHTML=t,o(n.childNodes).detach().get()}o.parseHTML=Ft,c.has=function(t){const e=k(t)?(n,i)=>yt(t,i).length:(n,i)=>i.contains(t);return this.filter(e)},c.not=function(t){const e=ct(t);return this.filter((n,i)=>(!k(t)||E(i))&&!e.call(i,n,i))};function M(t,e,n,i){const s=[],r=V(e),u=i&&ct(i);for(let a=0,p=t.length;ae.selected&&!e.disabled&&!e.parentNode.disabled),"value"):t.value||""}function Ie(t){return arguments.length?this.each((e,n)=>{const i=n.multiple&&n.options;if(i||ne.test(n.type)){const s=it(t)?It.call(t,String):X(t)?[]:[String(t)];i?T(n.options,(r,u)=>{u.selected=s.indexOf(u.value)>=0},!0):n.checked=s.indexOf(n.value)>=0}else n.value=R(t)||X(t)?"":t}):this[0]&&Jt(this[0])}c.val=Ie,c.is=function(t){const e=ct(t);return gt.call(this,(n,i)=>e.call(n,i,n))},o.guid=1;function _(t){return t.length>1?pt.call(t,(e,n,i)=>Dt.call(i,e)===n):t}o.unique=_,c.add=function(t,e){return o(_(this.get().concat(o(t,e).get())))},c.children=function(t){return D(o(_(M(this,e=>e.children))),t)},c.parent=function(t){return D(o(_(M(this,"parentNode"))),t)},c.index=function(t){const e=t?o(t)[0]:this[0],n=t?this:o(e).parent().children();return Dt.call(n,e)},c.closest=function(t){const e=this.filter(t);if(e.length)return e;const n=this.parent();return n.length?n.closest(t):e},c.siblings=function(t){return D(o(_(M(this,e=>o(e).parent().children().not(e)))),t)},c.find=function(t){return o(_(M(this,e=>yt(t,e))))};const Pe=/^\s*\s*$/g,je=/^$|^module$|\/(java|ecma)script/i,Ue=["type","src","nonce","noModule"];function He(t,e){const n=o(t);n.filter("script").add(n.find("script")).each((i,s)=>{if(je.test(s.type)&&N.contains(s)){const r=O("script");r.text=s.textContent.replace(Pe,""),T(Ue,(u,a)=>{s[a]&&(r[a]=s[a])}),e.head.insertBefore(r,null),e.head.removeChild(r)}})}function Ve(t,e,n,i,s){i?t.insertBefore(e,n?t.firstChild:null):t.nodeName==="HTML"?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&He(e,t.ownerDocument)}function I(t,e,n,i,s,r,u,a){return T(t,(p,d)=>{T(o(d),(g,x)=>{T(o(e),(L,v)=>{const P=n?x:v,w=n?v:x,q=n?g:L;Ve(P,q?w.cloneNode(!0):w,i,s,!q)},a)},u)},r),e}c.after=function(){return I(arguments,this,!1,!1,!1,!0,!0)},c.append=function(){return I(arguments,this,!1,!1,!0)};function Ye(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(R(t))return this;const e=/
8 |
9 |
10 |
11 |
29 |
30 |
31 |
34 |
35 |
36 |
37 |
40 |
41 |
42 |
43 |
44 |
45 |