forty-cdk
llms.txt

Utilities

Defaults

Every provideFor<Primitive>Defaults provider, its FOR_<PRIMITIVE>_DEFAULTS token and its For<Primitive>Defaults interface, imported from forty-cdk/defaults so that configuring a primitive at the application root does not load the primitive itself.

forty-cdk/defaults

Each primitive's entry point still re-exports its own pair, so import { provideForTooltipDefaults } from 'forty-cdk/tooltip' keeps compiling. Both paths name the same token object, so a provider from one and a primitive reading the other share one scope.

import { type ApplicationConfig } from '@angular/core';
import { provideForCalendarDefaults, provideForTooltipDefaults } from 'forty-cdk/defaults';

export const appConfig: ApplicationConfig = {
  providers: [
    provideForTooltipDefaults({ openDelay: 500 }),
    provideForCalendarDefaults({ firstDayOfWeek: 1 }),
  ],
};

Why this exists

A bundler splits code into chunks one module at a time, and each forty-cdk entry point is published as a single module. A root providers array is in the static graph of your main bundle, so whatever module it imports is loaded before the application bootstraps, on every route, including the ones that never render that primitive.

Importing a provider from the primitive's own entry point therefore puts that primitive's directives in main. The re-export does not change it, because the bundler still has to load the module the re-export lives in. forty-cdk/defaults holds only the pairs and imports nothing but @angular/core, so the directives stay in the lazy chunks of the routes that render them.

Measured on a production build of an app with four lazy routes and these providers at the root, provideForTooltipDefaults, provideForCalendarDefaults, provideForComboboxDefaults and provideForMenuDefaults:

Imported frommain holdsmain size (raw / gzip)
Each primitive's entrythe Tooltip, Calendar, Combobox and Menu directives281,035 B / 83,020 B
forty-cdk/defaultsthe four defaults pairs and the tooltip's coordinator209,552 B / 63,578 B
No root providersnothing from forty-cdk206,303 B / 62,301 B

A pair you do not import is not bundled: every token is a top-level new InjectionToken(...), which a bundler drops when nothing reads it.

A date adapter follows the same rule from forty-cdk/date-adapter: NativeDateAdapter, provideNativeDateAdapter and the FOR_DATE_ADAPTER token they provide import nothing but @angular/core, so providing one next to these pairs keeps the primitives and the code they share out of main.

API

Each pair resolves the same way: a scope's overrides merge key by key over its parent scope's, and the library fallback fills the rest. A key set to undefined is treated as omitted. Pass a function instead of an object to build the overrides where inject() is available; it runs once per injector that resolves the token. The primitive's README documents its keys.

