tegaki 0.11.1 → 0.13.0

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +4 -4
  3. package/dist/core/index.d.mts +2 -2
  4. package/dist/core/index.mjs +2 -2
  5. package/dist/{core-I9K3LqxK.mjs → core-Ds9ohwR7.mjs} +311 -167
  6. package/dist/core-Ds9ohwR7.mjs.map +1 -0
  7. package/dist/fonts/caveat/bundle.d.mts +5 -2
  8. package/dist/fonts/caveat/bundle.mjs +7 -3
  9. package/dist/fonts/caveat/bundle.mjs.map +1 -1
  10. package/dist/fonts/caveat/caveat-3dc76002.ttf +0 -0
  11. package/dist/fonts/italianno/bundle.d.mts +5 -2
  12. package/dist/fonts/italianno/bundle.mjs +7 -3
  13. package/dist/fonts/italianno/bundle.mjs.map +1 -1
  14. package/dist/fonts/italianno/italianno-3dc76002.ttf +0 -0
  15. package/dist/fonts/parisienne/bundle.d.mts +5 -2
  16. package/dist/fonts/parisienne/bundle.mjs +7 -3
  17. package/dist/fonts/parisienne/bundle.mjs.map +1 -1
  18. package/dist/fonts/parisienne/parisienne-3dc76002.ttf +0 -0
  19. package/dist/fonts/tangerine/bundle.d.mts +5 -2
  20. package/dist/fonts/tangerine/bundle.mjs +7 -3
  21. package/dist/fonts/tangerine/bundle.mjs.map +1 -1
  22. package/dist/fonts/tangerine/tangerine-3dc76002.ttf +0 -0
  23. package/dist/{index-vDbG4xkP.d.mts → index-BwhATGJw.d.mts} +2 -2
  24. package/dist/{index-CZFVynOK.d.mts → index-e-RN9Gi3.d.mts} +122 -7
  25. package/dist/index.d.mts +3 -3
  26. package/dist/index.mjs +3 -3
  27. package/dist/react/index.d.mts +3 -3
  28. package/dist/react/index.mjs +3 -3
  29. package/dist/{react-DGPG66n-.mjs → react-D3lP9bU2.mjs} +5 -4
  30. package/dist/react-D3lP9bU2.mjs.map +1 -0
  31. package/dist/solid/index.d.mts +2 -2
  32. package/dist/solid/index.mjs +6 -4
  33. package/dist/solid/index.mjs.map +1 -1
  34. package/dist/wc/index.d.mts +12 -3
  35. package/dist/wc/index.mjs +38 -7
  36. package/dist/wc/index.mjs.map +1 -1
  37. package/fonts/caveat/bundle.ts +7 -3
  38. package/fonts/caveat/caveat-3dc76002.ttf +0 -0
  39. package/fonts/italianno/bundle.ts +7 -3
  40. package/fonts/italianno/italianno-3dc76002.ttf +0 -0
  41. package/fonts/parisienne/bundle.ts +7 -3
  42. package/fonts/parisienne/parisienne-3dc76002.ttf +0 -0
  43. package/fonts/tangerine/bundle.ts +7 -3
  44. package/fonts/tangerine/tangerine-3dc76002.ttf +0 -0
  45. package/package.json +1 -1
  46. package/src/astro/TegakiRenderer.astro +2 -2
  47. package/src/core/bundle-registry.ts +16 -1
  48. package/src/core/createBundle.ts +13 -2
  49. package/src/core/engine.ts +138 -22
  50. package/src/core/index.ts +2 -1
  51. package/src/core/render-elements.ts +10 -4
  52. package/src/core/types.ts +45 -1
  53. package/src/lib/drawGlyph.ts +141 -166
  54. package/src/lib/strokeCache.ts +77 -0
  55. package/src/lib/textLayout.ts +6 -4
  56. package/src/lib/timeline.ts +19 -5
  57. package/src/lib/utils.ts +18 -3
  58. package/src/react/TegakiRenderer.tsx +4 -2
  59. package/src/solid/TegakiRenderer.tsx +4 -2
  60. package/src/svelte/TegakiRenderer.svelte +4 -3
  61. package/src/types.ts +24 -0
  62. package/src/vue/TegakiRenderer.vue +5 -3
  63. package/src/wc/TegakiElement.ts +34 -2
  64. package/dist/core-I9K3LqxK.mjs.map +0 -1
  65. package/dist/react-DGPG66n-.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # tegaki
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8fd875a: Add `clipText` quality option that clips handwriting strokes to the filled text shape using canvas composite operations. Accepts `true` for clipping with normal stroke widths, or a number to scale stroke widths (e.g. `2` for 2x wider strokes that fill more of the glyph interior).
8
+
9
+ ### Patch Changes
10
+
11
+ - 2a46c09: fix compatibility with old Safari versions, and a bug with text layout when text is wrapped. Fixes [#29](https://github.com/KurtGokhan/tegaki/issues/29)
12
+ - cdb2993: Fix timing around whitespace characters. Spaces and line breaks no longer consume `unknownDuration` on top of `wordGap`/`lineGap` — the gap alone now represents the full pause. `\r\n` and `\r` are normalized to `\n`, and all Unicode whitespace (NBSP, tab, ideographic space, etc.) is treated as a word gap.
13
+
14
+ Fixes [#28](https://github.com/KurtGokhan/tegaki/issues/28)
15
+
16
+ ## 0.12.0
17
+
18
+ ### Minor Changes
19
+
20
+ - be16624: Add bundle format versioning. Generated bundles now include a `version` field (currently `0`) so the engine can detect incompatible bundles. The engine checks the version when a bundle is registered or resolved and logs a console warning (once per bundle) if the version is missing or unsupported.
21
+
22
+ New exports: `BUNDLE_VERSION`, `COMPATIBLE_BUNDLE_VERSIONS`. New optional `TegakiBundle` field: `version`. Existing bundles without a version field trigger the warning but continue to work.
23
+
24
+ - 9776ca3: Cache stroke subdivision across glyph instances. Subdivision now depends
25
+ only on (stroke points, fontSize, segmentSize) and is reused by every
26
+ occurrence of the same glyph in the rendered text. Wobble, progress
27
+ truncation, pressure, taper, and gradient are applied at draw time on
28
+ top of the shared geometry, and effect config changes no longer
29
+ invalidate the cache. Glow draws the full truncated polyline in a single
30
+ stroke() call, removing the previous per-sub-segment shadowBlur cost.
31
+
32
+ Wobble is now sampled per sub-vertex (fractional original-point index
33
+ keeps phase continuous), giving smoother curves than the previous
34
+ lerp-between-wobbled-raw-vertices.
35
+
36
+ - 1ce1324: Add subset font bundling with full-font fallback. Bundles generated from a character subset now ship two font files: a subsetted TTF for the generated glyphs and the full TTF as a CSS fallback. The subset font is registered under a scoped family name (`<family> Tegaki <hash>`) to avoid colliding with user-loaded fonts, while the full font uses the original family name. The renderer composes both in `font-family` so the browser automatically falls back to the full font for non-generated characters.
37
+
38
+ New `TegakiBundle` fields: `fullFamily`, `fullFontUrl`. Existing bundles without these fields continue to work unchanged.
39
+
40
+ ### Patch Changes
41
+
42
+ - 73a6b7e: Introduces TegakiQuality ({ pixelRatio, segmentSize }) on the engine
43
+ options, replacing the top-level segmentSize. pixelRatio multiplies
44
+ devicePixelRatio when sizing the canvas backing store and root
45
+ transform, letting the browser downsample to the displayed size for
46
+ higher-quality antialiasing at a quadratic cost in pixels filled.
47
+ segmentSize retains its prior meaning under the new namespace.
48
+ - d9b7c85: feat: add stroke and glyph easing functions
49
+ - 7aaf5d2: add rtl direction support
50
+ - 23757ca: Breaking: `quality.segmentSize` is now measured in CSS pixels instead of
51
+ font units. Subdivision count now scales with rendered size, so small
52
+ glyphs are no longer over-subdivided. A 100px stroke with segmentSize=1
53
+ yields ~100 sub-segments; the same stroke at 10px yields ~10.
54
+
3
55
  ## 0.11.1
4
56
 
5
57
  ### Patch Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Handwriting animation for any font**
4
4
 
5
- Tegaki (手書き) turns any Google Font into animated handwriting.
5
+ Tegaki (手書き) turns any font into animated handwriting.
6
6
  No manual path authoring. No native dependencies. Just pick a font.
7
7
 
8
8
  [![npm](https://img.shields.io/npm/v/tegaki)](https://www.npmjs.com/package/tegaki)
@@ -72,7 +72,7 @@ Four handwriting fonts are bundled and ready to use:
72
72
  - **Tangerine** — `tegaki/fonts/tangerine`
73
73
  - **Parisienne** — `tegaki/fonts/parisienne`
74
74
 
75
- For other Google Fonts, use the [interactive generator](https://gkurt.com/tegaki/generator/) to create a custom bundle.
75
+ For other fonts, use the [interactive generator](https://gkurt.com/tegaki/generator/) to create a custom bundle.
76
76
 
77
77
  ## Documentation
78
78
 
@@ -80,8 +80,8 @@ Visit **[gkurt.com/tegaki](https://gkurt.com/tegaki)** for full documentation:
80
80
 
81
81
  - [Getting Started](https://gkurt.com/tegaki/getting-started/)
82
82
  - [Framework Guides](https://gkurt.com/tegaki/frameworks/react/) (React, Svelte, Vue, SolidJS, Astro, Web Components, Vanilla)
83
- - [Generating Fonts](https://gkurt.com/tegaki/guides/generating-fonts/)
84
- - [API Reference](https://gkurt.com/tegaki/api/tegaki-renderer/)
83
+ - [Generating Fonts](https://gkurt.com/tegaki/guides/generating/)
84
+ - [API Reference](https://gkurt.com/tegaki/api/renderer/)
85
85
 
86
86
  ## License
87
87
 
@@ -1,2 +1,2 @@
1
- import { A as Stroke, C as BBox, D as LineCap, E as GlyphData, F as TegakiGlyphData, I as TegakiMultiEffectName, L as TegakiSingletonEffectName, M as TegakiEffectConfigs, N as TegakiEffectName, O as PathCommand, P as TegakiEffects, R as TimedPoint, S as resolveEffects, T as FontOutput, _ as TextLayout, a as CreateElementFn, b as drawGlyph, c as TimeControlProp, d as registerBundle, f as resolveBundle, g as computeTimeline, h as TimelineEntry, i as TegakiEngine, j as TegakiBundle, k as Point, l as createBundle, m as TimelineConfig, n as buildRootProps, o as TegakiEngineOptions, p as Timeline, r as domCreateElement, s as TimeControlMode, t as buildChildren, u as getBundle, v as computeTextLayout, w as CSSLength, x as ResolvedEffect, y as ensureFontFace } from "../index-CZFVynOK.mjs";
2
- export { BBox, CSSLength, CreateElementFn, FontOutput, GlyphData, LineCap, PathCommand, Point, ResolvedEffect, Stroke, TegakiBundle, TegakiEffectConfigs, TegakiEffectName, TegakiEffects, TegakiEngine, TegakiEngineOptions, TegakiGlyphData, TegakiMultiEffectName, TegakiSingletonEffectName, TextLayout, TimeControlMode, TimeControlProp, TimedPoint, Timeline, TimelineConfig, TimelineEntry, buildChildren, buildRootProps, computeTextLayout, computeTimeline, createBundle, domCreateElement, drawGlyph, ensureFontFace, getBundle, registerBundle, resolveBundle, resolveEffects };
1
+ import { A as LineCap, B as TegakiSingletonEffectName, C as resolveEffects, D as CSSLength, E as COMPATIBLE_BUNDLE_VERSIONS, F as TegakiEffectConfigs, I as TegakiEffectName, L as TegakiEffects, M as Point, N as Stroke, O as FontOutput, P as TegakiBundle, R as TegakiGlyphData, S as ResolvedEffect, T as BUNDLE_VERSION, V as TimedPoint, _ as computeTimeline, a as CreateElementFn, b as ensureFontFace, c as TimeControlMode, d as getBundle, f as registerBundle, g as TimelineEntry, h as TimelineConfig, i as TegakiEngine, j as PathCommand, k as GlyphData, l as TimeControlProp, m as Timeline, n as buildRootProps, o as TegakiEngineOptions, p as resolveBundle, r as domCreateElement, s as TegakiQuality, t as buildChildren, u as createBundle, v as TextLayout, w as BBox, x as drawGlyph, y as computeTextLayout, z as TegakiMultiEffectName } from "../index-e-RN9Gi3.mjs";
2
+ export { BBox, BUNDLE_VERSION, COMPATIBLE_BUNDLE_VERSIONS, CSSLength, CreateElementFn, FontOutput, GlyphData, LineCap, PathCommand, Point, ResolvedEffect, Stroke, TegakiBundle, TegakiEffectConfigs, TegakiEffectName, TegakiEffects, TegakiEngine, TegakiEngineOptions, TegakiGlyphData, TegakiMultiEffectName, TegakiQuality, TegakiSingletonEffectName, TextLayout, TimeControlMode, TimeControlProp, TimedPoint, Timeline, TimelineConfig, TimelineEntry, buildChildren, buildRootProps, computeTextLayout, computeTimeline, createBundle, domCreateElement, drawGlyph, ensureFontFace, getBundle, registerBundle, resolveBundle, resolveEffects };
@@ -1,2 +1,2 @@
1
- import { a as createBundle, c as resolveBundle, d as ensureFontFace, f as drawGlyph, i as domCreateElement, l as computeTimeline, m as resolveEffects, n as buildChildren, o as getBundle, r as buildRootProps, s as registerBundle, t as TegakiEngine, u as computeTextLayout } from "../core-I9K3LqxK.mjs";
2
- export { TegakiEngine, buildChildren, buildRootProps, computeTextLayout, computeTimeline, createBundle, domCreateElement, drawGlyph, ensureFontFace, getBundle, registerBundle, resolveBundle, resolveEffects };
1
+ import { a as createBundle, c as resolveBundle, d as computeTimeline, f as computeTextLayout, g as resolveEffects, i as domCreateElement, l as BUNDLE_VERSION, m as drawGlyph, n as buildChildren, o as getBundle, p as ensureFontFace, r as buildRootProps, s as registerBundle, t as TegakiEngine, u as COMPATIBLE_BUNDLE_VERSIONS } from "../core-Ds9ohwR7.mjs";
2
+ export { BUNDLE_VERSION, COMPATIBLE_BUNDLE_VERSIONS, TegakiEngine, buildChildren, buildRootProps, computeTextLayout, computeTimeline, createBundle, domCreateElement, drawGlyph, ensureFontFace, getBundle, registerBundle, resolveBundle, resolveEffects };