@zag-js/focus-visible 0.0.0-dev-20230601110239 → 0.0.0-dev-20230605130234
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 +5 -6
- package/dist/index.js +14 -40
- package/dist/index.mjs +8 -13
- package/package.json +2 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
type Modality = "keyboard" | "pointer" | "virtual";
|
|
2
2
|
type FocusVisibleCallback = (isFocusVisible: boolean) => void;
|
|
3
|
-
declare function trackFocusVisible(fn: FocusVisibleCallback): () => void;
|
|
4
|
-
declare function trackInteractionModality(fn: (value: Modality | null) => void): () => void;
|
|
5
|
-
declare function setInteractionModality(value: Modality): void;
|
|
6
|
-
declare function getInteractionModality(): Modality | null;
|
|
7
|
-
|
|
8
|
-
export { getInteractionModality, setInteractionModality, trackFocusVisible, trackInteractionModality };
|
|
3
|
+
export declare function trackFocusVisible(fn: FocusVisibleCallback): () => void;
|
|
4
|
+
export declare function trackInteractionModality(fn: (value: Modality | null) => void): () => void;
|
|
5
|
+
export declare function setInteractionModality(value: Modality): void;
|
|
6
|
+
export declare function getInteractionModality(): Modality | null;
|
|
7
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
19
4
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
trackFocusVisible: () => trackFocusVisible,
|
|
26
|
-
trackInteractionModality: () => trackInteractionModality
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
var hasSetup = false;
|
|
30
|
-
var modality = null;
|
|
31
|
-
var hasEventBeforeFocus = false;
|
|
32
|
-
var hasBlurredWindowRecently = false;
|
|
33
|
-
var handlers = /* @__PURE__ */ new Set();
|
|
5
|
+
let hasSetup = false;
|
|
6
|
+
let modality = null;
|
|
7
|
+
let hasEventBeforeFocus = false;
|
|
8
|
+
let hasBlurredWindowRecently = false;
|
|
9
|
+
const handlers = /* @__PURE__ */ new Set();
|
|
34
10
|
function trigger(modality2, event) {
|
|
35
11
|
handlers.forEach((handler) => handler(modality2, event));
|
|
36
12
|
}
|
|
37
|
-
|
|
13
|
+
const isMac = typeof window !== "undefined" && window.navigator != null ? /^Mac/.test(window.navigator.platform) : false;
|
|
38
14
|
function isValidKey(e) {
|
|
39
15
|
return !(e.metaKey || !isMac && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
40
16
|
}
|
|
@@ -139,10 +115,8 @@ function setInteractionModality(value) {
|
|
|
139
115
|
function getInteractionModality() {
|
|
140
116
|
return modality;
|
|
141
117
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
trackInteractionModality
|
|
148
|
-
});
|
|
118
|
+
|
|
119
|
+
exports.getInteractionModality = getInteractionModality;
|
|
120
|
+
exports.setInteractionModality = setInteractionModality;
|
|
121
|
+
exports.trackFocusVisible = trackFocusVisible;
|
|
122
|
+
exports.trackInteractionModality = trackInteractionModality;
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var handlers = /* @__PURE__ */ new Set();
|
|
1
|
+
let hasSetup = false;
|
|
2
|
+
let modality = null;
|
|
3
|
+
let hasEventBeforeFocus = false;
|
|
4
|
+
let hasBlurredWindowRecently = false;
|
|
5
|
+
const handlers = /* @__PURE__ */ new Set();
|
|
7
6
|
function trigger(modality2, event) {
|
|
8
7
|
handlers.forEach((handler) => handler(modality2, event));
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
const isMac = typeof window !== "undefined" && window.navigator != null ? /^Mac/.test(window.navigator.platform) : false;
|
|
11
10
|
function isValidKey(e) {
|
|
12
11
|
return !(e.metaKey || !isMac && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
13
12
|
}
|
|
@@ -112,9 +111,5 @@ function setInteractionModality(value) {
|
|
|
112
111
|
function getInteractionModality() {
|
|
113
112
|
return modality;
|
|
114
113
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
setInteractionModality,
|
|
118
|
-
trackFocusVisible,
|
|
119
|
-
trackInteractionModality
|
|
120
|
-
};
|
|
114
|
+
|
|
115
|
+
export { getInteractionModality, setInteractionModality, trackFocusVisible, trackInteractionModality };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/focus-visible",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230605130234",
|
|
4
4
|
"description": "Focus visible polyfill utility based on WICG",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -39,9 +39,7 @@
|
|
|
39
39
|
"./package.json": "./package.json"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build
|
|
43
|
-
"start": "pnpm build --watch",
|
|
44
|
-
"build": "tsup src --dts",
|
|
42
|
+
"build": "vite build -c ../../../vite.config.ts",
|
|
45
43
|
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
46
44
|
"lint": "eslint src --ext .ts,.tsx",
|
|
47
45
|
"test-ci": "pnpm test --ci --runInBand -u",
|