ember-attacher 4.4.0 → 5.0.0-beta.2

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.
Files changed (50) hide show
  1. package/README.md +416 -0
  2. package/dist/{attacher-core-m7x5g04q.js → attacher-core-DIAMEQR6.js} +1001 -978
  3. package/dist/attacher-core-DIAMEQR6.js.map +1 -0
  4. package/dist/attacher-overlay-BCAfauc_.js +40 -0
  5. package/dist/attacher-overlay-BCAfauc_.js.map +1 -0
  6. package/dist/components/attach-popover.d.ts +10 -12
  7. package/dist/components/attach-popover.js +7 -4
  8. package/dist/components/attach-popover.js.map +1 -1
  9. package/dist/components/attach-tooltip.d.ts +11 -13
  10. package/dist/components/attach-tooltip.js +10 -7
  11. package/dist/components/attach-tooltip.js.map +1 -1
  12. package/dist/components/attacher.d.ts +12 -12
  13. package/dist/components/attacher.js +7 -15
  14. package/dist/components/attacher.js.map +1 -1
  15. package/dist/defaults.d.ts +27 -28
  16. package/dist/defaults.js +11 -11
  17. package/dist/defaults.js.map +1 -1
  18. package/dist/index.d.ts +9 -60
  19. package/dist/index.js +13 -3
  20. package/dist/index.js.map +1 -1
  21. package/dist/{is-visible-DQGdmVDv.js → is-visible-CeN9qZyc.js} +6 -3
  22. package/dist/is-visible-CeN9qZyc.js.map +1 -0
  23. package/dist/lib/a11y.d.ts +77 -0
  24. package/dist/lib/attacher-core.d.ts +342 -0
  25. package/dist/lib/attacher-overlay.d.ts +18 -0
  26. package/dist/lib/attachment-tree.d.ts +32 -0
  27. package/dist/lib/delay-group.d.ts +15 -0
  28. package/dist/lib/dom.d.ts +40 -0
  29. package/dist/lib/host.d.ts +21 -0
  30. package/dist/lib/positioning.d.ts +27 -0
  31. package/dist/lib/schedule.d.ts +12 -0
  32. package/dist/lib/singleton-tooltip-pool.d.ts +32 -0
  33. package/dist/lib/target-resolution.d.ts +44 -0
  34. package/dist/modifiers/tooltip.d.ts +18 -15
  35. package/dist/modifiers/tooltip.js +55 -67
  36. package/dist/modifiers/tooltip.js.map +1 -1
  37. package/dist/styles/ember-attacher.css +1 -1
  38. package/dist/template-registry.d.ts +7 -11
  39. package/dist/test-support/assert-attached.d.ts +27 -0
  40. package/dist/test-support/index.d.ts +2 -2
  41. package/dist/test-support/index.js +95 -1
  42. package/dist/test-support/index.js.map +1 -1
  43. package/dist/test-support/is-visible.d.ts +1 -2
  44. package/package.json +18 -7
  45. package/dist/_app_/components/basic-attacher.js +0 -1
  46. package/dist/attacher-core-m7x5g04q.js.map +0 -1
  47. package/dist/components/basic-attacher.d.ts +0 -151
  48. package/dist/components/basic-attacher.js +0 -44
  49. package/dist/components/basic-attacher.js.map +0 -1
  50. package/dist/is-visible-DQGdmVDv.js.map +0 -1
