@solidrt/core 0.0.63 → 0.0.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/core",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "license": "MIT",
5
5
  "funding": "https://github.com/sponsors/wellawaretech",
6
6
  "author": "Antoine van Wel",
@@ -32,7 +32,7 @@
32
32
  "AGENTS.md"
33
33
  ],
34
34
  "devDependencies": {
35
- "@solidrt/flux-types": "0.0.63"
35
+ "@solidrt/flux-types": "0.0.64"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@solidjs/signals": "2.0.0-rc.9",
@@ -308,7 +308,8 @@ export const BLEND_SECONDS = 0.5
308
308
 
309
309
  /** A shot's recording target: what its control drives. `camera()` is
310
310
  * the shot's latest full camera (the control's partial updates merged
311
- * over the initial one). */
311
+ * over the initial one; an undefined field is absent and keeps its
312
+ * value, as the real target's setCamera treats it). */
312
313
  export type ShotTarget<C> = { setCamera(update: Partial<C>): void; camera(): C }
313
314
 
314
315
  export type ShotBlendOptions = {
@@ -379,7 +380,13 @@ export function createShotBlend<C extends object>(push: (camera: C) => void, mix
379
380
  shots.set(name, s)
380
381
  return {
381
382
  setCamera(update) {
382
- Object.assign(s.latest, update)
383
+ // A component's props arrive as explicit undefineds for the
384
+ // unset ones; copying those would blank a field the mix then
385
+ // reads (NaN, or a missing vector).
386
+ for (let key of Object.keys(update) as (keyof C)[]) {
387
+ let value = update[key]
388
+ if (value !== undefined) s.latest[key] = value as C[keyof C]
389
+ }
383
390
  if (s === live && from === null) pushNow()
384
391
  },
385
392
  camera: () => ({ ...s.latest }),
package/src/gpu.ts CHANGED
@@ -80,9 +80,11 @@ export type { FilterMode, WrapMode, TextureBinding, TextureBindings } from "flux
80
80
  // createCubeTexture, createMutableTexture), fixed for the id's lifetime like
81
81
  // the sampler state. "rgba8" (default), "rgba8-srgb" (decodes to linear
82
82
  // light on sample), "r8", the float data-texture formats "r32f"/"rgba32f"
83
- // (Float32Array payload, nearest/texelFetch sampling only, no readback) and
84
- // the HDR image format "rgba16f" (Float32Array payload packed to half float,
85
- // filterable) - see TextureFormat in flux:gpu for each format's contract.
83
+ // (Float32Array payload, nearest/texelFetch sampling only, no readback), the
84
+ // HDR image format "rgba16f" (Float32Array payload packed to half float,
85
+ // filterable) and the integer data-texture format "rgba32ui" (Uint32Array
86
+ // payload, a uvec4 per texel through a usampler2D, nearest/texelFetch only)
87
+ // - see TextureFormat in flux:gpu for each format's contract.
86
88
  // Draw targets (createDrawTarget, createCubeDrawTarget) take the renderable
87
89
  // subset: "rgba8", "rgba8-srgb", "rgba16f".
88
90
  // "etc2-rgba8" (compressed) is a reserved future value of the same
@@ -245,7 +247,7 @@ export { captureSnapshot, readTexture } from "flux:gpu"
245
247
  * scope.
246
248
  */
247
249
  export function createTexture(
248
- data: Uint8Array | Float32Array,
250
+ data: Uint8Array | Float32Array | Uint32Array,
249
251
  width: number,
250
252
  height: number,
251
253
  opts?: CreateOptions & SamplerOptions & TextureFormatOptions,
@@ -279,7 +281,7 @@ export function createTexture(
279
281
  * reactive owner, `{ autoFree: false }` or `destroyTexture` otherwise).
280
282
  */
281
283
  export function createCubeTexture(
282
- faces: (Uint8Array | Float32Array)[] | (Uint8Array | Float32Array)[][],
284
+ faces: (Uint8Array | Float32Array | Uint32Array)[] | (Uint8Array | Float32Array | Uint32Array)[][],
283
285
  size: number,
284
286
  opts?: CreateOptions & SamplerOptions & TextureFormatOptions,
285
287
  ): gpu.TextureId {
@@ -300,7 +302,7 @@ export function createCubeTexture(
300
302
  * flux:gpu) yourself.
301
303
  */
302
304
  export function createMutableTexture(
303
- data: Uint8Array | Float32Array,
305
+ data: Uint8Array | Float32Array | Uint32Array,
304
306
  width: number,
305
307
  height: number,
306
308
  opts?: CreateOptions & SamplerOptions & TextureFormatOptions,
@@ -757,4 +759,16 @@ export function beginBufferWrite(id: gpu.BufferId): Float32Array {
757
759
  */
758
760
  export function writeBuffer(id: gpu.BufferId, data: ArrayBuffer | ArrayBufferView, byteOffset?: number): void {
759
761
  gpu.writeBuffer(id, toUint8(data), byteOffset)
762
+ }
763
+
764
+ /**
765
+ * Hands an ordered instance buffer's full record set to the engine - the
766
+ * write-once form: the engine keeps the one CPU copy and sorts,
767
+ * republishes and count-dials from it on its own; the caller keeps
768
+ * nothing and partial rewrites are off the table. Hand off before the
769
+ * entry attaches over the buffer. See `transferRecords` in flux:gpu for
770
+ * the full contract.
771
+ */
772
+ export function transferRecords(id: gpu.BufferId, records: ArrayBuffer | ArrayBufferView): void {
773
+ gpu.transferRecords(id, toUint8(records))
760
774
  }
package/src/index.ts CHANGED
@@ -67,6 +67,8 @@ export type {
67
67
  TextEvent,
68
68
  TextInputHints,
69
69
  PaintProps,
70
+ ShadowProps,
71
+ FilterProps,
70
72
  BlendMode,
71
73
  DrawStyle,
72
74
  StrokeCap,
package/src/types.d.ts CHANGED
@@ -189,7 +189,11 @@ export interface PaintProps {
189
189
  * paint inside, so the box is the outer edge) - except on `path`, where the
190
190
  * shadow mirrors the element's own fill/stroke silhouette and `spread` is
191
191
  * rejected (an arbitrary path cannot be inflated exactly). `color` is
192
- * required; there is no currentColor to inherit.
192
+ * required; there is no currentColor to inherit. Animates as one value
193
+ * under `transition={{ shadow }}`: offset, blur, spread and color move
194
+ * together (the color in oklab), an unset shadow counts as none (zero,
195
+ * transparent), so a shadow fades in from nothing and a `null` write
196
+ * fades it out.
193
197
  */
194
198
  export interface ShadowProps {
195
199
  x?: number
@@ -484,7 +488,7 @@ export type TransitionCurve = "linear" | "ease" | "ease-in" | "ease-out" | "ease
484
488
  * spring entry is a tween of the entry's duration.
485
489
  */
486
490
  export interface TransitionEndpoint {
487
- value: number | string
491
+ value: number | string | ShadowProps | null
488
492
  duration?: number
489
493
  curve?: TransitionCurve
490
494
  bounce?: number
@@ -509,11 +513,12 @@ export interface TransitionSpring {
509
513
  * Mount-time enter animation: at the element's first attach the property
510
514
  * snaps to this value and animates to the value it mounted with. Numbers
511
515
  * for the scalar properties; the color property takes a CSS color string
512
- * or packed number, or a {@link TransitionEndpoint} giving the enter its
516
+ * or packed number; the shadow property a {@link ShadowProps} object or
517
+ * `null` for none; or a {@link TransitionEndpoint} giving the enter its
513
518
  * own curve, duration, bounce or delay. Per-property entries only (not
514
519
  * under `all`); a later move or reorder re-runs nothing.
515
520
  */
516
- from?: number | string | TransitionEndpoint
521
+ from?: number | string | ShadowProps | null | TransitionEndpoint
517
522
  /**
518
523
  * Removal exit animation: when an element unmounts, every `exit`
519
524
  * declared on it or under it animates its property to this value
@@ -528,7 +533,7 @@ export interface TransitionSpring {
528
533
  * motion: an ease-out enter reads wrong played backwards, so pair it with
529
534
  * `exit: { value, curve: "ease-in" }`.
530
535
  */
531
- exit?: number | string | TransitionEndpoint
536
+ exit?: number | string | ShadowProps | null | TransitionEndpoint
532
537
  }
533
538
 
534
539
  /**
@@ -547,11 +552,12 @@ export interface TransitionTween {
547
552
  * Mount-time enter animation: at the element's first attach the property
548
553
  * snaps to this value and animates to the value it mounted with. Numbers
549
554
  * for the scalar properties; the color property takes a CSS color string
550
- * or packed number, or a {@link TransitionEndpoint} giving the enter its
555
+ * or packed number; the shadow property a {@link ShadowProps} object or
556
+ * `null` for none; or a {@link TransitionEndpoint} giving the enter its
551
557
  * own curve, duration, bounce or delay. Per-property entries only (not
552
558
  * under `all`); a later move or reorder re-runs nothing.
553
559
  */
554
- from?: number | string | TransitionEndpoint
560
+ from?: number | string | ShadowProps | null | TransitionEndpoint
555
561
  /**
556
562
  * Removal exit animation: when an element unmounts, every `exit`
557
563
  * declared on it or under it animates its property to this value
@@ -566,7 +572,7 @@ export interface TransitionTween {
566
572
  * motion: an ease-out enter reads wrong played backwards, so pair it with
567
573
  * `exit: { value, curve: "ease-in" }`.
568
574
  */
569
- exit?: number | string | TransitionEndpoint
575
+ exit?: number | string | ShadowProps | null | TransitionEndpoint
570
576
  }
571
577
 
572
578
  /**
@@ -579,7 +585,11 @@ export type TransitionShorthand = string
579
585
 
580
586
  export type Transition = TransitionSpring | TransitionTween | TransitionShorthand
581
587
 
582
- /** The property names a transition can cover (numeric scalars). */
588
+ /**
589
+ * The property names a transition can cover: the numeric scalars, `color`
590
+ * (solid colors, in oklab) and `shadow` (the whole {@link ShadowProps}
591
+ * value).
592
+ */
583
593
  export type TransitionPropName =
584
594
  | "x"
585
595
  | "y"
@@ -612,6 +622,7 @@ export type TransitionPropName =
612
622
  | "strokeWidth"
613
623
  | "radius"
614
624
  | "color"
625
+ | "shadow"
615
626
 
616
627
  /**
617
628
  * Payload of onTransitionEnd: which animated property finished. `"layout"`
@@ -637,8 +648,9 @@ export interface TransitionProps {
637
648
  * properties the element carries animate (a d-rect has x, a view's x is
638
649
  * its transform); the initial values (every write before the element's
639
650
  * first paint) never animate unless the entry sets `from` (an enter
640
- * animation), and a non-numeric write (e.g. null) cancels the running
641
- * animation and snaps. `null` clears the
651
+ * animation), and a write the property cannot animate (null on a scalar,
652
+ * a gradient color) cancels the running animation and snaps; `shadow`
653
+ * alone animates to and from `null`, its none. `null` clears the
642
654
  * declaration; already-running animations finish. A spec built in a
643
655
  * conditional widens `curve` to `string` for TypeScript; write
644
656
  * `satisfies Transition` on the branch.