@fiddle-digital/string-tune 1.1.39 → 1.1.41-fix.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/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +54 -5
- package/dist/index.d.ts +54 -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
|
@@ -507,6 +507,7 @@ declare class CenterCache {
|
|
|
507
507
|
private all;
|
|
508
508
|
attach(obj: StringObject): void;
|
|
509
509
|
detach(obj: StringObject): void;
|
|
510
|
+
invalidate(id: string): void;
|
|
510
511
|
invalidateAll(): void;
|
|
511
512
|
getCenter(obj: StringObject): {
|
|
512
513
|
cx: number;
|
|
@@ -1005,20 +1006,41 @@ declare class RuleParserTool implements IStringTool<RuleParserInput, RuleParserR
|
|
|
1005
1006
|
process({ value }: RuleParserInput): RuleParserResult[];
|
|
1006
1007
|
}
|
|
1007
1008
|
|
|
1009
|
+
interface ValidationContext {
|
|
1010
|
+
fieldKey?: string;
|
|
1011
|
+
values?: Record<string, any>;
|
|
1012
|
+
getValue?: (key: string) => any;
|
|
1013
|
+
}
|
|
1008
1014
|
interface ValidateInput {
|
|
1009
1015
|
rules: RuleParserResult[];
|
|
1010
1016
|
value: any;
|
|
1011
1017
|
type?: "input" | "beforeinput";
|
|
1018
|
+
context?: ValidationContext;
|
|
1012
1019
|
}
|
|
1013
1020
|
interface ValidationResult {
|
|
1014
1021
|
valid: boolean;
|
|
1015
1022
|
errors: string[];
|
|
1016
1023
|
}
|
|
1024
|
+
type ValidatorFn = (value: any, params?: string[], context?: ValidationContext) => boolean;
|
|
1017
1025
|
declare class ValidationTool implements IStringTool<ValidateInput, ValidationResult> {
|
|
1018
|
-
process({ rules, value, type }: ValidateInput): ValidationResult;
|
|
1019
|
-
inputValidators: Record<string,
|
|
1020
|
-
beforeInputValidators: Record<string,
|
|
1026
|
+
process({ rules, value, type, context }: ValidateInput): ValidationResult;
|
|
1027
|
+
inputValidators: Record<string, ValidatorFn>;
|
|
1028
|
+
beforeInputValidators: Record<string, ValidatorFn>;
|
|
1021
1029
|
getErrorMessage(key: string, params?: string[]): string;
|
|
1030
|
+
private validateMimes;
|
|
1031
|
+
private validateMaxSize;
|
|
1032
|
+
private extractFiles;
|
|
1033
|
+
private isMimeAllowed;
|
|
1034
|
+
private getFileExtension;
|
|
1035
|
+
private compareDates;
|
|
1036
|
+
private resolveDateReference;
|
|
1037
|
+
private toDate;
|
|
1038
|
+
private testByRegex;
|
|
1039
|
+
private normalizeRegex;
|
|
1040
|
+
private getContextValue;
|
|
1041
|
+
private areValuesEqual;
|
|
1042
|
+
private isIPv4;
|
|
1043
|
+
private isIPv6;
|
|
1022
1044
|
}
|
|
1023
1045
|
|
|
1024
1046
|
/**
|
|
@@ -1932,12 +1954,38 @@ declare class StringSequence extends StringModule {
|
|
|
1932
1954
|
private setSequenceState;
|
|
1933
1955
|
}
|
|
1934
1956
|
|
|
1957
|
+
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
1935
1958
|
declare class StringForm extends StringModule {
|
|
1936
1959
|
constructor(context: StringContext);
|
|
1937
1960
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1938
1961
|
onObjectConnected(object: StringObject): void;
|
|
1939
|
-
|
|
1940
|
-
|
|
1962
|
+
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1963
|
+
private applyValidationState;
|
|
1964
|
+
private getInteractiveFields;
|
|
1965
|
+
private getFieldRules;
|
|
1966
|
+
private registerField;
|
|
1967
|
+
private unregisterField;
|
|
1968
|
+
private collectInteractiveFieldsFromNode;
|
|
1969
|
+
private isRadioField;
|
|
1970
|
+
private handleMutationAdditions;
|
|
1971
|
+
private handleMutationRemovals;
|
|
1972
|
+
private getFormStateByContainment;
|
|
1973
|
+
private getFormStateByReference;
|
|
1974
|
+
private buildFormState;
|
|
1975
|
+
private registerFieldIndex;
|
|
1976
|
+
private getFieldIndex;
|
|
1977
|
+
private shouldValidateField;
|
|
1978
|
+
private supportsBeforeInputValidation;
|
|
1979
|
+
private requiresContext;
|
|
1980
|
+
private buildContext;
|
|
1981
|
+
private static readonly beforeInputRuleKeys;
|
|
1982
|
+
private static readonly crossFieldRuleKeys;
|
|
1983
|
+
private static readonly serviceAttributePrefixes;
|
|
1984
|
+
getInputKey(field: FormField, idx: number): string;
|
|
1985
|
+
getFieldValue(field: FormField): any;
|
|
1986
|
+
private isServiceFieldAttribute;
|
|
1987
|
+
private isFormFieldElement;
|
|
1988
|
+
private getInputEventType;
|
|
1941
1989
|
}
|
|
1942
1990
|
|
|
1943
1991
|
declare class StringScroller extends StringModule {
|
|
@@ -2222,6 +2270,7 @@ declare class StringTune {
|
|
|
2222
2270
|
*/
|
|
2223
2271
|
scrollToElement(selector: string, offset?: number): void;
|
|
2224
2272
|
scrollTo(position: number): void;
|
|
2273
|
+
invalidateCenter(id: string): void;
|
|
2225
2274
|
/**
|
|
2226
2275
|
* Forces center cache recalculation for all tracked objects.
|
|
2227
2276
|
* Useful when DOM geometry changes outside of StringTune's control.
|
package/dist/index.d.ts
CHANGED
|
@@ -507,6 +507,7 @@ declare class CenterCache {
|
|
|
507
507
|
private all;
|
|
508
508
|
attach(obj: StringObject): void;
|
|
509
509
|
detach(obj: StringObject): void;
|
|
510
|
+
invalidate(id: string): void;
|
|
510
511
|
invalidateAll(): void;
|
|
511
512
|
getCenter(obj: StringObject): {
|
|
512
513
|
cx: number;
|
|
@@ -1005,20 +1006,41 @@ declare class RuleParserTool implements IStringTool<RuleParserInput, RuleParserR
|
|
|
1005
1006
|
process({ value }: RuleParserInput): RuleParserResult[];
|
|
1006
1007
|
}
|
|
1007
1008
|
|
|
1009
|
+
interface ValidationContext {
|
|
1010
|
+
fieldKey?: string;
|
|
1011
|
+
values?: Record<string, any>;
|
|
1012
|
+
getValue?: (key: string) => any;
|
|
1013
|
+
}
|
|
1008
1014
|
interface ValidateInput {
|
|
1009
1015
|
rules: RuleParserResult[];
|
|
1010
1016
|
value: any;
|
|
1011
1017
|
type?: "input" | "beforeinput";
|
|
1018
|
+
context?: ValidationContext;
|
|
1012
1019
|
}
|
|
1013
1020
|
interface ValidationResult {
|
|
1014
1021
|
valid: boolean;
|
|
1015
1022
|
errors: string[];
|
|
1016
1023
|
}
|
|
1024
|
+
type ValidatorFn = (value: any, params?: string[], context?: ValidationContext) => boolean;
|
|
1017
1025
|
declare class ValidationTool implements IStringTool<ValidateInput, ValidationResult> {
|
|
1018
|
-
process({ rules, value, type }: ValidateInput): ValidationResult;
|
|
1019
|
-
inputValidators: Record<string,
|
|
1020
|
-
beforeInputValidators: Record<string,
|
|
1026
|
+
process({ rules, value, type, context }: ValidateInput): ValidationResult;
|
|
1027
|
+
inputValidators: Record<string, ValidatorFn>;
|
|
1028
|
+
beforeInputValidators: Record<string, ValidatorFn>;
|
|
1021
1029
|
getErrorMessage(key: string, params?: string[]): string;
|
|
1030
|
+
private validateMimes;
|
|
1031
|
+
private validateMaxSize;
|
|
1032
|
+
private extractFiles;
|
|
1033
|
+
private isMimeAllowed;
|
|
1034
|
+
private getFileExtension;
|
|
1035
|
+
private compareDates;
|
|
1036
|
+
private resolveDateReference;
|
|
1037
|
+
private toDate;
|
|
1038
|
+
private testByRegex;
|
|
1039
|
+
private normalizeRegex;
|
|
1040
|
+
private getContextValue;
|
|
1041
|
+
private areValuesEqual;
|
|
1042
|
+
private isIPv4;
|
|
1043
|
+
private isIPv6;
|
|
1022
1044
|
}
|
|
1023
1045
|
|
|
1024
1046
|
/**
|
|
@@ -1932,12 +1954,38 @@ declare class StringSequence extends StringModule {
|
|
|
1932
1954
|
private setSequenceState;
|
|
1933
1955
|
}
|
|
1934
1956
|
|
|
1957
|
+
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
1935
1958
|
declare class StringForm extends StringModule {
|
|
1936
1959
|
constructor(context: StringContext);
|
|
1937
1960
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1938
1961
|
onObjectConnected(object: StringObject): void;
|
|
1939
|
-
|
|
1940
|
-
|
|
1962
|
+
onDOMMutate(added: NodeList, removed: NodeList): void;
|
|
1963
|
+
private applyValidationState;
|
|
1964
|
+
private getInteractiveFields;
|
|
1965
|
+
private getFieldRules;
|
|
1966
|
+
private registerField;
|
|
1967
|
+
private unregisterField;
|
|
1968
|
+
private collectInteractiveFieldsFromNode;
|
|
1969
|
+
private isRadioField;
|
|
1970
|
+
private handleMutationAdditions;
|
|
1971
|
+
private handleMutationRemovals;
|
|
1972
|
+
private getFormStateByContainment;
|
|
1973
|
+
private getFormStateByReference;
|
|
1974
|
+
private buildFormState;
|
|
1975
|
+
private registerFieldIndex;
|
|
1976
|
+
private getFieldIndex;
|
|
1977
|
+
private shouldValidateField;
|
|
1978
|
+
private supportsBeforeInputValidation;
|
|
1979
|
+
private requiresContext;
|
|
1980
|
+
private buildContext;
|
|
1981
|
+
private static readonly beforeInputRuleKeys;
|
|
1982
|
+
private static readonly crossFieldRuleKeys;
|
|
1983
|
+
private static readonly serviceAttributePrefixes;
|
|
1984
|
+
getInputKey(field: FormField, idx: number): string;
|
|
1985
|
+
getFieldValue(field: FormField): any;
|
|
1986
|
+
private isServiceFieldAttribute;
|
|
1987
|
+
private isFormFieldElement;
|
|
1988
|
+
private getInputEventType;
|
|
1941
1989
|
}
|
|
1942
1990
|
|
|
1943
1991
|
declare class StringScroller extends StringModule {
|
|
@@ -2222,6 +2270,7 @@ declare class StringTune {
|
|
|
2222
2270
|
*/
|
|
2223
2271
|
scrollToElement(selector: string, offset?: number): void;
|
|
2224
2272
|
scrollTo(position: number): void;
|
|
2273
|
+
invalidateCenter(id: string): void;
|
|
2225
2274
|
/**
|
|
2226
2275
|
* Forces center cache recalculation for all tracked objects.
|
|
2227
2276
|
* Useful when DOM geometry changes outside of StringTune's control.
|