@koine/utils 2.0.0-beta.80 → 2.0.0-beta.83

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 (354) hide show
  1. package/Defer.cjs.js +20 -10
  2. package/Defer.esm.js +20 -10
  3. package/Emitter.cjs.js +18 -19
  4. package/Emitter.d.ts +1 -1
  5. package/Emitter.esm.js +18 -19
  6. package/accentsSets.cjs.d.ts +2 -0
  7. package/accentsSets.cjs.default.js +1 -0
  8. package/accentsSets.cjs.js +20 -0
  9. package/accentsSets.cjs.mjs +2 -0
  10. package/accentsSets.esm.js +15 -0
  11. package/addOrReplaceAtIdx.cjs.js +7 -14
  12. package/addOrReplaceAtIdx.esm.js +7 -14
  13. package/areEqual.cjs.js +28 -43
  14. package/areEqual.esm.js +28 -43
  15. package/arrayFilterFalsy.cjs.js +6 -1
  16. package/arrayFilterFalsy.d.ts +1 -1
  17. package/arrayFilterFalsy.esm.js +6 -1
  18. package/arrayFindLastIndex.cjs.js +13 -8
  19. package/arrayFindLastIndex.d.ts +1 -1
  20. package/arrayFindLastIndex.esm.js +13 -8
  21. package/arrayOfAll.cjs.js +16 -1
  22. package/arrayOfAll.esm.js +16 -1
  23. package/arraySum.cjs.js +6 -1
  24. package/arraySum.esm.js +6 -1
  25. package/arrayToLookup.cjs.js +5 -4
  26. package/arrayToLookup.esm.js +5 -4
  27. package/arrayUniqueByProperties.cjs.js +8 -1
  28. package/arrayUniqueByProperties.esm.js +8 -1
  29. package/buildUrlQueryString.cjs.js +10 -17
  30. package/buildUrlQueryString.esm.js +10 -17
  31. package/capitalize.cjs.js +7 -2
  32. package/capitalize.d.ts +1 -1
  33. package/capitalize.esm.js +7 -2
  34. package/changeCaseCamel.cjs.js +7 -17
  35. package/changeCaseCamel.esm.js +7 -17
  36. package/changeCaseCapital.cjs.js +7 -10
  37. package/changeCaseCapital.esm.js +7 -10
  38. package/changeCaseConstant.cjs.js +7 -6
  39. package/changeCaseConstant.esm.js +7 -6
  40. package/changeCaseDot.cjs.js +7 -1
  41. package/changeCaseDot.esm.js +7 -1
  42. package/changeCaseHelpers.cjs.js +32 -71
  43. package/changeCaseHelpers.esm.js +32 -71
  44. package/changeCaseKebab.cjs.js +7 -1
  45. package/changeCaseKebab.esm.js +7 -1
  46. package/changeCaseNone.cjs.js +7 -6
  47. package/changeCaseNone.esm.js +7 -6
  48. package/changeCasePascal.cjs.js +7 -9
  49. package/changeCasePascal.esm.js +7 -9
  50. package/changeCasePascalSnake.cjs.js +7 -1
  51. package/changeCasePascalSnake.esm.js +7 -1
  52. package/changeCasePath.cjs.js +7 -1
  53. package/changeCasePath.esm.js +7 -1
  54. package/changeCaseSentence.cjs.js +7 -15
  55. package/changeCaseSentence.esm.js +8 -16
  56. package/changeCaseSnake.cjs.js +7 -1
  57. package/changeCaseSnake.esm.js +7 -1
  58. package/changeCaseTrain.cjs.js +7 -1
  59. package/changeCaseTrain.esm.js +7 -1
  60. package/chunkByChunks.cjs.js +5 -31
  61. package/chunkByChunks.esm.js +5 -31
  62. package/chunkBySize.cjs.js +4 -7
  63. package/chunkBySize.esm.js +4 -7
  64. package/clamp.cjs.js +6 -1
  65. package/clamp.esm.js +6 -1
  66. package/clsx.cjs.js +8 -39
  67. package/clsx.esm.js +8 -39
  68. package/convertRange.cjs.js +14 -1
  69. package/convertRange.esm.js +14 -1
  70. package/cookie.cjs.js +44 -1
  71. package/cookie.esm.js +44 -1
  72. package/createPalette.cjs.js +17 -11
  73. package/createPalette.esm.js +17 -11
  74. package/debounce.cjs.js +7 -17
  75. package/debounce.esm.js +7 -17
  76. package/debouncePromise.cjs.js +16 -51
  77. package/debouncePromise.esm.js +16 -51
  78. package/debounceRaf.cjs.js +10 -12
  79. package/debounceRaf.esm.js +10 -12
  80. package/decode.cjs.js +4 -1
  81. package/decode.esm.js +4 -1
  82. package/encode.cjs.js +4 -1
  83. package/encode.esm.js +4 -1
  84. package/ensureInt.cjs.js +5 -1
  85. package/ensureInt.esm.js +5 -1
  86. package/errorToString.cjs.js +6 -1
  87. package/errorToString.esm.js +6 -1
  88. package/escapeRegExp.cjs.js +7 -1
  89. package/escapeRegExp.esm.js +7 -1
  90. package/findDuplicatedIndexes.cjs.js +3 -10
  91. package/findDuplicatedIndexes.esm.js +3 -10
  92. package/forin.cjs.js +6 -5
  93. package/forin.esm.js +6 -5
  94. package/gbToBytes.cjs.js +5 -1
  95. package/gbToBytes.esm.js +5 -1
  96. package/getEmptyArray.cjs.js +6 -3
  97. package/getEmptyArray.esm.js +6 -3
  98. package/getKeys.cjs.js +8 -1
  99. package/getKeys.d.ts +1 -1
  100. package/getKeys.esm.js +8 -1
  101. package/getMediaQueryWidthResolvers.cjs.js +27 -41
  102. package/getMediaQueryWidthResolvers.esm.js +27 -41
  103. package/getMediaQueryWidthTailwindScreens.cjs.js +6 -25
  104. package/getMediaQueryWidthTailwindScreens.esm.js +6 -25
  105. package/getNonce.cjs.js +4 -1
  106. package/getNonce.esm.js +4 -1
  107. package/getParamAmong.cjs.js +11 -4
  108. package/getParamAmong.esm.js +11 -4
  109. package/getParamAsInt.cjs.js +10 -7
  110. package/getParamAsInt.esm.js +10 -7
  111. package/getParamAsString.cjs.js +9 -1
  112. package/getParamAsString.esm.js +9 -1
  113. package/getType.cjs.js +13 -1
  114. package/getType.esm.js +13 -1
  115. package/getUrlHashParams.cjs.js +6 -8
  116. package/getUrlHashParams.esm.js +6 -8
  117. package/getUrlHashPathname.cjs.js +7 -1
  118. package/getUrlHashPathname.esm.js +7 -1
  119. package/getUrlPathnameParts.cjs.js +10 -4
  120. package/getUrlPathnameParts.esm.js +10 -4
  121. package/getUrlQueryParams.cjs.js +12 -20
  122. package/getUrlQueryParams.esm.js +12 -20
  123. package/hashAny.cjs.d.ts +2 -0
  124. package/hashAny.cjs.default.js +1 -0
  125. package/hashAny.cjs.js +40 -0
  126. package/hashAny.cjs.mjs +2 -0
  127. package/hashAny.d.ts +2 -0
  128. package/hashAny.esm.js +35 -0
  129. package/imgEmptyPixel.cjs.js +5 -1
  130. package/imgEmptyPixel.esm.js +5 -1
  131. package/index.cjs.js +5 -3
  132. package/index.d.ts +2 -1
  133. package/index.esm.js +3 -2
  134. package/invariant.cjs.js +17 -16
  135. package/invariant.esm.js +17 -16
  136. package/isAbsoluteUrl.cjs.js +5 -2
  137. package/isAbsoluteUrl.esm.js +5 -2
  138. package/isAnyObject.cjs.js +5 -1
  139. package/isAnyObject.esm.js +5 -1
  140. package/isArray.cjs.js +5 -1
  141. package/isArray.esm.js +5 -1
  142. package/isBlob.cjs.js +5 -1
  143. package/isBlob.esm.js +5 -1
  144. package/isBoolean.cjs.js +5 -1
  145. package/isBoolean.esm.js +5 -1
  146. package/isBrowser.cjs.js +4 -1
  147. package/isBrowser.esm.js +4 -1
  148. package/isBrowserNow.cjs.js +4 -1
  149. package/isBrowserNow.esm.js +4 -1
  150. package/isDate.cjs.js +5 -1
  151. package/isDate.esm.js +5 -1
  152. package/isEmptyArray.cjs.js +5 -1
  153. package/isEmptyArray.esm.js +5 -1
  154. package/isEmptyObject.cjs.js +5 -1
  155. package/isEmptyObject.esm.js +5 -1
  156. package/isEmptyString.cjs.js +5 -1
  157. package/isEmptyString.esm.js +5 -1
  158. package/isError.cjs.js +5 -1
  159. package/isError.esm.js +5 -1
  160. package/isExternalUrl.cjs.js +9 -9
  161. package/isExternalUrl.esm.js +9 -9
  162. package/isFile.cjs.js +5 -1
  163. package/isFile.esm.js +5 -1
  164. package/isFloat.cjs.js +5 -1
  165. package/isFloat.esm.js +5 -1
  166. package/isFormData.cjs.js +5 -1
  167. package/isFormData.esm.js +5 -1
  168. package/isFullArray.cjs.js +5 -1
  169. package/isFullArray.esm.js +5 -1
  170. package/isFullObject.cjs.js +5 -1
  171. package/isFullObject.esm.js +5 -1
  172. package/isFullString.cjs.js +5 -1
  173. package/isFullString.esm.js +5 -1
  174. package/isFunction.cjs.js +5 -1
  175. package/isFunction.esm.js +5 -1
  176. package/isInt.cjs.js +5 -1
  177. package/isInt.esm.js +5 -1
  178. package/isMap.cjs.js +5 -1
  179. package/isMap.esm.js +5 -1
  180. package/isNaNValue.cjs.js +5 -1
  181. package/isNaNValue.esm.js +5 -1
  182. package/isNegativeNumber.cjs.js +5 -1
  183. package/isNegativeNumber.esm.js +5 -1
  184. package/isNull.cjs.js +5 -1
  185. package/isNull.esm.js +5 -1
  186. package/isNullOrUndefined.cjs.js +5 -1
  187. package/isNullOrUndefined.esm.js +5 -1
  188. package/isNumber.cjs.js +7 -1
  189. package/isNumber.esm.js +7 -1
  190. package/isNumericLiteral.cjs.js +8 -1
  191. package/isNumericLiteral.esm.js +8 -1
  192. package/isObject.cjs.js +5 -1
  193. package/isObject.esm.js +5 -1
  194. package/isObjectLike.cjs.js +7 -1
  195. package/isObjectLike.esm.js +7 -1
  196. package/isObjectStringKeyed.cjs.js +9 -1
  197. package/isObjectStringKeyed.esm.js +9 -1
  198. package/isOneOf.cjs.js +3 -7
  199. package/isOneOf.esm.js +3 -7
  200. package/isPlainObject.cjs.js +5 -4
  201. package/isPlainObject.esm.js +5 -4
  202. package/isPositiveNumber.cjs.js +5 -1
  203. package/isPositiveNumber.esm.js +5 -1
  204. package/isPrimitive.cjs.js +5 -6
  205. package/isPrimitive.esm.js +5 -6
  206. package/isPromise.cjs.js +5 -1
  207. package/isPromise.esm.js +5 -1
  208. package/isRegExp.cjs.js +5 -1
  209. package/isRegExp.esm.js +5 -1
  210. package/isServer.cjs.js +4 -1
  211. package/isServer.esm.js +4 -1
  212. package/isServerNow.cjs.js +4 -1
  213. package/isServerNow.esm.js +4 -1
  214. package/isSet.cjs.js +5 -1
  215. package/isSet.esm.js +5 -1
  216. package/isString.cjs.js +5 -1
  217. package/isString.esm.js +5 -1
  218. package/isSymbol.cjs.js +5 -1
  219. package/isSymbol.esm.js +5 -1
  220. package/isType.cjs.js +9 -11
  221. package/isType.esm.js +9 -11
  222. package/isUndefined.cjs.js +5 -1
  223. package/isUndefined.esm.js +5 -1
  224. package/isWeakMap.cjs.js +5 -1
  225. package/isWeakMap.esm.js +5 -1
  226. package/isWeakSet.cjs.js +5 -1
  227. package/isWeakSet.esm.js +5 -1
  228. package/kbToBytes.cjs.js +5 -1
  229. package/kbToBytes.esm.js +5 -1
  230. package/lowercase.cjs.js +5 -1
  231. package/lowercase.d.ts +1 -1
  232. package/lowercase.esm.js +5 -1
  233. package/mapListBy.cjs.js +5 -4
  234. package/mapListBy.esm.js +5 -4
  235. package/matchSorter.cjs.js +94 -239
  236. package/matchSorter.d.ts +1 -1
  237. package/matchSorter.esm.js +92 -237
  238. package/mbToBytes.cjs.js +5 -1
  239. package/mbToBytes.esm.js +5 -1
  240. package/mergeObjects.cjs.js +8 -26
  241. package/mergeObjects.esm.js +8 -26
  242. package/mergeUrlQueryParams.cjs.js +5 -12
  243. package/mergeUrlQueryParams.esm.js +5 -12
  244. package/moveSortableArrayItemByKey.cjs.js +7 -8
  245. package/moveSortableArrayItemByKey.esm.js +7 -8
  246. package/noop.cjs.js +5 -1
  247. package/noop.esm.js +5 -1
  248. package/normaliseUrl.cjs.js +9 -1
  249. package/normaliseUrl.esm.js +9 -1
  250. package/normaliseUrlPathname.cjs.js +8 -1
  251. package/normaliseUrlPathname.esm.js +8 -1
  252. package/objectFlat.cjs.js +8 -16
  253. package/objectFlat.esm.js +8 -16
  254. package/objectFlip.cjs.js +4 -4
  255. package/objectFlip.esm.js +4 -4
  256. package/objectMergeWithDefaults.cjs.js +29 -19
  257. package/objectMergeWithDefaults.d.ts +1 -1
  258. package/objectMergeWithDefaults.esm.js +29 -19
  259. package/objectOmit.cjs.js +9 -7
  260. package/objectOmit.esm.js +9 -7
  261. package/objectPick.cjs.js +6 -8
  262. package/objectPick.esm.js +6 -8
  263. package/objectSort.cjs.js +8 -1
  264. package/objectSort.esm.js +8 -1
  265. package/objectSortByKeysMatching.cjs.js +9 -1
  266. package/objectSortByKeysMatching.esm.js +9 -1
  267. package/objectToArray.cjs.js +6 -1
  268. package/objectToArray.esm.js +6 -1
  269. package/package.json +10 -5
  270. package/parseCookie.cjs.js +13 -32
  271. package/parseCookie.esm.js +13 -32
  272. package/parseURL.cjs.js +6 -13
  273. package/parseURL.esm.js +6 -13
  274. package/quaranteneProps.cjs.js +17 -15
  275. package/quaranteneProps.esm.js +17 -15
  276. package/randomInt.cjs.js +5 -1
  277. package/randomInt.esm.js +5 -1
  278. package/randomKey.cjs.js +6 -4
  279. package/randomKey.esm.js +6 -4
  280. package/readCookie.cjs.js +5 -33
  281. package/readCookie.esm.js +5 -33
  282. package/removeAccents.cjs.js +4 -9
  283. package/removeAccents.d.ts +1 -1
  284. package/removeAccents.esm.js +4 -9
  285. package/removeCookie.cjs.js +3 -7
  286. package/removeCookie.esm.js +3 -7
  287. package/removeDuplicates.cjs.js +8 -1
  288. package/removeDuplicates.esm.js +8 -1
  289. package/removeDuplicatesByKey.cjs.js +6 -12
  290. package/removeDuplicatesByKey.esm.js +6 -12
  291. package/removeDuplicatesComparing.cjs.js +3 -4
  292. package/removeDuplicatesComparing.esm.js +3 -4
  293. package/removeIndexesFromArray.cjs.js +4 -9
  294. package/removeIndexesFromArray.esm.js +4 -9
  295. package/removeTrailingSlash.cjs.js +5 -1
  296. package/removeTrailingSlash.esm.js +5 -1
  297. package/removeUrlQueryParams.cjs.js +5 -11
  298. package/removeUrlQueryParams.esm.js +5 -11
  299. package/render.cjs.js +52 -112
  300. package/render.esm.js +52 -112
  301. package/round.cjs.js +11 -3
  302. package/round.esm.js +11 -3
  303. package/roundTo.cjs.js +22 -10
  304. package/roundTo.esm.js +22 -10
  305. package/serializeCookie.cjs.js +13 -67
  306. package/serializeCookie.esm.js +13 -67
  307. package/setCookie.cjs.js +11 -41
  308. package/setCookie.esm.js +11 -41
  309. package/shuffle.cjs.js +15 -16
  310. package/shuffle.esm.js +15 -16
  311. package/slugify.cjs.js +20 -9
  312. package/slugify.esm.js +20 -9
  313. package/split.cjs.js +6 -1
  314. package/split.esm.js +6 -1
  315. package/splitReverse.cjs.js +6 -1
  316. package/splitReverse.esm.js +6 -1
  317. package/swapMap.cjs.js +5 -7
  318. package/swapMap.esm.js +5 -7
  319. package/throttle.cjs.js +6 -14
  320. package/throttle.d.ts +1 -1
  321. package/throttle.esm.js +6 -14
  322. package/titleCase.cjs.js +6 -3
  323. package/titleCase.esm.js +6 -3
  324. package/toNumber.cjs.js +5 -1
  325. package/toNumber.esm.js +5 -1
  326. package/toRgba.cjs.js +5 -7
  327. package/toRgba.esm.js +5 -7
  328. package/transformToUrlPathname.cjs.js +9 -3
  329. package/transformToUrlPathname.esm.js +9 -3
  330. package/truncate.cjs.js +5 -5
  331. package/truncate.esm.js +5 -5
  332. package/tryUntil.cjs.js +14 -14
  333. package/tryUntil.esm.js +14 -14
  334. package/uid.cjs.js +5 -5
  335. package/uid.esm.js +5 -5
  336. package/updateLinkParams.cjs.js +7 -5
  337. package/updateLinkParams.esm.js +7 -5
  338. package/updateUrlQueryParams.cjs.js +5 -7
  339. package/updateUrlQueryParams.esm.js +5 -7
  340. package/uppercase.cjs.js +6 -1
  341. package/uppercase.d.ts +1 -1
  342. package/uppercase.esm.js +6 -1
  343. package/uuid.cjs.js +6 -4
  344. package/uuid.esm.js +6 -4
  345. package/uuidNumeric.cjs.js +4 -1
  346. package/uuidNumeric.esm.js +4 -1
  347. package/wait.cjs.js +5 -1
  348. package/wait.esm.js +5 -1
  349. package/accentSets.cjs.d.ts +0 -2
  350. package/accentSets.cjs.default.js +0 -1
  351. package/accentSets.cjs.js +0 -36
  352. package/accentSets.cjs.mjs +0 -2
  353. package/accentSets.esm.js +0 -31
  354. /package/{accentSets.d.ts → accentsSets.d.ts} +0 -0
