dozy 1.0.106 → 1.0.108
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.d.ts +15 -7
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -833,21 +833,26 @@ declare const $Response: {
|
|
|
833
833
|
declare const $log: <T>(a?: T, ...x: any[]) => T | undefined;
|
|
834
834
|
declare const $crypto: Crypto | undefined;
|
|
835
835
|
|
|
836
|
-
/** xls
|
|
837
|
-
declare const
|
|
836
|
+
/** xls 横屏模式下的默认 base 乘数。 */
|
|
837
|
+
declare const DEFAULT_XLS_BASE_MULTIPLIER: number;
|
|
838
|
+
/** xls 横屏模式下每一倍 base 对应的默认最大宽高比。 */
|
|
839
|
+
declare const DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR = 0.6;
|
|
840
|
+
/** xls 横屏模式下使用默认 base 乘数时的默认最大宽高比。 */
|
|
841
|
+
declare const DEFAULT_XLS_MAX_ASPECT_RATIO: number;
|
|
838
842
|
type ScaleComputer = undefined | ((scaler: Scaler) => number);
|
|
839
843
|
type ScaleIniter = (scaler: Scaler) => void;
|
|
840
844
|
type ScaleResponsiveOptions = {
|
|
841
845
|
/**
|
|
842
846
|
* xls 横屏模式下的 base 乘数。
|
|
843
847
|
*
|
|
844
|
-
*
|
|
848
|
+
* 默认 {@link DEFAULT_XLS_BASE_MULTIPLIER},即从 320 基准扩展到 640 基准。
|
|
845
849
|
*/
|
|
846
850
|
baseMultiplier?: number;
|
|
847
851
|
/**
|
|
848
852
|
* xls 横屏模式下的最大宽高比。
|
|
849
853
|
*
|
|
850
|
-
*
|
|
854
|
+
* 默认根据 `baseMultiplier * 0.6` 计算,使横屏扩展 base 时保持相近的视觉缩放比例。
|
|
855
|
+
* 使用默认 base 乘数时,结果为 {@link DEFAULT_XLS_MAX_ASPECT_RATIO}。
|
|
851
856
|
*/
|
|
852
857
|
xlsMaxAspectRatio?: number;
|
|
853
858
|
/** xls 状态变化时触发,方便业务侧保存状态。 */
|
|
@@ -911,7 +916,7 @@ declare function enableScaler(outerContainer: HTMLElement, initer?: ScaleIniter,
|
|
|
911
916
|
* @param args.heightElement 可选高度测量元素,默认使用 `document.documentElement`。
|
|
912
917
|
* @param args.widthElement 可选宽度测量元素,默认使用 `document.documentElement`。
|
|
913
918
|
* @param args.base 可选基础内容宽度。
|
|
914
|
-
* @param args.responsive 传入后启用 xls
|
|
919
|
+
* @param args.responsive 传入后启用 xls 横屏响应式:宽大于高时按 baseMultiplier 扩展 base;未指定 xlsMaxAspectRatio 时会按相同乘数计算默认最大宽高比,并同步 `html[data-xad-xls]`。
|
|
915
920
|
* @returns 返回一个可供 `enableScaler` 使用的 `ScaleIniter` 函数。
|
|
916
921
|
*/
|
|
917
922
|
declare const standardIniter: (args: {
|
|
@@ -1370,7 +1375,10 @@ declare class RepoStore {
|
|
|
1370
1375
|
constructor(x0: string, user: string, repo: string);
|
|
1371
1376
|
}
|
|
1372
1377
|
|
|
1378
|
+
/** HTML 转义(' → ',兼容 HTML4/5) */
|
|
1373
1379
|
declare function $escapeHTML(str?: string): string;
|
|
1380
|
+
/** XML 转义(' → ',符合 XML 1.0 规范) */
|
|
1381
|
+
declare function $escapeXML(str?: string): string;
|
|
1374
1382
|
declare class RainbowGen {
|
|
1375
1383
|
i: number;
|
|
1376
1384
|
ten: number;
|
|
@@ -1462,6 +1470,6 @@ declare function toRgbString(input: string | Color | any): string | undefined;
|
|
|
1462
1470
|
*/
|
|
1463
1471
|
declare function toHslString(input: string | Color | any): string | undefined;
|
|
1464
1472
|
|
|
1465
|
-
declare const DOZY = "1.0.
|
|
1473
|
+
declare const DOZY = "1.0.108";
|
|
1466
1474
|
|
|
1467
|
-
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $ensureUrl, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatK, $formatPoints, $formatPointsWithChange, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $humanizeBytes, $if, $inRange, $inRange2, $inferExtensionFormPureBase64, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DEFAULT_XLS_MAX_ASPECT_RATIO, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, RepoStore, type ScaleComputer, type ScaleIniter, type ScaleResponsiveOptions, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$replaceHash, web$setPathTarget, xtrim };
|
|
1475
|
+
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $ensureUrl, $entries, $escapeHTML, $escapeXML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatK, $formatPoints, $formatPointsWithChange, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $humanizeBytes, $if, $inRange, $inRange2, $inferExtensionFormPureBase64, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DEFAULT_XLS_BASE_MULTIPLIER, DEFAULT_XLS_MAX_ASPECT_RATIO, DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, RepoStore, type ScaleComputer, type ScaleIniter, type ScaleResponsiveOptions, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$replaceHash, web$setPathTarget, xtrim };
|
package/dist/index.js
CHANGED
|
@@ -1060,7 +1060,9 @@ async function $compressImage(input, options) {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
// src/modules/EnableScaler.ts
|
|
1063
|
-
var
|
|
1063
|
+
var DEFAULT_XLS_BASE_MULTIPLIER = 640 / 320;
|
|
1064
|
+
var DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR = 0.6;
|
|
1065
|
+
var DEFAULT_XLS_MAX_ASPECT_RATIO = DEFAULT_XLS_BASE_MULTIPLIER * DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR;
|
|
1064
1066
|
var _base, _mainScale, _scaleComputer;
|
|
1065
1067
|
var Scaler = class {
|
|
1066
1068
|
/**
|
|
@@ -1186,8 +1188,9 @@ var standardIniter = ({
|
|
|
1186
1188
|
const w = welement.clientWidth;
|
|
1187
1189
|
const h = helement.clientHeight;
|
|
1188
1190
|
const xls = !!responsive && w > h;
|
|
1189
|
-
const
|
|
1190
|
-
const
|
|
1191
|
+
const baseMultiplier = responsive?.baseMultiplier ?? DEFAULT_XLS_BASE_MULTIPLIER;
|
|
1192
|
+
const finalBase = xls ? scaler2.sourceBase * baseMultiplier : scaler2.sourceBase;
|
|
1193
|
+
const finalMaxAspectRatio = xls ? responsive.xlsMaxAspectRatio ?? baseMultiplier * DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR : maxAspectRatio;
|
|
1191
1194
|
document.documentElement.dataset.xadXls = xls ? "1" : "0";
|
|
1192
1195
|
responsive?.setXls?.(xls);
|
|
1193
1196
|
scaler2.base = finalBase;
|
|
@@ -2854,18 +2857,20 @@ function __GensStyleIds() {
|
|
|
2854
2857
|
|
|
2855
2858
|
// src/modules/gens/Gens.ts
|
|
2856
2859
|
var webSide = typeof window !== "undefined";
|
|
2860
|
+
var _escapeBase = {
|
|
2861
|
+
"&": "&",
|
|
2862
|
+
"<": "<",
|
|
2863
|
+
">": ">",
|
|
2864
|
+
'"': """
|
|
2865
|
+
};
|
|
2866
|
+
var _escapeRegex = /[&<>"']/g;
|
|
2857
2867
|
function $escapeHTML(str) {
|
|
2858
2868
|
if (!str) return "";
|
|
2859
|
-
return str.replace(
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
'"': """,
|
|
2865
|
-
"'": "'"
|
|
2866
|
-
};
|
|
2867
|
-
return escapeMap[match];
|
|
2868
|
-
});
|
|
2869
|
+
return str.replace(_escapeRegex, (ch) => _escapeBase[ch] || "'");
|
|
2870
|
+
}
|
|
2871
|
+
function $escapeXML(str) {
|
|
2872
|
+
if (!str) return "";
|
|
2873
|
+
return str.replace(_escapeRegex, (ch) => _escapeBase[ch] || "'");
|
|
2869
2874
|
}
|
|
2870
2875
|
var RainbowGen = class _RainbowGen {
|
|
2871
2876
|
constructor(useTimes = 0) {
|
|
@@ -8160,7 +8165,7 @@ function toHslString(input) {
|
|
|
8160
8165
|
}
|
|
8161
8166
|
|
|
8162
8167
|
// src/index.ts
|
|
8163
|
-
var DOZY = "1.0.
|
|
8168
|
+
var DOZY = "1.0.108";
|
|
8164
8169
|
/*! Bundled license information:
|
|
8165
8170
|
|
|
8166
8171
|
@octokit/request-error/dist-src/index.js:
|
|
@@ -8171,6 +8176,6 @@ var DOZY = "1.0.106";
|
|
|
8171
8176
|
(* v8 ignore else -- @preserve *)
|
|
8172
8177
|
*/
|
|
8173
8178
|
|
|
8174
|
-
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $ensureUrl, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatK, $formatPoints, $formatPointsWithChange, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $humanizeBytes, $if, $inRange, $inRange2, $inferExtensionFormPureBase64, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, src_exports as ColorLib, DEFAULT_XLS_MAX_ASPECT_RATIO, DOZY, Gens, RainbowGen, RepoStore, StringObfuscator, __GensDirectives, _res, boxShadow, customAlphabet, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, nanoid, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, urlAlphabet, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$replaceHash, web$setPathTarget, xtrim };
|
|
8179
|
+
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $ensureUrl, $entries, $escapeHTML, $escapeXML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatK, $formatPoints, $formatPointsWithChange, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $humanizeBytes, $if, $inRange, $inRange2, $inferExtensionFormPureBase64, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, src_exports as ColorLib, DEFAULT_XLS_BASE_MULTIPLIER, DEFAULT_XLS_MAX_ASPECT_RATIO, DEFAULT_XLS_MAX_ASPECT_RATIO_FACTOR, DOZY, Gens, RainbowGen, RepoStore, StringObfuscator, __GensDirectives, _res, boxShadow, customAlphabet, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, nanoid, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, urlAlphabet, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$replaceHash, web$setPathTarget, xtrim };
|
|
8175
8180
|
//# sourceMappingURL=index.js.map
|
|
8176
8181
|
//# sourceMappingURL=index.js.map
|