@softwarity/geojson-editor 1.0.14 → 1.0.16

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.
@@ -11,6 +11,10 @@
11
11
  }
12
12
 
13
13
  :host {
14
+ --line-height: 19.5px;
15
+ --gutter-width: 50px;
16
+ --editor-padding-y: 8px;
17
+ --editor-padding-x: 12px;
14
18
  display: flex;
15
19
  flex-direction: column;
16
20
  position: relative;
@@ -42,7 +46,7 @@
42
46
 
43
47
  /* ========== Gutter ========== */
44
48
  .gutter {
45
- width: 50px;
49
+ width: var(--gutter-width);
46
50
  background: var(--gutter-bg, #f0f0f0);
47
51
  border-right: 1px solid var(--gutter-border, #e0e0e0);
48
52
  overflow: hidden;
@@ -71,7 +75,7 @@
71
75
  }
72
76
 
73
77
  .gutter-line {
74
- height: 19.5px; /* line-height * font-size = 1.5 * 13px */
78
+ height: var(--line-height);
75
79
  display: flex;
76
80
  align-items: center;
77
81
  justify-content: flex-end;
@@ -95,50 +99,13 @@
95
99
  }
96
100
 
97
101
  /* ========== Gutter Controls ========== */
98
- .color-indicator, .collapse-button, .boolean-checkbox {
102
+ .collapse-button {
99
103
  width: 12px;
100
104
  height: 12px;
101
105
  border-radius: 2px;
102
106
  cursor: pointer;
103
107
  transition: transform 0.1s;
104
108
  flex-shrink: 0;
105
- }
106
-
107
- .color-indicator {
108
- border: 1px solid #555;
109
- }
110
- .color-indicator:hover {
111
- transform: scale(1.2);
112
- border-color: #fff;
113
- }
114
-
115
- .boolean-checkbox {
116
- appearance: none;
117
- -webkit-appearance: none;
118
- background: transparent;
119
- border: 1.5px solid var(--control-border, #c0c0c0);
120
- border-radius: 2px;
121
- margin: 0;
122
- position: relative;
123
- }
124
- .boolean-checkbox:checked {
125
- border-color: var(--control-color, #000080);
126
- }
127
- .boolean-checkbox:checked::after {
128
- content: '✔';
129
- color: var(--control-color, #000080);
130
- font-size: 11px;
131
- font-weight: bold;
132
- position: absolute;
133
- top: -3px;
134
- right: -1px;
135
- }
136
- .boolean-checkbox:hover {
137
- transform: scale(1.2);
138
- border-color: var(--control-color, #000080);
139
- }
140
-
141
- .collapse-button {
142
109
  background: transparent;
143
110
  border: none;
144
111
  color: var(--json-punct, #a9b7c6);
@@ -167,25 +134,6 @@
167
134
  }
168
135
  }
169
136
 
170
- .visibility-button {
171
- width: 14px;
172
- height: 14px;
173
- background: transparent;
174
- color: var(--control-color, #000080);
175
- border: none;
176
- cursor: pointer;
177
- display: flex;
178
- align-items: center;
179
- justify-content: center;
180
- transition: all 0.1s;
181
- flex-shrink: 0;
182
- opacity: 0.7;
183
- padding: 0;
184
- font-size: 11px;
185
- }
186
- .visibility-button:hover { opacity: 1; transform: scale(1.15); }
187
- .visibility-button.hidden { opacity: 0.35; }
188
-
189
137
  /* ========== Editor Content ========== */
190
138
  .editor-content {
191
139
  position: relative;
@@ -217,7 +165,7 @@
217
165
  position: absolute;
218
166
  inset: 0;
219
167
  overflow: auto;
220
- padding: 8px 12px;
168
+ padding: var(--editor-padding-y) var(--editor-padding-x);
221
169
  overscroll-behavior: contain; /* Prevent scroll chaining to parent */
222
170
  }
223
171
 
@@ -238,7 +186,7 @@
238
186
 
239
187
  /* Single line */
240
188
  .line {
241
- height: 19.5px; /* line-height * font-size */
189
+ height: var(--line-height);
242
190
  white-space: pre;
243
191
  display: block;
244
192
  position: relative;
@@ -270,20 +218,16 @@
270
218
  z-index: 0;
271
219
  }
272
220
 
273
- .line-hidden > span {
274
- opacity: 0.35;
275
- filter: grayscale(50%);
276
- }
277
-
278
- .line-collapsed {
279
- display: none;
221
+ .line-hidden > span {
222
+ opacity: 0.35;
223
+ filter: grayscale(50%);
280
224
  }
281
225
 
282
226
  /* Placeholder */
283
227
  .placeholder-layer {
284
228
  position: absolute;
285
- top: 8px;
286
- left: 12px;
229
+ top: var(--editor-padding-y);
230
+ left: var(--editor-padding-x);
287
231
  color: #6a6a6a;
288
232
  pointer-events: none;
289
233
  z-index: 0;
@@ -303,9 +247,6 @@
303
247
  .geojson-type { color: var(--geojson-type, #008000); font-weight: 600; }
304
248
  .geojson-type-invalid { color: var(--geojson-type-invalid, #f00); font-weight: 600; }
305
249
 
306
- /* Hidden marker - invisible but present for data */
307
- .d-none { display: none; }
308
-
309
250
  /* Collapsed node styling */
310
251
  .collapsed-bracket-array,
311
252
  .collapsed-bracket-object {
@@ -316,7 +257,6 @@
316
257
  content: '…';
317
258
  color: var(--json-punct, #888);
318
259
  }
319
- .collapsed-content { display: none; }
320
260
 
321
261
  /* ========== Prefix/Suffix ========== */
322
262
  .prefix-wrapper, .suffix-wrapper {
@@ -326,7 +266,7 @@
326
266
  }
327
267
 
328
268
  .prefix-gutter, .suffix-gutter {
329
- width: 50px;
269
+ width: var(--gutter-width);
330
270
  background: var(--gutter-bg, #f0f0f0);
331
271
  border-right: 1px solid var(--gutter-border, #e0e0e0);
332
272
  flex-shrink: 0;
@@ -399,11 +339,6 @@
399
339
  .viewport::-webkit-scrollbar-thumb:hover { background: var(--control-color, #000080); }
400
340
  .viewport { scrollbar-width: thin; scrollbar-color: var(--control-border, #c0c0c0) var(--control-bg, #e8e8e8); }
401
341
 
402
- /* ========== Selection highlight ========== */
403
- .line .selected {
404
- background: rgba(51, 153, 255, 0.3);
405
- }
406
-
407
342
  /* ========== Inline Controls (using ::before pseudo-elements) ========== */
408
343
 
409
344
  /* Shared styles for inline control pseudo-elements */
@@ -453,9 +388,6 @@
453
388
  }
454
389
 
455
390
  /* Feature visibility using ::before on the line (placed in indentation space) */
456
- .line.has-visibility {
457
- position: relative;
458
- }
459
391
  .line.has-visibility::before {
460
392
  content: '👁';
461
393
  position: absolute;
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * HTML Template for GeoJSON Editor
3
- * @param {string} placeholder - Placeholder text
4
- * @returns {string} HTML template string
5
3
  */
6
- export function getTemplate(placeholder = '', version = '') {
4
+ export function getTemplate(placeholder: string = '', version: string = ''): string {
7
5
  return `
8
6
  <div class="prefix-wrapper">
9
7
  <div class="prefix-gutter"></div>
@@ -46,10 +44,8 @@ export function getTemplate(placeholder = '', version = '') {
46
44
 
47
45
  /**
48
46
  * Escape HTML special characters
49
- * @param {string} text - Text to escape
50
- * @returns {string} Escaped text
51
47
  */
52
- function escapeHtml(text) {
48
+ function escapeHtml(text: string): string {
53
49
  if (!text) return '';
54
50
  return text
55
51
  .replace(/&/g, '&amp;')