three-text 0.5.2 → 0.6.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 (52) hide show
  1. package/LICENSE_THIRD_PARTY +15 -0
  2. package/README.md +73 -42
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +1 -1
  6. package/dist/index.min.cjs +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.umd.js +1 -1
  9. package/dist/index.umd.min.js +1 -1
  10. package/dist/three/react.d.ts +2 -0
  11. package/dist/types/core/types.d.ts +2 -33
  12. package/dist/types/vector/{core.d.ts → core/index.d.ts} +8 -7
  13. package/dist/types/vector/index.d.ts +22 -25
  14. package/dist/types/vector/react.d.ts +4 -3
  15. package/dist/types/vector/slug/SlugPacker.d.ts +2 -0
  16. package/dist/types/vector/slug/curveUtils.d.ts +6 -0
  17. package/dist/types/vector/slug/index.d.ts +8 -0
  18. package/dist/types/vector/slug/shaderStrings.d.ts +4 -0
  19. package/dist/types/vector/slug/slugGLSL.d.ts +21 -0
  20. package/dist/types/vector/slug/slugTSL.d.ts +13 -0
  21. package/dist/types/vector/slug/types.d.ts +30 -0
  22. package/dist/types/vector/slug/unpackVertices.d.ts +11 -0
  23. package/dist/types/vector/webgl/index.d.ts +7 -3
  24. package/dist/types/vector/webgpu/index.d.ts +4 -4
  25. package/dist/vector/core/index.cjs +856 -0
  26. package/dist/vector/core/index.d.ts +63 -0
  27. package/dist/vector/core/index.js +854 -0
  28. package/dist/vector/core.cjs +4419 -240
  29. package/dist/vector/core.d.ts +361 -71
  30. package/dist/vector/core.js +4406 -226
  31. package/dist/vector/index.cjs +5 -229
  32. package/dist/vector/index.d.ts +45 -396
  33. package/dist/vector/index.js +3 -223
  34. package/dist/vector/index2.cjs +287 -0
  35. package/dist/vector/index2.js +264 -0
  36. package/dist/vector/react.cjs +37 -8
  37. package/dist/vector/react.d.ts +6 -3
  38. package/dist/vector/react.js +18 -8
  39. package/dist/vector/slugTSL.cjs +252 -0
  40. package/dist/vector/slugTSL.js +231 -0
  41. package/dist/vector/webgl/index.cjs +131 -201
  42. package/dist/vector/webgl/index.d.ts +19 -44
  43. package/dist/vector/webgl/index.js +131 -201
  44. package/dist/vector/webgpu/index.cjs +100 -283
  45. package/dist/vector/webgpu/index.d.ts +16 -45
  46. package/dist/vector/webgpu/index.js +100 -283
  47. package/package.json +6 -1
  48. package/dist/types/vector/GlyphVectorGeometryBuilder.d.ts +0 -26
  49. package/dist/types/vector/LoopBlinnGeometry.d.ts +0 -68
  50. package/dist/types/vector/loopBlinnTSL.d.ts +0 -22
  51. package/dist/vector/loopBlinnTSL.cjs +0 -229
  52. package/dist/vector/loopBlinnTSL.js +0 -207
@@ -0,0 +1,63 @@
1
+ import { Text as Text$1 } from '../../core/Text';
2
+ import { VectorGlyphInfo, TextQueryOptions, TextRange, LoadedFont, TextOptions } from '../../core/types';
3
+ export { LoadedFont, TextOptions, VectorGlyphInfo } from '../../core/types';
4
+
5
+ interface BoundingBox {
6
+ min: {
7
+ x: number;
8
+ y: number;
9
+ z: number;
10
+ };
11
+ max: {
12
+ x: number;
13
+ y: number;
14
+ z: number;
15
+ };
16
+ }
17
+
18
+ interface SlugPackedTexture {
19
+ data: Float32Array | Uint32Array;
20
+ width: number;
21
+ height: number;
22
+ }
23
+ interface SlugGPUData {
24
+ curveTexture: SlugPackedTexture & {
25
+ data: Float32Array;
26
+ };
27
+ bandTexture: SlugPackedTexture & {
28
+ data: Uint32Array;
29
+ };
30
+ vertices: Float32Array;
31
+ indices: Uint16Array;
32
+ shapeCount: number;
33
+ }
34
+
35
+ interface HyphenationTrieNode {
36
+ patterns: number[] | null;
37
+ children: {
38
+ [char: string]: HyphenationTrieNode;
39
+ };
40
+ }
41
+
42
+ interface VectorTextResult {
43
+ gpuData: SlugGPUData;
44
+ glyphs: VectorGlyphInfo[];
45
+ planeBounds: BoundingBox;
46
+ query(options: TextQueryOptions): TextRange[];
47
+ getLoadedFont(): LoadedFont | undefined;
48
+ measureTextWidth(text: string, letterSpacing?: number): number;
49
+ update(options: Partial<TextOptions>): Promise<VectorTextResult>;
50
+ dispose(): void;
51
+ }
52
+ declare class Text {
53
+ static setHarfBuzzPath: typeof Text$1.setHarfBuzzPath;
54
+ static setHarfBuzzBuffer: typeof Text$1.setHarfBuzzBuffer;
55
+ static init: typeof Text$1.init;
56
+ static registerPattern: typeof Text$1.registerPattern;
57
+ static preloadPatterns: typeof Text$1.preloadPatterns;
58
+ static setMaxFontCacheMemoryMB: typeof Text$1.setMaxFontCacheMemoryMB;
59
+ static enableWoff2: typeof Text$1.enableWoff2;
60
+ static create(options: TextOptions): Promise<VectorTextResult>;
61
+ }
62
+
63
+ export { HyphenationTrieNode, SlugGPUData, Text, VectorTextResult as TextGeometryInfo, VectorTextResult };