@@ -2,47 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let getMediaQueryWidthResolvers = (customBreakpoints) => {
6
- const breakpoints = {
7
- xs: 0,
8
- ...customBreakpoints,
9
- };
10
- const sortedBreakpointsNames = Object.keys(breakpoints).map((key) => {
11
- const br = key;
12
- return [br, breakpoints[br]];
13
- })
14
- .sort((a, b) => a[1] - b[1])
15
- .map((item) => item[0]);
16
- const getNextBreakpoint = (breakpoint) => {
17
- const index = sortedBreakpointsNames.indexOf(breakpoint);
18
- return sortedBreakpointsNames[index + 1];
19
- };
20
- const min = (br) => `(min-width: ${breakpoints[br]}px)`;
21
- const max = (br) => `(max-width: ${breakpoints[br] - 0.02}px)`;
22
- const up = min;
23
- const down = (br) => {
24
- const brNext = getNextBreakpoint(br);
25
- return brNext && `(max-width: ${breakpoints[brNext] - 0.02}px)`;
26
- };
27
- const between = (br1, br2) => {
28
- br2 = br2 || getNextBreakpoint(br1);
29
- return br2
30
- ? `(min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)`
31
- : min(br1);
32
- };
33
- const only = (br) => {
34
- const brNext = getNextBreakpoint(br);
35
- return brNext ? between(br, brNext) : min(br);
36
- };
37
- return {
38
- max,
39
- min,
40
- down,
41
- up,
42
- between,
43
- only,
44
- };
45
- };
5
+ /**
6
+ * @category responsive
7
+ *//**
8
+ * @category responsive
9
+ */let getMediaQueryWidthResolvers=e=>{let t={xs:0,...e},r=Object.keys(t).map(e=>[e,t[e]]).sort((e,t)=>e[1]-t[1]).map(e=>e[0]),d=e=>{let t=r.indexOf(e);return r[t+1]},/**
10
+ * It behaves the same as `(min-width: ${value}px)`
11
+ * where value is the given breakpoint value.
12
+ * For ease of use this can be used both as a function `min("md")` and as an
13
+ * object literal `min.md`.
14
+ */x=e=>`(min-width: ${t[e]}px)`,/**
15
+ * Media query between the two given breakpoints
16
+ */i=(e,r)=>(r=r||d(e))?`(min-width: ${t[e]}px) and (max-width: ${t[r]-.02}px)`:x(e);return {max:/**
17
+ * It behaves the same as `(max-width: ${value}px)`
18
+ * where value is the given breakpoint value.
19
+ * For ease of use this can be used both as a function `max("md")` and as an
20
+ * object literal `max.md`.
21
+ */e=>`(max-width: ${t[e]-.02}px)`,min:x,down:/**
22
+ * It behaves similarly to `max` but you will use the "next" breakpoint,
23
+ * specifying CSS that will apply from the given breakpoint and down.
24
+ */e=>{let r=d(e);// TODO: if br does not exists otherwise throw Error
25
+ return r&&`(max-width: ${t[r]-.02}px)`},up:/**
26
+ * It behaves the same as `min`
27
+ * @inheritdoc {max}
28
+ */x,between:i,only:/**
29
+ * Media query to apply from the given breakpoint until the next, just for its
30
+ * full range
31
+ */e=>{let t=d(e);return t?i(e,t):x(e)}}};
46
32
 
