@ngneat/helipopper 10.0.0-alpha.1 → 10.2.0-alpha.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/README.md +43 -15
- package/config/index.d.ts +5 -0
- package/config/inject-tippy.d.ts +2 -0
- package/config/providers.d.ts +4 -0
- package/config/public-api.d.ts +4 -0
- package/{lib → config}/tippy.types.d.ts +7 -7
- package/fesm2022/ngneat-helipopper-config.mjs +52 -0
- package/fesm2022/ngneat-helipopper-config.mjs.map +1 -0
- package/fesm2022/ngneat-helipopper.mjs +26 -54
- package/fesm2022/ngneat-helipopper.mjs.map +1 -1
- package/lib/tippy.directive.d.ts +2 -1
- package/lib/tippy.factory.d.ts +2 -2
- package/lib/tippy.service.d.ts +1 -1
- package/lib/utils.d.ts +1 -1
- package/package.json +5 -3
- package/public-api.d.ts +1 -3
- package/esm2022/lib/coercion.mjs +0 -10
- package/esm2022/lib/defaults.mjs +0 -25
- package/esm2022/lib/intersection-observer.mjs +0 -10
- package/esm2022/lib/providers.mjs +0 -13
- package/esm2022/lib/tippy.directive.mjs +0 -482
- package/esm2022/lib/tippy.factory.mjs +0 -43
- package/esm2022/lib/tippy.service.mjs +0 -84
- package/esm2022/lib/tippy.types.mjs +0 -4
- package/esm2022/lib/utils.mjs +0 -128
- package/esm2022/ngneat-helipopper.mjs +0 -5
- package/esm2022/public-api.mjs +0 -7
- package/lib/providers.d.ts +0 -3
- /package/{lib → config}/defaults.d.ts +0 -0
package/README.md
CHANGED
|
@@ -49,12 +49,12 @@ $ pnpm i @ngneat/helipopper
|
|
|
49
49
|
Configure it as shown below:
|
|
50
50
|
|
|
51
51
|
```ts
|
|
52
|
-
import { provideTippyConfig, tooltipVariation, popperVariation } from '@ngneat/helipopper';
|
|
52
|
+
import { provideTippyLoader provideTippyConfig, tooltipVariation, popperVariation } from '@ngneat/helipopper/config';
|
|
53
53
|
|
|
54
54
|
bootstrapApplication(AppComponent, {
|
|
55
55
|
providers: [
|
|
56
|
+
provideTippyLoader(() => import('tippy.js')),
|
|
56
57
|
provideTippyConfig({
|
|
57
|
-
loader: () => import('tippy.js'),
|
|
58
58
|
defaultVariation: 'tooltip',
|
|
59
59
|
variations: {
|
|
60
60
|
tooltip: tooltipVariation,
|
|
@@ -65,14 +65,12 @@ bootstrapApplication(AppComponent, {
|
|
|
65
65
|
});
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Please note that the `
|
|
68
|
+
Please note that the `provideTippyLoader` is required, as it specifies how Tippy is loaded - either synchronously or asynchronously. When dynamic import is used, the library will load only when the first Tippy directive is rendered. If we want it to load synchronously, we use the following:
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
71
|
import tippy from 'tippy.js';
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
loader: () => tippy,
|
|
75
|
-
});
|
|
73
|
+
provideTippyLoader(() => tippy);
|
|
76
74
|
```
|
|
77
75
|
|
|
78
76
|
Add the styles you want to `styles.scss`:
|
|
@@ -85,7 +83,19 @@ Add the styles you want to `styles.scss`:
|
|
|
85
83
|
|
|
86
84
|
You have the freedom to [customize](https://atomiks.github.io/tippyjs/v6/themes/) it if you need to.
|
|
87
85
|
|
|
88
|
-
Import the standalone `TippyDirective`
|
|
86
|
+
Import the standalone `TippyDirective` in your components:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { TippyDirective } from '@ngneat/helipopper';
|
|
90
|
+
|
|
91
|
+
@Component({
|
|
92
|
+
standalone: true,
|
|
93
|
+
imports: [TippyDirective],
|
|
94
|
+
})
|
|
95
|
+
class ExampleComponent {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
And use it in your templates:
|
|
89
99
|
|
|
90
100
|
```html
|
|
91
101
|
<button tp="Helpful Message">I have a tooltip</button>
|
|
@@ -119,11 +129,11 @@ export const tooltipVariation = {
|
|
|
119
129
|
### Use `Component` as content
|
|
120
130
|
|
|
121
131
|
```ts
|
|
122
|
-
import {
|
|
132
|
+
import { injectTippyRef, TippyInstance } from '@ngneat/helipopper/config';
|
|
123
133
|
|
|
124
134
|
@Component()
|
|
125
135
|
class MyComponent {
|
|
126
|
-
tippy =
|
|
136
|
+
tippy = injectTippyRef();
|
|
127
137
|
}
|
|
128
138
|
```
|
|
129
139
|
|
|
@@ -137,7 +147,9 @@ You can pass the `onlyTextOverflow` input to show the tooltip only when the host
|
|
|
137
147
|
|
|
138
148
|
```html
|
|
139
149
|
<div style="max-width: 100px;" class="overflow-hidden flex">
|
|
140
|
-
<p class="ellipsis" [tp]="text" tpPlacement="right" [tpOnlyTextOverflow]="true">
|
|
150
|
+
<p class="ellipsis" [tp]="text" tpPlacement="right" [tpOnlyTextOverflow]="true">
|
|
151
|
+
{{ text }}
|
|
152
|
+
</p>
|
|
141
153
|
</div>
|
|
142
154
|
```
|
|
143
155
|
|
|
@@ -185,7 +197,12 @@ Note that it's using [`IntersectionObserver`](https://caniuse.com/intersectionob
|
|
|
185
197
|
First, define the `contextMenu` variation:
|
|
186
198
|
|
|
187
199
|
```ts
|
|
188
|
-
import {
|
|
200
|
+
import {
|
|
201
|
+
popperVariation,
|
|
202
|
+
tooltipVariation,
|
|
203
|
+
provideTippyConfig,
|
|
204
|
+
withContextMenuVariation,
|
|
205
|
+
} from '@ngneat/helipopper/config';
|
|
189
206
|
|
|
190
207
|
bootstrapApplication(AppComponent, {
|
|
191
208
|
providers: [
|
|
@@ -212,7 +229,14 @@ Now you can use it in your template:
|
|
|
212
229
|
</ng-template>
|
|
213
230
|
|
|
214
231
|
<ul>
|
|
215
|
-
<li
|
|
232
|
+
<li
|
|
233
|
+
*ngFor="let item of list"
|
|
234
|
+
[tp]="contextMenu"
|
|
235
|
+
[tpData]="item"
|
|
236
|
+
tpVariation="contextMenu"
|
|
237
|
+
>
|
|
238
|
+
{{ item.label }}
|
|
239
|
+
</li>
|
|
216
240
|
</ul>
|
|
217
241
|
```
|
|
218
242
|
|
|
@@ -230,7 +254,9 @@ Now you can use it in your template:
|
|
|
230
254
|
Use isVisible to trigger show and hide. Set trigger to manual.
|
|
231
255
|
|
|
232
256
|
```html
|
|
233
|
-
<div tp="Helpful Message" tpTrigger="manual" [tpIsVisible]="visibility">
|
|
257
|
+
<div tp="Helpful Message" tpTrigger="manual" [tpIsVisible]="visibility">
|
|
258
|
+
Click Open to see me
|
|
259
|
+
</div>
|
|
234
260
|
|
|
235
261
|
<button (click)="visibility = true">Open</button>
|
|
236
262
|
<button (click)="visibility = false">Close</button>
|
|
@@ -296,9 +322,11 @@ class Component {
|
|
|
296
322
|
tippy: TippyInstance;
|
|
297
323
|
private tippyService = inject(TippyService);
|
|
298
324
|
|
|
299
|
-
show() {
|
|
325
|
+
async show() {
|
|
300
326
|
if (!this.tippy) {
|
|
301
|
-
this.tippy =
|
|
327
|
+
this.tippy = await firstValueFrom(
|
|
328
|
+
this.tippyService.create(this.inputName, 'this field is required')
|
|
329
|
+
);
|
|
302
330
|
}
|
|
303
331
|
|
|
304
332
|
this.tippy.show();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Provider } from '@angular/core';
|
|
2
|
+
import { type TippyLoader, type TippyConfig } from './tippy.types';
|
|
3
|
+
export declare function provideTippyLoader(loader: TippyLoader): import("@angular/core").EnvironmentProviders;
|
|
4
|
+
export declare function provideTippyConfig(config: TippyConfig): Provider;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { tooltipVariation, popperVariation, withContextMenuVariation } from './defaults';
|
|
2
|
+
export { CreateOptions, TippyInstance, TippyProps, ExtendedTippyProps, TippyElement, ExtendedTippyInstance, TippyConfig, TippyLoader, TIPPY_LOADER, TIPPY_REF, TIPPY_CONFIG, } from './tippy.types';
|
|
3
|
+
export { provideTippyLoader, provideTippyConfig } from './providers';
|
|
4
|
+
export { injectTippyRef } from './inject-tippy';
|
|
@@ -8,7 +8,6 @@ export interface CreateOptions extends Partial<TippyProps>, ViewOptions {
|
|
|
8
8
|
className: string | string[];
|
|
9
9
|
data: any;
|
|
10
10
|
}
|
|
11
|
-
export declare const TIPPY_REF: InjectionToken<TippyInstance>;
|
|
12
11
|
export interface TippyInstance extends Instance {
|
|
13
12
|
data?: any;
|
|
14
13
|
}
|
|
@@ -25,9 +24,10 @@ export interface ExtendedTippyInstance<T> extends TippyInstance {
|
|
|
25
24
|
$viewOptions: ViewOptions;
|
|
26
25
|
context?: ViewOptions['context'];
|
|
27
26
|
}
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export declare const
|
|
27
|
+
export type TippyConfig = Partial<ExtendedTippyProps>;
|
|
28
|
+
export type TippyLoader = () => typeof tippy | Promise<{
|
|
29
|
+
default: typeof tippy;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const TIPPY_LOADER: InjectionToken<TippyLoader>;
|
|
32
|
+
export declare const TIPPY_REF: InjectionToken<TippyInstance>;
|
|
33
|
+
export declare const TIPPY_CONFIG: InjectionToken<Partial<ExtendedTippyProps>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { InjectionToken, makeEnvironmentProviders, inject } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
const tooltipVariation = {
|
|
4
|
+
theme: undefined,
|
|
5
|
+
arrow: false,
|
|
6
|
+
animation: 'scale',
|
|
7
|
+
trigger: 'mouseenter',
|
|
8
|
+
offset: [0, 5],
|
|
9
|
+
};
|
|
10
|
+
const popperVariation = {
|
|
11
|
+
theme: 'light',
|
|
12
|
+
arrow: true,
|
|
13
|
+
offset: [0, 10],
|
|
14
|
+
animation: undefined,
|
|
15
|
+
trigger: 'click',
|
|
16
|
+
interactive: true,
|
|
17
|
+
};
|
|
18
|
+
function withContextMenuVariation(baseVariation) {
|
|
19
|
+
return {
|
|
20
|
+
...baseVariation,
|
|
21
|
+
placement: 'right-start',
|
|
22
|
+
trigger: 'manual',
|
|
23
|
+
arrow: false,
|
|
24
|
+
offset: [0, 0],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const TIPPY_LOADER = new InjectionToken('TIPPY_LOADER');
|
|
29
|
+
const TIPPY_REF = /* @__PURE__ */ new InjectionToken('TIPPY_REF');
|
|
30
|
+
const TIPPY_CONFIG = new InjectionToken('Tippy config');
|
|
31
|
+
|
|
32
|
+
function provideTippyLoader(loader) {
|
|
33
|
+
return makeEnvironmentProviders([{ provide: TIPPY_LOADER, useValue: loader }]);
|
|
34
|
+
}
|
|
35
|
+
function provideTippyConfig(config) {
|
|
36
|
+
return { provide: TIPPY_CONFIG, useValue: config };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function injectTippyRef() {
|
|
40
|
+
const instance = inject(TIPPY_REF, { optional: true });
|
|
41
|
+
if (instance) {
|
|
42
|
+
return instance;
|
|
43
|
+
}
|
|
44
|
+
throw new Error('tp is not provided in the current context or on one of its ancestors');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generated bundle index. Do not edit.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export { TIPPY_CONFIG, TIPPY_LOADER, TIPPY_REF, injectTippyRef, popperVariation, provideTippyConfig, provideTippyLoader, tooltipVariation, withContextMenuVariation };
|
|
52
|
+
//# sourceMappingURL=ngneat-helipopper-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngneat-helipopper-config.mjs","sources":["../../../../projects/ngneat/helipopper/config/src/defaults.ts","../../../../projects/ngneat/helipopper/config/src/tippy.types.ts","../../../../projects/ngneat/helipopper/config/src/providers.ts","../../../../projects/ngneat/helipopper/config/src/inject-tippy.ts","../../../../projects/ngneat/helipopper/config/src/ngneat-helipopper-config.ts"],"sourcesContent":["import type { TippyProps } from './tippy.types';\n\n// A variation is a set of predefined tippy properties.\ntype Variation = Partial<TippyProps>;\n\nexport const tooltipVariation: Variation = {\n theme: undefined,\n arrow: false,\n animation: 'scale',\n trigger: 'mouseenter',\n offset: [0, 5],\n};\n\nexport const popperVariation: Variation = {\n theme: 'light',\n arrow: true,\n offset: [0, 10],\n animation: undefined,\n trigger: 'click',\n interactive: true,\n};\n\nexport function withContextMenuVariation(baseVariation: Variation): Variation {\n return {\n ...baseVariation,\n placement: 'right-start',\n trigger: 'manual',\n arrow: false,\n offset: [0, 0],\n };\n}\n","import type tippy from 'tippy.js';\nimport type { Instance, Props } from 'tippy.js';\nimport { ElementRef, InjectionToken } from '@angular/core';\nimport type { ResolveViewRef, ViewOptions } from '@ngneat/overview';\n\nexport interface CreateOptions extends Partial<TippyProps>, ViewOptions {\n variation: string;\n preserveView: boolean;\n className: string | string[];\n data: any;\n}\n\nexport interface TippyInstance extends Instance {\n data?: any;\n}\n\nexport type TippyProps = Props;\n\nexport interface ExtendedTippyProps extends TippyProps {\n variations: Record<string, Partial<TippyProps>>;\n defaultVariation: keyof ExtendedTippyProps['variations'];\n beforeRender?: (text: string) => string;\n zIndexGetter?(): number;\n}\n\nexport type TippyElement = ElementRef | Element;\n\nexport interface ExtendedTippyInstance<T> extends TippyInstance {\n view: ResolveViewRef<T> | null;\n $viewOptions: ViewOptions;\n context?: ViewOptions['context'];\n}\n\nexport type TippyConfig = Partial<ExtendedTippyProps>;\n\nexport type TippyLoader = () => typeof tippy | Promise<{ default: typeof tippy }>;\n\nexport const TIPPY_LOADER = new InjectionToken<TippyLoader>('TIPPY_LOADER');\n\nexport const TIPPY_REF = /* @__PURE__ */ new InjectionToken<TippyInstance>('TIPPY_REF');\n\nexport const TIPPY_CONFIG = new InjectionToken<TippyConfig>('Tippy config');\n","import { makeEnvironmentProviders, type Provider } from '@angular/core';\n\nimport {\n TIPPY_CONFIG,\n TIPPY_LOADER,\n type TippyLoader,\n type TippyConfig,\n} from './tippy.types';\n\nexport function provideTippyLoader(loader: TippyLoader) {\n return makeEnvironmentProviders([{ provide: TIPPY_LOADER, useValue: loader }]);\n}\n\nexport function provideTippyConfig(config: TippyConfig): Provider {\n return { provide: TIPPY_CONFIG, useValue: config };\n}\n","import { inject } from '@angular/core';\n\nimport { TIPPY_REF, type TippyInstance } from './tippy.types';\n\nexport function injectTippyRef(): TippyInstance {\n const instance = inject(TIPPY_REF, { optional: true });\n\n if (instance) {\n return instance;\n }\n\n throw new Error('tp is not provided in the current context or on one of its ancestors');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAKa,MAAA,gBAAgB,GAAc;AACzC,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,SAAS,EAAE,OAAO;AAClB,IAAA,OAAO,EAAE,YAAY;AACrB,IAAA,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;;AAGH,MAAA,eAAe,GAAc;AACxC,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;AACf,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,WAAW,EAAE,IAAI;;AAGb,SAAU,wBAAwB,CAAC,aAAwB,EAAA;IAC/D,OAAO;AACL,QAAA,GAAG,aAAa;AAChB,QAAA,SAAS,EAAE,aAAa;AACxB,QAAA,OAAO,EAAE,QAAQ;AACjB,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACf;AACH;;MCOa,YAAY,GAAG,IAAI,cAAc,CAAc,cAAc;AAE7D,MAAA,SAAS,mBAAmB,IAAI,cAAc,CAAgB,WAAW;MAEzE,YAAY,GAAG,IAAI,cAAc,CAAc,cAAc;;AChCpE,SAAU,kBAAkB,CAAC,MAAmB,EAAA;AACpD,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAChF;AAEM,SAAU,kBAAkB,CAAC,MAAmB,EAAA;IACpD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE;AACpD;;SCXgB,cAAc,GAAA;AAC5B,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEtD,IAAI,QAAQ,EAAE;AACZ,QAAA,OAAO,QAAQ;;AAGjB,IAAA,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC;AACzF;;ACZA;;AAEG;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef,
|
|
2
|
+
import { ElementRef, inject, NgZone, Injectable, booleanAttribute, input, model, EventEmitter, computed, DestroyRef, PLATFORM_ID, Injector, effect, untracked, Directive, Inject, Output } from '@angular/core';
|
|
3
3
|
import { isPlatformServer } from '@angular/common';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { Observable, defer, from, map as map$1, of, shareReplay, Subject, fromEvent, merge } from 'rxjs';
|
|
6
6
|
import { auditTime, map, switchMap, filter, takeUntil } from 'rxjs/operators';
|
|
7
7
|
import * as i1 from '@ngneat/overview';
|
|
8
8
|
import { isString as isString$1, isComponent, isTemplateRef } from '@ngneat/overview';
|
|
9
|
+
import { TIPPY_LOADER, TIPPY_REF, TIPPY_CONFIG } from '@ngneat/helipopper/config';
|
|
10
|
+
export { TIPPY_CONFIG, TIPPY_REF, injectTippyRef, popperVariation, provideTippyConfig, tooltipVariation, withContextMenuVariation } from '@ngneat/helipopper/config';
|
|
9
11
|
|
|
10
12
|
// Let's retrieve the native `IntersectionObserver` implementation hidden by
|
|
11
13
|
// `__zone_symbol__IntersectionObserver`. This would be the unpatched version of
|
|
@@ -141,9 +143,6 @@ function observeVisibility(host, hiddenHandler) {
|
|
|
141
143
|
};
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
const TIPPY_REF = new InjectionToken('TIPPY_REF');
|
|
145
|
-
const TIPPY_CONFIG = new InjectionToken('Tippy config');
|
|
146
|
-
|
|
147
146
|
// We need to use `isPromise` instead of checking whether
|
|
148
147
|
// `value instanceof Promise`. In zone.js patched environments, `global.Promise`
|
|
149
148
|
// is the `ZoneAwarePromise`.
|
|
@@ -155,7 +154,7 @@ function isPromise(value) {
|
|
|
155
154
|
class TippyFactory {
|
|
156
155
|
constructor() {
|
|
157
156
|
this._ngZone = inject(NgZone);
|
|
158
|
-
this.
|
|
157
|
+
this._loader = inject(TIPPY_LOADER);
|
|
159
158
|
this._tippyImpl$ = null;
|
|
160
159
|
}
|
|
161
160
|
/**
|
|
@@ -168,17 +167,19 @@ class TippyFactory {
|
|
|
168
167
|
// synchronous and to avoid triggering the `defer` callback repeatedly
|
|
169
168
|
// when new subscribers arrive.
|
|
170
169
|
this._tippyImpl$ ||= defer(() => {
|
|
171
|
-
const maybeTippy = this._ngZone.runOutsideAngular(() => this.
|
|
172
|
-
return isPromise(maybeTippy)
|
|
170
|
+
const maybeTippy = this._ngZone.runOutsideAngular(() => this._loader());
|
|
171
|
+
return isPromise(maybeTippy)
|
|
172
|
+
? from(maybeTippy).pipe(map$1((tippy) => tippy.default))
|
|
173
|
+
: of(maybeTippy);
|
|
173
174
|
}).pipe(shareReplay());
|
|
174
175
|
return this._tippyImpl$.pipe(map$1((tippy) => {
|
|
175
176
|
return this._ngZone.runOutsideAngular(() => tippy(target, props));
|
|
176
177
|
}));
|
|
177
178
|
}
|
|
178
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
179
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
179
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
180
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyFactory, providedIn: 'root' }); }
|
|
180
181
|
}
|
|
181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyFactory, decorators: [{
|
|
182
183
|
type: Injectable,
|
|
183
184
|
args: [{ providedIn: 'root' }]
|
|
184
185
|
}] });
|
|
@@ -319,10 +320,12 @@ class TippyDirective {
|
|
|
319
320
|
this.destroyRef = inject(DestroyRef);
|
|
320
321
|
this.isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
321
322
|
this.tippyFactory = inject(TippyFactory);
|
|
323
|
+
this.destroyed = false;
|
|
322
324
|
if (this.isServer)
|
|
323
325
|
return;
|
|
324
326
|
this.setupListeners();
|
|
325
327
|
this.destroyRef.onDestroy(() => {
|
|
328
|
+
this.destroyed = true;
|
|
326
329
|
this.instance?.destroy();
|
|
327
330
|
this.destroyView();
|
|
328
331
|
this.visibilityObserverCleanup?.();
|
|
@@ -604,7 +607,12 @@ class TippyDirective {
|
|
|
604
607
|
onHidden(instance = this.instance) {
|
|
605
608
|
this.destroyView();
|
|
606
609
|
const isVisible = false;
|
|
607
|
-
|
|
610
|
+
// `model()` uses `OutputEmitterRef` internally to emit events when the
|
|
611
|
+
// signal changes. If the directive is destroyed, it will throw an error:
|
|
612
|
+
// "Unexpected emit for destroyed `OutputRef`".
|
|
613
|
+
if (!this.destroyed) {
|
|
614
|
+
this.isVisible.set(isVisible);
|
|
615
|
+
}
|
|
608
616
|
this.visibleInternal.next(isVisible);
|
|
609
617
|
if (this.visible.observed) {
|
|
610
618
|
this.ngZone.run(() => this.visible.next(isVisible));
|
|
@@ -642,10 +650,10 @@ class TippyDirective {
|
|
|
642
650
|
isVisible ? this.show() : this.hide();
|
|
643
651
|
});
|
|
644
652
|
}
|
|
645
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
646
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
653
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyDirective, deps: [{ token: TIPPY_CONFIG }, { token: i0.Injector }, { token: i1.ViewService }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
654
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: TippyDirective, isStandalone: true, selector: "[tp]", inputs: { appendTo: { classPropertyName: "appendTo", publicName: "tpAppendTo", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "tp", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "tpDelay", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "tpDuration", isSignal: true, isRequired: false, transformFunction: null }, hideOnClick: { classPropertyName: "hideOnClick", publicName: "tpHideOnClick", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "tpInteractive", isSignal: true, isRequired: false, transformFunction: null }, interactiveBorder: { classPropertyName: "interactiveBorder", publicName: "tpInteractiveBorder", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "tpMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "tpOffset", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "tpPlacement", isSignal: true, isRequired: false, transformFunction: null }, popperOptions: { classPropertyName: "popperOptions", publicName: "tpPopperOptions", isSignal: true, isRequired: false, transformFunction: null }, showOnCreate: { classPropertyName: "showOnCreate", publicName: "tpShowOnCreate", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "tpTrigger", isSignal: true, isRequired: false, transformFunction: null }, triggerTarget: { classPropertyName: "triggerTarget", publicName: "tpTriggerTarget", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "tpZIndex", isSignal: true, isRequired: false, transformFunction: null }, animation: { classPropertyName: "animation", publicName: "tpAnimation", isSignal: true, isRequired: false, transformFunction: null }, useTextContent: { classPropertyName: "useTextContent", publicName: "tpUseTextContent", isSignal: true, isRequired: false, transformFunction: null }, isLazy: { classPropertyName: "isLazy", publicName: "tpIsLazy", isSignal: true, isRequired: false, transformFunction: null }, variation: { classPropertyName: "variation", publicName: "tpVariation", isSignal: true, isRequired: false, transformFunction: null }, isEnabled: { classPropertyName: "isEnabled", publicName: "tpIsEnabled", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "tpClassName", isSignal: true, isRequired: false, transformFunction: null }, onlyTextOverflow: { classPropertyName: "onlyTextOverflow", publicName: "tpOnlyTextOverflow", isSignal: true, isRequired: false, transformFunction: null }, staticWidthHost: { classPropertyName: "staticWidthHost", publicName: "tpStaticWidthHost", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "tpData", isSignal: true, isRequired: false, transformFunction: null }, useHostWidth: { classPropertyName: "useHostWidth", publicName: "tpUseHostWidth", isSignal: true, isRequired: false, transformFunction: null }, hideOnEscape: { classPropertyName: "hideOnEscape", publicName: "tpHideOnEscape", isSignal: true, isRequired: false, transformFunction: null }, detectChangesComponent: { classPropertyName: "detectChangesComponent", publicName: "tpDetectChangesComponent", isSignal: true, isRequired: false, transformFunction: null }, popperWidth: { classPropertyName: "popperWidth", publicName: "tpPopperWidth", isSignal: true, isRequired: false, transformFunction: null }, customHost: { classPropertyName: "customHost", publicName: "tpHost", isSignal: true, isRequired: false, transformFunction: null }, isVisible: { classPropertyName: "isVisible", publicName: "tpIsVisible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isVisible: "tpIsVisibleChange", visible: "tpVisible" }, exportAs: ["tippy"], usesOnChanges: true, ngImport: i0 }); }
|
|
647
655
|
}
|
|
648
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
656
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyDirective, decorators: [{
|
|
649
657
|
type: Directive,
|
|
650
658
|
args: [{
|
|
651
659
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -661,31 +669,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
661
669
|
args: ['tpVisible']
|
|
662
670
|
}] } });
|
|
663
671
|
|
|
664
|
-
const tooltipVariation = {
|
|
665
|
-
theme: undefined,
|
|
666
|
-
arrow: false,
|
|
667
|
-
animation: 'scale',
|
|
668
|
-
trigger: 'mouseenter',
|
|
669
|
-
offset: [0, 5],
|
|
670
|
-
};
|
|
671
|
-
const popperVariation = {
|
|
672
|
-
theme: 'light',
|
|
673
|
-
arrow: true,
|
|
674
|
-
offset: [0, 10],
|
|
675
|
-
animation: undefined,
|
|
676
|
-
trigger: 'click',
|
|
677
|
-
interactive: true,
|
|
678
|
-
};
|
|
679
|
-
function withContextMenuVariation(baseVariation) {
|
|
680
|
-
return {
|
|
681
|
-
...baseVariation,
|
|
682
|
-
placement: 'right-start',
|
|
683
|
-
trigger: 'manual',
|
|
684
|
-
arrow: false,
|
|
685
|
-
offset: [0, 0],
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
|
|
689
672
|
class TippyService {
|
|
690
673
|
constructor(globalConfig, view, injector) {
|
|
691
674
|
this.globalConfig = globalConfig;
|
|
@@ -752,10 +735,10 @@ class TippyService {
|
|
|
752
735
|
};
|
|
753
736
|
return this._tippyFactory.create(host, config);
|
|
754
737
|
}
|
|
755
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
756
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
738
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyService, deps: [{ token: TIPPY_CONFIG }, { token: i1.ViewService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
739
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyService, providedIn: 'root' }); }
|
|
757
740
|
}
|
|
758
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: TippyService, decorators: [{
|
|
759
742
|
type: Injectable,
|
|
760
743
|
args: [{ providedIn: 'root' }]
|
|
761
744
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
@@ -763,20 +746,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
|
|
|
763
746
|
args: [TIPPY_CONFIG]
|
|
764
747
|
}] }, { type: i1.ViewService }, { type: i0.Injector }] });
|
|
765
748
|
|
|
766
|
-
function provideTippyConfig(config) {
|
|
767
|
-
return makeEnvironmentProviders([{ provide: TIPPY_CONFIG, useValue: config }]);
|
|
768
|
-
}
|
|
769
|
-
function injectTippyRef() {
|
|
770
|
-
const instance = inject(TIPPY_REF, { optional: true });
|
|
771
|
-
if (instance) {
|
|
772
|
-
return instance;
|
|
773
|
-
}
|
|
774
|
-
throw new Error('tp is not provided in the current context or on one of its ancestors');
|
|
775
|
-
}
|
|
776
|
-
|
|
777
749
|
/**
|
|
778
750
|
* Generated bundle index. Do not edit.
|
|
779
751
|
*/
|
|
780
752
|
|
|
781
|
-
export {
|
|
753
|
+
export { TippyDirective, TippyService, inView, overflowChanges };
|
|
782
754
|
//# sourceMappingURL=ngneat-helipopper.mjs.map
|