sfml.js 1.2.1 → 1.3.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 (113) hide show
  1. package/dist/audio/effect-processor.d.ts +1 -0
  2. package/dist/audio/input-sound-file.d.ts +1 -0
  3. package/dist/audio/output-sound-file.d.ts +1 -0
  4. package/dist/audio/output-sound-file.js +1 -0
  5. package/dist/audio/sound-buffer-recorder.d.ts +2 -0
  6. package/dist/audio/sound-buffer-recorder.js +2 -0
  7. package/dist/audio/sound-buffer.d.ts +5 -1
  8. package/dist/audio/sound-file-reader.d.ts +4 -1
  9. package/dist/audio/sound-file-reader.js +0 -9
  10. package/dist/audio/sound-recorder.d.ts +4 -0
  11. package/dist/audio/sound-recorder.js +3 -0
  12. package/dist/audio/sound-source.d.ts +2 -0
  13. package/dist/audio/sound-source.js +1 -0
  14. package/dist/graphics/blend-mode.d.ts +1 -0
  15. package/dist/graphics/boolean-vector.d.ts +6 -0
  16. package/dist/graphics/boolean-vector.js +2 -0
  17. package/dist/graphics/color.d.ts +1 -0
  18. package/dist/graphics/color.js +1 -0
  19. package/dist/graphics/font.d.ts +6 -1
  20. package/dist/graphics/font.js +1 -0
  21. package/dist/graphics/glsl.d.ts +4 -0
  22. package/dist/graphics/glyph.d.ts +1 -0
  23. package/dist/graphics/glyph.js +1 -0
  24. package/dist/graphics/image.d.ts +1 -0
  25. package/dist/graphics/rect.d.ts +4 -0
  26. package/dist/graphics/rect.js +3 -0
  27. package/dist/graphics/render-target.d.ts +2 -0
  28. package/dist/graphics/render-target.js +2 -0
  29. package/dist/graphics/render-texture.d.ts +1 -0
  30. package/dist/graphics/render-window.d.ts +1 -0
  31. package/dist/graphics/shader.d.ts +11 -5
  32. package/dist/graphics/shader.js +1 -0
  33. package/dist/graphics/shape.d.ts +12 -7
  34. package/dist/graphics/shape.js +0 -6
  35. package/dist/graphics/sprite.d.ts +5 -3
  36. package/dist/graphics/text.d.ts +32 -13
  37. package/dist/graphics/text.js +4 -0
  38. package/dist/graphics/texture.d.ts +7 -1
  39. package/dist/graphics/transform.d.ts +3 -0
  40. package/dist/graphics/transform.js +1 -0
  41. package/dist/graphics/vertex-buffer.d.ts +2 -0
  42. package/dist/graphics/vertex.d.ts +1 -0
  43. package/dist/graphics/vertex.js +1 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +6 -3
  46. package/dist/internal/glsl-value.d.ts +3 -0
  47. package/dist/internal/glsl-value.js +3 -0
  48. package/dist/internal/scalar.d.ts +12 -6
  49. package/dist/internal/transformable.d.ts +4 -0
  50. package/dist/internal/value-storage.d.ts +85 -1
  51. package/dist/internal/value-storage.js +4 -0
  52. package/dist/network/common.d.ts +1 -0
  53. package/dist/network/http.d.ts +1 -0
  54. package/dist/network/http.js +1 -0
  55. package/dist/network/sftp.d.ts +3 -2
  56. package/dist/system/angle.d.ts +1 -0
  57. package/dist/system/angle.js +1 -0
  58. package/dist/system/operators.d.ts +8 -0
  59. package/dist/system/vector2.d.ts +6 -3
  60. package/dist/system/vector2.js +2 -0
  61. package/dist/system/vector3.d.ts +5 -3
  62. package/dist/system/vector3.js +2 -0
  63. package/dist/window/context.d.ts +1 -0
  64. package/dist/window/cursor.d.ts +1 -0
  65. package/dist/window/event.d.ts +1 -0
  66. package/dist/window/event.js +3 -1
  67. package/dist/window/window.d.ts +1 -0
  68. package/native/vertex-buffer-binding.cc +4 -4
  69. package/native/window-binding.cc +8 -2
  70. package/package.json +2 -2
  71. package/src/audio/effect-processor.ts +1 -0
  72. package/src/audio/input-sound-file.ts +1 -0
  73. package/src/audio/output-sound-file.ts +1 -0
  74. package/src/audio/sound-buffer-recorder.ts +2 -0
  75. package/src/audio/sound-buffer.ts +5 -2
  76. package/src/audio/sound-file-reader.ts +8 -0
  77. package/src/audio/sound-recorder.ts +4 -0
  78. package/src/audio/sound-source.ts +2 -0
  79. package/src/graphics/blend-mode.ts +1 -0
  80. package/src/graphics/boolean-vector.ts +6 -0
  81. package/src/graphics/color.ts +1 -0
  82. package/src/graphics/font.ts +6 -3
  83. package/src/graphics/glsl.ts +4 -0
  84. package/src/graphics/glyph.ts +1 -0
  85. package/src/graphics/image.ts +1 -0
  86. package/src/graphics/rect.ts +4 -0
  87. package/src/graphics/render-target.ts +2 -0
  88. package/src/graphics/render-texture.ts +1 -0
  89. package/src/graphics/render-window.ts +1 -0
  90. package/src/graphics/shader.ts +22 -6
  91. package/src/graphics/shape.ts +13 -6
  92. package/src/graphics/sprite.ts +5 -3
  93. package/src/graphics/text.ts +37 -13
  94. package/src/graphics/texture.ts +8 -3
  95. package/src/graphics/transform.ts +3 -0
  96. package/src/graphics/vertex-buffer.ts +2 -0
  97. package/src/graphics/vertex.ts +1 -0
  98. package/src/index.ts +4 -0
  99. package/src/internal/glsl-value.ts +3 -0
  100. package/src/internal/scalar.ts +14 -4
  101. package/src/internal/transformable.ts +4 -0
  102. package/src/internal/value-storage.ts +93 -3
  103. package/src/network/common.ts +1 -0
  104. package/src/network/http.ts +1 -0
  105. package/src/network/sftp.ts +2 -2
  106. package/src/system/angle.ts +1 -0
  107. package/src/system/operators.ts +8 -0
  108. package/src/system/vector2.ts +8 -1
  109. package/src/system/vector3.ts +9 -1
  110. package/src/window/context.ts +1 -0
  111. package/src/window/cursor.ts +1 -0
  112. package/src/window/event.ts +4 -1
  113. package/src/window/window.ts +1 -0