47
33
  exports["default"] = getMediaQueryWidthResolvers;
48
34
  exports.getMediaQueryWidthResolvers = getMediaQueryWidthResolvers;
@@ -1,43 +1,29 @@
1
- let getMediaQueryWidthResolvers = (customBreakpoints) => {
2
- const breakpoints = {
3
- xs: 0,
4
- ...customBreakpoints,
5
- };
6
- const sortedBreakpointsNames = Object.keys(breakpoints).map((key) => {
7
- const br = key;
8
- return [br, breakpoints[br]];
9
- })
10
- .sort((a, b) => a[1] - b[1])
11
- .map((item) => item[0]);
12
- const getNextBreakpoint = (breakpoint) => {
13
- const index = sortedBreakpointsNames.indexOf(breakpoint);
14
- return sortedBreakpointsNames[index + 1];
15
- };
16
- const min = (br) => `(min-width: ${breakpoints[br]}px)`;
17
- const max = (br) => `(max-width: ${breakpoints[br] - 0.02}px)`;
18
- const up = min;
19
- const down = (br) => {
20
- const brNext = getNextBreakpoint(br);
21
- return brNext && `(max-width: ${breakpoints[brNext] - 0.02}px)`;
22
- };
23
- const between = (br1, br2) => {
24
- br2 = br2 || getNextBreakpoint(br1);
25
- return br2
26
- ? `(min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)`
27
- : min(br1);
28
- };
29
- const only = (br) => {
30
- const brNext = getNextBreakpoint(br);
31
- return brNext ? between(br, brNext) : min(br);
32
- };
33
- return {
34
- max,
35
- min,
36
- down,
37
- up,
38
- between,
39
- only,
40
- };
41
- };
1
+ /**
2
+ * @category responsive
3
+ *//**
4
+ * @category responsive
5
+ */let getMediaQueryWidthResolvers=e=>{let t={xs:0,...e},r=Object.keys(t).map(e=>[e,t[e]]).sort((e,t)=>e[1]-t[1]).map(e=>e[0]),d=e=>{let t=r.indexOf(e);return r[t+1]},/**
6
+ * It behaves the same as `(min-width: ${value}px)`
7
+ * where value is the given breakpoint value.
8
+ * For ease of use this can be used both as a function `min("md")` and as an
9
+ * object literal `min.md`.
10
+ */x=e=>`(min-width: ${t[e]}px)`,/**
11
+ * Media query between the two given breakpoints
12
+ */i=(e,r)=>(r=r||d(e))?`(min-width: ${t[e]}px) and (max-width: ${t[r]-.02}px)`:x(e);return {max:/**
13
+ * It behaves the same as `(max-width: ${value}px)`
14
+ * where value is the given breakpoint value.
15
+ * For ease of use this can be used both as a function `max("md")` and as an
16
+ * object literal `max.md`.
17
+ */e=>`(max-width: ${t[e]-.02}px)`,min:x,down:/**
18
+ * It behaves similarly to `max` but you will use the "next" breakpoint,
19
+ * specifying CSS that will apply from the given breakpoint and down.
20
+ */e=>{let r=d(e);// TODO: if br does not exists otherwise throw Error
21
+ return r&&`(max-width: ${t[r]-.02}px)`},up:/**
22
+ * It behaves the same as `min`
23
+ * @inheritdoc {max}
24
+ */x,between:i,only:/**
25
+ * Media query to apply from the given breakpoint until the next, just for its
26
+ * full range
27
+ */e=>{let t=d(e);return t?i(e,t):x(e)}}};
42
28
 
