@zag-js/focus-visible 0.0.0-dev-20220617101836 → 0.0.0-dev-20220627213111

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  declare type Modality = "keyboard" | "pointer" | "virtual";
2
2
  declare type FocusVisibleCallback = (isFocusVisible: boolean) => void;
3
3
  export declare function trackFocusVisible(fn: FocusVisibleCallback): () => void;
4
- export declare function trackInteractionModality(fn: (v: Modality | null) => void): () => 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;
5
7
  export {};
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ getInteractionModality: () => getInteractionModality,
24
+ setInteractionModality: () => setInteractionModality,
23
25
  trackFocusVisible: () => trackFocusVisible,
24
26
  trackInteractionModality: () => trackInteractionModality
25
27
  });
@@ -80,7 +82,7 @@ function onWindowBlur() {
80
82
  hasBlurredWindowRecently = true;
81
83
  }
82
84
  function isFocusVisible() {
83
- return modality != null && modality !== "pointer";
85
+ return modality !== "pointer";
84
86
  }
85
87
  function setupGlobalFocusEvents() {
86
88
  if (typeof window === "undefined" || hasSetup) {
@@ -125,3 +127,10 @@ function trackInteractionModality(fn) {
125
127
  handlers.delete(handler);
126
128
  };
127
129
  }
130
+ function setInteractionModality(value) {
131
+ modality = value;
132
+ trigger(value, null);
133
+ }
134
+ function getInteractionModality() {
135
+ return modality;
136
+ }
package/dist/index.mjs CHANGED
@@ -57,7 +57,7 @@ function onWindowBlur() {
57
57
  hasBlurredWindowRecently = true;
58
58
  }
59
59
  function isFocusVisible() {
60
- return modality != null && modality !== "pointer";
60
+ return modality !== "pointer";
61
61
  }
62
62
  function setupGlobalFocusEvents() {
63
63
  if (typeof window === "undefined" || hasSetup) {
@@ -102,7 +102,16 @@ function trackInteractionModality(fn) {
102
102
  handlers.delete(handler);
103
103
  };
104
104
  }
105
+ function setInteractionModality(value) {
106
+ modality = value;
107
+ trigger(value, null);
108
+ }
109
+ function getInteractionModality() {
110
+ return modality;
111
+ }
105
112
  export {
113
+ getInteractionModality,
114
+ setInteractionModality,
106
115
  trackFocusVisible,
107
116
  trackInteractionModality
108
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/focus-visible",
3
- "version": "0.0.0-dev-20220617101836",
3
+ "version": "0.0.0-dev-20220627213111",
4
4
  "description": "Focus visible polyfill utility based on WICG",
5
5
  "keywords": [
6
6
  "js",