@altano/satori-fit-text 0.1.3 → 0.1.4

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.
@@ -1,4 +1,4 @@
1
- import { TextMeasurer, type Dimensions } from "./TextMeasurer";
1
+ import { TextMeasurer, type Dimensions } from "./TextMeasurer.js";
2
2
  export default class BrowserTextMeasurer extends TextMeasurer {
3
3
  #private;
4
4
  getDimensions(fontSize: number): Promise<Dimensions>;
@@ -1,6 +1,6 @@
1
- import log from "../log";
2
- import { TextMeasurer } from "./TextMeasurer";
3
- import getWidthAdjustedForInlineBleed from "./getWidthAdjustedForInlineBleed";
1
+ import log from "../log.js";
2
+ import { TextMeasurer } from "./TextMeasurer.js";
3
+ import getWidthAdjustedForInlineBleed from "./getWidthAdjustedForInlineBleed.js";
4
4
  class BrowserTextMeasurer extends TextMeasurer {
5
5
  #getSvgElement(svgText) {
6
6
  const div = document.createElement("div");
@@ -1,5 +1,5 @@
1
- import type { Font } from "../types";
2
- import { TextMeasurer, type Dimensions } from "./TextMeasurer";
1
+ import type { Font } from "../types.js";
2
+ import { TextMeasurer, type Dimensions } from "./TextMeasurer.js";
3
3
  export default class HeadlessTextMeasurer extends TextMeasurer {
4
4
  #private;
5
5
  constructor(text: string, font: Font, maxWidth: number, maxHeight: number, lineHeight: number | "normal");
@@ -1,8 +1,8 @@
1
1
  import { SVG, registerWindow } from "@svgdotjs/svg.js";
2
2
  import { createSVGWindow } from "svgdom";
3
- import log from "../log";
4
- import { TextMeasurer } from "./TextMeasurer";
5
- import getWidthAdjustedForInlineBleed from "./getWidthAdjustedForInlineBleed";
3
+ import log from "../log.js";
4
+ import { TextMeasurer } from "./TextMeasurer.js";
5
+ import getWidthAdjustedForInlineBleed from "./getWidthAdjustedForInlineBleed.js";
6
6
  class HeadlessTextMeasurer extends TextMeasurer {
7
7
  #canvas;
8
8
  constructor(text, font, maxWidth, maxHeight, lineHeight) {
@@ -1,4 +1,4 @@
1
- import type { Font } from "../types";
1
+ import type { Font } from "../types.js";
2
2
  export type Dimensions = Pick<DOMRect, "width" | "height">;
3
3
  export declare abstract class TextMeasurer {
4
4
  #private;
@@ -1,3 +1,3 @@
1
- import type { TextMeasurer } from "./TextMeasurer";
1
+ import type { TextMeasurer } from "./TextMeasurer.js";
2
2
  export declare function getTextMeasurer(...args: ConstructorParameters<typeof TextMeasurer>): Promise<TextMeasurer>;
3
3
  //# sourceMappingURL=getTextMeasurer.d.ts.map
@@ -1,9 +1,9 @@
1
1
  async function getTextMeasurer(...args) {
2
2
  if (typeof window !== "undefined") {
3
- const Measurer = await import("./BrowserTextMeasurer");
3
+ const Measurer = await import("./BrowserTextMeasurer.js");
4
4
  return new Measurer.default(...args);
5
5
  } else {
6
- const Measurer = await import("./HeadlessTextMeasurer");
6
+ const Measurer = await import("./HeadlessTextMeasurer.js");
7
7
  return new Measurer.default(...args);
8
8
  }
9
9
  }
package/dist/fitText.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Font } from "./types";
1
+ import type { Font } from "./types.js";
2
2
  export type FindOptions = {
3
3
  /**
4
4
  * The text you want to fit
package/dist/fitText.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getTextMeasurer } from "./TextMeasurer/getTextMeasurer";
1
+ import { getTextMeasurer } from "./TextMeasurer/getTextMeasurer.js";
2
2
  async function findLargestUsableFontSize({
3
3
  text,
4
4
  font,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./fitText";
2
- export * from "./types";
1
+ export * from "./fitText.js";
2
+ export * from "./types.js";
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./fitText";
2
- export * from "./types";
1
+ export * from "./fitText.js";
2
+ export * from "./types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altano/satori-fit-text",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Fit text to a bounding box in Node or the browser",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -59,10 +59,10 @@
59
59
  "react": "^18.2.0",
60
60
  "react-dom": "^18.2.0",
61
61
  "typescript": "^5.4.2",
62
- "vite": "^5.2.4",
62
+ "vite": "^5.2.8",
63
63
  "vitest": "^1.4.0",
64
64
  "@altano/assets": "0.0.0",
65
- "@altano/tiny-async-pool": "3.0.0",
65
+ "@altano/tiny-async-pool": "3.0.1",
66
66
  "@altano/tsconfig": "0.0.0"
67
67
  },
68
68
  "scripts": {
@@ -81,7 +81,7 @@
81
81
  "test:unit": "run-s test:unit:run test:unit:benchmark",
82
82
  "test:unit:benchmark": "vitest --run bench",
83
83
  "test:unit:run": "vitest --run",
84
- "test:unit:watch": "vitest tests/unit/",
84
+ "test:unit:watch": "vitest",
85
85
  "typecheck:src": "tsc --noEmit",
86
86
  "typecheck:test": "tsc --noEmit --project ./tests/tsconfig.json"
87
87
  }