@codebit-programando-solucoes/codebit-web 1.1.18 → 1.1.19
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.cjs +24 -0
- package/dist/util/Layout.d.ts +13 -0
- package/dist/util/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
fetchImageAsBlob: ()=>fetchImageAsBlob,
|
|
28
|
+
getScrollbarWidth: ()=>getScrollbarWidth,
|
|
28
29
|
loadImage: ()=>loadImage,
|
|
29
30
|
markdownItBrEmptyLines: ()=>markdownItBrEmptyLines,
|
|
30
31
|
ErrorCode: ()=>ErrorCode,
|
|
@@ -407,6 +408,27 @@ const markdownItBrEmptyLines = (md)=>{
|
|
|
407
408
|
}
|
|
408
409
|
});
|
|
409
410
|
};
|
|
411
|
+
function getScrollbarWidth(scrollbarWidth = 'auto') {
|
|
412
|
+
const outer = document.createElement('div');
|
|
413
|
+
outer.style.visibility = 'hidden';
|
|
414
|
+
outer.style.position = 'absolute';
|
|
415
|
+
outer.style.top = '-9999px';
|
|
416
|
+
outer.style.width = '100px';
|
|
417
|
+
outer.style.height = '100px';
|
|
418
|
+
outer.style.overflow = 'scroll';
|
|
419
|
+
outer.style.scrollbarWidth = 'thin';
|
|
420
|
+
const inner = document.createElement('div');
|
|
421
|
+
inner.style.width = '100%';
|
|
422
|
+
inner.style.height = '100%';
|
|
423
|
+
outer.appendChild(inner);
|
|
424
|
+
document.body.appendChild(outer);
|
|
425
|
+
const width = outer.offsetWidth - inner.offsetWidth;
|
|
426
|
+
outer.remove();
|
|
427
|
+
if (width > 0) return width;
|
|
428
|
+
if ('thin' === scrollbarWidth) return 8;
|
|
429
|
+
if ('none' === scrollbarWidth) return 0;
|
|
430
|
+
return 16;
|
|
431
|
+
}
|
|
410
432
|
exports.Api = __webpack_exports__.Api;
|
|
411
433
|
exports.ApiError = __webpack_exports__.ApiError;
|
|
412
434
|
exports.ApiNetworkError = __webpack_exports__.ApiNetworkError;
|
|
@@ -415,6 +437,7 @@ exports.Logger = __webpack_exports__.Logger;
|
|
|
415
437
|
exports.copyToClipboard = __webpack_exports__.copyToClipboard;
|
|
416
438
|
exports.createAdvancedPartialRegex = __webpack_exports__.createAdvancedPartialRegex;
|
|
417
439
|
exports.fetchImageAsBlob = __webpack_exports__.fetchImageAsBlob;
|
|
440
|
+
exports.getScrollbarWidth = __webpack_exports__.getScrollbarWidth;
|
|
418
441
|
exports.loadImage = __webpack_exports__.loadImage;
|
|
419
442
|
exports.markdownItBrEmptyLines = __webpack_exports__.markdownItBrEmptyLines;
|
|
420
443
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -426,6 +449,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
426
449
|
"copyToClipboard",
|
|
427
450
|
"createAdvancedPartialRegex",
|
|
428
451
|
"fetchImageAsBlob",
|
|
452
|
+
"getScrollbarWidth",
|
|
429
453
|
"loadImage",
|
|
430
454
|
"markdownItBrEmptyLines"
|
|
431
455
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the width of the browser's vertical scrollbar.
|
|
3
|
+
*
|
|
4
|
+
* The function creates temporary DOM elements, forces a scrollable container, and measures the difference between the outer container's width and the inner element's width. If the
|
|
5
|
+
* measurement fails (e.g., overlay scrollbars), a fallback value is returned based on the `scrollbarWidth` argument.
|
|
6
|
+
*
|
|
7
|
+
* @param {'auto' | 'none' | 'thin'} [scrollbarWidth='auto'] Desired fallback width when the actual scrollbar size cannot be measured. `'none'` returns **0px**, `'thin'` returns
|
|
8
|
+
* **8px**, and any other value (including `'auto'`) returns **16px**. Default is `'auto'`
|
|
9
|
+
* @returns {number} The width of the vertical scrollbar in pixels, or the fallback value when the measurement is not possible.
|
|
10
|
+
*/
|
|
11
|
+
export function getScrollbarWidth(
|
|
12
|
+
scrollbarWidth?: 'auto' | 'none' | 'thin',
|
|
13
|
+
): number;
|
package/dist/util/index.d.ts
CHANGED