@radix-ng/primitives 0.39.2 → 0.39.3
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/core/index.d.ts +2 -0
- package/core/src/is-equal.d.ts +7 -0
- package/core/src/isValueEqualOrExist.d.ts +10 -0
- package/core/src/serialize.d.ts +11 -0
- package/core/src/types.d.ts +1 -0
- package/fesm2022/radix-ng-primitives-collapsible.mjs +3 -0
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +220 -1
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +13 -7
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +13 -7
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/hover-card/src/hover-card-content.directive.d.ts +6 -2
- package/hover-card/src/hover-card-root.directive.d.ts +11 -9
- package/package.json +1 -1
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/toggle-group/src/toggle-group.directive.d.ts +5 -4
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
package/core/index.d.ts
CHANGED
@@ -8,9 +8,11 @@ export * from './src/getActiveElement';
|
|
8
8
|
export * from './src/id-generator';
|
9
9
|
export * from './src/inject-ng-control';
|
10
10
|
export * from './src/is-client';
|
11
|
+
export * from './src/is-equal';
|
11
12
|
export * from './src/is-inside-form';
|
12
13
|
export * from './src/is-nullish';
|
13
14
|
export * from './src/is-number';
|
15
|
+
export * from './src/isValueEqualOrExist';
|
14
16
|
export * from './src/kbd-constants';
|
15
17
|
export * from './src/provide-token';
|
16
18
|
export * from './src/window';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Compare two objects using reference equality and stable deep hashing.
|
3
|
+
* @param {any} object1 First object
|
4
|
+
* @param {any} object2 Second object
|
5
|
+
* @return {boolean} true if equal and false if not
|
6
|
+
*/
|
7
|
+
export declare function isEqual(object1: any, object2: any): boolean;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* The function `isValueEqualOrExist` checks if a value is equal to or exists in another value or
|
3
|
+
* array.
|
4
|
+
* @param {T | T[] | undefined} base - It represents the base value that you want to compare with the `current` value.
|
5
|
+
* @param {T | T[] | undefined} current - The `current` parameter represents the current value that you want to compare with the `base` value or values.
|
6
|
+
* @returns The `isValueEqualOrExist` function returns a boolean value. It checks if the `base` value
|
7
|
+
* is equal to the `current` value or if the `current` value exists within the `base` value. The
|
8
|
+
* function handles cases where `base` can be a single value, an array of values, or undefined.
|
9
|
+
*/
|
10
|
+
export declare function isValueEqualOrExist<T>(base: T | T[] | undefined, current: T | T[] | undefined): boolean;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Serializes any input value into a string for hashing.
|
3
|
+
*
|
4
|
+
* This method uses best efforts to generate stable serialized values.
|
5
|
+
* However, it is not designed for security purposes.
|
6
|
+
* Keep in mind that there is always a chance of intentional collisions caused by user input.
|
7
|
+
*
|
8
|
+
* @param input any value to serialize
|
9
|
+
* @return {string} serialized string value
|
10
|
+
*/
|
11
|
+
export declare function serialize(input: any): string;
|
package/core/src/types.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content-presence.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n inject,\n input,\n InputSignal,\n linkedSignal,\n model,\n ModelSignal,\n output,\n Signal,\n untracked\n} from '@angular/core';\nimport { createContext } from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\nexport interface CollapsibleRootContext {\n contentId: InputSignal<string>;\n open: ModelSignal<boolean>;\n toggle: () => void;\n disabled: Signal<boolean>;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] =\n createContext<CollapsibleRootContext>('CollapsibleRootContext');\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n contentId: instance.contentId,\n disabled: instance.isDisabled,\n open: instance.open,\n toggle: () => {\n untracked(() => {\n instance.open.set(!instance.open());\n });\n instance.onOpenChange.emit(instance.open());\n }\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n readonly contentId = input<string>('');\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly _disabled = linkedSignal(this.disabled);\n\n readonly isDisabled = this._disabled.asReadonly();\n\n readonly isOpen = computed(() => this.open());\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n}\n","import { Directive } from '@angular/core';\nimport { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: 'ng-template[rdxCollapsibleContentPresence]',\n providers: [\n provideRdxPresenceContext(() => ({\n present: injectCollapsibleRootContext()!.open\n }))\n ],\n hostDirectives: [RdxPresenceDirective]\n})\nexport class RdxCollapsibleContentPresenceDirective {}\n","import { isPlatformBrowser } from '@angular/common';\nimport { afterNextRender, computed, Directive, effect, ElementRef, inject, PLATFORM_ID, signal } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n host: {\n '[id]': 'rootContext.contentId()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.hidden]': 'shouldHide() ? \"until-found\" : undefined',\n '[style.--radix-collapsible-content-width.px]': 'width()',\n '[style.--radix-collapsible-content-height.px]': 'height()',\n '(animationend)': 'onAnimationEnd()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectCollapsibleRootContext()!;\n\n readonly isOpen = computed(() => this.rootContext.open());\n\n readonly height = signal<number | null>(null);\n readonly width = signal<number | null>(null);\n readonly shouldHide = signal(true);\n private isMountAnimationPrevented = signal(true);\n private currentStyle = signal<{ transitionDuration: string; animationName: string } | null>(null);\n\n private firstRender = true;\n\n constructor() {\n effect(() => {\n const isOpen = this.isOpen();\n\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n requestAnimationFrame(() => {\n this.updateDimensions(isOpen);\n });\n });\n\n afterNextRender(() => {\n requestAnimationFrame(() => {\n this.isMountAnimationPrevented.set(false);\n });\n });\n }\n\n onAnimationEnd() {\n if (!this.isOpen()) {\n this.shouldHide.set(true);\n }\n }\n\n private async updateDimensions(isOpen: boolean) {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n if (!this.currentStyle()) {\n this.currentStyle.set({\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n });\n }\n\n if (isOpen) {\n this.shouldHide.set(false);\n node.hidden = false;\n }\n\n node.style.transitionDuration = '0s';\n node.style.animationName = 'none';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n if (!this.isMountAnimationPrevented() && !this.firstRender) {\n node.style.transitionDuration = this.currentStyle()?.transitionDuration || '';\n node.style.animationName = this.currentStyle()?.animationName || '';\n }\n\n this.firstRender = false;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.contentId()',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.disabled]': 'rootContext.disabled() || undefined',\n\n '(click)': 'rootContext.toggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n protected readonly rootContext = injectCollapsibleRootContext()!;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from './src/collapsible-content-presence.directive';\nimport { RdxCollapsibleContentDirective } from './src/collapsible-content.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-content-presence.directive';\nexport * from './src/collapsible-content.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [\n RdxCollapsibleContentDirective,\n RdxCollapsibleRootDirective,\n RdxCollapsibleTriggerDirective,\n RdxCollapsibleContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index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7B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACrBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content-presence.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n inject,\n input,\n InputSignal,\n linkedSignal,\n model,\n ModelSignal,\n output,\n Signal,\n untracked\n} from '@angular/core';\nimport { createContext } from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\nexport interface CollapsibleRootContext {\n contentId: InputSignal<string>;\n open: ModelSignal<boolean>;\n toggle: () => void;\n disabled: Signal<boolean>;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] =\n createContext<CollapsibleRootContext>('CollapsibleRootContext');\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n contentId: instance.contentId,\n disabled: instance.isDisabled,\n open: instance.open,\n toggle: () => {\n if (instance.isDisabled()) {\n return;\n }\n\n untracked(() => {\n instance.open.set(!instance.open());\n });\n\n instance.onOpenChange.emit(instance.open());\n }\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n readonly contentId = input<string>('');\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly _disabled = linkedSignal(this.disabled);\n\n readonly isDisabled = this._disabled.asReadonly();\n\n readonly isOpen = computed(() => this.open());\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n}\n","import { Directive } from '@angular/core';\nimport { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: 'ng-template[rdxCollapsibleContentPresence]',\n providers: [\n provideRdxPresenceContext(() => ({\n present: injectCollapsibleRootContext()!.open\n }))\n ],\n hostDirectives: [RdxPresenceDirective]\n})\nexport class RdxCollapsibleContentPresenceDirective {}\n","import { isPlatformBrowser } from '@angular/common';\nimport { afterNextRender, computed, Directive, effect, ElementRef, inject, PLATFORM_ID, signal } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n host: {\n '[id]': 'rootContext.contentId()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.hidden]': 'shouldHide() ? \"until-found\" : undefined',\n '[style.--radix-collapsible-content-width.px]': 'width()',\n '[style.--radix-collapsible-content-height.px]': 'height()',\n '(animationend)': 'onAnimationEnd()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectCollapsibleRootContext()!;\n\n readonly isOpen = computed(() => this.rootContext.open());\n\n readonly height = signal<number | null>(null);\n readonly width = signal<number | null>(null);\n readonly shouldHide = signal(true);\n private isMountAnimationPrevented = signal(true);\n private currentStyle = signal<{ transitionDuration: string; animationName: string } | null>(null);\n\n private firstRender = true;\n\n constructor() {\n effect(() => {\n const isOpen = this.isOpen();\n\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n requestAnimationFrame(() => {\n this.updateDimensions(isOpen);\n });\n });\n\n afterNextRender(() => {\n requestAnimationFrame(() => {\n this.isMountAnimationPrevented.set(false);\n });\n });\n }\n\n onAnimationEnd() {\n if (!this.isOpen()) {\n this.shouldHide.set(true);\n }\n }\n\n private async updateDimensions(isOpen: boolean) {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n if (!this.currentStyle()) {\n this.currentStyle.set({\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n });\n }\n\n if (isOpen) {\n this.shouldHide.set(false);\n node.hidden = false;\n }\n\n node.style.transitionDuration = '0s';\n node.style.animationName = 'none';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n if (!this.isMountAnimationPrevented() && !this.firstRender) {\n node.style.transitionDuration = this.currentStyle()?.transitionDuration || '';\n node.style.animationName = this.currentStyle()?.animationName || '';\n }\n\n this.firstRender = false;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.contentId()',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.disabled]': 'rootContext.disabled() || undefined',\n\n '(click)': 'rootContext.toggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n protected readonly rootContext = injectCollapsibleRootContext()!;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from './src/collapsible-content-presence.directive';\nimport { RdxCollapsibleContentDirective } from './src/collapsible-content.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-content-presence.directive';\nexport * from './src/collapsible-content.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [\n RdxCollapsibleContentDirective,\n RdxCollapsibleRootDirective,\n RdxCollapsibleTriggerDirective,\n RdxCollapsibleContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,CAAC,4BAA4B,EAAE,6BAA6B,CAAC,GACtE,aAAa,CAAyB,wBAAwB;AAElE,MAAM,WAAW,GAAG,MAA6B;AAC7C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,2BAA2B,CAAC;IAEpD,OAAO;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,MAAK;AACT,YAAA,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE;gBACvB;;YAGJ,SAAS,CAAC,MAAK;gBACX,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACvC,aAAC,CAAC;YAEF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;;KAElD;AACL,CAAC;A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AmB,EAAE,wCAAwC;AAC7D,wBAAA,sBAAsB,EAAE,6CAA6C;AACrE,wBAAA,iBAAiB,EAAE,qCAAqC;AAExD,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACHD,MAAM,QAAQ,GAAG;IACb,8BAA8B;IAC9B,2BAA2B;IAC3B,8BAA8B;IAC9B;CACH;MAMY,oBAAoB,CAAA;8GAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAV7B,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;AAC9B,YAAA,sCAAsC,aAHtC,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;YAC9B,sCAAsC,CAAA,EAAA,CAAA,CAAA;+GAO7B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACrBD;;AAEG;;;;"}
|
@@ -358,6 +358,205 @@ function injectIsClient() {
|
|
358
358
|
return inject(Platform).isBrowser;
|
359
359
|
}
|
360
360
|
|
361
|
+
// Originally based on https://github.com/puleos/object-hash v3.0.0 (MIT)
|
362
|
+
/**
|
363
|
+
* Serializes any input value into a string for hashing.
|
364
|
+
*
|
365
|
+
* This method uses best efforts to generate stable serialized values.
|
366
|
+
* However, it is not designed for security purposes.
|
367
|
+
* Keep in mind that there is always a chance of intentional collisions caused by user input.
|
368
|
+
*
|
369
|
+
* @param input any value to serialize
|
370
|
+
* @return {string} serialized string value
|
371
|
+
*/
|
372
|
+
function serialize(input) {
|
373
|
+
if (typeof input === 'string') {
|
374
|
+
return `'${input}'`;
|
375
|
+
}
|
376
|
+
return new Serializer().serialize(input);
|
377
|
+
}
|
378
|
+
const Serializer = /*@__PURE__*/ (function () {
|
379
|
+
class Serializer {
|
380
|
+
#context = new Map();
|
381
|
+
compare(a, b) {
|
382
|
+
const typeA = typeof a;
|
383
|
+
const typeB = typeof b;
|
384
|
+
if (typeA === 'string' && typeB === 'string') {
|
385
|
+
return a.localeCompare(b);
|
386
|
+
}
|
387
|
+
if (typeA === 'number' && typeB === 'number') {
|
388
|
+
return a - b;
|
389
|
+
}
|
390
|
+
return String.prototype.localeCompare.call(this.serialize(a, true), this.serialize(b, true));
|
391
|
+
}
|
392
|
+
serialize(value, noQuotes) {
|
393
|
+
if (value === null) {
|
394
|
+
return 'null';
|
395
|
+
}
|
396
|
+
switch (typeof value) {
|
397
|
+
case 'string': {
|
398
|
+
return noQuotes ? value : `'${value}'`;
|
399
|
+
}
|
400
|
+
case 'bigint': {
|
401
|
+
return `${value}n`;
|
402
|
+
}
|
403
|
+
case 'object': {
|
404
|
+
return this.$object(value);
|
405
|
+
}
|
406
|
+
case 'function': {
|
407
|
+
return this.$function(value);
|
408
|
+
}
|
409
|
+
}
|
410
|
+
return String(value);
|
411
|
+
}
|
412
|
+
serializeObject(object) {
|
413
|
+
const objString = Object.prototype.toString.call(object);
|
414
|
+
if (objString !== '[object Object]') {
|
415
|
+
return this.serializeBuiltInType(objString.length < 10 /* '[object a]'.length === 10, the minimum */
|
416
|
+
? `unknown:${objString}`
|
417
|
+
: objString.slice(8, -1) /* '[object '.length === 8 */, object);
|
418
|
+
}
|
419
|
+
const constructor = object.constructor;
|
420
|
+
const objName = constructor === Object || constructor === undefined ? '' : constructor.name;
|
421
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
422
|
+
// @ts-expect-error
|
423
|
+
if (objName !== '' && globalThis[objName] === constructor) {
|
424
|
+
return this.serializeBuiltInType(objName, object);
|
425
|
+
}
|
426
|
+
if ('toJSON' in object && typeof object.toJSON === 'function') {
|
427
|
+
const json = object.toJSON();
|
428
|
+
return (objName +
|
429
|
+
(json !== null && typeof json === 'object' ? this.$object(json) : `(${this.serialize(json)})`));
|
430
|
+
}
|
431
|
+
const keys = Object.keys(object).sort((a, b) => a.localeCompare(b));
|
432
|
+
let content = `${objName}{`;
|
433
|
+
for (let i = 0; i < keys.length; i++) {
|
434
|
+
const key = keys[i];
|
435
|
+
content += `${key}:${this.serialize(object[key])}`;
|
436
|
+
if (i < keys.length - 1) {
|
437
|
+
content += ',';
|
438
|
+
}
|
439
|
+
}
|
440
|
+
return content + '}';
|
441
|
+
}
|
442
|
+
serializeBuiltInType(type, object) {
|
443
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
444
|
+
// @ts-expect-error
|
445
|
+
const handler = this['$' + type];
|
446
|
+
if (handler) {
|
447
|
+
return handler.call(this, object);
|
448
|
+
}
|
449
|
+
if (typeof object.entries === 'function') {
|
450
|
+
return this.serializeObjectEntries(type, object.entries());
|
451
|
+
}
|
452
|
+
throw new Error(`Cannot serialize ${type}`);
|
453
|
+
}
|
454
|
+
serializeObjectEntries(type, entries) {
|
455
|
+
const sortedEntries = Array.from(entries).sort((a, b) => this.compare(a[0], b[0]));
|
456
|
+
let content = `${type}{`;
|
457
|
+
for (let i = 0; i < sortedEntries.length; i++) {
|
458
|
+
const [key, value] = sortedEntries[i];
|
459
|
+
content += `${this.serialize(key, true)}:${this.serialize(value)}`;
|
460
|
+
if (i < sortedEntries.length - 1) {
|
461
|
+
content += ',';
|
462
|
+
}
|
463
|
+
}
|
464
|
+
return content + '}';
|
465
|
+
}
|
466
|
+
$object(object) {
|
467
|
+
let content = this.#context.get(object);
|
468
|
+
if (content === undefined) {
|
469
|
+
this.#context.set(object, `#${this.#context.size}`);
|
470
|
+
content = this.serializeObject(object);
|
471
|
+
this.#context.set(object, content);
|
472
|
+
}
|
473
|
+
return content;
|
474
|
+
}
|
475
|
+
$function(fn) {
|
476
|
+
const fnStr = Function.prototype.toString.call(fn);
|
477
|
+
if (fnStr.slice(-15 /* "[native code] }".length */) === '[native code] }') {
|
478
|
+
return `${fn.name || ''}()[native]`;
|
479
|
+
}
|
480
|
+
return `${fn.name}(${fn.length})${fnStr.replace(/\s*\n\s*/g, '')}`;
|
481
|
+
}
|
482
|
+
$Array(arr) {
|
483
|
+
let content = '[';
|
484
|
+
for (let i = 0; i < arr.length; i++) {
|
485
|
+
content += this.serialize(arr[i]);
|
486
|
+
if (i < arr.length - 1) {
|
487
|
+
content += ',';
|
488
|
+
}
|
489
|
+
}
|
490
|
+
return content + ']';
|
491
|
+
}
|
492
|
+
$Date(date) {
|
493
|
+
try {
|
494
|
+
return `Date(${date.toISOString()})`;
|
495
|
+
}
|
496
|
+
catch {
|
497
|
+
return `Date(null)`;
|
498
|
+
}
|
499
|
+
}
|
500
|
+
$ArrayBuffer(arr) {
|
501
|
+
return `ArrayBuffer[${new Uint8Array(arr).join(',')}]`;
|
502
|
+
}
|
503
|
+
$Set(set) {
|
504
|
+
return `Set${this.$Array(Array.from(set).sort((a, b) => this.compare(a, b)))}`;
|
505
|
+
}
|
506
|
+
$Map(map) {
|
507
|
+
return this.serializeObjectEntries('Map', map.entries());
|
508
|
+
}
|
509
|
+
}
|
510
|
+
for (const type of ['Error', 'RegExp', 'URL']) {
|
511
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
512
|
+
// @ts-expect-error
|
513
|
+
Serializer.prototype['$' + type] = function (val) {
|
514
|
+
return `${type}(${val})`;
|
515
|
+
};
|
516
|
+
}
|
517
|
+
for (const type of [
|
518
|
+
'Int8Array',
|
519
|
+
'Uint8Array',
|
520
|
+
'Uint8ClampedArray',
|
521
|
+
'Int16Array',
|
522
|
+
'Uint16Array',
|
523
|
+
'Int32Array',
|
524
|
+
'Uint32Array',
|
525
|
+
'Float32Array',
|
526
|
+
'Float64Array'
|
527
|
+
]) {
|
528
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
529
|
+
// @ts-expect-error
|
530
|
+
Serializer.prototype['$' + type] = function (arr) {
|
531
|
+
return `${type}[${arr.join(',')}]`;
|
532
|
+
};
|
533
|
+
}
|
534
|
+
for (const type of ['BigInt64Array', 'BigUint64Array']) {
|
535
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
536
|
+
// @ts-expect-error
|
537
|
+
Serializer.prototype['$' + type] = function (arr) {
|
538
|
+
return `${type}[${arr.join('n,')}${arr.length > 0 ? 'n' : ''}]`;
|
539
|
+
};
|
540
|
+
}
|
541
|
+
return Serializer;
|
542
|
+
})();
|
543
|
+
|
544
|
+
/**
|
545
|
+
* Compare two objects using reference equality and stable deep hashing.
|
546
|
+
* @param {any} object1 First object
|
547
|
+
* @param {any} object2 Second object
|
548
|
+
* @return {boolean} true if equal and false if not
|
549
|
+
*/
|
550
|
+
function isEqual(object1, object2) {
|
551
|
+
if (object1 === object2) {
|
552
|
+
return true;
|
553
|
+
}
|
554
|
+
if (serialize(object1) === serialize(object2)) {
|
555
|
+
return true;
|
556
|
+
}
|
557
|
+
return false;
|
558
|
+
}
|
559
|
+
|
361
560
|
function isInsideForm(el) {
|
362
561
|
if (!el || !el.nativeElement) {
|
363
562
|
return true;
|
@@ -371,6 +570,26 @@ function isNullish(value) {
|
|
371
570
|
|
372
571
|
const isNumber = (v) => typeof v === 'number';
|
373
572
|
|
573
|
+
/**
|
574
|
+
* The function `isValueEqualOrExist` checks if a value is equal to or exists in another value or
|
575
|
+
* array.
|
576
|
+
* @param {T | T[] | undefined} base - It represents the base value that you want to compare with the `current` value.
|
577
|
+
* @param {T | T[] | undefined} current - The `current` parameter represents the current value that you want to compare with the `base` value or values.
|
578
|
+
* @returns The `isValueEqualOrExist` function returns a boolean value. It checks if the `base` value
|
579
|
+
* is equal to the `current` value or if the `current` value exists within the `base` value. The
|
580
|
+
* function handles cases where `base` can be a single value, an array of values, or undefined.
|
581
|
+
*/
|
582
|
+
function isValueEqualOrExist(base, current) {
|
583
|
+
if (isNullish(base))
|
584
|
+
return false;
|
585
|
+
if (Array.isArray(base)) {
|
586
|
+
return base.some((val) => isEqual(val, current));
|
587
|
+
}
|
588
|
+
else {
|
589
|
+
return isEqual(base, current);
|
590
|
+
}
|
591
|
+
}
|
592
|
+
|
374
593
|
const ALT = 'Alt';
|
375
594
|
const ARROW_DOWN = 'ArrowDown';
|
376
595
|
const ARROW_LEFT = 'ArrowLeft';
|
@@ -2341,5 +2560,5 @@ function watch(deps, fn, options) {
|
|
2341
2560
|
* Generated bundle index. Do not edit.
|
2342
2561
|
*/
|
2343
2562
|
|
2344
|
-
export { A, ALT, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, ASTERISK, BACKSPACE, CAPS_LOCK, CONTROL, CTRL, DELETE, END, ENTER, ESCAPE, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, HOME, META, P, PAGE_DOWN, PAGE_UP, RDX_POSITIONING_DEFAULTS, RDX_POSITIONS, RdxAutoFocusDirective, RdxControlValueAccessor, RdxFocusInitialDirective, RdxPositionAlign, RdxPositionSide, SHIFT, SPACE, SPACE_CODE, TAB, WINDOW, _IdGenerator, a, areAllDaysBetweenValid, clamp, createContent, createContext, createFormatter, createMonth, createMonths, getActiveElement, getAllPossibleConnectedPositions, getArrowPositionParams, getContentPosition, getDaysBetween, getDaysInMonth, getDefaultDate, getDefaultTime, getLastFirstDayOfWeek, getNextLastDayOfWeek, getOptsByGranularity, getPlaceholder, getSegmentElements, getSideAndAlignFromAllPossibleConnectedPositions, handleCalendarInitialFocus, hasTime, initializeSegmentValues, injectControlValueAccessor, injectDocument, injectIsClient, injectNgControl, injectWindow, isAcceptableSegmentKey, isAfter, isAfterOrSame, isBefore, isBeforeOrSame, isBetween, isBetweenInclusive, isCalendarDateTime, isInsideForm, isNullish, isNumber, isNumberString, isSegmentNavigationKey, isZonedDateTime, j, k, n, p, provideToken, provideValueAccessor, resizeEffect, roundToStepPrecision, segmentBuilders, snapValueToStep, syncSegmentValues, syncTimeSegmentValues, toDate, useArrowNavigation, useDateField, watch };
|
2563
|
+
export { A, ALT, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, ASTERISK, BACKSPACE, CAPS_LOCK, CONTROL, CTRL, DELETE, END, ENTER, ESCAPE, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, HOME, META, P, PAGE_DOWN, PAGE_UP, RDX_POSITIONING_DEFAULTS, RDX_POSITIONS, RdxAutoFocusDirective, RdxControlValueAccessor, RdxFocusInitialDirective, RdxPositionAlign, RdxPositionSide, SHIFT, SPACE, SPACE_CODE, TAB, WINDOW, _IdGenerator, a, areAllDaysBetweenValid, clamp, createContent, createContext, createFormatter, createMonth, createMonths, getActiveElement, getAllPossibleConnectedPositions, getArrowPositionParams, getContentPosition, getDaysBetween, getDaysInMonth, getDefaultDate, getDefaultTime, getLastFirstDayOfWeek, getNextLastDayOfWeek, getOptsByGranularity, getPlaceholder, getSegmentElements, getSideAndAlignFromAllPossibleConnectedPositions, handleCalendarInitialFocus, hasTime, initializeSegmentValues, injectControlValueAccessor, injectDocument, injectIsClient, injectNgControl, injectWindow, isAcceptableSegmentKey, isAfter, isAfterOrSame, isBefore, isBeforeOrSame, isBetween, isBetweenInclusive, isCalendarDateTime, isEqual, isInsideForm, isNullish, isNumber, isNumberString, isSegmentNavigationKey, isValueEqualOrExist, isZonedDateTime, j, k, n, p, provideToken, provideValueAccessor, resizeEffect, roundToStepPrecision, segmentBuilders, snapValueToStep, syncSegmentValues, syncTimeSegmentValues, toDate, useArrowNavigation, useDateField, watch };
|
2345
2564
|
//# sourceMappingURL=radix-ng-primitives-core.mjs.map
|