@tailwind-ng/core
Advanced tools
@@ -68,3 +68,3 @@ import { OutputEmitterRef } from '@angular/core'; | ||
| */ | ||
| onIndeterminate: string; | ||
| indeterminate: string; | ||
| /** | ||
@@ -74,3 +74,3 @@ * The name of the icon to display when the checkbox is checked. | ||
| */ | ||
| onChecked: string; | ||
| checked: string; | ||
| /** | ||
@@ -77,0 +77,0 @@ * The size of the icon. Default is `'sm'`. |
@@ -106,3 +106,3 @@ import { OnDestroy, OnInit } from '@angular/core'; | ||
| get hasFocus(): boolean; | ||
| isHovered: boolean; | ||
| get isHovered(): boolean; | ||
| ngOnInit(): void; | ||
@@ -109,0 +109,0 @@ ngOnDestroy(): void; |
@@ -93,3 +93,2 @@ import * as i0 from '@angular/core'; | ||
| this._isDisabled = false; | ||
| this.isHovered = false; | ||
| } | ||
@@ -103,9 +102,6 @@ get isInitialized() { | ||
| this._isDisabled = newState; | ||
| if (this._isInitialized) { | ||
| this.buildStyle(); | ||
| } | ||
| } | ||
| } | ||
| get disabled() { | ||
| return this._isDisabled; | ||
| return this._isDisabled || this.nativeElement.matches(':disabled'); | ||
| } | ||
@@ -118,2 +114,5 @@ get isFocused() { | ||
| } | ||
| get isHovered() { | ||
| return this.nativeElement.matches(':hover'); | ||
| } | ||
| ngOnInit() { | ||
@@ -305,21 +304,2 @@ runInInjectionContext(this._injector, () => { | ||
| /** | ||
| * A utility for merging class names. | ||
| */ | ||
| const ClassName = { | ||
| /** | ||
| * Merges multiple class names from right (source) to left (target). | ||
| * | ||
| * @param args - The values to merge. This function accepts a merge options as last parameter. | ||
| * @returns The merged result. | ||
| */ | ||
| merge: merge, | ||
| /** | ||
| * Converts value to an array of strings using the specified separator. | ||
| * If value is not a string, an empty array is returned. | ||
| * @param value The value to convert. | ||
| * @param separator The separator to use. | ||
| */ | ||
| toArray: stringToArray, | ||
| }; | ||
| const NON_COLORS = ['transparent', 'white', 'black']; | ||
@@ -435,95 +415,8 @@ /** Returns an array of merged values from source to target. | ||
| } | ||
| /** Returns a string of merged class names from right to left. */ | ||
| const classNameMerge = merge; | ||
| function isObject(value) { | ||
| return value !== null && typeof value === 'object' && !Array.isArray(value); | ||
| } | ||
| function isConfigObject(value) { | ||
| return isObject(value) && !isEmptyObject(value); | ||
| } | ||
| function isEmptyConfigObject(value) { | ||
| return isObject(value) && isEmptyObject(value); | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| function isEmptyObject(value) { | ||
| return isObject(value) && Object.keys(value || {}).length === 0; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type | ||
| function isFunction(value) { | ||
| return typeof value === 'function'; | ||
| } | ||
| function isString(value) { | ||
| return typeof value === 'string'; | ||
| } | ||
| function isNumber(value) { | ||
| return typeof value === 'number'; | ||
| } | ||
| function isBoolean(value) { | ||
| return typeof value === 'boolean'; | ||
| } | ||
| /** | ||
| * Returns true if value is an array and has at least one element, otherwise false. | ||
| */ | ||
| function isArray(value) { | ||
| return Array.isArray(value) && value.length > 0; | ||
| } | ||
| function isUndefined(value) { | ||
| return typeof value === 'undefined'; | ||
| } | ||
| function isUndefinedOrNull(value) { | ||
| return isUndefined(value) || value === null; | ||
| } | ||
| function setClassName(value, el) { | ||
| if (value && el) { | ||
| el.className = value; | ||
| } | ||
| } | ||
| /** | ||
| * Creates a `ClassList` that can be set, update or merge directly. | ||
| * @param base The base value of the class list. | ||
| * @param el The element on which the classlist changes apply. | ||
| */ | ||
| function classlist(base, el) { | ||
| let _value = ''; | ||
| if (isString(base)) { | ||
| _value = base; | ||
| if (isHTMLElement(el)) { | ||
| setClassName(_value, el); | ||
| } | ||
| } | ||
| else if (isHTMLElement(base)) { | ||
| _value = base.className; | ||
| } | ||
| const classlist = () => { | ||
| return _value; | ||
| }; | ||
| // set classlist by merging value from right to left. | ||
| classlist.set = (...value) => { | ||
| const newValue = ClassName.merge(...value); | ||
| // Set newValue to _value only if newValue is different from current value. | ||
| if (newValue !== _value) { | ||
| _value = newValue; | ||
| if (isHTMLElement(base)) { | ||
| setClassName(_value, base); | ||
| } | ||
| else if (isHTMLElement(el)) { | ||
| setClassName(_value, el); | ||
| } | ||
| } | ||
| return classlist; | ||
| }; | ||
| classlist.update = (fn) => { | ||
| return classlist.set(fn(_value)); | ||
| }; | ||
| classlist.merge = (fn) => { | ||
| return classlist.set(ClassName.merge(...fn(_value))); | ||
| }; | ||
| classlist.toArray = () => ClassName.toArray(_value); | ||
| classlist.toString = () => _value; | ||
| return classlist; | ||
| } | ||
| class OptionDirective extends BaseDirective { | ||
| buildStyle() { | ||
| classlist(this.nativeElement).set('focus:bg-black/5 focus:dark:bg-white/5 focus:outline-0', this.class); | ||
| this.nativeElement.className = classNameMerge('focus:bg-black/5 focus:dark:bg-white/5 focus:outline-0', this.class); | ||
| } | ||
@@ -631,2 +524,41 @@ addEventListeners() { | ||
| function isObject(value) { | ||
| return value !== null && typeof value === 'object' && !Array.isArray(value); | ||
| } | ||
| function isConfigObject(value) { | ||
| return isObject(value) && !isEmptyObject(value); | ||
| } | ||
| function isEmptyConfigObject(value) { | ||
| return isObject(value) && isEmptyObject(value); | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| function isEmptyObject(value) { | ||
| return isObject(value) && Object.keys(value || {}).length === 0; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type | ||
| function isFunction(value) { | ||
| return typeof value === 'function'; | ||
| } | ||
| function isString(value) { | ||
| return typeof value === 'string'; | ||
| } | ||
| function isNumber(value) { | ||
| return typeof value === 'number'; | ||
| } | ||
| function isBoolean(value) { | ||
| return typeof value === 'boolean'; | ||
| } | ||
| /** | ||
| * Returns true if value is an array and has at least one element, otherwise false. | ||
| */ | ||
| function isArray(value) { | ||
| return Array.isArray(value) && value.length > 0; | ||
| } | ||
| function isUndefined(value) { | ||
| return typeof value === 'undefined'; | ||
| } | ||
| function isUndefinedOrNull(value) { | ||
| return isUndefined(value) || value === null; | ||
| } | ||
| /** Returns the object properties values, including properties values of it child objects in a string.*/ | ||
@@ -717,3 +649,3 @@ function toString(obj, separator = ' ') { | ||
| const t = target[k]; | ||
| const res = ClassName.merge(t, s, { | ||
| const res = classNameMerge(t, s, { | ||
| keepClassDeletor: true, | ||
@@ -1363,4 +1295,4 @@ }); | ||
| const CHECKBOX_ICON = InjectionTokenFactory.create({ | ||
| onIndeterminate: 'minus', | ||
| onChecked: 'check', | ||
| indeterminate: 'minus', | ||
| checked: 'check', | ||
| size: 'sm', | ||
@@ -1564,3 +1496,3 @@ }, 'CHECKBOX_ICON'); | ||
| export { AVATAR_CONFIG, AvatarBase, BADGE_CONFIG, BUTTON_CONFIG, BUTTON_GROUP_CONFIG, BadgeBase, BaseDirective, ButtonBase, ButtonGroupBase, CHECKBOX_CONFIG, CHECKBOX_ICON, COMBOBOX_ITEM_CONFIG, CRYPTO, CheckboxBase, ClassName, ComboboxBase, ComboboxItemBase, DIALOG_CONFIG, DROPDOWN_CONFIG, DialogBase, DropdownBase, ICON_CONFIG, INPUT_RADIO_CONFIG, INPUT_TEXT_CONFIG, IconBase, InjectionTokenFactory, InputRadioBase, InputTextBase, Obj, PopupDirective, TOGGLE_CONFIG, ThemeService, ToggleBase, TwIf, OptionDirective as TwOption, WINDOW, ZIndexer, Z_INDEX_SEED, benchmark, classlist, isArray, isArrowDown, isArrowDownOrRight, isArrowLeft, isArrowRight, isArrowUp, isArrowUpOrDown, isArrowUpOrLeft, isAvatar, isBadge, isBoolean, isButton, isCheckbox, isCombobox, isConfigObject, isDialog, isDropdown, isEmptyConfigObject, isEmptyObject, isEnter, isEnterOrSpace, isEscape, isFunction, isHTMLElement, isIcon, isInputElement, isInputText, isKeyboardEvent, isLabelElement, isNavigation, isNumber, isObject, isPrimaryButton, isSecondaryButton, isSpace, isString, isTab, isTextButton, isToggle, isTonalButton, isUndefined, isUndefinedOrNull, mergeConfig }; | ||
| export { AVATAR_CONFIG, AvatarBase, BADGE_CONFIG, BUTTON_CONFIG, BUTTON_GROUP_CONFIG, BadgeBase, BaseDirective, ButtonBase, ButtonGroupBase, CHECKBOX_CONFIG, CHECKBOX_ICON, COMBOBOX_ITEM_CONFIG, CRYPTO, CheckboxBase, ComboboxBase, ComboboxItemBase, DIALOG_CONFIG, DROPDOWN_CONFIG, DialogBase, DropdownBase, ICON_CONFIG, INPUT_RADIO_CONFIG, INPUT_TEXT_CONFIG, IconBase, InjectionTokenFactory, InputRadioBase, InputTextBase, Obj, PopupDirective, TOGGLE_CONFIG, ThemeService, ToggleBase, TwIf, OptionDirective as TwOption, WINDOW, ZIndexer, Z_INDEX_SEED, benchmark, classNameMerge, isArray, isArrowDown, isArrowDownOrRight, isArrowLeft, isArrowRight, isArrowUp, isArrowUpOrDown, isArrowUpOrLeft, isAvatar, isBadge, isBoolean, isButton, isCheckbox, isCombobox, isConfigObject, isDialog, isDropdown, isEmptyConfigObject, isEmptyObject, isEnter, isEnterOrSpace, isEscape, isFunction, isHTMLElement, isIcon, isInputElement, isInputText, isKeyboardEvent, isLabelElement, isNavigation, isNumber, isObject, isPrimaryButton, isSecondaryButton, isSpace, isString, isTab, isTextButton, isToggle, isTonalButton, isUndefined, isUndefinedOrNull, mergeConfig, stringToArray }; | ||
| //# sourceMappingURL=tailwind-ng-core.mjs.map |
+1
-1
| { | ||
| "name": "@tailwind-ng/core", | ||
| "version": "0.20.33", | ||
| "version": "0.20.34", | ||
| "author": { | ||
@@ -5,0 +5,0 @@ "email": "w.mba@outlook.com", |
+3
-20
@@ -1,20 +0,1 @@ | ||
| /** | ||
| * A utility for merging class names. | ||
| */ | ||
| export declare const ClassName: { | ||
| /** | ||
| * Merges multiple class names from right (source) to left (target). | ||
| * | ||
| * @param args - The values to merge. This function accepts a merge options as last parameter. | ||
| * @returns The merged result. | ||
| */ | ||
| merge: typeof merge; | ||
| /** | ||
| * Converts value to an array of strings using the specified separator. | ||
| * If value is not a string, an empty array is returned. | ||
| * @param value The value to convert. | ||
| * @param separator The separator to use. | ||
| */ | ||
| toArray: typeof stringToArray; | ||
| }; | ||
| interface MergeOptions { | ||
@@ -39,3 +20,5 @@ /** Whether to keep the class-deletor in the target array. */ | ||
| * Returns an empty array if value is undefined. */ | ||
| declare function stringToArray(value: unknown, separator?: string): string[]; | ||
| export declare function stringToArray(value: unknown, separator?: string): string[]; | ||
| /** Returns a string of merged class names from right to left. */ | ||
| export declare const classNameMerge: typeof merge; | ||
| export {}; |
+0
-1
@@ -5,3 +5,2 @@ export * from './object.util'; | ||
| export * from './benchmark'; | ||
| export * from './classlist'; | ||
| export * from './merge-config'; |
| import { ClassNameValue } from './classname'; | ||
| /** | ||
| * @TailwindNG Class list interface. | ||
| */ | ||
| export interface ClassList { | ||
| /** | ||
| * Returns the current classlist's value. | ||
| */ | ||
| (): NonNullable<ClassNameValue>; | ||
| /** | ||
| * Sets the classlist's value. If multiple values is provided, they will be merged from right to left. | ||
| * @returns The classlist with it new value. | ||
| */ | ||
| set(...value: ClassNameValue[]): ClassList; | ||
| /** | ||
| * Updates the classlist value. | ||
| * @param fn The update function that returns the new value to be setted. | ||
| * @param currentValue The current classlist's value passed to the update function. | ||
| */ | ||
| update(fn: (currentValue: string) => ClassNameValue): ClassList; | ||
| /** | ||
| * Merges multiple classnames to the classlist. | ||
| * @param fn The merge function that returns an array of values to merge from right to left. | ||
| * @param currentValue The current classlist's value passed to the merge function. | ||
| */ | ||
| merge(fn: (currentValue: string) => ClassNameValue[]): ClassList; | ||
| /** | ||
| * Returns an array representation of the classlist's value | ||
| */ | ||
| toArray(): string[]; | ||
| } | ||
| /** | ||
| * Creates a `ClassList` that can be set, update or merge directly. | ||
| * @param base The base value of the class list. | ||
| * @param el The element on which the classlist changes apply. | ||
| */ | ||
| export declare function classlist(base?: ClassNameValue | HTMLElement, el?: HTMLElement): ClassList; |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
3
-25%216431
-3.77%58
-1.69%2498
-4.66%