@esposter/shared 4.3.3 → 4.5.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/README.md +10 -19
- package/dist/index.d.ts +245 -27
- package/dist/index.js +790 -97
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -5,27 +5,29 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Provides shared TypeScript utilities, types and error classes for the Esposter platform.
|
|
9
|
+
|
|
10
|
+
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/shared).
|
|
9
11
|
|
|
10
12
|
## Table of Contents
|
|
11
13
|
|
|
12
14
|
- 🚀 [Getting Started](#getting-started)
|
|
13
|
-
-
|
|
15
|
+
- 🧩 [Key Exports](#key-exports)
|
|
14
16
|
- ⚖️ [License](#license)
|
|
15
17
|
|
|
16
18
|
---
|
|
17
19
|
|
|
18
20
|
## <a name="getting-started">🚀 Getting Started</a>
|
|
19
21
|
|
|
22
|
+
Install the package and zod.
|
|
23
|
+
|
|
20
24
|
```bash
|
|
21
25
|
pnpm i @esposter/shared zod
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
The package works in browser and server environments.
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Key Exports
|
|
30
|
+
## <a name="key-exports">🧩 Key Exports</a>
|
|
29
31
|
|
|
30
32
|
#### Error Classes
|
|
31
33
|
|
|
@@ -40,7 +42,7 @@ throw new InvalidOperationError(Operation.Read, file.name, zodError.message);
|
|
|
40
42
|
```ts
|
|
41
43
|
import { takeOne } from "@esposter/shared";
|
|
42
44
|
|
|
43
|
-
//
|
|
45
|
+
// The first item, typed without `undefined`; an out-of-bounds index still yields `undefined` at runtime
|
|
44
46
|
const first = takeOne(items);
|
|
45
47
|
```
|
|
46
48
|
|
|
@@ -49,7 +51,7 @@ const first = takeOne(items);
|
|
|
49
51
|
```ts
|
|
50
52
|
import type { ToData, DeepOmit, GetPaths } from "@esposter/shared";
|
|
51
53
|
|
|
52
|
-
// ToData<T> —
|
|
54
|
+
// ToData<T> — the plain data shape of T, with its `toJSON` method removed at every depth
|
|
53
55
|
type RawColumn = ToData<Column>;
|
|
54
56
|
```
|
|
55
57
|
|
|
@@ -74,17 +76,6 @@ import { capitalize, truncate, toKebabCase } from "@esposter/shared";
|
|
|
74
76
|
import { getResult, getResultAsync, withFinalizer } from "@esposter/shared";
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
### Commands
|
|
78
|
-
|
|
79
|
-
Run from `packages/shared/`:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
pnpm build # compile to dist/
|
|
83
|
-
pnpm test # vitest watch mode (coverage is run from the repo root)
|
|
84
|
-
pnpm lint:fix # auto-fix lint
|
|
85
|
-
pnpm typecheck # type check
|
|
86
|
-
```
|
|
87
|
-
|
|
88
79
|
## <a name="license">⚖️ License</a>
|
|
89
80
|
|
|
90
81
|
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Result, ResultAsync } from "neverthrow";
|
|
3
|
-
import { HTMLElement } from "node-html-parser";
|
|
3
|
+
import { HTMLElement as HTMLElement$1 } from "node-html-parser";
|
|
4
4
|
import { DefaultTreeAdapterTypes, html as html$1 } from "parse5";
|
|
5
5
|
export declare class ForbiddenError extends Error {
|
|
6
6
|
constructor(message: string);
|
|
@@ -139,6 +139,150 @@ export declare enum ObjectMethod {
|
|
|
139
139
|
ToString = "toString",
|
|
140
140
|
ValueOf = "valueOf"
|
|
141
141
|
}
|
|
142
|
+
export interface PanzoomEventDetail {
|
|
143
|
+
isSVG: boolean;
|
|
144
|
+
originalEvent?: Event;
|
|
145
|
+
scale: number;
|
|
146
|
+
x: number;
|
|
147
|
+
y: number;
|
|
148
|
+
}
|
|
149
|
+
export declare enum PanzoomContain {
|
|
150
|
+
Automatic = "automatic",
|
|
151
|
+
Inside = "inside",
|
|
152
|
+
Outside = "outside"
|
|
153
|
+
}
|
|
154
|
+
export type PanzoomStartScale = "fit" | number;
|
|
155
|
+
export interface PanzoomOptions {
|
|
156
|
+
animate?: boolean;
|
|
157
|
+
canvas?: boolean;
|
|
158
|
+
contain?: PanzoomContain;
|
|
159
|
+
cursor?: string;
|
|
160
|
+
disablePan?: boolean;
|
|
161
|
+
disableXAxis?: boolean;
|
|
162
|
+
disableYAxis?: boolean;
|
|
163
|
+
disableZoom?: boolean;
|
|
164
|
+
duration?: number;
|
|
165
|
+
easing?: string;
|
|
166
|
+
exclude?: Element[];
|
|
167
|
+
excludeClass?: string;
|
|
168
|
+
filter?: (event: PointerEvent) => boolean;
|
|
169
|
+
handleStartEvent?: (event: Event) => void;
|
|
170
|
+
maxScale?: number;
|
|
171
|
+
minScale?: number;
|
|
172
|
+
noBind?: boolean;
|
|
173
|
+
overflow?: string;
|
|
174
|
+
panCursor?: string;
|
|
175
|
+
panOnlyWhenZoomed?: boolean;
|
|
176
|
+
panThreshold?: number;
|
|
177
|
+
pinchAndPan?: boolean;
|
|
178
|
+
relative?: boolean;
|
|
179
|
+
roundPixels?: boolean;
|
|
180
|
+
setTransform?: (element: HTMLElement | SVGElement, detail: Pick<PanzoomEventDetail, "isSVG" | "scale" | "x" | "y">) => void;
|
|
181
|
+
silent?: boolean;
|
|
182
|
+
startScale?: PanzoomStartScale;
|
|
183
|
+
startX?: number;
|
|
184
|
+
startY?: number;
|
|
185
|
+
step?: number;
|
|
186
|
+
touchAction?: string;
|
|
187
|
+
}
|
|
188
|
+
export interface PanzoomPanOptions extends PanzoomOptions {
|
|
189
|
+
force?: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface PanzoomPoint {
|
|
192
|
+
x: number;
|
|
193
|
+
y: number;
|
|
194
|
+
}
|
|
195
|
+
export interface PanzoomZoomOptions extends PanzoomPanOptions {
|
|
196
|
+
focal?: PanzoomPoint;
|
|
197
|
+
}
|
|
198
|
+
export interface Panzoom {
|
|
199
|
+
bind: () => void;
|
|
200
|
+
destroy: () => void;
|
|
201
|
+
fit: (fitOptions?: PanzoomPanOptions) => PanzoomEventDetail;
|
|
202
|
+
getOptions: () => PanzoomOptions;
|
|
203
|
+
getPan: () => PanzoomPoint;
|
|
204
|
+
getScale: () => number;
|
|
205
|
+
pan: (x: number, y: number, panOptions?: PanzoomPanOptions) => PanzoomEventDetail;
|
|
206
|
+
reset: (resetOptions?: PanzoomPanOptions) => PanzoomEventDetail;
|
|
207
|
+
resetStyle: () => void;
|
|
208
|
+
setOptions: (options?: PanzoomOptions) => void;
|
|
209
|
+
zoom: (scale: number, zoomOptions?: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
210
|
+
zoomIn: (zoomOptions?: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
211
|
+
zoomOut: (zoomOptions?: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
212
|
+
zoomToPoint: (scale: number, point: Pick<MouseEvent, "clientX" | "clientY">, zoomOptions?: PanzoomZoomOptions, originalEvent?: Event) => PanzoomEventDetail;
|
|
213
|
+
zoomWithWheel: (event: WheelEvent, zoomOptions?: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
214
|
+
}
|
|
215
|
+
export interface PanzoomAxis {
|
|
216
|
+
center: number;
|
|
217
|
+
length: number;
|
|
218
|
+
parentLength: number;
|
|
219
|
+
parentStart: number;
|
|
220
|
+
}
|
|
221
|
+
export interface PanzoomBox {
|
|
222
|
+
height: number;
|
|
223
|
+
left: number;
|
|
224
|
+
top: number;
|
|
225
|
+
width: number;
|
|
226
|
+
}
|
|
227
|
+
export interface PanzoomDrag {
|
|
228
|
+
anchorPan: PanzoomPoint;
|
|
229
|
+
anchorPoint: PanzoomPoint;
|
|
230
|
+
downPoint: PanzoomPoint;
|
|
231
|
+
isDragging: boolean;
|
|
232
|
+
}
|
|
233
|
+
export type PanzoomElement = HTMLElement | SVGElement;
|
|
234
|
+
export interface PanzoomPinch {
|
|
235
|
+
midpoint: PanzoomPoint;
|
|
236
|
+
startDistance: number;
|
|
237
|
+
startScale: number;
|
|
238
|
+
}
|
|
239
|
+
export interface PanzoomState {
|
|
240
|
+
scale: number;
|
|
241
|
+
x: number;
|
|
242
|
+
y: number;
|
|
243
|
+
}
|
|
244
|
+
export interface PanzoomContext {
|
|
245
|
+
drag?: PanzoomDrag;
|
|
246
|
+
element: PanzoomElement;
|
|
247
|
+
isClickSuppressed: boolean;
|
|
248
|
+
isDestroyed: boolean;
|
|
249
|
+
options: PanzoomOptions;
|
|
250
|
+
parent: PanzoomElement;
|
|
251
|
+
pinch?: PanzoomPinch;
|
|
252
|
+
pointers: Map<number, PanzoomPoint>;
|
|
253
|
+
state: PanzoomState;
|
|
254
|
+
styles: Map<PanzoomElement, Map<string, string>>;
|
|
255
|
+
}
|
|
256
|
+
export declare enum PanzoomDeltaMode {
|
|
257
|
+
Pixel = 0,
|
|
258
|
+
Line = 1,
|
|
259
|
+
Page = 2
|
|
260
|
+
}
|
|
261
|
+
export declare enum PanzoomEventName {
|
|
262
|
+
Change = "panzoomchange",
|
|
263
|
+
End = "panzoomend",
|
|
264
|
+
Pan = "panzoompan",
|
|
265
|
+
Reset = "panzoomreset",
|
|
266
|
+
Start = "panzoomstart",
|
|
267
|
+
Zoom = "panzoomzoom"
|
|
268
|
+
}
|
|
269
|
+
export interface PanzoomSize {
|
|
270
|
+
height: number;
|
|
271
|
+
width: number;
|
|
272
|
+
}
|
|
273
|
+
export interface PanzoomMeasure {
|
|
274
|
+
center: PanzoomPoint;
|
|
275
|
+
parent: PanzoomBox;
|
|
276
|
+
size: PanzoomSize;
|
|
277
|
+
}
|
|
278
|
+
export interface PanzoomPinchFrame {
|
|
279
|
+
distance: number;
|
|
280
|
+
midpoint: PanzoomPoint;
|
|
281
|
+
}
|
|
282
|
+
export declare enum PanzoomZoomDirection {
|
|
283
|
+
In = "in",
|
|
284
|
+
Out = "out"
|
|
285
|
+
}
|
|
142
286
|
export interface ProfanityOptions {
|
|
143
287
|
isWholeWord: boolean;
|
|
144
288
|
}
|
|
@@ -188,6 +332,7 @@ export type AttributesTransformer = (attributes: Record<string, string>) => Reco
|
|
|
188
332
|
export interface SanitizeHtmlOptions {
|
|
189
333
|
allowedAttributes?: Record<string, string[]>;
|
|
190
334
|
allowedClasses?: Record<string, string[]>;
|
|
335
|
+
allowedSources?: Record<string, Record<string, RegExp[]>>;
|
|
191
336
|
allowedStyles?: Record<string, Record<string, RegExp[]>>;
|
|
192
337
|
allowedTags?: string[];
|
|
193
338
|
transformAttributes?: Record<string, AttributesTransformer>;
|
|
@@ -196,10 +341,12 @@ export interface SanitizePolicy {
|
|
|
196
341
|
allowedAttributes: Record<string, string[]>;
|
|
197
342
|
allowedClasses: Record<string, string[]>;
|
|
198
343
|
allowedSchemes: string[];
|
|
344
|
+
allowedSources: Record<string, Record<string, RegExp[]>>;
|
|
199
345
|
allowedStyles: Record<string, Record<string, RegExp[]>>;
|
|
200
346
|
allowedTags: string[];
|
|
201
347
|
transformAttributes: Record<string, AttributesTransformer>;
|
|
202
348
|
}
|
|
349
|
+
export type TextHtmlAllowance = Pick<SanitizeHtmlOptions, "allowedAttributes" | "allowedSources" | "allowedTags">;
|
|
203
350
|
export interface ItemEntityType<T extends string> {
|
|
204
351
|
type: T;
|
|
205
352
|
}
|
|
@@ -1870,6 +2017,29 @@ export interface ItemMetadataClass<TBase extends Class<object>> {
|
|
|
1870
2017
|
new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
|
|
1871
2018
|
prototype: InstanceType<TBase> & ItemMetadata;
|
|
1872
2019
|
}
|
|
2020
|
+
export type GetArrayProps<T extends unknown[], P extends string, D extends unknown[], R extends boolean> = (D extends [unknown, ...infer Rest] ? GetProperties<T[number], R extends true ? `${P}[number]` : `${P}.[number]`, Rest, false> : never) | {
|
|
2021
|
+
path: R extends true ? "length" : `${P}.length`;
|
|
2022
|
+
value: T["length"];
|
|
2023
|
+
};
|
|
2024
|
+
export type FunctionLike = ((...args: never) => unknown) | (abstract new (...args: never) => unknown);
|
|
2025
|
+
export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
2026
|
+
export type GetObjectProps<T, P extends string, D extends unknown[], R extends boolean> = { [K in keyof KnownKeys<T> & (number | string)]: K extends `${number}` ? never : NonNullable<T[K]> extends FunctionLike ? never : (D extends [unknown, ...infer Rest] ? GetProperties<T[K], R extends true ? `${K}` : `${P}.${K}`, Rest, false> : never) | {
|
|
2027
|
+
path: R extends true ? `${K}` : `${P}.${K}`;
|
|
2028
|
+
value: T[K];
|
|
2029
|
+
}; }[keyof KnownKeys<T> & (number | string)];
|
|
2030
|
+
export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
|
|
2031
|
+
path: R extends true ? "length" : `${P}.length`;
|
|
2032
|
+
value: number;
|
|
2033
|
+
} : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
|
|
2034
|
+
path: R extends true ? "description" : `${P}.description`;
|
|
2035
|
+
value: string | undefined;
|
|
2036
|
+
} : never;
|
|
2037
|
+
export type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends (infer O) ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
|
|
2038
|
+
export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
|
|
2039
|
+
path: infer Path;
|
|
2040
|
+
} ? Path : never) : never;
|
|
2041
|
+
export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
|
|
2042
|
+
export declare const ItemMetadataPropertyNames: PropertyNames<ItemMetadata>;
|
|
1873
2043
|
export declare abstract class Serializable {
|
|
1874
2044
|
toJSON(): this;
|
|
1875
2045
|
}
|
|
@@ -1877,7 +2047,6 @@ export interface TakeOne {
|
|
|
1877
2047
|
<T extends readonly unknown[]>(values: T, index?: number): T[number];
|
|
1878
2048
|
<T extends object>(values: T, index: keyof T): T[keyof T];
|
|
1879
2049
|
}
|
|
1880
|
-
export type FunctionLike = ((...args: never) => unknown) | (abstract new (...args: never) => unknown);
|
|
1881
2050
|
export type DeepOmit<T, TKey extends PropertyKey> = T extends DeepOmitKeptValue ? T : T extends readonly unknown[] ? { [K in keyof T]: DeepOmit<T[K], TKey>; } : T extends object ? [keyof T] extends [never] ? T : { [P in keyof T as P extends symbol ? never : P extends TKey ? never : P]: DeepOmit<T[P], TKey>; } : T;
|
|
1882
2051
|
type DeepOmitKeptValue = ArrayBufferView | Blob | Date | FunctionLike | Map<unknown, unknown> | Primitive | Promise<unknown> | RegExp | Set<unknown>;
|
|
1883
2052
|
export type DeepOptionalUndefined<T> = T extends Date | FunctionLike | Primitive ? T : T extends unknown[] ? { [K in keyof T]: DeepOptionalUndefined<T[K]>; } : T extends object ? { [K in keyof T as undefined extends T[K] ? K : never]?: DeepOptionalUndefined<T[K]>; } & { [K in keyof T as undefined extends T[K] ? never : K]: DeepOptionalUndefined<T[K]>; } extends (infer O) ? { [K in keyof O]: O[K]; } : never : T;
|
|
@@ -1941,7 +2110,9 @@ export declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
|
|
|
1941
2110
|
export declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
|
|
1942
2111
|
export declare const SPOILER_ATTRIBUTE = "data-spoiler";
|
|
1943
2112
|
export declare const SPOILER_SELECTOR: string;
|
|
1944
|
-
export declare const
|
|
2113
|
+
export declare const checkIsOnlyReactor: (userIds: string[], userId: string) => boolean;
|
|
2114
|
+
export declare const getUpdatedUserIds: (userIds: string[], newUserId: string) => string[];
|
|
2115
|
+
export declare const getMentions: (message: string) => HTMLElement$1[];
|
|
1945
2116
|
export declare const charset: (type: string) => false | string;
|
|
1946
2117
|
export declare const MEDIA_TYPE_REGEX: RegExp;
|
|
1947
2118
|
export declare const PATH_SEPARATOR_REGEX: RegExp;
|
|
@@ -1961,11 +2132,74 @@ export declare const getMediaType: (value: string) => string;
|
|
|
1961
2132
|
export declare const getMimeScore: (mimeType: string, source?: string) => number;
|
|
1962
2133
|
export declare const getMimeTypeEntryMap: () => ReadonlyMap<string, MimeDatabaseEntry>;
|
|
1963
2134
|
export declare const lookup: (path: string) => false | string;
|
|
2135
|
+
export declare const applyPanzoomStyles: (context: PanzoomContext) => void;
|
|
2136
|
+
export declare const bindPanzoom: (context: PanzoomContext, signal: AbortSignal) => void;
|
|
2137
|
+
export declare const checkIsContainableLength: (length: number) => boolean;
|
|
2138
|
+
export declare const checkIsPanzoomElement: (value: Element) => value is PanzoomElement;
|
|
2139
|
+
export declare const checkIsPanzoomExcluded: (target: Element, { exclude, excludeClass }: Pick<PanzoomOptions, "exclude" | "excludeClass">) => boolean;
|
|
2140
|
+
export declare const checkIsZoomRefused: ({ disableZoom, force }: PanzoomZoomOptions) => boolean;
|
|
2141
|
+
export declare const PANZOOM_DEFAULT_MAX_SCALE = 4;
|
|
2142
|
+
export declare const PANZOOM_DEFAULT_MIN_SCALE = .125;
|
|
2143
|
+
export declare const PANZOOM_DEFAULT_START_SCALE = 1;
|
|
2144
|
+
export declare const PANZOOM_DEFAULT_STEP = .3;
|
|
2145
|
+
export declare const PANZOOM_WHEEL_STEP_DIVISOR = 3;
|
|
2146
|
+
export declare const PANZOOM_WHEEL_NOTCH_PIXELS = 100;
|
|
2147
|
+
export declare const PANZOOM_PIXELS_PER_LINE = 16;
|
|
2148
|
+
export declare const PANZOOM_PRIMARY_BUTTON = 0;
|
|
2149
|
+
export declare const PANZOOM_DEFAULT_CURSOR = "move";
|
|
2150
|
+
export declare const PANZOOM_DEFAULT_DURATION = 200;
|
|
2151
|
+
export declare const PANZOOM_DEFAULT_EASING = "ease-in-out";
|
|
2152
|
+
export declare const PANZOOM_DEFAULT_EXCLUDE_CLASS = "panzoom-exclude";
|
|
2153
|
+
export declare const PANZOOM_DEFAULT_OVERFLOW = "hidden";
|
|
2154
|
+
export declare const PANZOOM_DEFAULT_PAN_THRESHOLD = 0;
|
|
2155
|
+
export declare const PANZOOM_DEFAULT_START_PAN = 0;
|
|
2156
|
+
export declare const PANZOOM_DEFAULT_TOUCH_ACTION = "none";
|
|
2157
|
+
export declare const PANZOOM_TRANSFORM_ORIGIN = "50% 50%";
|
|
2158
|
+
export declare const PANZOOM_SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
2159
|
+
export declare const PANZOOM_DEFAULT_OPTIONS: Readonly<PanzoomOptions>;
|
|
2160
|
+
export declare const constrainPanzoomAxis: (value: number, axis: PanzoomAxis, scale: number, contain?: PanzoomContain) => number;
|
|
2161
|
+
export declare const constrainPanzoomPan: (current: PanzoomState, requested: PanzoomPoint, toScale: number, measure: PanzoomMeasure, options: PanzoomPanOptions) => PanzoomPoint;
|
|
2162
|
+
export declare const constrainPanzoomScale: (scale: number, measure: PanzoomMeasure, { contain, maxScale, minScale }: Pick<PanzoomOptions, "contain" | "maxScale" | "minScale">) => number;
|
|
2163
|
+
export declare const createPanzoom: (element: PanzoomElement, options?: PanzoomOptions) => Panzoom;
|
|
2164
|
+
export declare const dispatchPanzoomChange: (context: Pick<PanzoomContext, "element" | "isDestroyed">, name: PanzoomEventName, detail: PanzoomEventDetail, options: Pick<PanzoomOptions, "silent">) => void;
|
|
2165
|
+
export declare const dispatchPanzoomEvent: ({ element, isDestroyed }: Pick<PanzoomContext, "element" | "isDestroyed">, name: PanzoomEventName, detail: PanzoomEventDetail, { silent }: Pick<PanzoomOptions, "silent">) => void;
|
|
2166
|
+
export declare const endPanzoomGesture: (context: PanzoomContext, event: PointerEvent) => void;
|
|
2167
|
+
export declare const fitPanzoom: (context: PanzoomContext, callOptions: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
2168
|
+
export declare const getPanzoomCallOptions: ({ options }: PanzoomContext, callOptions: PanzoomZoomOptions) => PanzoomZoomOptions;
|
|
2169
|
+
export declare const getPanzoomCentredPan: (scale: number, measure: PanzoomMeasure) => PanzoomPoint;
|
|
2170
|
+
export declare const getPanzoomCoverScale: (measure: PanzoomMeasure) => number;
|
|
2171
|
+
export declare const getPanzoomDrag: (state: PanzoomState, point: PanzoomPoint) => PanzoomDrag;
|
|
2172
|
+
export declare const getPanzoomEventDetail: ({ element, state }: PanzoomContext, originalEvent?: Event) => PanzoomEventDetail;
|
|
2173
|
+
export declare const getPanzoomFitScale: ({ parent, size }: PanzoomMeasure) => number;
|
|
2174
|
+
export declare const getPanzoomFocalPan: (current: PanzoomState, toScale: number, point: PanzoomPoint, measure: PanzoomMeasure) => PanzoomPoint;
|
|
2175
|
+
export declare const getPanzoomMeasure: (element: PanzoomElement, parent: PanzoomElement, state: PanzoomState) => PanzoomMeasure;
|
|
2176
|
+
export declare const getPanzoomParent: (element: PanzoomElement) => null | PanzoomElement;
|
|
2177
|
+
export declare const getPanzoomPinchFrame: (pointers: Map<number, PanzoomPoint>) => PanzoomPinchFrame;
|
|
2178
|
+
export declare const getPanzoomPinchScale: (startScale: number, startDistance: number, distance: number) => number;
|
|
2179
|
+
export declare const getPanzoomStartScale: (measure: PanzoomMeasure, options: Pick<PanzoomPanOptions, "contain" | "maxScale" | "minScale" | "startScale">) => number;
|
|
2180
|
+
export declare const getPanzoomStartState: (state: PanzoomState, measure: PanzoomMeasure, options: PanzoomPanOptions) => PanzoomState;
|
|
2181
|
+
export declare const getPanzoomStepScale: (scale: number, direction: PanzoomZoomDirection, step?: number) => number;
|
|
2182
|
+
export declare const getPanzoomTarget: ({ element, options, parent }: PanzoomContext) => PanzoomElement;
|
|
2183
|
+
export declare const getPanzoomWheelScale: (scale: number, { deltaMode, deltaX, deltaY }: Pick<WheelEvent, "deltaMode" | "deltaX" | "deltaY">, step?: number) => number;
|
|
2184
|
+
export declare const getPanzoomZoomedState: (state: PanzoomState, measure: PanzoomMeasure, options: PanzoomPanOptions, scale: number, focal?: PanzoomPoint) => PanzoomState;
|
|
2185
|
+
export declare const movePanzoomDrag: (context: PanzoomContext, drag: PanzoomDrag, point: PanzoomPoint, event: PointerEvent) => void;
|
|
2186
|
+
export declare const movePanzoomGesture: (context: PanzoomContext, event: PointerEvent) => void;
|
|
2187
|
+
export declare const movePanzoomPinch: (context: PanzoomContext, pinch: PanzoomPinch, event: PointerEvent) => void;
|
|
2188
|
+
export declare const panPanzoom: (context: PanzoomContext, point: PanzoomPoint, callOptions: PanzoomZoomOptions, originalEvent?: Event) => PanzoomEventDetail;
|
|
2189
|
+
export declare const reanchorPanzoomDrag: ({ drag, pointers, state }: PanzoomContext) => void;
|
|
2190
|
+
export declare const resetPanzoom: (context: PanzoomContext, callOptions: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
2191
|
+
export declare const restorePanzoomStyles: ({ styles }: PanzoomContext, properties?: readonly string[]) => void;
|
|
2192
|
+
export declare const startPanzoomGesture: (context: PanzoomContext, event: PointerEvent) => void;
|
|
2193
|
+
export declare const writePanzoomState: (context: PanzoomContext, state: PanzoomState, { animate, duration, easing, setTransform }: PanzoomPanOptions) => void;
|
|
2194
|
+
export declare const writePanzoomStyle: ({ isDestroyed, styles }: PanzoomContext, element: PanzoomElement, property: string, value: string) => void;
|
|
2195
|
+
export declare const zoomPanzoom: (context: PanzoomContext, scale: number, callOptions: PanzoomZoomOptions, originalEvent?: Event) => PanzoomEventDetail;
|
|
2196
|
+
export declare const zoomPanzoomStep: (context: PanzoomContext, direction: PanzoomZoomDirection, zoomOptions: PanzoomZoomOptions) => PanzoomEventDetail;
|
|
1964
2197
|
export declare const css: typeof String.raw;
|
|
1965
2198
|
export declare const html: typeof String.raw;
|
|
1966
2199
|
export declare const checkContainsProfanity: (text: unknown, { isWholeWord }?: Partial<ProfanityOptions>) => boolean;
|
|
1967
2200
|
export declare const englishProfaneWords: readonly string[];
|
|
1968
2201
|
export declare const checkIsAllowedUrl: (url: string, allowedSchemes: string[]) => boolean;
|
|
2202
|
+
export declare const checkIsSourceAllowed: (element: DefaultTreeAdapterTypes.Element, allowedSources: SanitizePolicy["allowedSources"]) => boolean;
|
|
1969
2203
|
export declare const checkIsUnsafeUrlCharacter: (character: string) => boolean;
|
|
1970
2204
|
export declare const checkIsWhitespaceCharacter: (character: string) => boolean;
|
|
1971
2205
|
export declare const collectText: (nodes: DefaultTreeAdapterTypes.ChildNode[], depth: number) => string;
|
|
@@ -1983,7 +2217,7 @@ export declare const MAX_NESTING_DEPTH = 256;
|
|
|
1983
2217
|
export declare const SRCSET_DESCRIPTOR_REGEX: RegExp;
|
|
1984
2218
|
export declare const ESCAPED_TEXT_CHARACTERS_REGEX: RegExp;
|
|
1985
2219
|
export declare const ESCAPED_ATTRIBUTE_CHARACTERS_REGEX: RegExp;
|
|
1986
|
-
export declare const SANITIZER_ADVISORY_WATCH_SINCE = "2026-10-
|
|
2220
|
+
export declare const SANITIZER_ADVISORY_WATCH_SINCE = "2026-10-23";
|
|
1987
2221
|
export declare const escapeAttribute: (value: string) => string;
|
|
1988
2222
|
export declare const escapeCharacters: (value: string, charactersRegex: RegExp, entities: Record<string, string>) => string;
|
|
1989
2223
|
export declare const escapeText: (text: string) => string;
|
|
@@ -1993,12 +2227,14 @@ export declare const filterHtml: (html: string, policy: SanitizePolicy) => strin
|
|
|
1993
2227
|
export declare const filterSrcset: (value: string, allowedSchemes: string[]) => string | undefined;
|
|
1994
2228
|
export declare const filterStyle: (value: string, rules: Record<string, RegExp[]> | undefined) => string | undefined;
|
|
1995
2229
|
export declare const getChildNodes: (element: DefaultTreeAdapterTypes.Element) => DefaultTreeAdapterTypes.ChildNode[];
|
|
2230
|
+
export declare const getTagPolicy: <T>(tagPolicies: Record<string, T>, tagName: string) => T | undefined;
|
|
1996
2231
|
export declare const matchesClassPattern: (className: string, pattern: string) => boolean;
|
|
1997
2232
|
export declare const renderNode: (node: DefaultTreeAdapterTypes.ChildNode, policy: SanitizePolicy, depth: number) => string;
|
|
1998
2233
|
export declare const sanitizeHtml: (html: string, options?: SanitizeHtmlOptions) => string;
|
|
1999
|
-
export declare const sanitizeTextHtml: (html: string) => string;
|
|
2234
|
+
export declare const sanitizeTextHtml: (html: string, allowance?: TextHtmlAllowance) => string;
|
|
2000
2235
|
export declare const applyItemMetadataMixin: <TBase extends Class<object>>(Base: TBase) => ItemMetadataClass<TBase>;
|
|
2001
2236
|
export declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
2237
|
+
export declare const createRecordSchema: <TKey extends z.core.$ZodRecordKey, TValue extends z.core.SomeType>(keySchema: TKey, valueSchema: TValue, maxEntries: number) => z.ZodRecord<TKey, TValue>;
|
|
2002
2238
|
export declare const createUniqueArraySchema: CreateUniqueArraySchema;
|
|
2003
2239
|
export declare const DEFAULT_COMPRESSION_LEVEL = 12;
|
|
2004
2240
|
export declare const MIN_WINDOW_LOG = 10;
|
|
@@ -2032,33 +2268,13 @@ export declare const checkIsSameBytes: (first: ArrayBuffer | ArrayBufferView | S
|
|
|
2032
2268
|
export declare const checkIsSameValueZero: (first: unknown, second: unknown) => boolean;
|
|
2033
2269
|
export declare const clonePlainDeep: <T>(data: T) => T;
|
|
2034
2270
|
export declare const getEnumerableKeys: (value: object) => PropertyKey[];
|
|
2035
|
-
export type GetArrayProps<T extends unknown[], P extends string, D extends unknown[], R extends boolean> = (D extends [unknown, ...infer Rest] ? GetProperties<T[number], R extends true ? `${P}[number]` : `${P}.[number]`, Rest, false> : never) | {
|
|
2036
|
-
path: R extends true ? "length" : `${P}.length`;
|
|
2037
|
-
value: T["length"];
|
|
2038
|
-
};
|
|
2039
|
-
export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
2040
|
-
export type GetObjectProps<T, P extends string, D extends unknown[], R extends boolean> = { [K in keyof KnownKeys<T> & (number | string)]: K extends `${number}` ? never : NonNullable<T[K]> extends FunctionLike ? never : (D extends [unknown, ...infer Rest] ? GetProperties<T[K], R extends true ? `${K}` : `${P}.${K}`, Rest, false> : never) | {
|
|
2041
|
-
path: R extends true ? `${K}` : `${P}.${K}`;
|
|
2042
|
-
value: T[K];
|
|
2043
|
-
}; }[keyof KnownKeys<T> & (number | string)];
|
|
2044
|
-
export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
|
|
2045
|
-
path: R extends true ? "length" : `${P}.length`;
|
|
2046
|
-
value: number;
|
|
2047
|
-
} : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
|
|
2048
|
-
path: R extends true ? "description" : `${P}.description`;
|
|
2049
|
-
value: string | undefined;
|
|
2050
|
-
} : never;
|
|
2051
|
-
export type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends (infer O) ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
|
|
2052
|
-
export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
|
|
2053
|
-
path: infer Path;
|
|
2054
|
-
} ? Path : never) : never;
|
|
2055
|
-
export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
|
|
2056
2271
|
export declare const getPropertyNames: <T>() => PropertyNames<T>;
|
|
2057
2272
|
export declare const jsonDateParse: <T = any>(text: string) => T;
|
|
2058
2273
|
export type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K]; } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
|
|
2059
2274
|
export declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
|
|
2060
2275
|
export declare const omitDeep: <T, TKey extends string>(value: T, ...keys: TKey[]) => DeepOmit<T, TKey>;
|
|
2061
2276
|
export declare const createEvictingPromiseCache: <TArguments extends unknown[], TValue>(getKey: (...args: TArguments) => string, load: (...args: TArguments) => Promise<TValue>) => ((...args: TArguments) => Promise<TValue>);
|
|
2277
|
+
export declare const rethrowRejections: (reasons: unknown[]) => void;
|
|
2062
2278
|
export declare const settleAll: <T>(tasks: (() => Promise<T>)[], concurrencyLimit?: number) => Promise<T[]>;
|
|
2063
2279
|
export declare const getRawData: <T>(data: T) => T;
|
|
2064
2280
|
export declare const toRawDeep: <T extends object>(data: T) => T;
|
|
@@ -2067,12 +2283,14 @@ export declare const dedent: Dedent;
|
|
|
2067
2283
|
export declare const encodeUrlSubDelimiters: (value: string) => string;
|
|
2068
2284
|
export declare const getDecodedUriComponent: (value: string, fallback: string) => string;
|
|
2069
2285
|
export declare const normalizeString: (value: string | undefined) => string;
|
|
2286
|
+
export declare const padWithZeros: (value: number, length: number) => string;
|
|
2070
2287
|
export declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
|
|
2071
2288
|
export declare const toKebabCase: <T extends string>(string: T) => KebabCase<T>;
|
|
2072
2289
|
export declare const truncate: (string: string, length: number) => string;
|
|
2073
2290
|
export declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
|
|
2074
2291
|
export declare const MILLISECONDS_PER_SECOND = 1e3;
|
|
2075
|
-
export declare const
|
|
2292
|
+
export declare const createExponentialBackoff: (baseDelayMs: number, maxDelayMs: number) => (<T>(operation: () => Promise<T>) => Promise<T>);
|
|
2293
|
+
export declare const getExponentialBackoffDelayMs: (attempt: number, baseDelayMs: number, maxDelayMs: number) => number;
|
|
2076
2294
|
export declare const now: () => string;
|
|
2077
2295
|
export declare const sleep: (durationMs: number) => Promise<void>;
|
|
2078
2296
|
export declare const exhaustiveGuard: (value: never) => never;
|