43
29
  export { getMediaQueryWidthResolvers as default, getMediaQueryWidthResolvers };
@@ -4,31 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getMediaQueryWidthResolvers = require('./getMediaQueryWidthResolvers.cjs.js');
6
6
 
7
- let getMediaQueryWidthTailwindScreens = (breakpoints) => {
8
- const mqWidthResolvers = getMediaQueryWidthResolvers.getMediaQueryWidthResolvers(breakpoints);
9
- const screens = Object.keys(breakpoints).reduce((output, br, idx) => {
10
- const brNext = Object.keys(breakpoints)[idx + 1];
11
- for (const resolverName in mqWidthResolvers) {
12
- const resolver = resolverName;
13
- const resolverFn = mqWidthResolvers[resolver];
14
- const raw = resolverFn(br);
15
- if (raw) {
16
- if (resolverName === "min") {
17
- output[`@${br}`] = { raw };
18
- }
19
- if (resolverName === "between") {
20
- if (brNext)
21
- output[`@${resolverName}-${br}_${brNext}`] = { raw };
22
- }
23
- else {
24
- output[`@${resolverName}-${br}`] = { raw };
25
- }
26
- }
27
- }
28
- return output;
29
- }, {});
30
- return screens;
31
- };
7
+ /**
8
+ * @category responsive
9
+ * @category tailwind
10
+ */let getMediaQueryWidthTailwindScreens=t=>{let r=getMediaQueryWidthResolvers.getMediaQueryWidthResolvers(t);return(// Object.keys(breakpoints).reduce((screens, br) => {
11
+ Object.keys(t).reduce((e,i,d)=>{let l=Object.keys(t)[d+1];for(let t in r){let d=(0, r[// this line is just for typescript..
12
+ t])(i);d&&("min"===t&&(e[`@${i}`]={raw:d}),"between"===t?l&&(e[`@${t}-${i}_${l}`]={raw:d}):e[`@${t}-${i}`]={raw:d});}return e},{}))};
32
13
 