@@ -12,6 +12,7 @@ import { EventEmitter } from 'node:events';
12
12
  import { createHash } from 'node:crypto';
13
13
  import { IpAddress } from './ip-address';
14
14
  import { Time } from '../system/time';
15
+ import type { ReadonlyValue } from '../internal/value-storage';
15
16
  import { TimeoutWithPredicate } from '../system/timeout-with-predicate';
16
17
  import {
17
18
  SerialQueue,
@@ -19,7 +20,6 @@ import {
19
20
  bytes,
20
21
  uint,
21
22
  waitFor,
22
- type NetworkTime,
23
23
  } from './common';
24
24
  import { SftpResultValue as Value, SftpHostKeyType } from './gen/constants';
25
25
 
@@ -33,7 +33,7 @@ export { SftpResultValue, SftpHostKeyType } from './gen/constants';
33
33
  * @ko 진행이 없을 때의 제한 시간 설정. 데이터 수신 또는 RPC 완료 시 타이머를
34
34
  * 재설정하며 기간이 0이면 제한 시간이 없습니다.
35
35
  */
36
- export type SftpTimeout = NetworkTime | TimeoutWithPredicate;
36
+ export type SftpTimeout = ReadonlyValue<Time> | TimeoutWithPredicate;
37
37
  /**
38
38
  * SFTP operation status and message.
39
39
  * @zh SFTP 操作状态和消息。
@@ -56,6 +56,7 @@ export class Angle {
56
56
  return this.state.values;
57
57
  }
58
58
 
59
+ /** Lazily creates the native view of shared angle storage. @internal */
59
60
  get [angleNative](): NativeValueHandle<'angle'> {
60
61
  return nativeValue(this, angleNative, this.state);
61
62
  }
@@ -99,6 +99,7 @@ type VectorEquality = Intersect<
99
99
  }[ScalarType]
100
100
  >;
101
101
 
