@fiddle-digital/string-tune 1.1.38 → 1.1.40
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/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +55 -5
- package/dist/index.d.ts +55 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1005,20 +1005,41 @@ declare class RuleParserTool implements IStringTool<RuleParserInput, RuleParserR
|
|
|
1005
1005
|
process({ value }: RuleParserInput): RuleParserResult[];
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
|
+
interface ValidationContext {
|
|
1009
|
+
fieldKey?: string;
|
|
1010
|
+
values?: Record<string, any>;
|
|
1011
|
+
getValue?: (key: string) => any;
|
|
1012
|
+
}
|
|
1008
1013
|
interface ValidateInput {
|
|
1009
1014
|
rules: RuleParserResult[];
|
|
1010
1015
|
value: any;
|
|
1011
1016
|
type?: "input" | "beforeinput";
|
|
1017
|
+
context?: ValidationContext;
|
|
1012
1018
|
}
|
|
1013
1019
|
interface ValidationResult {
|
|
1014
1020
|
valid: boolean;
|
|
1015
1021
|
errors: string[];
|
|
1016
1022
|
}
|
|
1023
|
+
type ValidatorFn = (value: any, params?: string[], context?: ValidationContext) => boolean;
|
|
1017
1024
|
declare class ValidationTool implements IStringTool<ValidateInput, ValidationResult> {
|
|
1018
|
-
process({ rules, value, type }: ValidateInput): ValidationResult;
|
|
1019
|
-
inputValidators: Record<string,
|
|
1020
|
-
beforeInputValidators: Record<string,
|
|
1025
|
+
process({ rules, value, type, context }: ValidateInput): ValidationResult;
|
|
1026
|
+
inputValidators: Record<string, ValidatorFn>;
|
|
1027
|
+
beforeInputValidators: Record<string, ValidatorFn>;
|
|
1021
1028
|
getErrorMessage(key: string, params?: string[]): string;
|
|
1029
|
+
private validateMimes;
|
|
1030
|
+
private validateMaxSize;
|
|
1031
|
+
private extractFiles;
|
|
1032
|
+
private isMimeAllowed;
|
|
1033
|
+
private getFileExtension;
|
|
1034
|
+
private compareDates;
|
|
1035
|
+
private resolveDateReference;
|
|
1036
|
+
private toDate;
|
|
1037
|
+
private testByRegex;
|
|
1038
|
+
private normalizeRegex;
|
|
1039
|
+
private getContextValue;
|
|
1040
|
+
private areValuesEqual;
|
|
1041
|
+
private isIPv4;
|
|
1042
|
+
private isIPv6;
|
|
1022
1043
|
}
|
|
1023
1044
|
|
|
1024
1045
|
/**
|
|
@@ -1402,6 +1423,7 @@ declare class StringCursor extends StringModule {
|
|
|
1402
1423
|
private boundPageHide;
|
|
1403
1424
|
private boundVisibilityChange;
|
|
1404
1425
|
protected enabled: boolean;
|
|
1426
|
+
private lastFrameTime;
|
|
1405
1427
|
constructor(context: StringContext);
|
|
1406
1428
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1407
1429
|
onMutate(data: StringData): void;
|
|
@@ -1418,6 +1440,7 @@ declare class StringCursor extends StringModule {
|
|
|
1418
1440
|
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1419
1441
|
private collectCursorPortals;
|
|
1420
1442
|
private resolvePortalId;
|
|
1443
|
+
private resolvePortalLerp;
|
|
1421
1444
|
private shouldRefreshPortals;
|
|
1422
1445
|
private withPortalsForObject;
|
|
1423
1446
|
private getPortalsForObject;
|
|
@@ -1432,6 +1455,8 @@ declare class StringCursor extends StringModule {
|
|
|
1432
1455
|
private bindGlobalLifecycleListeners;
|
|
1433
1456
|
private unbindGlobalLifecycleListeners;
|
|
1434
1457
|
private setMouseCoordinates;
|
|
1458
|
+
private getFrameAdjustedLerp;
|
|
1459
|
+
private getObjectDimensions;
|
|
1435
1460
|
private calculateOffset;
|
|
1436
1461
|
removeObject(id: string): void;
|
|
1437
1462
|
destroy(): void;
|
|
@@ -1928,12 +1953,37 @@ declare class StringSequence extends StringModule {
|
|
|
1928
1953
|
private setSequenceState;
|
|
1929
1954
|
}
|
|
1930
1955
|
|
|
1956
|
+
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
1931
1957
|
declare class StringForm extends StringModule {
|
|
1932
1958
|
constructor(context: StringContext);
|
|
1933
1959
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1934
1960
|
onObjectConnected(object: StringObject): void;
|
|
1935
|
-
|
|
1936
|
-
|
|
1961
|
+
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1962
|
+
private applyValidationState;
|
|
1963
|
+
private getInteractiveFields;
|
|
1964
|
+
private getFieldRules;
|
|
1965
|
+
private registerField;
|
|
1966
|
+
private unregisterField;
|
|
1967
|
+
private collectInteractiveFieldsFromNode;
|
|
1968
|
+
private handleMutationAdditions;
|
|
1969
|
+
private handleMutationRemovals;
|
|
1970
|
+
private getFormStateByContainment;
|
|
1971
|
+
private getFormStateByReference;
|
|
1972
|
+
private buildFormState;
|
|
1973
|
+
private registerFieldIndex;
|
|
1974
|
+
private getFieldIndex;
|
|
1975
|
+
private shouldValidateField;
|
|
1976
|
+
private supportsBeforeInputValidation;
|
|
1977
|
+
private requiresContext;
|
|
1978
|
+
private buildContext;
|
|
1979
|
+
private static readonly beforeInputRuleKeys;
|
|
1980
|
+
private static readonly crossFieldRuleKeys;
|
|
1981
|
+
private static readonly serviceAttributePrefixes;
|
|
1982
|
+
getInputKey(field: FormField, idx: number): string;
|
|
1983
|
+
getFieldValue(field: FormField): any;
|
|
1984
|
+
private isServiceFieldAttribute;
|
|
1985
|
+
private isFormFieldElement;
|
|
1986
|
+
private getInputEventType;
|
|
1937
1987
|
}
|
|
1938
1988
|
|
|
1939
1989
|
declare class StringScroller extends StringModule {
|
package/dist/index.d.ts
CHANGED
|
@@ -1005,20 +1005,41 @@ declare class RuleParserTool implements IStringTool<RuleParserInput, RuleParserR
|
|
|
1005
1005
|
process({ value }: RuleParserInput): RuleParserResult[];
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
|
+
interface ValidationContext {
|
|
1009
|
+
fieldKey?: string;
|
|
1010
|
+
values?: Record<string, any>;
|
|
1011
|
+
getValue?: (key: string) => any;
|
|
1012
|
+
}
|
|
1008
1013
|
interface ValidateInput {
|
|
1009
1014
|
rules: RuleParserResult[];
|
|
1010
1015
|
value: any;
|
|
1011
1016
|
type?: "input" | "beforeinput";
|
|
1017
|
+
context?: ValidationContext;
|
|
1012
1018
|
}
|
|
1013
1019
|
interface ValidationResult {
|
|
1014
1020
|
valid: boolean;
|
|
1015
1021
|
errors: string[];
|
|
1016
1022
|
}
|
|
1023
|
+
type ValidatorFn = (value: any, params?: string[], context?: ValidationContext) => boolean;
|
|
1017
1024
|
declare class ValidationTool implements IStringTool<ValidateInput, ValidationResult> {
|
|
1018
|
-
process({ rules, value, type }: ValidateInput): ValidationResult;
|
|
1019
|
-
inputValidators: Record<string,
|
|
1020
|
-
beforeInputValidators: Record<string,
|
|
1025
|
+
process({ rules, value, type, context }: ValidateInput): ValidationResult;
|
|
1026
|
+
inputValidators: Record<string, ValidatorFn>;
|
|
1027
|
+
beforeInputValidators: Record<string, ValidatorFn>;
|
|
1021
1028
|
getErrorMessage(key: string, params?: string[]): string;
|
|
1029
|
+
private validateMimes;
|
|
1030
|
+
private validateMaxSize;
|
|
1031
|
+
private extractFiles;
|
|
1032
|
+
private isMimeAllowed;
|
|
1033
|
+
private getFileExtension;
|
|
1034
|
+
private compareDates;
|
|
1035
|
+
private resolveDateReference;
|
|
1036
|
+
private toDate;
|
|
1037
|
+
private testByRegex;
|
|
1038
|
+
private normalizeRegex;
|
|
1039
|
+
private getContextValue;
|
|
1040
|
+
private areValuesEqual;
|
|
1041
|
+
private isIPv4;
|
|
1042
|
+
private isIPv6;
|
|
1022
1043
|
}
|
|
1023
1044
|
|
|
1024
1045
|
/**
|
|
@@ -1402,6 +1423,7 @@ declare class StringCursor extends StringModule {
|
|
|
1402
1423
|
private boundPageHide;
|
|
1403
1424
|
private boundVisibilityChange;
|
|
1404
1425
|
protected enabled: boolean;
|
|
1426
|
+
private lastFrameTime;
|
|
1405
1427
|
constructor(context: StringContext);
|
|
1406
1428
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1407
1429
|
onMutate(data: StringData): void;
|
|
@@ -1418,6 +1440,7 @@ declare class StringCursor extends StringModule {
|
|
|
1418
1440
|
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1419
1441
|
private collectCursorPortals;
|
|
1420
1442
|
private resolvePortalId;
|
|
1443
|
+
private resolvePortalLerp;
|
|
1421
1444
|
private shouldRefreshPortals;
|
|
1422
1445
|
private withPortalsForObject;
|
|
1423
1446
|
private getPortalsForObject;
|
|
@@ -1432,6 +1455,8 @@ declare class StringCursor extends StringModule {
|
|
|
1432
1455
|
private bindGlobalLifecycleListeners;
|
|
1433
1456
|
private unbindGlobalLifecycleListeners;
|
|
1434
1457
|
private setMouseCoordinates;
|
|
1458
|
+
private getFrameAdjustedLerp;
|
|
1459
|
+
private getObjectDimensions;
|
|
1435
1460
|
private calculateOffset;
|
|
1436
1461
|
removeObject(id: string): void;
|
|
1437
1462
|
destroy(): void;
|
|
@@ -1928,12 +1953,37 @@ declare class StringSequence extends StringModule {
|
|
|
1928
1953
|
private setSequenceState;
|
|
1929
1954
|
}
|
|
1930
1955
|
|
|
1956
|
+
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
1931
1957
|
declare class StringForm extends StringModule {
|
|
1932
1958
|
constructor(context: StringContext);
|
|
1933
1959
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1934
1960
|
onObjectConnected(object: StringObject): void;
|
|
1935
|
-
|
|
1936
|
-
|
|
1961
|
+
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1962
|
+
private applyValidationState;
|
|
1963
|
+
private getInteractiveFields;
|
|
1964
|
+
private getFieldRules;
|
|
1965
|
+
private registerField;
|
|
1966
|
+
private unregisterField;
|
|
1967
|
+
private collectInteractiveFieldsFromNode;
|
|
1968
|
+
private handleMutationAdditions;
|
|
1969
|
+
private handleMutationRemovals;
|
|
1970
|
+
private getFormStateByContainment;
|
|
1971
|
+
private getFormStateByReference;
|
|
1972
|
+
private buildFormState;
|
|
1973
|
+
private registerFieldIndex;
|
|
1974
|
+
private getFieldIndex;
|
|
1975
|
+
private shouldValidateField;
|
|
1976
|
+
private supportsBeforeInputValidation;
|
|
1977
|
+
private requiresContext;
|
|
1978
|
+
private buildContext;
|
|
1979
|
+
private static readonly beforeInputRuleKeys;
|
|
1980
|
+
private static readonly crossFieldRuleKeys;
|
|
1981
|
+
private static readonly serviceAttributePrefixes;
|
|
1982
|
+
getInputKey(field: FormField, idx: number): string;
|
|
1983
|
+
getFieldValue(field: FormField): any;
|
|
1984
|
+
private isServiceFieldAttribute;
|
|
1985
|
+
private isFormFieldElement;
|
|
1986
|
+
private getInputEventType;
|
|
1937
1987
|
}
|
|
1938
1988
|
|
|
1939
1989
|
declare class StringScroller extends StringModule {
|