@uxf/core 11.88.0 → 11.89.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/constants/empty-object.d.ts +1 -1
- package/cookie/index.d.ts +3 -2
- package/cookie/index.js +3 -2
- package/date/to-date-string.d.ts +4 -1
- package/date/to-datetime-string.d.ts +4 -1
- package/date/to-time-string.d.ts +4 -1
- package/package.json +1 -1
- package/qr/index.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/utils/body-scroll-lock.d.ts +5 -5
- package/utils/body-scroll-lock.js +16 -12
- package/utils/cxa.d.ts +2 -1
- package/utils/deep-equal-ingoring-key-order.test.js +0 -1
- package/utils/filter-aria-and-data-attrs.d.ts +2 -1
- package/utils/filter-nullish-object-values.d.ts +2 -1
- package/utils/is-empty.d.ts +2 -3
- package/utils/is-nil.d.ts +1 -1
- package/utils/is-not-empty.d.ts +2 -3
- package/utils/omit.d.ts +2 -1
- package/utils/sort-object-keys.d.ts +2 -1
- package/validators/form-validator.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const EMPTY_OBJECT: Record<string, never
|
|
1
|
+
export declare const EMPTY_OBJECT: Partial<Record<string, never>>;
|
package/cookie/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnyObject } from "../types";
|
|
1
2
|
interface CookieOptions {
|
|
2
3
|
domain?: string;
|
|
3
4
|
httpOnly?: boolean;
|
|
@@ -8,8 +9,8 @@ interface CookieOptions {
|
|
|
8
9
|
}
|
|
9
10
|
export declare class Cookie {
|
|
10
11
|
private ctx;
|
|
11
|
-
constructor(ctx?:
|
|
12
|
-
static create(ctx?:
|
|
12
|
+
constructor(ctx?: AnyObject | null);
|
|
13
|
+
static create(ctx?: AnyObject | null): Cookie;
|
|
13
14
|
has(name: string): boolean;
|
|
14
15
|
set(name: string, value: string, ttl?: number, options?: CookieOptions): Cookie;
|
|
15
16
|
get(cookieName: string): string;
|
package/cookie/index.js
CHANGED
|
@@ -14,6 +14,7 @@ class Cookie {
|
|
|
14
14
|
return (0, is_not_empty_1.isNotEmpty)(this.get(name));
|
|
15
15
|
}
|
|
16
16
|
set(name, value, ttl = 3600, options = {}) {
|
|
17
|
+
var _a, _b;
|
|
17
18
|
const date = new Date();
|
|
18
19
|
date.setTime(date.getTime() + ttl * 1000);
|
|
19
20
|
const cookieParts = [`${name}=${encodeURIComponent(value)}`, `expires=${date.toUTCString()}`];
|
|
@@ -38,9 +39,9 @@ class Cookie {
|
|
|
38
39
|
document.cookie = cookie;
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
|
-
const existsCookies = (this.ctx.res.getHeader("Set-Cookie") || []).slice(0);
|
|
42
|
+
const existsCookies = (((_a = this.ctx) === null || _a === void 0 ? void 0 : _a.res.getHeader("Set-Cookie")) || []).slice(0);
|
|
42
43
|
existsCookies.push(cookie);
|
|
43
|
-
this.ctx.res.setHeader("Set-Cookie", existsCookies);
|
|
44
|
+
(_b = this.ctx) === null || _b === void 0 ? void 0 : _b.res.setHeader("Set-Cookie", existsCookies);
|
|
44
45
|
}
|
|
45
46
|
return this;
|
|
46
47
|
}
|
package/date/to-date-string.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { DateString } from "./index";
|
|
2
|
-
|
|
2
|
+
type InputType = Date | null;
|
|
3
|
+
type ReturnType<T extends InputType> = T extends null ? DateString | null : DateString;
|
|
4
|
+
export declare function toDateString<T extends InputType>(value: T): ReturnType<T>;
|
|
5
|
+
export {};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { DatetimeString } from "./index";
|
|
2
|
-
|
|
2
|
+
type InputType = Date | null;
|
|
3
|
+
type ReturnType<T extends InputType> = T extends null ? DatetimeString | null : DatetimeString;
|
|
4
|
+
export declare function toDatetimeString<T extends InputType>(value: T): ReturnType<T>;
|
|
5
|
+
export {};
|
package/date/to-time-string.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { TimeString } from "./index";
|
|
2
|
-
|
|
2
|
+
type InputType = Date | null;
|
|
3
|
+
type ReturnType<T extends InputType> = T extends null ? TimeString | null : TimeString;
|
|
4
|
+
export declare function toTimeString<T extends InputType>(value: T): ReturnType<T>;
|
|
5
|
+
export {};
|
package/package.json
CHANGED
package/qr/index.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface BodyScrollOptions {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface BodyScrollOptions<E extends HTMLElement> {
|
|
2
|
+
allowTouchMove?: (el: E) => boolean;
|
|
3
|
+
willReserveScrollBarGap?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare const disableBodyScroll: (targetElement:
|
|
5
|
+
export declare const disableBodyScroll: <E extends HTMLElement = HTMLElement>(targetElement: E | null, options?: BodyScrollOptions<E>) => void;
|
|
6
6
|
export declare const clearAllBodyScrollLocks: () => void;
|
|
7
|
-
export declare const enableBodyScroll: (targetElement:
|
|
7
|
+
export declare const enableBodyScroll: <E extends HTMLElement = HTMLElement>(targetElement: E | null) => void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Forked from "body-scroll-lock" https://github.com/willmcpo/body-scroll-lock
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.enableBodyScroll = exports.clearAllBodyScrollLocks = exports.disableBodyScroll = void 0;
|
|
5
|
+
const is_nil_1 = require("./is-nil");
|
|
5
6
|
const noop_1 = require("./noop");
|
|
6
7
|
// Older browsers don't support event options, feature detect it.
|
|
7
8
|
let hasPassiveEvents = false;
|
|
@@ -21,7 +22,7 @@ const isIosDevice = typeof window !== "undefined" &&
|
|
|
21
22
|
(/iP(ad|hone|od)/.test(window.navigator.platform) ||
|
|
22
23
|
(window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1));
|
|
23
24
|
let locks = [];
|
|
24
|
-
let
|
|
25
|
+
let isDocumentListenerAdded = false;
|
|
25
26
|
let initialClientY = -1;
|
|
26
27
|
let previousBodyOverflowSetting;
|
|
27
28
|
let previousBodyPosition;
|
|
@@ -34,11 +35,11 @@ const preventDefault = (rawEvent) => {
|
|
|
34
35
|
// Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
|
|
35
36
|
// in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
|
|
36
37
|
// the touchmove event on document will break.
|
|
37
|
-
if ((e === null || e === void 0 ? void 0 : e.target) && allowTouchMove(e.target)) {
|
|
38
|
+
if ((e === null || e === void 0 ? void 0 : e.target) && e.target instanceof HTMLElement && allowTouchMove(e.target)) {
|
|
38
39
|
return true;
|
|
39
40
|
}
|
|
40
41
|
// Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
|
|
41
|
-
if (
|
|
42
|
+
if (e instanceof TouchEvent && e.touches.length > 1) {
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
44
45
|
if (e === null || e === void 0 ? void 0 : e.preventDefault) {
|
|
@@ -49,9 +50,9 @@ const preventDefault = (rawEvent) => {
|
|
|
49
50
|
const setOverflowHidden = (options) => {
|
|
50
51
|
// If previousBodyPaddingRight is already set, don't set it again.
|
|
51
52
|
if (previousBodyPaddingRight === undefined) {
|
|
52
|
-
const
|
|
53
|
+
const willReserveScrollBarGap = (options === null || options === void 0 ? void 0 : options.willReserveScrollBarGap) === true;
|
|
53
54
|
const scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
54
|
-
if (
|
|
55
|
+
if (willReserveScrollBarGap && scrollBarGap > 0) {
|
|
55
56
|
const computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"), 10);
|
|
56
57
|
previousBodyPaddingRight = document.body.style.paddingRight;
|
|
57
58
|
document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarGap}px`;
|
|
@@ -119,7 +120,7 @@ const isTargetElementTotallyScrolled = (targetElement) => targetElement ? target
|
|
|
119
120
|
const handleScroll = (event, targetElement) => {
|
|
120
121
|
var _a, _b;
|
|
121
122
|
const clientY = (_b = (_a = event.targetTouches.item(0)) === null || _a === void 0 ? void 0 : _a.clientY) !== null && _b !== void 0 ? _b : 0 - initialClientY;
|
|
122
|
-
if (event.target && allowTouchMove(event.target)) {
|
|
123
|
+
if (event.target && event.target instanceof HTMLElement && allowTouchMove(event.target)) {
|
|
123
124
|
return false;
|
|
124
125
|
}
|
|
125
126
|
if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
|
|
@@ -169,9 +170,9 @@ const disableBodyScroll = (targetElement, options) => {
|
|
|
169
170
|
handleScroll(event, targetElement);
|
|
170
171
|
}
|
|
171
172
|
};
|
|
172
|
-
if (!
|
|
173
|
+
if (!isDocumentListenerAdded) {
|
|
173
174
|
document.addEventListener("touchmove", preventDefault, hasPassiveEvents ? { passive: false } : undefined);
|
|
174
|
-
|
|
175
|
+
isDocumentListenerAdded = true;
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
};
|
|
@@ -180,12 +181,15 @@ const clearAllBodyScrollLocks = () => {
|
|
|
180
181
|
if (isIosDevice) {
|
|
181
182
|
// Clear all locks ontouchstart/ontouchmove handlers, and the references.
|
|
182
183
|
locks.forEach((lock) => {
|
|
184
|
+
if ((0, is_nil_1.isNil)(lock.targetElement)) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
183
187
|
lock.targetElement.ontouchstart = null;
|
|
184
188
|
lock.targetElement.ontouchmove = null;
|
|
185
189
|
});
|
|
186
|
-
if (
|
|
190
|
+
if (isDocumentListenerAdded) {
|
|
187
191
|
document.removeEventListener("touchmove", preventDefault);
|
|
188
|
-
|
|
192
|
+
isDocumentListenerAdded = false;
|
|
189
193
|
}
|
|
190
194
|
// Reset initial clientY.
|
|
191
195
|
initialClientY = -1;
|
|
@@ -209,9 +213,9 @@ const enableBodyScroll = (targetElement) => {
|
|
|
209
213
|
if (isIosDevice) {
|
|
210
214
|
targetElement.ontouchstart = null;
|
|
211
215
|
targetElement.ontouchmove = null;
|
|
212
|
-
if (
|
|
216
|
+
if (isDocumentListenerAdded && locks.length === 0) {
|
|
213
217
|
document.removeEventListener("touchmove", preventDefault);
|
|
214
|
-
|
|
218
|
+
isDocumentListenerAdded = false;
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
if (isIosDevice) {
|
package/utils/cxa.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { AnyObject } from "../types";
|
|
2
|
+
export type CxaClassValue = CxaClassArray | AnyObject | string | number | null | boolean | undefined;
|
|
2
3
|
export type CxaClassArray = CxaClassValue[];
|
|
3
4
|
export declare function cxa(...classes: CxaClassValue[]): string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// packages/core/utils/deep-equal-ingoring-key-order.test.ts
|
|
4
3
|
const deep_equal_ingoring_key_order_1 = require("./deep-equal-ingoring-key-order");
|
|
5
4
|
describe("deepEqualIgnoringKeyOrder", () => {
|
|
6
5
|
it("returns true for objects with same keys in different orders", () => {
|
package/utils/is-empty.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} | string): boolean;
|
|
1
|
+
import { AnyObject } from "../types";
|
|
2
|
+
export declare function isEmpty(value: unknown[] | AnyObject | string): boolean;
|
package/utils/is-nil.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isNil(value:
|
|
1
|
+
export declare function isNil(value: unknown): value is null | undefined;
|
package/utils/is-not-empty.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} | string): boolean;
|
|
1
|
+
import { AnyObject } from "../types";
|
|
2
|
+
export declare function isNotEmpty(value: unknown[] | AnyObject | string): boolean;
|
package/utils/omit.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { AnyObject } from "../types";
|
|
2
|
+
export declare function omit<T extends AnyObject, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { AnyObject } from "../types";
|
|
2
|
+
export declare function sortObjectKeys<T extends AnyObject>(object: T): T;
|
|
@@ -5,5 +5,5 @@ export declare const FormValidator: {
|
|
|
5
5
|
isLessOrEqualThan: (maxValue: number, errorMessage?: string) => (value: string) => string | undefined;
|
|
6
6
|
isLessThan: (maxValue: number, errorMessage?: string) => (value: string) => string | undefined;
|
|
7
7
|
isPhone: (errorMessage?: string) => (value: string) => string | undefined;
|
|
8
|
-
required: (errorMessage?: string) => (value:
|
|
8
|
+
required: (errorMessage?: string) => (value: unknown) => string | undefined;
|
|
9
9
|
};
|