ConfiguresProviderTokenAlso exported
avatarprovideForAvatarDefaultsFOR_AVATAR_DEFAULTSForAvatarDefaults
breadcrumbsprovideForBreadcrumbsDefaultsFOR_BREADCRUMBS_DEFAULTSForBreadcrumbsDefaults
breakpointsprovideForBreakpointsDefaultsFOR_BREAKPOINTS_DEFAULTSBreakpointMap, ForBreakpointsDefaults, forBreakpointsTailwind, TailwindBreakpointName
calendarprovideForCalendarDefaultsFOR_CALENDAR_DEFAULTSForCalendarDefaults
carouselprovideForCarouselDefaultsFOR_CAROUSEL_DEFAULTSCarouselAlign, ForCarouselDefaults
comboboxprovideForComboboxDefaultsFOR_COMBOBOX_DEFAULTSForComboboxDefaults, ForComboboxOpenHighlight
context-menuprovideForContextMenuDefaultsFOR_CONTEXT_MENU_DEFAULTSForContextMenuDefaults
date-fieldprovideForDateFieldDefaultsFOR_DATE_FIELD_DEFAULTSDEFAULT_DATE_FIELD_SEGMENT_LABELS, ForDateFieldDefaults, ForDateFieldSegmentLabels
date-pickerprovideForDatePickerDefaultsFOR_DATE_PICKER_DEFAULTSForDatePickerDefaults
date-fieldprovideForDateRangeFieldDefaultsFOR_DATE_RANGE_FIELD_DEFAULTSDEFAULT_DATE_RANGE_FIELD_SEGMENT_LABELS, ForDateRangeFieldDefaults, ForDateRangeFieldSegmentLabels
date-pickerprovideForDateRangePickerDefaultsFOR_DATE_RANGE_PICKER_DEFAULTSForDateRangePickerDefaults
dialogprovideForDialogDefaultsFOR_DIALOG_DEFAULTSForDialogDefaults
drag-dropprovideForDragDropDefaultsFOR_DRAG_DROP_DEFAULTSForDragDropDefaults
drawerprovideForDrawerDefaultsFOR_DRAWER_DEFAULTSForDrawerDefaults
dropdown-menuprovideForDropdownMenuDefaultsFOR_DROPDOWN_MENU_DEFAULTSForDropdownMenuDefaults
hover-cardprovideForHoverCardDefaultsFOR_HOVER_CARD_DEFAULTSForHoverCardDefaults, HoverCardCoordinator, HoverCardDefaultsOptions
listboxprovideForListboxDefaultsFOR_LISTBOX_DEFAULTSForListboxDefaults
menubarprovideForMenubarDefaultsFOR_MENUBAR_DEFAULTSForMenubarDefaults
menuprovideForMenuDefaultsFOR_MENU_DEFAULTSForMenuDefaults
navigation-menuprovideForNavigationMenuDefaultsFOR_NAVIGATION_MENU_DEFAULTSForNavigationMenuDefaults
number-inputprovideForNumberInputDefaultsFOR_NUMBER_INPUT_DEFAULTSForNumberInputDefaults
paginationprovideForPaginationDefaultsFOR_PAGINATION_DEFAULTSForPaginationDefaults
popoverprovideForPopoverDefaultsFOR_POPOVER_DEFAULTSForPopoverDefaults
progressprovideForProgressDefaultsFOR_PROGRESS_DEFAULTSForProgressDefaults
radio-groupprovideForRadioGroupDefaultsFOR_RADIO_GROUP_DEFAULTSForRadioGroupDefaults
scroll-areaprovideForScrollAreaDefaultsFOR_SCROLL_AREA_DEFAULTSForScrollAreaDefaults, ForScrollAreaTrackPress
searchprovideForSearchDefaultsFOR_SEARCH_DEFAULTSForSearchDefaults
selectprovideForSelectDefaultsFOR_SELECT_DEFAULTSForSelectDefaults
sliderprovideForSliderDefaultsFOR_SLIDER_DEFAULTSForSliderDefaults
stepperprovideForStepperDefaultsFOR_STEPPER_DEFAULTSForStepperDefaults, StepperActivationMode
tabsprovideForTabsDefaultsFOR_TABS_DEFAULTSForTabsDefaults, TabsActivationMode
time-fieldprovideForTimeFieldDefaultsFOR_TIME_FIELD_DEFAULTSDEFAULT_TIME_FIELD_SEGMENT_LABELS, ForTimeFieldDefaults, ForTimeFieldSegmentLabels
time-pickerprovideForTimePickerDefaultsFOR_TIME_PICKER_DEFAULTSForTimePickerDefaults
time-fieldprovideForTimeRangeFieldDefaultsFOR_TIME_RANGE_FIELD_DEFAULTSDEFAULT_TIME_RANGE_FIELD_SEGMENT_LABELS, ForTimeRangeFieldDefaults, ForTimeRangeFieldSegmentLabels
toastprovideForToastDefaultsFOR_TOAST_DEFAULTSForToastDefaults, ForToastStackShift
toggleprovideForToggleDefaultsFOR_TOGGLE_DEFAULTSForToggleDefaults
toolbarprovideForToolbarDefaultsFOR_TOOLBAR_DEFAULTSForToolbarDefaults
tooltipprovideForTooltipDefaultsFOR_TOOLTIP_DEFAULTSForTooltipDefaults, TooltipCoordinator, TooltipDefaultsOptions
treeprovideForTreeDefaultsFOR_TREE_DEFAULTSForTreeDefaults

forBreakpointsTailwind is the default breakpoint map, the Tailwind CSS scale value for value. provideForBreakpointsDefaults takes a whole map and replaces it rather than merging key by key.

Skip-delay windows

Tooltips and hover cards share a skip-delay window per scope: right after one closes, the next one in the same window opens without its open delay. provideForTooltipDefaults and provideForHoverCardDefaults take a second options argument whose skipDelayScope decides whether the scope starts its own window ('own') or shares its parent's ('inherit').

ExportWhat it is
TooltipCoordinatorThe window of a tooltip scope. Inject it to read skipDelay() or to call startSkipDelay() / cancelSkipDelay() from your own code.
HoverCardCoordinatorThe same window for hover cards. It is never shared with a tooltip scope.
createSkipDelayWindow(duration)A standalone window, owned by its caller: active reads true from start() until duration() ms later, or until cancel().
SkipDelayWindowThe handle createSkipDelayWindow returns.