33
14
  exports["default"] = getMediaQueryWidthTailwindScreens;
34
15
  exports.getMediaQueryWidthTailwindScreens = getMediaQueryWidthTailwindScreens;
@@ -1,29 +1,10 @@
1
1
  import { getMediaQueryWidthResolvers } from './getMediaQueryWidthResolvers.esm.js';
2
2
 
3
- let getMediaQueryWidthTailwindScreens = (breakpoints) => {
4
- const mqWidthResolvers = getMediaQueryWidthResolvers(breakpoints);
5
- const screens = Object.keys(breakpoints).reduce((output, br, idx) => {
6
- const brNext = Object.keys(breakpoints)[idx + 1];
7
- for (const resolverName in mqWidthResolvers) {
8
- const resolver = resolverName;
9
- const resolverFn = mqWidthResolvers[resolver];
10
- const raw = resolverFn(br);
11
- if (raw) {
12
- if (resolverName === "min") {
13
- output[`@${br}`] = { raw };
14
- }
15
- if (resolverName === "between") {
16
- if (brNext)
17
- output[`@${resolverName}-${br}_${brNext}`] = { raw };
18
- }
19
- else {
20
- output[`@${resolverName}-${br}`] = { raw };
21
- }
22
- }
23
- }
24
- return output;
25
- }, {});
26
- return screens;
27
- };
3
+ /**
4
+ * @category responsive
5
+ * @category tailwind
6
+ */let getMediaQueryWidthTailwindScreens=t=>{let r=getMediaQueryWidthResolvers(t);return(// Object.keys(breakpoints).reduce((screens, br) => {
7
+ Object.keys(t).reduce((e,i,d)=>{let l=Object.keys(t)[d+1];for(let t in r){let d=(0, r[// this line is just for typescript..
8
+ t])(i);d&&("min"===t&&(e[`@${i}`]={raw:d}),"between"===t?l&&(e[`@${t}-${i}_${l}`]={raw:d}):e[`@${t}-${i}`]={raw:d});}return e},{}))};
28
9
 
