vira 31.28.0 → 31.28.2
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/dist/elements/vira-json-form.element.d.ts +1 -2
- package/dist/elements/vira-json-form.element.js +40 -34
- package/dist/elements/vira-tabs.element.js +8 -0
- package/dist/elements/vira-tag.element.d.ts +1 -2
- package/dist/elements/vira-tag.element.js +1 -1
- package/dist/styles/vira-color-theme-object.d.ts +1 -2
- package/dist/util/dynamic-element.d.ts +1 -2
- package/dist/util/vira-json-schema.d.ts +1 -1
- package/dist/util/vira-json-schema.js +15 -5
- package/package.json +18 -19
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { type JsonValue } from 'type-fest';
|
|
1
|
+
import { type JsonValue, type PartialWithUndefined } from '@augment-vir/common';
|
|
3
2
|
import { ViraJsonType, type ViraJsonSchema } from '../util/vira-json-schema.js';
|
|
4
3
|
/**
|
|
5
4
|
* Editing mode for a string field that offers both a fixed set of enum options and free-form text.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertWrap, check } from '@augment-vir/assert';
|
|
2
|
-
import { omitObjectKeys, wrapInTry } from '@augment-vir/common';
|
|
2
|
+
import { omitObjectKeys, wrapInTry, } from '@augment-vir/common';
|
|
3
3
|
import { css, defineElementEvent, html, listen, nothing } from 'element-vir';
|
|
4
4
|
import { Plus16Icon, X16Icon } from '../icons/index.js';
|
|
5
5
|
import { viraFontCssVars } from '../styles/font.js';
|
|
@@ -357,16 +357,18 @@ export const ViraJsonForm = defineViraElement()({
|
|
|
357
357
|
<span class="json-null-indicator">null</span>
|
|
358
358
|
`;
|
|
359
359
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
360
|
+
else {
|
|
361
|
+
return html `
|
|
362
|
+
<${ViraInput.assign({
|
|
363
|
+
value: check.isString(value) ? value : '',
|
|
364
|
+
disabled: isDisabled,
|
|
365
|
+
})}
|
|
366
|
+
${listen(ViraInput.events.valueChange, (event) => {
|
|
367
|
+
emitReplaceAt(path, event.detail);
|
|
368
|
+
})}
|
|
369
|
+
></${ViraInput}>
|
|
370
|
+
`;
|
|
371
|
+
}
|
|
370
372
|
}
|
|
371
373
|
function renderInlineValueEditor(type, currentValue, onChange) {
|
|
372
374
|
if (type === ViraJsonType.String) {
|
|
@@ -414,7 +416,9 @@ export const ViraJsonForm = defineViraElement()({
|
|
|
414
416
|
></${ViraCheckbox}>
|
|
415
417
|
`;
|
|
416
418
|
}
|
|
417
|
-
|
|
419
|
+
else {
|
|
420
|
+
return nothing;
|
|
421
|
+
}
|
|
418
422
|
}
|
|
419
423
|
function renderPlusButton({ isAddDisabled, tooltip, onClick, }) {
|
|
420
424
|
return html `
|
|
@@ -504,28 +508,30 @@ export const ViraJsonForm = defineViraElement()({
|
|
|
504
508
|
})}
|
|
505
509
|
`;
|
|
506
510
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
511
|
+
else {
|
|
512
|
+
const selectedType = getPendingType(pathKey, allowedTypes);
|
|
513
|
+
const options = allowedTypes.map((type) => {
|
|
514
|
+
return {
|
|
515
|
+
value: type,
|
|
516
|
+
label: viraJsonTypeLabels[type],
|
|
517
|
+
};
|
|
518
|
+
});
|
|
519
|
+
return html `
|
|
520
|
+
<${ViraSelect.assign({
|
|
521
|
+
options,
|
|
522
|
+
value: selectedType,
|
|
523
|
+
})}
|
|
524
|
+
${listen(ViraSelect.events.valueChange, (event) => {
|
|
525
|
+
setPendingType(pathKey, event.detail);
|
|
526
|
+
})}
|
|
527
|
+
></${ViraSelect}>
|
|
528
|
+
${renderPlusButton({
|
|
529
|
+
isAddDisabled: false,
|
|
530
|
+
tooltip: `Add ${viraJsonTypeLabels[selectedType]}`,
|
|
531
|
+
onClick: () => onAdd(createDefaultForJsonType(selectedType)),
|
|
532
|
+
})}
|
|
533
|
+
`;
|
|
534
|
+
}
|
|
529
535
|
}
|
|
530
536
|
function getNestedTypeLabel(schema, value) {
|
|
531
537
|
const concreteType = getJsonType(value);
|
|
@@ -227,7 +227,15 @@ export const ViraTabs = defineViraElement()({
|
|
|
227
227
|
top: 0;
|
|
228
228
|
left: 0;
|
|
229
229
|
overflow: visible;
|
|
230
|
+
/**
|
|
231
|
+
* visibility:hidden keeps the mirror's links out of the tab order, but a selected
|
|
232
|
+
* tab's label re-sets visibility:visible on itself (see ViraBoldText), which would
|
|
233
|
+
* override the inherited hidden state and paint the label. opacity:0 cannot be
|
|
234
|
+
* overridden by a descendant, so it keeps the mirror invisible while still allowing
|
|
235
|
+
* width measurement.
|
|
236
|
+
*/
|
|
230
237
|
visibility: hidden;
|
|
238
|
+
opacity: 0;
|
|
231
239
|
pointer-events: none;
|
|
232
240
|
}
|
|
233
241
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { type Primitive, type RequireExactlyOne } from 'type-fest';
|
|
1
|
+
import { type PartialWithUndefined, type Primitive, type RequireExactlyOne } from '@augment-vir/common';
|
|
3
2
|
import { ViraColorVariant, ViraEmphasis, ViraSize } from '../styles/form-variants.js';
|
|
4
3
|
import { ViraThemeColorName } from '../styles/vira-color-theme-object.js';
|
|
5
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
|
-
import { arrayToObject, getObjectTypedKeys } from '@augment-vir/common';
|
|
2
|
+
import { arrayToObject, getObjectTypedKeys, } from '@augment-vir/common';
|
|
3
3
|
import { ContrastLevelName } from '@electrovir/color/dist/data/contrast/contrast.js';
|
|
4
4
|
import { css, defineElementEvent, html, listen, unsafeCSS } from 'element-vir';
|
|
5
5
|
import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type RemovePrefix, type RemoveSuffix } from '@augment-vir/common';
|
|
1
|
+
import { type RemovePrefix, type RemoveSuffix, type UnionToTuple } from '@augment-vir/common';
|
|
2
2
|
import { ContrastLevelName } from '@electrovir/color/dist/data/contrast/contrast.js';
|
|
3
3
|
import { type ColorThemeColor, type themeDefaultKey } from 'theme-vir';
|
|
4
|
-
import { type UnionToTuple } from 'type-fest';
|
|
5
4
|
import { viraTheme } from './vira-color-theme.js';
|
|
6
5
|
/**
|
|
7
6
|
* `ContrastLevelName` values with the values containing internal dashes to the beginning so they
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type Values } from '@augment-vir/common';
|
|
1
|
+
import { type RequireExactlyOne, type Values } from '@augment-vir/common';
|
|
2
2
|
import { type AsyncProp, type DeclarativeElementDefinition } from 'element-vir';
|
|
3
|
-
import { type RequireExactlyOne } from 'type-fest';
|
|
4
3
|
/**
|
|
5
4
|
* Base type for loaders passed to {@link createDynamicElementLoader}.
|
|
6
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type JsonValue } from '@augment-vir/common';
|
|
1
2
|
import { type JSONSchema } from 'json-schema-to-ts';
|
|
2
|
-
import { type JsonValue } from 'type-fest';
|
|
3
3
|
/**
|
|
4
4
|
* The JSON Schema type used by `ViraJsonForm`. Re-exported from `json-schema-to-ts` so that callers
|
|
5
5
|
* can pass standard JSON Schema objects.
|
|
@@ -78,7 +78,9 @@ export function normalizeSchema(schema) {
|
|
|
78
78
|
else if (schema === true) {
|
|
79
79
|
return {};
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
else {
|
|
82
|
+
return schema;
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
function jsonTypeFromSchemaType(type) {
|
|
84
86
|
if (allJsonTypes.includes(type)) {
|
|
@@ -395,7 +397,9 @@ export function getStringEnumValues(schema, context) {
|
|
|
395
397
|
else if ('const' in branch && check.isString(branch.const)) {
|
|
396
398
|
return [branch.const];
|
|
397
399
|
}
|
|
398
|
-
|
|
400
|
+
else {
|
|
401
|
+
return [];
|
|
402
|
+
}
|
|
399
403
|
});
|
|
400
404
|
return removeDuplicates(values);
|
|
401
405
|
}
|
|
@@ -637,7 +641,9 @@ function deepEqualsJson({ a, b }) {
|
|
|
637
641
|
b: b[key] ?? null,
|
|
638
642
|
}));
|
|
639
643
|
}
|
|
640
|
-
|
|
644
|
+
else {
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
641
647
|
}
|
|
642
648
|
/** @category Internal */
|
|
643
649
|
export function pathToKey(path) {
|
|
@@ -704,7 +710,9 @@ export function deleteValueAtPath(root, path) {
|
|
|
704
710
|
else if (typeof head === 'string' && check.isObject(root)) {
|
|
705
711
|
return omitObjectKeys(root, [head]);
|
|
706
712
|
}
|
|
707
|
-
|
|
713
|
+
else {
|
|
714
|
+
return root;
|
|
715
|
+
}
|
|
708
716
|
}
|
|
709
717
|
else if (typeof head === 'number' && check.isArray(root)) {
|
|
710
718
|
return root.map((item, index) => (index === head ? deleteValueAtPath(item, rest) : item));
|
|
@@ -715,5 +723,7 @@ export function deleteValueAtPath(root, path) {
|
|
|
715
723
|
[head]: deleteValueAtPath(root[head] ?? null, rest),
|
|
716
724
|
};
|
|
717
725
|
}
|
|
718
|
-
|
|
726
|
+
else {
|
|
727
|
+
return root;
|
|
728
|
+
}
|
|
719
729
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "31.28.
|
|
3
|
+
"version": "31.28.2",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -38,37 +38,36 @@
|
|
|
38
38
|
"test:docs": "virmator docs check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@augment-vir/assert": "^32.1
|
|
42
|
-
"@augment-vir/common": "^32.1
|
|
43
|
-
"@augment-vir/web": "^32.1
|
|
44
|
-
"@electrovir/color": "^1.7.
|
|
45
|
-
"@electrovir/local-storage-client": "^0.1.
|
|
41
|
+
"@augment-vir/assert": "^32.2.1",
|
|
42
|
+
"@augment-vir/common": "^32.2.1",
|
|
43
|
+
"@augment-vir/web": "^32.2.1",
|
|
44
|
+
"@electrovir/color": "^1.7.11",
|
|
45
|
+
"@electrovir/local-storage-client": "^0.1.1",
|
|
46
46
|
"date-vir": "^8.6.2",
|
|
47
|
-
"device-navigation": "^4.7.
|
|
47
|
+
"device-navigation": "^4.7.3",
|
|
48
48
|
"json-schema-to-ts": "^3.1.1",
|
|
49
|
-
"lit-css-vars": "^3.6.
|
|
50
|
-
"object-shape-tester": "^6.14.
|
|
51
|
-
"observavir": "^2.3.
|
|
52
|
-
"page-active": "^1.0.
|
|
53
|
-
"spa-router-vir": "^6.6.
|
|
54
|
-
"type-fest": "^5.8.0",
|
|
49
|
+
"lit-css-vars": "^3.6.3",
|
|
50
|
+
"object-shape-tester": "^6.14.1",
|
|
51
|
+
"observavir": "^2.3.3",
|
|
52
|
+
"page-active": "^1.0.4",
|
|
53
|
+
"spa-router-vir": "^6.6.1",
|
|
55
54
|
"typed-event-target": "^4.3.2"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@augment-vir/test": "^32.1
|
|
57
|
+
"@augment-vir/test": "^32.2.1",
|
|
59
58
|
"@web/dev-server-esbuild": "^2.0.0",
|
|
60
59
|
"@web/test-runner": "^1.0.0",
|
|
61
|
-
"@web/test-runner-commands": "^1.0.
|
|
60
|
+
"@web/test-runner-commands": "^1.0.1",
|
|
62
61
|
"@web/test-runner-playwright": "^1.0.0",
|
|
63
|
-
"@web/test-runner-visual-regression": "^1.0.
|
|
62
|
+
"@web/test-runner-visual-regression": "^1.0.1",
|
|
64
63
|
"esbuild": "^0.28.1",
|
|
65
64
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
66
|
-
"lucide-static": "^1.
|
|
65
|
+
"lucide-static": "^1.26.0",
|
|
67
66
|
"markdown-code-example-inserter": "^3.0.6",
|
|
68
|
-
"theme-vir": "^28.25.
|
|
67
|
+
"theme-vir": "^28.25.1",
|
|
69
68
|
"typedoc": "^0.28.20",
|
|
70
69
|
"typescript": "^6.0.3",
|
|
71
|
-
"vite": "^8.1.
|
|
70
|
+
"vite": "^8.1.5",
|
|
72
71
|
"vite-tsconfig-paths": "^6.1.1"
|
|
73
72
|
},
|
|
74
73
|
"peerDependencies": {
|