@@ -1,14 +1,12 @@
1
- import type Component from '@glimmer/component';
2
- import type { AttachPopoverArgs, AttacherNamedBlocks } from './basic-attacher';
3
-
4
- export type { AttachPopoverArgs };
5
-
6
- export interface AttachPopoverSignature {
7
- Element: HTMLDivElement;
8
- Args: AttachPopoverArgs;
9
- Blocks: AttacherNamedBlocks;
1
+ import type { AttacherArgs, AttacherNamedBlocks } from '../lib/attacher-core';
2
+ import AttacherOverlay, { type AttacherOverlaySignature } from '../lib/attacher-overlay';
3
+ export type AttachPopoverArgs = AttacherArgs;
4
+ export interface AttachPopoverSignature extends AttacherOverlaySignature {
5
+ Element: HTMLDivElement;
6
+ Args: AttachPopoverArgs;
7
+ Blocks: AttacherNamedBlocks;
10
8
  }
11
-
12
- export default class AttachPopover extends Component<AttachPopoverSignature> {
13
- get ariaRole(): string;
9
+ export default class AttachPopover extends AttacherOverlay {
10
+ get _defaultConfigKey(): 'popover';
11
+ get _defaultAriaRole(): string;
14
12
  }
@@ -1,7 +1,7 @@
1
- import { setComponentTemplate, getComponentTemplate } from '@ember/component';
2
- import BasicAttacher from './basic-attacher.js';
1
+ import { getComponentTemplate, setComponentTemplate } from '@ember/component';
2
+ import { A as AttacherOverlay } from '../attacher-overlay-BCAfauc_.js';
3
3
 
4
- class AttachPopover extends BasicAttacher {
4
+ class AttachPopover extends AttacherOverlay {
5
5
  get _defaultConfigKey() {
6
6
  return 'popover';
7
7
  }
@@ -9,7 +9,10 @@ class AttachPopover extends BasicAttacher {
9
9
  return 'dialog';
10
10
  }
11
11
  }
12
- setComponentTemplate(getComponentTemplate(BasicAttacher), AttachPopover);
12
+ const template = getComponentTemplate(AttacherOverlay);
13
+ if (template) {
14
+ setComponentTemplate(template, AttachPopover);
15
+ }
13
16
 
14
17
  export { AttachPopover as default };
15
18
  //# sourceMappingURL=attach-popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attach-popover.js","sources":["../../src/components/attach-popover.js"],"sourcesContent":["import { getComponentTemplate, setComponentTemplate } from '@ember/component';\nimport BasicAttacher from './basic-attacher';\n\nexport default class AttachPopover extends BasicAttacher {\n get _defaultConfigKey() {\n return 'popover';\n }\n\n get _defaultAriaRole() {\n return 'dialog';\n }\n}\n\nsetComponentTemplate(getComponentTemplate(BasicAttacher), AttachPopover);\n"],"names":["AttachPopover","BasicAttacher","_defaultConfigKey","_defaultAriaRole","setComponentTemplate","getComponentTemplate"],"mappings":";;;AAGe,MAAMA,aAAa,SAASC,aAAa,CAAC;EACvD,IAAIC,iBAAiBA,GAAG;AACtB,IAAA,OAAO,SAAS;AAClB,EAAA;EAEA,IAAIC,gBAAgBA,GAAG;AACrB,IAAA,OAAO,QAAQ;AACjB,EAAA;AACF;AAEAC,oBAAoB,CAACC,oBAAoB,CAACJ,aAAa,CAAC,EAAED,aAAa,CAAC;;"}
1
+ {"version":3,"file":"attach-popover.js","sources":["../../src/components/attach-popover.gts"],"sourcesContent":["import { getComponentTemplate, setComponentTemplate } from '@ember/component';\nimport type { AttacherArgs, AttacherNamedBlocks } from '../lib/attacher-core';\nimport AttacherOverlay, { type AttacherOverlaySignature } from '../lib/attacher-overlay';\n\nexport type AttachPopoverArgs = AttacherArgs;\n\nexport interface AttachPopoverSignature extends AttacherOverlaySignature {\n Element: HTMLDivElement;\n Args: AttachPopoverArgs;\n Blocks: AttacherNamedBlocks;\n}\n\nexport default class AttachPopover extends AttacherOverlay {\n override get _defaultConfigKey(): 'popover' {\n return 'popover';\n }\n\n override get _defaultAriaRole(): string {\n return 'dialog';\n }\n}\n\nconst template = getComponentTemplate(AttacherOverlay);\nif (template) {\n setComponentTemplate(template, AttachPopover);\n}\n"],"names":["AttachPopover","AttacherOverlay","_defaultConfigKey","_defaultAriaRole","template","getComponentTemplate","setComponentTemplate"],"mappings":";;;AAYe,MAAMA,aAAA,SAAsBC,eAAA,CAAA;EACzC,IAAaC,oBAA+B;AAC1C,IAAA,OAAO,SAAA;AACT,EAAA;EAEA,IAAaC,gBAAAA,GAA2B;AACtC,IAAA,OAAO,QAAA;AACT,EAAA;AACF;AAEA,MAAMC,WAAWC,oBAAA,CAAqBJ,eAAA,CAAA;AACtC,IAAIG,QAAA,EAAU;AACZE,EAAAA,oBAAA,CAAqBF,QAAA,EAAUJ,aAAA,CAAA;AACjC;;"}
@@ -1,15 +1,13 @@
1
- import type Component from '@glimmer/component';
2
- import type { AttachPopoverArgs, AttacherNamedBlocks } from './basic-attacher';
3
-
4
- export type AttachTooltipArgs = AttachPopoverArgs;
5
-
6
- export interface AttachTooltipSignature {
7
- Element: HTMLDivElement;
8
- Args: AttachTooltipArgs;
9
- Blocks: AttacherNamedBlocks;
1
+ import { type AttacherArgs, type AttacherNamedBlocks } from '../lib/attacher-core';
2
+ import AttacherOverlay, { type AttacherOverlaySignature } from '../lib/attacher-overlay';
3
+ export type AttachTooltipArgs = AttacherArgs;
4
+ export interface AttachTooltipSignature extends AttacherOverlaySignature {
5
+ Element: HTMLDivElement;
6
+ Args: AttachTooltipArgs;
7
+ Blocks: AttacherNamedBlocks;
10
8
  }
11
-
12
- export default class AttachTooltip extends Component<AttachTooltipSignature> {
13
- get ariaRole(): string;
14
- get additionalClass(): string;
9
+ export default class AttachTooltip extends AttacherOverlay {
10
+ get _defaultConfigKey(): 'tooltip';
11
+ get _defaultAriaRole(): string;
12
+ get _defaultClass(): string;
15
13
  }
@@ -1,19 +1,22 @@
1
- import { setComponentTemplate, getComponentTemplate } from '@ember/component';
2
- import { r as resolveTooltipClass } from '../attacher-core-m7x5g04q.js';
3
- import BasicAttacher from './basic-attacher.js';
1
+ import { getComponentTemplate, setComponentTemplate } from '@ember/component';
2
+ import { r as resolveTooltipClass } from '../attacher-core-DIAMEQR6.js';
3
+ import { A as AttacherOverlay } from '../attacher-overlay-BCAfauc_.js';
4
4
 
5
- class AttachTooltip extends BasicAttacher {
5
+ class AttachTooltip extends AttacherOverlay {
6
6
  get _defaultConfigKey() {
7
7
  return 'tooltip';
8
8
  }
9
9
  get _defaultAriaRole() {
10
10
  return 'tooltip';
11
11
  }
12
- get additionalClass() {
13
- return [this.args.additionalClass, resolveTooltipClass(this.core.envConfig)].filter(Boolean).join(' ');
12
+ get _defaultClass() {
13
+ return resolveTooltipClass(this.core.envConfig);
14
14
  }
15
15
  }
16
- setComponentTemplate(getComponentTemplate(BasicAttacher), AttachTooltip);
16
+ const template = getComponentTemplate(AttacherOverlay);
17
+ if (template) {
18
+ setComponentTemplate(template, AttachTooltip);
19
+ }
17
20
 
18
21
  export { AttachTooltip as default };
19
22
  //# sourceMappingURL=attach-tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attach-tooltip.js","sources":["../../src/components/attach-tooltip.js"],"sourcesContent":["import { getComponentTemplate, setComponentTemplate } from '@ember/component';\nimport { resolveTooltipClass } from '../lib/attacher-core.js';\nimport BasicAttacher from './basic-attacher';\n\nexport default class AttachTooltip extends BasicAttacher {\n get _defaultConfigKey() {\n return 'tooltip';\n }\n\n get _defaultAriaRole() {\n return 'tooltip';\n }\n\n get additionalClass() {\n return [this.args.additionalClass, resolveTooltipClass(this.core.envConfig)]\n .filter(Boolean)\n .join(' ');\n }\n}\n\nsetComponentTemplate(getComponentTemplate(BasicAttacher), AttachTooltip);\n"],"names":["AttachTooltip","BasicAttacher","_defaultConfigKey","_defaultAriaRole","additionalClass","args","resolveTooltipClass","core","envConfig","filter","Boolean","join","setComponentTemplate","getComponentTemplate"],"mappings":";;;;AAIe,MAAMA,aAAa,SAASC,aAAa,CAAC;EACvD,IAAIC,iBAAiBA,GAAG;AACtB,IAAA,OAAO,SAAS;AAClB,EAAA;EAEA,IAAIC,gBAAgBA,GAAG;AACrB,IAAA,OAAO,SAAS;AAClB,EAAA;EAEA,IAAIC,eAAeA,GAAG;IACpB,OAAO,CAAC,IAAI,CAACC,IAAI,CAACD,eAAe,EAAEE,mBAAmB,CAAC,IAAI,CAACC,IAAI,CAACC,SAAS,CAAC,CAAC,CACzEC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AACd,EAAA;AACF;AAEAC,oBAAoB,CAACC,oBAAoB,CAACZ,aAAa,CAAC,EAAED,aAAa,CAAC;;"}
1
+ {"version":3,"file":"attach-tooltip.js","sources":["../../src/components/attach-tooltip.gts"],"sourcesContent":["import { getComponentTemplate, setComponentTemplate } from '@ember/component';\nimport {\n resolveTooltipClass,\n type AttacherArgs,\n type AttacherNamedBlocks,\n} from '../lib/attacher-core';\nimport AttacherOverlay, { type AttacherOverlaySignature } from '../lib/attacher-overlay';\n\nexport type AttachTooltipArgs = AttacherArgs;\n\nexport interface AttachTooltipSignature extends AttacherOverlaySignature {\n Element: HTMLDivElement;\n Args: AttachTooltipArgs;\n Blocks: AttacherNamedBlocks;\n}\n\nexport default class AttachTooltip extends AttacherOverlay {\n override get _defaultConfigKey(): 'tooltip' {\n return 'tooltip';\n }\n\n override get _defaultAriaRole(): string {\n return 'tooltip';\n }\n\n override get _defaultClass(): string {\n return resolveTooltipClass(this.core.envConfig);\n }\n}\n\nconst template = getComponentTemplate(AttacherOverlay);\nif (template) {\n setComponentTemplate(template, AttachTooltip);\n}\n"],"names":["AttachTooltip","AttacherOverlay","_defaultConfigKey","_defaultAriaRole","_defaultClass","resolveTooltipClass","core","envConfig","template","getComponentTemplate","setComponentTemplate"],"mappings":";;;;AAgBe,MAAMA,aAAA,SAAsBC,eAAA,CAAA;EACzC,IAAaC,oBAA+B;AAC1C,IAAA,OAAO,SAAA;AACT,EAAA;EAEA,IAAaC,gBAAAA,GAA2B;AACtC,IAAA,OAAO,SAAA;AACT,EAAA;EAEA,IAAaC,aAAAA,GAAwB;AACnC,IAAA,OAAOC,mBAAA,CAAoB,IAAI,CAACC,IAAI,CAACC,SAAS,CAAA;AAChD,EAAA;AACF;AAEA,MAAMC,WAAWC,oBAAA,CAAqBR,eAAA,CAAA;AACtC,IAAIO,QAAA,EAAU;AACZE,EAAAA,oBAAA,CAAqBF,QAAA,EAAUR,aAAA,CAAA;AACjC;;"}
@@ -1,17 +1,17 @@
1
- import type Component from '@glimmer/component';
2
- import type { AttachPopoverArgs, AttacherBlockParams } from './basic-attacher';
3
-
4
- export type AttacherArgs = AttachPopoverArgs;
1
+ import Component from '@glimmer/component';
2
+ import type Owner from '@ember/owner';
3
+ import AttacherCore, { type AttacherArgs, type AttacherBlockParams } from '../lib/attacher-core';
4
+ export type { AttacherArgs };
5
5
  export type AttacherYieldedApi<TData = unknown> = AttacherBlockParams<TData>;
6
-
7
6
  export interface AttacherSignature {
8
- Element: null;
9
- Args: AttacherArgs;
10
- Blocks: {
11
- default: [attacher: AttacherBlockParams];
12
- };
7
+ Element: null;
8
+ Args: AttacherArgs;
9
+ Blocks: {
10
+ default: [attacher: AttacherBlockParams];
11
+ };
13
12
  }
14
-
15
13
  export default class Attacher extends Component<AttacherSignature> {
16
- get id(): string;
14
+ readonly core: AttacherCore;
15
+ constructor(owner: Owner, args: AttacherArgs);
16
+ get id(): string;
17
17
  }
@@ -1,25 +1,14 @@
1
1
  import Component from '@glimmer/component';
2
- import { helper } from '@ember/component/helper';
3
- import { A as AttacherCore } from '../attacher-core-m7x5g04q.js';
2
+ import { A as AttacherCore } from '../attacher-core-DIAMEQR6.js';
4
3
  import { precompileTemplate } from '@ember/template-compilation';
5
4
  import { setComponentTemplate } from '@ember/component';
6
5
 
7
- var TEMPLATE = precompileTemplate("{{~this.syncAttacherArgs\n this.core\n @target\n @explicitTarget\n @isShown\n @placement\n @strategy\n @showOn\n @hideOn\n @arrow\n @autoUpdate\n @id\n @ariaRole\n @middleware\n @overflowPadding\n @useCapture\n @renderInPlace\n @floatingElementContainer\n @floatingUiOptions\n~}}{{yield this.core.api}}");
8
-
9
- const syncAttacherArgs = helper(positional => {
10
- for (let i = 0; i < positional.length; i++) {
11
- void positional[i];
12
- }
13
- const [core] = positional;
14
- core?.scheduleArgsSync();
15
- return '';
16
- });
6
+ var _Attacher;
17
7
  class Attacher extends Component {
18
8
  constructor(owner, args) {
19
9
  super(owner, args);
20
- this.syncAttacherArgs = syncAttacherArgs;
10
+ this.core = void 0;
21
11
  this.core = new AttacherCore(this, () => this.args, {
22
- allowParentFallback: false,
23
12
  isComponentHost: false
24
13
  });
25
14
  }
@@ -27,7 +16,10 @@ class Attacher extends Component {
27
16
  return this.core.id;
28
17
  }
29
18
  }
30
- setComponentTemplate(TEMPLATE, Attacher);
19
+ _Attacher = Attacher;
20
+ setComponentTemplate(precompileTemplate("{{~this.core.syncArgs @target @isShown @placement @strategy @showOn @hideOn @showDelay @hideDelay @showDuration @hideDuration @animation @interactive @arrow @autoUpdate @lazyRender @renderInPlace @id @ariaRole @class @middleware @useCapture @onChange~}}{{yield this.core.api}}", {
21
+ strictMode: true
22
+ }), _Attacher);
31
23
 
32
24
  export { Attacher as default };
33
25
  //# sourceMappingURL=attacher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attacher.js","sources":["../../src/components/attacher.js"],"sourcesContent":["import Component from '@glimmer/component';\nimport { helper } from '@ember/component/helper';\nimport AttacherCore from '../lib/attacher-core.js';\n\nconst syncAttacherArgs = helper((positional) => {\n for (let i = 0; i < positional.length; i++) {\n void positional[i];\n }\n const [core] = positional;\n core?.scheduleArgsSync();\n return '';\n});\n\nexport default class Attacher extends Component {\n syncAttacherArgs = syncAttacherArgs;\n\n constructor(owner, args) {\n super(owner, args);\n this.core = new AttacherCore(this, () => this.args, {\n allowParentFallback: false,\n isComponentHost: false,\n });\n }\n\n get id() {\n return this.core.id;\n }\n}\n"],"names":["syncAttacherArgs","helper","positional","i","length","core","scheduleArgsSync","Attacher","Component","constructor","owner","args","AttacherCore","allowParentFallback","isComponentHost","id","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AAIA,MAAMA,gBAAgB,GAAGC,MAAM,CAAEC,UAAU,IAAK;AAC9C,EAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,UAAU,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;IAC1C,KAAKD,UAAU,CAACC,CAAC,CAAC;AACpB,EAAA;AACA,EAAA,MAAM,CAACE,IAAI,CAAC,GAAGH,UAAU;EACzBG,IAAI,EAAEC,gBAAgB,EAAE;AACxB,EAAA,OAAO,EAAE;AACX,CAAC,CAAC;AAEa,MAAMC,QAAQ,SAASC,SAAS,CAAC;AAG9CC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,IAAI,EAAE;AACvB,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC;IAAC,IAAA,CAHrBX,gBAAgB,GAAGA,gBAAgB;AAIjC,IAAA,IAAI,CAACK,IAAI,GAAG,IAAIO,YAAY,CAAC,IAAI,EAAE,MAAM,IAAI,CAACD,IAAI,EAAE;AAClDE,MAAAA,mBAAmB,EAAE,KAAK;AAC1BC,MAAAA,eAAe,EAAE;AACnB,KAAC,CAAC;AACJ,EAAA;EAEA,IAAIC,EAAEA,GAAG;AACP,IAAA,OAAO,IAAI,CAACV,IAAI,CAACU,EAAE;AACrB,EAAA;AACF;AAACC,oBAAA,CAAAC,QAAA,EAdoBV,QAAQ,CAAA;;"}
1
+ {"version":3,"file":"attacher.js","sources":["../../src/components/attacher.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport type Owner from '@ember/owner';\nimport AttacherCore, {\n type AttacherArgs,\n type AttacherBlockParams,\n} from '../lib/attacher-core';\n\nexport type { AttacherArgs };\nexport type AttacherYieldedApi<TData = unknown> = AttacherBlockParams<TData>;\n\nexport interface AttacherSignature {\n Element: null;\n Args: AttacherArgs;\n Blocks: {\n default: [attacher: AttacherBlockParams];\n };\n}\n\nexport default class Attacher extends Component<AttacherSignature> {\n readonly core: AttacherCore;\n\n constructor(owner: Owner, args: AttacherArgs) {\n super(owner, args);\n this.core = new AttacherCore(this, () => this.args, {\n isComponentHost: false,\n });\n }\n\n get id(): string {\n return this.core.id;\n }\n\n <template>{{~this.core.syncArgs\n @target\n @isShown\n @placement\n @strategy\n @showOn\n @hideOn\n @showDelay\n @hideDelay\n @showDuration\n @hideDuration\n @animation\n @interactive\n @arrow\n @autoUpdate\n @lazyRender\n @renderInPlace\n @id\n @ariaRole\n @class\n @middleware\n @useCapture\n @onChange\n ~}}{{yield this.core.api}}</template>\n}\n"],"names":["Attacher","Component","constructor","owner","args","core","AttacherCore","isComponentHost","id","_Attacher","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;AAkBe,MAAMA,iBAAiBC,SAAA,CAAU;AAG9CC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAkB,EAAE;AAC5C,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AAAA,IAAA,IAAA,CAHNC;AAIP,IAAA,IAAI,CAACA,IAAI,GAAG,IAAIC,YAAA,CAAa,IAAI,EAAE,MAAM,IAAI,CAACF,IAAI,EAAE;AAClDG,MAAAA,eAAA,EAAiB;AACnB,KAAA,CAAA;AACF,EAAA;EAEA,IAAIC,EAAAA,GAAa;AACf,IAAA,OAAO,IAAI,CAACH,IAAI,CAACG,EAAE;AACrB,EAAA;AA0BF;AAAAC,SAAA,GAtCqBT;AAcnBU,oBAAA,CAAAC,kBAAA,CAAA,sRAAA,EAuB0B;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAH,SAAA,CAAA;;"}
@@ -1,32 +1,31 @@
1
- import type { Placement, Strategy } from '@floating-ui/dom';
2
- import type { AttacherAnimation } from './components/basic-attacher';
3
-
1
+ import type { ComputePositionConfig, Placement, Strategy } from '@floating-ui/dom';
2
+ export type AttacherAnimation = 'fade' | 'fill' | 'none' | 'perspective' | 'scale' | 'shift' | (string & {});
3
+ export interface EmberAttacherPopoverDefaults {
4
+ showOn: string | null;
5
+ hideOn: string | null;
6
+ interactive: boolean;
7
+ lazyRender: boolean;
8
+ }
4
9
  export interface EmberAttacherDefaults {
5
- animation: AttacherAnimation;
6
- arrow: boolean;
7
- autoUpdate: boolean;
8
- flip: string | null;
9
- hideDelay: number;
10
- hideDuration: number;
11
- hideOn: string | null;
12
- interactive: boolean;
13
- isOffset: boolean;
14
- isShown: boolean;
15
- lazyRender: boolean;
16
- middleware: null;
17
- placement: Placement;
18
- strategy: Strategy;
19
- floatingElementContainer: string;
20
- floatingUiOptions: null;
21
- renderInPlace: boolean;
22
- showDelay: number;
23
- showDuration: number;
24
- showOn: string | null;
25
- style: null;
26
- tooltipClass: string;
27
- useCapture: boolean;
28
- overflowPadding: number | false;
10
+ animation: AttacherAnimation;
11
+ arrow: boolean;
12
+ autoUpdate: boolean;
13
+ hideDelay: number;
14
+ hideDuration: number;
15
+ hideOn: string | null;
16
+ interactive: boolean;
17
+ isShown: boolean;
18
+ lazyRender: boolean;
19
+ middleware: ComputePositionConfig['middleware'] | null;
20
+ placement: Placement;
21
+ strategy: Strategy;
22
+ renderInPlace: boolean;
23
+ showDelay: number;
24
+ showDuration: number;
25
+ showOn: string | null;
26
+ tooltipClass: string;
27
+ useCapture: boolean;
29
28
  }
30
-
29
+ export declare const POPOVER_DEFAULTS: Readonly<EmberAttacherPopoverDefaults>;
31
30
  declare const DEFAULTS: EmberAttacherDefaults;
32
31
  export default DEFAULTS;
package/dist/defaults.js CHANGED
@@ -1,29 +1,29 @@
1
- var DEFAULTS = {
1
+ const POPOVER_DEFAULTS = Object.freeze({
2
+ showOn: 'click',
3
+ hideOn: 'click clickout escapekey',
4
+ interactive: true,
5
+ lazyRender: true
6
+ });
7
+ const DEFAULTS = {
2
8
  animation: 'fill',
3
9
  arrow: false,
4
- autoUpdate: false,
5
- flip: null,
10
+ autoUpdate: true,
6
11
  hideDelay: 0,
7
12
  hideDuration: 300,
8
13
  hideOn: 'mouseleave blur escapekey',
9
- interactive: false,
10
- isOffset: false,
14
+ interactive: true,
11
15
  isShown: false,
12
16
  lazyRender: false,
13
17
  middleware: null,
14
18
  placement: 'top',
15
19
  strategy: 'absolute',
16
- floatingElementContainer: '.ember-application',
17
- floatingUiOptions: null,
18
20
  renderInPlace: false,
19
21
  showDelay: 0,
20
22
  showDuration: 300,
21
23
  showOn: 'mouseenter focus',
22
- style: null,
23
24
  tooltipClass: 'ember-attacher-floating ember-attacher-tooltip',
24
- useCapture: false,
25
- overflowPadding: 5
25
+ useCapture: false
26
26
  };
27
27
 
28
- export { DEFAULTS as default };
28
+ export { POPOVER_DEFAULTS, DEFAULTS as default };
29
29
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sources":["../src/defaults.js"],"sourcesContent":["export default {\n animation: 'fill',\n arrow: false,\n autoUpdate: false,\n flip: null,\n hideDelay: 0,\n hideDuration: 300,\n hideOn: 'mouseleave blur escapekey',\n interactive: false,\n isOffset: false,\n isShown: false,\n lazyRender: false,\n middleware: null,\n placement: 'top',\n strategy: 'absolute',\n floatingElementContainer: '.ember-application',\n floatingUiOptions: null,\n renderInPlace: false,\n showDelay: 0,\n showDuration: 300,\n showOn: 'mouseenter focus',\n style: null,\n tooltipClass: 'ember-attacher-floating ember-attacher-tooltip',\n useCapture: false,\n overflowPadding: 5\n};\n"],"names":["animation","arrow","autoUpdate","flip","hideDelay","hideDuration","hideOn","interactive","isOffset","isShown","lazyRender","middleware","placement","strategy","floatingElementContainer","floatingUiOptions","renderInPlace","showDelay","showDuration","showOn","style","tooltipClass","useCapture","overflowPadding"],"mappings":"AAAA,eAAe;AACbA,EAAAA,SAAS,EAAE,MAAM;AACjBC,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,UAAU,EAAE,KAAK;AACjBC,EAAAA,IAAI,EAAE,IAAI;AACVC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,YAAY,EAAE,GAAG;AACjBC,EAAAA,MAAM,EAAE,2BAA2B;AACnCC,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,QAAQ,EAAE,KAAK;AACfC,EAAAA,OAAO,EAAE,KAAK;AACdC,EAAAA,UAAU,EAAE,KAAK;AACjBC,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,SAAS,EAAE,KAAK;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,wBAAwB,EAAE,oBAAoB;AAC9CC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,aAAa,EAAE,KAAK;AACpBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,YAAY,EAAE,GAAG;AACjBC,EAAAA,MAAM,EAAE,kBAAkB;AAC1BC,EAAAA,KAAK,EAAE,IAAI;AACXC,EAAAA,YAAY,EAAE,gDAAgD;AAC9DC,EAAAA,UAAU,EAAE,KAAK;AACjBC,EAAAA,eAAe,EAAE;AACnB,CAAC;;"}
1
+ {"version":3,"file":"defaults.js","sources":["../src/defaults.ts"],"sourcesContent":["import type { ComputePositionConfig, Placement, Strategy } from '@floating-ui/dom';\n\nexport type AttacherAnimation =\n | 'fade'\n | 'fill'\n | 'none'\n | 'perspective'\n | 'scale'\n | 'shift'\n | (string & {});\n\nexport interface EmberAttacherPopoverDefaults {\n showOn: string | null;\n hideOn: string | null;\n interactive: boolean;\n lazyRender: boolean;\n}\n\nexport interface EmberAttacherDefaults {\n animation: AttacherAnimation;\n arrow: boolean;\n autoUpdate: boolean;\n hideDelay: number;\n hideDuration: number;\n hideOn: string | null;\n interactive: boolean;\n isShown: boolean;\n lazyRender: boolean;\n middleware: ComputePositionConfig['middleware'] | null;\n placement: Placement;\n strategy: Strategy;\n renderInPlace: boolean;\n showDelay: number;\n showDuration: number;\n showOn: string | null;\n tooltipClass: string;\n useCapture: boolean;\n}\n\nexport const POPOVER_DEFAULTS: Readonly<EmberAttacherPopoverDefaults> = Object.freeze({\n showOn: 'click',\n hideOn: 'click clickout escapekey',\n interactive: true,\n lazyRender: true,\n});\n\nconst DEFAULTS: EmberAttacherDefaults = {\n animation: 'fill',\n arrow: false,\n autoUpdate: true,\n hideDelay: 0,\n hideDuration: 300,\n hideOn: 'mouseleave blur escapekey',\n interactive: true,\n isShown: false,\n lazyRender: false,\n middleware: null,\n placement: 'top',\n strategy: 'absolute',\n renderInPlace: false,\n showDelay: 0,\n showDuration: 300,\n showOn: 'mouseenter focus',\n tooltipClass: 'ember-attacher-floating ember-attacher-tooltip',\n useCapture: false,\n};\n\nexport default DEFAULTS;\n"],"names":["POPOVER_DEFAULTS","Object","freeze","showOn","hideOn","interactive","lazyRender","DEFAULTS","animation","arrow","autoUpdate","hideDelay","hideDuration","isShown","middleware","placement","strategy","renderInPlace","showDelay","showDuration","tooltipClass","useCapture"],"mappings":"MAuCaA,gBAAwD,GAAGC,MAAM,CAACC,MAAM,CAAC;AACpFC,EAAAA,MAAM,EAAE,OAAO;AACfC,EAAAA,MAAM,EAAE,0BAA0B;AAClCC,EAAAA,WAAW,EAAE,IAAI;AACjBC,EAAAA,UAAU,EAAE;AACd,CAAC;AAED,MAAMC,QAA+B,GAAG;AACtCC,EAAAA,SAAS,EAAE,MAAM;AACjBC,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,YAAY,EAAE,GAAG;AACjBR,EAAAA,MAAM,EAAE,2BAA2B;AACnCC,EAAAA,WAAW,EAAE,IAAI;AACjBQ,EAAAA,OAAO,EAAE,KAAK;AACdP,EAAAA,UAAU,EAAE,KAAK;AACjBQ,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,SAAS,EAAE,KAAK;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,aAAa,EAAE,KAAK;AACpBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,YAAY,EAAE,GAAG;AACjBhB,EAAAA,MAAM,EAAE,kBAAkB;AAC1BiB,EAAAA,YAAY,EAAE,gDAAgD;AAC9DC,EAAAA,UAAU,EAAE;AACd;;"}
package/dist/index.d.ts CHANGED
@@ -1,72 +1,21 @@
1
+ import { type ArrowOptions as FloatingArrowOptions, type Middleware } from '@floating-ui/dom';
1
2
  export { default as AttachPopover } from './components/attach-popover';
2
3
  export type { AttachPopoverArgs, AttachPopoverSignature } from './components/attach-popover';
3
4
  export { default as AttachTooltip } from './components/attach-tooltip';
4
5
  export type { AttachTooltipArgs, AttachTooltipSignature } from './components/attach-tooltip';
5
6
  export { default as Attacher } from './components/attacher';
6
- export type {
7
- AttacherArgs,
8
- AttacherSignature,
9
- AttacherYieldedApi,
10
- } from './components/attacher';
11
- export { default as BasicAttacher } from './components/basic-attacher';
12
- export type {
13
- AttacherAnimation,
14
- AttacherBlockParams,
15
- AttacherNamedBlocks,
16
- AttacherTarget,
17
- AttacherTargetModifier,
18
- BasicAttacherArgs,
19
- BasicAttacherSignature,
20
- } from './components/basic-attacher';
7
+ export type { AttacherArgs, AttacherSignature, AttacherYieldedApi, } from './components/attacher';
8
+ export type { AttacherAnimation, AttacherBlockParams, AttacherNamedBlocks, AttacherTarget, AttacherTargetModifier, } from './lib/attacher-core';
21
9
  export { default as tooltip } from './modifiers/tooltip';
22
- export type {
23
- TooltipModifierOptions,
24
- TooltipModifierSignature,
25
- } from './modifiers/tooltip';
26
- export type { AttachmentSelector } from './test-support/is-visible';
27
- export { isVisible } from './test-support/is-visible';
28
- export type {
29
- ArrowOptions,
30
- AutoPlacementOptions,
31
- AutoUpdateOptions,
32
- ClientRectObject,
33
- ComputePositionConfig,
34
- FlipOptions,
35
- HideOptions,
36
- InlineOptions,
37
- LimitShiftOptions,
38
- Middleware,
39
- MiddlewareData,
40
- OffsetOptions,
41
- Placement,
42
- ShiftOptions,
43
- SizeOptions,
44
- Strategy,
45
- VirtualElement,
46
- } from '@floating-ui/dom';
47
- export {
48
- autoPlacement,
49
- flip,
50
- hide,
51
- inline,
52
- limitShift,
53
- offset,
54
- shift,
55
- size,
56
- } from '@floating-ui/dom';
57
-
58
- import type { ArrowOptions as FloatingArrowOptions, Middleware } from '@floating-ui/dom';
59
-
10
+ export type { TooltipModifierOptions, TooltipModifierSignature } from './modifiers/tooltip';
11
+ export { isVisible, type AttachmentSelector } from './test-support/is-visible';
12
+ export type { ArrowOptions, AutoPlacementOptions, AutoUpdateOptions, ClientRectObject, ComputePositionConfig, FlipOptions, HideOptions, InlineOptions, LimitShiftOptions, Middleware, MiddlewareData, OffsetOptions, Placement, ShiftOptions, SizeOptions, Strategy, VirtualElement, } from '@floating-ui/dom';
13
+ export { autoPlacement, flip, hide, inline, limitShift, offset, shift, size, } from '@floating-ui/dom';
60
14
  export type AttacherArrowOptions = Omit<FloatingArrowOptions, 'element'> & {
61
- element?: Element;
15
+ element?: Element;
62
16
  };
63
-
64
17
  /**
65
18
  * Floating UI `arrow` middleware re-exported with optional `element` (automatically
66
19
  * merged with the rendered `.ember-attacher-arrow` element when omitted).
67
20
  */
68
- export declare function arrow(
69
- options?:
70
- | AttacherArrowOptions
71
- | ((state: Parameters<Middleware['fn']>[0]) => AttacherArrowOptions)
72
- ): Middleware;
21
+ export declare function arrow(options?: AttacherArrowOptions | ((state: Parameters<Middleware['fn']>[0]) => AttacherArrowOptions)): Middleware;
package/dist/index.js CHANGED
@@ -1,8 +1,18 @@
1
+ import { arrow as arrow$1 } from '@floating-ui/dom';
2
+ export { autoPlacement, flip, hide, inline, limitShift, offset, shift, size } from '@floating-ui/dom';
1
3
  export { default as AttachPopover } from './components/attach-popover.js';
2
4
  export { default as AttachTooltip } from './components/attach-tooltip.js';
3
5
  export { default as Attacher } from './components/attacher.js';
4
- export { default as BasicAttacher } from './components/basic-attacher.js';
5
6
  export { default as tooltip } from './modifiers/tooltip.js';
6
- export { i as isVisible } from './is-visible-DQGdmVDv.js';
7
- export { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size } from '@floating-ui/dom';
7
+ export { i as isVisible } from './is-visible-CeN9qZyc.js';
8
+
9
+ /**
10
+ * Floating UI `arrow` middleware re-exported with optional `element` (automatically
11
+ * merged with the rendered `.ember-attacher-arrow` element when omitted).
12
+ */
13
+ function arrow(options) {
14
+ return arrow$1(options);
15
+ }
16
+
17
+ export { arrow };
8
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {\n arrow as floatingArrow,\n type ArrowOptions as FloatingArrowOptions,\n type Middleware,\n} from '@floating-ui/dom';\n\nexport { default as AttachPopover } from './components/attach-popover';\nexport type { AttachPopoverArgs, AttachPopoverSignature } from './components/attach-popover';\nexport { default as AttachTooltip } from './components/attach-tooltip';\nexport type { AttachTooltipArgs, AttachTooltipSignature } from './components/attach-tooltip';\nexport { default as Attacher } from './components/attacher';\nexport type {\n AttacherArgs,\n AttacherSignature,\n AttacherYieldedApi,\n} from './components/attacher';\nexport type {\n AttacherAnimation,\n AttacherBlockParams,\n AttacherNamedBlocks,\n AttacherTarget,\n AttacherTargetModifier,\n} from './lib/attacher-core';\nexport { default as tooltip } from './modifiers/tooltip';\nexport type { TooltipModifierOptions, TooltipModifierSignature } from './modifiers/tooltip';\nexport { isVisible, type AttachmentSelector } from './test-support/is-visible';\nexport type {\n ArrowOptions,\n AutoPlacementOptions,\n AutoUpdateOptions,\n ClientRectObject,\n ComputePositionConfig,\n FlipOptions,\n HideOptions,\n InlineOptions,\n LimitShiftOptions,\n Middleware,\n MiddlewareData,\n OffsetOptions,\n Placement,\n ShiftOptions,\n SizeOptions,\n Strategy,\n VirtualElement,\n} from '@floating-ui/dom';\nexport {\n autoPlacement,\n flip,\n hide,\n inline,\n limitShift,\n offset,\n shift,\n size,\n} from '@floating-ui/dom';\n\nexport type AttacherArrowOptions = Omit<FloatingArrowOptions, 'element'> & {\n element?: Element;\n};\n\n/**\n * Floating UI `arrow` middleware re-exported with optional `element` (automatically\n * merged with the rendered `.ember-attacher-arrow` element when omitted).\n */\nexport function arrow(\n options?:\n | AttacherArrowOptions\n | ((state: Parameters<Middleware['fn']>[0]) => AttacherArrowOptions)\n): Middleware {\n return floatingArrow(\n options as FloatingArrowOptions | ((state: Parameters<Middleware['fn']>[0]) => FloatingArrowOptions)\n );\n}\n"],"names":["arrow","options","floatingArrow"],"mappings":";;;;;;;;AA4DA;AACA;AACA;AACA;AACO,SAASA,KAAKA,CACnBC,OAEsE,EAC1D;EACZ,OAAOC,OAAa,CAClBD,OACF,CAAC;AACH;;"}
@@ -3,6 +3,9 @@ function isVisible(selector, contextEl) {
3
3
  if (!attachment) {
4
4
  return false;
5
5
  }
6
+ if (!(attachment instanceof Element)) {
7
+ return false;
8
+ }
6
9
  const style = getComputedStyle(attachment);
7
10
  if (style.display === 'none' || style.visibility === 'hidden') {
8
11
  return false;
@@ -22,7 +25,7 @@ function isVisible(selector, contextEl) {
22
25
  return true;
23
26
  }
24
27
  function getAttachment(selectorOrElement = '', contextEl) {
25
- if (selectorOrElement instanceof Window || selectorOrElement instanceof Document || selectorOrElement instanceof HTMLElement || selectorOrElement instanceof SVGElement) {
28
+ if (selectorOrElement instanceof Window || selectorOrElement instanceof Document || selectorOrElement instanceof Element) {
26
29
  return selectorOrElement;
27
30
  }
28
31
  let result;
@@ -32,11 +35,11 @@ function getAttachment(selectorOrElement = '', contextEl) {
32
35
  result = document.querySelector(`${selectorOrElement}`);
33
36
  }
34
37
  if (!result) {
35
- const msg = typeof selectorOrElement === 'string' ? selectorOrElement : selectorOrElement.innerHTML;
38
+ const msg = typeof selectorOrElement === 'string' ? selectorOrElement : '';
36
39
  throw `Could not locate attachment from selector: ${msg}`;
37
40
  }
38
41
  return result;
39
42
  }
40
43
 
41
44
  export { isVisible as i };
42
- //# sourceMappingURL=is-visible-DQGdmVDv.js.map
45
+ //# sourceMappingURL=is-visible-CeN9qZyc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-visible-CeN9qZyc.js","sources":["../src/test-support/is-visible.ts"],"sourcesContent":["export type AttachmentSelector = string | Element | Window | Document | null | undefined;\n\nexport function isVisible(selector: AttachmentSelector, contextEl?: Element | null): boolean {\n const attachment =\n typeof selector === 'string' ? getAttachment(selector, contextEl) : selector;\n\n if (!attachment) {\n return false;\n }\n\n if (!(attachment instanceof Element)) {\n return false;\n }\n\n const style = getComputedStyle(attachment);\n\n if (style.display === 'none' || style.visibility === 'hidden') {\n return false;\n }\n\n if (attachment.getAttribute('aria-hidden') === 'true') {\n return false;\n }\n\n if (\n attachment.hasAttribute('popover') &&\n typeof attachment.matches === 'function' &&\n typeof HTMLElement !== 'undefined' &&\n typeof HTMLElement.prototype.showPopover === 'function'\n ) {\n try {\n if (!attachment.matches(':popover-open')) {\n return false;\n }\n } catch {\n // Ignore if :popover-open selector is unsupported\n }\n }\n\n return true;\n}\n\nfunction getAttachment(\n selectorOrElement: string | Element | Window | Document = '',\n contextEl?: Element | null\n): Element | Window | Document {\n if (\n selectorOrElement instanceof Window ||\n selectorOrElement instanceof Document ||\n selectorOrElement instanceof Element\n ) {\n return selectorOrElement;\n }\n\n let result: Element | null;\n\n if (contextEl instanceof HTMLElement) {\n result = contextEl.querySelector(selectorOrElement);\n } else {\n result = document.querySelector(`${selectorOrElement}`);\n }\n\n if (!result) {\n const msg = typeof selectorOrElement === 'string' ? selectorOrElement : '';\n\n throw `Could not locate attachment from selector: ${msg}`;\n }\n\n return result;\n}\n"],"names":["isVisible","selector","contextEl","attachment","getAttachment","Element","style","getComputedStyle","display","visibility","getAttribute","hasAttribute","matches","HTMLElement","prototype","showPopover","selectorOrElement","Window","Document","result","querySelector","document","msg"],"mappings":"AAEO,SAASA,SAASA,CAACC,QAA4B,EAAEC,SAA0B,EAAW;AAC3F,EAAA,MAAMC,UAAU,GACd,OAAOF,QAAQ,KAAK,QAAQ,GAAGG,aAAa,CAACH,QAAQ,EAAEC,SAAS,CAAC,GAAGD,QAAQ;EAE9E,IAAI,CAACE,UAAU,EAAE;AACf,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,IAAI,EAAEA,UAAU,YAAYE,OAAO,CAAC,EAAE;AACpC,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,MAAMC,KAAK,GAAGC,gBAAgB,CAACJ,UAAU,CAAC;EAE1C,IAAIG,KAAK,CAACE,OAAO,KAAK,MAAM,IAAIF,KAAK,CAACG,UAAU,KAAK,QAAQ,EAAE;AAC7D,IAAA,OAAO,KAAK;AACd,EAAA;EAEA,IAAIN,UAAU,CAACO,YAAY,CAAC,aAAa,CAAC,KAAK,MAAM,EAAE;AACrD,IAAA,OAAO,KAAK;AACd,EAAA;EAEA,IACEP,UAAU,CAACQ,YAAY,CAAC,SAAS,CAAC,IAClC,OAAOR,UAAU,CAACS,OAAO,KAAK,UAAU,IACxC,OAAOC,WAAW,KAAK,WAAW,IAClC,OAAOA,WAAW,CAACC,SAAS,CAACC,WAAW,KAAK,UAAU,EACvD;IACA,IAAI;AACF,MAAA,IAAI,CAACZ,UAAU,CAACS,OAAO,CAAC,eAAe,CAAC,EAAE;AACxC,QAAA,OAAO,KAAK;AACd,MAAA;AACF,IAAA,CAAC,CAAC,MAAM;AACN;AAAA,IAAA;AAEJ,EAAA;AAEA,EAAA,OAAO,IAAI;AACb;AAEA,SAASR,aAAaA,CACpBY,iBAAuD,GAAG,EAAE,EAC5Dd,SAA0B,EACG;EAC7B,IACEc,iBAAiB,YAAYC,MAAM,IACnCD,iBAAiB,YAAYE,QAAQ,IACrCF,iBAAiB,YAAYX,OAAO,EACpC;AACA,IAAA,OAAOW,iBAAiB;AAC1B,EAAA;AAEA,EAAA,IAAIG,MAAsB;EAE1B,IAAIjB,SAAS,YAAYW,WAAW,EAAE;AACpCM,IAAAA,MAAM,GAAGjB,SAAS,CAACkB,aAAa,CAACJ,iBAAiB,CAAC;AACrD,EAAA,CAAC,MAAM;IACLG,MAAM,GAAGE,QAAQ,CAACD,aAAa,CAAC,CAAA,EAAGJ,iBAAiB,EAAE,CAAC;AACzD,EAAA;EAEA,IAAI,CAACG,MAAM,EAAE;IACX,MAAMG,GAAG,GAAG,OAAON,iBAAiB,KAAK,QAAQ,GAAGA,iBAAiB,GAAG,EAAE;IAE1E,MAAM,CAAA,2CAAA,EAA8CM,GAAG,CAAA,CAAE;AAC3D,EAAA;AAEA,EAAA,OAAOH,MAAM;AACf;;"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Accessibility and ARIA attribute management for ember-attacher.
3
+ *
4
+ * Implements modern-web-guidance smart tooltip ARIA:
5
+ * - Binds token-safe `aria-labelledby` when a trigger has no accessible name of its own.
6
+ * - Suppresses `aria-describedby` when the tooltip text duplicates the trigger's accessible name.
7
+ * - Otherwise binds token-safe open-only `aria-describedby` for tooltips, and automatic
8
+ * disclosure attributes (`aria-expanded`, `aria-controls`, `aria-haspopup`) for popovers.
9
+ * - Restores focus on Escape when focus lives inside an interactive popover.
10
+ */
11
+ /**
12
+ * Resolve a target Element's accessible name per modern-web-guidance rules
13
+ * (`aria-labelledby` excluding `ignoreId`, `aria-label`, text/alt content, `title`).
14
+ *
15
+ * @param {Element | null} target
16
+ * @param {string | null} [ignoreId]
17
+ * @returns {string}
18
+ */
19
+ export declare function getTargetAccessibleName(target: Element | null | undefined, ignoreId?: string | null): string;
20
+ /**
21
+ * Tracks and restores ARIA attributes owned by a single AttacherCore instance
22
+ * without clobbering pre-existing caller attributes or tokens.
23
+ */
24
+ export declare class AttachmentAriaController {
25
+ _boundTarget: Element | null;
26
+ _isTooltip: boolean;
27
+ _attachmentId: string | null;
28
+ _ariaRole: string | undefined;
29
+ _tooltipMode: 'describedby' | 'labelledby' | 'none';
30
+ _addedDescribedByToken: boolean;
31
+ _addedLabelledByToken: boolean;
32
+ _ownsHasPopup: boolean;
33
+ _ownsControls: boolean;
34
+ _ownsExpanded: boolean;
35
+ /**
36
+ * Bind ARIA metadata to a target Element (no-op when target is null/non-Element).
37
+ *
38
+ * @param {Element | null} target
39
+ * @param {{
40
+ * isTooltip: boolean,
41
+ * id: string,
42
+ * ariaRole?: string,
43
+ * isOpen: boolean,
44
+ * attachmentEl?: Element | null,
45
+ * tooltipText?: string | null,
46
+ * }} options
47
+ */
48
+ bind(target: Element | null | undefined, { isTooltip, id, ariaRole, isOpen, attachmentEl, tooltipText, }: {
49
+ isTooltip: boolean;
50
+ id: string;
51
+ ariaRole?: string;
52
+ isOpen: boolean;
53
+ attachmentEl?: Element | null;
54
+ tooltipText?: string | null;
55
+ }): void;
56
+ /**
57
+ * Update open/closed ARIA state on the bound target.
58
+ *
59
+ * @param {boolean} isOpen
60
+ */
61
+ setOpen(isOpen: boolean): void;
62
+ /**
63
+ * Remove only the attributes and tokens added by this controller.
64
+ */
65
+ unbind(): void;
66
+ _setTokenOnOpen(target: Element, attrName: string, isOpen: boolean): void;
67
+ _ensureAttributeToken(target: Element, attrName: string, token: string | null, alreadyOwned: boolean): boolean;
68
+ _removeAttributeToken(target: Element, attrName: string, token: string | null): void;
69
+ }
70
+ /**
71
+ * Restore focus to the Target if focus currently lives inside the floating attachment
72
+ * when dismissed via Escape.
73
+ *
74
+ * @param {Element | null} target
75
+ * @param {Element | null} floatingElement
76
+ */
77
+ export declare function restoreFocusOnEscape(target: Element | null | undefined, floatingElement: Element | null | undefined): void;