29
10
  export { getMediaQueryWidthTailwindScreens as default, getMediaQueryWidthTailwindScreens };
package/getNonce.cjs.js CHANGED
@@ -5,7 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isUndefined = require('./isUndefined.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let getNonce = () => isUndefined.isUndefined(__webpack_nonce__) ? null : __webpack_nonce__;
8
+ /**
9
+ * @category security
10
+ * @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
11
+ */let getNonce=()=>isUndefined.isUndefined(__webpack_nonce__)?null:__webpack_nonce__;
9
12
 
10
13
  exports["default"] = getNonce;
11
14
  exports.getNonce = getNonce;
package/getNonce.esm.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { isUndefined } from './isUndefined.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let getNonce = () => isUndefined(__webpack_nonce__) ? null : __webpack_nonce__;
4
+ /**
5
+ * @category security
6
+ * @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
7
+ */let getNonce=()=>isUndefined(__webpack_nonce__)?null:__webpack_nonce__;
5
8
 
6
9
  export { getNonce as default, getNonce };
@@ -6,10 +6,17 @@ var getParamAsString = require('./getParamAsString.cjs.js');
6
6
  require('./isArray.cjs.js');
7
7
  require('./getType.cjs.js');
8
8
 
9
- let getParamAmong = (raw, allowedValues = []) => {
10
- const string = getParamAsString.getParamAsString(raw);
11
- return allowedValues.includes(string) ? string : null;
12
- };
9
+ /**
10
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
11
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
12
+ * router and elsewhere)
13
+ *
14
+ * @category location
15
+ *
16
+ * @param raw The _raw_ query parameter
17
+ * @param allowedValues The list of values (as strings) that the parameter can
18
+ * have, if not one of them `null` is returned
19
+ */let getParamAmong=(e,r=[])=>{let a=getParamAsString.getParamAsString(e);return r.includes(a)?a:null};
13
20
 
14
21
  exports["default"] = getParamAmong;
15
22
  exports.getParamAmong = getParamAmong;
@@ -2,9 +2,16 @@ import { getParamAsString } from './getParamAsString.esm.js';
2
2
  import './isArray.esm.js';
3
3
  import './getType.esm.js';
4
4
 
5
- let getParamAmong = (raw, allowedValues = []) => {
6
- const string = getParamAsString(raw);
7
- return allowedValues.includes(string) ? string : null;
8
- };
5
+ /**
6
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
7
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
8
+ * router and elsewhere)
9
+ *
10
+ * @category location
11
+ *
12
+ * @param raw The _raw_ query parameter
13
+ * @param allowedValues The list of values (as strings) that the parameter can
14
+ * have, if not one of them `null` is returned
15
+ */let getParamAmong=(e,r=[])=>{let a=getParamAsString(e);return r.includes(a)?a:null};
9
16
 
10
17
  export { getParamAmong as default, getParamAmong };
@@ -6,13 +6,16 @@ var getParamAsString = require('./getParamAsString.cjs.js');
6
6
  require('./isArray.cjs.js');
7
7
  require('./getType.cjs.js');
8
8
 
9
- let getParamAsInt = (raw, fallback = null) => {
10
- const string = getParamAsString.getParamAsString(raw);
11
- if (string) {
12
- return parseInt(string, 10);
13
- }
14
- return fallback;
15
- };
9
+ /**
10
+ * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
11
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
12
+ * router and elsewhere)
13
+ *
14
+ * @category location
15
+ *
16
+ * @param raw The _raw_ query parameter
17
+ * @param fallback Fallback number, we return `null` if not provided
18
+ */let getParamAsInt=(r,e=null)=>{let a=getParamAsString.getParamAsString(r);return a?parseInt(a,10):e};
16
19
 
17
20
  exports["default"] = getParamAsInt;
18
21
  exports.getParamAsInt = getParamAsInt;
@@ -2,12 +2,15 @@ import { getParamAsString } from './getParamAsString.esm.js';
2
2
  import './isArray.esm.js';
3
3
  import './getType.esm.js';
4
4
 
5
- let getParamAsInt = (raw, fallback = null) => {
6
- const string = getParamAsString(raw);
7
- if (string) {
8
- return parseInt(string, 10);
9
- }
10
- return fallback;
11
- };
5
+ /**
6
+ * Get query parameter as `int`eger treating the `ParsedUrlQuery` result of
7
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
8
+ * router and elsewhere)
9
+ *
10
+ * @category location
11
+ *
12
+ * @param raw The _raw_ query parameter
13
+ * @param fallback Fallback number, we return `null` if not provided
14
+ */let getParamAsInt=(r,e=null)=>{let a=getParamAsString(r);return a?parseInt(a,10):e};
12
15
 
13
16
  export { getParamAsInt as default, getParamAsInt };
@@ -5,7 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var isArray = require('./isArray.cjs.js');
6
6
  require('./getType.cjs.js');
7
7
 
8
- let getParamAsString = (raw) => (isArray.isArray(raw) ? raw[0] : raw) || "";
8
+ /**
9
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
10
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
11
+ * router and elsewhere)
12
+ *
13
+ * @category location
14
+ *
15
+ * @param raw The _raw_ query parameter
16
+ */let getParamAsString=t=>(isArray.isArray(t)?t[0]:t)||"";
9
17
 
10
18
  exports["default"] = getParamAsString;
11
19
  exports.getParamAsString = getParamAsString;
@@ -1,6 +1,14 @@
1
1
  import { isArray } from './isArray.esm.js';
2
2
  import './getType.esm.js';
3
3
 
4
- let getParamAsString = (raw) => (isArray(raw) ? raw[0] : raw) || "";
4
+ /**
5
+ * Get query parameter as `string` treating the `ParsedUrlQuery` result of
6
+ * [`querystring`](https://nodejs.org/api/querystring.html) (used in next.js
7
+ * router and elsewhere)
8
+ *
9
+ * @category location
10
+ *
11
+ * @param raw The _raw_ query parameter
12
+ */let getParamAsString=t=>(isArray(t)?t[0]:t)||"";
5
13
 
6
14
  export { getParamAsString as default, getParamAsString };
package/getType.cjs.js CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
5
+ /**
6
+ * @file
7
+ *
8
+ * Same as [is-what](https://github.com/mesqueeb/is-what) plus:
9
+ *
10
+ * - `isFormData`
11
+ * - `isInt`
12
+ * - `isFloat`
13
+ *//**
14
+ * @deprecated Probably useless type
15
+ *//**
16
+ * Returns the object type of the given payload
17
+ */let getType=e=>Object.prototype.toString.call(e).slice(8,-1);
6
18
 
7
19
  exports["default"] = getType;
8
20
  exports.getType = getType;
package/getType.esm.js CHANGED
@@ -1,3 +1,15 @@
1
- let getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
1
+ /**
2
+ * @file
3
+ *
4
+ * Same as [is-what](https://github.com/mesqueeb/is-what) plus:
5
+ *
6
+ * - `isFormData`
7
+ * - `isInt`
8
+ * - `isFloat`
9
+ *//**
10
+ * @deprecated Probably useless type
11
+ *//**
12
+ * Returns the object type of the given payload
13
+ */let getType=e=>Object.prototype.toString.call(e).slice(8,-1);
2
14
 
3
15
  export { getType as default, getType };
@@ -2,14 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let getUrlHashParams = (hash = "") => {
6
- hash = hash || location.hash;
7
- const hashParts = hash.split("?");
8
- if (hashParts.length >= 1) {
9
- return Object.fromEntries(new URLSearchParams(hashParts[1]));
10
- }
11
- return {};
12
- };
5
+ /**
6
+ * It returns the "query params" as an object extracting it from the given `hash`
7
+ * string or, if not provided, failling back reading the `location.hash`
8
+ *
9
+ * @category location
10
+ */let getUrlHashParams=(e="")=>{let t=(e=e||location.hash).split("?");return t.length>=1?Object.fromEntries(new URLSearchParams(t[1])):{}};
13
11
 
14
12
  exports["default"] = getUrlHashParams;
15
13
  exports.getUrlHashParams = getUrlHashParams;
@@ -1,10 +1,8 @@
1
- let getUrlHashParams = (hash = "") => {
2
- hash = hash || location.hash;
3
- const hashParts = hash.split("?");
4
- if (hashParts.length >= 1) {
5
- return Object.fromEntries(new URLSearchParams(hashParts[1]));
6
- }
7
- return {};
8
- };
1
+ /**
2
+ * It returns the "query params" as an object extracting it from the given `hash`
3
+ * string or, if not provided, failling back reading the `location.hash`
4
+ *
5
+ * @category location
6
+ */let getUrlHashParams=(e="")=>{let t=(e=e||location.hash).split("?");return t.length>=1?Object.fromEntries(new URLSearchParams(t[1])):{}};
9
7
 
10
8
  export { getUrlHashParams as default, getUrlHashParams };
@@ -2,7 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- let getUrlHashPathname = (hash = "") => (hash || location.hash).split("?")[0].replace(/^#\//, "");
5
+ /**
6
+ * It returns the "pathname" cleaned up from the `#` and the initial slashes
7
+ * extracting it from the given `hash` string or, if not provided, failling
8
+ * back reading the `location.hash`
9
+ *
10
+ * @category location
11
+ */let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
6
12
 
7
13
  exports["default"] = getUrlHashPathname;
8
14
  exports.getUrlHashPathname = getUrlHashPathname;
@@ -1,3 +1,9 @@
1
- let getUrlHashPathname = (hash = "") => (hash || location.hash).split("?")[0].replace(/^#\//, "");
1
+ /**
2
+ * It returns the "pathname" cleaned up from the `#` and the initial slashes
3
+ * extracting it from the given `hash` string or, if not provided, failling
4
+ * back reading the `location.hash`
5
+ *
6
+ * @category location
7
+ */let getUrlHashPathname=(a="")=>(a||location.hash).split("?")[0].replace(/^#\//,"");
2
8
 
3
9
  export { getUrlHashPathname as default, getUrlHashPathname };
@@ -4,10 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var isBrowser = require('./isBrowser.cjs.js');
6
6
 
7
- let getUrlPathnameParts = (pathname = "") => (pathname || (isBrowser.isBrowser ? location.pathname : ""))
8
- .replace(/^\//, "")
9
- .split("/")
10
- .filter(Boolean);
7
+ /**
8
+ * Get pathname parts
9
+ *
10
+ * First clean the pathname from the first slash if any then split the pathname
11
+ * in parts,
12
+ * Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
13
+ * `[locale, prefix, collection, slug]`
14
+ *
15
+ * @category location
16
+ */let getUrlPathnameParts=(e="")=>(e||(isBrowser.isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
11
17
 
12
18
  exports["default"] = getUrlPathnameParts;
13
19
  exports.getUrlPathnameParts = getUrlPathnameParts;
@@ -1,8 +1,14 @@
1
1
  import { isBrowser } from './isBrowser.esm.js';
2
2
 
3
- let getUrlPathnameParts = (pathname = "") => (pathname || (isBrowser ? location.pathname : ""))
4
- .replace(/^\//, "")
5
- .split("/")
6
- .filter(Boolean);
3
+ /**
4
+ * Get pathname parts
5
+ *
6
+ * First clean the pathname from the first slash if any then split the pathname
7
+ * in parts,
8
+ * Given a pathname like: `"/en/{prefix}/{collection}/{slug}"` we obtain
9
+ * `[locale, prefix, collection, slug]`
10
+ *
11
+ * @category location
12
+ */let getUrlPathnameParts=(e="")=>(e||(isBrowser?location.pathname:"")).replace(/^\//,"").split("/").filter(Boolean);
7
13
 
8
14
  export { getUrlPathnameParts as default, getUrlPathnameParts };
@@ -4,26 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var isBrowser = require('./isBrowser.cjs.js');
6
6
 
7
- let getUrlQueryParams = (url) => {
8
- let params = {};
9
- const search = url
10
- ? url.split("?")?.[1]
11
- : isBrowser.isBrowser
12
- ? location.search.substring(1)
13
- : "";
14
- if (!search) {
15
- return {};
16
- }
17
- try {
18
- const paramsAsObj = `{"${search
19
- .replace(/&/g, '","')
20
- .replace(/=/g, '":"')}"}`;
21
- params = JSON.parse(paramsAsObj, (key, value) => key === "" ? value : decodeURIComponent(value));
22
- }
23
- catch (e) {
24
- }
25
- return params;
26
- };
7
+ /**
8
+ * Get parsed query parameters as object dictionary (from URL or given query string)
9
+ *
10
+ * @category location
11
+ * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
12
+ * If not provided it defaults reading the current URL query string with
13
+ * `location.search`. Through this argument you can use this same function to
14
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
15
+ *
16
+ */let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser.isBrowser?location.search.substring(1):"";if(!a)return {};try{// @see https://stackoverflow.com/a/8649003/1938970
17
+ let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}// do nothing or warn on process.env["NODE_ENV"] === "development"
18
+ return t};
27
19
 
28
20
  exports["default"] = getUrlQueryParams;
29
21
  exports.getUrlQueryParams = getUrlQueryParams;
@@ -1,24 +1,16 @@
1
1
  import { isBrowser } from './isBrowser.esm.js';
2
2
 
3
- let getUrlQueryParams = (url) => {
4
- let params = {};
5
- const search = url
6
- ? url.split("?")?.[1]
7
- : isBrowser
8
- ? location.search.substring(1)
9
- : "";
10
- if (!search) {
11
- return {};
12
- }
13
- try {
14
- const paramsAsObj = `{"${search
15
- .replace(/&/g, '","')
16
- .replace(/=/g, '":"')}"}`;
17
- params = JSON.parse(paramsAsObj, (key, value) => key === "" ? value : decodeURIComponent(value));
18
- }
19
- catch (e) {
20
- }
21
- return params;
22
- };
3
+ /**
4
+ * Get parsed query parameters as object dictionary (from URL or given query string)
5
+ *
6
+ * @category location
7
+ * @param url A URL which contains a `?`, e.g. `?myparam=x` or `https://a.com?myparams=x`.
8
+ * If not provided it defaults reading the current URL query string with
9
+ * `location.search`. Through this argument you can use this same function to
10
+ * parse, for instance, the query params of the `href` of a `<a href="...">` HTML tag.
11
+ *
12
+ */let getUrlQueryParams=r=>{let t={},a=r?r.split("?")?.[1]:isBrowser?location.search.substring(1):"";if(!a)return {};try{// @see https://stackoverflow.com/a/8649003/1938970
13
+ let e=`{"${a.replace(/&/g,'","').replace(/=/g,'":"')}"}`;t=JSON.parse(e,(e,r)=>""===e?r:decodeURIComponent(r));}catch(e){}// do nothing or warn on process.env["NODE_ENV"] === "development"
14
+ return t};
23
15
 
24
16
  export { getUrlQueryParams as default, getUrlQueryParams };
@@ -0,0 +1,2 @@
1
+ export * from "./hashAny";
2
+ export { default } from "./hashAny";
@@ -0,0 +1 @@
1
+ exports._default = require('./hashAny.cjs.js').default;