dozy 1.0.106 → 1.0.107

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 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 DEFAULT_XLS_MAX_ASPECT_RATIO = 1.2;
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
- * 默认写成 `640 / 320`,方便直观看出是从 320 基准扩展到 640 基准。
848
+ * 默认 {@link DEFAULT_XLS_BASE_MULTIPLIER},即从 320 基准扩展到 640 基准。
845
849
  */
846
850
  baseMultiplier?: number;
847
851
  /**
848
852
  * xls 横屏模式下的最大宽高比。
849
853
  *
850
- * 默认 {@link DEFAULT_XLS_MAX_ASPECT_RATIO}。
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 横屏响应式:宽大于高时切换 base maxAspectRatio,并同步 `html[data-xad-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: {
@@ -1462,6 +1467,6 @@ declare function toRgbString(input: string | Color | any): string | undefined;
1462
1467
  */
1463
1468
  declare function toHslString(input: string | Color | any): string | undefined;
1464
1469
 
1465
- declare const DOZY = "1.0.106";
1470
+ declare const DOZY = "1.0.107";
1466
1471
 
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 };
1472
+ 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_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 DEFAULT_XLS_MAX_ASPECT_RATIO = 1.2;
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 finalBase = xls ? scaler2.sourceBase * (responsive.baseMultiplier ?? 640 / 320) : scaler2.sourceBase;
1190
- const finalMaxAspectRatio = xls ? responsive.xlsMaxAspectRatio ?? DEFAULT_XLS_MAX_ASPECT_RATIO : maxAspectRatio;
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;
@@ -8160,7 +8163,7 @@ function toHslString(input) {
8160
8163
  }
8161
8164
 
8162
8165
  // src/index.ts
8163
- var DOZY = "1.0.106";
8166
+ var DOZY = "1.0.107";
8164
8167
  /*! Bundled license information:
8165
8168
 
8166
8169
  @octokit/request-error/dist-src/index.js:
@@ -8171,6 +8174,6 @@ var DOZY = "1.0.106";
8171
8174
  (* v8 ignore else -- @preserve *)
8172
8175
  */
8173
8176
 
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 };
8177
+ 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_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
8178
  //# sourceMappingURL=index.js.map
8176
8179
  //# sourceMappingURL=index.js.map