string-tune-3d 0.0.12 → 0.0.13

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/dist/index.d.mts CHANGED
@@ -412,6 +412,32 @@ type TextGeometryOptions = {
412
412
  elementWidth?: number;
413
413
  elementHeight?: number;
414
414
  };
415
+ type SVGGeometryOptions = {
416
+ depth: number;
417
+ curveSegments: number;
418
+ bevelEnabled: boolean;
419
+ bevelThickness: number;
420
+ bevelSize: number;
421
+ bevelOffset: number;
422
+ bevelSegments: number;
423
+ };
424
+ type SVGPathData = {
425
+ d: string;
426
+ transform: {
427
+ a: number;
428
+ b: number;
429
+ c: number;
430
+ d: number;
431
+ e: number;
432
+ f: number;
433
+ } | null;
434
+ };
435
+ type SVGViewBox = {
436
+ x: number;
437
+ y: number;
438
+ width: number;
439
+ height: number;
440
+ };
415
441
  interface I3DModelLoader {
416
442
  load(url: string, onLoad?: (model: any) => void, onProgress?: (progress: any) => void, onError?: (error: any) => void): void;
417
443
  }
@@ -511,6 +537,7 @@ interface I3DEngine {
511
537
  applyTextGeometryToMesh(mesh: I3DMesh, geometry: I3DGeometry): boolean;
512
538
  loadFont?(url: string): Promise<any>;
513
539
  createTextGeometry?(text: string, font: any, options: TextGeometryOptions): I3DGeometry | null;
540
+ createSVGGeometry?(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
514
541
  getTextGeometryLayoutSignature?(context: {
515
542
  text: string;
516
543
  layoutSignature: string;
@@ -627,6 +654,7 @@ declare class String3DScene {
627
654
  private createModel;
628
655
  private createParticles;
629
656
  private createText;
657
+ private createSVG;
630
658
  private getGeometryQuality;
631
659
  private resolveModelLoader;
632
660
  private centerObject;
@@ -711,6 +739,71 @@ declare class String3D extends StringModule {
711
739
  destroy(): void;
712
740
  }
713
741
 
742
+ interface SVGTransformMatrix {
743
+ a: number;
744
+ b: number;
745
+ c: number;
746
+ d: number;
747
+ e: number;
748
+ f: number;
749
+ }
750
+ interface ParsedSVGPath {
751
+ d: string;
752
+ transform: SVGTransformMatrix | null;
753
+ }
754
+ interface ParsedSVGData {
755
+ paths: ParsedSVGPath[];
756
+ viewBox: {
757
+ x: number;
758
+ y: number;
759
+ width: number;
760
+ height: number;
761
+ } | null;
762
+ naturalWidth: number;
763
+ naturalHeight: number;
764
+ }
765
+ declare class SVGParser {
766
+ static fromElement(svgEl: SVGSVGElement): ParsedSVGData;
767
+ static fromString(svgString: string): ParsedSVGData | null;
768
+ }
769
+
770
+ interface SyncContext {
771
+ camera: String3DCamera;
772
+ viewportWidth: number;
773
+ viewportHeight: number;
774
+ engine: I3DEngine;
775
+ scene?: String3DScene;
776
+ dirtySet?: Set<HTMLElement> | null;
777
+ forceSync?: boolean;
778
+ styleReadIntervalMs?: number;
779
+ layoutReadIntervalMs?: number;
780
+ }
781
+
782
+ interface String3DObjectSyncStrategy {
783
+ sync(el: HTMLElement, object: String3DObject, context: SyncContext, parentData: any): void;
784
+ cleanup?(el: HTMLElement, object: String3DObject): void;
785
+ }
786
+
787
+ declare class SVGSynchronizer implements String3DObjectSyncStrategy {
788
+ private static styleCache;
789
+ private static geometryKeys;
790
+ private static lastMaterialType;
791
+ private static svgCache;
792
+ private static svgFetchCache;
793
+ private static svgFetchPromises;
794
+ private static pendingSrcObjects;
795
+ private static mutationObservers;
796
+ private static morphStates;
797
+ private static svgSignatures;
798
+ sync(el: HTMLElement, object: String3DObject, ctx: SyncContext, parentData: any): any;
799
+ cleanup(el: HTMLElement, object: String3DObject): void;
800
+ private resolveSVGData;
801
+ private static markObjectPendingSrc;
802
+ private static invalidatePendingSrcObjects;
803
+ private static setupMutationObserver;
804
+ private readStyleBundle;
805
+ }
806
+
714
807
  declare class String3DRenderer {
715
808
  private _container;
716
809
  private _renderer;
@@ -858,7 +951,17 @@ declare class ThreeJSEngine implements I3DEngine {
858
951
  private getInteriorPoint;
859
952
  private parseOutlineToShapes;
860
953
  private reversePath;
954
+ private getCurveEndPoint;
861
955
  createTextGeometry(text: string, font: any, options: any): I3DGeometry | null;
956
+ createSVGGeometry(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
957
+ private buildShapesWithHoles;
958
+ private svgPathContains;
959
+ private parseSVGPathToSubpaths;
960
+ private ensurePathWinding;
961
+ private clonePathAsShape;
962
+ private tokenizeSVGPath;
963
+ private nextNum;
964
+ private arcToBezier;
862
965
  private buildLineShapes;
863
966
  private getGlyphAdvance;
864
967
  private translateShape;
@@ -923,4 +1026,4 @@ declare class ThreeJSMaterialFactory implements IMaterialFactory {
923
1026
  dispose(): void;
924
1027
  }
925
1028
 
926
- export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBackend, type I3DBox3, type I3DCamera, type I3DCustomFilterRegistryRuntime, type I3DCustomMaterialRegistryRuntime, type I3DEngine, type I3DEngineCapabilities, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DPostProcessPipelineRuntime, type I3DPostProcessRuntime, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParticleMode, type ParticleSystemConfig, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };
1029
+ export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBackend, type I3DBox3, type I3DCamera, type I3DCustomFilterRegistryRuntime, type I3DCustomMaterialRegistryRuntime, type I3DEngine, type I3DEngineCapabilities, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DPostProcessPipelineRuntime, type I3DPostProcessRuntime, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParsedSVGData, type ParsedSVGPath, type ParticleMode, type ParticleSystemConfig, type SVGGeometryOptions, SVGParser, type SVGPathData, SVGSynchronizer, type SVGTransformMatrix, type SVGViewBox, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };
package/dist/index.d.ts CHANGED
@@ -412,6 +412,32 @@ type TextGeometryOptions = {
412
412
  elementWidth?: number;
413
413
  elementHeight?: number;
414
414
  };
415
+ type SVGGeometryOptions = {
416
+ depth: number;
417
+ curveSegments: number;
418
+ bevelEnabled: boolean;
419
+ bevelThickness: number;
420
+ bevelSize: number;
421
+ bevelOffset: number;
422
+ bevelSegments: number;
423
+ };
424
+ type SVGPathData = {
425
+ d: string;
426
+ transform: {
427
+ a: number;
428
+ b: number;
429
+ c: number;
430
+ d: number;
431
+ e: number;
432
+ f: number;
433
+ } | null;
434
+ };
435
+ type SVGViewBox = {
436
+ x: number;
437
+ y: number;
438
+ width: number;
439
+ height: number;
440
+ };
415
441
  interface I3DModelLoader {
416
442
  load(url: string, onLoad?: (model: any) => void, onProgress?: (progress: any) => void, onError?: (error: any) => void): void;
417
443
  }
@@ -511,6 +537,7 @@ interface I3DEngine {
511
537
  applyTextGeometryToMesh(mesh: I3DMesh, geometry: I3DGeometry): boolean;
512
538
  loadFont?(url: string): Promise<any>;
513
539
  createTextGeometry?(text: string, font: any, options: TextGeometryOptions): I3DGeometry | null;
540
+ createSVGGeometry?(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
514
541
  getTextGeometryLayoutSignature?(context: {
515
542
  text: string;
516
543
  layoutSignature: string;
@@ -627,6 +654,7 @@ declare class String3DScene {
627
654
  private createModel;
628
655
  private createParticles;
629
656
  private createText;
657
+ private createSVG;
630
658
  private getGeometryQuality;
631
659
  private resolveModelLoader;
632
660
  private centerObject;
@@ -711,6 +739,71 @@ declare class String3D extends StringModule {
711
739
  destroy(): void;
712
740
  }
713
741
 
742
+ interface SVGTransformMatrix {
743
+ a: number;
744
+ b: number;
745
+ c: number;
746
+ d: number;
747
+ e: number;
748
+ f: number;
749
+ }
750
+ interface ParsedSVGPath {
751
+ d: string;
752
+ transform: SVGTransformMatrix | null;
753
+ }
754
+ interface ParsedSVGData {
755
+ paths: ParsedSVGPath[];
756
+ viewBox: {
757
+ x: number;
758
+ y: number;
759
+ width: number;
760
+ height: number;
761
+ } | null;
762
+ naturalWidth: number;
763
+ naturalHeight: number;
764
+ }
765
+ declare class SVGParser {
766
+ static fromElement(svgEl: SVGSVGElement): ParsedSVGData;
767
+ static fromString(svgString: string): ParsedSVGData | null;
768
+ }
769
+
770
+ interface SyncContext {
771
+ camera: String3DCamera;
772
+ viewportWidth: number;
773
+ viewportHeight: number;
774
+ engine: I3DEngine;
775
+ scene?: String3DScene;
776
+ dirtySet?: Set<HTMLElement> | null;
777
+ forceSync?: boolean;
778
+ styleReadIntervalMs?: number;
779
+ layoutReadIntervalMs?: number;
780
+ }
781
+
782
+ interface String3DObjectSyncStrategy {
783
+ sync(el: HTMLElement, object: String3DObject, context: SyncContext, parentData: any): void;
784
+ cleanup?(el: HTMLElement, object: String3DObject): void;
785
+ }
786
+
787
+ declare class SVGSynchronizer implements String3DObjectSyncStrategy {
788
+ private static styleCache;
789
+ private static geometryKeys;
790
+ private static lastMaterialType;
791
+ private static svgCache;
792
+ private static svgFetchCache;
793
+ private static svgFetchPromises;
794
+ private static pendingSrcObjects;
795
+ private static mutationObservers;
796
+ private static morphStates;
797
+ private static svgSignatures;
798
+ sync(el: HTMLElement, object: String3DObject, ctx: SyncContext, parentData: any): any;
799
+ cleanup(el: HTMLElement, object: String3DObject): void;
800
+ private resolveSVGData;
801
+ private static markObjectPendingSrc;
802
+ private static invalidatePendingSrcObjects;
803
+ private static setupMutationObserver;
804
+ private readStyleBundle;
805
+ }
806
+
714
807
  declare class String3DRenderer {
715
808
  private _container;
716
809
  private _renderer;
@@ -858,7 +951,17 @@ declare class ThreeJSEngine implements I3DEngine {
858
951
  private getInteriorPoint;
859
952
  private parseOutlineToShapes;
860
953
  private reversePath;
954
+ private getCurveEndPoint;
861
955
  createTextGeometry(text: string, font: any, options: any): I3DGeometry | null;
956
+ createSVGGeometry(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
957
+ private buildShapesWithHoles;
958
+ private svgPathContains;
959
+ private parseSVGPathToSubpaths;
960
+ private ensurePathWinding;
961
+ private clonePathAsShape;
962
+ private tokenizeSVGPath;
963
+ private nextNum;
964
+ private arcToBezier;
862
965
  private buildLineShapes;
863
966
  private getGlyphAdvance;
864
967
  private translateShape;
@@ -923,4 +1026,4 @@ declare class ThreeJSMaterialFactory implements IMaterialFactory {
923
1026
  dispose(): void;
924
1027
  }
925
1028
 
926
- export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBackend, type I3DBox3, type I3DCamera, type I3DCustomFilterRegistryRuntime, type I3DCustomMaterialRegistryRuntime, type I3DEngine, type I3DEngineCapabilities, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DPostProcessPipelineRuntime, type I3DPostProcessRuntime, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParticleMode, type ParticleSystemConfig, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };
1029
+ export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBackend, type I3DBox3, type I3DCamera, type I3DCustomFilterRegistryRuntime, type I3DCustomMaterialRegistryRuntime, type I3DEngine, type I3DEngineCapabilities, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DPostProcessPipelineRuntime, type I3DPostProcessRuntime, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParsedSVGData, type ParsedSVGPath, type ParticleMode, type ParticleSystemConfig, type SVGGeometryOptions, SVGParser, type SVGPathData, SVGSynchronizer, type SVGTransformMatrix, type SVGViewBox, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };