umaki 0.12.0 → 0.13.1

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.
Files changed (147) hide show
  1. package/README.md +58 -0
  2. package/dist/LICENSE.txt +1 -32
  3. package/dist/{index.cjs.js → index.cjs} +64 -62
  4. package/dist/index.es.js +3 -1
  5. package/dist/libs/callback/{index.cjs.js → index.cjs} +2 -2
  6. package/dist/libs/config/{_internal.cjs.js → _internal.cjs} +1 -1
  7. package/dist/libs/config/{get-config.cjs.js → get-config.cjs} +1 -1
  8. package/dist/libs/config/{index.cjs.js → index.cjs} +3 -3
  9. package/dist/libs/config/set-config.cjs +12 -0
  10. package/dist/libs/config/set-config.d.ts +1 -0
  11. package/dist/libs/config/set-config.es.js +5 -1
  12. package/dist/libs/control/{bg-scroll-stop.cjs.js → bg-scroll-stop.cjs} +2 -1
  13. package/dist/libs/control/bg-scroll-stop.d.ts +1 -0
  14. package/dist/libs/control/bg-scroll-stop.es.js +1 -0
  15. package/dist/libs/control/{index.cjs.js → index.cjs} +5 -5
  16. package/dist/libs/control/{scroll-to-hash.cjs.js → scroll-to-hash.cjs} +1 -0
  17. package/dist/libs/control/scroll-to-hash.d.ts +1 -0
  18. package/dist/libs/control/scroll-to-hash.es.js +1 -0
  19. package/dist/libs/control/{video-play-control.cjs.js → video-play-control.cjs} +1 -1
  20. package/dist/libs/convert/{change-date-string-to-specific-format.cjs.js → change-date-string-to-specific-format.cjs} +4 -4
  21. package/dist/libs/convert/change-date-string-to-specific-format.es.js +2 -2
  22. package/dist/libs/convert/{index.cjs.js → index.cjs} +4 -4
  23. package/dist/libs/eventControl/{index.cjs.js → index.cjs} +2 -2
  24. package/dist/libs/get/{get-aspect-ratio.cjs.js → get-aspect-ratio.cjs} +1 -1
  25. package/dist/libs/get/get-document-height.cjs +7 -0
  26. package/dist/libs/get/get-document-height.d.ts +1 -0
  27. package/dist/libs/get/get-document-height.es.js +4 -1
  28. package/dist/libs/get/{get-gcd.cjs.js → get-gcd.cjs} +4 -1
  29. package/dist/libs/get/get-gcd.d.ts +1 -0
  30. package/dist/libs/get/get-gcd.es.js +3 -0
  31. package/dist/libs/get/{get-gravatar-url.cjs.js → get-gravatar-url.cjs} +3 -0
  32. package/dist/libs/get/get-gravatar-url.d.ts +4 -0
  33. package/dist/libs/get/get-gravatar-url.es.js +3 -0
  34. package/dist/libs/get/{get-query-params.cjs.js → get-query-params.cjs} +4 -1
  35. package/dist/libs/get/get-query-params.d.ts +1 -0
  36. package/dist/libs/get/get-query-params.es.js +4 -1
  37. package/dist/libs/get/{get-random-int.cjs.js → get-random-int.cjs} +6 -0
  38. package/dist/libs/get/get-random-int.d.ts +5 -1
  39. package/dist/libs/get/get-random-int.es.js +6 -0
  40. package/dist/libs/get/{get-rem.cjs.js → get-rem.cjs} +1 -0
  41. package/dist/libs/get/get-rem.d.ts +1 -0
  42. package/dist/libs/get/get-rem.es.js +1 -0
  43. package/dist/libs/get/get-rendered-line-height.cjs +57 -0
  44. package/dist/libs/get/get-rendered-line-height.d.ts +37 -0
  45. package/dist/libs/get/get-rendered-line-height.es.js +57 -0
  46. package/dist/libs/get/get-rendered-line-height.test.d.ts +1 -0
  47. package/dist/libs/get/get-scrollbar-width.cjs +7 -0
  48. package/dist/libs/get/get-scrollbar-width.d.ts +1 -0
  49. package/dist/libs/get/get-scrollbar-width.es.js +4 -1
  50. package/dist/libs/get/{get-style-property-value-to-number.cjs.js → get-style-property-value-to-number.cjs} +1 -1
  51. package/dist/libs/get/get-style-property-value.cjs +7 -0
  52. package/dist/libs/get/get-style-property-value.d.ts +1 -0
  53. package/dist/libs/get/get-style-property-value.es.js +4 -1
  54. package/dist/libs/get/{get-ua-data.cjs.js → get-ua-data.cjs} +1 -1
  55. package/dist/libs/get/{index.cjs.js → index.cjs} +21 -19
  56. package/dist/libs/get/index.d.ts +2 -1
  57. package/dist/libs/get/index.es.js +3 -1
  58. package/dist/libs/is/{check-device-size.cjs.js → check-device-size.cjs} +1 -1
  59. package/dist/libs/is/{index.cjs.js → index.cjs} +11 -11
  60. package/dist/libs/is/{is-between-date-time.cjs.js → is-between-date-time.cjs} +2 -2
  61. package/dist/libs/is/is-between-date-time.es.js +1 -1
  62. package/dist/libs/is/{is-ipad.cjs.js → is-ipad.cjs} +2 -2
  63. package/dist/libs/is/{is-safari.cjs.js → is-safari.cjs} +1 -1
  64. package/dist/libs/remove/{index.cjs.js → index.cjs} +4 -4
  65. package/dist/libs/remove/remove-all-html-tags.d.ts +7 -1
  66. package/dist/libs/remove/{remove-style-property-value.cjs.js → remove-style-property-value.cjs} +1 -0
  67. package/dist/libs/remove/remove-style-property-value.d.ts +1 -0
  68. package/dist/libs/remove/remove-style-property-value.es.js +1 -0
  69. package/dist/libs/security/{html-sanitize.cjs.js → html-sanitize.cjs} +7 -1
  70. package/dist/libs/security/html-sanitize.d.ts +8 -0
  71. package/dist/libs/security/html-sanitize.es.js +7 -1
  72. package/dist/libs/security/{index.cjs.js → index.cjs} +1 -1
  73. package/dist/libs/set/{index.cjs.js → index.cjs} +6 -6
  74. package/dist/libs/set/{set-100vh.cjs.js → set-100vh.cjs} +1 -0
  75. package/dist/libs/set/set-100vh.d.ts +1 -0
  76. package/dist/libs/set/set-100vh.es.js +1 -0
  77. package/dist/libs/set/{set-100vw.cjs.js → set-100vw.cjs} +1 -0
  78. package/dist/libs/set/set-100vw.d.ts +1 -0
  79. package/dist/libs/set/set-100vw.es.js +1 -0
  80. package/dist/libs/set/{set-style-property-value.cjs.js → set-style-property-value.cjs} +1 -0
  81. package/dist/libs/set/set-style-property-value.d.ts +1 -0
  82. package/dist/libs/set/set-style-property-value.es.js +1 -0
  83. package/dist/libs/to/{index.cjs.js → index.cjs} +2 -2
  84. package/dist/libs/transform/{index.cjs.js → index.cjs} +1 -1
  85. package/dist/libs/wait/{index.cjs.js → index.cjs} +2 -2
  86. package/dist/libs/wait/{wait-for-all-media-loaded.cjs.js → wait-for-all-media-loaded.cjs} +2 -3
  87. package/dist/libs/wait/wait-for-all-media-loaded.d.ts +1 -0
  88. package/dist/libs/wait/wait-for-all-media-loaded.es.js +2 -3
  89. package/package.json +30 -31
  90. package/dist/_virtual/_commonjsHelpers.cjs.js +0 -6
  91. package/dist/_virtual/_commonjsHelpers.es.js +0 -6
  92. package/dist/_virtual/isBetween.cjs.js +0 -7
  93. package/dist/_virtual/isBetween.cjs2.js +0 -4
  94. package/dist/_virtual/isBetween.es.js +0 -7
  95. package/dist/_virtual/isBetween.es2.js +0 -4
  96. package/dist/_virtual/timezone.cjs.js +0 -7
  97. package/dist/_virtual/timezone.cjs2.js +0 -4
  98. package/dist/_virtual/timezone.es.js +0 -7
  99. package/dist/_virtual/timezone.es2.js +0 -4
  100. package/dist/_virtual/utc.cjs.js +0 -7
  101. package/dist/_virtual/utc.cjs2.js +0 -4
  102. package/dist/_virtual/utc.es.js +0 -7
  103. package/dist/_virtual/utc.es2.js +0 -4
  104. package/dist/libs/config/set-config.cjs.js +0 -8
  105. package/dist/libs/get/get-document-height.cjs.js +0 -4
  106. package/dist/libs/get/get-scrollbar-width.cjs.js +0 -4
  107. package/dist/libs/get/get-style-property-value.cjs.js +0 -4
  108. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.cjs.js +0 -23
  109. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.es.js +0 -23
  110. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.cjs.js +0 -71
  111. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.es.js +0 -71
  112. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.cjs.js +0 -83
  113. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.es.js +0 -83
  114. /package/dist/libs/callback/{tap-async.cjs.js → tap-async.cjs} +0 -0
  115. /package/dist/libs/callback/{tap.cjs.js → tap.cjs} +0 -0
  116. /package/dist/libs/config/{default-config.cjs.js → default-config.cjs} +0 -0
  117. /package/dist/libs/control/{copy-to-clipboard.cjs.js → copy-to-clipboard.cjs} +0 -0
  118. /package/dist/libs/control/{pd.cjs.js → pd.cjs} +0 -0
  119. /package/dist/libs/convert/{hex-to-rgb.cjs.js → hex-to-rgb.cjs} +0 -0
  120. /package/dist/libs/convert/{json-string-to-json-object.cjs.js → json-string-to-json-object.cjs} +0 -0
  121. /package/dist/libs/convert/{rgb-to-hex.cjs.js → rgb-to-hex.cjs} +0 -0
  122. /package/dist/libs/eventControl/{debounce.cjs.js → debounce.cjs} +0 -0
  123. /package/dist/libs/eventControl/{throttle.cjs.js → throttle.cjs} +0 -0
  124. /package/dist/libs/get/{get-class-names.cjs.js → get-class-names.cjs} +0 -0
  125. /package/dist/libs/get/{get-event-paths.cjs.js → get-event-paths.cjs} +0 -0
  126. /package/dist/libs/get/{get-orientation.cjs.js → get-orientation.cjs} +0 -0
  127. /package/dist/libs/get/{get-parent-list.cjs.js → get-parent-list.cjs} +0 -0
  128. /package/dist/libs/get/{get-relative-time.cjs.js → get-relative-time.cjs} +0 -0
  129. /package/dist/libs/get/{get-session-storage.cjs.js → get-session-storage.cjs} +0 -0
  130. /package/dist/libs/get/{get-string-length.cjs.js → get-string-length.cjs} +0 -0
  131. /package/dist/libs/is/{is-after-date-time.cjs.js → is-after-date-time.cjs} +0 -0
  132. /package/dist/libs/is/{is-exist-all-elements.cjs.js → is-exist-all-elements.cjs} +0 -0
  133. /package/dist/libs/is/{is-in-viewport.cjs.js → is-in-viewport.cjs} +0 -0
  134. /package/dist/libs/is/{is-key-exists.cjs.js → is-key-exists.cjs} +0 -0
  135. /package/dist/libs/is/{is-online.cjs.js → is-online.cjs} +0 -0
  136. /package/dist/libs/is/{is-scrollable.cjs.js → is-scrollable.cjs} +0 -0
  137. /package/dist/libs/is/{is-touch-support.cjs.js → is-touch-support.cjs} +0 -0
  138. /package/dist/libs/remove/{remove-all-html-tags.cjs.js → remove-all-html-tags.cjs} +0 -0
  139. /package/dist/libs/remove/{remove-attribute.cjs.js → remove-attribute.cjs} +0 -0
  140. /package/dist/libs/remove/{remove-session-storage.cjs.js → remove-session-storage.cjs} +0 -0
  141. /package/dist/libs/set/{set-attribute.cjs.js → set-attribute.cjs} +0 -0
  142. /package/dist/libs/set/{set-scroll-position-to-center.cjs.js → set-scroll-position-to-center.cjs} +0 -0
  143. /package/dist/libs/set/{set-session-storage.cjs.js → set-session-storage.cjs} +0 -0
  144. /package/dist/libs/to/{to-boolean.cjs.js → to-boolean.cjs} +0 -0
  145. /package/dist/libs/to/{to-positive-number.cjs.js → to-positive-number.cjs} +0 -0
  146. /package/dist/libs/transform/{wrap-text-with-spans.cjs.js → wrap-text-with-spans.cjs} +0 -0
  147. /package/dist/libs/wait/{sleep.cjs.js → sleep.cjs} +0 -0
