ember-attacher 5.0.0 → 5.1.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.
@@ -1,5 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
- import { A as AttacherCore } from './attacher-core-CtbFbuD_.js';
2
+ import { A as AttacherCore } from './attacher-core-BuH7FXay.js';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
@@ -32,9 +32,9 @@ var _AttacherOverlay;
32
32
  }
33
33
  }
34
34
  _AttacherOverlay = AttacherOverlay;
35
- setComponentTemplate(precompileTemplate("{{~#if (has-block \"target\")~}}{{yield this.core.api.target this.core.api to=\"target\"}}{{~/if~}}{{~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~}}<div class=\"ember-attacher\" id={{this.core.id}} popover={{this.core.popoverAttr}} role={{this.core.ariaRole}} {{this.core.setupFloatingElement (has-block \"target\")}} ...attributes>{{~#if this.core.shouldRenderFloatingElement~}}<div class={{this.core.innerClass}}>{{~#if (has-block \"content\")~}}{{yield this.core.api to=\"content\"}}{{else if (has-block)}}{{yield this.core.api}}{{~/if~}}{{~#if this.core.arrow~}}<div class=\"ember-attacher-arrow\" {{this.core.insertArrow}}></div>{{~/if~}}{{~#if this.core.isFillAnimation~}}<div class=\"ember-attacher-fill-backdrop\" aria-hidden=\"true\"><div class=\"ember-attacher-fill-circle\"></div></div>{{~/if~}}</div>{{~/if~}}</div>", {
35
+ setComponentTemplate(precompileTemplate("{{~#if (has-block \"target\")~}}{{yield this.core.api.target this.core.api to=\"target\"}}{{~/if~}}{{~this.core.syncArgs @target @isShown @placement @strategy @showOn @hideOn @showDelay @hideDelay @showDuration @hideDuration @animation @interactive @arrow @autoUpdate @lazyRender @middleware @offset @onChange @placement @renderInPlace @id @ariaRole @class @useCapture~}}<div class=\"ember-attacher\" id={{this.core.id}} popover={{this.core.popoverAttr}} role={{this.core.ariaRole}} data-offset={{if this.core.hasOffset \"\"}} {{this.core.setupFloatingElement (has-block \"target\")}} ...attributes>{{~#if this.core.shouldRenderFloatingElement~}}<div class={{this.core.innerClass}}>{{~#if (has-block \"content\")~}}{{yield this.core.api to=\"content\"}}{{else if (has-block)}}{{yield this.core.api}}{{~/if~}}{{~#if this.core.arrow~}}<div class=\"ember-attacher-arrow\" {{this.core.insertArrow}}></div>{{~/if~}}{{~#if this.core.isFillAnimation~}}<div class=\"ember-attacher-fill-backdrop\" aria-hidden=\"true\"><div class=\"ember-attacher-fill-circle\"></div></div>{{~/if~}}</div>{{~/if~}}</div>", {
36
36
  strictMode: true
37
37
  }), _AttacherOverlay);
38
38
 
39
39
  export { AttacherOverlay as A };
40
- //# sourceMappingURL=attacher-overlay-BoI7s8AI.js.map
40
+ //# sourceMappingURL=attacher-overlay-D0IJ82qu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attacher-overlay-D0IJ82qu.js","sources":["../src/lib/attacher-overlay.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport type Owner from '@ember/owner';\nimport AttacherCore, {\n type AttacherArgs,\n type AttacherNamedBlocks,\n} from './attacher-core';\n\nexport interface AttacherOverlaySignature {\n Element: HTMLDivElement;\n Args: AttacherArgs;\n Blocks: AttacherNamedBlocks;\n}\n\n/** Internal shared Host component class for `<AttachPopover>` and `<AttachTooltip>`. */\nexport default class AttacherOverlay extends Component<AttacherOverlaySignature> {\n readonly core: AttacherCore;\n\n constructor(owner: Owner, args: AttacherArgs) {\n super(owner, args);\n this.core = new AttacherCore(this, () => this.args, {\n defaultConfigKey: this._defaultConfigKey,\n defaultAriaRole: this._defaultAriaRole,\n getDefaultClass: () => this._defaultClass,\n isComponentHost: true,\n });\n }\n\n get _defaultConfigKey(): 'popover' | 'tooltip' | null {\n return null;\n }\n\n get _defaultAriaRole(): string | undefined {\n return undefined;\n }\n\n get _defaultClass(): string {\n return '';\n }\n\n get ariaRole(): string | undefined {\n return this.core.ariaRole;\n }\n\n get id(): string {\n return this.core.id;\n }\n\n <template>{{~#if (has-block \"target\")~}}{{yield this.core.api.target this.core.api to=\"target\"}}{{~/if~}}{{~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 @middleware\n @offset\n @onChange\n @placement\n @renderInPlace\n @id\n @ariaRole\n @class\n @useCapture\n ~}}<div\n class=\"ember-attacher\"\n id={{this.core.id}}\n popover={{this.core.popoverAttr}}\n role={{this.core.ariaRole}}\n data-offset={{if this.core.hasOffset \"\"}}\n {{this.core.setupFloatingElement (has-block \"target\")}}\n ...attributes\n >{{~#if this.core.shouldRenderFloatingElement~}}<div class={{this.core.innerClass}}>{{~#if (has-block \"content\")~}}{{yield this.core.api to=\"content\"}}{{~else if (has-block)~}}{{yield this.core.api}}{{~/if~}}{{~#if this.core.arrow~}}<div class=\"ember-attacher-arrow\" {{this.core.insertArrow}}></div>{{~/if~}}{{~#if this.core.isFillAnimation~}}<div class=\"ember-attacher-fill-backdrop\" aria-hidden=\"true\"><div class=\"ember-attacher-fill-circle\"></div></div>{{~/if~}}</div>{{~/if~}}</div></template>\n}\n"],"names":["AttacherOverlay","Component","constructor","owner","args","core","AttacherCore","defaultConfigKey","_defaultConfigKey","defaultAriaRole","_defaultAriaRole","getDefaultClass","_defaultClass","isComponentHost","undefined","ariaRole","id","_AttacherOverlay","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;AAaA,wFACe,MAAMA,eAAA,SAAwBC,SAAA,CAAU;AAGrDC,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;MAClDG,gBAAA,EAAkB,IAAI,CAACC,iBAAiB;MACxCC,eAAA,EAAiB,IAAI,CAACC,gBAAgB;AACtCC,MAAAA,eAAA,EAAiBA,MAAM,IAAI,CAACC,aAAa;AACzCC,MAAAA,eAAA,EAAiB;AACnB,KAAA,CAAA;AACF,EAAA;EAEA,IAAIL,iBAAAA,GAAkD;AACpD,IAAA,OAAO,IAAA;AACT,EAAA;EAEA,IAAIE,gBAAAA,GAAuC;AACzC,IAAA,OAAOI,SAAA;AACT,EAAA;EAEA,IAAIF,aAAAA,GAAwB;AAC1B,IAAA,OAAO,EAAA;AACT,EAAA;EAEA,IAAIG,QAAAA,GAA+B;AACjC,IAAA,OAAO,IAAI,CAACV,IAAI,CAACU,QAAQ;AAC3B,EAAA;EAEA,IAAIC,EAAAA,GAAa;AACf,IAAA,OAAO,IAAI,CAACX,IAAI,CAACW,EAAE;AACrB,EAAA;AAoCF;AAAAC,gBAAA,GAnEqBjB,eAAA;AAiCnBkB,oBAAA,CAAAC,kBAAA,CAAA,wkCAAA,EAiCse;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAH,gBAAA,CAAA;;"}
@@ -1,4 +1,4 @@
1
- import type { AttacherArgs, AttacherNamedBlocks } from '../lib/attacher-core';
1
+ import { type AttacherArgs, type AttacherNamedBlocks } from '../lib/attacher-core';
2
2
  import AttacherOverlay, { type AttacherOverlaySignature } from '../lib/attacher-overlay';
3
3
  export type AttachPopoverArgs = AttacherArgs;
4
4
  export interface AttachPopoverSignature extends AttacherOverlaySignature {
@@ -9,4 +9,5 @@ export interface AttachPopoverSignature extends AttacherOverlaySignature {
9
9
  export default class AttachPopover extends AttacherOverlay {
10
10
  get _defaultConfigKey(): 'popover';
11
11
  get _defaultAriaRole(): string;
12
+ get _defaultClass(): string;
12
13
  }
@@ -1,5 +1,6 @@
1
1
  import { getComponentTemplate, setComponentTemplate } from '@ember/component';
2
- import { A as AttacherOverlay } from '../attacher-overlay-BoI7s8AI.js';
2
+ import { r as resolvePopoverClass } from '../attacher-core-BuH7FXay.js';
3
+ import { A as AttacherOverlay } from '../attacher-overlay-D0IJ82qu.js';
3
4
 
4
5
  class AttachPopover extends AttacherOverlay {
5
6
  get _defaultConfigKey() {
@@ -8,6 +9,9 @@ class AttachPopover extends AttacherOverlay {
8
9
  get _defaultAriaRole() {
9
10
  return 'dialog';
10
11
  }
12
+ get _defaultClass() {
13
+ return resolvePopoverClass(this.core.envConfig);
14
+ }
11
15
  }
12
16
  const template = getComponentTemplate(AttacherOverlay);
13
17
  if (template) {
@@ -1 +1 @@
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
+ {"version":3,"file":"attach-popover.js","sources":["../../src/components/attach-popover.gts"],"sourcesContent":["import { getComponentTemplate, setComponentTemplate } from '@ember/component';\nimport {\n resolvePopoverClass,\n type AttacherArgs,\n type AttacherNamedBlocks,\n} 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 override get _defaultClass(): string {\n return resolvePopoverClass(this.core.envConfig);\n }\n}\n\nconst template = getComponentTemplate(AttacherOverlay);\nif (template) {\n setComponentTemplate(template, AttachPopover);\n}\n"],"names":["AttachPopover","AttacherOverlay","_defaultConfigKey","_defaultAriaRole","_defaultClass","resolvePopoverClass","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,QAAA;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,6 +1,6 @@
1
1
  import { getComponentTemplate, setComponentTemplate } from '@ember/component';
2
- import { r as resolveTooltipClass } from '../attacher-core-CtbFbuD_.js';
3
- import { A as AttacherOverlay } from '../attacher-overlay-BoI7s8AI.js';
2
+ import { a as resolveTooltipClass } from '../attacher-core-BuH7FXay.js';
3
+ import { A as AttacherOverlay } from '../attacher-overlay-D0IJ82qu.js';
4
4
 
5
5
  class AttachTooltip extends AttacherOverlay {
6
6
  get _defaultConfigKey() {
@@ -1,5 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
- import { A as AttacherCore } from '../attacher-core-CtbFbuD_.js';
2
+ import { A as AttacherCore } from '../attacher-core-BuH7FXay.js';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
@@ -17,7 +17,7 @@ class Attacher extends Component {
17
17
  }
18
18
  }
19
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}}", {
20
+ setComponentTemplate(precompileTemplate("{{~this.core.syncArgs @target @isShown @placement @strategy @showOn @hideOn @showDelay @hideDelay @showDuration @hideDuration @animation @interactive @arrow @autoUpdate @lazyRender @middleware @offset @onChange @placement @renderInPlace @id @ariaRole @class @useCapture~}}{{yield this.core.api}}", {
21
21
  strictMode: true
22
22
  }), _Attacher);
23
23
 
@@ -1 +1 @@
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
+ {"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 @middleware\n @offset\n @onChange\n @placement\n @renderInPlace\n @id\n @ariaRole\n @class\n @useCapture\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;AA4BF;AAAAC,SAAA,GAxCqBT;AAcnBU,oBAAA,CAAAC,kBAAA,CAAA,ySAAA,EAyB0B;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAH,SAAA,CAAA;;"}
@@ -1,4 +1,4 @@
1
- import type { ComputePositionConfig, Placement, Strategy } from '@floating-ui/dom';
1
+ import type { ComputePositionConfig, OffsetOptions, Placement, Strategy } from '@floating-ui/dom';
2
2
  export type AttacherAnimation = 'fade' | 'fill' | 'none' | 'perspective' | 'scale' | 'shift' | (string & {});
3
3
  export interface EmberAttacherPopoverDefaults {
4
4
  showOn: string | null;
@@ -17,7 +17,9 @@ export interface EmberAttacherDefaults {
17
17
  isShown: boolean;
18
18
  lazyRender: boolean;
19
19
  middleware: ComputePositionConfig['middleware'] | null;
20
+ offset: OffsetOptions | null;
20
21
  placement: Placement;
22
+ popoverClass: string;
21
23
  strategy: Strategy;
22
24
  renderInPlace: boolean;
23
25
  showDelay: number;
package/dist/defaults.js CHANGED
@@ -15,7 +15,9 @@ const DEFAULTS = {
15
15
  isShown: false,
16
16
  lazyRender: false,
17
17
  middleware: null,
18
+ offset: null,
18
19
  placement: 'top',
20
+ popoverClass: '',
19
21
  strategy: 'absolute',
20
22
  renderInPlace: false,
21
23
  showDelay: 0,
@@ -1 +1 @@
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;;"}
1
+ {"version":3,"file":"defaults.js","sources":["../src/defaults.ts"],"sourcesContent":["import type { ComputePositionConfig, OffsetOptions, 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 offset: OffsetOptions | null;\n placement: Placement;\n popoverClass: string;\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 offset: null,\n placement: 'top',\n popoverClass: '',\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","offset","placement","popoverClass","strategy","renderInPlace","showDelay","showDuration","tooltipClass","useCapture"],"mappings":"MAyCaA,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,MAAM,EAAE,IAAI;AACZC,EAAAA,SAAS,EAAE,KAAK;AAChBC,EAAAA,YAAY,EAAE,EAAE;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,aAAa,EAAE,KAAK;AACpBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,YAAY,EAAE,GAAG;AACjBlB,EAAAA,MAAM,EAAE,kBAAkB;AAC1BmB,EAAAA,YAAY,EAAE,gDAAgD;AAC9DC,EAAAA,UAAU,EAAE;AACd;;"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { default as AttachPopover } from './components/attach-popover.js';
4
4
  export { default as AttachTooltip } from './components/attach-tooltip.js';
5
5
  export { default as Attacher } from './components/attacher.js';
6
6
  export { default as tooltip } from './modifiers/tooltip.js';
7
- export { i as isVisible } from './is-visible-CeN9qZyc.js';
7
+ export { i as isVisible } from './is-visible-BRGjlnLT.js';
8
8
 
9
9
  /**
10
10
  * Floating UI `arrow` middleware re-exported with optional `element` (automatically
@@ -1,21 +1,14 @@
1
- function isVisible(selector, contextEl) {
2
- const attachment = typeof selector === 'string' ? getAttachment(selector, contextEl) : selector;
3
- if (!attachment) {
4
- return false;
5
- }
6
- if (!(attachment instanceof Element)) {
7
- return false;
8
- }
9
- const style = getComputedStyle(attachment);
1
+ function isElementVisible(element) {
2
+ const style = getComputedStyle(element);
10
3
  if (style.display === 'none' || style.visibility === 'hidden') {
11
4
  return false;
12
5
  }
13
- if (attachment.getAttribute('aria-hidden') === 'true') {
6
+ if (element.getAttribute('aria-hidden') === 'true') {
14
7
  return false;
15
8
  }
16
- if (attachment.hasAttribute('popover') && typeof attachment.matches === 'function' && typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function') {
9
+ if (element.hasAttribute('popover') && typeof element.matches === 'function' && typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function') {
17
10
  try {
18
- if (!attachment.matches(':popover-open')) {
11
+ if (!element.matches(':popover-open')) {
19
12
  return false;
20
13
  }
21
14
  } catch {
@@ -24,6 +17,23 @@ function isVisible(selector, contextEl) {
24
17
  }
25
18
  return true;
26
19
  }
20
+ function isVisible(selector, contextEl) {
21
+ const attachment = typeof selector === 'string' ? getAttachment(selector, contextEl) : selector;
22
+ if (!attachment) {
23
+ return false;
24
+ }
25
+ if (!(attachment instanceof Element)) {
26
+ return false;
27
+ }
28
+
29
+ // Host controls display/aria-hidden/[popover] while @class targets the inner element;
30
+ // check both so closed inner selectors return false while hidden sub-elements (e.g. arrow) stay accurate.
31
+ const host = attachment.closest('.ember-attacher');
32
+ if (host && host !== attachment && !isElementVisible(host)) {
33
+ return false;
34
+ }
35
+ return isElementVisible(attachment);
36
+ }
27
37
  function getAttachment(selectorOrElement = '', contextEl) {
28
38
  if (selectorOrElement instanceof Window || selectorOrElement instanceof Document || selectorOrElement instanceof Element) {
29
39
  return selectorOrElement;
@@ -42,4 +52,4 @@ function getAttachment(selectorOrElement = '', contextEl) {
42
52
  }
43
53
 
44
54
  export { isVisible as i };
45
- //# sourceMappingURL=is-visible-CeN9qZyc.js.map
55
+ //# sourceMappingURL=is-visible-BRGjlnLT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-visible-BRGjlnLT.js","sources":["../src/test-support/is-visible.ts"],"sourcesContent":["export type AttachmentSelector = string | Element | Window | Document | null | undefined;\n\nfunction isElementVisible(element: Element): boolean {\n const style = getComputedStyle(element);\n\n if (style.display === 'none' || style.visibility === 'hidden') {\n return false;\n }\n\n if (element.getAttribute('aria-hidden') === 'true') {\n return false;\n }\n\n if (\n element.hasAttribute('popover') &&\n typeof element.matches === 'function' &&\n typeof HTMLElement !== 'undefined' &&\n typeof HTMLElement.prototype.showPopover === 'function'\n ) {\n try {\n if (!element.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\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 // Host controls display/aria-hidden/[popover] while @class targets the inner element;\n // check both so closed inner selectors return false while hidden sub-elements (e.g. arrow) stay accurate.\n const host = attachment.closest('.ember-attacher');\n if (host && host !== attachment && !isElementVisible(host)) {\n return false;\n }\n\n return isElementVisible(attachment);\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":["isElementVisible","element","style","getComputedStyle","display","visibility","getAttribute","hasAttribute","matches","HTMLElement","prototype","showPopover","isVisible","selector","contextEl","attachment","getAttachment","Element","host","closest","selectorOrElement","Window","Document","result","querySelector","document","msg"],"mappings":"AAEA,SAASA,gBAAgBA,CAACC,OAAgB,EAAW;AACnD,EAAA,MAAMC,KAAK,GAAGC,gBAAgB,CAACF,OAAO,CAAC;EAEvC,IAAIC,KAAK,CAACE,OAAO,KAAK,MAAM,IAAIF,KAAK,CAACG,UAAU,KAAK,QAAQ,EAAE;AAC7D,IAAA,OAAO,KAAK;AACd,EAAA;EAEA,IAAIJ,OAAO,CAACK,YAAY,CAAC,aAAa,CAAC,KAAK,MAAM,EAAE;AAClD,IAAA,OAAO,KAAK;AACd,EAAA;EAEA,IACEL,OAAO,CAACM,YAAY,CAAC,SAAS,CAAC,IAC/B,OAAON,OAAO,CAACO,OAAO,KAAK,UAAU,IACrC,OAAOC,WAAW,KAAK,WAAW,IAClC,OAAOA,WAAW,CAACC,SAAS,CAACC,WAAW,KAAK,UAAU,EACvD;IACA,IAAI;AACF,MAAA,IAAI,CAACV,OAAO,CAACO,OAAO,CAAC,eAAe,CAAC,EAAE;AACrC,QAAA,OAAO,KAAK;AACd,MAAA;AACF,IAAA,CAAC,CAAC,MAAM;AACN;AAAA,IAAA;AAEJ,EAAA;AAEA,EAAA,OAAO,IAAI;AACb;AAEO,SAASI,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;AACA;AACA,EAAA,MAAMC,IAAI,GAAGH,UAAU,CAACI,OAAO,CAAC,iBAAiB,CAAC;EAClD,IAAID,IAAI,IAAIA,IAAI,KAAKH,UAAU,IAAI,CAACf,gBAAgB,CAACkB,IAAI,CAAC,EAAE;AAC1D,IAAA,OAAO,KAAK;AACd,EAAA;EAEA,OAAOlB,gBAAgB,CAACe,UAAU,CAAC;AACrC;AAEA,SAASC,aAAaA,CACpBI,iBAAuD,GAAG,EAAE,EAC5DN,SAA0B,EACG;EAC7B,IACEM,iBAAiB,YAAYC,MAAM,IACnCD,iBAAiB,YAAYE,QAAQ,IACrCF,iBAAiB,YAAYH,OAAO,EACpC;AACA,IAAA,OAAOG,iBAAiB;AAC1B,EAAA;AAEA,EAAA,IAAIG,MAAsB;EAE1B,IAAIT,SAAS,YAAYL,WAAW,EAAE;AACpCc,IAAAA,MAAM,GAAGT,SAAS,CAACU,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;;"}
@@ -1,5 +1,5 @@
1
1
  import type Owner from '@ember/owner';
2
- import { type AutoUpdateOptions, type ComputePositionConfig, type MiddlewareData, type Placement, type Strategy } from '@floating-ui/dom';
2
+ import { type AutoUpdateOptions, type ComputePositionConfig, type MiddlewareData, type OffsetOptions, type Placement, type Strategy } from '@floating-ui/dom';
3
3
  import { type FunctionBasedModifier } from 'ember-modifier';
4
4
  import { type AttacherAnimation } from '../defaults';
5
5
  import { AttachmentAriaController } from './a11y';
@@ -83,6 +83,8 @@ export interface AttacherArgs {
83
83
  lazyRender?: boolean;
84
84
  /** Floating UI middleware pipeline (merged and deduplicated by `m.name`). */
85
85
  middleware?: ComputePositionConfig['middleware'] | null;
86
+ /** Floating UI `offset()` shorthand (number or `OffsetOptions`), prepended unless `@middleware` already includes `offset`. */
87
+ offset?: OffsetOptions | null;
86
88
  /** Callback invoked when attachment visibility toggles. */
87
89
  onChange?: (isVisible: boolean) => unknown;
88
90
  /** Floating UI placement. Defaults to `'top'`. */
@@ -112,6 +114,7 @@ export interface HostRenderState {
112
114
  isFillAnimation?: boolean;
113
115
  isShown?: boolean;
114
116
  isHiding?: boolean;
117
+ hasOffset?: boolean;
115
118
  container?: Element | null;
116
119
  }
117
120
  type ConfigKey = 'tooltip' | 'popover';
@@ -127,7 +130,9 @@ export interface EmberAttacherConfigGroup {
127
130
  isShown?: boolean;
128
131
  lazyRender?: boolean;
129
132
  middleware?: ComputePositionConfig['middleware'] | null;
133
+ offset?: OffsetOptions | null;
130
134
  placement?: Placement;
135
+ popoverClass?: string;
131
136
  renderInPlace?: boolean;
132
137
  showDelay?: number | string;
133
138
  showDuration?: number | string;
@@ -158,6 +163,7 @@ interface RegisteredEntry {
158
163
  updateHandle: ScheduledHandle | null;
159
164
  }
160
165
  export declare function resolveTooltipClass(envConfig: EmberAttacherEnvConfig | null | undefined): string;
166
+ export declare function resolvePopoverClass(envConfig: EmberAttacherEnvConfig | null | undefined): string;
161
167
  /**
162
168
  * Shared reactive controller backing `<AttachTooltip>`, `<AttachPopover>`,
163
169
  * `<Attacher>`, and the `{{tooltip}}` singleton pool.
@@ -221,6 +227,10 @@ export default class AttacherCore {
221
227
  _lastUseCaptureArgumentValue: boolean;
222
228
  _warnedRemovedArgs: Set<string>;
223
229
  _cleanup: (() => void) | null;
230
+ _openingTriggerEvent: Event | null;
231
+ _openingTriggerHandle: ScheduledHandle | null;
232
+ _relativeTargetObserver: MutationObserver | null;
233
+ _observedRelativeParent: Element | null;
224
234
  readonly api: AttacherBlockParams;
225
235
  /** Tracks template args read inside `<template>` and schedules an idle args sync. */
226
236
  syncArgs: (..._positional: unknown[]) => "";
@@ -257,6 +267,7 @@ export default class AttacherCore {
257
267
  options?: any;
258
268
  fn: (state: import("@floating-ui/dom").MiddlewareState) => import("@floating-ui/dom").MiddlewareReturn | Promise<import("@floating-ui/dom").MiddlewareReturn>;
259
269
  }[];
270
+ get hasOffset(): boolean;
260
271
  get _usePopoverHost(): boolean;
261
272
  get _renderInPlace(): boolean;
262
273
  get _delayGroupOwner(): object | null;
@@ -299,6 +310,7 @@ export default class AttacherCore {
299
310
  _attachPopoverEvents(element: Element | null): void;
300
311
  _detachPopoverEvents(element: Element | null): void;
301
312
  _onPopoverBeforeToggle(rawEvent: Event): void;
313
+ _isEventFromAttachment(event: Event | undefined): boolean;
302
314
  _onPopoverTargetClick(event: Event): void;
303
315
  _syncEntryShowListeners(entry: RegisteredEntry): void;
304
316
  _removeEntryShowListeners(entry: RegisteredEntry): void;
@@ -328,15 +340,21 @@ export default class AttacherCore {
328
340
  _syncIsShown(): void;
329
341
  _showAfterDelay(event?: Event): void;
330
342
  _show(): void;
331
- _hideAfterDelay(): void;
343
+ _hideAfterDelay(event?: Event): void;
332
344
  _hide(): void;
333
345
  _addListenersForHideEvents(): void;
334
346
  _hideOnMouseLeaveTarget(rawEvent: Event): void;
335
347
  _hideIfMouseOutsideTargetOrAttachment(rawEvent: Event): void;
348
+ _markOpeningTriggerEvent(event: Event | undefined): void;
349
+ _isTargetContainingFloating(): boolean;
350
+ _isEventInDismissRetentionZone(event: Event): boolean;
351
+ _isNodeInDismissRetentionZone(node: Node | null): boolean;
336
352
  _hideOnClickOut(event: Event): void;
337
353
  _hideOnEscapeKey(rawEvent: Event): void;
338
354
  _hideOnLostFocus(rawEvent: Event): void;
339
355
  _update(): void;
340
356
  _updatePosition(): void;
357
+ _disconnectRelativeTargetObserver(): void;
358
+ _syncRelativeTargetObserver(): void;
341
359
  destroy(): void;
342
360
  }
@@ -1,17 +1,27 @@
1
- import { type ComputePositionConfig, type Middleware, type MiddlewareData, type Placement, type Strategy } from '@floating-ui/dom';
1
+ import { type ComputePositionConfig, type Middleware, type MiddlewareData, type OffsetOptions, type Placement, type Platform, type Strategy } from '@floating-ui/dom';
2
2
  import { type AttachmentTarget } from './target-resolution';
3
+ /**
4
+ * Floating UI platform adapter that stops `clippingAncestors` discovery at the
5
+ * nearest enclosing Top-Layer host (`:popover-open` or `:modal`), preventing
6
+ * background page overflow containers from falsely clipping references inside
7
+ * dialogs or nested popovers while preserving scroll clipping inside that host.
8
+ */
9
+ export declare const topLayerAwarePlatform: Platform;
3
10
  /** Check whether an attachment target (DOM Element or VirtualElement) is still connected. */
4
11
  export declare function isTargetConnected(target: AttachmentTarget | null | undefined): boolean;
5
12
  export interface BuildMiddlewareOptions {
6
13
  rawMiddleware?: ComputePositionConfig['middleware'] | null;
14
+ offsetOptions?: OffsetOptions | null;
7
15
  arrowElement: Element | null;
8
16
  arrowEnabled: boolean;
9
17
  }
18
+ /** Whether a normalized middleware pipeline includes an `offset` entry. */
19
+ export declare function hasOffsetMiddleware(middleware: readonly Middleware[]): boolean;
10
20
  /**
11
21
  * Normalize and deduplicate the Floating UI middleware array without mutating
12
22
  * caller-supplied middleware objects.
13
23
  */
14
- export declare function buildMiddleware({ rawMiddleware, arrowElement, arrowEnabled, }: BuildMiddlewareOptions): Middleware[];
24
+ export declare function buildMiddleware({ rawMiddleware, offsetOptions, arrowElement, arrowEnabled, }: BuildMiddlewareOptions): Middleware[];
15
25
  export interface ApplyPositionResultOptions {
16
26
  x: number;
17
27
  y: number;
@@ -11,12 +11,18 @@ export type AttachmentTargetInput = AttachmentTarget | string;
11
11
  export declare function isElementTarget(value: unknown): value is Element;
12
12
  /** Floating UI virtual references are plain objects with `getBoundingClientRect`. */
13
13
  export declare function isVirtualReference(value: unknown): value is VirtualElement;
14
+ /** Whether a `@target` string uses a relative DOM token (`:previous`, `:previous(...)`, `:parent`, `:closest(...)`). */
15
+ export declare function isRelativeTargetToken(value: unknown): value is string;
16
+ /** Non-asserting lookup for relative target tokens used to detect stale DOM bindings. */
17
+ export declare function peekRelativeTarget(token: string, floatingElement: Element | null | undefined): Element | null;
14
18
  /**
15
- * Resolve a public `@target` value (Element | selector | virtual ref).
19
+ * Resolve a public `@target` value (Element | selector | relative token | virtual ref).
16
20
  *
17
21
  * Selector strings use `querySelectorAll` and must match exactly one node.
22
+ * Relative tokens (`:previous`, `:previous(selector)`, `:parent`, `:closest(selector)`)
23
+ * resolve from the in-place `floatingElement` Host without `<meta hidden>` markers.
18
24
  */
19
- export declare function coerceTarget(value: AttachmentTargetInput | null | undefined, root?: ParentNode | null): AttachmentTarget | null;
25
+ export declare function coerceTarget(value: AttachmentTargetInput | null | undefined, root?: ParentNode | null, floatingElement?: Element | null): AttachmentTarget | null;
20
26
  export declare function escapeAttributeSelectorValue(value: string): string;
21
27
  export interface TriggerTargets {
22
28
  popoverTargets: Element[];
@@ -26,16 +32,18 @@ export interface TriggerTargets {
26
32
  /** Find native `[popovertarget="<id>"]` / `[interestfor="<id>"]` triggers for an attachment id. */
27
33
  export declare function findTriggerTargetElements(id: string | null | undefined, root?: ParentNode | null): TriggerTargets;
28
34
  export interface ResolveAttachmentTargetOptions {
29
- /** `@target` arg: Element, selector, or virtual reference. */
35
+ /** `@target` arg: Element, selector, relative token, or virtual reference. */
30
36
  target?: AttachmentTargetInput | null;
31
37
  /** Element registered via `{{a.target}}` / `a.setTarget()`. */
32
38
  registeredTarget?: AttachmentTarget | null;
33
39
  /** Native `[popovertarget]` / `[interestfor]` triggers. */
34
40
  triggerTargets?: readonly Element[];
35
41
  root?: ParentNode | null;
42
+ /** In-place Attachment Host element used to resolve relative `@target` tokens. */
43
+ floatingElement?: Element | null;
36
44
  }
37
45
  /** Pick the Floating UI reference: `@target`, then yielded registration, then native triggers. */
38
- export declare function resolveAttachmentTarget({ target, registeredTarget, triggerTargets, root, }: ResolveAttachmentTargetOptions): AttachmentTarget | null;
46
+ export declare function resolveAttachmentTarget({ target, registeredTarget, triggerTargets, root, floatingElement, }: ResolveAttachmentTargetOptions): AttachmentTarget | null;
39
47
  /**
40
48
  * Extract the DOM Element that should receive event listeners.
41
49
  * Real Elements receive events directly. Virtual references may provide a
@@ -10,11 +10,13 @@ export interface TooltipModifierSignature {
10
10
  }
11
11
  /**
12
12
  * `{{tooltip "Text" class="..." ...}}` modifier for void and simple targets.
13
- * Shares a single Top-Layer Attachment DOM node per document via `SingletonTooltipPool` (#64).
13
+ * Shares a single Top-Layer Attachment DOM node per document via `SingletonTooltipPool` (#64),
14
+ * or allocates an isolated host instance when controlled `isShown` is passed.
14
15
  */
15
16
  export default class TooltipModifier extends Modifier<TooltipModifierSignature> {
16
17
  private _element;
17
18
  private _pool;
19
+ private _dedicatedPool;
18
20
  constructor(owner: ConstructorParameters<typeof Modifier<TooltipModifierSignature>>[0], args: ConstructorParameters<typeof Modifier<TooltipModifierSignature>>[1]);
19
21
  modify(element: Element, [text]: TooltipModifierSignature['Args']['Positional'], named: TooltipModifierSignature['Args']['Named']): void;
20
22
  }
@@ -1,7 +1,7 @@
1
1
  import { getOwner } from '@ember/application';
2
2
  import { registerDestructor } from '@ember/destroyable';
3
3
  import Modifier from 'ember-modifier';
4
- import { A as AttacherCore, r as resolveTooltipClass, c as cancelScheduled, s as scheduleMicrotask } from '../attacher-core-CtbFbuD_.js';
4
+ import { A as AttacherCore, a as resolveTooltipClass, c as cancelScheduled, s as scheduleMicrotask } from '../attacher-core-BuH7FXay.js';
5
5
 
6
6
  const poolsByDocument = new WeakMap();
7
7
  const BASE_ARGS = Object.freeze({
@@ -98,6 +98,11 @@ class TooltipDomHost {
98
98
  } else if (fillEl.parentNode === innerEl) {
99
99
  innerEl.removeChild(fillEl);
100
100
  }
101
+ if (state.hasOffset) {
102
+ hostEl.setAttribute('data-offset', '');
103
+ } else {
104
+ hostEl.removeAttribute('data-offset');
105
+ }
101
106
  }
102
107
  destroy() {
103
108
  if (this.hostEl?.parentNode) {
@@ -174,7 +179,7 @@ class SingletonTooltipPool {
174
179
  cancelScheduled(handle);
175
180
  }
176
181
  this._visibilitySyncHandles.clear();
177
- if (this.doc) {
182
+ if (this.doc && poolsByDocument.get(this.doc) === this) {
178
183
  poolsByDocument.delete(this.doc);
179
184
  }
180
185
  this.core?.destroy();
@@ -200,17 +205,21 @@ function getTooltipPool(element) {
200
205
 
201
206
  /**
202
207
  * `{{tooltip "Text" class="..." ...}}` modifier for void and simple targets.
203
- * Shares a single Top-Layer Attachment DOM node per document via `SingletonTooltipPool` (#64).
208
+ * Shares a single Top-Layer Attachment DOM node per document via `SingletonTooltipPool` (#64),
209
+ * or allocates an isolated host instance when controlled `isShown` is passed.
204
210
  */
205
211
  class TooltipModifier extends Modifier {
206
212
  constructor(owner, args) {
207
213
  super(owner, args);
208
214
  this._element = null;
209
215
  this._pool = null;
216
+ this._dedicatedPool = null;
210
217
  registerDestructor(this, () => {
211
218
  if (this._pool && this._element) {
212
219
  this._pool.unregister(this._element);
213
220
  }
221
+ this._dedicatedPool?.destroy();
222
+ this._dedicatedPool = null;
214
223
  this._element = null;
215
224
  this._pool = null;
216
225
  });
@@ -219,12 +228,41 @@ class TooltipModifier extends Modifier {
219
228
  if (text == null || text === '') {
220
229
  if (this._pool && this._element) {
221
230
  this._pool.unregister(this._element);
222
- this._element = null;
223
231
  this._pool = null;
224
232
  }
233
+ if (this._dedicatedPool) {
234
+ this._dedicatedPool.destroy();
235
+ this._dedicatedPool = null;
236
+ }
237
+ this._element = null;
225
238
  return;
226
239
  }
227
240
  const owner = getOwner(this);
241
+ const isControlled = named?.isShown !== undefined;
242
+ if (isControlled) {
243
+ if (this._pool && this._element) {
244
+ this._pool.unregister(this._element);
245
+ this._pool = null;
246
+ }
247
+ const doc = element?.ownerDocument || (typeof document !== 'undefined' ? document : null);
248
+ if (!doc) {
249
+ return;
250
+ }
251
+ if (this._dedicatedPool && this._element && this._element !== element) {
252
+ this._dedicatedPool.unregister(this._element);
253
+ this._dedicatedPool = null;
254
+ }
255
+ if (!this._dedicatedPool || !this._dedicatedPool.core || this._dedicatedPool.core.isDestroyed) {
256
+ this._dedicatedPool = new SingletonTooltipPool(doc);
257
+ }
258
+ this._element = element;
259
+ this._dedicatedPool.register(element, text, named, owner);
260
+ return;
261
+ }
262
+ if (this._dedicatedPool) {
263
+ this._dedicatedPool.destroy();
264
+ this._dedicatedPool = null;
265
+ }
228
266
  const pool = getTooltipPool(element);
229
267
  if (!pool) {
230
268
  return;