UNPKG

@ngneat/helipopper

Version:

A Powerful Tooltip and Popover for Angular Applications

1 lines 5.82 kB
{"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/ngneat-helipopper-config.ts"],"sourcesContent":["import type { TippyProps, VariationConfig } 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 focus',\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): VariationConfig {\n return {\n ...baseVariation,\n placement: 'right-start',\n trigger: 'manual',\n arrow: false,\n offset: [0, 0],\n isContextMenu: true, // signals the directive to attach the right-click listener\n };\n}\n","import type tippy from 'tippy.js';\nimport type { Instance, Props } from 'tippy.js';\nimport { ElementRef, InjectionToken, Type } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport type { Content, 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\n// Extends tippy props with isContextMenu so any named variation (not just one\n// called 'contextMenu') can opt into right-click listener behaviour.\nexport type VariationConfig = Partial<TippyProps> & { isContextMenu?: boolean };\n\nexport interface ExtendedTippyProps extends TippyProps {\n variations: Record<string, VariationConfig>;\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 TippyContent = Content | (() => Promise<Type<any>>);\n\nexport type TippyLoader = () => typeof tippy | Promise<{ default: typeof tippy }>;\n\nexport const TIPPY_LOADER = new InjectionToken<TippyLoader>(\n ngDevMode ? 'TIPPY_LOADER' : '',\n);\n\nexport const TIPPY_CONFIG = new InjectionToken<TippyConfig>(\n ngDevMode ? 'TIPPY_CONFIG' : '',\n);\n\nexport const TIPPY_LOADER_COMPONENT = new InjectionToken<Type<unknown>>(\n ngDevMode ? 'TIPPY_LOADER_COMPONENT' : '',\n);\n\nexport type TippyLoaderTiming = Observable<void>;\n\nexport const TIPPY_LOADER_TIMING = new InjectionToken<TippyLoaderTiming>(\n ngDevMode ? 'TIPPY_LOADER_TIMING' : '',\n { factory: () => of(undefined) },\n);\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n Provider,\n Type,\n} from '@angular/core';\n\nimport {\n TIPPY_CONFIG,\n TIPPY_LOADER,\n TIPPY_LOADER_COMPONENT,\n TIPPY_LOADER_TIMING,\n type TippyLoader,\n type TippyConfig,\n type TippyLoaderTiming,\n} from './tippy.types';\n\nexport function provideTippyLoader(\n loader: TippyLoader,\n ...features: EnvironmentProviders[]\n) {\n return makeEnvironmentProviders([\n { provide: TIPPY_LOADER, useValue: loader },\n ...features,\n ]);\n}\n\nexport function provideTippyConfig(config: TippyConfig): Provider {\n return { provide: TIPPY_CONFIG, useValue: config };\n}\n\nexport function withTippyLoaderComponent(component: Type<unknown>): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: TIPPY_LOADER_COMPONENT, useValue: component },\n ]);\n}\n\nexport function withTippyLoaderTiming(\n timing: () => TippyLoaderTiming,\n): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: TIPPY_LOADER_TIMING, useFactory: timing }]);\n}\n","/**\n * Generated b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