@n3rdw1z4rd/core 0.17.1 → 0.17.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/dist/index.d.mts CHANGED
@@ -359,7 +359,9 @@ declare class Noise {
359
359
  type CanvasColor = string | CanvasGradient | CanvasPattern;
360
360
  declare const DEFAULT_COLOR: CanvasColor;
361
361
  declare const DEFAULT_PIXEL_SIZE: number;
362
- declare const DEFAULT_FONT = "18px monospace";
362
+ declare const DEFAULT_FONT_SIZE = 14;
363
+ declare const DEFAULT_FONT_NAME = "monospace";
364
+ declare const DEFAULT_FONT = "14px monospace";
363
365
  declare const DEFAULT_TEXTALIGN = "left";
364
366
  declare const DEFAULT_TEXTBASELINE = "alphabetic";
365
367
  interface DrawParams {
@@ -367,6 +369,10 @@ interface DrawParams {
367
369
  filled?: boolean;
368
370
  size?: number;
369
371
  lineDash?: number[];
372
+ textAlign?: CanvasTextAlign;
373
+ textBaseline?: CanvasTextBaseline;
374
+ font?: string;
375
+ fontName?: string;
370
376
  }
371
377
  interface SpriteParams extends DrawParams {
372
378
  sourceX?: number;
@@ -855,4 +861,4 @@ declare class WorkerInterface {
855
861
  terminate(): void;
856
862
  }
857
863
 
858
- export { AStar, type AStarFindPathParams, type AStarPoint, AddThreeComponent, AsteroidMesh, type AsteroidOptions, type AtlasParams, AtlasTextureMaterial, type AtlasTextureMaterialParams, BuildDefaultPalette, type CanvasColor, CanvasRenderer, Clock, Color, type ColorSelectionOptions, type ColorSelectionResult, Colors, CompileShader, CreatePaletteController, CreateProgram, CreateProgramInfo, CreateStarfield, CreateSubTexture, CreateSystemStar, CreateThreeEntity, CreateWebGlContext, CubeSphereGeometry, DEFAULT_COLOR, DEFAULT_FONT, DEFAULT_PIXEL_SIZE, DEFAULT_TEXTALIGN, DEFAULT_TEXTBASELINE, DEG2RAD, DOWN, Disposable, type DoorsParams, type DrawParams, E, ECS, EPSILON, type Entity, EventQueue, type EyeDropper, type FractalParams, GenerateDoors, GenerateEntityId, GenerateRooms, type GenerateRoomsParams, GenerateWalls, GetProgramLocations, GetThreeComponent, GetUrlParams, HALF_PI, Input, type InputEventState, IsThreeEntity, type KeyValue, LN10, LN2, LOG10E, LOG2E, LoadTexture, Map2D, type Map2DData, Map3D, type Map3DData, Noise, Observable, PI, type PaletteController, type PaletteControllerOnChange, ParticleRenderer, ParticleSystem2d, ParticleSystem3d, type PathsParams, type PointPair, PoissonDiskSampler, type ProgramInfo, type ProgramLocations, QUARTER_PI, RAD2DEG, type RGB, type RGBA, Random, RandomTools, type RectPair, Rectangle, RemoveThreeComponent, type RendererParams, ResizeWebGlContext, type RoomsParams, SQRT1_2, SQRT2, type SetupBasicSceneParams, ShaderType, Signal, SimplexNoise, SpatialPartition2d, SpatialPartition3d, type SpatialPartitionEntity2d, type SpatialPartitionEntity3d, type SpriteParams, TAU, TILE_EMPTY, TILE_FLOOR, TILE_PATH, TextureAtlas, type TextureData, type ThreeComponent, type ThreeEntity, ThreeJsBoilerPlate, type ThreeJsBoilerPlateParams, ThreeJsCameraRig, type ThreeJsCameraRigParams, ThreeJsPlayerController, type ThreeSystem, Tilemap, UP, Vector, type Voxel, type VoxelData, VoxelFaces, type VoxelMap, type VoxelMaterial, VoxelMesh, WebGlRenderer, WorkerInterface, type XY, type XYZ, type XYZW, abs, acos, asin, atan, atan2, cbrt, ceil, clamp, cos, cosh, degrees, distance2d, distance3d, exp, expm1, floor, fract, getRedYellowGreenGradientHex, hypot, hypot2, hypot3, imul, inverseLerp, isFinite, isInteger, isNaN, isNullOrUndefined, isPositiveString, k2xy, k2xyz, lerp, log, log10, log1p, log2, manhattanDistance, map, max, min, mod, nearlyEqual, normalizeRadians, pow, radians, randomMatrix, rng, round, roundTo, saturate, sign, sin, sinh, smoothstep, sqrt, squaredDistance, tan, tanh, trunc, wrap, xy2k, xyz2k };
864
+ export { AStar, type AStarFindPathParams, type AStarPoint, AddThreeComponent, AsteroidMesh, type AsteroidOptions, type AtlasParams, AtlasTextureMaterial, type AtlasTextureMaterialParams, BuildDefaultPalette, type CanvasColor, CanvasRenderer, Clock, Color, type ColorSelectionOptions, type ColorSelectionResult, Colors, CompileShader, CreatePaletteController, CreateProgram, CreateProgramInfo, CreateStarfield, CreateSubTexture, CreateSystemStar, CreateThreeEntity, CreateWebGlContext, CubeSphereGeometry, DEFAULT_COLOR, DEFAULT_FONT, DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_PIXEL_SIZE, DEFAULT_TEXTALIGN, DEFAULT_TEXTBASELINE, DEG2RAD, DOWN, Disposable, type DoorsParams, type DrawParams, E, ECS, EPSILON, type Entity, EventQueue, type EyeDropper, type FractalParams, GenerateDoors, GenerateEntityId, GenerateRooms, type GenerateRoomsParams, GenerateWalls, GetProgramLocations, GetThreeComponent, GetUrlParams, HALF_PI, Input, type InputEventState, IsThreeEntity, type KeyValue, LN10, LN2, LOG10E, LOG2E, LoadTexture, Map2D, type Map2DData, Map3D, type Map3DData, Noise, Observable, PI, type PaletteController, type PaletteControllerOnChange, ParticleRenderer, ParticleSystem2d, ParticleSystem3d, type PathsParams, type PointPair, PoissonDiskSampler, type ProgramInfo, type ProgramLocations, QUARTER_PI, RAD2DEG, type RGB, type RGBA, Random, RandomTools, type RectPair, Rectangle, RemoveThreeComponent, type RendererParams, ResizeWebGlContext, type RoomsParams, SQRT1_2, SQRT2, type SetupBasicSceneParams, ShaderType, Signal, SimplexNoise, SpatialPartition2d, SpatialPartition3d, type SpatialPartitionEntity2d, type SpatialPartitionEntity3d, type SpriteParams, TAU, TILE_EMPTY, TILE_FLOOR, TILE_PATH, TextureAtlas, type TextureData, type ThreeComponent, type ThreeEntity, ThreeJsBoilerPlate, type ThreeJsBoilerPlateParams, ThreeJsCameraRig, type ThreeJsCameraRigParams, ThreeJsPlayerController, type ThreeSystem, Tilemap, UP, Vector, type Voxel, type VoxelData, VoxelFaces, type VoxelMap, type VoxelMaterial, VoxelMesh, WebGlRenderer, WorkerInterface, type XY, type XYZ, type XYZW, abs, acos, asin, atan, atan2, cbrt, ceil, clamp, cos, cosh, degrees, distance2d, distance3d, exp, expm1, floor, fract, getRedYellowGreenGradientHex, hypot, hypot2, hypot3, imul, inverseLerp, isFinite, isInteger, isNaN, isNullOrUndefined, isPositiveString, k2xy, k2xyz, lerp, log, log10, log1p, log2, manhattanDistance, map, max, min, mod, nearlyEqual, normalizeRadians, pow, radians, randomMatrix, rng, round, roundTo, saturate, sign, sin, sinh, smoothstep, sqrt, squaredDistance, tan, tanh, trunc, wrap, xy2k, xyz2k };
package/dist/index.d.ts CHANGED
@@ -359,7 +359,9 @@ declare class Noise {
359
359
  type CanvasColor = string | CanvasGradient | CanvasPattern;
360
360
  declare const DEFAULT_COLOR: CanvasColor;
361
361
  declare const DEFAULT_PIXEL_SIZE: number;
362
- declare const DEFAULT_FONT = "18px monospace";
362
+ declare const DEFAULT_FONT_SIZE = 14;
363
+ declare const DEFAULT_FONT_NAME = "monospace";
364
+ declare const DEFAULT_FONT = "14px monospace";
363
365
  declare const DEFAULT_TEXTALIGN = "left";
364
366
  declare const DEFAULT_TEXTBASELINE = "alphabetic";
365
367
  interface DrawParams {
@@ -367,6 +369,10 @@ interface DrawParams {
367
369
  filled?: boolean;
368
370
  size?: number;
369
371
  lineDash?: number[];
372
+ textAlign?: CanvasTextAlign;
373
+ textBaseline?: CanvasTextBaseline;
374
+ font?: string;
375
+ fontName?: string;
370
376
  }
371
377
  interface SpriteParams extends DrawParams {
372
378
  sourceX?: number;
@@ -855,4 +861,4 @@ declare class WorkerInterface {
855
861
  terminate(): void;
856
862
  }
857
863
 
858
- export { AStar, type AStarFindPathParams, type AStarPoint, AddThreeComponent, AsteroidMesh, type AsteroidOptions, type AtlasParams, AtlasTextureMaterial, type AtlasTextureMaterialParams, BuildDefaultPalette, type CanvasColor, CanvasRenderer, Clock, Color, type ColorSelectionOptions, type ColorSelectionResult, Colors, CompileShader, CreatePaletteController, CreateProgram, CreateProgramInfo, CreateStarfield, CreateSubTexture, CreateSystemStar, CreateThreeEntity, CreateWebGlContext, CubeSphereGeometry, DEFAULT_COLOR, DEFAULT_FONT, DEFAULT_PIXEL_SIZE, DEFAULT_TEXTALIGN, DEFAULT_TEXTBASELINE, DEG2RAD, DOWN, Disposable, type DoorsParams, type DrawParams, E, ECS, EPSILON, type Entity, EventQueue, type EyeDropper, type FractalParams, GenerateDoors, GenerateEntityId, GenerateRooms, type GenerateRoomsParams, GenerateWalls, GetProgramLocations, GetThreeComponent, GetUrlParams, HALF_PI, Input, type InputEventState, IsThreeEntity, type KeyValue, LN10, LN2, LOG10E, LOG2E, LoadTexture, Map2D, type Map2DData, Map3D, type Map3DData, Noise, Observable, PI, type PaletteController, type PaletteControllerOnChange, ParticleRenderer, ParticleSystem2d, ParticleSystem3d, type PathsParams, type PointPair, PoissonDiskSampler, type ProgramInfo, type ProgramLocations, QUARTER_PI, RAD2DEG, type RGB, type RGBA, Random, RandomTools, type RectPair, Rectangle, RemoveThreeComponent, type RendererParams, ResizeWebGlContext, type RoomsParams, SQRT1_2, SQRT2, type SetupBasicSceneParams, ShaderType, Signal, SimplexNoise, SpatialPartition2d, SpatialPartition3d, type SpatialPartitionEntity2d, type SpatialPartitionEntity3d, type SpriteParams, TAU, TILE_EMPTY, TILE_FLOOR, TILE_PATH, TextureAtlas, type TextureData, type ThreeComponent, type ThreeEntity, ThreeJsBoilerPlate, type ThreeJsBoilerPlateParams, ThreeJsCameraRig, type ThreeJsCameraRigParams, ThreeJsPlayerController, type ThreeSystem, Tilemap, UP, Vector, type Voxel, type VoxelData, VoxelFaces, type VoxelMap, type VoxelMaterial, VoxelMesh, WebGlRenderer, WorkerInterface, type XY, type XYZ, type XYZW, abs, acos, asin, atan, atan2, cbrt, ceil, clamp, cos, cosh, degrees, distance2d, distance3d, exp, expm1, floor, fract, getRedYellowGreenGradientHex, hypot, hypot2, hypot3, imul, inverseLerp, isFinite, isInteger, isNaN, isNullOrUndefined, isPositiveString, k2xy, k2xyz, lerp, log, log10, log1p, log2, manhattanDistance, map, max, min, mod, nearlyEqual, normalizeRadians, pow, radians, randomMatrix, rng, round, roundTo, saturate, sign, sin, sinh, smoothstep, sqrt, squaredDistance, tan, tanh, trunc, wrap, xy2k, xyz2k };
864
+ export { AStar, type AStarFindPathParams, type AStarPoint, AddThreeComponent, AsteroidMesh, type AsteroidOptions, type AtlasParams, AtlasTextureMaterial, type AtlasTextureMaterialParams, BuildDefaultPalette, type CanvasColor, CanvasRenderer, Clock, Color, type ColorSelectionOptions, type ColorSelectionResult, Colors, CompileShader, CreatePaletteController, CreateProgram, CreateProgramInfo, CreateStarfield, CreateSubTexture, CreateSystemStar, CreateThreeEntity, CreateWebGlContext, CubeSphereGeometry, DEFAULT_COLOR, DEFAULT_FONT, DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_PIXEL_SIZE, DEFAULT_TEXTALIGN, DEFAULT_TEXTBASELINE, DEG2RAD, DOWN, Disposable, type DoorsParams, type DrawParams, E, ECS, EPSILON, type Entity, EventQueue, type EyeDropper, type FractalParams, GenerateDoors, GenerateEntityId, GenerateRooms, type GenerateRoomsParams, GenerateWalls, GetProgramLocations, GetThreeComponent, GetUrlParams, HALF_PI, Input, type InputEventState, IsThreeEntity, type KeyValue, LN10, LN2, LOG10E, LOG2E, LoadTexture, Map2D, type Map2DData, Map3D, type Map3DData, Noise, Observable, PI, type PaletteController, type PaletteControllerOnChange, ParticleRenderer, ParticleSystem2d, ParticleSystem3d, type PathsParams, type PointPair, PoissonDiskSampler, type ProgramInfo, type ProgramLocations, QUARTER_PI, RAD2DEG, type RGB, type RGBA, Random, RandomTools, type RectPair, Rectangle, RemoveThreeComponent, type RendererParams, ResizeWebGlContext, type RoomsParams, SQRT1_2, SQRT2, type SetupBasicSceneParams, ShaderType, Signal, SimplexNoise, SpatialPartition2d, SpatialPartition3d, type SpatialPartitionEntity2d, type SpatialPartitionEntity3d, type SpriteParams, TAU, TILE_EMPTY, TILE_FLOOR, TILE_PATH, TextureAtlas, type TextureData, type ThreeComponent, type ThreeEntity, ThreeJsBoilerPlate, type ThreeJsBoilerPlateParams, ThreeJsCameraRig, type ThreeJsCameraRigParams, ThreeJsPlayerController, type ThreeSystem, Tilemap, UP, Vector, type Voxel, type VoxelData, VoxelFaces, type VoxelMap, type VoxelMaterial, VoxelMesh, WebGlRenderer, WorkerInterface, type XY, type XYZ, type XYZW, abs, acos, asin, atan, atan2, cbrt, ceil, clamp, cos, cosh, degrees, distance2d, distance3d, exp, expm1, floor, fract, getRedYellowGreenGradientHex, hypot, hypot2, hypot3, imul, inverseLerp, isFinite, isInteger, isNaN, isNullOrUndefined, isPositiveString, k2xy, k2xyz, lerp, log, log10, log1p, log2, manhattanDistance, map, max, min, mod, nearlyEqual, normalizeRadians, pow, radians, randomMatrix, rng, round, roundTo, saturate, sign, sin, sinh, smoothstep, sqrt, squaredDistance, tan, tanh, trunc, wrap, xy2k, xyz2k };
package/dist/index.js CHANGED
@@ -72,6 +72,8 @@ __export(index_exports, {
72
72
  CubeSphereGeometry: () => CubeSphereGeometry,
73
73
  DEFAULT_COLOR: () => DEFAULT_COLOR,
74
74
  DEFAULT_FONT: () => DEFAULT_FONT,
75
+ DEFAULT_FONT_NAME: () => DEFAULT_FONT_NAME,
76
+ DEFAULT_FONT_SIZE: () => DEFAULT_FONT_SIZE,
75
77
  DEFAULT_PIXEL_SIZE: () => DEFAULT_PIXEL_SIZE,
76
78
  DEFAULT_TEXTALIGN: () => DEFAULT_TEXTALIGN,
77
79
  DEFAULT_TEXTBASELINE: () => DEFAULT_TEXTBASELINE,
@@ -635,7 +637,7 @@ var RandomTools = class {
635
637
  max2 = min2;
636
638
  min2 = 0;
637
639
  }
638
- return floor(this.floatRange(min2, max2 + 1));
640
+ return floor(this.floatRange(min2, max2));
639
641
  }
640
642
  //----------------------------------------------------------------------
641
643
  // Collections
@@ -1844,7 +1846,9 @@ function PoissonDiskSampler(width, height, minDist, maxPoints = 30) {
1844
1846
  // src/rendering/canvas-renderer.ts
1845
1847
  var DEFAULT_COLOR = "white";
1846
1848
  var DEFAULT_PIXEL_SIZE = 1;
1847
- var DEFAULT_FONT = "18px monospace";
1849
+ var DEFAULT_FONT_SIZE = 14;
1850
+ var DEFAULT_FONT_NAME = "monospace";
1851
+ var DEFAULT_FONT = `${DEFAULT_FONT_SIZE}px ${DEFAULT_FONT_NAME}`;
1848
1852
  var DEFAULT_TEXTALIGN = "left";
1849
1853
  var DEFAULT_TEXTBASELINE = "alphabetic";
1850
1854
  var CanvasRenderer = class {
@@ -1966,6 +1970,9 @@ var CanvasRenderer = class {
1966
1970
  }, params);
1967
1971
  }
1968
1972
  drawText(x, y, text, params = {}) {
1973
+ this.context.font = params.font ?? `${params.size ?? DEFAULT_FONT_SIZE}px ${params.fontName ?? DEFAULT_FONT_NAME}`;
1974
+ this.context.textAlign = params.textAlign ?? DEFAULT_TEXTALIGN;
1975
+ this.context.textBaseline = params.textBaseline ?? DEFAULT_TEXTBASELINE;
1969
1976
  this.context.fillStyle = params.color ?? DEFAULT_COLOR;
1970
1977
  this.context.fillText(text, x, y);
1971
1978
  }
@@ -3567,6 +3574,8 @@ var WorkerInterface = class {
3567
3574
  CubeSphereGeometry,
3568
3575
  DEFAULT_COLOR,
3569
3576
  DEFAULT_FONT,
3577
+ DEFAULT_FONT_NAME,
3578
+ DEFAULT_FONT_SIZE,
3570
3579
  DEFAULT_PIXEL_SIZE,
3571
3580
  DEFAULT_TEXTALIGN,
3572
3581
  DEFAULT_TEXTBASELINE,
package/dist/index.mjs CHANGED
@@ -70,6 +70,8 @@ __export(index_exports, {
70
70
  CubeSphereGeometry: () => CubeSphereGeometry,
71
71
  DEFAULT_COLOR: () => DEFAULT_COLOR,
72
72
  DEFAULT_FONT: () => DEFAULT_FONT,
73
+ DEFAULT_FONT_NAME: () => DEFAULT_FONT_NAME,
74
+ DEFAULT_FONT_SIZE: () => DEFAULT_FONT_SIZE,
73
75
  DEFAULT_PIXEL_SIZE: () => DEFAULT_PIXEL_SIZE,
74
76
  DEFAULT_TEXTALIGN: () => DEFAULT_TEXTALIGN,
75
77
  DEFAULT_TEXTBASELINE: () => DEFAULT_TEXTBASELINE,
@@ -632,7 +634,7 @@ var RandomTools = class {
632
634
  max2 = min2;
633
635
  min2 = 0;
634
636
  }
635
- return floor(this.floatRange(min2, max2 + 1));
637
+ return floor(this.floatRange(min2, max2));
636
638
  }
637
639
  //----------------------------------------------------------------------
638
640
  // Collections
@@ -1841,7 +1843,9 @@ function PoissonDiskSampler(width, height, minDist, maxPoints = 30) {
1841
1843
  // src/rendering/canvas-renderer.ts
1842
1844
  var DEFAULT_COLOR = "white";
1843
1845
  var DEFAULT_PIXEL_SIZE = 1;
1844
- var DEFAULT_FONT = "18px monospace";
1846
+ var DEFAULT_FONT_SIZE = 14;
1847
+ var DEFAULT_FONT_NAME = "monospace";
1848
+ var DEFAULT_FONT = `${DEFAULT_FONT_SIZE}px ${DEFAULT_FONT_NAME}`;
1845
1849
  var DEFAULT_TEXTALIGN = "left";
1846
1850
  var DEFAULT_TEXTBASELINE = "alphabetic";
1847
1851
  var CanvasRenderer = class {
@@ -1963,6 +1967,9 @@ var CanvasRenderer = class {
1963
1967
  }, params);
1964
1968
  }
1965
1969
  drawText(x, y, text, params = {}) {
1970
+ this.context.font = params.font ?? `${params.size ?? DEFAULT_FONT_SIZE}px ${params.fontName ?? DEFAULT_FONT_NAME}`;
1971
+ this.context.textAlign = params.textAlign ?? DEFAULT_TEXTALIGN;
1972
+ this.context.textBaseline = params.textBaseline ?? DEFAULT_TEXTBASELINE;
1966
1973
  this.context.fillStyle = params.color ?? DEFAULT_COLOR;
1967
1974
  this.context.fillText(text, x, y);
1968
1975
  }
@@ -3563,6 +3570,8 @@ export {
3563
3570
  CubeSphereGeometry,
3564
3571
  DEFAULT_COLOR,
3565
3572
  DEFAULT_FONT,
3573
+ DEFAULT_FONT_NAME,
3574
+ DEFAULT_FONT_SIZE,
3566
3575
  DEFAULT_PIXEL_SIZE,
3567
3576
  DEFAULT_TEXTALIGN,
3568
3577
  DEFAULT_TEXTBASELINE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n3rdw1z4rd/core",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "core library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",