ember-attacher 4.2.1 → 4.4.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.
- package/dist/_app_/components/attacher.js +1 -0
- package/dist/_app_/modifiers/tooltip.js +1 -0
- package/dist/attacher-core-m7x5g04q.js +2653 -0
- package/dist/attacher-core-m7x5g04q.js.map +1 -0
- package/dist/components/attach-popover.d.ts +14 -0
- package/dist/components/attach-popover.js +9 -9
- package/dist/components/attach-popover.js.map +1 -1
- package/dist/components/attach-tooltip.d.ts +15 -0
- package/dist/components/attach-tooltip.js +12 -34
- package/dist/components/attach-tooltip.js.map +1 -1
- package/dist/components/attacher.d.ts +17 -0
- package/dist/components/attacher.js +33 -0
- package/dist/components/attacher.js.map +1 -0
- package/dist/components/basic-attacher.d.ts +151 -0
- package/dist/components/basic-attacher.js +22 -973
- package/dist/components/basic-attacher.js.map +1 -1
- package/dist/defaults.d.ts +32 -0
- package/dist/defaults.js +1 -0
- package/dist/defaults.js.map +1 -1
- package/dist/index.d.ts +72 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/is-visible-DQGdmVDv.js +42 -0
- package/dist/is-visible-DQGdmVDv.js.map +1 -0
- package/dist/modifiers/tooltip.d.ts +17 -0
- package/dist/modifiers/tooltip.js +254 -0
- package/dist/modifiers/tooltip.js.map +1 -0
- package/dist/styles/ember-attacher.css +1 -206
- package/dist/template-registry.d.ts +17 -0
- package/dist/test-support/index.d.ts +2 -0
- package/dist/test-support/index.js +1 -1
- package/dist/test-support/is-visible.d.ts +3 -0
- package/package.json +50 -15
- package/dist/is-visible-CzMFp_fy.js +0 -23
- package/dist/is-visible-CzMFp_fy.js.map +0 -1
- package/dist/target-resolution-Bz738VeA.js +0 -164
- package/dist/target-resolution-Bz738VeA.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-tooltip.js","sources":["../../src/components/attach-tooltip.js"],"sourcesContent":["import
|
|
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;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type Component from '@glimmer/component';
|
|
2
|
+
import type { AttachPopoverArgs, AttacherBlockParams } from './basic-attacher';
|
|
3
|
+
|
|
4
|
+
export type AttacherArgs = AttachPopoverArgs;
|
|
5
|
+
export type AttacherYieldedApi<TData = unknown> = AttacherBlockParams<TData>;
|
|
6
|
+
|
|
7
|
+
export interface AttacherSignature {
|
|
8
|
+
Element: null;
|
|
9
|
+
Args: AttacherArgs;
|
|
10
|
+
Blocks: {
|
|
11
|
+
default: [attacher: AttacherBlockParams];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class Attacher extends Component<AttacherSignature> {
|
|
16
|
+
get id(): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { helper } from '@ember/component/helper';
|
|
3
|
+
import { A as AttacherCore } from '../attacher-core-m7x5g04q.js';
|
|
4
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
|
+
import { setComponentTemplate } from '@ember/component';
|
|
6
|
+
|
|
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
|
+
});
|
|
17
|
+
class Attacher extends Component {
|
|
18
|
+
constructor(owner, args) {
|
|
19
|
+
super(owner, args);
|
|
20
|
+
this.syncAttacherArgs = syncAttacherArgs;
|
|
21
|
+
this.core = new AttacherCore(this, () => this.args, {
|
|
22
|
+
allowParentFallback: false,
|
|
23
|
+
isComponentHost: false
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
get id() {
|
|
27
|
+
return this.core.id;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
setComponentTemplate(TEMPLATE, Attacher);
|
|
31
|
+
|
|
32
|
+
export { Attacher as default };
|
|
33
|
+
//# sourceMappingURL=attacher.js.map
|
|
@@ -0,0 +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;;"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type Component from '@glimmer/component';
|
|
2
|
+
import type { htmlSafe } from '@ember/template';
|
|
3
|
+
import type { FunctionBasedModifier } from 'ember-modifier';
|
|
4
|
+
import type {
|
|
5
|
+
AutoUpdateOptions,
|
|
6
|
+
ComputePositionConfig,
|
|
7
|
+
MiddlewareData,
|
|
8
|
+
Placement,
|
|
9
|
+
Strategy,
|
|
10
|
+
VirtualElement,
|
|
11
|
+
} from '@floating-ui/dom';
|
|
12
|
+
|
|
13
|
+
export type AttacherAnimation =
|
|
14
|
+
| 'fade'
|
|
15
|
+
| 'fill'
|
|
16
|
+
| 'none'
|
|
17
|
+
| 'perspective'
|
|
18
|
+
| 'scale'
|
|
19
|
+
| 'shift'
|
|
20
|
+
| (string & {});
|
|
21
|
+
|
|
22
|
+
export type AttacherTarget = Element | VirtualElement | string;
|
|
23
|
+
|
|
24
|
+
export type AttacherTargetModifier<TData = unknown> = FunctionBasedModifier<{
|
|
25
|
+
Element: Element;
|
|
26
|
+
Args: {
|
|
27
|
+
Positional: [data?: TData];
|
|
28
|
+
Named: { data?: TData };
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export interface AttacherBlockParams<TData = unknown> {
|
|
33
|
+
/** Element modifier registering an element as a Target and associating optional `data`. */
|
|
34
|
+
target: AttacherTargetModifier<TData>;
|
|
35
|
+
/** Element modifier marking the caller's Attachment DOM element (headless `<Attacher>`). */
|
|
36
|
+
attachment: FunctionBasedModifier<{ Element: Element }>;
|
|
37
|
+
/** Element modifier registering a custom arrow element. */
|
|
38
|
+
arrow: FunctionBasedModifier<{ Element: Element }>;
|
|
39
|
+
/** Programmatically registers an explicit target Element or VirtualElement and optional `data`. */
|
|
40
|
+
setTarget: (target: Element | VirtualElement | null | undefined, data?: TData) => void;
|
|
41
|
+
/** Programmatically shows the attachment (optionally switching target and data). */
|
|
42
|
+
show: (target?: Element | VirtualElement, data?: TData) => void;
|
|
43
|
+
/** Programmatically hides the attachment. */
|
|
44
|
+
hide: () => void;
|
|
45
|
+
/** Programmatically toggles visibility of the attachment. */
|
|
46
|
+
toggle: () => void;
|
|
47
|
+
/** Recomputes Floating UI positioning immediately. */
|
|
48
|
+
update: () => void;
|
|
49
|
+
/** Current open visibility state. */
|
|
50
|
+
readonly isShown: boolean;
|
|
51
|
+
/** Whether inner content should render (respecting `@lazyRender`). */
|
|
52
|
+
readonly shouldRender: boolean;
|
|
53
|
+
/** Payload associated with the currently active Target (`{{a.target data}}` / `setTarget`). */
|
|
54
|
+
readonly data: TData | undefined;
|
|
55
|
+
/** Resolved Floating UI placement after middleware execution. */
|
|
56
|
+
readonly placement: Placement;
|
|
57
|
+
/** Latest Floating UI `middlewareData` from `computePosition()`. */
|
|
58
|
+
readonly middlewareData: MiddlewareData;
|
|
59
|
+
/** Programmatically registers an explicit target Element or VirtualElement (4.x alias for `setTarget`). */
|
|
60
|
+
setReference: (target: Element | VirtualElement | null | undefined) => void;
|
|
61
|
+
/** Element modifier yielding target registration when composed into a trigger element (4.x alias for `target`). */
|
|
62
|
+
reference: FunctionBasedModifier<{ Element: Element }>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface AttacherNamedBlocks<TData = unknown> {
|
|
66
|
+
default: [attacher: AttacherBlockParams<TData>];
|
|
67
|
+
target: [target: AttacherTargetModifier<TData>, attacher: AttacherBlockParams<TData>];
|
|
68
|
+
content: [attacher: AttacherBlockParams<TData>];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface AttachPopoverArgs {
|
|
72
|
+
/** Additional CSS classes appended alongside `@class` on the inner attachment container. */
|
|
73
|
+
additionalClass?: string | null;
|
|
74
|
+
/** Animation applied when showing and hiding the attachment. Defaults to `'fill'`. */
|
|
75
|
+
animation?: AttacherAnimation | null;
|
|
76
|
+
/** ARIA role attribute applied to the attachment element (`'dialog'` by default for `<AttachPopover>`, `'tooltip'` for `<AttachTooltip>`). */
|
|
77
|
+
ariaRole?: string;
|
|
78
|
+
/** Whether to render an arrow element positioned by Floating UI. Defaults to `false`. */
|
|
79
|
+
arrow?: boolean;
|
|
80
|
+
/** Keeps attachment position synced via Floating UI `autoUpdate`. Defaults to `false`. */
|
|
81
|
+
autoUpdate?: boolean | AutoUpdateOptions;
|
|
82
|
+
/** CSS class(es) applied to the inner attachment container. */
|
|
83
|
+
class?: string | null;
|
|
84
|
+
/** Target DOM Element, single-match CSS selector string, or Floating UI `VirtualElement`. */
|
|
85
|
+
target?: AttacherTarget | null;
|
|
86
|
+
/** Legacy alias of `@target`. */
|
|
87
|
+
explicitTarget?: AttacherTarget | null;
|
|
88
|
+
/** Space-separated fallback placements string passed to Floating UI `flip()`. */
|
|
89
|
+
flip?: string | null;
|
|
90
|
+
/** Explicit portal container Element or CSS selector string (disables Top-Layer promotion). */
|
|
91
|
+
floatingElementContainer?: Element | string | null;
|
|
92
|
+
/** Additional options merged into Floating UI `computePosition()`. */
|
|
93
|
+
floatingUiOptions?: Partial<ComputePositionConfig> | null;
|
|
94
|
+
/** Delay in ms (number or numeric string) before hiding. Defaults to `0`. */
|
|
95
|
+
hideDelay?: number | string;
|
|
96
|
+
/** Exit transition duration in ms (number or numeric string). Defaults to `300`. */
|
|
97
|
+
hideDuration?: number | string;
|
|
98
|
+
/** Space-separated hide triggers (`click`, `clickout`, `mouseleave`, `blur`, `focusout`, `escapekey`), or `null` to disable. */
|
|
99
|
+
hideOn?: string | null;
|
|
100
|
+
/** DOM `id` on the attachment element (also used for ARIA linkage and `[popovertarget]`). */
|
|
101
|
+
id?: string;
|
|
102
|
+
/** Keeps attachment open when pointer/focus enters it or traverses the `safePolygon` corridor. Defaults to `false`. */
|
|
103
|
+
interactive?: boolean;
|
|
104
|
+
/** Legacy offset hint kept for 4.x compatibility (`safePolygon` is active automatically in 4.3+). */
|
|
105
|
+
isOffset?: boolean;
|
|
106
|
+
/** Controlled visibility flag. */
|
|
107
|
+
isShown?: boolean;
|
|
108
|
+
/** Defers rendering inner block content until the attachment is first triggered. Defaults to `false`. */
|
|
109
|
+
lazyRender?: boolean;
|
|
110
|
+
/** Floating UI middleware pipeline (merged and deduplicated by `m.name`). */
|
|
111
|
+
middleware?: ComputePositionConfig['middleware'] | null;
|
|
112
|
+
/** Callback invoked when attachment visibility toggles. */
|
|
113
|
+
onChange?: (isVisible: boolean) => unknown;
|
|
114
|
+
/** Lifecycle hook invoked when the attacher binds to its resolved target. */
|
|
115
|
+
onInitializeAttacher?: (target: Element | VirtualElement | null, id: string) => unknown;
|
|
116
|
+
/** Lifecycle hook invoked during component teardown. */
|
|
117
|
+
onWillDestroy?: (target: Element | VirtualElement | null, id: string) => unknown;
|
|
118
|
+
/** Viewport padding passed to default `shift()`, or `false` to disable auto `flip`/`shift`. Defaults to `5`. */
|
|
119
|
+
overflowPadding?: number | false;
|
|
120
|
+
/** Floating UI placement. Defaults to `'top'`. */
|
|
121
|
+
placement?: Placement;
|
|
122
|
+
/** Renders the attachment in place within its parent DOM instead of portaling / promoting to Top Layer. */
|
|
123
|
+
renderInPlace?: boolean;
|
|
124
|
+
/** Delay in ms (number or numeric string) before showing. Defaults to `0`. */
|
|
125
|
+
showDelay?: number | string;
|
|
126
|
+
/** Enter transition duration in ms (number or numeric string). Defaults to `300`. */
|
|
127
|
+
showDuration?: number | string;
|
|
128
|
+
/** Space-separated show triggers (`click`, `mouseenter`, `focus`), or `null` to disable. */
|
|
129
|
+
showOn?: string | null;
|
|
130
|
+
/** CSS positioning strategy (`'absolute'` or `'fixed'`). Defaults to `'absolute'`. */
|
|
131
|
+
strategy?: Strategy;
|
|
132
|
+
/** Trusted `htmlSafe()` style applied to the inner attachment container. */
|
|
133
|
+
style?: ReturnType<typeof htmlSafe> | null;
|
|
134
|
+
/** Attaches event listeners in the capture phase (`true`) or bubble phase (`false`). */
|
|
135
|
+
useCapture?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface BasicAttacherArgs extends AttachPopoverArgs {
|
|
139
|
+
/** Configuration key under `config.emberAttacher` (`'popover'` or `'tooltip'`). */
|
|
140
|
+
configKey?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface BasicAttacherSignature {
|
|
144
|
+
Element: HTMLDivElement;
|
|
145
|
+
Args: BasicAttacherArgs;
|
|
146
|
+
Blocks: AttacherNamedBlocks;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export default class BasicAttacher extends Component<BasicAttacherSignature> {
|
|
150
|
+
get id(): string;
|
|
151
|
+
}
|