tegaki 0.0.1 → 0.2.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/CHANGELOG.md +19 -0
- package/FONTS-LICENSE.md +67 -0
- package/LICENSE +21 -0
- package/README.md +261 -0
- package/dist/index.d.mts +257 -0
- package/dist/index.mjs +900 -0
- package/dist/index.mjs.map +1 -0
- package/fonts/caveat/bundle.ts +300 -0
- package/fonts/caveat/caveat.ttf +0 -0
- package/fonts/caveat/font.json +24472 -0
- package/fonts/caveat/glyphData.json +1 -0
- package/fonts/caveat/svg/0.svg +12 -0
- package/fonts/caveat/svg/0.tsx +14 -0
- package/fonts/caveat/svg/1.svg +7 -0
- package/fonts/caveat/svg/1.tsx +9 -0
- package/fonts/caveat/svg/2.svg +10 -0
- package/fonts/caveat/svg/2.tsx +12 -0
- package/fonts/caveat/svg/3.svg +12 -0
- package/fonts/caveat/svg/3.tsx +14 -0
- package/fonts/caveat/svg/4.svg +12 -0
- package/fonts/caveat/svg/4.tsx +14 -0
- package/fonts/caveat/svg/5.svg +7 -0
- package/fonts/caveat/svg/5.tsx +9 -0
- package/fonts/caveat/svg/6.svg +7 -0
- package/fonts/caveat/svg/6.tsx +9 -0
- package/fonts/caveat/svg/7.svg +12 -0
- package/fonts/caveat/svg/7.tsx +14 -0
- package/fonts/caveat/svg/8.svg +10 -0
- package/fonts/caveat/svg/8.tsx +12 -0
- package/fonts/caveat/svg/9.svg +12 -0
- package/fonts/caveat/svg/9.tsx +14 -0
- package/fonts/caveat/svg/U+0021.svg +12 -0
- package/fonts/caveat/svg/U+0021.tsx +14 -0
- package/fonts/caveat/svg/U+0022.svg +12 -0
- package/fonts/caveat/svg/U+0022.tsx +14 -0
- package/fonts/caveat/svg/U+0023.svg +22 -0
- package/fonts/caveat/svg/U+0023.tsx +24 -0
- package/fonts/caveat/svg/U+0024.svg +12 -0
- package/fonts/caveat/svg/U+0024.tsx +14 -0
- package/fonts/caveat/svg/U+0025.svg +25 -0
- package/fonts/caveat/svg/U+0025.tsx +27 -0
- package/fonts/caveat/svg/U+0026.svg +10 -0
- package/fonts/caveat/svg/U+0026.tsx +12 -0
- package/fonts/caveat/svg/U+0027.svg +7 -0
- package/fonts/caveat/svg/U+0027.tsx +9 -0
- package/fonts/caveat/svg/U+0028.svg +7 -0
- package/fonts/caveat/svg/U+0028.tsx +9 -0
- package/fonts/caveat/svg/U+0029.svg +7 -0
- package/fonts/caveat/svg/U+0029.tsx +9 -0
- package/fonts/caveat/svg/U+002a.svg +17 -0
- package/fonts/caveat/svg/U+002a.tsx +19 -0
- package/fonts/caveat/svg/U+002b.svg +12 -0
- package/fonts/caveat/svg/U+002b.tsx +14 -0
- package/fonts/caveat/svg/U+002c.svg +7 -0
- package/fonts/caveat/svg/U+002c.tsx +9 -0
- package/fonts/caveat/svg/U+002d.svg +7 -0
- package/fonts/caveat/svg/U+002d.tsx +9 -0
- package/fonts/caveat/svg/U+002e.svg +7 -0
- package/fonts/caveat/svg/U+002e.tsx +9 -0
- package/fonts/caveat/svg/U+002f.svg +12 -0
- package/fonts/caveat/svg/U+002f.tsx +14 -0
- package/fonts/caveat/svg/U+003a.svg +12 -0
- package/fonts/caveat/svg/U+003a.tsx +14 -0
- package/fonts/caveat/svg/U+003b.svg +12 -0
- package/fonts/caveat/svg/U+003b.tsx +14 -0
- package/fonts/caveat/svg/U+003c.svg +12 -0
- package/fonts/caveat/svg/U+003c.tsx +14 -0
- package/fonts/caveat/svg/U+003d.svg +12 -0
- package/fonts/caveat/svg/U+003d.tsx +14 -0
- package/fonts/caveat/svg/U+003e.svg +12 -0
- package/fonts/caveat/svg/U+003e.tsx +14 -0
- package/fonts/caveat/svg/U+003f.svg +12 -0
- package/fonts/caveat/svg/U+003f.tsx +14 -0
- package/fonts/caveat/svg/U+0040.svg +7 -0
- package/fonts/caveat/svg/U+0040.tsx +9 -0
- package/fonts/caveat/svg/U+005c.svg +7 -0
- package/fonts/caveat/svg/U+005c.tsx +9 -0
- package/fonts/caveat/svg/U+005e.svg +7 -0
- package/fonts/caveat/svg/U+005e.tsx +9 -0
- package/fonts/caveat/svg/U+005f.svg +7 -0
- package/fonts/caveat/svg/U+005f.tsx +9 -0
- package/fonts/caveat/svg/U+0060.svg +7 -0
- package/fonts/caveat/svg/U+0060.tsx +9 -0
- package/fonts/caveat/svg/U+007c.svg +7 -0
- package/fonts/caveat/svg/U+007c.tsx +9 -0
- package/fonts/caveat/svg/U+007e.svg +7 -0
- package/fonts/caveat/svg/U+007e.tsx +9 -0
- package/fonts/caveat/svg/a.svg +7 -0
- package/fonts/caveat/svg/a.tsx +9 -0
- package/fonts/caveat/svg/b.svg +12 -0
- package/fonts/caveat/svg/b.tsx +14 -0
- package/fonts/caveat/svg/c.svg +7 -0
- package/fonts/caveat/svg/c.tsx +9 -0
- package/fonts/caveat/svg/d.svg +12 -0
- package/fonts/caveat/svg/d.tsx +14 -0
- package/fonts/caveat/svg/e.svg +7 -0
- package/fonts/caveat/svg/e.tsx +9 -0
- package/fonts/caveat/svg/f.svg +12 -0
- package/fonts/caveat/svg/f.tsx +14 -0
- package/fonts/caveat/svg/g.svg +15 -0
- package/fonts/caveat/svg/g.tsx +17 -0
- package/fonts/caveat/svg/h.svg +7 -0
- package/fonts/caveat/svg/h.tsx +9 -0
- package/fonts/caveat/svg/i.svg +12 -0
- package/fonts/caveat/svg/i.tsx +14 -0
- package/fonts/caveat/svg/j.svg +12 -0
- package/fonts/caveat/svg/j.tsx +14 -0
- package/fonts/caveat/svg/k.svg +15 -0
- package/fonts/caveat/svg/k.tsx +17 -0
- package/fonts/caveat/svg/l.svg +7 -0
- package/fonts/caveat/svg/l.tsx +9 -0
- package/fonts/caveat/svg/m.svg +17 -0
- package/fonts/caveat/svg/m.tsx +19 -0
- package/fonts/caveat/svg/n.svg +17 -0
- package/fonts/caveat/svg/n.tsx +19 -0
- package/fonts/caveat/svg/o.svg +7 -0
- package/fonts/caveat/svg/o.tsx +9 -0
- package/fonts/caveat/svg/p.svg +12 -0
- package/fonts/caveat/svg/p.tsx +14 -0
- package/fonts/caveat/svg/q.svg +7 -0
- package/fonts/caveat/svg/q.tsx +9 -0
- package/fonts/caveat/svg/r.svg +12 -0
- package/fonts/caveat/svg/r.tsx +14 -0
- package/fonts/caveat/svg/s.svg +7 -0
- package/fonts/caveat/svg/s.tsx +9 -0
- package/fonts/caveat/svg/t.svg +20 -0
- package/fonts/caveat/svg/t.tsx +22 -0
- package/fonts/caveat/svg/u.svg +12 -0
- package/fonts/caveat/svg/u.tsx +14 -0
- package/fonts/caveat/svg/upper_A.svg +12 -0
- package/fonts/caveat/svg/upper_A.tsx +14 -0
- package/fonts/caveat/svg/upper_B.svg +17 -0
- package/fonts/caveat/svg/upper_B.tsx +19 -0
- package/fonts/caveat/svg/upper_C.svg +7 -0
- package/fonts/caveat/svg/upper_C.tsx +9 -0
- package/fonts/caveat/svg/upper_D.svg +12 -0
- package/fonts/caveat/svg/upper_D.tsx +14 -0
- package/fonts/caveat/svg/upper_E.svg +12 -0
- package/fonts/caveat/svg/upper_E.tsx +14 -0
- package/fonts/caveat/svg/upper_F.svg +17 -0
- package/fonts/caveat/svg/upper_F.tsx +19 -0
- package/fonts/caveat/svg/upper_G.svg +7 -0
- package/fonts/caveat/svg/upper_G.tsx +9 -0
- package/fonts/caveat/svg/upper_H.svg +17 -0
- package/fonts/caveat/svg/upper_H.tsx +19 -0
- package/fonts/caveat/svg/upper_I.svg +17 -0
- package/fonts/caveat/svg/upper_I.tsx +19 -0
- package/fonts/caveat/svg/upper_J.svg +7 -0
- package/fonts/caveat/svg/upper_J.tsx +9 -0
- package/fonts/caveat/svg/upper_K.svg +12 -0
- package/fonts/caveat/svg/upper_K.tsx +14 -0
- package/fonts/caveat/svg/upper_L.svg +7 -0
- package/fonts/caveat/svg/upper_L.tsx +9 -0
- package/fonts/caveat/svg/upper_M.svg +17 -0
- package/fonts/caveat/svg/upper_M.tsx +19 -0
- package/fonts/caveat/svg/upper_N.svg +7 -0
- package/fonts/caveat/svg/upper_N.tsx +9 -0
- package/fonts/caveat/svg/upper_O.svg +7 -0
- package/fonts/caveat/svg/upper_O.tsx +9 -0
- package/fonts/caveat/svg/upper_P.svg +12 -0
- package/fonts/caveat/svg/upper_P.tsx +14 -0
- package/fonts/caveat/svg/upper_Q.svg +15 -0
- package/fonts/caveat/svg/upper_Q.tsx +17 -0
- package/fonts/caveat/svg/upper_R.svg +12 -0
- package/fonts/caveat/svg/upper_R.tsx +14 -0
- package/fonts/caveat/svg/upper_S.svg +7 -0
- package/fonts/caveat/svg/upper_S.tsx +9 -0
- package/fonts/caveat/svg/upper_T.svg +12 -0
- package/fonts/caveat/svg/upper_T.tsx +14 -0
- package/fonts/caveat/svg/upper_U.svg +15 -0
- package/fonts/caveat/svg/upper_U.tsx +17 -0
- package/fonts/caveat/svg/upper_V.svg +12 -0
- package/fonts/caveat/svg/upper_V.tsx +14 -0
- package/fonts/caveat/svg/upper_W.svg +12 -0
- package/fonts/caveat/svg/upper_W.tsx +14 -0
- package/fonts/caveat/svg/upper_X.svg +12 -0
- package/fonts/caveat/svg/upper_X.tsx +14 -0
- package/fonts/caveat/svg/upper_Y.svg +12 -0
- package/fonts/caveat/svg/upper_Y.tsx +14 -0
- package/fonts/caveat/svg/upper_Z.svg +7 -0
- package/fonts/caveat/svg/upper_Z.tsx +9 -0
- package/fonts/caveat/svg/v.svg +7 -0
- package/fonts/caveat/svg/v.tsx +9 -0
- package/fonts/caveat/svg/w.svg +12 -0
- package/fonts/caveat/svg/w.tsx +14 -0
- package/fonts/caveat/svg/x.svg +17 -0
- package/fonts/caveat/svg/x.tsx +19 -0
- package/fonts/caveat/svg/y.svg +12 -0
- package/fonts/caveat/svg/y.tsx +14 -0
- package/fonts/caveat/svg/z.svg +7 -0
- package/fonts/caveat/svg/z.tsx +9 -0
- package/fonts/italianno/bundle.ts +300 -0
- package/fonts/italianno/font.json +33410 -0
- package/fonts/italianno/glyphData.json +1 -0
- package/fonts/italianno/italianno.ttf +0 -0
- package/fonts/italianno/svg/0.svg +10 -0
- package/fonts/italianno/svg/0.tsx +12 -0
- package/fonts/italianno/svg/1.svg +17 -0
- package/fonts/italianno/svg/1.tsx +19 -0
- package/fonts/italianno/svg/2.svg +12 -0
- package/fonts/italianno/svg/2.tsx +14 -0
- package/fonts/italianno/svg/3.svg +17 -0
- package/fonts/italianno/svg/3.tsx +19 -0
- package/fonts/italianno/svg/4.svg +22 -0
- package/fonts/italianno/svg/4.tsx +24 -0
- package/fonts/italianno/svg/5.svg +12 -0
- package/fonts/italianno/svg/5.tsx +14 -0
- package/fonts/italianno/svg/6.svg +13 -0
- package/fonts/italianno/svg/6.tsx +15 -0
- package/fonts/italianno/svg/7.svg +12 -0
- package/fonts/italianno/svg/7.tsx +14 -0
- package/fonts/italianno/svg/8.svg +7 -0
- package/fonts/italianno/svg/8.tsx +9 -0
- package/fonts/italianno/svg/9.svg +12 -0
- package/fonts/italianno/svg/9.tsx +14 -0
- package/fonts/italianno/svg/U+0021.svg +12 -0
- package/fonts/italianno/svg/U+0021.tsx +14 -0
- package/fonts/italianno/svg/U+0022.svg +15 -0
- package/fonts/italianno/svg/U+0022.tsx +17 -0
- package/fonts/italianno/svg/U+0023.svg +22 -0
- package/fonts/italianno/svg/U+0023.tsx +24 -0
- package/fonts/italianno/svg/U+0024.svg +25 -0
- package/fonts/italianno/svg/U+0024.tsx +27 -0
- package/fonts/italianno/svg/U+0025.svg +22 -0
- package/fonts/italianno/svg/U+0025.tsx +24 -0
- package/fonts/italianno/svg/U+0026.svg +17 -0
- package/fonts/italianno/svg/U+0026.tsx +19 -0
- package/fonts/italianno/svg/U+0027.svg +7 -0
- package/fonts/italianno/svg/U+0027.tsx +9 -0
- package/fonts/italianno/svg/U+0028.svg +7 -0
- package/fonts/italianno/svg/U+0028.tsx +9 -0
- package/fonts/italianno/svg/U+0029.svg +7 -0
- package/fonts/italianno/svg/U+0029.tsx +9 -0
- package/fonts/italianno/svg/U+002a.svg +22 -0
- package/fonts/italianno/svg/U+002a.tsx +24 -0
- package/fonts/italianno/svg/U+002b.svg +12 -0
- package/fonts/italianno/svg/U+002b.tsx +14 -0
- package/fonts/italianno/svg/U+002c.svg +12 -0
- package/fonts/italianno/svg/U+002c.tsx +14 -0
- package/fonts/italianno/svg/U+002d.svg +7 -0
- package/fonts/italianno/svg/U+002d.tsx +9 -0
- package/fonts/italianno/svg/U+002e.svg +7 -0
- package/fonts/italianno/svg/U+002e.tsx +9 -0
- package/fonts/italianno/svg/U+002f.svg +7 -0
- package/fonts/italianno/svg/U+002f.tsx +9 -0
- package/fonts/italianno/svg/U+003a.svg +12 -0
- package/fonts/italianno/svg/U+003a.tsx +14 -0
- package/fonts/italianno/svg/U+003b.svg +12 -0
- package/fonts/italianno/svg/U+003b.tsx +14 -0
- package/fonts/italianno/svg/U+003c.svg +7 -0
- package/fonts/italianno/svg/U+003c.tsx +9 -0
- package/fonts/italianno/svg/U+003d.svg +12 -0
- package/fonts/italianno/svg/U+003d.tsx +14 -0
- package/fonts/italianno/svg/U+003e.svg +12 -0
- package/fonts/italianno/svg/U+003e.tsx +14 -0
- package/fonts/italianno/svg/U+003f.svg +12 -0
- package/fonts/italianno/svg/U+003f.tsx +14 -0
- package/fonts/italianno/svg/U+0040.svg +15 -0
- package/fonts/italianno/svg/U+0040.tsx +17 -0
- package/fonts/italianno/svg/U+005c.svg +7 -0
- package/fonts/italianno/svg/U+005c.tsx +9 -0
- package/fonts/italianno/svg/U+005e.svg +12 -0
- package/fonts/italianno/svg/U+005e.tsx +14 -0
- package/fonts/italianno/svg/U+005f.svg +3 -0
- package/fonts/italianno/svg/U+005f.tsx +5 -0
- package/fonts/italianno/svg/U+0060.svg +10 -0
- package/fonts/italianno/svg/U+0060.tsx +12 -0
- package/fonts/italianno/svg/U+007c.svg +7 -0
- package/fonts/italianno/svg/U+007c.tsx +9 -0
- package/fonts/italianno/svg/U+007e.svg +7 -0
- package/fonts/italianno/svg/U+007e.tsx +9 -0
- package/fonts/italianno/svg/a.svg +12 -0
- package/fonts/italianno/svg/a.tsx +14 -0
- package/fonts/italianno/svg/b.svg +10 -0
- package/fonts/italianno/svg/b.tsx +12 -0
- package/fonts/italianno/svg/c.svg +10 -0
- package/fonts/italianno/svg/c.tsx +12 -0
- package/fonts/italianno/svg/d.svg +15 -0
- package/fonts/italianno/svg/d.tsx +17 -0
- package/fonts/italianno/svg/e.svg +12 -0
- package/fonts/italianno/svg/e.tsx +14 -0
- package/fonts/italianno/svg/f.svg +12 -0
- package/fonts/italianno/svg/f.tsx +14 -0
- package/fonts/italianno/svg/g.svg +12 -0
- package/fonts/italianno/svg/g.tsx +14 -0
- package/fonts/italianno/svg/h.svg +12 -0
- package/fonts/italianno/svg/h.tsx +14 -0
- package/fonts/italianno/svg/i.svg +17 -0
- package/fonts/italianno/svg/i.tsx +19 -0
- package/fonts/italianno/svg/j.svg +12 -0
- package/fonts/italianno/svg/j.tsx +14 -0
- package/fonts/italianno/svg/k.svg +17 -0
- package/fonts/italianno/svg/k.tsx +19 -0
- package/fonts/italianno/svg/l.svg +15 -0
- package/fonts/italianno/svg/l.tsx +17 -0
- package/fonts/italianno/svg/m.svg +27 -0
- package/fonts/italianno/svg/m.tsx +29 -0
- package/fonts/italianno/svg/n.svg +22 -0
- package/fonts/italianno/svg/n.tsx +24 -0
- package/fonts/italianno/svg/o.svg +20 -0
- package/fonts/italianno/svg/o.tsx +22 -0
- package/fonts/italianno/svg/p.svg +12 -0
- package/fonts/italianno/svg/p.tsx +14 -0
- package/fonts/italianno/svg/q.svg +17 -0
- package/fonts/italianno/svg/q.tsx +19 -0
- package/fonts/italianno/svg/r.svg +22 -0
- package/fonts/italianno/svg/r.tsx +24 -0
- package/fonts/italianno/svg/s.svg +15 -0
- package/fonts/italianno/svg/s.tsx +17 -0
- package/fonts/italianno/svg/t.svg +17 -0
- package/fonts/italianno/svg/t.tsx +19 -0
- package/fonts/italianno/svg/u.svg +12 -0
- package/fonts/italianno/svg/u.tsx +14 -0
- package/fonts/italianno/svg/upper_A.svg +17 -0
- package/fonts/italianno/svg/upper_A.tsx +19 -0
- package/fonts/italianno/svg/upper_B.svg +27 -0
- package/fonts/italianno/svg/upper_B.tsx +29 -0
- package/fonts/italianno/svg/upper_C.svg +7 -0
- package/fonts/italianno/svg/upper_C.tsx +9 -0
- package/fonts/italianno/svg/upper_D.svg +12 -0
- package/fonts/italianno/svg/upper_D.tsx +14 -0
- package/fonts/italianno/svg/upper_E.svg +17 -0
- package/fonts/italianno/svg/upper_E.tsx +19 -0
- package/fonts/italianno/svg/upper_F.svg +17 -0
- package/fonts/italianno/svg/upper_F.tsx +19 -0
- package/fonts/italianno/svg/upper_G.svg +20 -0
- package/fonts/italianno/svg/upper_G.tsx +22 -0
- package/fonts/italianno/svg/upper_H.svg +17 -0
- package/fonts/italianno/svg/upper_H.tsx +19 -0
- package/fonts/italianno/svg/upper_I.svg +12 -0
- package/fonts/italianno/svg/upper_I.tsx +14 -0
- package/fonts/italianno/svg/upper_J.svg +10 -0
- package/fonts/italianno/svg/upper_J.tsx +12 -0
- package/fonts/italianno/svg/upper_K.svg +20 -0
- package/fonts/italianno/svg/upper_K.tsx +22 -0
- package/fonts/italianno/svg/upper_L.svg +12 -0
- package/fonts/italianno/svg/upper_L.tsx +14 -0
- package/fonts/italianno/svg/upper_M.svg +17 -0
- package/fonts/italianno/svg/upper_M.tsx +19 -0
- package/fonts/italianno/svg/upper_N.svg +17 -0
- package/fonts/italianno/svg/upper_N.tsx +19 -0
- package/fonts/italianno/svg/upper_O.svg +17 -0
- package/fonts/italianno/svg/upper_O.tsx +19 -0
- package/fonts/italianno/svg/upper_P.svg +22 -0
- package/fonts/italianno/svg/upper_P.tsx +24 -0
- package/fonts/italianno/svg/upper_Q.svg +12 -0
- package/fonts/italianno/svg/upper_Q.tsx +14 -0
- package/fonts/italianno/svg/upper_R.svg +15 -0
- package/fonts/italianno/svg/upper_R.tsx +17 -0
- package/fonts/italianno/svg/upper_S.svg +12 -0
- package/fonts/italianno/svg/upper_S.tsx +14 -0
- package/fonts/italianno/svg/upper_T.svg +17 -0
- package/fonts/italianno/svg/upper_T.tsx +19 -0
- package/fonts/italianno/svg/upper_U.svg +17 -0
- package/fonts/italianno/svg/upper_U.tsx +19 -0
- package/fonts/italianno/svg/upper_V.svg +17 -0
- package/fonts/italianno/svg/upper_V.tsx +19 -0
- package/fonts/italianno/svg/upper_W.svg +17 -0
- package/fonts/italianno/svg/upper_W.tsx +19 -0
- package/fonts/italianno/svg/upper_X.svg +22 -0
- package/fonts/italianno/svg/upper_X.tsx +24 -0
- package/fonts/italianno/svg/upper_Y.svg +22 -0
- package/fonts/italianno/svg/upper_Y.tsx +24 -0
- package/fonts/italianno/svg/upper_Z.svg +12 -0
- package/fonts/italianno/svg/upper_Z.tsx +14 -0
- package/fonts/italianno/svg/v.svg +17 -0
- package/fonts/italianno/svg/v.tsx +19 -0
- package/fonts/italianno/svg/w.svg +17 -0
- package/fonts/italianno/svg/w.tsx +19 -0
- package/fonts/italianno/svg/x.svg +15 -0
- package/fonts/italianno/svg/x.tsx +17 -0
- package/fonts/italianno/svg/y.svg +12 -0
- package/fonts/italianno/svg/y.tsx +14 -0
- package/fonts/italianno/svg/z.svg +17 -0
- package/fonts/italianno/svg/z.tsx +19 -0
- package/fonts/parisienne/bundle.ts +300 -0
- package/fonts/parisienne/font.json +36222 -0
- package/fonts/parisienne/glyphData.json +1 -0
- package/fonts/parisienne/parisienne.ttf +0 -0
- package/fonts/parisienne/svg/0.svg +7 -0
- package/fonts/parisienne/svg/0.tsx +9 -0
- package/fonts/parisienne/svg/1.svg +12 -0
- package/fonts/parisienne/svg/1.tsx +14 -0
- package/fonts/parisienne/svg/2.svg +7 -0
- package/fonts/parisienne/svg/2.tsx +9 -0
- package/fonts/parisienne/svg/3.svg +7 -0
- package/fonts/parisienne/svg/3.tsx +9 -0
- package/fonts/parisienne/svg/4.svg +17 -0
- package/fonts/parisienne/svg/4.tsx +19 -0
- package/fonts/parisienne/svg/5.svg +10 -0
- package/fonts/parisienne/svg/5.tsx +12 -0
- package/fonts/parisienne/svg/6.svg +7 -0
- package/fonts/parisienne/svg/6.tsx +9 -0
- package/fonts/parisienne/svg/7.svg +12 -0
- package/fonts/parisienne/svg/7.tsx +14 -0
- package/fonts/parisienne/svg/8.svg +7 -0
- package/fonts/parisienne/svg/8.tsx +9 -0
- package/fonts/parisienne/svg/9.svg +7 -0
- package/fonts/parisienne/svg/9.tsx +9 -0
- package/fonts/parisienne/svg/U+0021.svg +10 -0
- package/fonts/parisienne/svg/U+0021.tsx +12 -0
- package/fonts/parisienne/svg/U+0022.svg +12 -0
- package/fonts/parisienne/svg/U+0022.tsx +14 -0
- package/fonts/parisienne/svg/U+0023.svg +22 -0
- package/fonts/parisienne/svg/U+0023.tsx +24 -0
- package/fonts/parisienne/svg/U+0024.svg +15 -0
- package/fonts/parisienne/svg/U+0024.tsx +17 -0
- package/fonts/parisienne/svg/U+0025.svg +22 -0
- package/fonts/parisienne/svg/U+0025.tsx +24 -0
- package/fonts/parisienne/svg/U+0026.svg +17 -0
- package/fonts/parisienne/svg/U+0026.tsx +19 -0
- package/fonts/parisienne/svg/U+0027.svg +7 -0
- package/fonts/parisienne/svg/U+0027.tsx +9 -0
- package/fonts/parisienne/svg/U+0028.svg +7 -0
- package/fonts/parisienne/svg/U+0028.tsx +9 -0
- package/fonts/parisienne/svg/U+0029.svg +7 -0
- package/fonts/parisienne/svg/U+0029.tsx +9 -0
- package/fonts/parisienne/svg/U+002a.svg +22 -0
- package/fonts/parisienne/svg/U+002a.tsx +24 -0
- package/fonts/parisienne/svg/U+002b.svg +12 -0
- package/fonts/parisienne/svg/U+002b.tsx +14 -0
- package/fonts/parisienne/svg/U+002c.svg +7 -0
- package/fonts/parisienne/svg/U+002c.tsx +9 -0
- package/fonts/parisienne/svg/U+002d.svg +7 -0
- package/fonts/parisienne/svg/U+002d.tsx +9 -0
- package/fonts/parisienne/svg/U+002e.svg +7 -0
- package/fonts/parisienne/svg/U+002e.tsx +9 -0
- package/fonts/parisienne/svg/U+002f.svg +7 -0
- package/fonts/parisienne/svg/U+002f.tsx +9 -0
- package/fonts/parisienne/svg/U+003a.svg +8 -0
- package/fonts/parisienne/svg/U+003a.tsx +10 -0
- package/fonts/parisienne/svg/U+003b.svg +10 -0
- package/fonts/parisienne/svg/U+003b.tsx +12 -0
- package/fonts/parisienne/svg/U+003c.svg +7 -0
- package/fonts/parisienne/svg/U+003c.tsx +9 -0
- package/fonts/parisienne/svg/U+003d.svg +12 -0
- package/fonts/parisienne/svg/U+003d.tsx +14 -0
- package/fonts/parisienne/svg/U+003e.svg +7 -0
- package/fonts/parisienne/svg/U+003e.tsx +9 -0
- package/fonts/parisienne/svg/U+003f.svg +10 -0
- package/fonts/parisienne/svg/U+003f.tsx +12 -0
- package/fonts/parisienne/svg/U+0040.svg +15 -0
- package/fonts/parisienne/svg/U+0040.tsx +17 -0
- package/fonts/parisienne/svg/U+005c.svg +7 -0
- package/fonts/parisienne/svg/U+005c.tsx +9 -0
- package/fonts/parisienne/svg/U+005e.svg +7 -0
- package/fonts/parisienne/svg/U+005e.tsx +9 -0
- package/fonts/parisienne/svg/U+005f.svg +7 -0
- package/fonts/parisienne/svg/U+005f.tsx +9 -0
- package/fonts/parisienne/svg/U+0060.svg +10 -0
- package/fonts/parisienne/svg/U+0060.tsx +12 -0
- package/fonts/parisienne/svg/U+007c.svg +7 -0
- package/fonts/parisienne/svg/U+007c.tsx +9 -0
- package/fonts/parisienne/svg/U+007e.svg +7 -0
- package/fonts/parisienne/svg/U+007e.tsx +9 -0
- package/fonts/parisienne/svg/a.svg +15 -0
- package/fonts/parisienne/svg/a.tsx +17 -0
- package/fonts/parisienne/svg/b.svg +7 -0
- package/fonts/parisienne/svg/b.tsx +9 -0
- package/fonts/parisienne/svg/c.svg +12 -0
- package/fonts/parisienne/svg/c.tsx +14 -0
- package/fonts/parisienne/svg/d.svg +12 -0
- package/fonts/parisienne/svg/d.tsx +14 -0
- package/fonts/parisienne/svg/e.svg +17 -0
- package/fonts/parisienne/svg/e.tsx +19 -0
- package/fonts/parisienne/svg/f.svg +12 -0
- package/fonts/parisienne/svg/f.tsx +14 -0
- package/fonts/parisienne/svg/g.svg +10 -0
- package/fonts/parisienne/svg/g.tsx +12 -0
- package/fonts/parisienne/svg/h.svg +12 -0
- package/fonts/parisienne/svg/h.tsx +14 -0
- package/fonts/parisienne/svg/i.svg +12 -0
- package/fonts/parisienne/svg/i.tsx +14 -0
- package/fonts/parisienne/svg/j.svg +17 -0
- package/fonts/parisienne/svg/j.tsx +19 -0
- package/fonts/parisienne/svg/k.svg +17 -0
- package/fonts/parisienne/svg/k.tsx +19 -0
- package/fonts/parisienne/svg/l.svg +7 -0
- package/fonts/parisienne/svg/l.tsx +9 -0
- package/fonts/parisienne/svg/m.svg +17 -0
- package/fonts/parisienne/svg/m.tsx +19 -0
- package/fonts/parisienne/svg/n.svg +12 -0
- package/fonts/parisienne/svg/n.tsx +14 -0
- package/fonts/parisienne/svg/o.svg +15 -0
- package/fonts/parisienne/svg/o.tsx +17 -0
- package/fonts/parisienne/svg/p.svg +12 -0
- package/fonts/parisienne/svg/p.tsx +14 -0
- package/fonts/parisienne/svg/q.svg +12 -0
- package/fonts/parisienne/svg/q.tsx +14 -0
- package/fonts/parisienne/svg/r.svg +7 -0
- package/fonts/parisienne/svg/r.tsx +9 -0
- package/fonts/parisienne/svg/s.svg +17 -0
- package/fonts/parisienne/svg/s.tsx +19 -0
- package/fonts/parisienne/svg/t.svg +20 -0
- package/fonts/parisienne/svg/t.tsx +22 -0
- package/fonts/parisienne/svg/u.svg +12 -0
- package/fonts/parisienne/svg/u.tsx +14 -0
- package/fonts/parisienne/svg/upper_A.svg +10 -0
- package/fonts/parisienne/svg/upper_A.tsx +12 -0
- package/fonts/parisienne/svg/upper_B.svg +12 -0
- package/fonts/parisienne/svg/upper_B.tsx +14 -0
- package/fonts/parisienne/svg/upper_C.svg +7 -0
- package/fonts/parisienne/svg/upper_C.tsx +9 -0
- package/fonts/parisienne/svg/upper_D.svg +7 -0
- package/fonts/parisienne/svg/upper_D.tsx +9 -0
- package/fonts/parisienne/svg/upper_E.svg +10 -0
- package/fonts/parisienne/svg/upper_E.tsx +12 -0
- package/fonts/parisienne/svg/upper_F.svg +22 -0
- package/fonts/parisienne/svg/upper_F.tsx +24 -0
- package/fonts/parisienne/svg/upper_G.svg +15 -0
- package/fonts/parisienne/svg/upper_G.tsx +17 -0
- package/fonts/parisienne/svg/upper_H.svg +15 -0
- package/fonts/parisienne/svg/upper_H.tsx +17 -0
- package/fonts/parisienne/svg/upper_I.svg +15 -0
- package/fonts/parisienne/svg/upper_I.tsx +17 -0
- package/fonts/parisienne/svg/upper_J.svg +15 -0
- package/fonts/parisienne/svg/upper_J.tsx +17 -0
- package/fonts/parisienne/svg/upper_K.svg +12 -0
- package/fonts/parisienne/svg/upper_K.tsx +14 -0
- package/fonts/parisienne/svg/upper_L.svg +7 -0
- package/fonts/parisienne/svg/upper_L.tsx +9 -0
- package/fonts/parisienne/svg/upper_M.svg +15 -0
- package/fonts/parisienne/svg/upper_M.tsx +17 -0
- package/fonts/parisienne/svg/upper_N.svg +12 -0
- package/fonts/parisienne/svg/upper_N.tsx +14 -0
- package/fonts/parisienne/svg/upper_O.svg +7 -0
- package/fonts/parisienne/svg/upper_O.tsx +9 -0
- package/fonts/parisienne/svg/upper_P.svg +12 -0
- package/fonts/parisienne/svg/upper_P.tsx +14 -0
- package/fonts/parisienne/svg/upper_Q.svg +15 -0
- package/fonts/parisienne/svg/upper_Q.tsx +17 -0
- package/fonts/parisienne/svg/upper_R.svg +12 -0
- package/fonts/parisienne/svg/upper_R.tsx +14 -0
- package/fonts/parisienne/svg/upper_S.svg +7 -0
- package/fonts/parisienne/svg/upper_S.tsx +9 -0
- package/fonts/parisienne/svg/upper_T.svg +12 -0
- package/fonts/parisienne/svg/upper_T.tsx +14 -0
- package/fonts/parisienne/svg/upper_U.svg +17 -0
- package/fonts/parisienne/svg/upper_U.tsx +19 -0
- package/fonts/parisienne/svg/upper_V.svg +7 -0
- package/fonts/parisienne/svg/upper_V.tsx +9 -0
- package/fonts/parisienne/svg/upper_W.svg +12 -0
- package/fonts/parisienne/svg/upper_W.tsx +14 -0
- package/fonts/parisienne/svg/upper_X.svg +27 -0
- package/fonts/parisienne/svg/upper_X.tsx +29 -0
- package/fonts/parisienne/svg/upper_Y.svg +15 -0
- package/fonts/parisienne/svg/upper_Y.tsx +17 -0
- package/fonts/parisienne/svg/upper_Z.svg +12 -0
- package/fonts/parisienne/svg/upper_Z.tsx +14 -0
- package/fonts/parisienne/svg/v.svg +7 -0
- package/fonts/parisienne/svg/v.tsx +9 -0
- package/fonts/parisienne/svg/w.svg +17 -0
- package/fonts/parisienne/svg/w.tsx +19 -0
- package/fonts/parisienne/svg/x.svg +17 -0
- package/fonts/parisienne/svg/x.tsx +19 -0
- package/fonts/parisienne/svg/y.svg +17 -0
- package/fonts/parisienne/svg/y.tsx +19 -0
- package/fonts/parisienne/svg/z.svg +12 -0
- package/fonts/parisienne/svg/z.tsx +14 -0
- package/fonts/tangerine/bundle.ts +300 -0
- package/fonts/tangerine/font.json +31512 -0
- package/fonts/tangerine/glyphData.json +1 -0
- package/fonts/tangerine/svg/0.svg +7 -0
- package/fonts/tangerine/svg/0.tsx +9 -0
- package/fonts/tangerine/svg/1.svg +12 -0
- package/fonts/tangerine/svg/1.tsx +14 -0
- package/fonts/tangerine/svg/2.svg +12 -0
- package/fonts/tangerine/svg/2.tsx +14 -0
- package/fonts/tangerine/svg/3.svg +12 -0
- package/fonts/tangerine/svg/3.tsx +14 -0
- package/fonts/tangerine/svg/4.svg +12 -0
- package/fonts/tangerine/svg/4.tsx +14 -0
- package/fonts/tangerine/svg/5.svg +7 -0
- package/fonts/tangerine/svg/5.tsx +9 -0
- package/fonts/tangerine/svg/6.svg +7 -0
- package/fonts/tangerine/svg/6.tsx +9 -0
- package/fonts/tangerine/svg/7.svg +12 -0
- package/fonts/tangerine/svg/7.tsx +14 -0
- package/fonts/tangerine/svg/8.svg +7 -0
- package/fonts/tangerine/svg/8.tsx +9 -0
- package/fonts/tangerine/svg/9.svg +7 -0
- package/fonts/tangerine/svg/9.tsx +9 -0
- package/fonts/tangerine/svg/U+0021.svg +12 -0
- package/fonts/tangerine/svg/U+0021.tsx +14 -0
- package/fonts/tangerine/svg/U+0022.svg +12 -0
- package/fonts/tangerine/svg/U+0022.tsx +14 -0
- package/fonts/tangerine/svg/U+0023.svg +22 -0
- package/fonts/tangerine/svg/U+0023.tsx +24 -0
- package/fonts/tangerine/svg/U+0024.svg +12 -0
- package/fonts/tangerine/svg/U+0024.tsx +14 -0
- package/fonts/tangerine/svg/U+0025.svg +17 -0
- package/fonts/tangerine/svg/U+0025.tsx +19 -0
- package/fonts/tangerine/svg/U+0026.svg +7 -0
- package/fonts/tangerine/svg/U+0026.tsx +9 -0
- package/fonts/tangerine/svg/U+0027.svg +7 -0
- package/fonts/tangerine/svg/U+0027.tsx +9 -0
- package/fonts/tangerine/svg/U+0028.svg +7 -0
- package/fonts/tangerine/svg/U+0028.tsx +9 -0
- package/fonts/tangerine/svg/U+0029.svg +7 -0
- package/fonts/tangerine/svg/U+0029.tsx +9 -0
- package/fonts/tangerine/svg/U+002a.svg +17 -0
- package/fonts/tangerine/svg/U+002a.tsx +19 -0
- package/fonts/tangerine/svg/U+002b.svg +12 -0
- package/fonts/tangerine/svg/U+002b.tsx +14 -0
- package/fonts/tangerine/svg/U+002c.svg +10 -0
- package/fonts/tangerine/svg/U+002c.tsx +12 -0
- package/fonts/tangerine/svg/U+002d.svg +7 -0
- package/fonts/tangerine/svg/U+002d.tsx +9 -0
- package/fonts/tangerine/svg/U+002e.svg +10 -0
- package/fonts/tangerine/svg/U+002e.tsx +12 -0
- package/fonts/tangerine/svg/U+002f.svg +7 -0
- package/fonts/tangerine/svg/U+002f.tsx +9 -0
- package/fonts/tangerine/svg/U+003a.svg +12 -0
- package/fonts/tangerine/svg/U+003a.tsx +14 -0
- package/fonts/tangerine/svg/U+003b.svg +12 -0
- package/fonts/tangerine/svg/U+003b.tsx +14 -0
- package/fonts/tangerine/svg/U+003c.svg +12 -0
- package/fonts/tangerine/svg/U+003c.tsx +14 -0
- package/fonts/tangerine/svg/U+003d.svg +12 -0
- package/fonts/tangerine/svg/U+003d.tsx +14 -0
- package/fonts/tangerine/svg/U+003e.svg +12 -0
- package/fonts/tangerine/svg/U+003e.tsx +14 -0
- package/fonts/tangerine/svg/U+003f.svg +12 -0
- package/fonts/tangerine/svg/U+003f.tsx +14 -0
- package/fonts/tangerine/svg/U+0040.svg +15 -0
- package/fonts/tangerine/svg/U+0040.tsx +17 -0
- package/fonts/tangerine/svg/U+005c.svg +7 -0
- package/fonts/tangerine/svg/U+005c.tsx +9 -0
- package/fonts/tangerine/svg/U+005e.svg +12 -0
- package/fonts/tangerine/svg/U+005e.tsx +14 -0
- package/fonts/tangerine/svg/U+005f.svg +7 -0
- package/fonts/tangerine/svg/U+005f.tsx +9 -0
- package/fonts/tangerine/svg/U+0060.svg +7 -0
- package/fonts/tangerine/svg/U+0060.tsx +9 -0
- package/fonts/tangerine/svg/U+007c.svg +7 -0
- package/fonts/tangerine/svg/U+007c.tsx +9 -0
- package/fonts/tangerine/svg/U+007e.svg +7 -0
- package/fonts/tangerine/svg/U+007e.tsx +9 -0
- package/fonts/tangerine/svg/a.svg +12 -0
- package/fonts/tangerine/svg/a.tsx +14 -0
- package/fonts/tangerine/svg/b.svg +7 -0
- package/fonts/tangerine/svg/b.tsx +9 -0
- package/fonts/tangerine/svg/c.svg +7 -0
- package/fonts/tangerine/svg/c.tsx +9 -0
- package/fonts/tangerine/svg/d.svg +12 -0
- package/fonts/tangerine/svg/d.tsx +14 -0
- package/fonts/tangerine/svg/e.svg +15 -0
- package/fonts/tangerine/svg/e.tsx +17 -0
- package/fonts/tangerine/svg/f.svg +15 -0
- package/fonts/tangerine/svg/f.tsx +17 -0
- package/fonts/tangerine/svg/g.svg +12 -0
- package/fonts/tangerine/svg/g.tsx +14 -0
- package/fonts/tangerine/svg/h.svg +12 -0
- package/fonts/tangerine/svg/h.tsx +14 -0
- package/fonts/tangerine/svg/i.svg +15 -0
- package/fonts/tangerine/svg/i.tsx +17 -0
- package/fonts/tangerine/svg/j.svg +12 -0
- package/fonts/tangerine/svg/j.tsx +14 -0
- package/fonts/tangerine/svg/k.svg +12 -0
- package/fonts/tangerine/svg/k.tsx +14 -0
- package/fonts/tangerine/svg/l.svg +7 -0
- package/fonts/tangerine/svg/l.tsx +9 -0
- package/fonts/tangerine/svg/m.svg +17 -0
- package/fonts/tangerine/svg/m.tsx +19 -0
- package/fonts/tangerine/svg/n.svg +12 -0
- package/fonts/tangerine/svg/n.tsx +14 -0
- package/fonts/tangerine/svg/o.svg +12 -0
- package/fonts/tangerine/svg/o.tsx +14 -0
- package/fonts/tangerine/svg/p.svg +17 -0
- package/fonts/tangerine/svg/p.tsx +19 -0
- package/fonts/tangerine/svg/q.svg +15 -0
- package/fonts/tangerine/svg/q.tsx +17 -0
- package/fonts/tangerine/svg/r.svg +17 -0
- package/fonts/tangerine/svg/r.tsx +19 -0
- package/fonts/tangerine/svg/s.svg +10 -0
- package/fonts/tangerine/svg/s.tsx +12 -0
- package/fonts/tangerine/svg/t.svg +17 -0
- package/fonts/tangerine/svg/t.tsx +19 -0
- package/fonts/tangerine/svg/u.svg +17 -0
- package/fonts/tangerine/svg/u.tsx +19 -0
- package/fonts/tangerine/svg/upper_A.svg +20 -0
- package/fonts/tangerine/svg/upper_A.tsx +22 -0
- package/fonts/tangerine/svg/upper_B.svg +17 -0
- package/fonts/tangerine/svg/upper_B.tsx +19 -0
- package/fonts/tangerine/svg/upper_C.svg +7 -0
- package/fonts/tangerine/svg/upper_C.tsx +9 -0
- package/fonts/tangerine/svg/upper_D.svg +12 -0
- package/fonts/tangerine/svg/upper_D.tsx +14 -0
- package/fonts/tangerine/svg/upper_E.svg +7 -0
- package/fonts/tangerine/svg/upper_E.tsx +9 -0
- package/fonts/tangerine/svg/upper_F.svg +17 -0
- package/fonts/tangerine/svg/upper_F.tsx +19 -0
- package/fonts/tangerine/svg/upper_G.svg +12 -0
- package/fonts/tangerine/svg/upper_G.tsx +14 -0
- package/fonts/tangerine/svg/upper_H.svg +12 -0
- package/fonts/tangerine/svg/upper_H.tsx +14 -0
- package/fonts/tangerine/svg/upper_I.svg +7 -0
- package/fonts/tangerine/svg/upper_I.tsx +9 -0
- package/fonts/tangerine/svg/upper_J.svg +7 -0
- package/fonts/tangerine/svg/upper_J.tsx +9 -0
- package/fonts/tangerine/svg/upper_K.svg +17 -0
- package/fonts/tangerine/svg/upper_K.tsx +19 -0
- package/fonts/tangerine/svg/upper_L.svg +7 -0
- package/fonts/tangerine/svg/upper_L.tsx +9 -0
- package/fonts/tangerine/svg/upper_M.svg +12 -0
- package/fonts/tangerine/svg/upper_M.tsx +14 -0
- package/fonts/tangerine/svg/upper_N.svg +15 -0
- package/fonts/tangerine/svg/upper_N.tsx +17 -0
- package/fonts/tangerine/svg/upper_O.svg +7 -0
- package/fonts/tangerine/svg/upper_O.tsx +9 -0
- package/fonts/tangerine/svg/upper_P.svg +12 -0
- package/fonts/tangerine/svg/upper_P.tsx +14 -0
- package/fonts/tangerine/svg/upper_Q.svg +12 -0
- package/fonts/tangerine/svg/upper_Q.tsx +14 -0
- package/fonts/tangerine/svg/upper_R.svg +12 -0
- package/fonts/tangerine/svg/upper_R.tsx +14 -0
- package/fonts/tangerine/svg/upper_S.svg +7 -0
- package/fonts/tangerine/svg/upper_S.tsx +9 -0
- package/fonts/tangerine/svg/upper_T.svg +7 -0
- package/fonts/tangerine/svg/upper_T.tsx +9 -0
- package/fonts/tangerine/svg/upper_U.svg +12 -0
- package/fonts/tangerine/svg/upper_U.tsx +14 -0
- package/fonts/tangerine/svg/upper_V.svg +12 -0
- package/fonts/tangerine/svg/upper_V.tsx +14 -0
- package/fonts/tangerine/svg/upper_W.svg +17 -0
- package/fonts/tangerine/svg/upper_W.tsx +19 -0
- package/fonts/tangerine/svg/upper_X.svg +12 -0
- package/fonts/tangerine/svg/upper_X.tsx +14 -0
- package/fonts/tangerine/svg/upper_Y.svg +12 -0
- package/fonts/tangerine/svg/upper_Y.tsx +14 -0
- package/fonts/tangerine/svg/upper_Z.svg +17 -0
- package/fonts/tangerine/svg/upper_Z.tsx +19 -0
- package/fonts/tangerine/svg/v.svg +12 -0
- package/fonts/tangerine/svg/v.tsx +14 -0
- package/fonts/tangerine/svg/w.svg +25 -0
- package/fonts/tangerine/svg/w.tsx +27 -0
- package/fonts/tangerine/svg/x.svg +17 -0
- package/fonts/tangerine/svg/x.tsx +19 -0
- package/fonts/tangerine/svg/y.svg +12 -0
- package/fonts/tangerine/svg/y.tsx +14 -0
- package/fonts/tangerine/svg/z.svg +20 -0
- package/fonts/tangerine/svg/z.tsx +22 -0
- package/fonts/tangerine/tangerine.ttf +0 -0
- package/package.json +64 -6
- package/src/env.d.ts +10 -0
- package/src/index.ts +10 -0
- package/src/lib/TegakiRenderer.tsx +589 -0
- package/src/lib/drawFallbackGlyph.ts +70 -0
- package/src/lib/drawGlyph.ts +374 -0
- package/src/lib/effects.ts +56 -0
- package/src/lib/textLayout.ts +114 -0
- package/src/lib/timeline.ts +65 -0
- package/src/lib/utils.ts +22 -0
- package/src/types.test.ts +92 -0
- package/src/types.ts +114 -0
- package/index.js +0 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,900 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { layoutWithLines, prepareWithSegments } from "@chenglou/pretext";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/lib/effects.ts
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes an effects record into a sorted array of resolved effects.
|
|
7
|
+
* Known keys infer the effect name; custom keys read it from the `effect` field.
|
|
8
|
+
* Boolean `true` becomes an empty config. `false`/absent entries are skipped.
|
|
9
|
+
*/
|
|
10
|
+
function resolveEffects(effects) {
|
|
11
|
+
if (!effects) return [];
|
|
12
|
+
const knownEffects = new Set([
|
|
13
|
+
"glow",
|
|
14
|
+
"wobble",
|
|
15
|
+
"pressureWidth",
|
|
16
|
+
"taper",
|
|
17
|
+
"gradient"
|
|
18
|
+
]);
|
|
19
|
+
const result = [];
|
|
20
|
+
for (const [key, value] of Object.entries(effects)) {
|
|
21
|
+
if (value === false || value == null) continue;
|
|
22
|
+
let effectName;
|
|
23
|
+
let config;
|
|
24
|
+
let order;
|
|
25
|
+
if (value === true) {
|
|
26
|
+
effectName = knownEffects.has(key) ? key : void 0;
|
|
27
|
+
if (!effectName) continue;
|
|
28
|
+
config = {};
|
|
29
|
+
order = 0;
|
|
30
|
+
} else {
|
|
31
|
+
if (value.enabled === false) continue;
|
|
32
|
+
effectName = value.effect ?? (knownEffects.has(key) ? key : void 0);
|
|
33
|
+
if (!effectName) continue;
|
|
34
|
+
const { effect: _, order: o, enabled: __, ...rest } = value;
|
|
35
|
+
config = rest;
|
|
36
|
+
order = o ?? 0;
|
|
37
|
+
}
|
|
38
|
+
result.push({
|
|
39
|
+
effect: effectName,
|
|
40
|
+
order,
|
|
41
|
+
config
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
result.sort((a, b) => a.order - b.order);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/** Check if a specific effect is active. */
|
|
48
|
+
function findEffect(effects, name) {
|
|
49
|
+
return effects.find((e) => e.effect === name);
|
|
50
|
+
}
|
|
51
|
+
/** Get all instances of a specific effect (for duplicates). */
|
|
52
|
+
function findEffects(effects, name) {
|
|
53
|
+
return effects.filter((e) => e.effect === name);
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/lib/utils.ts
|
|
57
|
+
const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
58
|
+
/** Resolve a CSSLength to pixels. Plain numbers are px, `"Nem"` is N * fontSize. */
|
|
59
|
+
function resolveCSSLength(value, fontSize) {
|
|
60
|
+
if (typeof value === "number") return value;
|
|
61
|
+
return parseFloat(value) * fontSize;
|
|
62
|
+
}
|
|
63
|
+
function graphemes(text) {
|
|
64
|
+
return Array.from(segmenter.segment(text), (s) => s.segment);
|
|
65
|
+
}
|
|
66
|
+
function coerceToString(value) {
|
|
67
|
+
if (value == null || typeof value === "boolean") return "";
|
|
68
|
+
if (typeof value === "string") return value;
|
|
69
|
+
if (typeof value === "number" || typeof value === "bigint") return String(value);
|
|
70
|
+
if (Array.isArray(value)) return value.map(coerceToString).join("");
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/lib/drawGlyph.ts
|
|
75
|
+
function parseColor(color) {
|
|
76
|
+
const h = color.replace("#", "");
|
|
77
|
+
if (h.length === 3) return [
|
|
78
|
+
parseInt(h[0] + h[0], 16),
|
|
79
|
+
parseInt(h[1] + h[1], 16),
|
|
80
|
+
parseInt(h[2] + h[2], 16),
|
|
81
|
+
1
|
|
82
|
+
];
|
|
83
|
+
if (h.length === 4) return [
|
|
84
|
+
parseInt(h[0] + h[0], 16),
|
|
85
|
+
parseInt(h[1] + h[1], 16),
|
|
86
|
+
parseInt(h[2] + h[2], 16),
|
|
87
|
+
parseInt(h[3] + h[3], 16) / 255
|
|
88
|
+
];
|
|
89
|
+
if (h.length === 8) return [
|
|
90
|
+
parseInt(h.slice(0, 2), 16),
|
|
91
|
+
parseInt(h.slice(2, 4), 16),
|
|
92
|
+
parseInt(h.slice(4, 6), 16),
|
|
93
|
+
parseInt(h.slice(6, 8), 16) / 255
|
|
94
|
+
];
|
|
95
|
+
return [
|
|
96
|
+
parseInt(h.slice(0, 2), 16),
|
|
97
|
+
parseInt(h.slice(2, 4), 16),
|
|
98
|
+
parseInt(h.slice(4, 6), 16),
|
|
99
|
+
1
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
function lerpColor(a, b, t) {
|
|
103
|
+
const r = Math.round(a[0] + (b[0] - a[0]) * t);
|
|
104
|
+
const g = Math.round(a[1] + (b[1] - a[1]) * t);
|
|
105
|
+
const bl = Math.round(a[2] + (b[2] - a[2]) * t);
|
|
106
|
+
const al = a[3] + (b[3] - a[3]) * t;
|
|
107
|
+
if (al >= 1) return `rgb(${r},${g},${bl})`;
|
|
108
|
+
return `rgba(${r},${g},${bl},${al.toFixed(3)})`;
|
|
109
|
+
}
|
|
110
|
+
function gradientColor(progress, colors, seed) {
|
|
111
|
+
if (colors.length === 0) return "#000";
|
|
112
|
+
if (colors.length === 1) return colors[0];
|
|
113
|
+
const scaledT = ((progress + seed * .1) % 1 + 1) % 1 * (colors.length - 1);
|
|
114
|
+
const i = Math.min(Math.floor(scaledT), colors.length - 2);
|
|
115
|
+
const frac = scaledT - i;
|
|
116
|
+
return lerpColor(parseColor(colors[i]), parseColor(colors[i + 1]), frac);
|
|
117
|
+
}
|
|
118
|
+
function rainbowColor(progress, saturation, lightness, seed) {
|
|
119
|
+
return `hsl(${(progress * 360 + seed * 137.5) % 360}, ${saturation}%, ${lightness}%)`;
|
|
120
|
+
}
|
|
121
|
+
function hash(x) {
|
|
122
|
+
let h = x * 2654435761 | 0;
|
|
123
|
+
h = (h >>> 16 ^ h) * 73244475;
|
|
124
|
+
h = (h >>> 16 ^ h) * 73244475;
|
|
125
|
+
h = h >>> 16 ^ h;
|
|
126
|
+
return (h & 2147483647) / 2147483647;
|
|
127
|
+
}
|
|
128
|
+
function noise1d(x, seed) {
|
|
129
|
+
const i = Math.floor(x);
|
|
130
|
+
const f = x - i;
|
|
131
|
+
const t = f * f * (3 - 2 * f);
|
|
132
|
+
return hash(i + seed * 7919) * (1 - t) + hash(i + 1 + seed * 7919) * t;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Draw a single glyph's strokes onto a canvas context, animated up to `localTime`.
|
|
136
|
+
* `localTime` is seconds relative to this glyph's start (0 = glyph begins).
|
|
137
|
+
*/
|
|
138
|
+
function drawGlyph(ctx, glyph, pos, localTime, lineCap, color, effects = [], seed = 0, segmentSize) {
|
|
139
|
+
const scale = pos.fontSize / pos.unitsPerEm;
|
|
140
|
+
const ox = pos.x;
|
|
141
|
+
const oy = pos.y;
|
|
142
|
+
const glowEffects = findEffects(effects, "glow");
|
|
143
|
+
const wobbleEffect = findEffect(effects, "wobble");
|
|
144
|
+
const pressureEffect = findEffect(effects, "pressureWidth");
|
|
145
|
+
const taperEffect = findEffect(effects, "taper");
|
|
146
|
+
const gradientEffect = findEffect(effects, "gradient");
|
|
147
|
+
const pressureAmount = pressureEffect ? Math.max(0, Math.min(pressureEffect.config.strength ?? 1, 1)) : 0;
|
|
148
|
+
const wobbleAmplitude = wobbleEffect ? wobbleEffect.config.amplitude ?? 1.5 : 0;
|
|
149
|
+
const wobbleFrequency = wobbleEffect ? wobbleEffect.config.frequency ?? 8 : 0;
|
|
150
|
+
const wobbleMode = wobbleEffect?.config.mode ?? "sine";
|
|
151
|
+
const taperStart = taperEffect ? Math.max(0, Math.min(taperEffect.config.startLength ?? .15, 1)) : 0;
|
|
152
|
+
const taperEnd = taperEffect ? Math.max(0, Math.min(taperEffect.config.endLength ?? .15, 1)) : 0;
|
|
153
|
+
const gradientColors = gradientEffect?.config.colors;
|
|
154
|
+
const isRainbow = gradientColors === "rainbow";
|
|
155
|
+
const gradientColorStops = Array.isArray(gradientColors) ? gradientColors : void 0;
|
|
156
|
+
const gradientSaturation = gradientEffect?.config.saturation ?? 80;
|
|
157
|
+
const gradientLightness = gradientEffect?.config.lightness ?? 55;
|
|
158
|
+
const wobbleX = (x, y, idx) => {
|
|
159
|
+
if (!wobbleEffect) return x;
|
|
160
|
+
if (wobbleMode === "noise") return x + wobbleAmplitude * (noise1d(y * .1 + idx * .7, seed) * 2 - 1);
|
|
161
|
+
return x + wobbleAmplitude * Math.sin(wobbleFrequency * (y * .01 + idx * .7) + seed);
|
|
162
|
+
};
|
|
163
|
+
const wobbleY = (x, y, idx) => {
|
|
164
|
+
if (!wobbleEffect) return y;
|
|
165
|
+
if (wobbleMode === "noise") return y + wobbleAmplitude * (noise1d(x * .1 + idx * .5, seed * 1.3 + 1e3) * 2 - 1);
|
|
166
|
+
return y + wobbleAmplitude * Math.cos(wobbleFrequency * (x * .01 + idx * .5) + seed * 1.3);
|
|
167
|
+
};
|
|
168
|
+
const px = (x) => ox + x * scale;
|
|
169
|
+
const py = (y) => oy + (y + pos.ascender) * scale;
|
|
170
|
+
const colorAt = (progress) => {
|
|
171
|
+
if (isRainbow) return rainbowColor(progress, gradientSaturation, gradientLightness, seed);
|
|
172
|
+
if (gradientColorStops) return gradientColor(progress, gradientColorStops, seed);
|
|
173
|
+
return color;
|
|
174
|
+
};
|
|
175
|
+
const hasGradient = !!gradientEffect;
|
|
176
|
+
const taperMultiplier = (progress) => {
|
|
177
|
+
let m = 1;
|
|
178
|
+
if (taperStart > 0 && progress < taperStart) m = Math.min(m, progress / taperStart);
|
|
179
|
+
if (taperEnd > 0 && progress > 1 - taperEnd) m = Math.min(m, (1 - progress) / taperEnd);
|
|
180
|
+
return m;
|
|
181
|
+
};
|
|
182
|
+
for (const stroke of glyph.strokes) {
|
|
183
|
+
if (localTime < stroke.delay) continue;
|
|
184
|
+
const elapsed = localTime - stroke.delay;
|
|
185
|
+
const progress = Math.min(elapsed / stroke.animationDuration, 1);
|
|
186
|
+
const pts = stroke.points;
|
|
187
|
+
if (pts.length === 0) continue;
|
|
188
|
+
const avgWidth = pts.reduce((s, p) => s + p.width, 0) / pts.length;
|
|
189
|
+
const baseLineWidth = Math.max(avgWidth, .5) * scale;
|
|
190
|
+
if (pts.length === 1) {
|
|
191
|
+
if (progress <= 0) continue;
|
|
192
|
+
const p = pts[0];
|
|
193
|
+
const dotX = px(wobbleX(p.x, p.y, 0));
|
|
194
|
+
const dotY = py(wobbleY(p.x, p.y, 0));
|
|
195
|
+
let dotWidth = baseLineWidth + (Math.max(p.width, .5) * scale - baseLineWidth) * pressureAmount;
|
|
196
|
+
dotWidth *= taperMultiplier(.5);
|
|
197
|
+
for (const glow of glowEffects) {
|
|
198
|
+
ctx.save();
|
|
199
|
+
ctx.shadowBlur = resolveCSSLength(glow.config.radius ?? 8, pos.fontSize);
|
|
200
|
+
ctx.shadowColor = glow.config.color ?? color;
|
|
201
|
+
ctx.shadowOffsetX = (glow.config.offsetX ?? 0) * scale;
|
|
202
|
+
ctx.shadowOffsetY = (glow.config.offsetY ?? 0) * scale;
|
|
203
|
+
ctx.fillStyle = glow.config.color ?? color;
|
|
204
|
+
ctx.beginPath();
|
|
205
|
+
if (lineCap === "round") ctx.arc(dotX, dotY, dotWidth / 2, 0, Math.PI * 2);
|
|
206
|
+
else ctx.rect(dotX - dotWidth / 2, dotY - dotWidth / 2, dotWidth, dotWidth);
|
|
207
|
+
ctx.fill();
|
|
208
|
+
ctx.restore();
|
|
209
|
+
}
|
|
210
|
+
ctx.fillStyle = colorAt(0);
|
|
211
|
+
ctx.beginPath();
|
|
212
|
+
if (lineCap === "round") {
|
|
213
|
+
ctx.arc(dotX, dotY, dotWidth / 2, 0, Math.PI * 2);
|
|
214
|
+
ctx.fill();
|
|
215
|
+
} else ctx.fillRect(dotX - dotWidth / 2, dotY - dotWidth / 2, dotWidth, dotWidth);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
let totalLen = 0;
|
|
219
|
+
for (let j = 1; j < pts.length; j++) {
|
|
220
|
+
const dx = pts[j].x - pts[j - 1].x;
|
|
221
|
+
const dy = pts[j].y - pts[j - 1].y;
|
|
222
|
+
totalLen += Math.sqrt(dx * dx + dy * dy);
|
|
223
|
+
}
|
|
224
|
+
const drawLen = totalLen * progress;
|
|
225
|
+
if (drawLen <= 0) continue;
|
|
226
|
+
const segments = [];
|
|
227
|
+
let accumulated = 0;
|
|
228
|
+
for (let j = 1; j < pts.length; j++) {
|
|
229
|
+
const prev = pts[j - 1];
|
|
230
|
+
const cur = pts[j];
|
|
231
|
+
const dx = cur.x - prev.x;
|
|
232
|
+
const dy = cur.y - prev.y;
|
|
233
|
+
const segLen = Math.sqrt(dx * dx + dy * dy);
|
|
234
|
+
if (accumulated + segLen <= drawLen) {
|
|
235
|
+
segments.push({
|
|
236
|
+
x0: px(wobbleX(prev.x, prev.y, j - 1)),
|
|
237
|
+
y0: py(wobbleY(prev.x, prev.y, j - 1)),
|
|
238
|
+
x1: px(wobbleX(cur.x, cur.y, j)),
|
|
239
|
+
y1: py(wobbleY(cur.x, cur.y, j)),
|
|
240
|
+
width0: prev.width,
|
|
241
|
+
width1: cur.width,
|
|
242
|
+
segProgress: (accumulated + segLen / 2) / totalLen
|
|
243
|
+
});
|
|
244
|
+
accumulated += segLen;
|
|
245
|
+
} else {
|
|
246
|
+
const remaining = drawLen - accumulated;
|
|
247
|
+
const frac = segLen > 0 ? remaining / segLen : 0;
|
|
248
|
+
const ix = prev.x + dx * frac;
|
|
249
|
+
const iy = prev.y + dy * frac;
|
|
250
|
+
const iw = prev.width + (cur.width - prev.width) * frac;
|
|
251
|
+
segments.push({
|
|
252
|
+
x0: px(wobbleX(prev.x, prev.y, j - 1)),
|
|
253
|
+
y0: py(wobbleY(prev.x, prev.y, j - 1)),
|
|
254
|
+
x1: px(wobbleX(ix, iy, j)),
|
|
255
|
+
y1: py(wobbleY(ix, iy, j)),
|
|
256
|
+
width0: prev.width,
|
|
257
|
+
width1: iw,
|
|
258
|
+
segProgress: (accumulated + remaining / 2) / totalLen
|
|
259
|
+
});
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (segments.length === 0) continue;
|
|
264
|
+
const coarseSegments = segments.slice();
|
|
265
|
+
const resolvedSegmentSize = segmentSize ?? (pressureAmount > 0 || hasGradient || !!wobbleEffect || !!taperEffect ? 2 : void 0);
|
|
266
|
+
if (resolvedSegmentSize != null) {
|
|
267
|
+
const maxSegLen = resolvedSegmentSize * scale;
|
|
268
|
+
const subdivided = [];
|
|
269
|
+
for (const seg of segments) {
|
|
270
|
+
const dx = seg.x1 - seg.x0;
|
|
271
|
+
const dy = seg.y1 - seg.y0;
|
|
272
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
273
|
+
const count = Math.max(1, Math.ceil(len / maxSegLen));
|
|
274
|
+
for (let k = 0; k < count; k++) {
|
|
275
|
+
const t0 = k / count;
|
|
276
|
+
const t1 = (k + 1) / count;
|
|
277
|
+
subdivided.push({
|
|
278
|
+
x0: seg.x0 + dx * t0,
|
|
279
|
+
y0: seg.y0 + dy * t0,
|
|
280
|
+
x1: seg.x0 + dx * t1,
|
|
281
|
+
y1: seg.y0 + dy * t1,
|
|
282
|
+
width0: seg.width0 + (seg.width1 - seg.width0) * t0,
|
|
283
|
+
width1: seg.width0 + (seg.width1 - seg.width0) * t1,
|
|
284
|
+
segProgress: seg.segProgress
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
for (let k = 0; k < subdivided.length; k++) subdivided[k].segProgress = subdivided.length > 1 ? k / (subdivided.length - 1) : 0;
|
|
289
|
+
segments.length = 0;
|
|
290
|
+
segments.push(...subdivided);
|
|
291
|
+
}
|
|
292
|
+
const segWidth = (seg) => {
|
|
293
|
+
const perPoint = (seg.width0 + seg.width1) / 2 * scale;
|
|
294
|
+
return Math.max(baseLineWidth + (perPoint - baseLineWidth) * pressureAmount, .5 * scale) * taperMultiplier(seg.segProgress);
|
|
295
|
+
};
|
|
296
|
+
const needsPerSegment = pressureAmount > 0 || taperEffect;
|
|
297
|
+
const drawStrokePath = () => {
|
|
298
|
+
if (needsPerSegment) for (const seg of segments) {
|
|
299
|
+
ctx.lineWidth = segWidth(seg);
|
|
300
|
+
ctx.beginPath();
|
|
301
|
+
ctx.moveTo(seg.x0, seg.y0);
|
|
302
|
+
ctx.lineTo(seg.x1, seg.y1);
|
|
303
|
+
ctx.stroke();
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
ctx.lineWidth = baseLineWidth;
|
|
307
|
+
ctx.beginPath();
|
|
308
|
+
ctx.moveTo(segments[0].x0, segments[0].y0);
|
|
309
|
+
for (const seg of segments) ctx.lineTo(seg.x1, seg.y1);
|
|
310
|
+
ctx.stroke();
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
const drawGradientPath = () => {
|
|
314
|
+
for (const seg of segments) {
|
|
315
|
+
ctx.strokeStyle = colorAt(seg.segProgress);
|
|
316
|
+
if (needsPerSegment) ctx.lineWidth = segWidth(seg);
|
|
317
|
+
ctx.beginPath();
|
|
318
|
+
ctx.moveTo(seg.x0, seg.y0);
|
|
319
|
+
ctx.lineTo(seg.x1, seg.y1);
|
|
320
|
+
ctx.stroke();
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
ctx.lineCap = lineCap;
|
|
324
|
+
ctx.lineJoin = "round";
|
|
325
|
+
for (const glow of glowEffects) {
|
|
326
|
+
ctx.save();
|
|
327
|
+
ctx.shadowBlur = resolveCSSLength(glow.config.radius ?? 8, pos.fontSize);
|
|
328
|
+
ctx.shadowColor = glow.config.color ?? color;
|
|
329
|
+
ctx.shadowOffsetX = (glow.config.offsetX ?? 0) * scale;
|
|
330
|
+
ctx.shadowOffsetY = (glow.config.offsetY ?? 0) * scale;
|
|
331
|
+
ctx.strokeStyle = glow.config.color ?? color;
|
|
332
|
+
ctx.lineWidth = baseLineWidth;
|
|
333
|
+
ctx.beginPath();
|
|
334
|
+
ctx.moveTo(coarseSegments[0].x0, coarseSegments[0].y0);
|
|
335
|
+
for (const seg of coarseSegments) ctx.lineTo(seg.x1, seg.y1);
|
|
336
|
+
ctx.stroke();
|
|
337
|
+
ctx.restore();
|
|
338
|
+
}
|
|
339
|
+
if (hasGradient) drawGradientPath();
|
|
340
|
+
else {
|
|
341
|
+
ctx.strokeStyle = color;
|
|
342
|
+
drawStrokePath();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/lib/drawFallbackGlyph.ts
|
|
348
|
+
/**
|
|
349
|
+
* Draw a fallback glyph (plain text) with applicable effects (glow, gradient, wobble).
|
|
350
|
+
*/
|
|
351
|
+
function drawFallbackGlyph(ctx, char, x, baseline, fontSize, fontFamily, color, effects = [], seed = 0) {
|
|
352
|
+
const glowEffects = findEffects(effects, "glow");
|
|
353
|
+
const wobbleEffect = findEffect(effects, "wobble");
|
|
354
|
+
const gradientEffect = findEffect(effects, "gradient");
|
|
355
|
+
let dx = 0;
|
|
356
|
+
let dy = 0;
|
|
357
|
+
if (wobbleEffect) {
|
|
358
|
+
const amplitude = (wobbleEffect.config.amplitude ?? 1.5) * (fontSize / 100);
|
|
359
|
+
const frequency = wobbleEffect.config.frequency ?? 8;
|
|
360
|
+
dx = amplitude * Math.sin(frequency * (baseline * .01) + seed);
|
|
361
|
+
dy = amplitude * Math.cos(frequency * (x * .01) + seed * 1.3);
|
|
362
|
+
}
|
|
363
|
+
const drawX = x + dx;
|
|
364
|
+
const drawY = baseline + dy;
|
|
365
|
+
let fillColor = color;
|
|
366
|
+
if (gradientEffect) {
|
|
367
|
+
const colors = gradientEffect.config.colors;
|
|
368
|
+
if (colors === "rainbow") {
|
|
369
|
+
const saturation = gradientEffect.config.saturation ?? 80;
|
|
370
|
+
const lightness = gradientEffect.config.lightness ?? 55;
|
|
371
|
+
fillColor = `hsl(${seed * 137.5 % 360}, ${saturation}%, ${lightness}%)`;
|
|
372
|
+
} else if (Array.isArray(colors) && colors.length > 0) fillColor = colors[Math.floor(seed) % colors.length];
|
|
373
|
+
}
|
|
374
|
+
ctx.save();
|
|
375
|
+
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
376
|
+
ctx.textBaseline = "alphabetic";
|
|
377
|
+
for (const glow of glowEffects) {
|
|
378
|
+
ctx.save();
|
|
379
|
+
ctx.shadowBlur = resolveCSSLength(glow.config.radius ?? 8, fontSize);
|
|
380
|
+
ctx.shadowColor = glow.config.color ?? color;
|
|
381
|
+
ctx.shadowOffsetX = glow.config.offsetX ?? 0;
|
|
382
|
+
ctx.shadowOffsetY = glow.config.offsetY ?? 0;
|
|
383
|
+
ctx.fillStyle = glow.config.color ?? color;
|
|
384
|
+
ctx.fillText(char, drawX, drawY);
|
|
385
|
+
ctx.restore();
|
|
386
|
+
}
|
|
387
|
+
ctx.fillStyle = fillColor;
|
|
388
|
+
ctx.fillText(char, drawX, drawY);
|
|
389
|
+
ctx.restore();
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/lib/textLayout.ts
|
|
393
|
+
function computeTextLayout(text, fontFamily, fontSize, lineHeight, maxWidth) {
|
|
394
|
+
const fontStr = `${fontSize}px ${fontFamily}`;
|
|
395
|
+
const chars = graphemes(text);
|
|
396
|
+
const widthCache = /* @__PURE__ */ new Map();
|
|
397
|
+
const charWidths = [];
|
|
398
|
+
for (const char of chars) {
|
|
399
|
+
let w = widthCache.get(char);
|
|
400
|
+
if (w === void 0) {
|
|
401
|
+
if (char === "\n") w = 0;
|
|
402
|
+
else {
|
|
403
|
+
const r = layoutWithLines(prepareWithSegments(char, fontStr, { whiteSpace: "pre-wrap" }), Infinity, lineHeight);
|
|
404
|
+
w = r.lines.length > 0 ? r.lines[0].width / fontSize : 0;
|
|
405
|
+
}
|
|
406
|
+
widthCache.set(char, w);
|
|
407
|
+
}
|
|
408
|
+
charWidths.push(w);
|
|
409
|
+
}
|
|
410
|
+
const prepared = prepareWithSegments(text, fontStr, { whiteSpace: "pre-wrap" });
|
|
411
|
+
const singleLineResult = layoutWithLines(prepared, Infinity, lineHeight);
|
|
412
|
+
const intrinsicWidth = Math.max(0, ...singleLineResult.lines.map((l) => l.width)) / fontSize;
|
|
413
|
+
const result = layoutWithLines(prepared, maxWidth, lineHeight);
|
|
414
|
+
const utf16ToCodePoint = [];
|
|
415
|
+
for (let ci = 0; ci < chars.length; ci++) for (let j = 0; j < chars[ci].length; j++) utf16ToCodePoint.push(ci);
|
|
416
|
+
const lines = [];
|
|
417
|
+
let utf16Offset = 0;
|
|
418
|
+
for (const line of result.lines) {
|
|
419
|
+
const indices = [];
|
|
420
|
+
const seen = /* @__PURE__ */ new Set();
|
|
421
|
+
for (let i = 0; i < line.text.length; i++) {
|
|
422
|
+
const cpIdx = utf16ToCodePoint[utf16Offset + i];
|
|
423
|
+
if (!seen.has(cpIdx)) {
|
|
424
|
+
seen.add(cpIdx);
|
|
425
|
+
indices.push(cpIdx);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
utf16Offset += line.text.length;
|
|
429
|
+
if (utf16Offset < text.length && text[utf16Offset] === "\n") {
|
|
430
|
+
const cpIdx = utf16ToCodePoint[utf16Offset];
|
|
431
|
+
indices.push(cpIdx);
|
|
432
|
+
utf16Offset++;
|
|
433
|
+
}
|
|
434
|
+
lines.push(indices);
|
|
435
|
+
}
|
|
436
|
+
if (utf16Offset < text.length) {
|
|
437
|
+
const indices = [];
|
|
438
|
+
const seen = /* @__PURE__ */ new Set();
|
|
439
|
+
for (let i = utf16Offset; i < text.length; i++) {
|
|
440
|
+
const cpIdx = utf16ToCodePoint[i];
|
|
441
|
+
if (!seen.has(cpIdx)) {
|
|
442
|
+
seen.add(cpIdx);
|
|
443
|
+
indices.push(cpIdx);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
lines.push(indices);
|
|
447
|
+
}
|
|
448
|
+
const kernings = [];
|
|
449
|
+
const pairCache = /* @__PURE__ */ new Map();
|
|
450
|
+
for (let i = 0; i < chars.length - 1; i++) {
|
|
451
|
+
const a = chars[i];
|
|
452
|
+
const b = chars[i + 1];
|
|
453
|
+
if (a === "\n" || b === "\n") {
|
|
454
|
+
kernings.push(0);
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const pair = `${a}${b}`;
|
|
458
|
+
let k = pairCache.get(pair);
|
|
459
|
+
if (k === void 0) {
|
|
460
|
+
const r = layoutWithLines(prepareWithSegments(pair, fontStr, { whiteSpace: "pre-wrap" }), Infinity, lineHeight);
|
|
461
|
+
k = (r.lines.length > 0 ? r.lines[0].width / fontSize : 0) - (widthCache.get(a) ?? 0) - (widthCache.get(b) ?? 0);
|
|
462
|
+
if (Math.abs(k) < .001) k = 0;
|
|
463
|
+
pairCache.set(pair, k);
|
|
464
|
+
}
|
|
465
|
+
kernings.push(k);
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
lines,
|
|
469
|
+
charWidths,
|
|
470
|
+
kernings,
|
|
471
|
+
intrinsicWidth
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/lib/timeline.ts
|
|
476
|
+
const DEFAULTS = {
|
|
477
|
+
glyphGap: .1,
|
|
478
|
+
wordGap: .15,
|
|
479
|
+
lineGap: .3,
|
|
480
|
+
unknownDuration: .2
|
|
481
|
+
};
|
|
482
|
+
function computeTimeline(text, font, config) {
|
|
483
|
+
const glyphGap = config?.glyphGap ?? DEFAULTS.glyphGap;
|
|
484
|
+
const wordGap = config?.wordGap ?? DEFAULTS.wordGap;
|
|
485
|
+
const lineGap = config?.lineGap ?? DEFAULTS.lineGap;
|
|
486
|
+
const unknownDuration = config?.unknownDuration ?? DEFAULTS.unknownDuration;
|
|
487
|
+
const chars = graphemes(text);
|
|
488
|
+
const entries = [];
|
|
489
|
+
let offset = 0;
|
|
490
|
+
for (const char of chars) {
|
|
491
|
+
const hasSvg = char in font.glyphs;
|
|
492
|
+
const duration = hasSvg ? font.glyphTimings[char] ?? 1 : unknownDuration;
|
|
493
|
+
entries.push({
|
|
494
|
+
char,
|
|
495
|
+
offset,
|
|
496
|
+
duration,
|
|
497
|
+
hasSvg
|
|
498
|
+
});
|
|
499
|
+
offset += duration;
|
|
500
|
+
if (char === "\n") offset += lineGap;
|
|
501
|
+
else if (char === " ") offset += wordGap;
|
|
502
|
+
else offset += glyphGap;
|
|
503
|
+
}
|
|
504
|
+
if (entries.length > 0) {
|
|
505
|
+
const lastChar = chars[chars.length - 1];
|
|
506
|
+
offset -= lastChar === "\n" ? lineGap : lastChar === " " ? wordGap : glyphGap;
|
|
507
|
+
}
|
|
508
|
+
return {
|
|
509
|
+
entries,
|
|
510
|
+
totalDuration: Math.max(0, offset)
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/lib/TegakiRenderer.tsx
|
|
515
|
+
const PADDING_H_EM = .2;
|
|
516
|
+
const MIN_LINE_HEIGHT_EM = 1.8;
|
|
517
|
+
const MIN_PADDING_V_EM = .2;
|
|
518
|
+
const CSS_TIME = "--tegaki-time";
|
|
519
|
+
const CSS_PROGRESS = "--tegaki-progress";
|
|
520
|
+
const CSS_DURATION = "--tegaki-duration";
|
|
521
|
+
if (typeof CSS !== "undefined" && "registerProperty" in CSS) for (const prop of [
|
|
522
|
+
CSS_TIME,
|
|
523
|
+
CSS_PROGRESS,
|
|
524
|
+
CSS_DURATION
|
|
525
|
+
]) try {
|
|
526
|
+
CSS.registerProperty({
|
|
527
|
+
name: prop,
|
|
528
|
+
syntax: "<number>",
|
|
529
|
+
inherits: true,
|
|
530
|
+
initialValue: "0"
|
|
531
|
+
});
|
|
532
|
+
} catch {}
|
|
533
|
+
function TegakiRenderer({ font, text, children, time: timeProp, onComplete, mode = "canvas", effects, segmentSize, timing, showOverlay, ...props }) {
|
|
534
|
+
const resolvedText = text ?? coerceToString(children);
|
|
535
|
+
const resolvedEffects = useMemo(() => resolveEffects(effects), [effects]);
|
|
536
|
+
const [seed] = useState(() => Math.random() * 1e3);
|
|
537
|
+
const timeControl = timeProp == null ? { mode: "uncontrolled" } : typeof timeProp === "number" ? {
|
|
538
|
+
mode: "controlled",
|
|
539
|
+
value: timeProp
|
|
540
|
+
} : timeProp === "css" ? { mode: "css" } : timeProp;
|
|
541
|
+
const isCss = timeControl.mode === "css";
|
|
542
|
+
const isControlled = timeControl.mode === "controlled" || isCss;
|
|
543
|
+
const controlledTime = timeControl.mode === "controlled" ? timeControl.value : void 0;
|
|
544
|
+
const defaultTime = timeControl.mode === "uncontrolled" ? timeControl.initialTime ?? 0 : 0;
|
|
545
|
+
const speed = timeControl.mode === "uncontrolled" ? timeControl.speed ?? 1 : 1;
|
|
546
|
+
const playing = timeControl.mode === "uncontrolled" ? timeControl.playing ?? true : false;
|
|
547
|
+
const loop = timeControl.mode === "uncontrolled" ? timeControl.loop ?? false : false;
|
|
548
|
+
const catchUp = timeControl.mode === "uncontrolled" ? timeControl.catchUp ?? 0 : 0;
|
|
549
|
+
const onTimeChange = timeControl.mode === "uncontrolled" ? timeControl.onTimeChange : void 0;
|
|
550
|
+
const [internalTime, setInternalTime] = useState(defaultTime);
|
|
551
|
+
const [cssTime, setCssTime] = useState(0);
|
|
552
|
+
const currentTime = isCss ? cssTime : isControlled ? controlledTime : internalTime;
|
|
553
|
+
const onTimeChangeRef = useRef(onTimeChange);
|
|
554
|
+
onTimeChangeRef.current = onTimeChange;
|
|
555
|
+
const onCompleteRef = useRef(onComplete);
|
|
556
|
+
onCompleteRef.current = onComplete;
|
|
557
|
+
const fontFamily = font?.family;
|
|
558
|
+
const emHeight = font ? (font.ascender - font.descender) / font.unitsPerEm : 0;
|
|
559
|
+
const baselineOffset = font ? font.descender / font.unitsPerEm : 0;
|
|
560
|
+
const rootRef = useRef(null);
|
|
561
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
562
|
+
const [fontSize, setFontSize] = useState(0);
|
|
563
|
+
const [lineHeight, setLineHeight] = useState(0);
|
|
564
|
+
const timeline = useMemo(() => font && resolvedText ? computeTimeline(resolvedText, font, timing) : {
|
|
565
|
+
entries: [],
|
|
566
|
+
totalDuration: 0
|
|
567
|
+
}, [
|
|
568
|
+
resolvedText,
|
|
569
|
+
font,
|
|
570
|
+
timing
|
|
571
|
+
]);
|
|
572
|
+
const totalDurationRef = useRef(timeline.totalDuration);
|
|
573
|
+
totalDurationRef.current = timeline.totalDuration;
|
|
574
|
+
const smoothedBoostRef = useRef(0);
|
|
575
|
+
const prevCompletedRef = useRef(false);
|
|
576
|
+
const isComplete = timeline.totalDuration > 0 && currentTime >= timeline.totalDuration;
|
|
577
|
+
useEffect(() => {
|
|
578
|
+
if (isComplete && !prevCompletedRef.current) {
|
|
579
|
+
prevCompletedRef.current = true;
|
|
580
|
+
onCompleteRef.current?.();
|
|
581
|
+
} else if (!isComplete) prevCompletedRef.current = false;
|
|
582
|
+
});
|
|
583
|
+
useEffect(() => {
|
|
584
|
+
if (!isControlled) onTimeChangeRef.current?.(internalTime);
|
|
585
|
+
}, [internalTime, isControlled]);
|
|
586
|
+
useEffect(() => {
|
|
587
|
+
if (isControlled || !playing || !font) return;
|
|
588
|
+
smoothedBoostRef.current = 0;
|
|
589
|
+
let lastTs = null;
|
|
590
|
+
let raf;
|
|
591
|
+
const attackRate = 4;
|
|
592
|
+
const releaseRate = loop ? 30 : 2;
|
|
593
|
+
const tick = (ts) => {
|
|
594
|
+
if (lastTs === null) lastTs = ts;
|
|
595
|
+
const dtSec = (ts - lastTs) / 1e3;
|
|
596
|
+
lastTs = ts;
|
|
597
|
+
setInternalTime((prev) => {
|
|
598
|
+
const totalDur = totalDurationRef.current;
|
|
599
|
+
if (totalDur === 0 || !loop && prev >= totalDur) return totalDur;
|
|
600
|
+
let effectiveSpeed = speed;
|
|
601
|
+
if (catchUp > 0) {
|
|
602
|
+
const remaining = Math.max(0, totalDur - prev);
|
|
603
|
+
const targetBoost = catchUp * Math.max(0, remaining - 2);
|
|
604
|
+
const rate = targetBoost > smoothedBoostRef.current ? attackRate : releaseRate;
|
|
605
|
+
smoothedBoostRef.current += (targetBoost - smoothedBoostRef.current) * (1 - Math.exp(-rate * dtSec));
|
|
606
|
+
effectiveSpeed = speed + smoothedBoostRef.current;
|
|
607
|
+
}
|
|
608
|
+
let next = prev + dtSec * effectiveSpeed;
|
|
609
|
+
if (next >= totalDur) {
|
|
610
|
+
next = loop ? next % totalDur : totalDur;
|
|
611
|
+
smoothedBoostRef.current = 0;
|
|
612
|
+
}
|
|
613
|
+
return next;
|
|
614
|
+
});
|
|
615
|
+
raf = requestAnimationFrame(tick);
|
|
616
|
+
};
|
|
617
|
+
raf = requestAnimationFrame(tick);
|
|
618
|
+
return () => cancelAnimationFrame(raf);
|
|
619
|
+
}, [
|
|
620
|
+
isControlled,
|
|
621
|
+
playing,
|
|
622
|
+
speed,
|
|
623
|
+
loop,
|
|
624
|
+
catchUp,
|
|
625
|
+
font
|
|
626
|
+
]);
|
|
627
|
+
const svgRefs = useRef(/* @__PURE__ */ new Map());
|
|
628
|
+
const svgRefCallbacks = useRef(/* @__PURE__ */ new Map());
|
|
629
|
+
const makeSvgRef = useCallback((charIdx) => (node) => {
|
|
630
|
+
if (node) {
|
|
631
|
+
node.pauseAnimations();
|
|
632
|
+
svgRefs.current.set(charIdx, node);
|
|
633
|
+
} else svgRefs.current.delete(charIdx);
|
|
634
|
+
}, []);
|
|
635
|
+
const getSvgRef = useCallback((charIdx) => {
|
|
636
|
+
let cb = svgRefCallbacks.current.get(charIdx);
|
|
637
|
+
if (!cb) {
|
|
638
|
+
cb = makeSvgRef(charIdx);
|
|
639
|
+
svgRefCallbacks.current.set(charIdx, cb);
|
|
640
|
+
}
|
|
641
|
+
return cb;
|
|
642
|
+
}, [makeSvgRef]);
|
|
643
|
+
const prevFontRef = useRef(font);
|
|
644
|
+
const prevModeRef = useRef(mode);
|
|
645
|
+
if (prevFontRef.current !== font || prevModeRef.current !== mode) {
|
|
646
|
+
prevFontRef.current = font;
|
|
647
|
+
prevModeRef.current = mode;
|
|
648
|
+
svgRefs.current.clear();
|
|
649
|
+
svgRefCallbacks.current.clear();
|
|
650
|
+
}
|
|
651
|
+
useEffect(() => {
|
|
652
|
+
const el = rootRef.current;
|
|
653
|
+
if (!el) return;
|
|
654
|
+
const ro = new ResizeObserver(([entry]) => {
|
|
655
|
+
if (entry) {
|
|
656
|
+
setContainerWidth(entry.contentRect.width);
|
|
657
|
+
const styles = getComputedStyle(el);
|
|
658
|
+
setFontSize(Number.parseFloat(styles.fontSize));
|
|
659
|
+
setLineHeight(Number.parseFloat(styles.lineHeight));
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
ro.observe(el);
|
|
663
|
+
return () => ro.disconnect();
|
|
664
|
+
}, []);
|
|
665
|
+
const sentinelRef = useRef(null);
|
|
666
|
+
useEffect(() => {
|
|
667
|
+
const el = sentinelRef.current;
|
|
668
|
+
if (!el) return;
|
|
669
|
+
const onTransition = (e) => {
|
|
670
|
+
const styles = getComputedStyle(el);
|
|
671
|
+
if (e.propertyName === "font-size" || e.propertyName === "line-height") {
|
|
672
|
+
setFontSize(Number.parseFloat(styles.fontSize));
|
|
673
|
+
setLineHeight(Number.parseFloat(styles.lineHeight));
|
|
674
|
+
}
|
|
675
|
+
if (e.propertyName === CSS_PROGRESS) setCssTime(Number(styles.getPropertyValue(CSS_PROGRESS)) * totalDurationRef.current);
|
|
676
|
+
};
|
|
677
|
+
el.addEventListener("transitionend", onTransition);
|
|
678
|
+
return () => el.removeEventListener("transitionend", onTransition);
|
|
679
|
+
}, []);
|
|
680
|
+
const layout = useMemo(() => {
|
|
681
|
+
if (!fontFamily || !fontSize || !containerWidth || !resolvedText) return null;
|
|
682
|
+
return computeTextLayout(resolvedText, fontFamily, fontSize, lineHeight, containerWidth);
|
|
683
|
+
}, [
|
|
684
|
+
resolvedText,
|
|
685
|
+
fontFamily,
|
|
686
|
+
fontSize,
|
|
687
|
+
lineHeight,
|
|
688
|
+
containerWidth
|
|
689
|
+
]);
|
|
690
|
+
const padH = PADDING_H_EM * fontSize;
|
|
691
|
+
const padV = fontSize ? Math.max(MIN_PADDING_V_EM * fontSize, (MIN_LINE_HEIGHT_EM * fontSize - lineHeight) / 2) : 0;
|
|
692
|
+
useLayoutEffect(() => {
|
|
693
|
+
if (mode !== "svg") return;
|
|
694
|
+
const entries = timeline.entries;
|
|
695
|
+
for (let i = 0; i < entries.length; i++) {
|
|
696
|
+
const entry = entries[i];
|
|
697
|
+
if (!entry.hasSvg) continue;
|
|
698
|
+
const svg = svgRefs.current.get(i);
|
|
699
|
+
if (!svg) continue;
|
|
700
|
+
const localTime = Math.max(0, Math.min(currentTime - entry.offset, entry.duration));
|
|
701
|
+
svg.setCurrentTime(localTime);
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
const canvasRef = useRef(null);
|
|
705
|
+
useLayoutEffect(() => {
|
|
706
|
+
if (mode !== "canvas") return;
|
|
707
|
+
const canvas = canvasRef.current;
|
|
708
|
+
if (!canvas || !font?.glyphData || !layout || !fontSize) return;
|
|
709
|
+
const dpr = window.devicePixelRatio || 1;
|
|
710
|
+
const el = rootRef.current;
|
|
711
|
+
if (!el) return;
|
|
712
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
713
|
+
const w = canvasRect.width;
|
|
714
|
+
const h = canvasRect.height;
|
|
715
|
+
if (canvas.width !== Math.round(w * dpr) || canvas.height !== Math.round(h * dpr)) {
|
|
716
|
+
canvas.width = Math.round(w * dpr);
|
|
717
|
+
canvas.height = Math.round(h * dpr);
|
|
718
|
+
}
|
|
719
|
+
const ctx = canvas.getContext("2d");
|
|
720
|
+
if (!ctx) return;
|
|
721
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
722
|
+
ctx.clearRect(0, 0, w, h);
|
|
723
|
+
ctx.translate(padH, padV);
|
|
724
|
+
const color = getComputedStyle(el).color;
|
|
725
|
+
const halfLeading = (lineHeight - emHeight * fontSize) / 2;
|
|
726
|
+
const characters = graphemes(resolvedText);
|
|
727
|
+
let y = 0;
|
|
728
|
+
for (const lineIndices of layout.lines) {
|
|
729
|
+
let x = 0;
|
|
730
|
+
for (const charIdx of lineIndices) {
|
|
731
|
+
const char = characters[charIdx];
|
|
732
|
+
if (char === "\n") continue;
|
|
733
|
+
const entry = timeline.entries[charIdx];
|
|
734
|
+
const charWidth = layout.charWidths[charIdx] ?? 0;
|
|
735
|
+
const kerning = layout.kernings[charIdx] ?? 0;
|
|
736
|
+
const glyph = font.glyphData[char];
|
|
737
|
+
if (glyph && entry.hasSvg) {
|
|
738
|
+
const localTime = Math.max(0, Math.min(currentTime - entry.offset, entry.duration));
|
|
739
|
+
const glyphY = y + halfLeading;
|
|
740
|
+
drawGlyph(ctx, glyph, {
|
|
741
|
+
x,
|
|
742
|
+
y: glyphY,
|
|
743
|
+
fontSize,
|
|
744
|
+
unitsPerEm: font.unitsPerEm,
|
|
745
|
+
ascender: font.ascender,
|
|
746
|
+
descender: font.descender
|
|
747
|
+
}, localTime, font.lineCap, color, resolvedEffects, seed + charIdx, segmentSize);
|
|
748
|
+
} else if (!entry.hasSvg && currentTime >= entry.offset + entry.duration) {
|
|
749
|
+
const baseline = y + halfLeading + font.ascender / font.unitsPerEm * fontSize;
|
|
750
|
+
drawFallbackGlyph(ctx, char, x, baseline, fontSize, fontFamily, color, resolvedEffects, seed + charIdx);
|
|
751
|
+
}
|
|
752
|
+
x += (charWidth + kerning) * fontSize;
|
|
753
|
+
}
|
|
754
|
+
y += lineHeight;
|
|
755
|
+
}
|
|
756
|
+
}, [
|
|
757
|
+
mode,
|
|
758
|
+
currentTime,
|
|
759
|
+
timeline,
|
|
760
|
+
layout,
|
|
761
|
+
font,
|
|
762
|
+
fontFamily,
|
|
763
|
+
fontSize,
|
|
764
|
+
lineHeight,
|
|
765
|
+
resolvedText,
|
|
766
|
+
emHeight,
|
|
767
|
+
padH,
|
|
768
|
+
padV,
|
|
769
|
+
resolvedEffects,
|
|
770
|
+
seed,
|
|
771
|
+
segmentSize
|
|
772
|
+
]);
|
|
773
|
+
const lineElements = useMemo(() => {
|
|
774
|
+
if (mode !== "svg" || !font || !resolvedText) return null;
|
|
775
|
+
const characters = graphemes(resolvedText);
|
|
776
|
+
const renderGlyph = (charIdx) => {
|
|
777
|
+
const char = characters[charIdx];
|
|
778
|
+
const entry = timeline.entries[charIdx];
|
|
779
|
+
const GlyphSvg = font.glyphs[char];
|
|
780
|
+
const width = layout?.charWidths[charIdx] ?? 1;
|
|
781
|
+
const kerning = layout?.kernings[charIdx];
|
|
782
|
+
if (char === "\n") return null;
|
|
783
|
+
if (GlyphSvg) return /* @__PURE__ */ jsx(GlyphSvg, {
|
|
784
|
+
ref: getSvgRef(charIdx),
|
|
785
|
+
style: {
|
|
786
|
+
display: "inline-block",
|
|
787
|
+
verticalAlign: `${baselineOffset}em`,
|
|
788
|
+
width: `${width}em`,
|
|
789
|
+
marginRight: kerning ? `${kerning}em` : void 0,
|
|
790
|
+
height: `${emHeight}em`,
|
|
791
|
+
overflow: "visible"
|
|
792
|
+
}
|
|
793
|
+
}, charIdx);
|
|
794
|
+
return /* @__PURE__ */ jsx("span", {
|
|
795
|
+
style: {
|
|
796
|
+
fontFamily,
|
|
797
|
+
visibility: currentTime >= entry.offset + entry.duration ? "visible" : "hidden"
|
|
798
|
+
},
|
|
799
|
+
children: char
|
|
800
|
+
}, charIdx);
|
|
801
|
+
};
|
|
802
|
+
if (layout) return layout.lines.map((lineIndices, lineIdx) => {
|
|
803
|
+
return /* @__PURE__ */ jsx("div", {
|
|
804
|
+
style: {
|
|
805
|
+
whiteSpace: "nowrap",
|
|
806
|
+
height: lineIndices.every((i) => characters[i] === "\n") ? "1lh" : void 0,
|
|
807
|
+
lineHeight: `${lineHeight}px`
|
|
808
|
+
},
|
|
809
|
+
children: lineIndices.map(renderGlyph)
|
|
810
|
+
}, lineIdx);
|
|
811
|
+
});
|
|
812
|
+
return characters.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
813
|
+
style: { whiteSpace: "nowrap" },
|
|
814
|
+
children: characters.map((_, i) => renderGlyph(i))
|
|
815
|
+
}) : null;
|
|
816
|
+
}, [
|
|
817
|
+
mode,
|
|
818
|
+
resolvedText,
|
|
819
|
+
timeline,
|
|
820
|
+
font,
|
|
821
|
+
layout,
|
|
822
|
+
getSvgRef,
|
|
823
|
+
baselineOffset,
|
|
824
|
+
emHeight,
|
|
825
|
+
currentTime,
|
|
826
|
+
fontFamily,
|
|
827
|
+
lineHeight
|
|
828
|
+
]);
|
|
829
|
+
if (!font || !resolvedText) return /* @__PURE__ */ jsx("div", {
|
|
830
|
+
ref: rootRef,
|
|
831
|
+
...props
|
|
832
|
+
});
|
|
833
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
834
|
+
ref: rootRef,
|
|
835
|
+
...props,
|
|
836
|
+
style: {
|
|
837
|
+
...props.style,
|
|
838
|
+
position: "relative",
|
|
839
|
+
maxWidth: "100%",
|
|
840
|
+
width: "auto",
|
|
841
|
+
height: "auto",
|
|
842
|
+
[CSS_DURATION]: timeline.totalDuration,
|
|
843
|
+
[CSS_TIME]: currentTime,
|
|
844
|
+
[CSS_PROGRESS]: timeline.totalDuration > 0 ? currentTime / timeline.totalDuration : 0
|
|
845
|
+
},
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ jsx("span", {
|
|
848
|
+
ref: sentinelRef,
|
|
849
|
+
"aria-hidden": true,
|
|
850
|
+
style: {
|
|
851
|
+
position: "absolute",
|
|
852
|
+
width: 0,
|
|
853
|
+
overflow: "hidden",
|
|
854
|
+
pointerEvents: "none",
|
|
855
|
+
fontSize: "inherit",
|
|
856
|
+
lineHeight: "inherit",
|
|
857
|
+
visibility: "hidden",
|
|
858
|
+
transition: isCss ? `font-size 0.001s, line-height 0.001s, ${CSS_PROGRESS} 0.001s` : "font-size 0.001s, line-height 0.001s"
|
|
859
|
+
},
|
|
860
|
+
children: "\xA0"
|
|
861
|
+
}),
|
|
862
|
+
mode === "canvas" ? /* @__PURE__ */ jsx("canvas", {
|
|
863
|
+
ref: canvasRef,
|
|
864
|
+
"aria-hidden": true,
|
|
865
|
+
style: {
|
|
866
|
+
position: "absolute",
|
|
867
|
+
inset: `${-padV}px ${-padH}px`,
|
|
868
|
+
width: `calc(100% + ${padH * 2}px)`,
|
|
869
|
+
height: `calc(100% + ${padV * 2}px)`,
|
|
870
|
+
pointerEvents: "none"
|
|
871
|
+
}
|
|
872
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
873
|
+
style: {
|
|
874
|
+
position: "absolute",
|
|
875
|
+
inset: 0,
|
|
876
|
+
pointerEvents: "none",
|
|
877
|
+
fontFamily
|
|
878
|
+
},
|
|
879
|
+
children: lineElements
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ jsx("div", {
|
|
882
|
+
style: {
|
|
883
|
+
userSelect: "auto",
|
|
884
|
+
whiteSpace: "pre-wrap",
|
|
885
|
+
overflowWrap: "break-word",
|
|
886
|
+
paddingRight: 1,
|
|
887
|
+
WebkitTextFillColor: showOverlay ? void 0 : "transparent",
|
|
888
|
+
fontFamily,
|
|
889
|
+
color: showOverlay ? "rgba(255, 0, 0, 0.4)" : void 0,
|
|
890
|
+
fontFeatureSettings: "'calt' 0, 'liga' 0"
|
|
891
|
+
},
|
|
892
|
+
children: resolvedText
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
export { TegakiRenderer, computeTimeline, drawGlyph };
|
|
899
|
+
|
|
900
|
+
//# sourceMappingURL=index.mjs.map
|