modern-text 0.1.25 → 0.2.1
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/README.md +7 -5
- package/dist/index.cjs +1052 -1
- package/dist/index.d.cts +290 -0
- package/dist/index.d.mts +290 -0
- package/dist/index.d.ts +290 -0
- package/dist/index.js +4 -1
- package/dist/index.mjs +972 -571
- package/package.json +40 -25
- package/types/bounding-box.d.ts +0 -16
- package/types/canvas-measure-text.d.ts +0 -18
- package/types/character.d.ts +0 -18
- package/types/dom-measure-text.d.ts +0 -4
- package/types/fragment.d.ts +0 -21
- package/types/index.d.ts +0 -4
- package/types/measure-text.d.ts +0 -19
- package/types/paragraph.d.ts +0 -18
- package/types/parse-color.d.ts +0 -2
- package/types/parse-paragraphs.d.ts +0 -3
- package/types/render-text.d.ts +0 -6
- package/types/set-context-style.d.ts +0 -2
- package/types/types.d.ts +0 -49
- package/types/utils.d.ts +0 -1
- package/types/wrap-paragraphs.d.ts +0 -2
package/README.md
CHANGED
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import {
|
|
24
|
+
import { Text } from 'modern-text'
|
|
25
25
|
|
|
26
|
-
const text = {
|
|
26
|
+
const text = new Text({
|
|
27
27
|
style: {
|
|
28
28
|
width: 100,
|
|
29
29
|
height: 200,
|
|
@@ -58,9 +58,11 @@ const text = {
|
|
|
58
58
|
{ content: ', ', color: 'grey' },
|
|
59
59
|
{ content: 'World!', color: 'black' },
|
|
60
60
|
],
|
|
61
|
-
}
|
|
61
|
+
})
|
|
62
62
|
|
|
63
|
-
document.
|
|
63
|
+
const view = document.createElement('canvas')
|
|
64
|
+
text.render({ view })
|
|
65
|
+
document.body.append(view) // canvas 2d
|
|
64
66
|
|
|
65
|
-
console.log(
|
|
67
|
+
console.log(text.measure()) // boundingBox with computed paragraphs
|
|
66
68
|
```
|