-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this commit, we add a new subpackage called `@ngneat/helipopper/config`. This change is intended to separate configuration logic from UI-related functionality. The configuration should be imported at the root level, while the UI components should only be imported when necessary. Previously, importing the library at the root level (when providing the configuration) caused the bundler to include everything in the main bundle immediately. With this approach, the configuration is bundled separately at the root level and includes only the provider functions. Additionally, while we had already added a `loader` function, to avoid breaking the `provideTippyConfig` signature, we introduced a separate function called `provideTippyLoader`, which exclusively accepts a loader function. The `provideTippyConfig` has been reverted to return a provider (not an environment provider), becuase it might be provided at the component level too.
- Loading branch information
Showing
16 changed files
with
143 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...cts/ngneat/helipopper/src/lib/defaults.ts → .../ngneat/helipopper/config/src/defaults.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { inject } from '@angular/core'; | ||
|
||
import { TIPPY_REF, type TippyInstance } from './tippy.types'; | ||
|
||
export function injectTippyRef(): TippyInstance { | ||
const instance = inject(TIPPY_REF, { optional: true }); | ||
|
||
if (instance) { | ||
return instance; | ||
} | ||
|
||
throw new Error('tp is not provided in the current context or on one of its ancestors'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { makeEnvironmentProviders, type Provider } from '@angular/core'; | ||
|
||
import { | ||
TIPPY_CONFIG, | ||
TIPPY_LOADER, | ||
type TippyLoader, | ||
type TippyConfig, | ||
} from './tippy.types'; | ||
|
||
export function provideTippyLoader(loader: TippyLoader) { | ||
return makeEnvironmentProviders([{ provide: TIPPY_LOADER, useValue: loader }]); | ||
} | ||
|
||
export function provideTippyConfig(config: TippyConfig): Provider { | ||
return { provide: TIPPY_CONFIG, useValue: config }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export { tooltipVariation, popperVariation, withContextMenuVariation } from './defaults'; | ||
export { | ||
CreateOptions, | ||
TippyInstance, | ||
TippyProps, | ||
ExtendedTippyProps, | ||
TippyElement, | ||
ExtendedTippyInstance, | ||
TippyConfig, | ||
TippyLoader, | ||
TIPPY_LOADER, | ||
TIPPY_REF, | ||
TIPPY_CONFIG, | ||
} from './tippy.types'; | ||
export { provideTippyLoader, provideTippyConfig } from './providers'; | ||
export { injectTippyRef } from './inject-tippy'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
export { TippyDirective } from './lib/tippy.directive'; | ||
export { tooltipVariation, popperVariation, withContextMenuVariation } from './lib/defaults'; | ||
export { TippyService } from './lib/tippy.service'; | ||
export { inView, overflowChanges } from './lib/utils'; | ||
export { ExtendedTippyInstance, TippyInstance, TIPPY_REF, TippyConfig, TIPPY_CONFIG } from './lib/tippy.types'; | ||
export { provideTippyConfig, injectTippyRef } from './lib/providers'; | ||
|
||
export { | ||
ExtendedTippyInstance, | ||
TippyInstance, | ||
TIPPY_REF, | ||
TippyConfig, | ||
TIPPY_CONFIG, | ||
tooltipVariation, | ||
popperVariation, | ||
withContextMenuVariation, | ||
provideTippyConfig, | ||
injectTippyRef, | ||
} from '@ngneat/helipopper/config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters