@threadlabs/looma 0.26.16 → 0.26.18
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/components/ui-menu/ui-menu.html +6 -0
- package/components/ui-menu-item/ui-menu-item.html +26 -0
- package/components/ui-meter/ui-meter.html +59 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-menu-item.css +25 -0
- package/styles/ui-menu.css +5 -0
- package/styles/ui-meter.css +34 -0
- package/vanilla/UiMenu.d.ts +1 -0
- package/vanilla/UiMenu.js +4 -4
- package/vanilla/UiMenuItem.d.ts +1 -0
- package/vanilla/UiMenuItem.js +77 -49
- package/vanilla/UiMeter.d.ts +2 -0
- package/vanilla/UiMeter.js +136 -38
- package/vue/UiMenu.d.ts +9 -0
- package/vue/UiMenu.vue +25 -1
- package/vue/UiMenuItem.d.ts +13 -0
- package/vue/UiMenuItem.vue +48 -2
- package/vue/UiMeter.d.ts +27 -0
- package/vue/UiMeter.vue +514 -77
- package/vue/chunks/UiMenu.js +24 -1
- package/vue/chunks/UiMenuItem.js +55 -12
- package/vue/chunks/UiMeter.js +271 -57
- package/vue/components.css +101 -52
package/vue/UiMeter.vue
CHANGED
|
@@ -370,11 +370,30 @@ const propValidityContract = {
|
|
|
370
370
|
max: {
|
|
371
371
|
type: { kind: 'terminal', name: 'number' },
|
|
372
372
|
required: false,
|
|
373
|
-
target: { attribute: '
|
|
373
|
+
target: { attribute: 'max' },
|
|
374
374
|
description:
|
|
375
375
|
'The value of a full bar, as on a native meter: 1 for a fraction, or the whole amount (a total, a count of items) with value as the part of it. Must be\n above 0; otherwise the bar is empty.',
|
|
376
376
|
default: 1,
|
|
377
377
|
},
|
|
378
|
+
parts: {
|
|
379
|
+
type: {
|
|
380
|
+
kind: 'list',
|
|
381
|
+
item: {
|
|
382
|
+
kind: 'object',
|
|
383
|
+
fields: [{ name: 'value', type: { kind: 'terminal', name: 'number' }, optional: false }, {
|
|
384
|
+
name: 'color',
|
|
385
|
+
type: { kind: 'terminal', name: 'string' },
|
|
386
|
+
optional: false,
|
|
387
|
+
}],
|
|
388
|
+
open: false,
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
required: false,
|
|
392
|
+
target: { attribute: 'parts' },
|
|
393
|
+
description:
|
|
394
|
+
'Categories in display order for distribution. Positive finite values determine each share without rounding; zero\n and negative values draw nothing. Supply label and valueText to describe every category, and a visible text legend so colour is never the only\n explanation.',
|
|
395
|
+
default: [],
|
|
396
|
+
},
|
|
378
397
|
segments: {
|
|
379
398
|
type: { kind: 'terminal', name: 'number' },
|
|
380
399
|
required: false,
|
|
@@ -417,11 +436,26 @@ const propValidityContract = {
|
|
|
417
436
|
'The value as assistive technology reads it ("$750 of $1,240 collected", "3 of 5 done, overdue"). Empty reads the whole percentage in the current\n locale.',
|
|
418
437
|
default: '',
|
|
419
438
|
},
|
|
439
|
+
variant: {
|
|
440
|
+
type: { kind: 'terminal', name: 'keyword' },
|
|
441
|
+
required: false,
|
|
442
|
+
target: { attribute: 'variant' },
|
|
443
|
+
description:
|
|
444
|
+
'progress measures one value against max. distribution shows mutually exclusive parts of a whole as a full-width proportional bar; it uses parts rather than\n value/max and is an image, not a progress reading.',
|
|
445
|
+
values: ['progress', 'distribution'],
|
|
446
|
+
default: 'progress',
|
|
447
|
+
},
|
|
420
448
|
},
|
|
421
449
|
} as const
|
|
422
450
|
const props = defineProps({
|
|
423
451
|
label: { type: null as unknown as PropType<string | null>, default: '' },
|
|
424
452
|
max: { type: null as unknown as PropType<number | null>, default: 1 },
|
|
453
|
+
parts: {
|
|
454
|
+
type: null as unknown as PropType<
|
|
455
|
+
readonly ({ readonly value: number; readonly color: string })[] | null
|
|
456
|
+
>,
|
|
457
|
+
default: () => [],
|
|
458
|
+
},
|
|
425
459
|
segments: { type: null as unknown as PropType<number | null>, default: 0 },
|
|
426
460
|
size: { type: null as unknown as PropType<'sm' | 'md' | null>, default: 'md' },
|
|
427
461
|
tone: {
|
|
@@ -432,15 +466,21 @@ const props = defineProps({
|
|
|
432
466
|
},
|
|
433
467
|
value: { type: null as unknown as PropType<number | null>, default: 0 },
|
|
434
468
|
valueText: { type: null as unknown as PropType<string | null>, default: '' },
|
|
469
|
+
variant: {
|
|
470
|
+
type: null as unknown as PropType<'progress' | 'distribution' | null>,
|
|
471
|
+
default: 'progress',
|
|
472
|
+
},
|
|
435
473
|
})
|
|
436
474
|
const acceptedProps: Record<string, unknown> = {
|
|
437
475
|
label: '',
|
|
438
476
|
max: 1,
|
|
477
|
+
parts: () => [],
|
|
439
478
|
segments: 0,
|
|
440
479
|
size: 'md',
|
|
441
480
|
tone: 'neutral',
|
|
442
481
|
value: 0,
|
|
443
482
|
valueText: '',
|
|
483
|
+
variant: 'progress',
|
|
444
484
|
}
|
|
445
485
|
const checkedProps = computed(() => ({
|
|
446
486
|
label: checkedProp<string>(
|
|
@@ -457,6 +497,24 @@ const checkedProps = computed(() => ({
|
|
|
457
497
|
'max',
|
|
458
498
|
acceptedProps,
|
|
459
499
|
) as number,
|
|
500
|
+
parts: checkedProp<readonly ({ readonly value: number; readonly color: string })[]>(
|
|
501
|
+
props['parts'],
|
|
502
|
+
{
|
|
503
|
+
kind: 'list',
|
|
504
|
+
item: {
|
|
505
|
+
kind: 'object',
|
|
506
|
+
fields: [{ name: 'value', type: { kind: 'terminal', name: 'number' }, optional: false }, {
|
|
507
|
+
name: 'color',
|
|
508
|
+
type: { kind: 'terminal', name: 'string' },
|
|
509
|
+
optional: false,
|
|
510
|
+
}],
|
|
511
|
+
open: false,
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
false,
|
|
515
|
+
'parts',
|
|
516
|
+
acceptedProps,
|
|
517
|
+
) as readonly ({ readonly value: number; readonly color: string })[],
|
|
460
518
|
segments: checkedProp<number>(
|
|
461
519
|
props['segments'],
|
|
462
520
|
{ kind: 'terminal', name: 'number' },
|
|
@@ -492,6 +550,13 @@ const checkedProps = computed(() => ({
|
|
|
492
550
|
'valueText',
|
|
493
551
|
acceptedProps,
|
|
494
552
|
) as string,
|
|
553
|
+
variant: checkedProp<'progress' | 'distribution'>(
|
|
554
|
+
props['variant'],
|
|
555
|
+
{ kind: 'terminal', name: 'keyword' },
|
|
556
|
+
false,
|
|
557
|
+
'variant',
|
|
558
|
+
acceptedProps,
|
|
559
|
+
) as 'progress' | 'distribution',
|
|
495
560
|
}))
|
|
496
561
|
void checkedProps.value
|
|
497
562
|
watchSyncEffect(() => {
|
|
@@ -599,6 +664,142 @@ const percent = cycleCheckedComputed(() => {
|
|
|
599
664
|
})
|
|
600
665
|
let guardedPrevious: any = null
|
|
601
666
|
const guarded = computed(() => {
|
|
667
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
668
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
669
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
670
|
+
? Symbol.for('html-next.invalid-result')
|
|
671
|
+
: objectValue[indexValue])(
|
|
672
|
+
{ true: 'img', false: 'meter' },
|
|
673
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
674
|
+
)
|
|
675
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
676
|
+
return guardedPrevious
|
|
677
|
+
}
|
|
678
|
+
return guardedPrevious = attribute(((objectValue: any, indexValue: any) =>
|
|
679
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
680
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
681
|
+
? Symbol.for('html-next.invalid-result')
|
|
682
|
+
: objectValue[indexValue])(
|
|
683
|
+
{ true: 'img', false: 'meter' },
|
|
684
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
685
|
+
))
|
|
686
|
+
})
|
|
687
|
+
let guardedBindingPrevious: any = null
|
|
688
|
+
const guardedBinding = computed(() => {
|
|
689
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
690
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
691
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
692
|
+
? Symbol.for('html-next.invalid-result')
|
|
693
|
+
: objectValue[indexValue])(
|
|
694
|
+
{ true: null, false: 0 },
|
|
695
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
696
|
+
)
|
|
697
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
698
|
+
return guardedBindingPrevious
|
|
699
|
+
}
|
|
700
|
+
return guardedBindingPrevious = typeof (((objectValue: any, indexValue: any) =>
|
|
701
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
702
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
703
|
+
? Symbol.for('html-next.invalid-result')
|
|
704
|
+
: objectValue[indexValue])(
|
|
705
|
+
{ true: null, false: 0 },
|
|
706
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
707
|
+
)) === 'boolean'
|
|
708
|
+
? String(((objectValue: any, indexValue: any) =>
|
|
709
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
710
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
711
|
+
? Symbol.for('html-next.invalid-result')
|
|
712
|
+
: objectValue[indexValue])(
|
|
713
|
+
{ true: null, false: 0 },
|
|
714
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
715
|
+
))
|
|
716
|
+
: attribute(((objectValue: any, indexValue: any) =>
|
|
717
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
718
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
719
|
+
? Symbol.for('html-next.invalid-result')
|
|
720
|
+
: objectValue[indexValue])(
|
|
721
|
+
{ true: null, false: 0 },
|
|
722
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
723
|
+
))
|
|
724
|
+
})
|
|
725
|
+
let guardedBinding2Previous: any = null
|
|
726
|
+
const guardedBinding2 = computed(() => {
|
|
727
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
728
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
729
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
730
|
+
? Symbol.for('html-next.invalid-result')
|
|
731
|
+
: objectValue[indexValue])(
|
|
732
|
+
{ true: null, false: checkedProps.value.max },
|
|
733
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
734
|
+
)
|
|
735
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
736
|
+
return guardedBinding2Previous
|
|
737
|
+
}
|
|
738
|
+
return guardedBinding2Previous = typeof (((objectValue: any, indexValue: any) =>
|
|
739
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
740
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
741
|
+
? Symbol.for('html-next.invalid-result')
|
|
742
|
+
: objectValue[indexValue])(
|
|
743
|
+
{ true: null, false: checkedProps.value.max },
|
|
744
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
745
|
+
)) === 'boolean'
|
|
746
|
+
? String(((objectValue: any, indexValue: any) =>
|
|
747
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
748
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
749
|
+
? Symbol.for('html-next.invalid-result')
|
|
750
|
+
: objectValue[indexValue])(
|
|
751
|
+
{ true: null, false: checkedProps.value.max },
|
|
752
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
753
|
+
))
|
|
754
|
+
: attribute(((objectValue: any, indexValue: any) =>
|
|
755
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
756
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
757
|
+
? Symbol.for('html-next.invalid-result')
|
|
758
|
+
: objectValue[indexValue])(
|
|
759
|
+
{ true: null, false: checkedProps.value.max },
|
|
760
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
761
|
+
))
|
|
762
|
+
})
|
|
763
|
+
let guardedBinding3Previous: any = null
|
|
764
|
+
const guardedBinding3 = computed(() => {
|
|
765
|
+
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
766
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
767
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
768
|
+
? Symbol.for('html-next.invalid-result')
|
|
769
|
+
: objectValue[indexValue])(
|
|
770
|
+
{ true: null, false: amount.value },
|
|
771
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
772
|
+
)
|
|
773
|
+
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
774
|
+
return guardedBinding3Previous
|
|
775
|
+
}
|
|
776
|
+
return guardedBinding3Previous = typeof (((objectValue: any, indexValue: any) =>
|
|
777
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
778
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
779
|
+
? Symbol.for('html-next.invalid-result')
|
|
780
|
+
: objectValue[indexValue])(
|
|
781
|
+
{ true: null, false: amount.value },
|
|
782
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
783
|
+
)) === 'boolean'
|
|
784
|
+
? String(((objectValue: any, indexValue: any) =>
|
|
785
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
786
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
787
|
+
? Symbol.for('html-next.invalid-result')
|
|
788
|
+
: objectValue[indexValue])(
|
|
789
|
+
{ true: null, false: amount.value },
|
|
790
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
791
|
+
))
|
|
792
|
+
: attribute(((objectValue: any, indexValue: any) =>
|
|
793
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
794
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
795
|
+
? Symbol.for('html-next.invalid-result')
|
|
796
|
+
: objectValue[indexValue])(
|
|
797
|
+
{ true: null, false: amount.value },
|
|
798
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
799
|
+
))
|
|
800
|
+
})
|
|
801
|
+
let guardedBinding4Previous: any = null
|
|
802
|
+
const guardedBinding4 = computed(() => {
|
|
602
803
|
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
603
804
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
604
805
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
@@ -606,16 +807,33 @@ const guarded = computed(() => {
|
|
|
606
807
|
: objectValue[indexValue])(
|
|
607
808
|
(() => {
|
|
608
809
|
const value = {
|
|
609
|
-
true:
|
|
610
|
-
false:
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
810
|
+
true: null,
|
|
811
|
+
false: ((objectValue: any, indexValue: any) =>
|
|
812
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
813
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
814
|
+
? Symbol.for('html-next.invalid-result')
|
|
815
|
+
: objectValue[indexValue])(
|
|
816
|
+
(() => {
|
|
817
|
+
const value = {
|
|
818
|
+
true: checkedProps.value.valueText,
|
|
819
|
+
false: formatValue(
|
|
820
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
821
|
+
? undefined
|
|
822
|
+
: number(percent.value)! / number(100)!,
|
|
823
|
+
'number',
|
|
824
|
+
'format',
|
|
825
|
+
'percent',
|
|
826
|
+
{ maximumFractionDigits: 0 },
|
|
827
|
+
),
|
|
828
|
+
}
|
|
829
|
+
return Object.values(value).some((entry: unknown) =>
|
|
830
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
831
|
+
)
|
|
832
|
+
? Symbol.for('html-next.invalid-result')
|
|
833
|
+
: value
|
|
834
|
+
})(),
|
|
835
|
+
concat(checkedProps.value.valueText !== ''),
|
|
836
|
+
),
|
|
619
837
|
}
|
|
620
838
|
return Object.values(value).some((entry: unknown) =>
|
|
621
839
|
entry === Symbol.for('html-next.invalid-result')
|
|
@@ -623,28 +841,45 @@ const guarded = computed(() => {
|
|
|
623
841
|
? Symbol.for('html-next.invalid-result')
|
|
624
842
|
: value
|
|
625
843
|
})(),
|
|
626
|
-
concat(checkedProps.value.
|
|
844
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
627
845
|
)
|
|
628
846
|
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
629
|
-
return
|
|
847
|
+
return guardedBinding4Previous
|
|
630
848
|
}
|
|
631
|
-
return
|
|
849
|
+
return guardedBinding4Previous = typeof (((objectValue: any, indexValue: any) =>
|
|
632
850
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
633
851
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
634
852
|
? Symbol.for('html-next.invalid-result')
|
|
635
853
|
: objectValue[indexValue])(
|
|
636
854
|
(() => {
|
|
637
855
|
const value = {
|
|
638
|
-
true:
|
|
639
|
-
false:
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
856
|
+
true: null,
|
|
857
|
+
false: ((objectValue: any, indexValue: any) =>
|
|
858
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
859
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
860
|
+
? Symbol.for('html-next.invalid-result')
|
|
861
|
+
: objectValue[indexValue])(
|
|
862
|
+
(() => {
|
|
863
|
+
const value = {
|
|
864
|
+
true: checkedProps.value.valueText,
|
|
865
|
+
false: formatValue(
|
|
866
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
867
|
+
? undefined
|
|
868
|
+
: number(percent.value)! / number(100)!,
|
|
869
|
+
'number',
|
|
870
|
+
'format',
|
|
871
|
+
'percent',
|
|
872
|
+
{ maximumFractionDigits: 0 },
|
|
873
|
+
),
|
|
874
|
+
}
|
|
875
|
+
return Object.values(value).some((entry: unknown) =>
|
|
876
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
877
|
+
)
|
|
878
|
+
? Symbol.for('html-next.invalid-result')
|
|
879
|
+
: value
|
|
880
|
+
})(),
|
|
881
|
+
concat(checkedProps.value.valueText !== ''),
|
|
882
|
+
),
|
|
648
883
|
}
|
|
649
884
|
return Object.values(value).some((entry: unknown) =>
|
|
650
885
|
entry === Symbol.for('html-next.invalid-result')
|
|
@@ -652,7 +887,7 @@ const guarded = computed(() => {
|
|
|
652
887
|
? Symbol.for('html-next.invalid-result')
|
|
653
888
|
: value
|
|
654
889
|
})(),
|
|
655
|
-
concat(checkedProps.value.
|
|
890
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
656
891
|
)) === 'boolean'
|
|
657
892
|
? String(((objectValue: any, indexValue: any) =>
|
|
658
893
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
@@ -661,16 +896,33 @@ const guarded = computed(() => {
|
|
|
661
896
|
: objectValue[indexValue])(
|
|
662
897
|
(() => {
|
|
663
898
|
const value = {
|
|
664
|
-
true:
|
|
665
|
-
false:
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
899
|
+
true: null,
|
|
900
|
+
false: ((objectValue: any, indexValue: any) =>
|
|
901
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
902
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
903
|
+
? Symbol.for('html-next.invalid-result')
|
|
904
|
+
: objectValue[indexValue])(
|
|
905
|
+
(() => {
|
|
906
|
+
const value = {
|
|
907
|
+
true: checkedProps.value.valueText,
|
|
908
|
+
false: formatValue(
|
|
909
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
910
|
+
? undefined
|
|
911
|
+
: number(percent.value)! / number(100)!,
|
|
912
|
+
'number',
|
|
913
|
+
'format',
|
|
914
|
+
'percent',
|
|
915
|
+
{ maximumFractionDigits: 0 },
|
|
916
|
+
),
|
|
917
|
+
}
|
|
918
|
+
return Object.values(value).some((entry: unknown) =>
|
|
919
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
920
|
+
)
|
|
921
|
+
? Symbol.for('html-next.invalid-result')
|
|
922
|
+
: value
|
|
923
|
+
})(),
|
|
924
|
+
concat(checkedProps.value.valueText !== ''),
|
|
925
|
+
),
|
|
674
926
|
}
|
|
675
927
|
return Object.values(value).some((entry: unknown) =>
|
|
676
928
|
entry === Symbol.for('html-next.invalid-result')
|
|
@@ -678,7 +930,7 @@ const guarded = computed(() => {
|
|
|
678
930
|
? Symbol.for('html-next.invalid-result')
|
|
679
931
|
: value
|
|
680
932
|
})(),
|
|
681
|
-
concat(checkedProps.value.
|
|
933
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
682
934
|
))
|
|
683
935
|
: attribute(((objectValue: any, indexValue: any) =>
|
|
684
936
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
@@ -687,16 +939,33 @@ const guarded = computed(() => {
|
|
|
687
939
|
: objectValue[indexValue])(
|
|
688
940
|
(() => {
|
|
689
941
|
const value = {
|
|
690
|
-
true:
|
|
691
|
-
false:
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
942
|
+
true: null,
|
|
943
|
+
false: ((objectValue: any, indexValue: any) =>
|
|
944
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
945
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
946
|
+
? Symbol.for('html-next.invalid-result')
|
|
947
|
+
: objectValue[indexValue])(
|
|
948
|
+
(() => {
|
|
949
|
+
const value = {
|
|
950
|
+
true: checkedProps.value.valueText,
|
|
951
|
+
false: formatValue(
|
|
952
|
+
number(percent.value) === undefined || number(100) === undefined
|
|
953
|
+
? undefined
|
|
954
|
+
: number(percent.value)! / number(100)!,
|
|
955
|
+
'number',
|
|
956
|
+
'format',
|
|
957
|
+
'percent',
|
|
958
|
+
{ maximumFractionDigits: 0 },
|
|
959
|
+
),
|
|
960
|
+
}
|
|
961
|
+
return Object.values(value).some((entry: unknown) =>
|
|
962
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
963
|
+
)
|
|
964
|
+
? Symbol.for('html-next.invalid-result')
|
|
965
|
+
: value
|
|
966
|
+
})(),
|
|
967
|
+
concat(checkedProps.value.valueText !== ''),
|
|
968
|
+
),
|
|
700
969
|
}
|
|
701
970
|
return Object.values(value).some((entry: unknown) =>
|
|
702
971
|
entry === Symbol.for('html-next.invalid-result')
|
|
@@ -704,28 +973,88 @@ const guarded = computed(() => {
|
|
|
704
973
|
? Symbol.for('html-next.invalid-result')
|
|
705
974
|
: value
|
|
706
975
|
})(),
|
|
707
|
-
concat(checkedProps.value.
|
|
976
|
+
concat(checkedProps.value.variant === 'distribution'),
|
|
708
977
|
))
|
|
709
978
|
})
|
|
710
|
-
let
|
|
711
|
-
const
|
|
979
|
+
let guardedBinding5Previous: any = null
|
|
980
|
+
const guardedBinding5 = computed(() => {
|
|
712
981
|
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
713
982
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
714
983
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
715
984
|
? Symbol.for('html-next.invalid-result')
|
|
716
985
|
: objectValue[indexValue])(
|
|
717
|
-
|
|
986
|
+
(() => {
|
|
987
|
+
const value = {
|
|
988
|
+
true: ((objectValue: any, indexValue: any) =>
|
|
989
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
990
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
991
|
+
? Symbol.for('html-next.invalid-result')
|
|
992
|
+
: objectValue[indexValue])(
|
|
993
|
+
(() => {
|
|
994
|
+
const value = {
|
|
995
|
+
true: concat(checkedProps.value.label, ': ', checkedProps.value.valueText),
|
|
996
|
+
false: checkedProps.value.label,
|
|
997
|
+
}
|
|
998
|
+
return Object.values(value).some((entry: unknown) =>
|
|
999
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1000
|
+
)
|
|
1001
|
+
? Symbol.for('html-next.invalid-result')
|
|
1002
|
+
: value
|
|
1003
|
+
})(),
|
|
1004
|
+
concat(
|
|
1005
|
+
checkedProps.value.variant === 'distribution'
|
|
1006
|
+
&& checkedProps.value.valueText !== '',
|
|
1007
|
+
),
|
|
1008
|
+
),
|
|
1009
|
+
false: null,
|
|
1010
|
+
}
|
|
1011
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1012
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1013
|
+
)
|
|
1014
|
+
? Symbol.for('html-next.invalid-result')
|
|
1015
|
+
: value
|
|
1016
|
+
})(),
|
|
718
1017
|
concat(checkedProps.value.label !== ''),
|
|
719
1018
|
)
|
|
720
1019
|
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
721
|
-
return
|
|
1020
|
+
return guardedBinding5Previous
|
|
722
1021
|
}
|
|
723
|
-
return
|
|
1022
|
+
return guardedBinding5Previous = typeof (((objectValue: any, indexValue: any) =>
|
|
724
1023
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
725
1024
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
726
1025
|
? Symbol.for('html-next.invalid-result')
|
|
727
1026
|
: objectValue[indexValue])(
|
|
728
|
-
|
|
1027
|
+
(() => {
|
|
1028
|
+
const value = {
|
|
1029
|
+
true: ((objectValue: any, indexValue: any) =>
|
|
1030
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
1031
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
1032
|
+
? Symbol.for('html-next.invalid-result')
|
|
1033
|
+
: objectValue[indexValue])(
|
|
1034
|
+
(() => {
|
|
1035
|
+
const value = {
|
|
1036
|
+
true: concat(checkedProps.value.label, ': ', checkedProps.value.valueText),
|
|
1037
|
+
false: checkedProps.value.label,
|
|
1038
|
+
}
|
|
1039
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1040
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1041
|
+
)
|
|
1042
|
+
? Symbol.for('html-next.invalid-result')
|
|
1043
|
+
: value
|
|
1044
|
+
})(),
|
|
1045
|
+
concat(
|
|
1046
|
+
checkedProps.value.variant === 'distribution'
|
|
1047
|
+
&& checkedProps.value.valueText !== '',
|
|
1048
|
+
),
|
|
1049
|
+
),
|
|
1050
|
+
false: null,
|
|
1051
|
+
}
|
|
1052
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1053
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1054
|
+
)
|
|
1055
|
+
? Symbol.for('html-next.invalid-result')
|
|
1056
|
+
: value
|
|
1057
|
+
})(),
|
|
729
1058
|
concat(checkedProps.value.label !== ''),
|
|
730
1059
|
)) === 'boolean'
|
|
731
1060
|
? String(((objectValue: any, indexValue: any) =>
|
|
@@ -733,7 +1062,37 @@ const guardedBinding = computed(() => {
|
|
|
733
1062
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
734
1063
|
? Symbol.for('html-next.invalid-result')
|
|
735
1064
|
: objectValue[indexValue])(
|
|
736
|
-
|
|
1065
|
+
(() => {
|
|
1066
|
+
const value = {
|
|
1067
|
+
true: ((objectValue: any, indexValue: any) =>
|
|
1068
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
1069
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
1070
|
+
? Symbol.for('html-next.invalid-result')
|
|
1071
|
+
: objectValue[indexValue])(
|
|
1072
|
+
(() => {
|
|
1073
|
+
const value = {
|
|
1074
|
+
true: concat(checkedProps.value.label, ': ', checkedProps.value.valueText),
|
|
1075
|
+
false: checkedProps.value.label,
|
|
1076
|
+
}
|
|
1077
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1078
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1079
|
+
)
|
|
1080
|
+
? Symbol.for('html-next.invalid-result')
|
|
1081
|
+
: value
|
|
1082
|
+
})(),
|
|
1083
|
+
concat(
|
|
1084
|
+
checkedProps.value.variant === 'distribution'
|
|
1085
|
+
&& checkedProps.value.valueText !== '',
|
|
1086
|
+
),
|
|
1087
|
+
),
|
|
1088
|
+
false: null,
|
|
1089
|
+
}
|
|
1090
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1091
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1092
|
+
)
|
|
1093
|
+
? Symbol.for('html-next.invalid-result')
|
|
1094
|
+
: value
|
|
1095
|
+
})(),
|
|
737
1096
|
concat(checkedProps.value.label !== ''),
|
|
738
1097
|
))
|
|
739
1098
|
: attribute(((objectValue: any, indexValue: any) =>
|
|
@@ -741,12 +1100,42 @@ const guardedBinding = computed(() => {
|
|
|
741
1100
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
742
1101
|
? Symbol.for('html-next.invalid-result')
|
|
743
1102
|
: objectValue[indexValue])(
|
|
744
|
-
|
|
1103
|
+
(() => {
|
|
1104
|
+
const value = {
|
|
1105
|
+
true: ((objectValue: any, indexValue: any) =>
|
|
1106
|
+
objectValue === Symbol.for('html-next.invalid-result')
|
|
1107
|
+
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
1108
|
+
? Symbol.for('html-next.invalid-result')
|
|
1109
|
+
: objectValue[indexValue])(
|
|
1110
|
+
(() => {
|
|
1111
|
+
const value = {
|
|
1112
|
+
true: concat(checkedProps.value.label, ': ', checkedProps.value.valueText),
|
|
1113
|
+
false: checkedProps.value.label,
|
|
1114
|
+
}
|
|
1115
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1116
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1117
|
+
)
|
|
1118
|
+
? Symbol.for('html-next.invalid-result')
|
|
1119
|
+
: value
|
|
1120
|
+
})(),
|
|
1121
|
+
concat(
|
|
1122
|
+
checkedProps.value.variant === 'distribution'
|
|
1123
|
+
&& checkedProps.value.valueText !== '',
|
|
1124
|
+
),
|
|
1125
|
+
),
|
|
1126
|
+
false: null,
|
|
1127
|
+
}
|
|
1128
|
+
return Object.values(value).some((entry: unknown) =>
|
|
1129
|
+
entry === Symbol.for('html-next.invalid-result')
|
|
1130
|
+
)
|
|
1131
|
+
? Symbol.for('html-next.invalid-result')
|
|
1132
|
+
: value
|
|
1133
|
+
})(),
|
|
745
1134
|
concat(checkedProps.value.label !== ''),
|
|
746
1135
|
))
|
|
747
1136
|
})
|
|
748
|
-
let
|
|
749
|
-
const
|
|
1137
|
+
let guardedBinding6Previous: any = null
|
|
1138
|
+
const guardedBinding6 = computed(() => {
|
|
750
1139
|
const candidate: any = ((objectValue: any, indexValue: any) =>
|
|
751
1140
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
752
1141
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
@@ -754,32 +1143,34 @@ const guardedBinding2 = computed(() => {
|
|
|
754
1143
|
: objectValue[indexValue])(
|
|
755
1144
|
{ true: checkedProps.value.segments, false: null },
|
|
756
1145
|
concat(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
1146
|
+
checkedProps.value.variant === 'progress'
|
|
1147
|
+
&& (number(checkedProps.value.segments) === undefined || number(1) === undefined
|
|
1148
|
+
? undefined
|
|
1149
|
+
: number(checkedProps.value.segments)! > number(1)!),
|
|
760
1150
|
),
|
|
761
1151
|
)
|
|
762
1152
|
if (candidate === Symbol.for('html-next.invalid-result')) {
|
|
763
|
-
return
|
|
1153
|
+
return guardedBinding6Previous
|
|
764
1154
|
}
|
|
765
|
-
return
|
|
1155
|
+
return guardedBinding6Previous = attribute(((objectValue: any, indexValue: any) =>
|
|
766
1156
|
objectValue === Symbol.for('html-next.invalid-result')
|
|
767
1157
|
|| indexValue === Symbol.for('html-next.invalid-result')
|
|
768
1158
|
? Symbol.for('html-next.invalid-result')
|
|
769
1159
|
: objectValue[indexValue])(
|
|
770
1160
|
{ true: checkedProps.value.segments, false: null },
|
|
771
1161
|
concat(
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
1162
|
+
checkedProps.value.variant === 'progress'
|
|
1163
|
+
&& (number(checkedProps.value.segments) === undefined || number(1) === undefined
|
|
1164
|
+
? undefined
|
|
1165
|
+
: number(checkedProps.value.segments)! > number(1)!),
|
|
775
1166
|
),
|
|
776
1167
|
))
|
|
777
1168
|
})
|
|
778
|
-
let
|
|
779
|
-
const
|
|
1169
|
+
let guardedBinding7Previous: any = null
|
|
1170
|
+
const guardedBinding7 = computed(() => {
|
|
780
1171
|
const candidate: any = concat(percent.value, '%')
|
|
781
|
-
if (candidate === Symbol.for('html-next.invalid-result')) return
|
|
782
|
-
return
|
|
1172
|
+
if (candidate === Symbol.for('html-next.invalid-result')) return guardedBinding7Previous
|
|
1173
|
+
return guardedBinding7Previous = candidate
|
|
783
1174
|
})
|
|
784
1175
|
const hydrationNode = hydrationInstance?.vnode.el
|
|
785
1176
|
if (
|
|
@@ -802,6 +1193,9 @@ const hostState = computed(() =>
|
|
|
802
1193
|
checkedProps.value.size != null && `size=${encodeURIComponent(checkedProps.value.size)}`,
|
|
803
1194
|
checkedProps.value.tone && 'tone',
|
|
804
1195
|
checkedProps.value.tone != null && `tone=${encodeURIComponent(checkedProps.value.tone)}`,
|
|
1196
|
+
checkedProps.value.variant && 'variant',
|
|
1197
|
+
checkedProps.value.variant != null
|
|
1198
|
+
&& `variant=${encodeURIComponent(checkedProps.value.variant)}`,
|
|
805
1199
|
].filter(Boolean).join(' ')
|
|
806
1200
|
)
|
|
807
1201
|
|
|
@@ -923,24 +1317,39 @@ function math(
|
|
|
923
1317
|
<template>
|
|
924
1318
|
<span
|
|
925
1319
|
data-component="ui-meter"
|
|
926
|
-
role="meter"
|
|
927
|
-
aria-valuemin="0"
|
|
928
1320
|
v-bind="nativeAttrs($attrs)"
|
|
929
|
-
:
|
|
930
|
-
:aria-
|
|
931
|
-
:aria-
|
|
932
|
-
:aria-
|
|
933
|
-
:
|
|
1321
|
+
:role="guarded"
|
|
1322
|
+
:aria-valuemin="guardedBinding"
|
|
1323
|
+
:aria-valuemax="guardedBinding2"
|
|
1324
|
+
:aria-valuenow="guardedBinding3"
|
|
1325
|
+
:aria-valuetext="guardedBinding4"
|
|
1326
|
+
:aria-label="guardedBinding5"
|
|
1327
|
+
:data-ui-meter-segments="guardedBinding6"
|
|
934
1328
|
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
935
1329
|
:data-label="reflectedProp('label', 'label', checkedProps.label, undefined, false)"
|
|
936
1330
|
:data-max="reflectedProp('max', 'max', checkedProps.max, undefined, false)"
|
|
1331
|
+
:data-parts="reflectedProp('parts', 'parts', checkedProps.parts, undefined, false)"
|
|
937
1332
|
:data-segments="reflectedProp('segments', 'segments', checkedProps.segments, undefined, false)"
|
|
938
1333
|
:data-size="reflectedProp('size', 'size', checkedProps.size, undefined, false)"
|
|
939
1334
|
:data-tone="reflectedProp('tone', 'tone', checkedProps.tone, undefined, false)"
|
|
940
1335
|
:data-value="reflectedProp('value', 'value', checkedProps.value, undefined, false)"
|
|
941
1336
|
:data-value-text="reflectedProp('valueText', 'value-text', checkedProps.valueText, undefined, false)"
|
|
1337
|
+
:data-variant="reflectedProp('variant', 'variant', checkedProps.variant, undefined, false)"
|
|
942
1338
|
:data-ui-meter-state="hostState || undefined"
|
|
943
|
-
><span
|
|
1339
|
+
><span
|
|
1340
|
+
v-if="checkedProps.variant === 'progress'"
|
|
1341
|
+
class="fill"
|
|
1342
|
+
:style="{ 'inline-size': guardedBinding7 }"
|
|
1343
|
+
></span>
|
|
1344
|
+
<template v-if="checkedProps.variant === 'distribution'"><template
|
|
1345
|
+
v-for="(part, index) in checkedProps.parts"
|
|
1346
|
+
:key="index"
|
|
1347
|
+
><span
|
|
1348
|
+
v-if="part.value > 0 && (part.value - part.value) === 0"
|
|
1349
|
+
class="part"
|
|
1350
|
+
aria-hidden="true"
|
|
1351
|
+
:style="{ 'flex-grow': part.value, 'background-color': part.color }"
|
|
1352
|
+
></span></template></template></span>
|
|
944
1353
|
</template>
|
|
945
1354
|
|
|
946
1355
|
<style scoped>
|
|
@@ -1070,6 +1479,34 @@ function math(
|
|
|
1070
1479
|
--_meter-gap: var(--ui-space-0-5);
|
|
1071
1480
|
}
|
|
1072
1481
|
|
|
1482
|
+
/* A categorical distribution uses flex ratios, avoiding rounded percentages and retaining
|
|
1483
|
+
identical geometry before hydration. It has no progress mask or growing-value animation. */
|
|
1484
|
+
[data-component~="ui-meter"][data-ui-meter-state~="variant=distribution"] {
|
|
1485
|
+
display: flex;
|
|
1486
|
+
inline-size: 100%;
|
|
1487
|
+
block-size: var(--ui-space-4);
|
|
1488
|
+
gap: var(--ui-space-0-5);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
[data-component~="ui-meter"][data-ui-meter-state~="variant=distribution"][size="sm"] {
|
|
1492
|
+
block-size: var(--ui-space-2);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
.part {
|
|
1496
|
+
flex-basis: 0;
|
|
1497
|
+
min-inline-size: 0;
|
|
1498
|
+
block-size: 100%;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
@media (forced-colors: active) {
|
|
1502
|
+
.part {
|
|
1503
|
+
forced-color-adjust: none;
|
|
1504
|
+
background: CanvasText !important;
|
|
1505
|
+
outline: var(--ui-border-width) solid Canvas;
|
|
1506
|
+
outline-offset: calc(-1 * var(--ui-border-width));
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1073
1510
|
/* Forced colours drop backgrounds: draw the fill in the text colour inside the outlined track. */
|
|
1074
1511
|
@media (forced-colors: active) {
|
|
1075
1512
|
.fill {
|