102
+ /** Same-type addition signatures, returning independent values. @inline */
102
103
  interface Addition extends VectorAddition {
103
104
  (left: R<Bvec2>, right: R<Bvec2>): Bvec2;
104
105
  (left: R<Bvec3>, right: R<Bvec3>): Bvec3;
@@ -107,6 +108,7 @@ interface Addition extends VectorAddition {
107
108
  (left: R<Angle>, right: R<Angle>): Angle;
108
109
  }
109
110
 
111
+ /** Same-type addition signatures that mutate the left operand. @inline */
110
112
  interface AdditionAssign extends VectorAdditionAssign {
111
113
  (left: Bvec2, right: R<Bvec2>): Bvec2;
112
114
  (left: Bvec3, right: R<Bvec3>): Bvec3;
@@ -115,6 +117,7 @@ interface AdditionAssign extends VectorAdditionAssign {
115
117
  (left: Angle, right: R<Angle>): Angle;
116
118
  }
117
119
 
120
+ /** Unary negation signatures, returning independent values. @inline */
118
121
  interface Negation extends VectorNegation {
119
122
  (value: R<Bvec2>): Bvec2;
120
123
  (value: R<Bvec3>): Bvec3;
@@ -122,6 +125,7 @@ interface Negation extends VectorNegation {
122
125
  (value: R<Angle>): Angle;
123
126
  }
124
127
 
128
+ /** Right-scalar multiplication and division signatures. @inline */
125
129
  interface Scale extends VectorScale {
126
130
  (left: R<Bvec2>, right: boolean): Bvec2;
127
131
  (left: R<Bvec3>, right: boolean): Bvec3;
@@ -129,6 +133,7 @@ interface Scale extends VectorScale {
129
133
  (left: R<Angle>, right: number): Angle;
130
134
  }
131
135
 
136
+ /** Right-scalar signatures that mutate the left operand. @inline */
132
137
  interface ScaleAssign extends VectorScaleAssign {
133
138
  (left: Bvec2, right: boolean): Bvec2;
134
139
  (left: Bvec3, right: boolean): Bvec3;
@@ -136,6 +141,7 @@ interface ScaleAssign extends VectorScaleAssign {
136
141
  (left: Angle, right: number): Angle;
137
142
  }
138
143
 
144
+ /** Left-scalar multiplication signatures. @inline */
139
145
  interface LeftScale extends VectorLeftScale {
140
146
  (left: boolean, right: R<Bvec2>): Bvec2;
141
147
  (left: boolean, right: R<Bvec3>): Bvec3;
@@ -143,6 +149,7 @@ interface LeftScale extends VectorLeftScale {
143
149
  (left: number, right: R<Angle>): Angle;
144
150
  }
145
151
 
152
+ /** Exact same-type equality and inequality signatures. @inline */
146
153
  interface Equality extends VectorEquality {
147
154
  (left: IpAddress, right: IpAddress): boolean;
148
155
  (left: Readonly<VideoMode>, right: Readonly<VideoMode>): boolean;
@@ -782,6 +789,7 @@ export const equal = equals as Equality;
782
789
  */
783
790
  export const notEqual = ((left: EqualityInput, right: EqualityInput) =>
784
791
  !equals(left, right)) as Equality;
792
+ /** Ordering signatures for address, mode, duration and angle. @inline */
785
793
  interface Ordering {
786
794
  (left: IpAddress, right: IpAddress): boolean;
787
795
  (left: Readonly<VideoMode>, right: Readonly<VideoMode>): boolean;
@@ -24,13 +24,16 @@ import {
24
24
 
25
25
  export type { ScalarType } from '../internal/scalar';
26
26
 
27
+ /** Two-dimensional numeric or boolean source for conversion. @inline */
27
28
  type Vector2Source =
28
29
  | ReadonlyValue<Vector2<ScalarType>>
29
30
  | ReadonlyValue<Bvec2>;
31
+ /** Default, component and copy construction arguments. @inline */
30
32
  type Vector2Arguments<T extends ScalarType = NumberScalar> =
31
33
  | []
32
34
  | [x: Scalar<T>, y: Scalar<T>]
33
35
  | [source: Vector2Source];
36
+ /** Radius and direction for floating-point polar construction. @inline */
34
37
  type PolarArguments = [r: number, phi: ReadonlyValue<Angle>];
35
38
 
36
39
  type Vector2State = LazyValue<'vector2', ScalarArray>;
@@ -71,7 +74,9 @@ export class Vector2<T extends ScalarType> {
71
74
  constructor(
72
75
  scalarType: T,
73
76
  ...args:
74
- | Vector2Arguments<T>
77
+ | []
78
+ | [x: Scalar<T>, y: Scalar<T>]
79
+ | [source: Vector2Source]
75
80
  | (T extends FloatScalar ? PolarArguments : never)
76
81
  );
77
82
  /**
@@ -132,10 +137,12 @@ export class Vector2<T extends ScalarType> {
132
137
  return this.type;
133
138
  }
134
139
 
140
+ /** Shared component storage for native operations. @internal */
135
141
  get [vector2Storage](): ScalarArray<T> {
136
142
  return this.state.values as ScalarArray<T>;
137
143
  }
138
144
 
145
+ /** Native view bound to the shared component storage. @internal */
139
146
  get [vector2Native](): NativeValueHandle<'vector2'> {
140
147
  return nativeValue(this, vector2Native, this.state);
141
148
  }
@@ -21,9 +21,11 @@ import {
21
21
  type FloatScalar,
22
22
  } from '../internal/scalar';
23
23
 
24
+ /** Three-dimensional numeric or boolean source for conversion. @inline */
24
25
  type Vector3Source =
25
26
  | ReadonlyValue<Vector3<ScalarType>>
26
27
  | ReadonlyValue<Bvec3>;
28
+ /** Default, component and copy construction arguments. @inline */
27
29
  type Vector3Arguments<T extends ScalarType = NumberScalar> =
28
30
  | []
29
31
  | [x: Scalar<T>, y: Scalar<T>, z: Scalar<T>]
@@ -58,7 +60,11 @@ export class Vector3<T extends ScalarType> {
58
60
  * @ko args - x, y, z 성분 또는 변환하여 복사할 원본 벡터.
59
61
  * 생략하면 영벡터를 생성한다.
60
62
  */
61
- constructor(scalarType: T, ...args: Vector3Arguments<T>);
63
+ constructor(
64
+ scalarType: T,
65
+ ...args: [] | [x: Scalar<T>, y: Scalar<T>, z: Scalar<T>]
66
+ | [source: Vector3Source]
67
+ );
62
68
  /**
63
69
  * Copy the vector and its scalar type with independent storage.
64
70
  * @zh 复制向量及其标量类型,副本拥有独立存储。
@@ -109,10 +115,12 @@ export class Vector3<T extends ScalarType> {
109
115
  return this.type;
110
116
  }
111
117
 
118
+ /** Shared component storage for native operations. @internal */
112
119
  get [vector3Storage](): ScalarArray<T> {
113
120
  return this.state.values as ScalarArray<T>;
114
121
  }
115
122
 
123
+ /** Native view bound to the shared component storage. @internal */
116
124
  get [vector3Native](): NativeValueHandle<'vector3'> {
117
125
  return nativeValue(this, vector3Native, this.state);
118
126
  }
@@ -34,6 +34,7 @@ function remember(key: bigint, context: Context): void {
34
34
  * @ko 네이티브 측이 소유한 OpenGL 컨텍스트. 활성화는 네이티브 스레드별로 유지된다.
35
35
  */
36
36
  export class Context {
37
+ /** Native OpenGL context capability. @internal */
37
38
  readonly [graphicsNative]: NativeContextMapping['handle'];
38
39
  private readonly settings: Readonly<Required<ContextSettings>>;
39
40
 
@@ -48,6 +48,7 @@ export class Cursor {
48
48
  * @ko 시스템 커서 모양 열거형.
49
49
  */
50
50
  static readonly Type = CursorType;
51
+ /** Native cursor capability. @internal */
51
52
  readonly [graphicsNative]: NativeGraphicsHandle<'cursor'>;
52
53
 
53
54
  /**
@@ -9,6 +9,7 @@ import type {
9
9
  SensorType,
10
10
  } from './gen/constants';
11
11
 
12
+ /** Key code, scan code and modifier snapshot for a keyboard event. @inline */
12
13
  interface KeyEvent {
13
14
  /**
14
15
  * A logical key code affected by the keyboard layout.
@@ -570,7 +571,9 @@ export type NativeWindowEvent = {
570
571
  }[EventKind];
571
572
 
572
573
  export function windowEvent(raw: NativeWindowEvent): Event {
573
- const data = { ...raw } as unknown as EventData;
574
+ // Preserve the native snapshot's private provenance owner while replacing
575
+ // serialized vector fields. Public Event construction still copies data.
576
+ const data = raw as unknown as EventData;
574
577
  if (data.kind === 'Resized') {
575
578
  data.size = new Vector2u(
576
579
  ...(raw as NativeFields<EventData<'Resized'>>).size,
@@ -120,6 +120,7 @@ export function registerMixedWindow(window: Window): void {
120
120
  * @ko OpenGL 컨텍스트가 있는 OS 윈도우. Texture.update()에서 사용할 수 있다.
121
121
  */
122
122
  export class Window {
123
+ /** Native window capability. @internal */
123
124
  readonly [graphicsNative]: NativeGraphicsHandle<'window'>;
124
125
 
125
126
  static [Symbol.hasInstance](value: unknown): boolean {