@cronn/element-snapshot 0.6.0 → 0.7.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/dist/index.d.ts +8 -2
- package/dist/index.global.js +22 -2
- package/dist/types.d.ts +9 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,12 @@ interface MenuitemSnapshot extends GenericElementSnapshot<"menuitem", MenuitemAt
|
|
|
71
71
|
interface MenuitemAttributes extends LinkAttributes, DisableableAttributes {
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
interface ProgressbarSnapshot extends GenericElementSnapshot<"progressbar", ProgressbarAttributes> {
|
|
75
|
+
}
|
|
76
|
+
interface ProgressbarAttributes {
|
|
77
|
+
value?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
interface TabSnapshot extends GenericElementSnapshot<"tab", TabAttributes> {
|
|
75
81
|
}
|
|
76
82
|
interface TabAttributes extends DisableableAttributes, SelectableAttributes {
|
|
@@ -91,9 +97,9 @@ interface TextSnapshot {
|
|
|
91
97
|
|
|
92
98
|
type SnapshotTargetElement = HTMLElement | SVGElement;
|
|
93
99
|
type NodeRole = ElementRole | "text";
|
|
94
|
-
type ElementRole = "heading" | "link" | "button" | "option" | "tab" | "menuitem" | "columnheader" | "group" | ContainerRole | InputRole | DialogRole;
|
|
100
|
+
type ElementRole = "heading" | "link" | "button" | "option" | "tab" | "menuitem" | "columnheader" | "group" | "progressbar" | ContainerRole | InputRole | DialogRole;
|
|
95
101
|
type NodeSnapshot = ElementSnapshot | TextSnapshot;
|
|
96
|
-
type ElementSnapshot = ContainerSnapshot | HeadingSnapshot | LinkSnapshot | ButtonSnapshot | InputSnapshot | ComboboxSnapshot | OptionSnapshot | DialogSnapshot | TabSnapshot | MenuitemSnapshot | ColumnheaderSnapshot | GroupSnapshot;
|
|
102
|
+
type ElementSnapshot = ContainerSnapshot | HeadingSnapshot | LinkSnapshot | ButtonSnapshot | InputSnapshot | ComboboxSnapshot | OptionSnapshot | DialogSnapshot | TabSnapshot | MenuitemSnapshot | ColumnheaderSnapshot | GroupSnapshot | ProgressbarSnapshot;
|
|
97
103
|
interface GenericElementSnapshot<TRole extends NodeRole = NodeRole, TAttributes = unknown> {
|
|
98
104
|
role: TRole;
|
|
99
105
|
name?: string;
|
package/dist/index.global.js
CHANGED
|
@@ -236,7 +236,8 @@
|
|
|
236
236
|
tr: "row",
|
|
237
237
|
th: resolveTableHeaderCellRole,
|
|
238
238
|
td: "cell",
|
|
239
|
-
fieldset: "group"
|
|
239
|
+
fieldset: "group",
|
|
240
|
+
progress: "progressbar"
|
|
240
241
|
};
|
|
241
242
|
var CONTEXT_DEPENDENT_ROLES = {
|
|
242
243
|
banner: isTopLevelBanner,
|
|
@@ -613,6 +614,24 @@
|
|
|
613
614
|
};
|
|
614
615
|
}
|
|
615
616
|
|
|
617
|
+
// src/snapshots/progressbar.ts
|
|
618
|
+
function snapshotProgressbar(element) {
|
|
619
|
+
return {
|
|
620
|
+
role: "progressbar",
|
|
621
|
+
name: resolveAccessibleName(element, false),
|
|
622
|
+
attributes: {
|
|
623
|
+
value: resolveValue2(element)
|
|
624
|
+
},
|
|
625
|
+
children: snapshotChildren(element)
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function resolveValue2(element) {
|
|
629
|
+
if (element instanceof HTMLProgressElement) {
|
|
630
|
+
return element.value;
|
|
631
|
+
}
|
|
632
|
+
return numericAttribute(element.ariaValueNow);
|
|
633
|
+
}
|
|
634
|
+
|
|
616
635
|
// src/snapshots/tab.ts
|
|
617
636
|
function snapshotTab(element) {
|
|
618
637
|
return {
|
|
@@ -657,7 +676,8 @@
|
|
|
657
676
|
tab: snapshotTab,
|
|
658
677
|
menuitem: snapshotMenuitem,
|
|
659
678
|
columnheader: snapshotColumnheader,
|
|
660
|
-
group: snapshotGroup
|
|
679
|
+
group: snapshotGroup,
|
|
680
|
+
progressbar: snapshotProgressbar
|
|
661
681
|
};
|
|
662
682
|
function snapshotElement(element) {
|
|
663
683
|
return snapshotNodeRecursive(element);
|
package/dist/types.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ interface MenuitemSnapshot extends GenericElementSnapshot<"menuitem", MenuitemAt
|
|
|
76
76
|
interface MenuitemAttributes extends LinkAttributes, DisableableAttributes {
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
interface ProgressbarSnapshot extends GenericElementSnapshot<"progressbar", ProgressbarAttributes> {
|
|
80
|
+
}
|
|
81
|
+
interface ProgressbarAttributes {
|
|
82
|
+
value?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
interface TabSnapshot extends GenericElementSnapshot<"tab", TabAttributes> {
|
|
80
86
|
}
|
|
81
87
|
interface TabAttributes extends DisableableAttributes, SelectableAttributes {
|
|
@@ -95,9 +101,9 @@ interface TextSnapshot {
|
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
type NodeRole = ElementRole | "text";
|
|
98
|
-
type ElementRole = "heading" | "link" | "button" | "option" | "tab" | "menuitem" | "columnheader" | "group" | ContainerRole | InputRole | DialogRole;
|
|
104
|
+
type ElementRole = "heading" | "link" | "button" | "option" | "tab" | "menuitem" | "columnheader" | "group" | "progressbar" | ContainerRole | InputRole | DialogRole;
|
|
99
105
|
type NodeSnapshot = ElementSnapshot | TextSnapshot;
|
|
100
|
-
type ElementSnapshot = ContainerSnapshot | HeadingSnapshot | LinkSnapshot | ButtonSnapshot | InputSnapshot | ComboboxSnapshot | OptionSnapshot | DialogSnapshot | TabSnapshot | MenuitemSnapshot | ColumnheaderSnapshot | GroupSnapshot;
|
|
106
|
+
type ElementSnapshot = ContainerSnapshot | HeadingSnapshot | LinkSnapshot | ButtonSnapshot | InputSnapshot | ComboboxSnapshot | OptionSnapshot | DialogSnapshot | TabSnapshot | MenuitemSnapshot | ColumnheaderSnapshot | GroupSnapshot | ProgressbarSnapshot;
|
|
101
107
|
interface GenericElementSnapshot<TRole extends NodeRole = NodeRole, TAttributes = unknown> {
|
|
102
108
|
role: TRole;
|
|
103
109
|
name?: string;
|
|
@@ -106,4 +112,4 @@ interface GenericElementSnapshot<TRole extends NodeRole = NodeRole, TAttributes
|
|
|
106
112
|
}
|
|
107
113
|
type SetValues<TSet> = TSet extends Set<infer TValue> ? TValue : never;
|
|
108
114
|
|
|
109
|
-
export type { ButtonSnapshot, ColumnheaderSnapshot, ComboboxSnapshot, ContainerSnapshot, DialogSnapshot, ElementRole, ElementSnapshot, GroupSnapshot, HeadingSnapshot, InputSnapshot, LinkSnapshot, MenuitemSnapshot, NodeRole, NodeSnapshot, OptionSnapshot, TabSnapshot, TextSnapshot };
|
|
115
|
+
export type { ButtonSnapshot, ColumnheaderSnapshot, ComboboxSnapshot, ContainerSnapshot, DialogSnapshot, ElementRole, ElementSnapshot, GroupSnapshot, HeadingSnapshot, InputSnapshot, LinkSnapshot, MenuitemSnapshot, NodeRole, NodeSnapshot, OptionSnapshot, ProgressbarSnapshot, TabSnapshot, TextSnapshot };
|