ng-primitives 0.120.4 → 0.121.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/example-theme/index.css +9 -0
- package/fesm2022/ng-primitives-a11y.mjs +5 -5
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-accordion.mjs +34 -51
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-ai.mjs +39 -52
- package/fesm2022/ng-primitives-ai.mjs.map +1 -1
- package/fesm2022/ng-primitives-autofill.mjs +4 -4
- package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
- package/fesm2022/ng-primitives-avatar.mjs +14 -17
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-breadcrumbs.mjs +21 -21
- package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs +7 -9
- package/fesm2022/ng-primitives-button.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +15 -30
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-combobox.mjs +60 -92
- package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/ng-primitives-common.mjs +4 -4
- package/fesm2022/ng-primitives-common.mjs.map +1 -1
- package/fesm2022/ng-primitives-context-menu.mjs +68 -121
- package/fesm2022/ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +91 -115
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs +35 -51
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +26 -53
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +5 -8
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +39 -44
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input-otp.mjs +30 -43
- package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +6 -8
- package/fesm2022/ng-primitives-input.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +31 -48
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +39 -35
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +34 -48
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +85 -151
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-meter.mjs +25 -36
- package/fesm2022/ng-primitives-meter.mjs.map +1 -1
- package/fesm2022/ng-primitives-navigation-menu.mjs +60 -108
- package/fesm2022/ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-number-field.mjs +35 -59
- package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +270 -297
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-popover.mjs +209 -223
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-portal.mjs +88 -59
- package/fesm2022/ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +30 -41
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-radio.mjs +20 -30
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-resize.mjs +3 -3
- package/fesm2022/ng-primitives-resize.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +20 -34
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs +9 -9
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-select.mjs +720 -620
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-separator.mjs +4 -6
- package/fesm2022/ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +63 -100
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs +3 -3
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +15 -21
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +31 -41
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +5 -7
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +30 -23
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +20 -36
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +10 -19
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs +4 -6
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +401 -402
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +5 -4
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/package.json +56 -55
- package/schematics/ng-generate/templates/select/select.__fileSuffix@dasherize__.ts.template +48 -48
- package/{a11y/index.d.ts → types/ng-primitives-a11y.d.ts} +18 -24
- package/{accordion/index.d.ts → types/ng-primitives-accordion.d.ts} +85 -98
- package/{autofill/index.d.ts → types/ng-primitives-autofill.d.ts} +3 -10
- package/{avatar/index.d.ts → types/ng-primitives-avatar.d.ts} +7 -30
- package/{breadcrumbs/index.d.ts → types/ng-primitives-breadcrumbs.d.ts} +15 -70
- package/{button/index.d.ts → types/ng-primitives-button.d.ts} +23 -29
- package/{checkbox/index.d.ts → types/ng-primitives-checkbox.d.ts} +68 -74
- package/{combobox/index.d.ts → types/ng-primitives-combobox.d.ts} +35 -35
- package/{context-menu/index.d.ts → types/ng-primitives-context-menu.d.ts} +2 -1
- package/{date-picker/index.d.ts → types/ng-primitives-date-picker.d.ts} +2 -2
- package/{dialog/index.d.ts → types/ng-primitives-dialog.d.ts} +7 -2
- package/{file-upload/index.d.ts → types/ng-primitives-file-upload.d.ts} +5 -20
- package/{focus-trap/index.d.ts → types/ng-primitives-focus-trap.d.ts} +3 -10
- package/{form-field/index.d.ts → types/ng-primitives-form-field.d.ts} +9 -40
- package/{input/index.d.ts → types/ng-primitives-input.d.ts} +3 -10
- package/{menu/index.d.ts → types/ng-primitives-menu.d.ts} +17 -63
- package/{navigation-menu/index.d.ts → types/ng-primitives-navigation-menu.d.ts} +15 -70
- package/{number-field/index.d.ts → types/ng-primitives-number-field.d.ts} +80 -110
- package/types/ng-primitives-pagination.d.ts +502 -0
- package/{popover/index.d.ts → types/ng-primitives-popover.d.ts} +244 -57
- package/{portal/index.d.ts → types/ng-primitives-portal.d.ts} +22 -13
- package/{progress/index.d.ts → types/ng-primitives-progress.d.ts} +3 -10
- package/{roving-focus/index.d.ts → types/ng-primitives-roving-focus.d.ts} +65 -79
- package/types/ng-primitives-select.d.ts +687 -0
- package/{separator/index.d.ts → types/ng-primitives-separator.d.ts} +3 -10
- package/{slider/index.d.ts → types/ng-primitives-slider.d.ts} +76 -138
- package/{state/index.d.ts → types/ng-primitives-state.d.ts} +26 -21
- package/{switch/index.d.ts → types/ng-primitives-switch.d.ts} +50 -64
- package/{tabs/index.d.ts → types/ng-primitives-tabs.d.ts} +9 -40
- package/{textarea/index.d.ts → types/ng-primitives-textarea.d.ts} +3 -10
- package/{toast/index.d.ts → types/ng-primitives-toast.d.ts} +13 -1
- package/{toggle-group/index.d.ts → types/ng-primitives-toggle-group.d.ts} +75 -89
- package/{toggle/index.d.ts → types/ng-primitives-toggle.d.ts} +50 -56
- package/{toolbar/index.d.ts → types/ng-primitives-toolbar.d.ts} +3 -10
- package/types/ng-primitives-tooltip.d.ts +691 -0
- package/pagination/index.d.ts +0 -211
- package/select/index.d.ts +0 -396
- package/tooltip/index.d.ts +0 -384
- /package/{ai/index.d.ts → types/ng-primitives-ai.d.ts} +0 -0
- /package/{common/index.d.ts → types/ng-primitives-common.d.ts} +0 -0
- /package/{date-time-luxon/index.d.ts → types/ng-primitives-date-time-luxon.d.ts} +0 -0
- /package/{date-time/index.d.ts → types/ng-primitives-date-time.d.ts} +0 -0
- /package/{input-otp/index.d.ts → types/ng-primitives-input-otp.d.ts} +0 -0
- /package/{interactions/index.d.ts → types/ng-primitives-interactions.d.ts} +0 -0
- /package/{internal/index.d.ts → types/ng-primitives-internal.d.ts} +0 -0
- /package/{listbox/index.d.ts → types/ng-primitives-listbox.d.ts} +0 -0
- /package/{meter/index.d.ts → types/ng-primitives-meter.d.ts} +0 -0
- /package/{radio/index.d.ts → types/ng-primitives-radio.d.ts} +0 -0
- /package/{resize/index.d.ts → types/ng-primitives-resize.d.ts} +0 -0
- /package/{search/index.d.ts → types/ng-primitives-search.d.ts} +0 -0
- /package/{utils/index.d.ts → types/ng-primitives-utils.d.ts} +0 -0
- /package/{index.d.ts → types/ng-primitives.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-state.mjs","sources":["../../../../packages/ng-primitives/state/src/index.ts","../../../../packages/ng-primitives/state/src/ng-primitives-state.ts"],"sourcesContent":["/* eslint-disable @angular-eslint/no-uncalled-signals */\nimport { coerceElement } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n afterRenderEffect,\n ChangeDetectorRef,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n FactoryProvider,\n forwardRef,\n inject,\n InjectionToken,\n InjectOptions,\n Injector,\n InputSignal,\n InputSignalWithTransform,\n isSignal,\n linkedSignal,\n NgZone,\n PLATFORM_ID,\n ProviderToken,\n runInInjectionContext,\n signal,\n Signal,\n WritableSignal,\n} from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\n\n/**\n * This converts the state object to a writable state object.\n * This means that inputs become signals which are writable.\n */\nexport type State<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any>\n ? WritableSignal<U>\n : T[K] extends InputSignal<infer R>\n ? WritableSignal<R>\n : T[K];\n};\n\n/**\n * This is similar to the state object, but we don't expose properties that are not\n * inputs.\n */\nexport type CreatedState<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any>\n ? WritableSignal<U>\n : T[K] extends InputSignal<infer R>\n ? WritableSignal<R>\n : never;\n};\n\nexport type InjectedState<T> = Signal<State<T>>;\n\n/**\n * Create a new injection token for the state.\n * @param description The description of the token\n */\nexport function createStateToken<T>(description: string): InjectionToken<T> {\n return new InjectionToken<Signal<State<T>>>(`Ngp${description}StateToken`);\n}\n\nexport interface CreateStateProviderOptions {\n /**\n * Whether we should check for the state in the parent injector.\n */\n inherit?: boolean;\n}\n\n/**\n * Create a new provider for the state. It first tries to inject the state from the parent injector,\n * as this allows for the state to be hoisted to a higher level in the component tree. This can\n * be useful to avoid issues where the injector can't be shared in some cases when ng-content is used.\n * @param token The token for the state\n */\nexport function createStateProvider<T>(\n token: ProviderToken<T>,\n): (options?: CreateStateProviderOptions) => FactoryProvider {\n return ({ inherit }: CreateStateProviderOptions = {}) => ({\n provide: token,\n useFactory: () => {\n if (inherit === false) {\n // if we are not checking the parent, we want to create a new state\n return signal({});\n }\n // if we are checking the parent, we want to check if the state is already defined\n return inject(token, { optional: true, skipSelf: true }) ?? signal({});\n },\n });\n}\n\ntype CreateStateInjectorOptions = {\n /**\n * Whether the state may not be immediately available. This can happen when the child is instantiated before the parent.\n */\n deferred?: boolean;\n};\n\n/**\n * Create a new state injector for the state.\n * @param token The token for the state\n */\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: { deferred: true },\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U> | undefined>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options?: CreateStateInjectorOptions,\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U>>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: CreateStateInjectorOptions = {},\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U> | undefined> {\n return <U = T>(injectOptions: InjectOptions = {}) => {\n const value = inject(token, injectOptions) as Signal<State<U> | undefined> | null;\n\n if (options.deferred) {\n return computed(() =>\n value && Object.keys(value() ?? {}).length === 0 ? undefined : value?.(),\n ) as Signal<State<U> | undefined>;\n }\n\n return (value as Signal<State<U>>) ?? signal(undefined);\n };\n}\n\n/**\n * Convert the original state object into a writable state object.\n * @param token The token for the state\n */\nexport function createState(token: ProviderToken<WritableSignal<State<unknown>>>) {\n return <U>(state: U): CreatedState<U> => {\n const internalState = inject(token);\n\n internalState.update(obj => {\n // Iterating over properties\n for (const key in state) {\n const value = state[key as keyof U];\n\n // We want to make this a controlled input if it is an InputSignal or InputSignalWithTransform\n if (isSignalInput(value)) {\n // @ts-ignore\n obj[key] = createControlledInput(value);\n } else {\n // @ts-ignore\n obj[key] = value;\n }\n }\n\n // Iterating over prototype methods\n const prototype = Object.getPrototypeOf(state);\n\n for (const key of Object.getOwnPropertyNames(prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, key);\n\n // if this is a getter or setter, we need to define it on the object\n if (descriptor?.get || descriptor?.set) {\n Object.defineProperty(obj, key, descriptor);\n } else if (typeof prototype[key as keyof U] === 'function') {\n (obj as Record<string, unknown>)[key] = prototype[key as keyof U].bind(state);\n } else {\n // @ts-ignore\n obj[key] = prototype[key as keyof U];\n }\n }\n\n return { ...obj };\n });\n\n return internalState() as unknown as CreatedState<U>;\n };\n}\n\n// this is a bit hacky, but we need to do it to track whether this is controlled\nfunction createControlledInput(\n property: InputSignal<unknown> | InputSignalWithTransform<unknown, unknown>,\n): WritableSignal<unknown> {\n const value = signal(property());\n let isControlled = false;\n\n const symbol = Object.getOwnPropertySymbols(property).find(s => s.description === 'SIGNAL');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const inputDefinition = symbol ? (property as any)[symbol] : undefined;\n\n if (\n !symbol ||\n !inputDefinition ||\n typeof inputDefinition.applyValueToInputSignal !== 'function'\n ) {\n console.warn(\n 'Angular has changed its internal Input implementation, report this issue to ng-primitives.',\n );\n // fallback to a linked signal which is partially controlled\n return linkedSignal(() => property());\n }\n\n const originalApply = inputDefinition.applyValueToInputSignal.bind(inputDefinition);\n const originalSet = value.set.bind(value);\n const originalUpdate = value.update.bind(value);\n\n inputDefinition.applyValueToInputSignal = (inputSignalNode: unknown, newValue: unknown) => {\n isControlled = true;\n originalSet(newValue);\n originalApply(inputSignalNode, newValue);\n };\n\n value.set = (newValue: unknown) => {\n if (!isControlled) {\n originalSet(newValue);\n }\n };\n\n value.update = (updateFn: (value: unknown) => unknown) => {\n if (!isControlled) {\n originalUpdate(updateFn);\n }\n };\n\n return value;\n}\n\nfunction isSignalInput(\n property: unknown,\n): property is InputSignal<unknown> | InputSignalWithTransform<unknown, unknown> {\n if (!isSignal(property)) {\n return false;\n }\n\n const symbol = Object.getOwnPropertySymbols(property).find(s => s.description === 'SIGNAL');\n\n if (!symbol) {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const inputDefinition = symbol ? (property as any)[symbol] : undefined;\n\n if (!inputDefinition) {\n return false;\n }\n\n return 'transformFn' in inputDefinition || 'applyValueToInputSignal' in inputDefinition;\n}\n\nexport interface CreatePrimitiveOptions {\n injector?: Injector;\n elementRef?: ElementRef<HTMLElement>;\n}\n\ntype PrimitiveState<TFactory extends (...args: any[]) => unknown> = TFactory extends (\n props: unknown,\n) => infer R\n ? R\n : TFactory extends (...args: any[]) => infer R\n ? R\n : never;\n\ntype BasePrimitiveInjectionFn<TState> = {\n (): Signal<TState>;\n (options: { hoisted: true; optional?: boolean; skipSelf?: boolean }): Signal<TState | null>;\n (options?: {\n hoisted?: boolean;\n optional?: boolean;\n skipSelf?: boolean;\n }): Signal<TState | null> | Signal<TState>;\n};\n\ntype PrimitiveInjectionFn<TFactory extends (...args: any[]) => unknown> = TFactory extends (\n props: unknown,\n) => infer R\n ? {\n (): Signal<R>;\n (options: { hoisted: true; optional?: boolean; skipSelf?: boolean }): Signal<R | null>;\n (options?: {\n hoisted?: boolean;\n optional?: boolean;\n skipSelf?: boolean;\n }): Signal<R | null> | Signal<R>;\n }\n : BasePrimitiveInjectionFn<PrimitiveState<TFactory>>;\n\nexport function createPrimitive<TFactory extends (...args: any[]) => unknown>(\n name: string,\n fn: TFactory,\n options?: CreatePrimitiveOptions,\n): [\n InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,\n TFactory,\n PrimitiveInjectionFn<TFactory>,\n (opts?: { inherit?: boolean }) => FactoryProvider,\n];\nexport function createPrimitive<TFactory extends (...args: any[]) => unknown>(\n name: string,\n fn: TFactory,\n options: CreatePrimitiveOptions = {},\n): [\n InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,\n TFactory,\n PrimitiveInjectionFn<TFactory>,\n (opts?: { inherit?: boolean }) => FactoryProvider,\n] {\n // Create a unique injection token for the primitive's state signal\n const token = new InjectionToken<WritableSignal<PrimitiveState<TFactory>>>(`Primitive: ${name}`);\n\n // Create the state signal within the appropriate injection context\n const factory = ((props: Parameters<TFactory>[0]) => {\n // determine the injector to use\n let injector = options.injector ?? inject(Injector);\n\n // If an ElementRef is provided in options, create a child injector\n if (options.elementRef) {\n injector = Injector.create({\n providers: [{ provide: ElementRef, useValue: options.elementRef }],\n parent: injector,\n });\n }\n\n return runInInjectionContext(injector, () => {\n const state = inject(token, { optional: true });\n const instance = fn(props);\n state?.set(instance as PrimitiveState<TFactory>);\n return instance;\n });\n }) as TFactory;\n\n // create an injection function that provides the state signal\n function injectFn<T = PrimitiveState<TFactory>>(): Signal<T>;\n function injectFn<T = PrimitiveState<TFactory>>(\n options: { hoisted: true } & InjectOptions,\n ): Signal<T | null>;\n function injectFn<T = PrimitiveState<TFactory>>(options?: {\n hoisted?: boolean;\n optional?: boolean;\n skipSelf?: boolean;\n }): Signal<T | null> | Signal<T> {\n const hoisted = options?.hoisted ?? false;\n const optional = options?.optional ?? false;\n const skipSelf = options?.skipSelf ?? false;\n\n if (hoisted || optional) {\n return (inject(token, { optional: true, skipSelf }) ??\n signal(null)) as unknown as Signal<T | null>;\n }\n\n return inject(token, { optional, skipSelf }) as unknown as Signal<T>;\n }\n\n // create a function to provide the state\n const provideFn = (opts?: { inherit?: boolean }): FactoryProvider => {\n const inherit = opts?.inherit ?? true;\n return {\n provide: token,\n useFactory: () => {\n if (inherit === false) {\n return signal(null);\n }\n\n return inject(token, { optional: true, skipSelf: true }) ?? signal(null);\n },\n };\n };\n\n return [token, factory as TFactory, injectFn as PrimitiveInjectionFn<TFactory>, provideFn];\n}\n\nexport function controlled<T>(value: Signal<T>): WritableSignal<T>;\nexport function controlled<T>(value: Signal<T> | undefined, defaultValue: T): WritableSignal<T>;\nexport function controlled<T>(value: Signal<T> | undefined, defaultValue?: T): WritableSignal<T> {\n return value ? linkedSignal(() => value()) : signal(defaultValue as T);\n}\n\nexport interface ControlledStateOptions<T> {\n /**\n * The controlled value signal. When defined (not `undefined`), the component\n * is in controlled mode and this value always wins.\n */\n readonly value: Signal<T | undefined>;\n /**\n * The default value signal for uncontrolled mode.\n */\n readonly defaultValue?: Signal<T>;\n /**\n * Callback fired when the value changes.\n */\n readonly onChange?: (value: T) => void;\n}\n\nexport interface SetterOptions {\n /**\n * Whether to fire `onChange` and emit on the `change` observable.\n * Defaults to `true`. Set to `false` for cases like form `writeValue`\n * where the internal state should sync without notifying listeners.\n */\n readonly emit?: boolean;\n}\n\nexport type ControlledState<T> = [\n value: Signal<T>,\n set: (value: T, options?: SetterOptions) => void,\n change: Observable<T>,\n];\n\nexport function controlledState<T>({\n value,\n onChange,\n defaultValue,\n}: ControlledStateOptions<T>): ControlledState<T> {\n const change = emitter<T>();\n const UNSET = Symbol('UNSET');\n const userValue = signal<T | typeof UNSET>(UNSET);\n\n // Latching flag: once the controlled value has been defined, the component\n // is permanently controlled and set() must not update internal state.\n // This is intentionally mutated inside `resolved` — it must latch\n // synchronously during signal evaluation so that set() sees the correct\n // state. A pure computation cannot express \"once true, always true\" without\n // external state.\n let isControlled = value() !== undefined;\n\n const resolved = linkedSignal(() => {\n const v = value();\n if (v !== undefined) {\n isControlled = true;\n return v;\n }\n const uv = userValue();\n return uv !== UNSET ? (uv as T) : defaultValue?.();\n });\n\n function set(newValue: T, options?: SetterOptions) {\n if (resolved() === newValue && options?.emit !== false) {\n return;\n }\n if (!isControlled) {\n userValue.set(newValue);\n }\n if (options?.emit !== false) {\n onChange?.(newValue);\n change.emit(newValue);\n }\n }\n\n return [resolved.asReadonly() as Signal<T>, set, change.asObservable()];\n}\n\nfunction setAttribute(\n element: ElementRef<HTMLElement>,\n attr: string,\n value: string | null | undefined,\n): void {\n // if the attribute is \"disabled\" and the value is 'false', we need to remove the attribute\n if (attr === 'disabled' && value === 'false') {\n element.nativeElement.removeAttribute(attr);\n return;\n }\n\n if (value !== null && value !== undefined) {\n element.nativeElement.setAttribute(attr, value);\n } else {\n element.nativeElement.removeAttribute(attr);\n }\n}\n\nexport function attrBinding(\n element: ElementRef<HTMLElement>,\n attr: string,\n value:\n | (() => string | number | boolean | null | undefined)\n | string\n | number\n | boolean\n | null\n | undefined,\n): void {\n // If the value is static (not a function), set it immediately without an effect\n if (typeof value !== 'function') {\n setAttribute(element, attr, value?.toString() ?? null);\n return;\n }\n\n isomorphicEffect(() => {\n const valueResult = value();\n setAttribute(element, attr, valueResult?.toString() ?? null);\n });\n}\n\nfunction getStyleUnit(style: string): string {\n const parts = style.split('.');\n\n if (parts.length > 1) {\n const unit = parts[parts.length - 1];\n\n switch (unit) {\n case 'px':\n case 'em':\n case 'rem':\n case '%':\n case 'vh':\n case 'vw':\n case 'vmin':\n case 'vmax':\n case 'cm':\n case 'mm':\n case 'in':\n case 'pt':\n case 'pc':\n case 'ex':\n case 'ch':\n return unit;\n default:\n return '';\n }\n }\n\n return '';\n}\n\nexport function styleBinding(\n element: ElementRef<HTMLElement>,\n style: string,\n value: (() => string | number | null) | string | number | null,\n): void {\n isomorphicEffect(() => {\n const styleValue = typeof value === 'function' ? value() : value;\n // we should look for units in the style name, just like Angular does e.g. width.px\n const styleUnit = getStyleUnit(style);\n const styleName = styleUnit ? style.replace(`.${styleUnit}`, '') : style;\n\n if (styleValue !== null) {\n element.nativeElement.style.setProperty(styleName, styleValue + styleUnit);\n } else {\n element.nativeElement.style.removeProperty(styleName);\n }\n });\n}\n\nexport function dataBinding(\n element: ElementRef<HTMLElement>,\n attr: string,\n value: (() => string | boolean | null) | string | boolean | null,\n): void {\n if (!attr.startsWith('data-')) {\n throw new Error(`dataBinding: attribute \"${attr}\" must start with \"data-\"`);\n }\n\n isomorphicEffect(() => {\n let valueResult = typeof value === 'function' ? value() : value;\n\n if (valueResult === false) {\n valueResult = null;\n } else if (valueResult === true) {\n valueResult = '';\n } else if (valueResult !== null && typeof valueResult !== 'string') {\n valueResult = String(valueResult);\n }\n\n setAttribute(element, attr, valueResult);\n });\n}\n\nexport function listener<K extends keyof HTMLElementEventMap>(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: K,\n handler: (event: HTMLElementEventMap[K]) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void;\nexport function listener(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: string,\n handler: (event: Event) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void;\nexport function listener<K extends keyof HTMLElementEventMap>(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: K | string,\n handler: (event: HTMLElementEventMap[K] | Event) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void {\n return runInInjectionContext(options?.injector ?? inject(Injector), () => {\n const ngZone = inject(NgZone);\n const destroyRef = inject(DestroyRef);\n const nativeElement = coerceElement(element);\n\n const removeListener = () =>\n nativeElement.removeEventListener(event, handler as EventListener, options?.config);\n destroyRef.onDestroy(removeListener);\n ngZone.runOutsideAngular(() =>\n nativeElement.addEventListener(event, handler as EventListener, options?.config),\n );\n\n return removeListener;\n });\n}\n\nexport function onMount(callback: () => void): void {\n const injector = inject(Injector);\n afterRenderEffect(() => runInInjectionContext(injector, callback), { injector });\n}\n\nexport function onDestroy(callback: () => void): void {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(callback);\n}\n\n/**\n * Previously, with our state approach, we allowed signals to be written directly using their setters.\n * However, with our new approach, we want people to use the appropriate set method instead. This function takes in a writable\n * signal and returns a proxy that warns the user when set is called directly.\n */\nexport function deprecatedSetter<T>(\n signal: WritableSignal<T>,\n methodName: string,\n): WritableSignal<T>;\nexport function deprecatedSetter<T>(\n signal: Signal<T>,\n methodName: string,\n setter: (value: T) => void,\n): WritableSignal<T>;\nexport function deprecatedSetter<T>(\n signal: Signal<T>,\n methodName: string,\n setter?: (value: T) => void,\n): WritableSignal<T> {\n return new Proxy(signal as WritableSignal<T>, {\n get(target, prop) {\n if (prop === 'set') {\n return (value: T) => {\n console.warn(\n `Deprecation warning: Use ${methodName}() instead of setting the value directly.`,\n );\n if (setter) {\n setter(value);\n } else {\n (target as WritableSignal<T>).set(value);\n }\n };\n }\n if (prop === 'update') {\n return (updateFn: (value: T) => T) => {\n console.warn(\n `Deprecation warning: Use ${methodName}() instead of setting the value directly.`,\n );\n const newValue = updateFn(target());\n if (setter) {\n setter(newValue);\n } else {\n (target as WritableSignal<T>).set(newValue);\n }\n };\n }\n return target[prop as keyof WritableSignal<T>];\n },\n });\n}\n\n/**\n * A utility function to inject an inherited state from a parent injector. This is useful for cases\n * where a primitive needs to inherit state from a parent primitive, such as in roving focus groups.\n * We could use inject with a forwardRef, but forwardRef returns an any - no thanks...\n */\nexport function injectInheritedState<T>(\n token: () => InjectionToken<T>,\n injectOptions: InjectOptions = {},\n): T | null {\n return (\n inject<T>(\n forwardRef(() => token()),\n { optional: true, skipSelf: true, ...injectOptions },\n ) ?? null\n );\n}\n\nexport interface Emitter<T> {\n emit(value: T): void;\n asObservable(): Observable<T>;\n}\n\n/**\n * An emitter is a simple wrapper around a Subject that ensures\n * that change detection is run when an event is emitted and that\n * the subject is automatically completed when the component is destroyed.\n */\nexport function emitter<T>({\n injector = inject(Injector),\n}: { injector?: Injector } = {}): Emitter<T> {\n return runInInjectionContext(injector, () => {\n const eventEmitter = new Subject<T>();\n const changeDetector = inject(ChangeDetectorRef);\n\n // Complete the subject on destroy\n onDestroy(() => eventEmitter.complete());\n\n return {\n emit(value: T): void {\n eventEmitter.next(value);\n queueMicrotask(() => changeDetector.markForCheck());\n },\n asObservable(): Observable<T> {\n return eventEmitter.asObservable();\n },\n };\n });\n}\n\nfunction isomorphicEffect(callback: () => void): void {\n const injector = inject(Injector);\n const platformId = injector.get(PLATFORM_ID);\n\n if (isPlatformBrowser(platformId)) {\n afterRenderEffect(() => callback());\n } else {\n // On the server, we just run the effect immediately\n effect(() => callback());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AA0DA;;;AAGG;AACG,SAAU,gBAAgB,CAAI,WAAmB,EAAA;AACrD,IAAA,OAAO,IAAI,cAAc,CAAmB,MAAM,WAAW,CAAA,UAAA,CAAY,CAAC;AAC5E;AASA;;;;;AAKG;AACG,SAAU,mBAAmB,CACjC,KAAuB,EAAA;IAEvB,OAAO,CAAC,EAAE,OAAO,EAAA,GAAiC,EAAE,MAAM;AACxD,QAAA,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,MAAK;AACf,YAAA,IAAI,O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pC,CAAC;SACF;AACH,IAAA,CAAC,CAAC;AACJ;AAEA,SAAS,gBAAgB,CAAC,QAAoB,EAAA;AAC5C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;AAE5C,IAAA,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE;AACjC,QAAA,iBAAiB,CAAC,MAAM,QAAQ,EAAE,CAAC;IACrC;SAAO;;AAEL,QAAA,MAAM,CAAC,MAAM,QAAQ,EAAE,CAAC;IAC1B;AACF;;AC/sBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-state.mjs","sources":["../../../../packages/ng-primitives/state/src/index.ts","../../../../packages/ng-primitives/state/src/ng-primitives-state.ts"],"sourcesContent":["/* eslint-disable @angular-eslint/no-uncalled-signals */\nimport { coerceElement } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n afterRenderEffect,\n ChangeDetectorRef,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n FactoryProvider,\n forwardRef,\n inject,\n InjectionToken,\n InjectOptions,\n Injector,\n InputSignal,\n InputSignalWithTransform,\n isSignal,\n linkedSignal,\n NgZone,\n PLATFORM_ID,\n ProviderToken,\n runInInjectionContext,\n signal,\n Signal,\n WritableSignal,\n} from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\n\n/**\n * This converts the state object to a writable state object.\n * This means that inputs become signals which are writable.\n */\nexport type State<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any>\n ? WritableSignal<U>\n : T[K] extends InputSignal<infer R>\n ? WritableSignal<R>\n : T[K];\n};\n\n/**\n * This is similar to the state object, but we don't expose properties that are not\n * inputs.\n */\nexport type CreatedState<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any>\n ? WritableSignal<U>\n : T[K] extends InputSignal<infer R>\n ? WritableSignal<R>\n : never;\n};\n\nexport type InjectedState<T> = Signal<State<T>>;\n\n/**\n * Create a new injection token for the state.\n * @param description The description of the token\n */\nexport function createStateToken<T>(description: string): InjectionToken<T> {\n return new InjectionToken<Signal<State<T>>>(`Ngp${description}StateToken`);\n}\n\nexport interface CreateStateProviderOptions {\n /**\n * Whether we should check for the state in the parent injector.\n */\n inherit?: boolean;\n}\n\nexport type StateInjectionOptions =\n | {\n hoisted?: boolean;\n optional?: boolean;\n skipSelf?: boolean;\n }\n | undefined;\n\n/**\n * Create a new provider for the state. It first tries to inject the state from the parent injector,\n * as this allows for the state to be hoisted to a higher level in the component tree. This can\n * be useful to avoid issues where the injector can't be shared in some cases when ng-content is used.\n * @param token The token for the state\n */\nexport function createStateProvider<T>(\n token: ProviderToken<T>,\n): (options?: CreateStateProviderOptions) => FactoryProvider {\n return ({ inherit }: CreateStateProviderOptions = {}) => ({\n provide: token,\n useFactory: () => {\n if (inherit === false) {\n // if we are not checking the parent, we want to create a new state\n return signal({});\n }\n // if we are checking the parent, we want to check if the state is already defined\n return inject(token, { optional: true, skipSelf: true }) ?? signal({});\n },\n });\n}\n\ntype CreateStateInjectorOptions = {\n /**\n * Whether the state may not be immediately available. This can happen when the child is instantiated before the parent.\n */\n deferred?: boolean;\n};\n\n/**\n * Create a new state injector for the state.\n * @param token The token for the state\n */\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: { deferred: true },\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U> | undefined>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options?: CreateStateInjectorOptions,\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U>>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: CreateStateInjectorOptions = {},\n): <U = T>(injectOptions?: InjectOptions) => Signal<State<U> | undefined> {\n return <U = T>(injectOptions: InjectOptions = {}) => {\n const value = inject(token, injectOptions) as Signal<State<U> | undefined> | null;\n\n if (options.deferred) {\n return computed(() =>\n value && Object.keys(value() ?? {}).length === 0 ? undefined : value?.(),\n ) as Signal<State<U> | undefined>;\n }\n\n return (value as Signal<State<U>>) ?? signal(undefined);\n };\n}\n\n/**\n * Convert the original state object into a writable state object.\n * @param token The token for the state\n */\nexport function createState(token: ProviderToken<WritableSignal<State<unknown>>>) {\n return <U>(state: U): CreatedState<U> => {\n const internalState = inject(token);\n\n internalState.update(obj => {\n // Iterating over properties\n for (const key in state) {\n const value = state[key as keyof U];\n\n // We want to make this a controlled input if it is an InputSignal or InputSignalWithTransform\n if (isSignalInput(value)) {\n // @ts-ignore\n obj[key] = createControlledInput(value);\n } else {\n // @ts-ignore\n obj[key] = value;\n }\n }\n\n // Iterating over prototype methods\n const prototype = Object.getPrototypeOf(state);\n\n for (const key of Object.getOwnPropertyNames(prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, key);\n\n // if this is a getter or setter, we need to define it on the object\n if (descriptor?.get || descriptor?.set) {\n Object.defineProperty(obj, key, descriptor);\n } else if (typeof prototype[key as keyof U] === 'function') {\n (obj as Record<string, unknown>)[key] = prototype[key as keyof U].bind(state);\n } else {\n // @ts-ignore\n obj[key] = prototype[key as keyof U];\n }\n }\n\n return { ...obj };\n });\n\n return internalState() as unknown as CreatedState<U>;\n };\n}\n\n// this is a bit hacky, but we need to do it to track whether this is controlled\nfunction createControlledInput(\n property: InputSignal<unknown> | InputSignalWithTransform<unknown, unknown>,\n): WritableSignal<unknown> {\n const value = signal(property());\n let isControlled = false;\n\n const symbol = Object.getOwnPropertySymbols(property).find(s => s.description === 'SIGNAL');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const inputDefinition = symbol ? (property as any)[symbol] : undefined;\n\n if (\n !symbol ||\n !inputDefinition ||\n typeof inputDefinition.applyValueToInputSignal !== 'function'\n ) {\n console.warn(\n 'Angular has changed its internal Input implementation, report this issue to ng-primitives.',\n );\n // fallback to a linked signal which is partially controlled\n return linkedSignal(() => property());\n }\n\n const originalApply = inputDefinition.applyValueToInputSignal.bind(inputDefinition);\n const originalSet = value.set.bind(value);\n const originalUpdate = value.update.bind(value);\n\n inputDefinition.applyValueToInputSignal = (inputSignalNode: unknown, newValue: unknown) => {\n isControlled = true;\n originalSet(newValue);\n originalApply(inputSignalNode, newValue);\n };\n\n value.set = (newValue: unknown) => {\n if (!isControlled) {\n originalSet(newValue);\n }\n };\n\n value.update = (updateFn: (value: unknown) => unknown) => {\n if (!isControlled) {\n originalUpdate(updateFn);\n }\n };\n\n return value;\n}\n\nfunction isSignalInput(\n property: unknown,\n): property is InputSignal<unknown> | InputSignalWithTransform<unknown, unknown> {\n if (!isSignal(property)) {\n return false;\n }\n\n const symbol = Object.getOwnPropertySymbols(property).find(s => s.description === 'SIGNAL');\n\n if (!symbol) {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const inputDefinition = symbol ? (property as any)[symbol] : undefined;\n\n if (!inputDefinition) {\n return false;\n }\n\n return 'transformFn' in inputDefinition || 'applyValueToInputSignal' in inputDefinition;\n}\n\nexport interface CreatePrimitiveOptions {\n injector?: Injector;\n elementRef?: ElementRef<HTMLElement>;\n}\n\ntype PrimitiveState<TFactory extends (...args: any[]) => unknown> = TFactory extends (\n props: unknown,\n) => infer R\n ? R\n : TFactory extends (...args: any[]) => infer R\n ? R\n : never;\n\ntype BasePrimitiveInjectionFn<TState> = {\n (): Signal<TState>;\n (options: StateInjectionOptions): Signal<TState | null>;\n (options?: StateInjectionOptions): Signal<TState | null> | Signal<TState>;\n};\n\ntype PrimitiveInjectionFn<TFactory extends (...args: any[]) => unknown> = TFactory extends (\n props: unknown,\n) => infer R\n ? {\n (): Signal<R>;\n (options: StateInjectionOptions): Signal<R | null>;\n (options?: StateInjectionOptions): Signal<R | null> | Signal<R>;\n }\n : BasePrimitiveInjectionFn<PrimitiveState<TFactory>>;\n\nexport function createPrimitive<TFactory extends (...args: any[]) => unknown>(\n name: string,\n fn: TFactory,\n options?: CreatePrimitiveOptions,\n): [\n InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,\n TFactory,\n PrimitiveInjectionFn<TFactory>,\n (opts?: { inherit?: boolean }) => FactoryProvider,\n];\nexport function createPrimitive<TFactory extends (...args: any[]) => unknown>(\n name: string,\n fn: TFactory,\n options: CreatePrimitiveOptions = {},\n): [\n InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,\n TFactory,\n PrimitiveInjectionFn<TFactory>,\n (opts?: { inherit?: boolean }) => FactoryProvider,\n] {\n // Create a unique injection token for the primitive's state signal\n const token = new InjectionToken<WritableSignal<PrimitiveState<TFactory>>>(`Primitive: ${name}`);\n\n // Create the state signal within the appropriate injection context\n const factory = ((props: Parameters<TFactory>[0]) => {\n // determine the injector to use\n let injector = options.injector ?? inject(Injector);\n\n // If an ElementRef is provided in options, create a child injector\n if (options.elementRef) {\n injector = Injector.create({\n providers: [{ provide: ElementRef, useValue: options.elementRef }],\n parent: injector,\n });\n }\n\n return runInInjectionContext(injector, () => {\n const state = inject(token, { optional: true });\n const instance = fn(props);\n state?.set(instance as PrimitiveState<TFactory>);\n return instance;\n });\n }) as TFactory;\n\n // create an injection function that provides the state signal\n function injectFn<T = PrimitiveState<TFactory>>(): Signal<T>;\n function injectFn<T = PrimitiveState<TFactory>>(\n options: { hoisted: true } & InjectOptions,\n ): Signal<T | null>;\n function injectFn<T = PrimitiveState<TFactory>>(\n options?: StateInjectionOptions,\n ): Signal<T | null> | Signal<T> {\n const hoisted = options?.hoisted ?? false;\n const optional = options?.optional ?? false;\n const skipSelf = options?.skipSelf ?? false;\n\n if (hoisted || optional) {\n return (inject(token, { optional: true, skipSelf }) ??\n signal(null)) as unknown as Signal<T | null>;\n }\n\n return inject(token, { optional, skipSelf }) as unknown as Signal<T>;\n }\n\n // create a function to provide the state\n const provideFn = (opts?: { inherit?: boolean }): FactoryProvider => {\n const inherit = opts?.inherit ?? true;\n return {\n provide: token,\n useFactory: () => {\n if (inherit === false) {\n return signal(null);\n }\n\n return inject(token, { optional: true, skipSelf: true }) ?? signal(null);\n },\n };\n };\n\n return [token, factory as TFactory, injectFn as PrimitiveInjectionFn<TFactory>, provideFn];\n}\n\n/**\n * Wraps an external signal in a `linkedSignal` so it can be written to internally\n * while still re-syncing whenever the source input changes.\n *\n * Only use this when the primitive needs to mutate the value internally (e.g. a\n * setter, toggle, or other internal update) but must also remain in sync with the\n * input. If the value is read-only — passed straight through to bindings or exposed\n * to consumers without internal mutation — use the input signal directly instead.\n *\n * When `value` is `undefined`, falls back to a plain writable signal seeded with\n * `defaultValue`, supporting uncontrolled usage.\n *\n * @param value - The external signal to synchronize with\n * @param defaultValue - The default value to use when `value` is `undefined`\n * @returns A writable signal linked to the external signal\n */\nexport function controlled<T>(value: Signal<T>): WritableSignal<T>;\nexport function controlled<T>(value: Signal<T> | undefined, defaultValue: T): WritableSignal<T>;\nexport function controlled<T>(value: Signal<T> | undefined, defaultValue?: T): WritableSignal<T> {\n return value ? linkedSignal(() => value()) : signal(defaultValue as T);\n}\n\nexport interface ControlledStateOptions<T> {\n /**\n * The controlled value signal. When defined (not `undefined`), the component\n * is in controlled mode and this value always wins.\n */\n readonly value: Signal<T | undefined>;\n /**\n * The default value signal for uncontrolled mode.\n */\n readonly defaultValue?: Signal<T>;\n /**\n * Callback fired when the value changes.\n */\n readonly onChange?: (value: T) => void;\n}\n\nexport interface SetterOptions {\n /**\n * Whether to fire `onChange` and emit on the `change` observable.\n * Defaults to `true`. Set to `false` for cases like form `writeValue`\n * where the internal state should sync without notifying listeners.\n */\n readonly emit?: boolean;\n}\n\nexport type ControlledState<T> = [\n value: Signal<T>,\n set: (value: T, options?: SetterOptions) => void,\n change: Observable<T>,\n];\n\nexport function controlledState<T>({\n value,\n onChange,\n defaultValue,\n}: ControlledStateOptions<T>): ControlledState<T> {\n const change = emitter<T>();\n const UNSET = Symbol('UNSET');\n const userValue = signal<T | typeof UNSET>(UNSET);\n\n // Latching flag: once the controlled value has been defined, the component\n // is permanently controlled and set() must not update internal state.\n // This is intentionally mutated inside `resolved` — it must latch\n // synchronously during signal evaluation so that set() sees the correct\n // state. A pure computation cannot express \"once true, always true\" without\n // external state.\n let isControlled = value() !== undefined;\n\n const resolved = linkedSignal(() => {\n const v = value();\n if (v !== undefined) {\n isControlled = true;\n return v;\n }\n const uv = userValue();\n return uv !== UNSET ? (uv as T) : defaultValue?.();\n });\n\n function set(newValue: T, options?: SetterOptions) {\n if (resolved() === newValue && options?.emit !== false) {\n return;\n }\n if (!isControlled) {\n userValue.set(newValue);\n }\n if (options?.emit !== false) {\n onChange?.(newValue);\n change.emit(newValue);\n }\n }\n\n return [resolved.asReadonly() as Signal<T>, set, change.asObservable()];\n}\n\nfunction setAttribute(\n element: ElementRef<HTMLElement>,\n attr: string,\n value: string | null | undefined,\n): void {\n // if the attribute is \"disabled\" and the value is 'false', we need to remove the attribute\n if (attr === 'disabled' && value === 'false') {\n element.nativeElement.removeAttribute(attr);\n return;\n }\n\n if (value !== null && value !== undefined) {\n element.nativeElement.setAttribute(attr, value);\n } else {\n element.nativeElement.removeAttribute(attr);\n }\n}\n\nexport function attrBinding(\n element: ElementRef<HTMLElement>,\n attr: string,\n value:\n | (() => string | number | boolean | null | undefined)\n | string\n | number\n | boolean\n | null\n | undefined,\n): void {\n // If the value is static (not a function), set it immediately without an effect\n if (typeof value !== 'function') {\n setAttribute(element, attr, value?.toString() ?? null);\n return;\n }\n\n isomorphicEffect(() => {\n const valueResult = value();\n setAttribute(element, attr, valueResult?.toString() ?? null);\n });\n}\n\nfunction getStyleUnit(style: string): string {\n const parts = style.split('.');\n\n if (parts.length > 1) {\n const unit = parts[parts.length - 1];\n\n switch (unit) {\n case 'px':\n case 'em':\n case 'rem':\n case '%':\n case 'vh':\n case 'vw':\n case 'vmin':\n case 'vmax':\n case 'cm':\n case 'mm':\n case 'in':\n case 'pt':\n case 'pc':\n case 'ex':\n case 'ch':\n return unit;\n default:\n return '';\n }\n }\n\n return '';\n}\n\nexport function styleBinding(\n element: ElementRef<HTMLElement>,\n style: string,\n value: (() => string | number | null) | string | number | null,\n): void {\n isomorphicEffect(() => {\n const styleValue = typeof value === 'function' ? value() : value;\n // we should look for units in the style name, just like Angular does e.g. width.px\n const styleUnit = getStyleUnit(style);\n const styleName = styleUnit ? style.replace(`.${styleUnit}`, '') : style;\n\n if (styleValue !== null) {\n element.nativeElement.style.setProperty(styleName, styleValue + styleUnit);\n } else {\n element.nativeElement.style.removeProperty(styleName);\n }\n });\n}\n\nexport function dataBinding(\n element: ElementRef<HTMLElement>,\n attr: string,\n value: (() => string | boolean | null) | string | boolean | null,\n): void {\n if (!attr.startsWith('data-')) {\n throw new Error(`dataBinding: attribute \"${attr}\" must start with \"data-\"`);\n }\n\n isomorphicEffect(() => {\n let valueResult = typeof value === 'function' ? value() : value;\n\n if (valueResult === false) {\n valueResult = null;\n } else if (valueResult === true) {\n valueResult = '';\n } else if (valueResult !== null && typeof valueResult !== 'string') {\n valueResult = String(valueResult);\n }\n\n setAttribute(element, attr, valueResult);\n });\n}\n\nexport function listener<K extends keyof HTMLElementEventMap>(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: K,\n handler: (event: HTMLElementEventMap[K]) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void;\nexport function listener(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: string,\n handler: (event: Event) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void;\nexport function listener<K extends keyof HTMLElementEventMap>(\n element: HTMLElement | ElementRef<HTMLElement> | Document,\n event: K | string,\n handler: (event: HTMLElementEventMap[K] | Event) => void,\n options?: { injector?: Injector; config?: AddEventListenerOptions | boolean },\n): () => void {\n return runInInjectionContext(options?.injector ?? inject(Injector), () => {\n const ngZone = inject(NgZone);\n const destroyRef = inject(DestroyRef);\n const nativeElement = coerceElement(element);\n\n const removeListener = () =>\n nativeElement.removeEventListener(event, handler as EventListener, options?.config);\n destroyRef.onDestroy(removeListener);\n ngZone.runOutsideAngular(() =>\n nativeElement.addEventListener(event, handler as EventListener, options?.config),\n );\n\n return removeListener;\n });\n}\n\nexport function onMount(callback: () => void): void {\n const injector = inject(Injector);\n afterRenderEffect(() => runInInjectionContext(injector, callback), { injector });\n}\n\nexport function onDestroy(callback: () => void): void {\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(callback);\n}\n\n/**\n * Previously, with our state approach, we allowed signals to be written directly using their setters.\n * However, with our new approach, we want people to use the appropriate set method instead. This function takes in a writable\n * signal and returns a proxy that warns the user when set is called directly.\n */\nexport function deprecatedSetter<T>(\n signal: WritableSignal<T>,\n methodName: string,\n): WritableSignal<T>;\nexport function deprecatedSetter<T>(\n signal: Signal<T>,\n methodName: string,\n setter: (value: T) => void,\n): WritableSignal<T>;\nexport function deprecatedSetter<T>(\n signal: Signal<T>,\n methodName: string,\n setter?: (value: T) => void,\n): WritableSignal<T> {\n return new Proxy(signal as WritableSignal<T>, {\n get(target, prop) {\n if (prop === 'set') {\n return (value: T) => {\n console.warn(\n `Deprecation warning: Use ${methodName}() instead of setting the value directly.`,\n );\n if (setter) {\n setter(value);\n } else {\n (target as WritableSignal<T>).set(value);\n }\n };\n }\n if (prop === 'update') {\n return (updateFn: (value: T) => T) => {\n console.warn(\n `Deprecation warning: Use ${methodName}() instead of setting the value directly.`,\n );\n const newValue = updateFn(target());\n if (setter) {\n setter(newValue);\n } else {\n (target as WritableSignal<T>).set(newValue);\n }\n };\n }\n return target[prop as keyof WritableSignal<T>];\n },\n });\n}\n\n/**\n * A utility function to inject an inherited state from a parent injector. This is useful for cases\n * where a primitive needs to inherit state from a parent primitive, such as in roving focus groups.\n * We could use inject with a forwardRef, but forwardRef returns an any - no thanks...\n */\nexport function injectInheritedState<T>(\n token: () => InjectionToken<T>,\n injectOptions: InjectOptions = {},\n): T | null {\n return (\n inject<T>(\n forwardRef(() => token()),\n { optional: true, skipSelf: true, ...injectOptions },\n ) ?? null\n );\n}\n\nexport interface Emitter<T> {\n emit(value: T): void;\n asObservable(): Observable<T>;\n}\n\n/**\n * An emitter is a simple wrapper around a Subject that ensures\n * that change detection is run when an event is emitted and that\n * the subject is automatically completed when the component is destroyed.\n */\nexport function emitter<T>({\n injector = inject(Injector),\n}: { injector?: Injector } = {}): Emitter<T> {\n return runInInjectionContext(injector, () => {\n const eventEmitter = new Subject<T>();\n const changeDetector = inject(ChangeDetectorRef);\n\n // Complete the subject on destroy\n onDestroy(() => eventEmitter.complete());\n\n return {\n emit(value: T): void {\n eventEmitter.next(value);\n queueMicrotask(() => changeDetector.markForCheck());\n },\n asObservable(): Observable<T> {\n return eventEmitter.asObservable();\n },\n };\n });\n}\n\nfunction isomorphicEffect(callback: () => void): void {\n const injector = inject(Injector);\n const platformId = injector.get(PLATFORM_ID);\n\n if (isPlatformBrowser(platformId)) {\n afterRenderEffect(() => callback());\n } else {\n // On the server, we just run the effect immediately\n effect(() => callback());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AA0DA;;;AAGG;AACG,SAAU,gBAAgB,CAAI,WAAmB,EAAA;AACrD,IAAA,OAAO,IAAI,cAAc,CAAmB,MAAM,WAAW,CAAA,UAAA,CAAY,CAAC;AAC5E;AAiBA;;;;;AAKG;AACG,SAAU,mBAAmB,CACjC,KAAuB,EAAA;IAEvB,OAAO,CAAC,EAAE,OAAO,EAAA,GAAiC,EAAE,MAAM;AACxD,QAAA,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,MAAK;AACf,YAAA,IAAI,OAAO,KAAK,KAAK,EAAE;;AAErB,gBAAA,OAAO,MAAM,CAAC,EAAE,CAAC;YACnB;;AAEA,YAAA,OAAO,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC;QACxE,CAAC;AACF,KAAA,CAAC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UAAU,CAAC,EAAE;AACjC,QAAA,iBAAiB,CAAC,MAAM,QAAQ,EAAE,CAAC;IACrC;SAAO;;AAEL,QAAA,MAAM,CAAC,MAAM,QAAQ,EAAE,CAAC;IAC1B;AACF;;AC7tBA;;AAEG;;;;"}
|
|
@@ -13,10 +13,10 @@ const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =
|
|
|
13
13
|
const disabledInput = controlled(_disabled);
|
|
14
14
|
// Form control and interactions
|
|
15
15
|
const status = ngpFormControl({ id, disabled: disabledInput });
|
|
16
|
-
const disabled = computed(() => status().disabled ?? disabledInput(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
16
|
+
const disabled = computed(() => status().disabled ?? disabledInput(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
17
17
|
ngpInteractions({ hover: true, press: true, focusVisible: true, disabled });
|
|
18
18
|
const checkedChange = emitter();
|
|
19
|
-
const tabindex = computed(() => (disabled() ? -1 : 0), ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
19
|
+
const tabindex = computed(() => (disabled() ? -1 : 0), ...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
20
20
|
// Host bindings
|
|
21
21
|
attrBinding(element, 'role', 'switch');
|
|
22
22
|
attrBinding(element, 'id', id);
|
|
@@ -66,8 +66,8 @@ const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =
|
|
|
66
66
|
const [NgpSwitchThumbStateToken, ngpSwitchThumb, injectSwitchThumbState, provideSwitchThumbState,] = createPrimitive('NgpSwitchThumb', ({}) => {
|
|
67
67
|
const element = injectElementRef();
|
|
68
68
|
const switchState = injectSwitchState();
|
|
69
|
-
const checked = computed(() => switchState().checked(), ...(ngDevMode ? [{ debugName: "checked" }] : []));
|
|
70
|
-
const disabled = computed(() => switchState().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
69
|
+
const checked = computed(() => switchState().checked(), ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
70
|
+
const disabled = computed(() => switchState().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
71
71
|
// Host bindings
|
|
72
72
|
dataBinding(element, 'data-checked', checked);
|
|
73
73
|
dataBinding(element, 'data-disabled', disabled);
|
|
@@ -87,10 +87,10 @@ class NgpSwitchThumb {
|
|
|
87
87
|
constructor() {
|
|
88
88
|
ngpSwitchThumb({});
|
|
89
89
|
}
|
|
90
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
91
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
90
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpSwitchThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
91
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.14", type: NgpSwitchThumb, isStandalone: true, selector: "[ngpSwitchThumb]", providers: [provideSwitchThumbState({ inherit: false })], ngImport: i0 }); }
|
|
92
92
|
}
|
|
93
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpSwitchThumb, decorators: [{
|
|
94
94
|
type: Directive,
|
|
95
95
|
args: [{
|
|
96
96
|
selector: '[ngpSwitchThumb]',
|
|
@@ -106,16 +106,13 @@ class NgpSwitch {
|
|
|
106
106
|
/**
|
|
107
107
|
* The id of the switch. If not provided, a unique id will be generated.
|
|
108
108
|
*/
|
|
109
|
-
this.id = input(uniqueId('ngp-switch'), ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
109
|
+
this.id = input(uniqueId('ngp-switch'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
110
110
|
/**
|
|
111
111
|
* Determine if the switch is checked.
|
|
112
112
|
* @default false
|
|
113
113
|
*/
|
|
114
|
-
this.checked = input(false, ...(ngDevMode ?
|
|
115
|
-
|
|
116
|
-
alias: 'ngpSwitchChecked',
|
|
117
|
-
transform: booleanAttribute,
|
|
118
|
-
}]));
|
|
114
|
+
this.checked = input(false, { ...(ngDevMode ? { debugName: "checked" } : /* istanbul ignore next */ {}), alias: 'ngpSwitchChecked',
|
|
115
|
+
transform: booleanAttribute });
|
|
119
116
|
/**
|
|
120
117
|
* Emits when the checked state changes.
|
|
121
118
|
*/
|
|
@@ -126,11 +123,8 @@ class NgpSwitch {
|
|
|
126
123
|
* Determine if the switch is disabled.
|
|
127
124
|
* @default false
|
|
128
125
|
*/
|
|
129
|
-
this.disabled = input(false, ...(ngDevMode ?
|
|
130
|
-
|
|
131
|
-
alias: 'ngpSwitchDisabled',
|
|
132
|
-
transform: booleanAttribute,
|
|
133
|
-
}]));
|
|
126
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), alias: 'ngpSwitchDisabled',
|
|
127
|
+
transform: booleanAttribute });
|
|
134
128
|
/**
|
|
135
129
|
* The switch state.
|
|
136
130
|
* @internal
|
|
@@ -160,10 +154,10 @@ class NgpSwitch {
|
|
|
160
154
|
setDisabled(value) {
|
|
161
155
|
this.state.setDisabled(value);
|
|
162
156
|
}
|
|
163
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
164
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
157
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
158
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpSwitch, isStandalone: true, selector: "[ngpSwitch]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpSwitchChecked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSwitchDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpSwitchCheckedChange" }, providers: [provideSwitchState({ inherit: false })], exportAs: ["ngpSwitch"], ngImport: i0 }); }
|
|
165
159
|
}
|
|
166
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpSwitch, decorators: [{
|
|
167
161
|
type: Directive,
|
|
168
162
|
args: [{
|
|
169
163
|
selector: '[ngpSwitch]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n emitter,\n listener,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable } from 'rxjs';\n\n/**\n * Public state surface for the Switch primitive.\n */\nexport interface NgpSwitchState {\n /**\n * The id of the switch.\n */\n readonly id: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked: WritableSignal<boolean>;\n /**\n * Whether the switch is disabled (includes form control state).\n */\n readonly disabled: WritableSignal<boolean>;\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange: Observable<boolean>;\n /**\n * Toggle the switch state.\n */\n toggle(event?: Event): void;\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void;\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * Inputs for configuring the Switch primitive.\n */\nexport interface NgpSwitchProps {\n /**\n * The id of the switch.\n */\n readonly id?: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked?: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback fired when the checked state changes.\n */\n readonly onCheckedChange?: (checked: boolean) => void;\n}\n\nexport const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =\n createPrimitive(\n 'NgpSwitch',\n ({\n id = signal(uniqueId('ngp-switch')),\n checked: _checked = signal(false),\n disabled: _disabled = signal(false),\n onCheckedChange,\n }: NgpSwitchProps): NgpSwitchState => {\n const element = injectElementRef<HTMLElement>();\n const isButton = element.nativeElement.tagName.toLowerCase() === 'button';\n const checked = controlled(_checked);\n const disabledInput = controlled(_disabled);\n\n // Form control and interactions\n const status = ngpFormControl({ id, disabled: disabledInput });\n const disabled = computed(() => status().disabled ?? disabledInput());\n ngpInteractions({ hover: true, press: true, focusVisible: true, disabled });\n\n const checkedChange = emitter<boolean>();\n const tabindex = computed(() => (disabled() ? -1 : 0));\n\n // Host bindings\n attrBinding(element, 'role', 'switch');\n attrBinding(element, 'id', id);\n attrBinding(element, 'type', () => (isButton ? 'button' : null));\n attrBinding(element, 'aria-checked', checked);\n dataBinding(element, 'data-checked', checked);\n attrBinding(element, 'aria-disabled', disabled);\n dataBinding(element, 'data-disabled', disabled);\n attrBinding(element, 'disabled', () => (isButton && disabled() ? '' : null));\n attrBinding(element, 'tabindex', tabindex);\n\n // Listeners\n listener(element, 'click', event => toggle(event));\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Space') {\n event.preventDefault();\n if (!isButton) {\n toggle(event);\n }\n }\n });\n\n function toggle(event?: Event): void {\n if (disabled()) {\n return;\n }\n\n event?.preventDefault?.();\n setChecked(!checked());\n }\n\n function setChecked(value: boolean): void {\n checked.set(value);\n onCheckedChange?.(value);\n checkedChange.emit(value);\n }\n\n function setDisabled(value: boolean): void {\n disabledInput.set(value);\n }\n\n return {\n id,\n checked: deprecatedSetter(checked, 'setChecked'),\n disabled: deprecatedSetter(disabledInput, 'setDisabled'),\n checkedChange: checkedChange.asObservable(),\n toggle,\n setChecked,\n setDisabled,\n } satisfies NgpSwitchState;\n },\n );\n","import { computed, Signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectSwitchState } from '../switch/switch-state';\n\n/**\n * Public state surface for the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbState {\n /**\n * Whether the switch is checked.\n */\n readonly checked: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Inputs for configuring the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbProps {}\n\nexport const [\n NgpSwitchThumbStateToken,\n ngpSwitchThumb,\n injectSwitchThumbState,\n provideSwitchThumbState,\n] = createPrimitive('NgpSwitchThumb', ({}: NgpSwitchThumbProps): NgpSwitchThumbState => {\n const element = injectElementRef();\n const switchState = injectSwitchState();\n\n const checked = computed(() => switchState().checked());\n const disabled = computed(() => switchState().disabled());\n\n // Host bindings\n dataBinding(element, 'data-checked', checked);\n dataBinding(element, 'data-disabled', disabled);\n\n ngpInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled,\n });\n\n return { checked, disabled } satisfies NgpSwitchThumbState;\n});\n","import { Directive } from '@angular/core';\nimport { ngpSwitchThumb, provideSwitchThumbState } from './switch-thumb-state';\n\n/**\n * Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.\n */\n@Directive({\n selector: '[ngpSwitchThumb]',\n providers: [provideSwitchThumbState({ inherit: false })],\n})\nexport class NgpSwitchThumb {\n constructor() {\n ngpSwitchThumb({});\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpSwitch, provideSwitchState } from './switch-state';\n\n/**\n * Apply the `ngpSwitch` directive to an element to manage the checked state.\n */\n@Directive({\n selector: '[ngpSwitch]',\n exportAs: 'ngpSwitch',\n providers: [provideSwitchState({ inherit: false })],\n})\nexport class NgpSwitch {\n /**\n * The id of the switch. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-switch'));\n\n /**\n * Determine if the switch is checked.\n * @default false\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchChecked',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpSwitchCheckedChange',\n });\n\n /**\n * Determine if the switch is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The switch state.\n * @internal\n */\n readonly state = ngpSwitch({\n id: this.id,\n checked: this.checked,\n disabled: this.disabled,\n onCheckedChange: value => this.checkedChange.emit(value),\n });\n\n /**\n * Toggle the checked state.\n */\n toggle(): void {\n this.state.toggle();\n }\n\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void {\n this.state.setChecked(value);\n }\n\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void {\n this.state.setDisabled(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAwEa,CAAC,mBAAmB,EAAE,SAAS,EAAE,iBA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A,EAAA,aAAA,EAAA,wBAAA,EAAA,EAAA,SAAA,EAFT,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAExC,SAAS,EAAA,UAAA,EAAA,CAAA;kBALrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n emitter,\n listener,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable } from 'rxjs';\n\n/**\n * Public state surface for the Switch primitive.\n */\nexport interface NgpSwitchState {\n /**\n * The id of the switch.\n */\n readonly id: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked: WritableSignal<boolean>;\n /**\n * Whether the switch is disabled (includes form control state).\n */\n readonly disabled: WritableSignal<boolean>;\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange: Observable<boolean>;\n /**\n * Toggle the switch state.\n */\n toggle(event?: Event): void;\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void;\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * Inputs for configuring the Switch primitive.\n */\nexport interface NgpSwitchProps {\n /**\n * The id of the switch.\n */\n readonly id?: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked?: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback fired when the checked state changes.\n */\n readonly onCheckedChange?: (checked: boolean) => void;\n}\n\nexport const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =\n createPrimitive(\n 'NgpSwitch',\n ({\n id = signal(uniqueId('ngp-switch')),\n checked: _checked = signal(false),\n disabled: _disabled = signal(false),\n onCheckedChange,\n }: NgpSwitchProps): NgpSwitchState => {\n const element = injectElementRef<HTMLElement>();\n const isButton = element.nativeElement.tagName.toLowerCase() === 'button';\n const checked = controlled(_checked);\n const disabledInput = controlled(_disabled);\n\n // Form control and interactions\n const status = ngpFormControl({ id, disabled: disabledInput });\n const disabled = computed(() => status().disabled ?? disabledInput());\n ngpInteractions({ hover: true, press: true, focusVisible: true, disabled });\n\n const checkedChange = emitter<boolean>();\n const tabindex = computed(() => (disabled() ? -1 : 0));\n\n // Host bindings\n attrBinding(element, 'role', 'switch');\n attrBinding(element, 'id', id);\n attrBinding(element, 'type', () => (isButton ? 'button' : null));\n attrBinding(element, 'aria-checked', checked);\n dataBinding(element, 'data-checked', checked);\n attrBinding(element, 'aria-disabled', disabled);\n dataBinding(element, 'data-disabled', disabled);\n attrBinding(element, 'disabled', () => (isButton && disabled() ? '' : null));\n attrBinding(element, 'tabindex', tabindex);\n\n // Listeners\n listener(element, 'click', event => toggle(event));\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Space') {\n event.preventDefault();\n if (!isButton) {\n toggle(event);\n }\n }\n });\n\n function toggle(event?: Event): void {\n if (disabled()) {\n return;\n }\n\n event?.preventDefault?.();\n setChecked(!checked());\n }\n\n function setChecked(value: boolean): void {\n checked.set(value);\n onCheckedChange?.(value);\n checkedChange.emit(value);\n }\n\n function setDisabled(value: boolean): void {\n disabledInput.set(value);\n }\n\n return {\n id,\n checked: deprecatedSetter(checked, 'setChecked'),\n disabled: deprecatedSetter(disabledInput, 'setDisabled'),\n checkedChange: checkedChange.asObservable(),\n toggle,\n setChecked,\n setDisabled,\n } satisfies NgpSwitchState;\n },\n );\n","import { computed, Signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectSwitchState } from '../switch/switch-state';\n\n/**\n * Public state surface for the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbState {\n /**\n * Whether the switch is checked.\n */\n readonly checked: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Inputs for configuring the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbProps {}\n\nexport const [\n NgpSwitchThumbStateToken,\n ngpSwitchThumb,\n injectSwitchThumbState,\n provideSwitchThumbState,\n] = createPrimitive('NgpSwitchThumb', ({}: NgpSwitchThumbProps): NgpSwitchThumbState => {\n const element = injectElementRef();\n const switchState = injectSwitchState();\n\n const checked = computed(() => switchState().checked());\n const disabled = computed(() => switchState().disabled());\n\n // Host bindings\n dataBinding(element, 'data-checked', checked);\n dataBinding(element, 'data-disabled', disabled);\n\n ngpInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled,\n });\n\n return { checked, disabled } satisfies NgpSwitchThumbState;\n});\n","import { Directive } from '@angular/core';\nimport { ngpSwitchThumb, provideSwitchThumbState } from './switch-thumb-state';\n\n/**\n * Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.\n */\n@Directive({\n selector: '[ngpSwitchThumb]',\n providers: [provideSwitchThumbState({ inherit: false })],\n})\nexport class NgpSwitchThumb {\n constructor() {\n ngpSwitchThumb({});\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpSwitch, provideSwitchState } from './switch-state';\n\n/**\n * Apply the `ngpSwitch` directive to an element to manage the checked state.\n */\n@Directive({\n selector: '[ngpSwitch]',\n exportAs: 'ngpSwitch',\n providers: [provideSwitchState({ inherit: false })],\n})\nexport class NgpSwitch {\n /**\n * The id of the switch. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-switch'));\n\n /**\n * Determine if the switch is checked.\n * @default false\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchChecked',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpSwitchCheckedChange',\n });\n\n /**\n * Determine if the switch is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The switch state.\n * @internal\n */\n readonly state = ngpSwitch({\n id: this.id,\n checked: this.checked,\n disabled: this.disabled,\n onCheckedChange: value => this.checkedChange.emit(value),\n });\n\n /**\n * Toggle the checked state.\n */\n toggle(): void {\n this.state.toggle();\n }\n\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void {\n this.state.setChecked(value);\n }\n\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void {\n this.state.setDisabled(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAwEa,CAAC,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,GAClF,eAAe,CACb,WAAW,EACX,CAAC,EACC,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EACnC,OAA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Aa;AACvB,oBAAA,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -35,7 +35,7 @@ function injectTabsConfig() {
|
|
|
35
35
|
|
|
36
36
|
const [NgpTabsetStateToken, ngpTabset, injectTabsetState, provideTabsetState] = createPrimitive('NgpTabset', ({ id = signal(uniqueId('ngp-tabset')), value: _value = signal(undefined), orientation: _orientation = signal('horizontal'), activateOnFocus: _activateOnFocus = signal(false), onValueChange, }) => {
|
|
37
37
|
const element = injectElementRef();
|
|
38
|
-
const tabs = signal([], ...(ngDevMode ? [{ debugName: "tabs" }] : []));
|
|
38
|
+
const tabs = signal([], ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
39
39
|
// Controlled properties
|
|
40
40
|
const value = controlled(_value);
|
|
41
41
|
const orientation = controlled(_orientation);
|
|
@@ -57,7 +57,7 @@ const [NgpTabsetStateToken, ngpTabset, injectTabsetState, provideTabsetState] =
|
|
|
57
57
|
}
|
|
58
58
|
// otherwise return the first non-disabled tab's value
|
|
59
59
|
return tabList.find(tab => !tab.disabled())?.value();
|
|
60
|
-
}, ...(ngDevMode ? [{ debugName: "selectedTab" }] : []));
|
|
60
|
+
}, ...(ngDevMode ? [{ debugName: "selectedTab" }] : /* istanbul ignore next */ []));
|
|
61
61
|
function select(newValue) {
|
|
62
62
|
// if the value is already selected, do nothing
|
|
63
63
|
if (value() === newValue) {
|
|
@@ -97,9 +97,9 @@ const [NgpTabButtonStateToken, ngpTabButton, injectTabButtonState, provideTabBut
|
|
|
97
97
|
const tagName = inject(HOST_TAG_NAME);
|
|
98
98
|
const tabset = injectTabsetState();
|
|
99
99
|
// Computed properties
|
|
100
|
-
const buttonId = computed(() => id?.() ?? `${tabset().id()}-button-${value()}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
|
|
101
|
-
const ariaControls = computed(() => `${tabset().id()}-panel-${value()}`, ...(ngDevMode ? [{ debugName: "ariaControls" }] : []));
|
|
102
|
-
const active = computed(() => tabset().selectedTab() === value(), ...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
100
|
+
const buttonId = computed(() => id?.() ?? `${tabset().id()}-button-${value()}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : /* istanbul ignore next */ []));
|
|
101
|
+
const ariaControls = computed(() => `${tabset().id()}-panel-${value()}`, ...(ngDevMode ? [{ debugName: "ariaControls" }] : /* istanbul ignore next */ []));
|
|
102
|
+
const active = computed(() => tabset().selectedTab() === value(), ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
103
103
|
// Host bindings
|
|
104
104
|
attrBinding(element, 'role', 'tab');
|
|
105
105
|
attrBinding(element, 'id', buttonId);
|
|
@@ -157,21 +157,18 @@ class NgpTabButton {
|
|
|
157
157
|
* The value of the tab this trigger controls
|
|
158
158
|
* @required
|
|
159
159
|
*/
|
|
160
|
-
this.value = input(undefined, ...(ngDevMode ?
|
|
160
|
+
this.value = input(undefined, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), alias: 'ngpTabButtonValue' });
|
|
161
161
|
/**
|
|
162
162
|
* Whether the tab is disabled
|
|
163
163
|
* @default false
|
|
164
164
|
*/
|
|
165
|
-
this.disabled = input(false, ...(ngDevMode ?
|
|
166
|
-
|
|
167
|
-
alias: 'ngpTabButtonDisabled',
|
|
168
|
-
transform: booleanAttribute,
|
|
169
|
-
}]));
|
|
165
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), alias: 'ngpTabButtonDisabled',
|
|
166
|
+
transform: booleanAttribute });
|
|
170
167
|
/**
|
|
171
168
|
* Determine the id of the tab button
|
|
172
169
|
* @internal
|
|
173
170
|
*/
|
|
174
|
-
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
|
|
171
|
+
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
175
172
|
this.state = ngpTabButton({
|
|
176
173
|
value: this.value,
|
|
177
174
|
disabled: this.disabled,
|
|
@@ -189,10 +186,10 @@ class NgpTabButton {
|
|
|
189
186
|
select() {
|
|
190
187
|
this.state.select();
|
|
191
188
|
}
|
|
192
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
193
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
189
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
190
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpTabButton, isStandalone: true, selector: "[ngpTabButton]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabButtonValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpTabButtonDisabled", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTabButtonState(), provideRovingFocusItemState()], exportAs: ["ngpTabButton"], ngImport: i0 }); }
|
|
194
191
|
}
|
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabButton, decorators: [{
|
|
196
193
|
type: Directive,
|
|
197
194
|
args: [{
|
|
198
195
|
selector: '[ngpTabButton]',
|
|
@@ -218,10 +215,10 @@ class NgpTabList {
|
|
|
218
215
|
constructor() {
|
|
219
216
|
ngpTabList({});
|
|
220
217
|
}
|
|
221
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
222
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
218
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
219
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.14", type: NgpTabList, isStandalone: true, selector: "[ngpTabList]", providers: [provideTabListState()], exportAs: ["ngpTabList"], ngImport: i0 }); }
|
|
223
220
|
}
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabList, decorators: [{
|
|
225
222
|
type: Directive,
|
|
226
223
|
args: [{
|
|
227
224
|
selector: '[ngpTabList]',
|
|
@@ -234,9 +231,9 @@ const [NgpTabPanelStateToken, ngpTabPanel, injectTabPanelState, provideTabPanelS
|
|
|
234
231
|
const element = injectElementRef();
|
|
235
232
|
const tabset = injectTabsetState();
|
|
236
233
|
// Computed properties
|
|
237
|
-
const panelId = computed(() => id?.() ?? `${tabset().id()}-panel-${value?.()}`, ...(ngDevMode ? [{ debugName: "panelId" }] : []));
|
|
238
|
-
const labelledBy = computed(() => `${tabset().id()}-button-${value?.()}`, ...(ngDevMode ? [{ debugName: "labelledBy" }] : []));
|
|
239
|
-
const active = computed(() => tabset().selectedTab() === value?.(), ...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
234
|
+
const panelId = computed(() => id?.() ?? `${tabset().id()}-panel-${value?.()}`, ...(ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []));
|
|
235
|
+
const labelledBy = computed(() => `${tabset().id()}-button-${value?.()}`, ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
|
|
236
|
+
const active = computed(() => tabset().selectedTab() === value?.(), ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
240
237
|
// Host bindings
|
|
241
238
|
attrBinding(element, 'role', 'tabpanel');
|
|
242
239
|
attrBinding(element, 'tabindex', () => (active() ? '0' : null));
|
|
@@ -267,12 +264,12 @@ class NgpTabPanel {
|
|
|
267
264
|
* The value of the tab
|
|
268
265
|
* @required
|
|
269
266
|
*/
|
|
270
|
-
this.value = input(undefined, ...(ngDevMode ?
|
|
267
|
+
this.value = input(undefined, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), alias: 'ngpTabPanelValue' });
|
|
271
268
|
/**
|
|
272
269
|
* Determine the id of the tab panel
|
|
273
270
|
* @internal
|
|
274
271
|
*/
|
|
275
|
-
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
|
|
272
|
+
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
276
273
|
this.state = ngpTabPanel({
|
|
277
274
|
value: this.value,
|
|
278
275
|
id: this.id,
|
|
@@ -282,10 +279,10 @@ class NgpTabPanel {
|
|
|
282
279
|
*/
|
|
283
280
|
this.active = this.state.active;
|
|
284
281
|
}
|
|
285
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
286
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
282
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
283
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpTabPanel, isStandalone: true, selector: "[ngpTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabPanelValue", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTabPanelState()], exportAs: ["ngpTabPanel"], ngImport: i0 }); }
|
|
287
284
|
}
|
|
288
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabPanel, decorators: [{
|
|
289
286
|
type: Directive,
|
|
290
287
|
args: [{
|
|
291
288
|
selector: '[ngpTabPanel]',
|
|
@@ -306,13 +303,11 @@ class NgpTabset {
|
|
|
306
303
|
/**
|
|
307
304
|
* Define the id for the tabset
|
|
308
305
|
*/
|
|
309
|
-
this.id = input(uniqueId('ngp-tabset'), ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
306
|
+
this.id = input(uniqueId('ngp-tabset'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
310
307
|
/**
|
|
311
308
|
* Define the active tab
|
|
312
309
|
*/
|
|
313
|
-
this.value = input(undefined, ...(ngDevMode ?
|
|
314
|
-
alias: 'ngpTabsetValue',
|
|
315
|
-
}]));
|
|
310
|
+
this.value = input(undefined, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), alias: 'ngpTabsetValue' });
|
|
316
311
|
/**
|
|
317
312
|
* Emit the value of the selected tab when it changes
|
|
318
313
|
*/
|
|
@@ -323,17 +318,12 @@ class NgpTabset {
|
|
|
323
318
|
* The orientation of the tabset
|
|
324
319
|
* @default 'horizontal'
|
|
325
320
|
*/
|
|
326
|
-
this.orientation = input(this.config.orientation, ...(ngDevMode ?
|
|
327
|
-
alias: 'ngpTabsetOrientation',
|
|
328
|
-
}]));
|
|
321
|
+
this.orientation = input(this.config.orientation, { ...(ngDevMode ? { debugName: "orientation" } : /* istanbul ignore next */ {}), alias: 'ngpTabsetOrientation' });
|
|
329
322
|
/**
|
|
330
323
|
* Whether tabs should activate on focus
|
|
331
324
|
*/
|
|
332
|
-
this.activateOnFocus = input(this.config.activateOnFocus, ...(ngDevMode ?
|
|
333
|
-
|
|
334
|
-
alias: 'ngpTabsetActivateOnFocus',
|
|
335
|
-
transform: booleanAttribute,
|
|
336
|
-
}]));
|
|
325
|
+
this.activateOnFocus = input(this.config.activateOnFocus, { ...(ngDevMode ? { debugName: "activateOnFocus" } : /* istanbul ignore next */ {}), alias: 'ngpTabsetActivateOnFocus',
|
|
326
|
+
transform: booleanAttribute });
|
|
337
327
|
this.state = ngpTabset({
|
|
338
328
|
id: this.id,
|
|
339
329
|
value: this.value,
|
|
@@ -366,13 +356,13 @@ class NgpTabset {
|
|
|
366
356
|
setOrientation(orientation) {
|
|
367
357
|
this.state.setOrientation(orientation);
|
|
368
358
|
}
|
|
369
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
370
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
359
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabset, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
360
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpTabset, isStandalone: true, selector: "[ngpTabset]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpTabsetValue", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpTabsetOrientation", isSignal: true, isRequired: false, transformFunction: null }, activateOnFocus: { classPropertyName: "activateOnFocus", publicName: "ngpTabsetActivateOnFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpTabsetValueChange" }, providers: [
|
|
371
361
|
provideTabsetState({ inherit: false }),
|
|
372
362
|
provideRovingFocusGroupState({ inherit: false }),
|
|
373
363
|
], exportAs: ["ngpTabset"], ngImport: i0 }); }
|
|
374
364
|
}
|
|
375
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpTabset, decorators: [{
|
|
376
366
|
type: Directive,
|
|
377
367
|
args: [{
|
|
378
368
|
selector: '[ngpTabset]',
|