@@ -4,7 +4,10 @@ const queryStringOptions = {
4
4
  parseNumbers: true
5
5
  };
6
6
  const getQueryParams = (query, options = {}) => {
7
- const { searchString = window.location.search, parseOptions } = options;
7
+ const {
8
+ searchString = typeof window === "undefined" ? "" : window.location.search,
9
+ parseOptions
10
+ } = options;
8
11
  const queryOptions = {
9
12
  ...queryStringOptions,
10
13
  ...parseOptions
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const getRandomInt = (min, max) => {
4
+ if (!Number.isFinite(min) || !Number.isFinite(max)) {
5
+ throw new Error("min and max must be finite numbers");
6
+ }
4
7
  if (min > max) {
5
8
  throw new Error("min must be less than or equal to max");
6
9
  }
7
10
  const minCeiled = Math.ceil(min);
8
11
  const maxFloored = Math.floor(max);
12
+ if (minCeiled > maxFloored) {
13
+ throw new Error("No integer exists between min and max");
14
+ }
9
15
  return Math.floor(Math.random() * (maxFloored - minCeiled + 1)) + minCeiled;
10
16
  };
11
17
  exports.getRandomInt = getRandomInt;
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Returns a random integer between min (inclusive) and max (inclusive).
3
3
  *
4
+ * Uses `Math.random()`, which is not cryptographically secure.
5
+ * Use `crypto.getRandomValues()` for tokens, IDs or passwords.
6
+ *
4
7
  * @param min - The minimum value (inclusive).
5
8
  * @param max - The maximum value (inclusive).
6
9
  * @returns A random integer between min and max.
7
- * @throws If min is greater than max.
10
+ * @throws If min or max is not a finite number, min is greater than max,
11
+ * or no integer exists between min and max (e.g. `getRandomInt(1.2, 1.8)`).
8
12
  *
9
13
  * @example
10
14
  * ```ts
@@ -1,9 +1,15 @@
1
1
  const getRandomInt = (min, max) => {
2
+ if (!Number.isFinite(min) || !Number.isFinite(max)) {
3
+ throw new Error("min and max must be finite numbers");
4
+ }
2
5
  if (min > max) {
3
6
  throw new Error("min must be less than or equal to max");
4
7
  }
5
8
  const minCeiled = Math.ceil(min);
6
9
  const maxFloored = Math.floor(max);
10
+ if (minCeiled > maxFloored) {
11
+ throw new Error("No integer exists between min and max");
12
+ }
7
13
  return Math.floor(Math.random() * (maxFloored - minCeiled + 1)) + minCeiled;
8
14
  };
9
15
  export {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const getRem = (px) => {
4
+ if (typeof window === "undefined") return `${px / 16}rem`;
4
5
  const rootFontSize = parseFloat(
5
6
  getComputedStyle(document.documentElement).fontSize
6
7
  );
@@ -4,5 +4,6 @@
4
4
  *
5
5
  * @param px - The pixel value to be converted.
6
6
  * @returns The equivalent value in rem units as a string.
7
+ * Uses the browser default root font size (16px) in SSR environments where window is undefined.
7
8
  */
8
9
  export declare const getRem: (px: number) => string;
@@ -1,4 +1,5 @@
1
1
  const getRem = (px) => {
2
+ if (typeof window === "undefined") return `${px / 16}rem`;
2
3
  const rootFontSize = parseFloat(
3
4
  getComputedStyle(document.documentElement).fontSize
4
5
  );
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const DEFAULT_SAMPLE_LINES = 20;
4
+ const MIN_SAMPLE_LINES = 2;
5
+ const MAX_SAMPLE_LINES = 100;
6
+ const normalizeSampleLines = (value) => {
7
+ const raw = value ?? DEFAULT_SAMPLE_LINES;
8
+ if (!Number.isFinite(raw)) return DEFAULT_SAMPLE_LINES;
9
+ return Math.min(MAX_SAMPLE_LINES, Math.max(MIN_SAMPLE_LINES, Math.floor(raw)));
10
+ };
11
+ const getRenderedLineHeight = (element, options) => {
12
+ if (typeof window === "undefined") return Number.NaN;
13
+ const sampleLines = normalizeSampleLines(options?.sampleLines);
14
+ const ownerDocument = element.ownerDocument;
15
+ const host = ownerDocument?.body;
16
+ const view = ownerDocument?.defaultView;
17
+ if (!host || !view) return Number.NaN;
18
+ const cs = view.getComputedStyle(element);
19
+ const probe = ownerDocument.createElement("div");
20
+ const style = probe.style;
21
+ style.position = "absolute";
22
+ style.left = "-9999px";
23
+ style.top = "0";
24
+ style.visibility = "hidden";
25
+ style.pointerEvents = "none";
26
+ style.margin = "0";
27
+ style.padding = "0";
28
+ style.border = "0";
29
+ style.whiteSpace = "pre";
30
+ style.fontFamily = cs.fontFamily;
31
+ style.fontSize = cs.fontSize;
32
+ style.fontWeight = cs.fontWeight;
33
+ style.fontStyle = cs.fontStyle;
34
+ style.lineHeight = cs.lineHeight;
35
+ style.letterSpacing = cs.letterSpacing;
36
+ style.fontFeatureSettings = cs.fontFeatureSettings;
37
+ if (cs.fontVariationSettings) {
38
+ style.fontVariationSettings = cs.fontVariationSettings;
39
+ }
40
+ for (let i = 0; i < sampleLines; i++) {
41
+ if (i > 0) probe.appendChild(ownerDocument.createElement("br"));
42
+ probe.appendChild(ownerDocument.createTextNode("X"));
43
+ }
44
+ host.appendChild(probe);
45
+ try {
46
+ const probeHeight = probe.getBoundingClientRect().height;
47
+ if (probeHeight <= 0) return Number.NaN;
48
+ return probeHeight / sampleLines;
49
+ } catch {
50
+ return Number.NaN;
51
+ } finally {
52
+ if (probe.parentNode === host) {
53
+ host.removeChild(probe);
54
+ }
55
+ }
56
+ };
57
+ exports.getRenderedLineHeight = getRenderedLineHeight;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Options for {@link getRenderedLineHeight}.
3
+ */
4
+ export type GetRenderedLineHeightOptions = {
5
+ /**
6
+ * Number of lines used to measure the rendered line-height. Higher values
7
+ * yield a more precise per-line average. Clamped to the range [2, 100];
8
+ * non-finite values fall back to the default.
9
+ *
10
+ * @default 20
11
+ */
12
+ sampleLines?: number;
13
+ };
14
+ /**
15
+ * Measures the line-height as it is actually rendered (in CSS pixels) for the
16
+ * given element.
17
+ *
18
+ * On iOS Safari, fractional `line-height` values are floored to integer pixels
19
+ * at paint time, which makes `getComputedStyle(...).lineHeight` and the
20
+ * `1lh` unit drift from the visual baseline. This function inserts a hidden
21
+ * probe element with the same font/line-height related styles, measures the
22
+ * total height across multiple lines, and divides by the line count to obtain
23
+ * the actually rendered per-line height.
24
+ *
25
+ * Returns `NaN` in non-DOM environments (SSR), or when the probe cannot be
26
+ * measured (no body, no defaultView, zero/negative height, or measurement
27
+ * exception).
28
+ *
29
+ * The caller is responsible for waiting on `document.fonts.ready` before
30
+ * calling this function when accurate font-loaded measurements matter.
31
+ *
32
+ * @param element - The element whose rendered line-height should be measured.
33
+ * @param options - Measurement options.
34
+ * @returns The rendered line-height in CSS pixels, or `NaN` when measurement
35
+ * is not possible.
36
+ */
37
+ export declare const getRenderedLineHeight: (element: HTMLElement, options?: GetRenderedLineHeightOptions) => number;
@@ -0,0 +1,57 @@
1
+ const DEFAULT_SAMPLE_LINES = 20;
2
+ const MIN_SAMPLE_LINES = 2;
3
+ const MAX_SAMPLE_LINES = 100;
4
+ const normalizeSampleLines = (value) => {
5
+ const raw = value ?? DEFAULT_SAMPLE_LINES;
6
+ if (!Number.isFinite(raw)) return DEFAULT_SAMPLE_LINES;
7
+ return Math.min(MAX_SAMPLE_LINES, Math.max(MIN_SAMPLE_LINES, Math.floor(raw)));
8
+ };
9
+ const getRenderedLineHeight = (element, options) => {
10
+ if (typeof window === "undefined") return Number.NaN;
11
+ const sampleLines = normalizeSampleLines(options?.sampleLines);
12
+ const ownerDocument = element.ownerDocument;
13
+ const host = ownerDocument?.body;
14
+ const view = ownerDocument?.defaultView;
15
+ if (!host || !view) return Number.NaN;
16
+ const cs = view.getComputedStyle(element);
17
+ const probe = ownerDocument.createElement("div");
18
+ const style = probe.style;
19
+ style.position = "absolute";
20
+ style.left = "-9999px";
21
+ style.top = "0";
22
+ style.visibility = "hidden";
23
+ style.pointerEvents = "none";
24
+ style.margin = "0";
25
+ style.padding = "0";
26
+ style.border = "0";
27
+ style.whiteSpace = "pre";
28
+ style.fontFamily = cs.fontFamily;
29
+ style.fontSize = cs.fontSize;
30
+ style.fontWeight = cs.fontWeight;
31
+ style.fontStyle = cs.fontStyle;
32
+ style.lineHeight = cs.lineHeight;
33
+ style.letterSpacing = cs.letterSpacing;
34
+ style.fontFeatureSettings = cs.fontFeatureSettings;
35
+ if (cs.fontVariationSettings) {
36
+ style.fontVariationSettings = cs.fontVariationSettings;
37
+ }
38
+ for (let i = 0; i < sampleLines; i++) {
39
+ if (i > 0) probe.appendChild(ownerDocument.createElement("br"));
40
+ probe.appendChild(ownerDocument.createTextNode("X"));
41
+ }
42
+ host.appendChild(probe);
43
+ try {
44
+ const probeHeight = probe.getBoundingClientRect().height;
45
+ if (probeHeight <= 0) return Number.NaN;
46
+ return probeHeight / sampleLines;
47
+ } catch {
48
+ return Number.NaN;
49
+ } finally {
50
+ if (probe.parentNode === host) {
51
+ host.removeChild(probe);
52
+ }
53
+ }
54
+ };
55
+ export {
56
+ getRenderedLineHeight
57
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getScrollbarWidth = () => {
4
+ if (typeof window === "undefined") return 0;
5
+ return window.innerWidth - document.documentElement.clientWidth;
6
+ };
7
+ exports.getScrollbarWidth = getScrollbarWidth;
@@ -5,5 +5,6 @@
5
5
  * to ensure accurate measurement regardless of body element styling (e.g., max-width, margin).
6
6
  *
7
7
  * @returns {number} The width of the scrollbar in pixels.
8
+ * Returns 0 in SSR environments where window is undefined.
8
9
  */
9
10
  export declare const getScrollbarWidth: () => number;
@@ -1,4 +1,7 @@
1
- const getScrollbarWidth = () => window.innerWidth - document.documentElement.clientWidth;
1
+ const getScrollbarWidth = () => {
2
+ if (typeof window === "undefined") return 0;
3
+ return window.innerWidth - document.documentElement.clientWidth;
4
+ };
2
5
  export {
3
6
  getScrollbarWidth
4
7
  };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getStylePropertyValue = require("./get-style-property-value.cjs.js");
3
+ const getStylePropertyValue = require("./get-style-property-value.cjs");
4
4
  const getStylePropertyValueToNumber = (key) => Number.parseFloat(getStylePropertyValue.getStylePropertyValue(key)) || 0;
5
5
  exports.getStylePropertyValueToNumber = getStylePropertyValueToNumber;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getStylePropertyValue = (key) => {
4
+ if (typeof window === "undefined") return "";
5
+ return getComputedStyle(document.documentElement).getPropertyValue(key);
6
+ };
7
+ exports.getStylePropertyValue = getStylePropertyValue;
@@ -3,5 +3,6 @@
3
3
  *
4
4
  * @param key - The name of the CSS custom property to retrieve.
5
5
  * @returns The value of the specified CSS custom property.
6
+ * Returns an empty string in SSR environments where window is undefined.
6
7
  */
7
8
  export declare const getStylePropertyValue: (key: string) => string;
@@ -1,4 +1,7 @@
1
- const getStylePropertyValue = (key) => getComputedStyle(document.documentElement).getPropertyValue(key);
1
+ const getStylePropertyValue = (key) => {
2
+ if (typeof window === "undefined") return "";
3
+ return getComputedStyle(document.documentElement).getPropertyValue(key);
4
+ };
2
5
  export {
3
6
  getStylePropertyValue
4
7
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isTouchSupport = require("../is/is-touch-support.cjs.js");
3
+ const isTouchSupport = require("../is/is-touch-support.cjs");
4
4
  const UAParser = require("ua-parser-js");
5
5
  const getUaData = () => {
6
6
  const parser = new UAParser();
@@ -1,23 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getAspectRatio = require("./get-aspect-ratio.cjs.js");
4
- const getClassNames = require("./get-class-names.cjs.js");
5
- const getDocumentHeight = require("./get-document-height.cjs.js");
6
- const getEventPaths = require("./get-event-paths.cjs.js");
7
- const getGcd = require("./get-gcd.cjs.js");
8
- const getGravatarUrl = require("./get-gravatar-url.cjs.js");
9
- const getOrientation = require("./get-orientation.cjs.js");
10
- const getParentList = require("./get-parent-list.cjs.js");
11
- const getQueryParams = require("./get-query-params.cjs.js");
12
- const getRelativeTime = require("./get-relative-time.cjs.js");
13
- const getRandomInt = require("./get-random-int.cjs.js");
14
- const getRem = require("./get-rem.cjs.js");
15
- const getScrollbarWidth = require("./get-scrollbar-width.cjs.js");
16
- const getSessionStorage = require("./get-session-storage.cjs.js");
17
- const getStringLength = require("./get-string-length.cjs.js");
18
- const getStylePropertyValue = require("./get-style-property-value.cjs.js");
19
- const getStylePropertyValueToNumber = require("./get-style-property-value-to-number.cjs.js");
20
- const getUaData = require("./get-ua-data.cjs.js");
3
+ const getAspectRatio = require("./get-aspect-ratio.cjs");
4
+ const getClassNames = require("./get-class-names.cjs");
5
+ const getDocumentHeight = require("./get-document-height.cjs");
6
+ const getEventPaths = require("./get-event-paths.cjs");
7
+ const getGcd = require("./get-gcd.cjs");
8
+ const getGravatarUrl = require("./get-gravatar-url.cjs");
9
+ const getOrientation = require("./get-orientation.cjs");
10
+ const getParentList = require("./get-parent-list.cjs");
11
+ const getQueryParams = require("./get-query-params.cjs");
12
+ const getRandomInt = require("./get-random-int.cjs");
13
+ const getRelativeTime = require("./get-relative-time.cjs");
14
+ const getRem = require("./get-rem.cjs");
15
+ const getRenderedLineHeight = require("./get-rendered-line-height.cjs");
16
+ const getScrollbarWidth = require("./get-scrollbar-width.cjs");
17
+ const getSessionStorage = require("./get-session-storage.cjs");
18
+ const getStringLength = require("./get-string-length.cjs");
19
+ const getStylePropertyValue = require("./get-style-property-value.cjs");
20
+ const getStylePropertyValueToNumber = require("./get-style-property-value-to-number.cjs");
21
+ const getUaData = require("./get-ua-data.cjs");
21
22
  exports.getAspectRatio = getAspectRatio.getAspectRatio;
22
23
  exports.getClassNames = getClassNames.getClassNames;
23
24
  exports.getDocumentHeight = getDocumentHeight.getDocumentHeight;
@@ -27,9 +28,10 @@ exports.getGravatarUrl = getGravatarUrl.getGravatarUrl;
27
28
  exports.getOrientation = getOrientation.getOrientation;
28
29
  exports.getParentList = getParentList.getParentList;
29
30
  exports.getQueryParams = getQueryParams.getQueryParams;
30
- exports.getRelativeTime = getRelativeTime.getRelativeTime;
31
31
  exports.getRandomInt = getRandomInt.getRandomInt;
32
+ exports.getRelativeTime = getRelativeTime.getRelativeTime;
32
33
  exports.getRem = getRem.getRem;
34
+ exports.getRenderedLineHeight = getRenderedLineHeight.getRenderedLineHeight;
33
35
  exports.getScrollbarWidth = getScrollbarWidth.getScrollbarWidth;
34
36
  exports.getSessionStorage = getSessionStorage.getSessionStorage;
35
37
  exports.getStringLength = getStringLength.getStringLength;
@@ -10,9 +10,10 @@ export * from './get-gravatar-url';
10
10
  export * from './get-orientation';
11
11
  export * from './get-parent-list';
12
12
  export * from './get-query-params';
13
- export * from './get-relative-time';
14
13
  export * from './get-random-int';
14
+ export * from './get-relative-time';
15
15
  export * from './get-rem';
16
+ export * from './get-rendered-line-height';
16
17
  export * from './get-scrollbar-width';
17
18
  export * from './get-session-storage';
18
19
  export * from './get-string-length';
@@ -7,9 +7,10 @@ import { getGravatarUrl } from "./get-gravatar-url.es.js";
7
7
  import { getOrientation } from "./get-orientation.es.js";
8
8
  import { getParentList } from "./get-parent-list.es.js";
9
9
  import { getQueryParams } from "./get-query-params.es.js";
10
- import { getRelativeTime } from "./get-relative-time.es.js";
11
10
  import { getRandomInt } from "./get-random-int.es.js";
11
+ import { getRelativeTime } from "./get-relative-time.es.js";
12
12
  import { getRem } from "./get-rem.es.js";
13
+ import { getRenderedLineHeight } from "./get-rendered-line-height.es.js";
13
14
  import { getScrollbarWidth } from "./get-scrollbar-width.es.js";
14
15
  import { getSessionStorage } from "./get-session-storage.es.js";
15
16
  import { getStringLength } from "./get-string-length.es.js";
@@ -29,6 +30,7 @@ export {
29
30
  getRandomInt,
30
31
  getRelativeTime,
31
32
  getRem,
33
+ getRenderedLineHeight,
32
34
  getScrollbarWidth,
33
35
  getSessionStorage,
34
36
  getStringLength,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getConfig = require("../config/get-config.cjs.js");
3
+ const getConfig = require("../config/get-config.cjs");
4
4
  const checkDeviceSize = () => {
5
5
  const breakpoint = getConfig.getConfigValue("BREAKPOINT");
6
6
  if (typeof window !== "undefined") {
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const checkDeviceSize = require("./check-device-size.cjs.js");
4
- const isAfterDateTime = require("./is-after-date-time.cjs.js");
5
- const isBetweenDateTime = require("./is-between-date-time.cjs.js");
6
- const isExistAllElements = require("./is-exist-all-elements.cjs.js");
7
- const isInViewport = require("./is-in-viewport.cjs.js");
8
- const isIpad = require("./is-ipad.cjs.js");
9
- const isKeyExists = require("./is-key-exists.cjs.js");
10
- const isOnline = require("./is-online.cjs.js");
11
- const isSafari = require("./is-safari.cjs.js");
12
- const isScrollable = require("./is-scrollable.cjs.js");
13
- const isTouchSupport = require("./is-touch-support.cjs.js");
3
+ const checkDeviceSize = require("./check-device-size.cjs");
4
+ const isAfterDateTime = require("./is-after-date-time.cjs");
5
+ const isBetweenDateTime = require("./is-between-date-time.cjs");
6
+ const isExistAllElements = require("./is-exist-all-elements.cjs");
7
+ const isInViewport = require("./is-in-viewport.cjs");
8
+ const isIpad = require("./is-ipad.cjs");
9
+ const isKeyExists = require("./is-key-exists.cjs");
10
+ const isOnline = require("./is-online.cjs");
11
+ const isSafari = require("./is-safari.cjs");
12
+ const isScrollable = require("./is-scrollable.cjs");
13
+ const isTouchSupport = require("./is-touch-support.cjs");
14
14
  exports.checkDeviceSize = checkDeviceSize.checkDeviceSize;
15
15
  exports.isAfterDateTime = isAfterDateTime.isAfterDateTime;
16
16
  exports.isBetweenDateTime = isBetweenDateTime.isBetweenDateTime;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const dayjs = require("dayjs");
4
- const isBetween = require("../../_virtual/isBetween.cjs.js");
5
- dayjs.extend(isBetween.default);
4
+ const isBetween = require("dayjs/plugin/isBetween.js");
5
+ dayjs.extend(isBetween);
6
6
  const isBetweenDateTime = (dateA, dateB, now = dayjs()) => {
7
7
  if (!dayjs(dateA).isValid() || !dayjs(dateB).isValid()) {
8
8
  throw new Error("dateA or dateB is not valid date");
@@ -1,5 +1,5 @@
1
1
  import dayjs from "dayjs";
2
- import isBetween from "../../_virtual/isBetween.es.js";
2
+ import isBetween from "dayjs/plugin/isBetween.js";
3
3
  dayjs.extend(isBetween);
4
4
  const isBetweenDateTime = (dateA, dateB, now = dayjs()) => {
5
5
  if (!dayjs(dateA).isValid() || !dayjs(dateB).isValid()) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getOrientation = require("../get/get-orientation.cjs.js");
4
- const getUaData = require("../get/get-ua-data.cjs.js");
3
+ const getOrientation = require("../get/get-orientation.cjs");
4
+ const getUaData = require("../get/get-ua-data.cjs");
5
5
  const isIpad = (orientation = "portrait") => {
6
6
  if (typeof window === "undefined" || typeof navigator === "undefined") {
7
7
  return false;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getUaData = require("../get/get-ua-data.cjs.js");
3
+ const getUaData = require("../get/get-ua-data.cjs");
4
4
  const isSafari = (includeMobileSafari = true) => {
5
5
  const clientData = getUaData.getUaData();
6
6
  if (includeMobileSafari) {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const removeAllHtmlTags = require("./remove-all-html-tags.cjs.js");
4
- const removeAttribute = require("./remove-attribute.cjs.js");
5
- const removeSessionStorage = require("./remove-session-storage.cjs.js");
6
- const removeStylePropertyValue = require("./remove-style-property-value.cjs.js");
3
+ const removeAllHtmlTags = require("./remove-all-html-tags.cjs");
4
+ const removeAttribute = require("./remove-attribute.cjs");
5
+ const removeSessionStorage = require("./remove-session-storage.cjs");
6
+ const removeStylePropertyValue = require("./remove-style-property-value.cjs");
7
7
  exports.removeAllHtmlTags = removeAllHtmlTags.removeAllHtmlTags;
8
8
  exports.removeAttribute = removeAttribute.removeAttribute;
9
9
  exports.removeSessionStorage = removeSessionStorage.removeSessionStorage;
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * Removes all HTML tags from the given string.
3
3
  *
4
+ * The result is an HTML string, not plain text: when the input contains `<`,
5
+ * special characters are escaped (e.g. `&` becomes `&amp;`); otherwise the input is returned as is.
6
+ * It is safe to insert as HTML (e.g. `innerHTML`), but entities may appear when assigned to `textContent`.
7
+ * Do not decode the result and then insert it as HTML.
8
+ * To keep safe markup instead of removing it, use `sanitizeHtml`.
9
+ *
4
10
  * @param string - The input string from which HTML tags should be removed.
5
- * @returns The sanitized string with all HTML tags removed.
11
+ * @returns The HTML string with all HTML tags removed.
6
12
  */
7
13
  export declare const removeAllHtmlTags: (string: string) => string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const removeStylePropertyValue = (key) => {
4
+ if (typeof window === "undefined") return;
4
5
  document.documentElement.style.removeProperty(key);
5
6
  };
6
7
  exports.removeStylePropertyValue = removeStylePropertyValue;
@@ -2,5 +2,6 @@
2
2
  * Removes a CSS custom property from the root element.
3
3
  *
4
4
  * @param key - The name of the CSS custom property to remove.
5
+ * Does nothing in SSR environments where window is undefined.
5
6
  */
6
7
  export declare const removeStylePropertyValue: (key: string) => void;
@@ -1,4 +1,5 @@
1
1
  const removeStylePropertyValue = (key) => {
2
+ if (typeof window === "undefined") return;
2
3
  document.documentElement.style.removeProperty(key);
3
4
  };
4
5
  export {
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const DOMPurify = require("isomorphic-dompurify");
4
+ const STRING_OUTPUT_CONFIG = {
5
+ RETURN_DOM: false,
6
+ RETURN_DOM_FRAGMENT: false,
7
+ RETURN_TRUSTED_TYPE: false,
8
+ IN_PLACE: false
9
+ };
4
10
  const htmlSanitize = (html, config = {}) => {
5
- return DOMPurify.sanitize(html, config);
11
+ return DOMPurify.sanitize(html, { ...config, ...STRING_OUTPUT_CONFIG });
6
12
  };
7
13
  const sanitizeHtml = htmlSanitize;
8
14
  exports.htmlSanitize = htmlSanitize;
@@ -2,6 +2,14 @@ import { default as DOMPurify } from 'isomorphic-dompurify';
2
2
  /**
3
3
  * Sanitizes the given HTML string to prevent XSS attacks.
4
4
  *
5
+ * The result is safe to insert as HTML element content (e.g. `innerHTML`).
6
+ * It is NOT safe for other contexts such as attribute values, URLs, `<script>` or CSS.
7
+ *
8
+ * Options that weaken the default protection (e.g. `ALLOWED_URI_REGEXP`, `ADD_TAGS`,
9
+ * `ALLOW_UNKNOWN_PROTOCOLS`, `SAFE_FOR_TEMPLATES: false`) are passed through to DOMPurify as is.
10
+ * `RETURN_DOM`, `RETURN_DOM_FRAGMENT`, `RETURN_TRUSTED_TYPE` and `IN_PLACE` are ignored,
11
+ * so the return value is always a string.
12
+ *
5
13
  * @param html - The HTML string to sanitize.
6
14
  * @param config - Optional configuration for DOMPurify.
7
15
  * @returns The sanitized HTML string.
@@ -1,6 +1,12 @@
1
1
  import DOMPurify from "isomorphic-dompurify";
2
+ const STRING_OUTPUT_CONFIG = {
3
+ RETURN_DOM: false,
4
+ RETURN_DOM_FRAGMENT: false,
5
+ RETURN_TRUSTED_TYPE: false,
6
+ IN_PLACE: false
7
+ };
2
8
  const htmlSanitize = (html, config = {}) => {
3
- return DOMPurify.sanitize(html, config);
9
+ return DOMPurify.sanitize(html, { ...config, ...STRING_OUTPUT_CONFIG });
4
10
  };
5
11
  const sanitizeHtml = htmlSanitize;
6
12
  export {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const htmlSanitize = require("./html-sanitize.cjs.js");
3
+ const htmlSanitize = require("./html-sanitize.cjs");
4
4
  exports.htmlSanitize = htmlSanitize.htmlSanitize;
5
5
  exports.sanitizeHtml = htmlSanitize.sanitizeHtml;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const set100vh = require("./set-100vh.cjs.js");
4
- const set100vw = require("./set-100vw.cjs.js");
5
- const setAttribute = require("./set-attribute.cjs.js");
6
- const setScrollPositionToCenter = require("./set-scroll-position-to-center.cjs.js");
7
- const setSessionStorage = require("./set-session-storage.cjs.js");
8
- const setStylePropertyValue = require("./set-style-property-value.cjs.js");
3
+ const set100vh = require("./set-100vh.cjs");
4
+ const set100vw = require("./set-100vw.cjs");
5
+ const setAttribute = require("./set-attribute.cjs");
6
+ const setScrollPositionToCenter = require("./set-scroll-position-to-center.cjs");
7
+ const setSessionStorage = require("./set-session-storage.cjs");
8
+ const setStylePropertyValue = require("./set-style-property-value.cjs");
9
9
  exports.set100vh = set100vh.set100vh;
10
10
  exports.set100vw = set100vw.set100vw;
11
11
  exports.setAttribute = setAttribute.setAttribute;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const set100vh = (setProperty = "--vh") => {
4
+ if (typeof window === "undefined") return;
4
5
  const vh = window.innerHeight * 0.01;
5
6
  document.documentElement.style.setProperty(setProperty, `${vh}px`);
6
7
  };
@@ -7,5 +7,6 @@
7
7
  * @param {string} [setProperty='--vh'] - The name of the CSS variable to set.
8
8
  *
9
9
  * @link https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
10
+ * Does nothing in SSR environments where window is undefined.
10
11
  */
11
12
  export declare const set100vh: (setProperty?: string) => void;