@altano/textfit 1.0.0 → 1.0.2

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2014 Samuel Reed <samuel.trace.reed@gmail.com> (http://strml.net/)
4
- Copyright (c) 2022 Alan Norbauer <altano@gmail.com> (https://alan.norbauer.com/)
4
+ Copyright (c) 2022 Alan Norbauer <alan@norbauer.com> (https://alan.norbauer.com/)
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.d.ts CHANGED
@@ -1,47 +1,48 @@
1
1
  //#region src/index.d.ts
2
2
  /**
3
- * textFit v2.3.1
4
- * Previously known as jQuery.textFit
5
- * 11/2014 by STRML (strml.github.com)
6
- * MIT License
7
- *
8
- * To use: textFit(document.getElementById('target-div'), options);
9
- *
10
- * Will make the *text* content inside a container scale to fit the container
11
- * The container is required to have a set width and height
12
- * Uses binary search to fit text with minimal layout calls.
13
- * Version 2.0 does not use jQuery.
14
- */
3
+ * textFit v2.3.1
4
+ * Previously known as jQuery.textFit
5
+ * 11/2014 by STRML (strml.github.com)
6
+ * MIT License
7
+ *
8
+ * To use: textFit(document.getElementById('target-div'), options);
9
+ *
10
+ * Will make the *text* content inside a container scale to fit the container
11
+ * The container is required to have a set width and height
12
+ * Uses binary search to fit text with minimal layout calls.
13
+ * Version 2.0 does not use jQuery.
14
+ */
15
15
  interface Options {
16
16
  /**
17
- * if true, textFit will not set white-space: no-wrap
18
- */
17
+ * if true, textFit will not set white-space: no-wrap
18
+ */
19
19
  multiLine?: boolean;
20
20
  /**
21
- * disable to turn off automatic multi-line sensing
22
- */
21
+ * disable to turn off automatic multi-line sensing
22
+ */
23
23
  detectMultiLine?: boolean;
24
24
  minFontSize?: number;
25
25
  maxFontSize?: number;
26
26
  /**
27
- * if true, textFit will re-process already-fit nodes. Set to 'false' for
28
- * better performance
29
- */
27
+ * if true, textFit will re-process already-fit nodes. Set to 'false' for
28
+ * better performance
29
+ */
30
30
  reProcess?: boolean;
31
31
  /**
32
- * if true, textFit will fit text to element width, regardless of text height
33
- */
32
+ * if true, textFit will fit text to element width, regardless of text height
33
+ */
34
34
  widthOnly?: boolean;
35
35
  /**
36
- * if true, textFit will use flexbox for vertical alignment
37
- */
36
+ * if true, textFit will use flexbox for vertical alignment
37
+ */
38
38
  alignVertWithFlexbox?: boolean;
39
39
  /**
40
- * Sets the final size to the max multiple of this. Useful when a font
41
- * requires the font size to be a multiple of a number for optimal rendering.
42
- */
40
+ * Sets the final size to the max multiple of this. Useful when a font
41
+ * requires the font size to be a multiple of a number for optimal rendering.
42
+ */
43
43
  sizeMultipleOf?: number;
44
44
  }
45
- declare function textFit(elements: HTMLElement | HTMLElement[], options?: Options): void; //#endregion
45
+ declare function textFit(elements: HTMLElement | HTMLElement[], options?: Options): void;
46
+ //#endregion
46
47
  export { Options, textFit };
47
48
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -11,8 +11,7 @@ const defaultSettings = {
11
11
  };
12
12
  function textFit(elements, options = {}) {
13
13
  const settings = Object.assign({}, defaultSettings, options);
14
- const els = Array.isArray(elements) ? elements : [elements];
15
- els.forEach((el) => {
14
+ (Array.isArray(elements) ? elements : [elements]).forEach((el) => {
16
15
  processItem(el, settings);
17
16
  });
18
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altano/textfit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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",
@@ -14,9 +14,13 @@
14
14
  "directory": "packages/textfit"
15
15
  },
16
16
  "license": "MIT",
17
- "author": "Alan Norbauer <altano@gmail.com> (https://alan.norbauer.com/)",
17
+ "author": "Alan Norbauer <alan@norbauer.com> (https://alan.norbauer.com/)",
18
18
  "contributors": [
19
- "Samuel Reed <samuel.trace.reed@gmail.com> (http://strml.net/)"
19
+ {
20
+ "name": "Samuel Reed",
21
+ "email": "samuel.trace.reed@gmail.com",
22
+ "url": "http://strml.net"
23
+ }
20
24
  ],
21
25
  "sideEffects": false,
22
26
  "type": "module",
@@ -27,33 +31,34 @@
27
31
  "dist/**/*.d.ts"
28
32
  ],
29
33
  "devDependencies": {
30
- "@arethetypeswrong/cli": "^0.17.4",
31
- "@playwright/test": "1.51.1",
32
- "@types/node": "^22.13.10",
34
+ "@arethetypeswrong/cli": "^0.18.5",
35
+ "@playwright/test": "1.59.1",
36
+ "@types/node": "^26.1.1",
33
37
  "depcheck": "^1.4.7",
34
- "tsdown": "^0.12.3",
35
- "typescript": "^5.8.2",
36
- "vite": "^6.2.6",
37
- "vitest": "^3.1.4",
38
+ "tsdown": "^0.22.13",
39
+ "typescript": "^6.0.3",
40
+ "vite": "^8.1.5",
41
+ "vitest": "^4.1.10",
38
42
  "@altano/build-config": "0.0.1",
43
+ "@altano/testing": "0.0.1",
39
44
  "@altano/tsconfig": "0.0.1"
40
45
  },
41
46
  "publishConfig": {
42
47
  "access": "public"
43
48
  },
44
49
  "scripts": {
45
- "build": "tsdown --config ../build-config/tsdown.config.browser.ts",
50
+ "build": "tsdown",
46
51
  "check:exports": "attw --pack . --profile esm-only --quiet",
47
52
  "check:types:src": "tsc --noEmit",
48
53
  "check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
49
54
  "check:unused-dependencies": "depcheck",
50
55
  "dev": "pnpm run build --watch",
51
- "format": "prettier --check src",
52
- "format:fix": "prettier --write src",
56
+ "format": "prettier --check .",
57
+ "format:fix": "prettier --write .",
53
58
  "lint": "eslint",
54
59
  "lint:fix": "TIMING=1 pnpm lint --fix",
55
60
  "lint:timing": "TIMING=1 pnpm lint",
56
- "test:e2e": "playwright test",
61
+ "test:e2e": "NODE_OPTIONS='--no-experimental-strip-types' playwright test",
57
62
  "test:e2e:server": "vite --strictPort --port 8173 ./tests/e2e",
58
63
  "test:e2e:ui": "playwright test --ui"
59
64
  }