@lit-material/key-value 0.0.0-stage → 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bohdaq
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.
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # @lit-material/key-value
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An editor for ordered key/value pairs: labels, annotations, environment variables, headers. Each
4
+ row is a key field, a value field and a remove button. It flags duplicate and missing keys, can
5
+ check keys against a pattern, and turns pasted `KEY=value` lines into rows. Built with
6
+ [Lit](https://lit.dev/). Part of [lit-material](https://github.com/bohdaq/lit-material).
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install @lit-material/key-value @lit-material/tokens
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```html
17
+ <lit-material-key-value-editor
18
+ id="labels"
19
+ key-label="Label"
20
+ add-label="Add label"
21
+ key-pattern="([a-z0-9]([-a-z0-9.]*[a-z0-9])?/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?"
22
+ key-pattern-message="Letters, digits, - _ . and an optional prefix/"
23
+ ></lit-material-key-value-editor>
24
+
25
+ <script type="module">
26
+ import "@lit-material/key-value";
27
+ const labels = document.querySelector("#labels");
28
+ labels.entries = [{ key: "app", value: "web" }];
29
+ labels.addEventListener("change", (e) => console.log(e.detail.entries));
30
+ // On save:
31
+ if (labels.checkValidity()) save(labels.toObject());
32
+ </script>
33
+ ```
34
+
35
+ ## API
36
+
37
+ | Property | Attribute | Type | Default |
38
+ | ------------------- | --------------------- | ----------------- | --------------- |
39
+ | `entries` | — | `KeyValueEntry[]` | `[]` |
40
+ | `keyLabel` | `key-label` | `string` | `"Key"` |
41
+ | `valueLabel` | `value-label` | `string` | `"Value"` |
42
+ | `addLabel` | `add-label` | `string` | `"Add"` |
43
+ | `keyPattern` | `key-pattern` | `string` (regex, whole key) | `""` |
44
+ | `keyPatternMessage` | `key-pattern-message` | `string` | `"Invalid key"` |
45
+ | `maskValues` | `mask-values` | `boolean` | `false` |
46
+ | `disabled` | `disabled` (reflected)| `boolean` | `false` |
47
+ | `readonly` | `readonly` | `boolean` | `false` |
48
+
49
+ `KeyValueEntry` is `{ key: string; value: string }`. `entries` leaves out rows whose key and value
50
+ are both empty, so an added, untouched row doesn't count.
51
+
52
+ Methods: `toObject()` (last duplicate wins), `checkValidity()` (focuses the first bad key),
53
+ `addRow()`. Getter: `valid`. Event: `change`, `detail: { entries }`, after every edit, add or
54
+ remove. Parts: `row`, `add`.
55
+
56
+ `parseKeyValues(text)` is exported too: it reads `.env` lines (comments, `export`, quotes),
57
+ `a=b,c=d` selectors and `key: value` lines, and returns `[]` for anything else.
58
+
59
+ ## Behavior
60
+
61
+ - Duplicate keys show "Duplicate key" on each; a value without a key shows "Key required".
62
+ - Add focuses the new key field; removing a row moves focus to the next remove button (or Add).
63
+ - `readonly` and `disabled` hide Add and the remove buttons.
64
+ - Below 480px a row stacks the value under the key.
65
+
66
+ ## License
67
+
68
+ MIT
@@ -0,0 +1,453 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "LitMaterialKeyValueEditor",
13
+ "declaration": {
14
+ "name": "LitMaterialKeyValueEditor",
15
+ "module": "./key-value-editor.js"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "parseKeyValues",
21
+ "declaration": {
22
+ "name": "parseKeyValues",
23
+ "module": "./key-value-editor.js"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "KeyValueEntry",
29
+ "declaration": {
30
+ "name": "KeyValueEntry",
31
+ "module": "./key-value-editor.js"
32
+ }
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "kind": "javascript-module",
38
+ "path": "src/key-value-editor.ts",
39
+ "declarations": [
40
+ {
41
+ "kind": "function",
42
+ "name": "parseKeyValues",
43
+ "return": {
44
+ "type": {
45
+ "text": "KeyValueEntry[]"
46
+ }
47
+ },
48
+ "parameters": [
49
+ {
50
+ "name": "text",
51
+ "type": {
52
+ "text": "string"
53
+ }
54
+ }
55
+ ],
56
+ "description": "Parses pasted `KEY=value` (or `key: value`) lines, as from a `.env` file or\n`kubectl get --show-labels`. Blank lines and `#` comments are skipped, a\nleading `export ` is dropped and one pair of matching quotes around the\nvalue is removed. Returns `[]` when the text isn't in that shape."
57
+ },
58
+ {
59
+ "kind": "class",
60
+ "description": "Edits an ordered list of key/value pairs: labels, annotations,\nenvironment variables, headers. Each row is a key field, a value field\nand a remove button; \"Add\" appends a row and focuses its key.\n\nIt flags a duplicate key, a value without a key and, with `key-pattern`,\na key that doesn't match (e.g. a Kubernetes label key). `valid` and\n`checkValidity()` report it, so a form can refuse to submit.\n\nPasting several `KEY=value` lines (a `.env` file) into a key field turns\nthem into rows.\n\nRows with an empty key and value are left out of `entries` and the\n`change` event, so an added, untouched row costs nothing.",
61
+ "name": "LitMaterialKeyValueEditor",
62
+ "cssParts": [
63
+ {
64
+ "description": "One key/value row.",
65
+ "name": "row"
66
+ },
67
+ {
68
+ "description": "The add button.",
69
+ "name": "add"
70
+ }
71
+ ],
72
+ "members": [
73
+ {
74
+ "kind": "field",
75
+ "name": "keyLabel",
76
+ "type": {
77
+ "text": "string"
78
+ },
79
+ "default": "\"Key\"",
80
+ "description": "Label of the key fields.",
81
+ "attribute": "key-label"
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "name": "valueLabel",
86
+ "type": {
87
+ "text": "string"
88
+ },
89
+ "default": "\"Value\"",
90
+ "description": "Label of the value fields.",
91
+ "attribute": "value-label"
92
+ },
93
+ {
94
+ "kind": "field",
95
+ "name": "addLabel",
96
+ "type": {
97
+ "text": "string"
98
+ },
99
+ "default": "\"Add\"",
100
+ "description": "Label of the add button.",
101
+ "attribute": "add-label"
102
+ },
103
+ {
104
+ "kind": "field",
105
+ "name": "keyPattern",
106
+ "type": {
107
+ "text": "string"
108
+ },
109
+ "default": "\"\"",
110
+ "description": "A regular expression (whole key) every key must match.",
111
+ "attribute": "key-pattern"
112
+ },
113
+ {
114
+ "kind": "field",
115
+ "name": "keyPatternMessage",
116
+ "type": {
117
+ "text": "string"
118
+ },
119
+ "default": "\"Invalid key\"",
120
+ "description": "Error shown when a key doesn't match `key-pattern`.",
121
+ "attribute": "key-pattern-message"
122
+ },
123
+ {
124
+ "kind": "field",
125
+ "name": "maskValues",
126
+ "type": {
127
+ "text": "boolean"
128
+ },
129
+ "default": "false",
130
+ "description": "Show values as password fields, e.g. secrets.",
131
+ "attribute": "mask-values"
132
+ },
133
+ {
134
+ "kind": "field",
135
+ "name": "disabled",
136
+ "type": {
137
+ "text": "boolean"
138
+ },
139
+ "default": "false",
140
+ "attribute": "disabled",
141
+ "reflects": true
142
+ },
143
+ {
144
+ "kind": "field",
145
+ "name": "readonly",
146
+ "type": {
147
+ "text": "boolean"
148
+ },
149
+ "default": "false",
150
+ "attribute": "readonly"
151
+ },
152
+ {
153
+ "kind": "field",
154
+ "name": "rows",
155
+ "type": {
156
+ "text": "Row[]"
157
+ },
158
+ "privacy": "private",
159
+ "default": "[]"
160
+ },
161
+ {
162
+ "kind": "field",
163
+ "name": "entries",
164
+ "type": {
165
+ "text": "KeyValueEntry[]"
166
+ },
167
+ "description": "The pairs, in order, without blank rows. Setting it replaces every row."
168
+ },
169
+ {
170
+ "kind": "method",
171
+ "name": "toObject",
172
+ "return": {
173
+ "type": {
174
+ "text": "Record<string, string>"
175
+ }
176
+ },
177
+ "description": "The pairs as an object; with duplicate keys the last one wins."
178
+ },
179
+ {
180
+ "kind": "field",
181
+ "name": "valid",
182
+ "type": {
183
+ "text": "boolean"
184
+ },
185
+ "description": "`true` when no row has an error.",
186
+ "readonly": true
187
+ },
188
+ {
189
+ "kind": "method",
190
+ "name": "checkValidity",
191
+ "return": {
192
+ "type": {
193
+ "text": "boolean"
194
+ }
195
+ },
196
+ "description": "Same as `valid`; focuses the first bad key when there is one."
197
+ },
198
+ {
199
+ "kind": "method",
200
+ "name": "addRow",
201
+ "return": {
202
+ "type": {
203
+ "text": "Promise<void>"
204
+ }
205
+ },
206
+ "description": "Appends a blank row and focuses its key field."
207
+ },
208
+ {
209
+ "kind": "method",
210
+ "name": "fieldFor",
211
+ "privacy": "private",
212
+ "return": {
213
+ "type": {
214
+ "text": "HTMLElement | null"
215
+ }
216
+ },
217
+ "parameters": [
218
+ {
219
+ "name": "id",
220
+ "type": {
221
+ "text": "number"
222
+ }
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "kind": "field",
228
+ "name": "keyRegExp",
229
+ "type": {
230
+ "text": "RegExp | undefined"
231
+ },
232
+ "privacy": "private",
233
+ "readonly": true
234
+ },
235
+ {
236
+ "kind": "method",
237
+ "name": "keyError",
238
+ "privacy": "private",
239
+ "return": {
240
+ "type": {
241
+ "text": "string"
242
+ }
243
+ },
244
+ "parameters": [
245
+ {
246
+ "name": "row",
247
+ "type": {
248
+ "text": "Row"
249
+ }
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ "kind": "method",
255
+ "name": "emit",
256
+ "privacy": "private",
257
+ "return": {
258
+ "type": {
259
+ "text": "void"
260
+ }
261
+ }
262
+ },
263
+ {
264
+ "kind": "method",
265
+ "name": "edit",
266
+ "privacy": "private",
267
+ "return": {
268
+ "type": {
269
+ "text": "void"
270
+ }
271
+ },
272
+ "parameters": [
273
+ {
274
+ "name": "row",
275
+ "type": {
276
+ "text": "Row"
277
+ }
278
+ },
279
+ {
280
+ "name": "field",
281
+ "type": {
282
+ "text": "\"key\" | \"value\""
283
+ }
284
+ },
285
+ {
286
+ "name": "event",
287
+ "type": {
288
+ "text": "Event"
289
+ }
290
+ }
291
+ ]
292
+ },
293
+ {
294
+ "kind": "method",
295
+ "name": "removeRow",
296
+ "privacy": "private",
297
+ "return": {
298
+ "type": {
299
+ "text": "Promise<void>"
300
+ }
301
+ },
302
+ "parameters": [
303
+ {
304
+ "name": "row",
305
+ "type": {
306
+ "text": "Row"
307
+ }
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ "kind": "method",
313
+ "name": "paste",
314
+ "privacy": "private",
315
+ "return": {
316
+ "type": {
317
+ "text": "void"
318
+ }
319
+ },
320
+ "parameters": [
321
+ {
322
+ "name": "row",
323
+ "type": {
324
+ "text": "Row"
325
+ }
326
+ },
327
+ {
328
+ "name": "event",
329
+ "type": {
330
+ "text": "ClipboardEvent"
331
+ }
332
+ }
333
+ ]
334
+ }
335
+ ],
336
+ "events": [
337
+ {
338
+ "name": "change",
339
+ "type": {
340
+ "text": "CustomEvent"
341
+ },
342
+ "description": "After any edit, add or remove; `detail` is `{ entries }`."
343
+ }
344
+ ],
345
+ "attributes": [
346
+ {
347
+ "name": "key-label",
348
+ "type": {
349
+ "text": "string"
350
+ },
351
+ "default": "\"Key\"",
352
+ "description": "Label of the key fields.",
353
+ "fieldName": "keyLabel"
354
+ },
355
+ {
356
+ "name": "value-label",
357
+ "type": {
358
+ "text": "string"
359
+ },
360
+ "default": "\"Value\"",
361
+ "description": "Label of the value fields.",
362
+ "fieldName": "valueLabel"
363
+ },
364
+ {
365
+ "name": "add-label",
366
+ "type": {
367
+ "text": "string"
368
+ },
369
+ "default": "\"Add\"",
370
+ "description": "Label of the add button.",
371
+ "fieldName": "addLabel"
372
+ },
373
+ {
374
+ "name": "key-pattern",
375
+ "type": {
376
+ "text": "string"
377
+ },
378
+ "default": "\"\"",
379
+ "description": "A regular expression (whole key) every key must match.",
380
+ "fieldName": "keyPattern"
381
+ },
382
+ {
383
+ "name": "key-pattern-message",
384
+ "type": {
385
+ "text": "string"
386
+ },
387
+ "default": "\"Invalid key\"",
388
+ "description": "Error shown when a key doesn't match `key-pattern`.",
389
+ "fieldName": "keyPatternMessage"
390
+ },
391
+ {
392
+ "name": "mask-values",
393
+ "type": {
394
+ "text": "boolean"
395
+ },
396
+ "default": "false",
397
+ "description": "Show values as password fields, e.g. secrets.",
398
+ "fieldName": "maskValues"
399
+ },
400
+ {
401
+ "name": "disabled",
402
+ "type": {
403
+ "text": "boolean"
404
+ },
405
+ "default": "false",
406
+ "fieldName": "disabled"
407
+ },
408
+ {
409
+ "name": "readonly",
410
+ "type": {
411
+ "text": "boolean"
412
+ },
413
+ "default": "false",
414
+ "fieldName": "readonly"
415
+ }
416
+ ],
417
+ "superclass": {
418
+ "name": "LitElement",
419
+ "package": "lit"
420
+ },
421
+ "tagName": "lit-material-key-value-editor",
422
+ "customElement": true
423
+ }
424
+ ],
425
+ "exports": [
426
+ {
427
+ "kind": "js",
428
+ "name": "parseKeyValues",
429
+ "declaration": {
430
+ "name": "parseKeyValues",
431
+ "module": "src/key-value-editor.ts"
432
+ }
433
+ },
434
+ {
435
+ "kind": "js",
436
+ "name": "LitMaterialKeyValueEditor",
437
+ "declaration": {
438
+ "name": "LitMaterialKeyValueEditor",
439
+ "module": "src/key-value-editor.ts"
440
+ }
441
+ },
442
+ {
443
+ "kind": "custom-element-definition",
444
+ "name": "lit-material-key-value-editor",
445
+ "declaration": {
446
+ "name": "LitMaterialKeyValueEditor",
447
+ "module": "src/key-value-editor.ts"
448
+ }
449
+ }
450
+ ]
451
+ }
452
+ ]
453
+ }
@@ -0,0 +1,3 @@
1
+ export { LitMaterialKeyValueEditor, parseKeyValues } from "./key-value-editor.js";
2
+ export type { KeyValueEntry } from "./key-value-editor.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClF,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { LitMaterialKeyValueEditor, parseKeyValues } from "./key-value-editor.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { LitElement } from "lit";
2
+ import "@lit-material/button";
3
+ import "@lit-material/icon-button";
4
+ import "@lit-material/text-field";
5
+ export interface KeyValueEntry {
6
+ key: string;
7
+ value: string;
8
+ }
9
+ /**
10
+ * Parses pasted `KEY=value` (or `key: value`) lines, as from a `.env` file or
11
+ * `kubectl get --show-labels`. Blank lines and `#` comments are skipped, a
12
+ * leading `export ` is dropped and one pair of matching quotes around the
13
+ * value is removed. Returns `[]` when the text isn't in that shape.
14
+ */
15
+ export declare function parseKeyValues(text: string): KeyValueEntry[];
16
+ /**
17
+ * Edits an ordered list of key/value pairs: labels, annotations,
18
+ * environment variables, headers. Each row is a key field, a value field
19
+ * and a remove button; "Add" appends a row and focuses its key.
20
+ *
21
+ * It flags a duplicate key, a value without a key and, with `key-pattern`,
22
+ * a key that doesn't match (e.g. a Kubernetes label key). `valid` and
23
+ * `checkValidity()` report it, so a form can refuse to submit.
24
+ *
25
+ * Pasting several `KEY=value` lines (a `.env` file) into a key field turns
26
+ * them into rows.
27
+ *
28
+ * Rows with an empty key and value are left out of `entries` and the
29
+ * `change` event, so an added, untouched row costs nothing.
30
+ *
31
+ * @element lit-material-key-value-editor
32
+ *
33
+ * @fires change - After any edit, add or remove; `detail` is `{ entries }`.
34
+ *
35
+ * @csspart row - One key/value row.
36
+ * @csspart add - The add button.
37
+ */
38
+ export declare class LitMaterialKeyValueEditor extends LitElement {
39
+ static styles: import("lit").CSSResult;
40
+ /** Label of the key fields. */
41
+ keyLabel: string;
42
+ /** Label of the value fields. */
43
+ valueLabel: string;
44
+ /** Label of the add button. */
45
+ addLabel: string;
46
+ /** A regular expression (whole key) every key must match. */
47
+ keyPattern: string;
48
+ /** Error shown when a key doesn't match `key-pattern`. */
49
+ keyPatternMessage: string;
50
+ /** Show values as password fields, e.g. secrets. */
51
+ maskValues: boolean;
52
+ disabled: boolean;
53
+ readonly: boolean;
54
+ private rows;
55
+ /** The pairs, in order, without blank rows. Setting it replaces every row. */
56
+ get entries(): KeyValueEntry[];
57
+ set entries(entries: readonly KeyValueEntry[]);
58
+ /** The pairs as an object; with duplicate keys the last one wins. */
59
+ toObject(): Record<string, string>;
60
+ /** `true` when no row has an error. */
61
+ get valid(): boolean;
62
+ /** Same as `valid`; focuses the first bad key when there is one. */
63
+ checkValidity(): boolean;
64
+ /** Appends a blank row and focuses its key field. */
65
+ addRow(): Promise<void>;
66
+ private fieldFor;
67
+ private get keyRegExp();
68
+ private keyError;
69
+ private emit;
70
+ private edit;
71
+ private removeRow;
72
+ private paste;
73
+ render(): import("lit").TemplateResult<1>;
74
+ }
75
+ declare global {
76
+ interface HTMLElementTagNameMap {
77
+ "lit-material-key-value-editor": LitMaterialKeyValueEditor;
78
+ }
79
+ }
80
+ //# sourceMappingURL=key-value-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-value-editor.d.ts","sourceRoot":"","sources":["../src/key-value-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAGrD,OAAO,sBAAsB,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,0BAA0B,CAAC;AAElC,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAQD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAc5D;AAQD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBACa,yBAA0B,SAAQ,UAAU;IACvD,OAAgB,MAAM,0BA0CpB;IAEF,+BAA+B;IACO,QAAQ,SAAS;IAEvD,iCAAiC;IACO,UAAU,SAAW;IAE7D,+BAA+B;IACO,QAAQ,SAAS;IAEvD,6DAA6D;IACrB,UAAU,SAAM;IAExD,0DAA0D;IACV,iBAAiB,SAAiB;IAElF,oDAAoD;IACG,UAAU,UAAS;IAE9B,QAAQ,UAAS;IAEhC,QAAQ,UAAS;IAE9C,OAAO,CAAC,IAAI,CAAa;IAEzB,8EAA8E;IAC9E,IACI,OAAO,IAAI,aAAa,EAAE,CAE7B;IACD,IAAI,OAAO,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,EAI5C;IAED,qEAAqE;IACrE,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIlC,uCAAuC;IACvC,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,oEAAoE;IACpE,aAAa,IAAI,OAAO;IAOxB,qDAAqD;IAC/C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B,OAAO,CAAC,QAAQ;IAIhB,OAAO,KAAK,SAAS,GAMpB;IAED,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,IAAI;YAME,SAAS;IAUvB,OAAO,CAAC,KAAK;IAYJ,MAAM;CA0DhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,+BAA+B,EAAE,yBAAyB,CAAC;KAC5D;CACF"}
@@ -0,0 +1,295 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement, nothing } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { repeat } from "lit/directives/repeat.js";
10
+ import "@lit-material/button";
11
+ import "@lit-material/icon-button";
12
+ import "@lit-material/text-field";
13
+ // Material icons close, add (Apache 2.0).
14
+ const removeIcon = html `<svg viewBox="0 0 24 24" aria-hidden="true">
15
+ <path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
16
+ </svg>`;
17
+ const addIcon = html `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path></svg>`;
18
+ /**
19
+ * Parses pasted `KEY=value` (or `key: value`) lines, as from a `.env` file or
20
+ * `kubectl get --show-labels`. Blank lines and `#` comments are skipped, a
21
+ * leading `export ` is dropped and one pair of matching quotes around the
22
+ * value is removed. Returns `[]` when the text isn't in that shape.
23
+ */
24
+ export function parseKeyValues(text) {
25
+ const lines = text
26
+ .split(/\r?\n|,(?=[^=,\s]+=)/)
27
+ .map((l) => l.trim())
28
+ .filter((l) => l && !l.startsWith("#"));
29
+ const entries = [];
30
+ for (const line of lines) {
31
+ const match = /^(?:export\s+)?([^=:\s][^=:]*?)\s*(?:=|:\s)\s*(.*)$/.exec(line);
32
+ if (!match)
33
+ return [];
34
+ let value = match[2] ?? "";
35
+ if (value.length >= 2 && /^(["']).*\1$/.test(value))
36
+ value = value.slice(1, -1);
37
+ entries.push({ key: match[1] ?? "", value });
38
+ }
39
+ return entries;
40
+ }
41
+ let nextRowId = 0;
42
+ /**
43
+ * Edits an ordered list of key/value pairs: labels, annotations,
44
+ * environment variables, headers. Each row is a key field, a value field
45
+ * and a remove button; "Add" appends a row and focuses its key.
46
+ *
47
+ * It flags a duplicate key, a value without a key and, with `key-pattern`,
48
+ * a key that doesn't match (e.g. a Kubernetes label key). `valid` and
49
+ * `checkValidity()` report it, so a form can refuse to submit.
50
+ *
51
+ * Pasting several `KEY=value` lines (a `.env` file) into a key field turns
52
+ * them into rows.
53
+ *
54
+ * Rows with an empty key and value are left out of `entries` and the
55
+ * `change` event, so an added, untouched row costs nothing.
56
+ *
57
+ * @element lit-material-key-value-editor
58
+ *
59
+ * @fires change - After any edit, add or remove; `detail` is `{ entries }`.
60
+ *
61
+ * @csspart row - One key/value row.
62
+ * @csspart add - The add button.
63
+ */
64
+ let LitMaterialKeyValueEditor = class LitMaterialKeyValueEditor extends LitElement {
65
+ constructor() {
66
+ super(...arguments);
67
+ /** Label of the key fields. */
68
+ this.keyLabel = "Key";
69
+ /** Label of the value fields. */
70
+ this.valueLabel = "Value";
71
+ /** Label of the add button. */
72
+ this.addLabel = "Add";
73
+ /** A regular expression (whole key) every key must match. */
74
+ this.keyPattern = "";
75
+ /** Error shown when a key doesn't match `key-pattern`. */
76
+ this.keyPatternMessage = "Invalid key";
77
+ /** Show values as password fields, e.g. secrets. */
78
+ this.maskValues = false;
79
+ this.disabled = false;
80
+ this.readonly = false;
81
+ this.rows = [];
82
+ }
83
+ static { this.styles = css `
84
+ :host {
85
+ display: block;
86
+ }
87
+ :host([hidden]) {
88
+ display: none;
89
+ }
90
+ .rows {
91
+ display: grid;
92
+ gap: 8px;
93
+ margin-block-end: 8px;
94
+ }
95
+ .row {
96
+ display: grid;
97
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto;
98
+ align-items: start;
99
+ gap: 8px;
100
+ }
101
+ .row > lit-material-text-field {
102
+ --lit-material-text-field-min-width: 0;
103
+ width: 100%;
104
+ }
105
+ lit-material-icon-button {
106
+ margin-block-start: 8px;
107
+ }
108
+ svg {
109
+ width: 100%;
110
+ height: 100%;
111
+ fill: currentColor;
112
+ }
113
+ .add svg {
114
+ width: 18px;
115
+ height: 18px;
116
+ }
117
+ @media (max-width: 480px) {
118
+ .row {
119
+ grid-template-columns: minmax(0, 1fr) auto;
120
+ }
121
+ .row > lit-material-text-field:nth-child(2) {
122
+ grid-row: 2;
123
+ }
124
+ }
125
+ `; }
126
+ /** The pairs, in order, without blank rows. Setting it replaces every row. */
127
+ get entries() {
128
+ return this.rows.filter((r) => r.key || r.value).map(({ key, value }) => ({ key, value }));
129
+ }
130
+ set entries(entries) {
131
+ const old = this.entries;
132
+ this.rows = entries.map(({ key, value }) => ({ id: ++nextRowId, key, value }));
133
+ this.requestUpdate("entries", old);
134
+ }
135
+ /** The pairs as an object; with duplicate keys the last one wins. */
136
+ toObject() {
137
+ return Object.fromEntries(this.entries.map((e) => [e.key, e.value]));
138
+ }
139
+ /** `true` when no row has an error. */
140
+ get valid() {
141
+ return this.rows.every((row) => !this.keyError(row));
142
+ }
143
+ /** Same as `valid`; focuses the first bad key when there is one. */
144
+ checkValidity() {
145
+ const bad = this.rows.find((row) => this.keyError(row));
146
+ if (!bad)
147
+ return true;
148
+ this.fieldFor(bad.id)?.focus();
149
+ return false;
150
+ }
151
+ /** Appends a blank row and focuses its key field. */
152
+ async addRow() {
153
+ const row = { id: ++nextRowId, key: "", value: "" };
154
+ this.rows = [...this.rows, row];
155
+ this.requestUpdate();
156
+ await this.updateComplete;
157
+ this.fieldFor(row.id)?.focus();
158
+ }
159
+ fieldFor(id) {
160
+ return this.renderRoot.querySelector(`[data-row="${id}"] .key`);
161
+ }
162
+ get keyRegExp() {
163
+ try {
164
+ return new RegExp(`^(?:${this.keyPattern})$`, "u");
165
+ }
166
+ catch {
167
+ return undefined; // A broken pattern accepts nothing rather than throwing on every render.
168
+ }
169
+ }
170
+ keyError(row) {
171
+ if (!row.key)
172
+ return row.value ? "Key required" : "";
173
+ if (this.rows.some((other) => other !== row && other.key === row.key))
174
+ return "Duplicate key";
175
+ if (this.keyPattern && !this.keyRegExp?.test(row.key))
176
+ return this.keyPatternMessage;
177
+ return "";
178
+ }
179
+ emit() {
180
+ this.requestUpdate();
181
+ this.dispatchEvent(new CustomEvent("change", { bubbles: true, composed: true, detail: { entries: this.entries } }));
182
+ }
183
+ edit(row, field, event) {
184
+ event.stopPropagation();
185
+ row[field] = event.target.value;
186
+ this.emit();
187
+ }
188
+ async removeRow(row) {
189
+ const index = this.rows.indexOf(row);
190
+ this.rows = this.rows.filter((r) => r !== row);
191
+ this.emit();
192
+ await this.updateComplete;
193
+ // Keep focus in the list: the next row's remove button, else the previous one's, else Add.
194
+ const buttons = this.renderRoot.querySelectorAll(".remove");
195
+ (buttons[Math.min(index, buttons.length - 1)] ?? this.renderRoot.querySelector(".add"))?.focus();
196
+ }
197
+ paste(row, event) {
198
+ // A plain key (no "=" or ": ") pastes as usual.
199
+ const pasted = parseKeyValues(event.clipboardData?.getData("text/plain") ?? "");
200
+ if (pasted.length === 0)
201
+ return;
202
+ event.preventDefault();
203
+ const index = this.rows.indexOf(row);
204
+ const replace = !row.key && !row.value ? 1 : 0;
205
+ const added = pasted.map((e) => ({ id: ++nextRowId, ...e }));
206
+ this.rows = [...this.rows.slice(0, index + 1 - replace), ...added, ...this.rows.slice(index + 1)];
207
+ this.emit();
208
+ }
209
+ render() {
210
+ const locked = this.disabled || this.readonly;
211
+ return html `
212
+ ${this.rows.length
213
+ ? html `<div class="rows">
214
+ ${repeat(this.rows, (row) => row.id, (row, i) => {
215
+ const error = this.keyError(row);
216
+ return html `<div part="row" class="row" data-row=${row.id}>
217
+ <lit-material-text-field
218
+ class="key"
219
+ variant="outlined"
220
+ label=${this.keyLabel}
221
+ autocomplete="off"
222
+ spellcheck="false"
223
+ .value=${row.key}
224
+ ?error=${Boolean(error)}
225
+ error-text=${error}
226
+ ?disabled=${this.disabled}
227
+ ?readonly=${this.readonly}
228
+ @input=${(e) => this.edit(row, "key", e)}
229
+ @change=${(e) => e.stopPropagation()}
230
+ @paste=${(e) => this.paste(row, e)}
231
+ ></lit-material-text-field>
232
+ <lit-material-text-field
233
+ variant="outlined"
234
+ label=${this.valueLabel}
235
+ type=${this.maskValues ? "password" : "text"}
236
+ autocomplete="off"
237
+ spellcheck="false"
238
+ .value=${row.value}
239
+ ?disabled=${this.disabled}
240
+ ?readonly=${this.readonly}
241
+ @input=${(e) => this.edit(row, "value", e)}
242
+ @change=${(e) => e.stopPropagation()}
243
+ ></lit-material-text-field>
244
+ ${locked
245
+ ? nothing
246
+ : html `<lit-material-icon-button
247
+ class="remove"
248
+ aria-label=${row.key ? `Remove ${row.key}` : `Remove row ${i + 1}`}
249
+ @click=${() => void this.removeRow(row)}
250
+ ><span slot="icon">${removeIcon}</span></lit-material-icon-button
251
+ >`}
252
+ </div>`;
253
+ })}
254
+ </div>`
255
+ : nothing}
256
+ ${locked
257
+ ? nothing
258
+ : html `<lit-material-button part="add" class="add" variant="text" @click=${() => void this.addRow()}>
259
+ <span slot="icon">${addIcon}</span>${this.addLabel}
260
+ </lit-material-button>`}
261
+ `;
262
+ }
263
+ };
264
+ __decorate([
265
+ property({ attribute: "key-label" })
266
+ ], LitMaterialKeyValueEditor.prototype, "keyLabel", void 0);
267
+ __decorate([
268
+ property({ attribute: "value-label" })
269
+ ], LitMaterialKeyValueEditor.prototype, "valueLabel", void 0);
270
+ __decorate([
271
+ property({ attribute: "add-label" })
272
+ ], LitMaterialKeyValueEditor.prototype, "addLabel", void 0);
273
+ __decorate([
274
+ property({ attribute: "key-pattern" })
275
+ ], LitMaterialKeyValueEditor.prototype, "keyPattern", void 0);
276
+ __decorate([
277
+ property({ attribute: "key-pattern-message" })
278
+ ], LitMaterialKeyValueEditor.prototype, "keyPatternMessage", void 0);
279
+ __decorate([
280
+ property({ type: Boolean, attribute: "mask-values" })
281
+ ], LitMaterialKeyValueEditor.prototype, "maskValues", void 0);
282
+ __decorate([
283
+ property({ type: Boolean, reflect: true })
284
+ ], LitMaterialKeyValueEditor.prototype, "disabled", void 0);
285
+ __decorate([
286
+ property({ type: Boolean })
287
+ ], LitMaterialKeyValueEditor.prototype, "readonly", void 0);
288
+ __decorate([
289
+ property({ attribute: false })
290
+ ], LitMaterialKeyValueEditor.prototype, "entries", null);
291
+ LitMaterialKeyValueEditor = __decorate([
292
+ customElement("lit-material-key-value-editor")
293
+ ], LitMaterialKeyValueEditor);
294
+ export { LitMaterialKeyValueEditor };
295
+ //# sourceMappingURL=key-value-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-value-editor.js","sourceRoot":"","sources":["../src/key-value-editor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,sBAAsB,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,0BAA0B,CAAC;AAOlC,0CAA0C;AAC1C,MAAM,UAAU,GAAG,IAAI,CAAA;;OAEhB,CAAC;AAC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1,69 @@
1
1
  {
2
2
  "name": "@lit-material/key-value",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Key/value editor for lit-material: labels, annotations and environment variables, with duplicate and pattern checks and KEY=value paste.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "bohdaq",
8
+ "email": "bohdaq@gmail.com",
9
+ "url": "https://github.com/bohdaq"
10
+ },
11
+ "homepage": "https://github.com/bohdaq/lit-material#readme",
12
+ "bugs": "https://github.com/bohdaq/lit-material/issues",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+ssh://git@github.com/bohdaq/lit-material.git",
16
+ "directory": "packages/key-value"
17
+ },
18
+ "keywords": [
19
+ "lit",
20
+ "web-components",
21
+ "lit-material",
22
+ "material-design",
23
+ "material-design-3",
24
+ "key-value",
25
+ "labels",
26
+ "environment-variables",
27
+ "editor"
28
+ ],
29
+ "type": "module",
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "default": "./dist/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "custom-elements.json"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "dependencies": {
46
+ "lit": "^3.2.0",
47
+ "@lit-material/button": "0.1.1",
48
+ "@lit-material/icon-button": "0.0.3",
49
+ "@lit-material/text-field": "0.2.0",
50
+ "@lit-material/tokens": "0.0.1"
51
+ },
52
+ "devDependencies": {
53
+ "@lit-labs/ssr": "^3.3.1",
54
+ "@open-wc/testing": "^4.0.0",
55
+ "@web/dev-server-esbuild": "^1.0.0",
56
+ "@web/test-runner": "^0.19.0",
57
+ "@web/test-runner-commands": "^0.9.0",
58
+ "@web/test-runner-playwright": "^0.11.0",
59
+ "tsx": "^4.19.0",
60
+ "typescript": "^5.7.0"
61
+ },
62
+ "customElements": "custom-elements.json",
63
+ "scripts": {
64
+ "build": "tsc -p tsconfig.json",
65
+ "typecheck": "tsc -p tsconfig.json --noEmit",
66
+ "test": "web-test-runner && node --import tsx --test src/*.ssr.test.ts",
67
+ "analyze": "custom-elements-manifest analyze --litelement --globs \"src/**/*.ts\" --exclude \"src/**/*.test.ts\" --exclude \"src/**/*.ssr.test.ts\""
68
+ }
6
69
  }