@thi.ng/api 8.0.6 → 8.1.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.
package/CHANGELOG.md CHANGED
@@ -3,49 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.5...@thi.ng/api@8.0.6) (2021-10-28)
6
+ # [8.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.6...@thi.ng/api@8.1.0) (2021-11-03)
7
7
 
8
- **Note:** Version bump only for package @thi.ng/api
9
8
 
9
+ ### Features
10
10
 
11
-
12
-
13
-
14
- ## [8.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.4...@thi.ng/api@8.0.5) (2021-10-28)
15
-
16
- **Note:** Version bump only for package @thi.ng/api
17
-
18
-
19
-
20
-
21
-
22
- ## [8.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.3...@thi.ng/api@8.0.4) (2021-10-25)
23
-
24
- **Note:** Version bump only for package @thi.ng/api
25
-
26
-
27
-
28
-
29
-
30
- ## [8.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.2...@thi.ng/api@8.0.3) (2021-10-15)
31
-
32
- **Note:** Version bump only for package @thi.ng/api
33
-
34
-
35
-
36
-
37
-
38
- ## [8.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.1...@thi.ng/api@8.0.2) (2021-10-15)
39
-
40
- **Note:** Version bump only for package @thi.ng/api
41
-
42
-
43
-
44
-
45
-
46
- ## [8.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.0...@thi.ng/api@8.0.1) (2021-10-13)
47
-
48
- **Note:** Version bump only for package @thi.ng/api
11
+ * **api:** add asInt() coercion helper ([49cd772](https://github.com/thi-ng/umbrella/commit/49cd772a328b7c71fb16ed3041e03832ebd1f884))
12
+ * **api:** add IGrid2D/3D interfaces ([e57ad7e](https://github.com/thi-ng/umbrella/commit/e57ad7e8139512bf4146c4c70ef693b810eee24a))
49
13
 
50
14
 
51
15
 
@@ -102,31 +66,31 @@ Also:
102
66
 
103
67
 
104
68
 
105
- # [7.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.1.9...@thi.ng/api@7.2.0) (2021-09-03)
69
+ # [7.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.1.9...@thi.ng/api@7.2.0) (2021-09-03)
106
70
 
107
- ### Features
71
+ ### Features
108
72
 
109
- - **api:** add DeepArrayValue type ([a309fac](https://github.com/thi-ng/umbrella/commit/a309faca831651f611b9b056d9c7587f85b60087))
73
+ - **api:** add DeepArrayValue type ([a309fac](https://github.com/thi-ng/umbrella/commit/a309faca831651f611b9b056d9c7587f85b60087))
110
74
 
111
- # [7.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.0.0...@thi.ng/api@7.1.0) (2021-03-03)
75
+ # [7.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.0.0...@thi.ng/api@7.1.0) (2021-03-03)
112
76
 
113
- ### Features
77
+ ### Features
114
78
 
115
- - **api:** add StringOrSym type alias ([fb92c9d](https://github.com/thi-ng/umbrella/commit/fb92c9d93b4e795f60118e1167d5adb1bb108380))
79
+ - **api:** add StringOrSym type alias ([fb92c9d](https://github.com/thi-ng/umbrella/commit/fb92c9d93b4e795f60118e1167d5adb1bb108380))
116
80
 
117
- # [7.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.13.6...@thi.ng/api@7.0.0) (2021-02-20)
81
+ # [7.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.13.6...@thi.ng/api@7.0.0) (2021-02-20)
118
82
 
119
- ### Features
83
+ ### Features
120
84
 
121
- - **api:** add Range type ([5d94974](https://github.com/thi-ng/umbrella/commit/5d94974c34ca81513d40743f2a9b9a3ed20146d3))
122
- - **api:** add typedArrayType() classifier ([5c81fd8](https://github.com/thi-ng/umbrella/commit/5c81fd859514401c2c419b2ed3ec0f12025356c3))
123
- - **api:** more finely grained typedarray types ([8316d05](https://github.com/thi-ng/umbrella/commit/8316d058f0b5f760afd89e8590619670210a970a))
124
- - **api:** replace Type enum w/ strings consts ([a333d41](https://github.com/thi-ng/umbrella/commit/a333d418222972373cc1f9b256def2f79610d3fa))
85
+ - **api:** add Range type ([5d94974](https://github.com/thi-ng/umbrella/commit/5d94974c34ca81513d40743f2a9b9a3ed20146d3))
86
+ - **api:** add typedArrayType() classifier ([5c81fd8](https://github.com/thi-ng/umbrella/commit/5c81fd859514401c2c419b2ed3ec0f12025356c3))
87
+ - **api:** more finely grained typedarray types ([8316d05](https://github.com/thi-ng/umbrella/commit/8316d058f0b5f760afd89e8590619670210a970a))
88
+ - **api:** replace Type enum w/ strings consts ([a333d41](https://github.com/thi-ng/umbrella/commit/a333d418222972373cc1f9b256def2f79610d3fa))
125
89
 
126
- ### BREAKING CHANGES
90
+ ### BREAKING CHANGES
127
91
 
128
- - **api:** replace Type enum w/ string consts
129
- - update Type, UintType, IntType, FloatType aliases
92
+ - **api:** replace Type enum w/ string consts
93
+ - update Type, UintType, IntType, FloatType aliases
130
94
  - update GL2TYPE, TYPE2GL, SIZEOF, TYPEDARRAY_CTORS tables
131
95
  - add asNativeType(), asGLType() conversions
132
96
  - add sizeOf()
@@ -252,156 +216,156 @@ Also:
252
216
  ### Features
253
217
 
254
218
  - **api:** add common logging types & default impls ([4578604](https://github.com/thi-ng/umbrella/commit/4578604))
255
- - **api:** update ILogger, freeze NULL_LOGGER ([27ff8de](https://github.com/thi-ng/umbrella/commit/27ff8de))
219
+ - **api:** update ILogger, freeze NULL_LOGGER ([27ff8de](https://github.com/thi-ng/umbrella/commit/27ff8de))
256
220
 
257
- # [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.1.0...@thi.ng/api@6.0.0) (2019-03-28)
221
+ # [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.1.0...@thi.ng/api@6.0.0) (2019-03-28)
258
222
 
259
- ### Features
223
+ ### Features
260
224
 
261
- - **api:** add new types, update existing ([560eb90](https://github.com/thi-ng/umbrella/commit/560eb90))
225
+ - **api:** add new types, update existing ([560eb90](https://github.com/thi-ng/umbrella/commit/560eb90))
262
226
 
263
- ### BREAKING CHANGES
227
+ ### BREAKING CHANGES
264
228
 
265
- - **api:** split up, remove & update various interfaces
266
- - split IAssociative => IAssoc, IAssocIn
267
- - update IDissoc, add IDissocIn
268
- - split IGet => IGet, IGetIn
269
- - update IInto generics & return type
270
- - update ISet, remove IImmutableSet
271
- - update IStack, remove IImmutableStack
229
+ - **api:** split up, remove & update various interfaces
230
+ - split IAssociative => IAssoc, IAssocIn
231
+ - update IDissoc, add IDissocIn
232
+ - split IGet => IGet, IGetIn
233
+ - update IInto generics & return type
234
+ - update ISet, remove IImmutableSet
235
+ - update IStack, remove IImmutableStack
272
236
 
273
- # [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10)
237
+ # [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10)
274
238
 
275
- ### Features
239
+ ### Features
276
240
 
277
- - **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe))
278
- - **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61))
241
+ - **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe))
242
+ - **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61))
279
243
 
280
- # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.2.4...@thi.ng/api@5.0.0) (2019-01-21)
244
+ # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.2.4...@thi.ng/api@5.0.0) (2019-01-21)
281
245
 
282
- ### Bug Fixes
246
+ ### Bug Fixes
283
247
 
284
- - **api:** update assert(), re-export mixin() ([9f91cfa](https://github.com/thi-ng/umbrella/commit/9f91cfa))
248
+ - **api:** update assert(), re-export mixin() ([9f91cfa](https://github.com/thi-ng/umbrella/commit/9f91cfa))
285
249
 
286
- ### Build System
250
+ ### Build System
287
251
 
288
- - **api:** update package build scripts / outputs ([f913d7b](https://github.com/thi-ng/umbrella/commit/f913d7b))
252
+ - **api:** update package build scripts / outputs ([f913d7b](https://github.com/thi-ng/umbrella/commit/f913d7b))
289
253
 
290
- ### Features
254
+ ### Features
291
255
 
292
- - **api:** add assert() ([d381ace](https://github.com/thi-ng/umbrella/commit/d381ace))
256
+ - **api:** add assert() ([d381ace](https://github.com/thi-ng/umbrella/commit/d381ace))
293
257
 
294
- ### BREAKING CHANGES
258
+ ### BREAKING CHANGES
295
259
 
296
- - **api:** rename mixins to avoid name clashes, update decorators
297
- - append `Mixin` suffix to all mixins (i.e. `INotify` => `INotifyMixin`)
298
- - update re-exports of mixins & decorators (no more nested child namespace)
260
+ - **api:** rename mixins to avoid name clashes, update decorators
261
+ - append `Mixin` suffix to all mixins (i.e. `INotify` => `INotifyMixin`)
262
+ - update re-exports of mixins & decorators (no more nested child namespace)
299
263
 
300
- # [4.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.1.1...@thi.ng/api@4.2.0) (2018-09-22)
264
+ # [4.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.1.1...@thi.ng/api@4.2.0) (2018-09-22)
301
265
 
302
- ### Features
266
+ ### Features
303
267
 
304
- - **api:** add `IToHiccup` interface ([e390a54](https://github.com/thi-ng/umbrella/commit/e390a54))
268
+ - **api:** add `IToHiccup` interface ([e390a54](https://github.com/thi-ng/umbrella/commit/e390a54))
305
269
 
306
- # [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.0.6...@thi.ng/api@4.1.0) (2018-08-24)
270
+ # [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.0.6...@thi.ng/api@4.1.0) (2018-08-24)
307
271
 
308
- ### Features
272
+ ### Features
309
273
 
310
- - **api:** add new/move type aliases into api.ts ([cf30ba2](https://github.com/thi-ng/umbrella/commit/cf30ba2))
311
- - **api:** add NumericArray and TypedArray types ([519394b](https://github.com/thi-ng/umbrella/commit/519394b))
274
+ - **api:** add new/move type aliases into api.ts ([cf30ba2](https://github.com/thi-ng/umbrella/commit/cf30ba2))
275
+ - **api:** add NumericArray and TypedArray types ([519394b](https://github.com/thi-ng/umbrella/commit/519394b))
312
276
 
313
- # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@3.0.1...@thi.ng/api@4.0.0) (2018-05-12)
277
+ # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@3.0.1...@thi.ng/api@4.0.0) (2018-05-12)
314
278
 
315
- ### Code Refactoring
279
+ ### Code Refactoring
316
280
 
317
- - **api:** update interfaces, add docs ([9b38860](https://github.com/thi-ng/umbrella/commit/9b38860))
281
+ - **api:** update interfaces, add docs ([9b38860](https://github.com/thi-ng/umbrella/commit/9b38860))
318
282
 
319
- ### BREAKING CHANGES
283
+ ### BREAKING CHANGES
320
284
 
321
- - **api:** IBind, IEnable now include generics, update IIndexed, IMeta, ISet, IStack
322
- - add IInto
323
- - add IImmutableSet
324
- - add IImmutableStack
325
- - minor update IEnabled mixin
285
+ - **api:** IBind, IEnable now include generics, update IIndexed, IMeta, ISet, IStack
286
+ - add IInto
287
+ - add IImmutableSet
288
+ - add IImmutableStack
289
+ - minor update IEnabled mixin
326
290
 
327
- # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.2...@thi.ng/api@3.0.0) (2018-05-10)
291
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.2...@thi.ng/api@3.0.0) (2018-05-10)
328
292
 
329
- ### Code Refactoring
293
+ ### Code Refactoring
330
294
 
331
- - **api:** remove obsolete files from package ([f051ca3](https://github.com/thi-ng/umbrella/commit/f051ca3))
295
+ - **api:** remove obsolete files from package ([f051ca3](https://github.com/thi-ng/umbrella/commit/f051ca3))
332
296
 
333
- ### BREAKING CHANGES
297
+ ### BREAKING CHANGES
334
298
 
335
- - **api:** @thi.ng/api now only contains type declarations, decorators and mixins. All other features have been moved to new dedicated packages:
336
- - @thi.ng/bench
337
- - @thi.ng/compare
338
- - @thi.ng/equiv
339
- - @thi.ng/errors
299
+ - **api:** @thi.ng/api now only contains type declarations, decorators and mixins. All other features have been moved to new dedicated packages:
300
+ - @thi.ng/bench
301
+ - @thi.ng/compare
302
+ - @thi.ng/equiv
303
+ - @thi.ng/errors
340
304
 
341
- ## [2.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.0...@thi.ng/api@2.3.1) (2018-04-29)
305
+ ## [2.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.0...@thi.ng/api@2.3.1) (2018-04-29)
342
306
 
343
- ### Performance Improvements
307
+ ### Performance Improvements
344
308
 
345
- - **api:** major speedup equivObject(), update equivSet() ([7fdf172](https://github.com/thi-ng/umbrella/commit/7fdf172))
309
+ - **api:** major speedup equivObject(), update equivSet() ([7fdf172](https://github.com/thi-ng/umbrella/commit/7fdf172))
346
310
 
347
- # [2.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.2.0...@thi.ng/api@2.3.0) (2018-04-26)
311
+ # [2.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.2.0...@thi.ng/api@2.3.0) (2018-04-26)
348
312
 
349
- ### Features
313
+ ### Features
350
314
 
351
- - **api:** support more types in equiv(), add tests ([2ac8bff](https://github.com/thi-ng/umbrella/commit/2ac8bff))
315
+ - **api:** support more types in equiv(), add tests ([2ac8bff](https://github.com/thi-ng/umbrella/commit/2ac8bff))
352
316
 
353
- # [2.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.3...@thi.ng/api@2.2.0) (2018-04-08)
317
+ # [2.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.3...@thi.ng/api@2.2.0) (2018-04-08)
354
318
 
355
- ### Features
319
+ ### Features
356
320
 
357
- - **api:** add bench() & timed() utils ([d310345](https://github.com/thi-ng/umbrella/commit/d310345))
321
+ - **api:** add bench() & timed() utils ([d310345](https://github.com/thi-ng/umbrella/commit/d310345))
358
322
 
359
- ## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.0...@thi.ng/api@2.1.1) (2018-03-28)
323
+ ## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.0...@thi.ng/api@2.1.1) (2018-03-28)
360
324
 
361
- ### Bug Fixes
325
+ ### Bug Fixes
362
326
 
363
- - **api:** illegalState() creates IllegalStateError ([2b7e99b](https://github.com/thi-ng/umbrella/commit/2b7e99b))
327
+ - **api:** illegalState() creates IllegalStateError ([2b7e99b](https://github.com/thi-ng/umbrella/commit/2b7e99b))
364
328
 
365
- # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.4...@thi.ng/api@2.1.0) (2018-03-21)
329
+ # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.4...@thi.ng/api@2.1.0) (2018-03-21)
366
330
 
367
- ### Features
331
+ ### Features
368
332
 
369
- - **api:** add error types & ctor fns ([4d3785f](https://github.com/thi-ng/umbrella/commit/4d3785f))
333
+ - **api:** add error types & ctor fns ([4d3785f](https://github.com/thi-ng/umbrella/commit/4d3785f))
370
334
 
371
- ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.0...@thi.ng/api@2.0.1) (2018-02-02)
335
+ ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.0...@thi.ng/api@2.0.1) (2018-02-02)
372
336
 
373
- ### Bug Fixes
337
+ ### Bug Fixes
374
338
 
375
- - **api:** update compare() & equiv() ([110a9de](https://github.com/thi-ng/umbrella/commit/110a9de))
339
+ - **api:** update compare() & equiv() ([110a9de](https://github.com/thi-ng/umbrella/commit/110a9de))
376
340
 
377
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.5.0...@thi.ng/api@2.0.0) (2018-02-01)
341
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.5.0...@thi.ng/api@2.0.0) (2018-02-01)
378
342
 
379
- ### Bug Fixes
343
+ ### Bug Fixes
380
344
 
381
- - **api:** fix equiv string handling, update tests ([1354e29](https://github.com/thi-ng/umbrella/commit/1354e29))
345
+ - **api:** fix equiv string handling, update tests ([1354e29](https://github.com/thi-ng/umbrella/commit/1354e29))
382
346
 
383
- ### Features
347
+ ### Features
384
348
 
385
- - **api:** update equiv() null handling, add tests ([878520e](https://github.com/thi-ng/umbrella/commit/878520e))
349
+ - **api:** update equiv() null handling, add tests ([878520e](https://github.com/thi-ng/umbrella/commit/878520e))
386
350
 
387
- ### BREAKING CHANGES
351
+ ### BREAKING CHANGES
388
352
 
389
- - **api:** equiv now treats null & undefined as equal
353
+ - **api:** equiv now treats null & undefined as equal
390
354
 
391
- # [1.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.4.2...@thi.ng/api@1.5.0) (2018-01-31)
355
+ # [1.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.4.2...@thi.ng/api@1.5.0) (2018-01-31)
392
356
 
393
- ### Features
357
+ ### Features
394
358
 
395
- - **api:** add Predicate2 & StatefulPredicate2 types ([fbf8453](https://github.com/thi-ng/umbrella/commit/fbf8453))
359
+ - **api:** add Predicate2 & StatefulPredicate2 types ([fbf8453](https://github.com/thi-ng/umbrella/commit/fbf8453))
396
360
 
397
- # [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.3.0...@thi.ng/api@1.4.0) (2018-01-29)
361
+ # [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.3.0...@thi.ng/api@1.4.0) (2018-01-29)
398
362
 
399
- ### Features
363
+ ### Features
400
364
 
401
- - **api:** update IWatch & mixin, boolean returns ([bddd5ce](https://github.com/thi-ng/umbrella/commit/bddd5ce))
365
+ - **api:** update IWatch & mixin, boolean returns ([bddd5ce](https://github.com/thi-ng/umbrella/commit/bddd5ce))
402
366
 
403
- # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.2.1...@thi.ng/api@1.3.0) (2018-01-28)
367
+ # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.2.1...@thi.ng/api@1.3.0) (2018-01-28)
404
368
 
405
- ### Features
369
+ ### Features
406
370
 
407
371
  - **api:** add StatefulPredicate ([c74353b](https://github.com/thi-ng/umbrella/commit/c74353b))
package/README.md CHANGED
@@ -60,7 +60,7 @@ node --experimental-repl-await
60
60
  > const api = await import("@thi.ng/api");
61
61
  ```
62
62
 
63
- Package sizes (gzipped, pre-treeshake): ESM: 1.73 KB
63
+ Package sizes (gzipped, pre-treeshake): ESM: 1.75 KB
64
64
 
65
65
  ## Dependencies
66
66
 
package/grid.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import type { TypedArray, UIntArray } from "./typedarray.js";
2
+ export interface IGrid2D<T extends any[] | TypedArray = UIntArray, P = number> {
3
+ readonly width: number;
4
+ readonly height: number;
5
+ readonly stride: number;
6
+ readonly rowStride: number;
7
+ readonly data: T;
8
+ /**
9
+ * Returns value at given position. If pos is outside the defined region,
10
+ * returns a suitable zero value.
11
+ *
12
+ * @param x -
13
+ * @param y -
14
+ */
15
+ getAt(x: number, y: number): P;
16
+ /**
17
+ * Non-boundschecked version of {@link IGrid2D.getAt}. Assumes given
18
+ * position is valid.
19
+ *
20
+ * @param x -
21
+ * @param y -
22
+ */
23
+ getAtUnsafe(x: number, y: number): P;
24
+ /**
25
+ * Writes value at given position. Has no effect if outside of the defined
26
+ * region.
27
+ *
28
+ * @param x -
29
+ * @param y -
30
+ * @param col -
31
+ */
32
+ setAt(x: number, y: number, col: P): this;
33
+ /**
34
+ * Non-boundschecked version of {@link IGrid2D.setAt}. Assumes given
35
+ * position is valid.
36
+ *
37
+ * @param x -
38
+ * @param y -
39
+ */
40
+ setAtUnsafe(x: number, y: number, col: P): this;
41
+ }
42
+ export interface IGrid3D<T extends any[] | TypedArray = UIntArray, P = number> {
43
+ readonly width: number;
44
+ readonly height: number;
45
+ readonly depth: number;
46
+ readonly stride: number;
47
+ readonly rowStride: number;
48
+ readonly sliceStride: number;
49
+ readonly data: T;
50
+ /**
51
+ * Returns value at given position. If pos is outside the defined region,
52
+ * returns a suitable zero value.
53
+ *
54
+ * @param x -
55
+ * @param y -
56
+ * @param z -
57
+ */
58
+ getAt(x: number, y: number, z: number): P;
59
+ /**
60
+ * Non-boundschecked version of {@link IGrid3D.getAt}. Assumes given
61
+ * position is valid.
62
+ *
63
+ * @param x -
64
+ * @param y -
65
+ * @param z -
66
+ */
67
+ getAtUnsafe(x: number, y: number, z: number): P;
68
+ /**
69
+ * Writes value at given position. Has no effect if outside of the defined
70
+ * region.
71
+ *
72
+ * @param x -
73
+ * @param y -
74
+ * @param z -
75
+ * @param col -
76
+ */
77
+ setAt(x: number, y: number, z: number, col: P): this;
78
+ /**
79
+ * Non-boundschecked version of {@link IGrid3D.setAt}. Assumes given
80
+ * position is valid.
81
+ *
82
+ * @param x -
83
+ * @param y -
84
+ * @param z -
85
+ * @param col -
86
+ */
87
+ setAtUnsafe(x: number, y: number, z: number, col: P): this;
88
+ }
89
+ //# sourceMappingURL=grid.d.ts.map
package/grid.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./equiv.js";
13
13
  export * from "./event.js";
14
14
  export * from "./fn.js";
15
15
  export * from "./get.js";
16
+ export * from "./grid.js";
16
17
  export * from "./hash.js";
17
18
  export * from "./hiccup.js";
18
19
  export * from "./id.js";
package/index.js CHANGED
@@ -13,6 +13,7 @@ export * from "./equiv.js";
13
13
  export * from "./event.js";
14
14
  export * from "./fn.js";
15
15
  export * from "./get.js";
16
+ export * from "./grid.js";
16
17
  export * from "./hash.js";
17
18
  export * from "./hiccup.js";
18
19
  export * from "./id.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.0.6",
3
+ "version": "8.1.0",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -126,6 +126,9 @@
126
126
  "./get": {
127
127
  "import": "./get.js"
128
128
  },
129
+ "./grid": {
130
+ "import": "./grid.js"
131
+ },
129
132
  "./hash": {
130
133
  "import": "./hash.js"
131
134
  },
@@ -211,5 +214,5 @@
211
214
  "import": "./watch.js"
212
215
  }
213
216
  },
214
- "gitHead": "c17a556ad25f6882dfa8f806a1d9e8ed7ac7cd71"
217
+ "gitHead": "852cd2450617c86d15d18477dc634f17f04202eb"
215
218
  }
package/typedarray.d.ts CHANGED
@@ -108,6 +108,10 @@ export declare const asNativeType: (type: GLType | Type) => Type;
108
108
  * @param type -
109
109
  */
110
110
  export declare const asGLType: (type: GLType | Type) => GLType;
111
+ /**
112
+ * Coerces given numeric args to integer values.
113
+ */
114
+ export declare const asInt: (...args: number[]) => number[];
111
115
  /**
112
116
  * Returns byte size for given {@link Type} ID or {@link GLType} enum.
113
117
  *
package/typedarray.js CHANGED
@@ -111,6 +111,10 @@ export const asGLType = (type) => {
111
111
  const t = TYPE2GL[type];
112
112
  return t !== undefined ? t : type;
113
113
  };
114
+ /**
115
+ * Coerces given numeric args to integer values.
116
+ */
117
+ export const asInt = (...args) => args.map((x) => x | 0);
114
118
  /**
115
119
  * Returns byte size for given {@link Type} ID or {@link GLType} enum.
116
120
  *