@altano/textfit 1.0.2 → 1.0.3
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 +2 -5
- package/dist/index.js +5 -4
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* textFit v2.3.1
|
|
4
3
|
* Previously known as jQuery.textFit
|
|
@@ -12,7 +11,7 @@
|
|
|
12
11
|
* Uses binary search to fit text with minimal layout calls.
|
|
13
12
|
* Version 2.0 does not use jQuery.
|
|
14
13
|
*/
|
|
15
|
-
interface Options {
|
|
14
|
+
export interface Options {
|
|
16
15
|
/**
|
|
17
16
|
* if true, textFit will not set white-space: no-wrap
|
|
18
17
|
*/
|
|
@@ -42,7 +41,5 @@ interface Options {
|
|
|
42
41
|
*/
|
|
43
42
|
sizeMultipleOf?: number;
|
|
44
43
|
}
|
|
45
|
-
declare function textFit(elements: HTMLElement | HTMLElement[], options?: Options): void;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { Options, textFit };
|
|
44
|
+
export declare function textFit(elements: HTMLElement | HTMLElement[], options?: Options): void;
|
|
48
45
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/index.ts
|
|
2
2
|
const defaultSettings = {
|
|
3
3
|
multiLine: false,
|
|
4
4
|
detectMultiLine: true,
|
|
@@ -28,8 +28,10 @@ function processItem(el, settings) {
|
|
|
28
28
|
const originalHTML = el.innerHTML;
|
|
29
29
|
const originalWidth = innerWidth(el);
|
|
30
30
|
const originalHeight = innerHeight(el);
|
|
31
|
-
if (!originalWidth || !settings.widthOnly && !originalHeight)
|
|
32
|
-
|
|
31
|
+
if (!originalWidth || !settings.widthOnly && !originalHeight) {
|
|
32
|
+
if (!settings.widthOnly) throw new Error("Set a static height and width on the target element " + el.outerHTML + " before using textFit!");
|
|
33
|
+
else throw new Error("Set a static width on the target element " + el.outerHTML + " before using textFit!");
|
|
34
|
+
}
|
|
33
35
|
if (originalHTML.indexOf("textFitted") === -1) {
|
|
34
36
|
innerSpan = document.createElement("span");
|
|
35
37
|
innerSpan.className = "textFitted";
|
|
@@ -81,6 +83,5 @@ function hasClass(element, cls) {
|
|
|
81
83
|
return (" " + element.className + " ").indexOf(" " + cls + " ") > -1;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
//#endregion
|
|
85
86
|
export { textFit };
|
|
86
87
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/textfit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A fast, jQuery-free text sizing component that quickly fits single and multi-line text to the width (and optionally height) of its container.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fit",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
35
35
|
"@playwright/test": "1.59.1",
|
|
36
|
-
"@types/node": "^26.
|
|
36
|
+
"@types/node": "^26.6.6",
|
|
37
37
|
"depcheck": "^1.4.7",
|
|
38
|
-
"tsdown": "^0.
|
|
38
|
+
"tsdown": "^0.23.5",
|
|
39
39
|
"typescript": "^6.0.3",
|
|
40
|
-
"vite": "^8.
|
|
41
|
-
"vitest": "^
|
|
40
|
+
"vite": "^8.3.5",
|
|
41
|
+
"vitest": "^5.1.0",
|
|
42
42
|
"@altano/build-config": "0.0.1",
|
|
43
|
-
"@altano/
|
|
44
|
-
"@altano/
|
|
43
|
+
"@altano/tsconfig": "0.0.1",
|
|
44
|
+
"@altano/testing": "0.0.1"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|