barbican-reset 3.3.0 → 3.4.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/focus-visible.min.js +146 -2
- package/package.json +1 -1
package/focus-visible.min.js
CHANGED
|
@@ -1,2 +1,146 @@
|
|
|
1
|
-
!
|
|
2
|
-
|
|
1
|
+
!(function (e, t) {
|
|
2
|
+
"object" == typeof exports && "undefined" != typeof module
|
|
3
|
+
? t()
|
|
4
|
+
: "function" == typeof define && define.amd
|
|
5
|
+
? define(t)
|
|
6
|
+
: t();
|
|
7
|
+
})(0, function () {
|
|
8
|
+
"use strict";
|
|
9
|
+
function e(e) {
|
|
10
|
+
var t = !0,
|
|
11
|
+
n = !1,
|
|
12
|
+
o = null,
|
|
13
|
+
d = {
|
|
14
|
+
text: !0,
|
|
15
|
+
search: !0,
|
|
16
|
+
url: !0,
|
|
17
|
+
tel: !0,
|
|
18
|
+
email: !0,
|
|
19
|
+
password: !0,
|
|
20
|
+
number: !0,
|
|
21
|
+
date: !0,
|
|
22
|
+
month: !0,
|
|
23
|
+
week: !0,
|
|
24
|
+
time: !0,
|
|
25
|
+
datetime: !0,
|
|
26
|
+
"datetime-local": !0,
|
|
27
|
+
};
|
|
28
|
+
function i(e) {
|
|
29
|
+
return !!(
|
|
30
|
+
e &&
|
|
31
|
+
e !== document &&
|
|
32
|
+
"HTML" !== e.nodeName &&
|
|
33
|
+
"BODY" !== e.nodeName &&
|
|
34
|
+
"classList" in e &&
|
|
35
|
+
"contains" in e.classList
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function s(e) {
|
|
39
|
+
e.classList.contains("focus-visible") ||
|
|
40
|
+
(e.classList.add("focus-visible"),
|
|
41
|
+
e.setAttribute("data-focus-visible-added", ""));
|
|
42
|
+
}
|
|
43
|
+
function u(e) {
|
|
44
|
+
t = !1;
|
|
45
|
+
}
|
|
46
|
+
function a() {
|
|
47
|
+
document.addEventListener("mousemove", c),
|
|
48
|
+
document.addEventListener("mousedown", c),
|
|
49
|
+
document.addEventListener("mouseup", c),
|
|
50
|
+
document.addEventListener("pointermove", c),
|
|
51
|
+
document.addEventListener("pointerdown", c),
|
|
52
|
+
document.addEventListener("pointerup", c),
|
|
53
|
+
document.addEventListener("touchmove", c),
|
|
54
|
+
document.addEventListener("touchstart", c),
|
|
55
|
+
document.addEventListener("touchend", c);
|
|
56
|
+
}
|
|
57
|
+
function c(e) {
|
|
58
|
+
(e.target.nodeName && "html" === e.target.nodeName.toLowerCase()) ||
|
|
59
|
+
((t = !1),
|
|
60
|
+
document.removeEventListener("mousemove", c),
|
|
61
|
+
document.removeEventListener("mousedown", c),
|
|
62
|
+
document.removeEventListener("mouseup", c),
|
|
63
|
+
document.removeEventListener("pointermove", c),
|
|
64
|
+
document.removeEventListener("pointerdown", c),
|
|
65
|
+
document.removeEventListener("pointerup", c),
|
|
66
|
+
document.removeEventListener("touchmove", c),
|
|
67
|
+
document.removeEventListener("touchstart", c),
|
|
68
|
+
document.removeEventListener("touchend", c));
|
|
69
|
+
}
|
|
70
|
+
document.addEventListener(
|
|
71
|
+
"keydown",
|
|
72
|
+
function (n) {
|
|
73
|
+
n.metaKey ||
|
|
74
|
+
n.altKey ||
|
|
75
|
+
n.ctrlKey ||
|
|
76
|
+
(i(e.activeElement) && s(e.activeElement), (t = !0));
|
|
77
|
+
},
|
|
78
|
+
!0
|
|
79
|
+
),
|
|
80
|
+
document.addEventListener("mousedown", u, !0),
|
|
81
|
+
document.addEventListener("pointerdown", u, !0),
|
|
82
|
+
document.addEventListener("touchstart", u, !0),
|
|
83
|
+
document.addEventListener(
|
|
84
|
+
"visibilitychange",
|
|
85
|
+
function (e) {
|
|
86
|
+
"hidden" === document.visibilityState && (n && (t = !0), a());
|
|
87
|
+
},
|
|
88
|
+
!0
|
|
89
|
+
),
|
|
90
|
+
a(),
|
|
91
|
+
e.addEventListener(
|
|
92
|
+
"focus",
|
|
93
|
+
function (e) {
|
|
94
|
+
var n, o, u;
|
|
95
|
+
i(e.target) &&
|
|
96
|
+
(t ||
|
|
97
|
+
((n = e.target),
|
|
98
|
+
(o = n.type),
|
|
99
|
+
("INPUT" === (u = n.tagName) && d[o] && !n.readOnly) ||
|
|
100
|
+
("TEXTAREA" === u && !n.readOnly) ||
|
|
101
|
+
n.isContentEditable)) &&
|
|
102
|
+
s(e.target);
|
|
103
|
+
},
|
|
104
|
+
!0
|
|
105
|
+
),
|
|
106
|
+
e.addEventListener(
|
|
107
|
+
"blur",
|
|
108
|
+
function (e) {
|
|
109
|
+
var t;
|
|
110
|
+
i(e.target) &&
|
|
111
|
+
(e.target.classList.contains("focus-visible") ||
|
|
112
|
+
e.target.hasAttribute("data-focus-visible-added")) &&
|
|
113
|
+
((n = !0),
|
|
114
|
+
window.clearTimeout(o),
|
|
115
|
+
(o = window.setTimeout(function () {
|
|
116
|
+
n = !1;
|
|
117
|
+
}, 100)),
|
|
118
|
+
(t = e.target).hasAttribute("data-focus-visible-added") &&
|
|
119
|
+
(t.classList.remove("focus-visible"),
|
|
120
|
+
t.removeAttribute("data-focus-visible-added")));
|
|
121
|
+
},
|
|
122
|
+
!0
|
|
123
|
+
),
|
|
124
|
+
e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && e.host
|
|
125
|
+
? e.host.setAttribute("data-js-focus-visible", "")
|
|
126
|
+
: e.nodeType === Node.DOCUMENT_NODE &&
|
|
127
|
+
(document.documentElement.classList.add("js-focus-visible"),
|
|
128
|
+
document.documentElement.setAttribute("data-js-focus-visible", ""));
|
|
129
|
+
}
|
|
130
|
+
if ("undefined" != typeof window && "undefined" != typeof document) {
|
|
131
|
+
var t;
|
|
132
|
+
window.applyFocusVisiblePolyfill = e;
|
|
133
|
+
try {
|
|
134
|
+
t = new CustomEvent("focus-visible-polyfill-ready");
|
|
135
|
+
} catch (e) {
|
|
136
|
+
(t = document.createEvent("CustomEvent")).initCustomEvent(
|
|
137
|
+
"focus-visible-polyfill-ready",
|
|
138
|
+
!1,
|
|
139
|
+
!1,
|
|
140
|
+
{}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
window.dispatchEvent(t);
|
|
144
|
+
}
|
|
145
|
+
"undefined" != typeof document && e(document);
|
|
146
|
+
});
|
package/package.json
CHANGED