ember-aria-voyager 0.2.3 → 0.2.5
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/README.md +14 -2
- package/dist/aria-tablist-ClqYX2au.d.mts +96 -0
- package/dist/aria-tablist-WuIqBROc.d.cts +96 -0
- package/dist/chunk-CbDLau6x.cjs +34 -0
- package/dist/index.cjs +350 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +343 -0
- package/dist/template-registry.cjs +0 -0
- package/dist/template-registry.d.cts +9 -0
- package/dist/template-registry.d.mts +10 -0
- package/dist/template-registry.mjs +1 -0
- package/dist/test-support/index.cjs +539 -0
- package/dist/test-support/index.d.cts +36 -0
- package/dist/test-support/index.d.mts +36 -0
- package/dist/test-support/index.mjs +525 -0
- package/package.json +81 -71
- package/declarations/index.d.ts +0 -12
- package/declarations/index.d.ts.map +0 -1
- package/declarations/modifiers/-emitter.d.ts +0 -28
- package/declarations/modifiers/-emitter.d.ts.map +0 -1
- package/declarations/modifiers/aria-listbox.d.ts +0 -25
- package/declarations/modifiers/aria-listbox.d.ts.map +0 -1
- package/declarations/modifiers/aria-menu.d.ts +0 -23
- package/declarations/modifiers/aria-menu.d.ts.map +0 -1
- package/declarations/modifiers/aria-tablist.d.ts +0 -28
- package/declarations/modifiers/aria-tablist.d.ts.map +0 -1
- package/declarations/template-registry.d.ts +0 -9
- package/declarations/template-registry.d.ts.map +0 -1
- package/declarations/test-support/-private/-get-description.d.ts +0 -11
- package/declarations/test-support/-private/-get-description.d.ts.map +0 -1
- package/declarations/test-support/-private/-get-element.d.ts +0 -11
- package/declarations/test-support/-private/-get-element.d.ts.map +0 -1
- package/declarations/test-support/-private/-get-elements.d.ts +0 -5
- package/declarations/test-support/-private/-get-elements.d.ts.map +0 -1
- package/declarations/test-support/-private/-target.d.ts +0 -9
- package/declarations/test-support/-private/-target.d.ts.map +0 -1
- package/declarations/test-support/-private/composite.d.ts +0 -2
- package/declarations/test-support/-private/composite.d.ts.map +0 -1
- package/declarations/test-support/-private/list.d.ts +0 -36
- package/declarations/test-support/-private/list.d.ts.map +0 -1
- package/declarations/test-support/-private/selection.d.ts +0 -18
- package/declarations/test-support/-private/selection.d.ts.map +0 -1
- package/declarations/test-support/index.d.ts +0 -4
- package/declarations/test-support/index.d.ts.map +0 -1
- package/declarations/test-support/listbox.d.ts +0 -13
- package/declarations/test-support/listbox.d.ts.map +0 -1
- package/declarations/test-support/menu.d.ts +0 -9
- package/declarations/test-support/menu.d.ts.map +0 -1
- package/declarations/test-support/tablist.d.ts +0 -13
- package/declarations/test-support/tablist.d.ts.map +0 -1
- package/dist/-emitter-CQPiyyOK.js +0 -47
- package/dist/-emitter-CQPiyyOK.js.map +0 -1
- package/dist/_app_/modifiers/aria-listbox.js +0 -1
- package/dist/_app_/modifiers/aria-menu.js +0 -1
- package/dist/_app_/modifiers/aria-tablist.js +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/modifiers/aria-listbox.js +0 -61
- package/dist/modifiers/aria-listbox.js.map +0 -1
- package/dist/modifiers/aria-menu.js +0 -42
- package/dist/modifiers/aria-menu.js.map +0 -1
- package/dist/modifiers/aria-tablist.js +0 -65
- package/dist/modifiers/aria-tablist.js.map +0 -1
- package/dist/template-registry.js +0 -2
- package/dist/template-registry.js.map +0 -1
- package/dist/test-support/index.js +0 -810
- package/dist/test-support/index.js.map +0 -1
- /package/{addon-main.js → addon-main.cjs} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ember-aria-voyager
|
|
2
2
|
|
|
3
|
-
[](https://qlty.sh/gh/hokulea/projects/aria-voyager)
|
|
4
|
+
[](https://qlty.sh/gh/hokulea/projects/aria-voyager)
|
|
5
5
|
|
|
6
6
|
_Canoe vessel that navigates your aria._
|
|
7
7
|
|
|
@@ -198,3 +198,15 @@ interface TablistSignature<T> {
|
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
When passing `items` the `select()` and `selection` can work off of your passed items, anyway will fall back to the HTMLElement
|
|
201
|
+
|
|
202
|
+
## Use in Classic Apps
|
|
203
|
+
|
|
204
|
+
`ember-aria-voyager` is primed to be used with polaris edition of ember using
|
|
205
|
+
imports. Classic v1 addons and v2 addons with compat automatically provide
|
|
206
|
+
re-exports, which this addon does not. Re-export it manually. Here is an example
|
|
207
|
+
for `ariaListbox`:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
// app/modifiers/aria-listbox.js
|
|
211
|
+
export { ariaListbox as default } from 'ember-aria-voyager';
|
|
212
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { IndexEmitStrategy, ItemEmitStrategy, Orientation, TablistBehavior } from "aria-voyager";
|
|
2
|
+
import Modifier, { ArgsFor, NamedArgs, PositionalArgs } from "ember-modifier";
|
|
3
|
+
import Owner from "@ember/owner";
|
|
4
|
+
|
|
5
|
+
//#region src/modifiers/-emitter.d.ts
|
|
6
|
+
type WithItems<T> = {
|
|
7
|
+
items: T[];
|
|
8
|
+
selection?: T | T[];
|
|
9
|
+
activateItem?: (item: T) => void;
|
|
10
|
+
} & ({
|
|
11
|
+
multi: true;
|
|
12
|
+
select?: (selection: T[]) => void;
|
|
13
|
+
} | {
|
|
14
|
+
multi?: false;
|
|
15
|
+
select?: (selection: T) => void;
|
|
16
|
+
});
|
|
17
|
+
type OptionalItems = {
|
|
18
|
+
items?: HTMLElement[];
|
|
19
|
+
selection?: HTMLElement | HTMLElement[];
|
|
20
|
+
activateItem?: (item: HTMLElement) => void;
|
|
21
|
+
} & ({
|
|
22
|
+
multi: true;
|
|
23
|
+
select?: (selection: HTMLElement[]) => void;
|
|
24
|
+
} | {
|
|
25
|
+
multi?: false;
|
|
26
|
+
select?: (selection: HTMLElement) => void;
|
|
27
|
+
});
|
|
28
|
+
type EmitterSignature<T> = WithItems<T> | OptionalItems;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/modifiers/aria-listbox.d.ts
|
|
31
|
+
interface ListboxSignature<T> {
|
|
32
|
+
Args: {
|
|
33
|
+
Positional: [];
|
|
34
|
+
Named: {
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
} & EmitterSignature<T>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare class ListboxModifier<T> extends Modifier<ListboxSignature<T>> {
|
|
40
|
+
private listbox?;
|
|
41
|
+
private updater;
|
|
42
|
+
private emitter;
|
|
43
|
+
private prevItems?;
|
|
44
|
+
private prevSelection?;
|
|
45
|
+
private prevMulti?;
|
|
46
|
+
private prevDisabled?;
|
|
47
|
+
constructor(owner: Owner, args: ArgsFor<ListboxSignature<T>>);
|
|
48
|
+
modify(element: Element, _: PositionalArgs<ListboxSignature<T>>, options: NamedArgs<ListboxSignature<T>>): void;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/modifiers/aria-menu.d.ts
|
|
52
|
+
interface MenuSignature<T> {
|
|
53
|
+
Element: HTMLElement;
|
|
54
|
+
Args: {
|
|
55
|
+
Positional: [];
|
|
56
|
+
Named: {
|
|
57
|
+
items?: T[];
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
declare class MenuModifier<T> extends Modifier<MenuSignature<T>> {
|
|
63
|
+
private menu?;
|
|
64
|
+
private updater;
|
|
65
|
+
private emitter;
|
|
66
|
+
private prevItems?;
|
|
67
|
+
private prevDisabled?;
|
|
68
|
+
constructor(owner: Owner, args: ArgsFor<MenuSignature<T>>);
|
|
69
|
+
modify(element: Element, _: PositionalArgs<MenuSignature<T>>, options: NamedArgs<MenuSignature<T>>): void;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/modifiers/aria-tablist.d.ts
|
|
73
|
+
interface TablistSignature<T> {
|
|
74
|
+
Element: HTMLElement;
|
|
75
|
+
Args: {
|
|
76
|
+
Positional: [];
|
|
77
|
+
Named: {
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
orientation?: Orientation;
|
|
80
|
+
behavior?: TablistBehavior;
|
|
81
|
+
} & EmitterSignature<T>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
declare class TablistModifier<T> extends Modifier<TablistSignature<T>> {
|
|
85
|
+
private tablist?;
|
|
86
|
+
private updater;
|
|
87
|
+
private emitter;
|
|
88
|
+
private prevItems?;
|
|
89
|
+
private prevSelection?;
|
|
90
|
+
private prevDisabled?;
|
|
91
|
+
private prevOrientation?;
|
|
92
|
+
constructor(owner: Owner, args: ArgsFor<TablistSignature<T>>);
|
|
93
|
+
modify(element: Element, _: PositionalArgs<TablistSignature<T>>, options: NamedArgs<TablistSignature<T>>): void;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { MenuModifier as n, ListboxModifier as r, TablistModifier as t };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import Modifier, { ArgsFor, NamedArgs, PositionalArgs } from "ember-modifier";
|
|
2
|
+
import { Orientation, TablistBehavior } from "aria-voyager";
|
|
3
|
+
import Owner from "@ember/owner";
|
|
4
|
+
|
|
5
|
+
//#region src/modifiers/-emitter.d.ts
|
|
6
|
+
type WithItems<T> = {
|
|
7
|
+
items: T[];
|
|
8
|
+
selection?: T | T[];
|
|
9
|
+
activateItem?: (item: T) => void;
|
|
10
|
+
} & ({
|
|
11
|
+
multi: true;
|
|
12
|
+
select?: (selection: T[]) => void;
|
|
13
|
+
} | {
|
|
14
|
+
multi?: false;
|
|
15
|
+
select?: (selection: T) => void;
|
|
16
|
+
});
|
|
17
|
+
type OptionalItems = {
|
|
18
|
+
items?: HTMLElement[];
|
|
19
|
+
selection?: HTMLElement | HTMLElement[];
|
|
20
|
+
activateItem?: (item: HTMLElement) => void;
|
|
21
|
+
} & ({
|
|
22
|
+
multi: true;
|
|
23
|
+
select?: (selection: HTMLElement[]) => void;
|
|
24
|
+
} | {
|
|
25
|
+
multi?: false;
|
|
26
|
+
select?: (selection: HTMLElement) => void;
|
|
27
|
+
});
|
|
28
|
+
type EmitterSignature<T> = WithItems<T> | OptionalItems;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/modifiers/aria-listbox.d.ts
|
|
31
|
+
interface ListboxSignature<T> {
|
|
32
|
+
Args: {
|
|
33
|
+
Positional: [];
|
|
34
|
+
Named: {
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
} & EmitterSignature<T>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare class ListboxModifier<T> extends Modifier<ListboxSignature<T>> {
|
|
40
|
+
private listbox?;
|
|
41
|
+
private updater;
|
|
42
|
+
private emitter;
|
|
43
|
+
private prevItems?;
|
|
44
|
+
private prevSelection?;
|
|
45
|
+
private prevMulti?;
|
|
46
|
+
private prevDisabled?;
|
|
47
|
+
constructor(owner: Owner, args: ArgsFor<ListboxSignature<T>>);
|
|
48
|
+
modify(element: Element, _: PositionalArgs<ListboxSignature<T>>, options: NamedArgs<ListboxSignature<T>>): void;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/modifiers/aria-menu.d.ts
|
|
52
|
+
interface MenuSignature<T> {
|
|
53
|
+
Element: HTMLElement;
|
|
54
|
+
Args: {
|
|
55
|
+
Positional: [];
|
|
56
|
+
Named: {
|
|
57
|
+
items?: T[];
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
declare class MenuModifier<T> extends Modifier<MenuSignature<T>> {
|
|
63
|
+
private menu?;
|
|
64
|
+
private updater;
|
|
65
|
+
private emitter;
|
|
66
|
+
private prevItems?;
|
|
67
|
+
private prevDisabled?;
|
|
68
|
+
constructor(owner: Owner, args: ArgsFor<MenuSignature<T>>);
|
|
69
|
+
modify(element: Element, _: PositionalArgs<MenuSignature<T>>, options: NamedArgs<MenuSignature<T>>): void;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/modifiers/aria-tablist.d.ts
|
|
73
|
+
interface TablistSignature<T> {
|
|
74
|
+
Element: HTMLElement;
|
|
75
|
+
Args: {
|
|
76
|
+
Positional: [];
|
|
77
|
+
Named: {
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
orientation?: Orientation;
|
|
80
|
+
behavior?: TablistBehavior;
|
|
81
|
+
} & EmitterSignature<T>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
declare class TablistModifier<T> extends Modifier<TablistSignature<T>> {
|
|
85
|
+
private tablist?;
|
|
86
|
+
private updater;
|
|
87
|
+
private emitter;
|
|
88
|
+
private prevItems?;
|
|
89
|
+
private prevSelection?;
|
|
90
|
+
private prevDisabled?;
|
|
91
|
+
private prevOrientation?;
|
|
92
|
+
constructor(owner: Owner, args: ArgsFor<TablistSignature<T>>);
|
|
93
|
+
modify(element: Element, _: PositionalArgs<TablistSignature<T>>, options: NamedArgs<TablistSignature<T>>): void;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { MenuModifier as n, ListboxModifier as r, TablistModifier as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, '__toESM', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return __toESM;
|
|
33
|
+
}
|
|
34
|
+
});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
+
let _ember_destroyable = require("@ember/destroyable");
|
|
3
|
+
let aria_voyager = require("aria-voyager");
|
|
4
|
+
let ember_modifier = require("ember-modifier");
|
|
5
|
+
ember_modifier = require_chunk.__toESM(ember_modifier);
|
|
6
|
+
|
|
7
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
8
|
+
function isPlainObject(value) {
|
|
9
|
+
if (!value || typeof value !== "object") return false;
|
|
10
|
+
const proto = Object.getPrototypeOf(value);
|
|
11
|
+
if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
|
|
12
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
17
|
+
function getSymbols(object) {
|
|
18
|
+
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
23
|
+
function getTag(value) {
|
|
24
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
25
|
+
return Object.prototype.toString.call(value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
30
|
+
const regexpTag = "[object RegExp]";
|
|
31
|
+
const stringTag = "[object String]";
|
|
32
|
+
const numberTag = "[object Number]";
|
|
33
|
+
const booleanTag = "[object Boolean]";
|
|
34
|
+
const argumentsTag = "[object Arguments]";
|
|
35
|
+
const symbolTag = "[object Symbol]";
|
|
36
|
+
const dateTag = "[object Date]";
|
|
37
|
+
const mapTag = "[object Map]";
|
|
38
|
+
const setTag = "[object Set]";
|
|
39
|
+
const arrayTag = "[object Array]";
|
|
40
|
+
const functionTag = "[object Function]";
|
|
41
|
+
const arrayBufferTag = "[object ArrayBuffer]";
|
|
42
|
+
const objectTag = "[object Object]";
|
|
43
|
+
const errorTag = "[object Error]";
|
|
44
|
+
const dataViewTag = "[object DataView]";
|
|
45
|
+
const uint8ArrayTag = "[object Uint8Array]";
|
|
46
|
+
const uint8ClampedArrayTag = "[object Uint8ClampedArray]";
|
|
47
|
+
const uint16ArrayTag = "[object Uint16Array]";
|
|
48
|
+
const uint32ArrayTag = "[object Uint32Array]";
|
|
49
|
+
const bigUint64ArrayTag = "[object BigUint64Array]";
|
|
50
|
+
const int8ArrayTag = "[object Int8Array]";
|
|
51
|
+
const int16ArrayTag = "[object Int16Array]";
|
|
52
|
+
const int32ArrayTag = "[object Int32Array]";
|
|
53
|
+
const bigInt64ArrayTag = "[object BigInt64Array]";
|
|
54
|
+
const float32ArrayTag = "[object Float32Array]";
|
|
55
|
+
const float64ArrayTag = "[object Float64Array]";
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/compat/util/eq.mjs
|
|
59
|
+
function eq(value, other) {
|
|
60
|
+
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
65
|
+
function isEqualWith(a, b, areValuesEqual) {
|
|
66
|
+
return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
|
|
67
|
+
}
|
|
68
|
+
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
|
69
|
+
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
|
70
|
+
if (result !== void 0) return result;
|
|
71
|
+
if (typeof a === typeof b) switch (typeof a) {
|
|
72
|
+
case "bigint":
|
|
73
|
+
case "string":
|
|
74
|
+
case "boolean":
|
|
75
|
+
case "symbol":
|
|
76
|
+
case "undefined": return a === b;
|
|
77
|
+
case "number": return a === b || Object.is(a, b);
|
|
78
|
+
case "function": return a === b;
|
|
79
|
+
case "object": return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
80
|
+
}
|
|
81
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
82
|
+
}
|
|
83
|
+
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
84
|
+
if (Object.is(a, b)) return true;
|
|
85
|
+
let aTag = getTag(a);
|
|
86
|
+
let bTag = getTag(b);
|
|
87
|
+
if (aTag === argumentsTag) aTag = objectTag;
|
|
88
|
+
if (bTag === argumentsTag) bTag = objectTag;
|
|
89
|
+
if (aTag !== bTag) return false;
|
|
90
|
+
switch (aTag) {
|
|
91
|
+
case stringTag: return a.toString() === b.toString();
|
|
92
|
+
case numberTag: return eq(a.valueOf(), b.valueOf());
|
|
93
|
+
case booleanTag:
|
|
94
|
+
case dateTag:
|
|
95
|
+
case symbolTag: return Object.is(a.valueOf(), b.valueOf());
|
|
96
|
+
case regexpTag: return a.source === b.source && a.flags === b.flags;
|
|
97
|
+
case functionTag: return a === b;
|
|
98
|
+
}
|
|
99
|
+
stack = stack ?? /* @__PURE__ */ new Map();
|
|
100
|
+
const aStack = stack.get(a);
|
|
101
|
+
const bStack = stack.get(b);
|
|
102
|
+
if (aStack != null && bStack != null) return aStack === b;
|
|
103
|
+
stack.set(a, b);
|
|
104
|
+
stack.set(b, a);
|
|
105
|
+
try {
|
|
106
|
+
switch (aTag) {
|
|
107
|
+
case mapTag:
|
|
108
|
+
if (a.size !== b.size) return false;
|
|
109
|
+
for (const [key, value] of a.entries()) if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) return false;
|
|
110
|
+
return true;
|
|
111
|
+
case setTag: {
|
|
112
|
+
if (a.size !== b.size) return false;
|
|
113
|
+
const aValues = Array.from(a.values());
|
|
114
|
+
const bValues = Array.from(b.values());
|
|
115
|
+
for (let i = 0; i < aValues.length; i++) {
|
|
116
|
+
const aValue = aValues[i];
|
|
117
|
+
const index = bValues.findIndex((bValue) => {
|
|
118
|
+
return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
|
|
119
|
+
});
|
|
120
|
+
if (index === -1) return false;
|
|
121
|
+
bValues.splice(index, 1);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
case arrayTag:
|
|
126
|
+
case uint8ArrayTag:
|
|
127
|
+
case uint8ClampedArrayTag:
|
|
128
|
+
case uint16ArrayTag:
|
|
129
|
+
case uint32ArrayTag:
|
|
130
|
+
case bigUint64ArrayTag:
|
|
131
|
+
case int8ArrayTag:
|
|
132
|
+
case int16ArrayTag:
|
|
133
|
+
case int32ArrayTag:
|
|
134
|
+
case bigInt64ArrayTag:
|
|
135
|
+
case float32ArrayTag:
|
|
136
|
+
case float64ArrayTag:
|
|
137
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) return false;
|
|
138
|
+
if (a.length !== b.length) return false;
|
|
139
|
+
for (let i = 0; i < a.length; i++) if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) return false;
|
|
140
|
+
return true;
|
|
141
|
+
case arrayBufferTag:
|
|
142
|
+
if (a.byteLength !== b.byteLength) return false;
|
|
143
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
144
|
+
case dataViewTag:
|
|
145
|
+
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) return false;
|
|
146
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
147
|
+
case errorTag: return a.name === b.name && a.message === b.message;
|
|
148
|
+
case objectTag: {
|
|
149
|
+
if (!(areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b))) return false;
|
|
150
|
+
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
|
151
|
+
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
152
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
153
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
154
|
+
const propKey = aKeys[i];
|
|
155
|
+
const aProp = a[propKey];
|
|
156
|
+
if (!Object.hasOwn(b, propKey)) return false;
|
|
157
|
+
const bProp = b[propKey];
|
|
158
|
+
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
default: return false;
|
|
163
|
+
}
|
|
164
|
+
} finally {
|
|
165
|
+
stack.delete(a);
|
|
166
|
+
stack.delete(b);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/function/noop.mjs
|
|
172
|
+
function noop() {}
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
176
|
+
function isEqual(a, b) {
|
|
177
|
+
return isEqualWith(a, b, noop);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/modifiers/-emitter.ts
|
|
182
|
+
function asArray(val) {
|
|
183
|
+
if (val === void 0) return [];
|
|
184
|
+
return Array.isArray(val) ? val : [val];
|
|
185
|
+
}
|
|
186
|
+
function createItemEmitter(control, options) {
|
|
187
|
+
return new aria_voyager.ItemEmitStrategy(control, {
|
|
188
|
+
select: (selection) => {
|
|
189
|
+
options.select?.(options.multi ? selection : selection[0]);
|
|
190
|
+
},
|
|
191
|
+
activateItem: (item) => {
|
|
192
|
+
options.activateItem?.(item);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function createIndexEmitter(control, options) {
|
|
197
|
+
const findByIndex = (index) => {
|
|
198
|
+
return options.items[index] ?? void 0;
|
|
199
|
+
};
|
|
200
|
+
return new aria_voyager.IndexEmitStrategy(control, {
|
|
201
|
+
select: (selection) => {
|
|
202
|
+
if (options.multi) {
|
|
203
|
+
const items = selection.map((index) => findByIndex(index)).filter((i) => i !== void 0);
|
|
204
|
+
options.select?.(items);
|
|
205
|
+
} else {
|
|
206
|
+
const item = findByIndex(selection[0]);
|
|
207
|
+
if (item) options.select?.(item);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
activateItem: (index) => {
|
|
211
|
+
const item = findByIndex(index);
|
|
212
|
+
if (item) options.activateItem?.(item);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/modifiers/aria-listbox.ts
|
|
219
|
+
var ListboxModifier = class extends ember_modifier.default {
|
|
220
|
+
listbox;
|
|
221
|
+
prevItems;
|
|
222
|
+
prevSelection;
|
|
223
|
+
prevMulti;
|
|
224
|
+
prevDisabled;
|
|
225
|
+
constructor(owner, args) {
|
|
226
|
+
super(owner, args);
|
|
227
|
+
(0, _ember_destroyable.registerDestructor)(this, () => {
|
|
228
|
+
this.listbox?.dispose();
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
modify(element, _, options) {
|
|
232
|
+
if (!this.listbox) {
|
|
233
|
+
this.updater = new aria_voyager.ReactiveUpdateStrategy();
|
|
234
|
+
this.listbox = new aria_voyager.Listbox(element, { updater: this.updater });
|
|
235
|
+
}
|
|
236
|
+
if (options.items && !(this.emitter instanceof aria_voyager.IndexEmitStrategy)) this.emitter = createIndexEmitter(this.listbox, options);
|
|
237
|
+
else if (!options.items && !(this.emitter instanceof aria_voyager.ItemEmitStrategy)) this.emitter = createItemEmitter(this.listbox, options);
|
|
238
|
+
if (options.items && !isEqual(this.prevItems, options.items)) {
|
|
239
|
+
this.updater.updateItems();
|
|
240
|
+
this.prevItems = [...options.items];
|
|
241
|
+
}
|
|
242
|
+
if (options.selection && !isEqual(asArray(this.prevSelection), asArray(options.selection))) {
|
|
243
|
+
this.updater.updateSelection();
|
|
244
|
+
this.prevSelection = asArray(options.selection);
|
|
245
|
+
}
|
|
246
|
+
let optionsChanged = false;
|
|
247
|
+
if (this.prevMulti !== options.multi) {
|
|
248
|
+
if (options.multi) element.setAttribute("aria-multiselectable", "true");
|
|
249
|
+
else element.removeAttribute("aria-multiselectable");
|
|
250
|
+
optionsChanged = true;
|
|
251
|
+
this.prevMulti = options.multi;
|
|
252
|
+
}
|
|
253
|
+
if (this.prevDisabled !== options.disabled) {
|
|
254
|
+
if (options.disabled) element.setAttribute("aria-disabled", "true");
|
|
255
|
+
else element.removeAttribute("aria-disabled");
|
|
256
|
+
optionsChanged = true;
|
|
257
|
+
this.prevDisabled = options.disabled;
|
|
258
|
+
}
|
|
259
|
+
if (optionsChanged) this.updater.updateOptions();
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/modifiers/aria-menu.ts
|
|
265
|
+
var MenuModifier = class extends ember_modifier.default {
|
|
266
|
+
menu;
|
|
267
|
+
prevItems;
|
|
268
|
+
prevDisabled;
|
|
269
|
+
constructor(owner, args) {
|
|
270
|
+
super(owner, args);
|
|
271
|
+
(0, _ember_destroyable.registerDestructor)(this, () => {
|
|
272
|
+
this.menu?.dispose();
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
modify(element, _, options) {
|
|
276
|
+
if (!this.menu) {
|
|
277
|
+
this.updater = new aria_voyager.ReactiveUpdateStrategy();
|
|
278
|
+
this.menu = new aria_voyager.Menu(element, { updater: this.updater });
|
|
279
|
+
}
|
|
280
|
+
if (options.items && !isEqual(this.prevItems, options.items)) {
|
|
281
|
+
this.updater.updateItems();
|
|
282
|
+
this.prevItems = [...options.items];
|
|
283
|
+
}
|
|
284
|
+
let optionsChanged = false;
|
|
285
|
+
if (this.prevDisabled !== options.disabled) {
|
|
286
|
+
if (options.disabled) element.setAttribute("aria-disabled", "true");
|
|
287
|
+
else element.removeAttribute("aria-disabled");
|
|
288
|
+
optionsChanged = true;
|
|
289
|
+
this.prevDisabled = options.disabled;
|
|
290
|
+
}
|
|
291
|
+
if (optionsChanged) this.updater.updateOptions();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/modifiers/aria-tablist.ts
|
|
297
|
+
var TablistModifier = class extends ember_modifier.default {
|
|
298
|
+
tablist;
|
|
299
|
+
prevItems;
|
|
300
|
+
prevSelection;
|
|
301
|
+
prevDisabled;
|
|
302
|
+
prevOrientation;
|
|
303
|
+
constructor(owner, args) {
|
|
304
|
+
super(owner, args);
|
|
305
|
+
(0, _ember_destroyable.registerDestructor)(this, () => {
|
|
306
|
+
this.tablist?.dispose();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
modify(element, _, options) {
|
|
310
|
+
if (!this.tablist) {
|
|
311
|
+
this.updater = new aria_voyager.ReactiveUpdateStrategy();
|
|
312
|
+
this.tablist = new aria_voyager.Tablist(element, {
|
|
313
|
+
updater: this.updater,
|
|
314
|
+
behavior: options.behavior
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
if (options.items && !(this.emitter instanceof aria_voyager.IndexEmitStrategy)) this.emitter = createIndexEmitter(this.tablist, options);
|
|
318
|
+
else if (!options.items && !(this.emitter instanceof aria_voyager.ItemEmitStrategy)) this.emitter = createItemEmitter(this.tablist, options);
|
|
319
|
+
if (options.items && !isEqual(this.prevItems, options.items)) {
|
|
320
|
+
this.updater.updateItems();
|
|
321
|
+
this.prevItems = [...options.items];
|
|
322
|
+
}
|
|
323
|
+
if (options.selection && !isEqual(asArray(this.prevSelection), asArray(options.selection))) {
|
|
324
|
+
this.updater.updateSelection();
|
|
325
|
+
this.prevSelection = asArray(options.selection);
|
|
326
|
+
}
|
|
327
|
+
let optionsChanged = false;
|
|
328
|
+
if (this.prevOrientation !== options.orientation) {
|
|
329
|
+
if (options.orientation) element.setAttribute("aria-orientation", options.orientation);
|
|
330
|
+
else element.removeAttribute("aria-orientation");
|
|
331
|
+
optionsChanged = true;
|
|
332
|
+
this.prevOrientation = options.orientation;
|
|
333
|
+
}
|
|
334
|
+
if (this.prevDisabled !== options.disabled) {
|
|
335
|
+
if (options.disabled) element.setAttribute("aria-disabled", "true");
|
|
336
|
+
else element.removeAttribute("aria-disabled");
|
|
337
|
+
optionsChanged = true;
|
|
338
|
+
this.prevDisabled = options.disabled;
|
|
339
|
+
}
|
|
340
|
+
if (optionsChanged) this.updater.updateOptions();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
//#endregion
|
|
345
|
+
exports.ariaListbox = ListboxModifier;
|
|
346
|
+
exports.ariaMenu = MenuModifier;
|
|
347
|
+
exports.ariaTablist = TablistModifier;
|
|
348
|
+
exports.listbox = ListboxModifier;
|
|
349
|
+
exports.menu = MenuModifier;
|
|
350
|
+
exports.tablist = TablistModifier;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { n as MenuModifier, r as ListboxModifier, t as TablistModifier } from "./aria-tablist-WuIqBROc.cjs";
|
|
2
|
+
import { Orientation, TablistBehavior } from "aria-voyager";
|
|
3
|
+
export { type Orientation, type TablistBehavior, ListboxModifier as ariaListbox, ListboxModifier as listbox, MenuModifier as ariaMenu, MenuModifier as menu, TablistModifier as ariaTablist, TablistModifier as tablist };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { n as MenuModifier, r as ListboxModifier, t as TablistModifier } from "./aria-tablist-ClqYX2au.mjs";
|
|
2
|
+
import { Orientation, TablistBehavior } from "aria-voyager";
|
|
3
|
+
export { type Orientation, type TablistBehavior, ListboxModifier as ariaListbox, ListboxModifier as listbox, MenuModifier as ariaMenu, MenuModifier as menu, TablistModifier as ariaTablist, TablistModifier as tablist };
|