dozy 1.0.101 → 1.0.103

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
@@ -717,6 +717,12 @@ declare function $copy(content: string): Promise<boolean | undefined>;
717
717
  * @returns 当 `document.execCommand('copy')` 返回成功时为 `true`,否则为 `false`。
718
718
  */
719
719
  declare function $fallbackCopy(content: string): boolean;
720
+ /**
721
+ * 替换当前地址栏的 hash 部分,保留 pathname 和 search 不变。
722
+ *
723
+ * @param hash 目标 hash 值;传入时不需要带 `#` 前缀(会自动补上)。传空字符串则清除 hash。
724
+ */
725
+ declare function web$replaceHash(hash: string): void;
720
726
  /**
721
727
  * 将当前页面的路径、查询参数和哈希编码成一个 URI 片段字符串。
722
728
  *
@@ -834,6 +840,8 @@ declare const $Response: {
834
840
  declare const $log: <T>(a?: T, ...x: any[]) => T | undefined;
835
841
  declare const $crypto: Crypto | undefined;
836
842
 
843
+ /** xls 横屏模式下的默认最大宽高比。 */
844
+ declare const DEFAULT_XLS_MAX_ASPECT_RATIO = 1.2;
837
845
  type ScaleComputer = undefined | ((scaler: Scaler) => number);
838
846
  type ScaleIniter = (scaler: Scaler) => void;
839
847
  type ScaleResponsiveOptions = {
@@ -846,7 +854,7 @@ type ScaleResponsiveOptions = {
846
854
  /**
847
855
  * xls 横屏模式下的最大宽高比。
848
856
  *
849
- * 默认写成 `1.2`。
857
+ * 默认 {@link DEFAULT_XLS_MAX_ASPECT_RATIO}。
850
858
  */
851
859
  xlsMaxAspectRatio?: number;
852
860
  /** xls 状态变化时触发,方便业务侧保存状态。 */
@@ -1461,6 +1469,6 @@ declare function toRgbString(input: string | Color | any): string | undefined;
1461
1469
  */
1462
1470
  declare function toHslString(input: string | Color | any): string | undefined;
1463
1471
 
1464
- declare const DOZY = "1.0.101";
1472
+ declare const DOZY = "1.0.103";
1465
1473
 
1466
- 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, 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$setPathTarget, xtrim };
1474
+ 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 };
package/dist/index.js CHANGED
@@ -11955,6 +11955,11 @@ function $fallbackCopy(content) {
11955
11955
  document.body.removeChild(textArea);
11956
11956
  }
11957
11957
  }
11958
+ function web$replaceHash(hash) {
11959
+ if (typeof window === "undefined") return;
11960
+ const h = hash ? hash.startsWith("#") ? hash : "#" + hash : "";
11961
+ window.history.replaceState(null, "", window.location.pathname + window.location.search + h);
11962
+ }
11958
11963
  function web$encodeURI(hash) {
11959
11964
  if (typeof window === "undefined") throw "";
11960
11965
  let h = location.hash;
@@ -12022,6 +12027,7 @@ async function $compressImage(input, options) {
12022
12027
  }
12023
12028
 
12024
12029
  // src/modules/EnableScaler.ts
12030
+ var DEFAULT_XLS_MAX_ASPECT_RATIO = 1.2;
12025
12031
  var _base, _mainScale, _scaleComputer;
12026
12032
  var Scaler = class {
12027
12033
  /**
@@ -12148,7 +12154,7 @@ var standardIniter = ({
12148
12154
  const h = helement.clientHeight;
12149
12155
  const xls = !!responsive && w > h;
12150
12156
  const finalBase = xls ? scaler2.sourceBase * (responsive.baseMultiplier ?? 640 / 320) : scaler2.sourceBase;
12151
- const finalMaxAspectRatio = xls ? responsive.xlsMaxAspectRatio ?? 1.2 : maxAspectRatio;
12157
+ const finalMaxAspectRatio = xls ? responsive.xlsMaxAspectRatio ?? DEFAULT_XLS_MAX_ASPECT_RATIO : maxAspectRatio;
12152
12158
  document.documentElement.dataset.xadXls = xls ? "1" : "0";
12153
12159
  responsive?.setXls?.(xls);
12154
12160
  scaler2.base = finalBase;
@@ -27585,7 +27591,7 @@ var lodash_default_default = wrapperLodash_default;
27585
27591
 
27586
27592
  // src/index.ts
27587
27593
  var import_crypto_js = __toESM(require_crypto_js(), 1);
27588
- var DOZY = "1.0.101";
27594
+ var DOZY = "1.0.103";
27589
27595
  var export_Cryptojs = import_crypto_js.default;
27590
27596
  export {
27591
27597
  $Headers,
@@ -27691,6 +27697,7 @@ export {
27691
27697
  CanceledError2 as CanceledError,
27692
27698
  src_exports as ColorLib,
27693
27699
  export_Cryptojs as Cryptojs,
27700
+ DEFAULT_XLS_MAX_ASPECT_RATIO,
27694
27701
  DOZY,
27695
27702
  Gens,
27696
27703
  HttpStatusCode2 as HttpStatusCode,
@@ -27747,6 +27754,7 @@ export {
27747
27754
  web$encodeURI,
27748
27755
  web$pathStartData,
27749
27756
  web$redirectToDomain,
27757
+ web$replaceHash,
27750
27758
  web$setPathTarget,
27751
27759
  xtrim
27752
27760
  };