@occluze/umber 0.3.0 → 0.4.1
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/README.md +93 -47
- package/THIRD-PARTY-NOTICES.md +33 -0
- package/dist/chunks/badge.js +2 -2
- package/dist/chunks/basis.js +2 -2
- package/dist/chunks/batches.js +2 -0
- package/dist/chunks/capture.js +2 -2
- package/dist/chunks/covers.js +2 -2
- package/dist/chunks/curves.js +2 -2
- package/dist/chunks/flip.js +2 -2
- package/dist/chunks/fx.js +2 -2
- package/dist/chunks/gl.js +2 -2
- package/dist/chunks/glsl.js +2 -2
- package/dist/chunks/glyphs.js +2 -0
- package/dist/chunks/inspect.js +2 -2
- package/dist/chunks/instances.js +2 -2
- package/dist/chunks/layers.js +2 -2
- package/dist/chunks/licence.js +2 -2
- package/dist/chunks/morph.js +2 -2
- package/dist/chunks/pace.js +2 -0
- package/dist/chunks/patch.js +2 -2
- package/dist/chunks/prepared.js +2 -2
- package/dist/chunks/profiler.js +2 -2
- package/dist/chunks/recheck.js +2 -0
- package/dist/chunks/resize.js +2 -0
- package/dist/chunks/restore.js +2 -2
- package/dist/chunks/shapes.js +2 -2
- package/dist/chunks/sim.js +2 -2
- package/dist/chunks/text.js +2 -2
- package/dist/chunks/video.js +2 -2
- package/dist/chunks/vocabulary.js +2 -2
- package/dist/chunks/warm.js +2 -2
- package/dist/modules/debug.js +2 -2
- package/dist/modules/debug.mjs +2 -2
- package/dist/modules/handoff.js +2 -2
- package/dist/modules/handoff.mjs +2 -2
- package/dist/modules/input.js +2 -2
- package/dist/modules/input.mjs +2 -2
- package/dist/modules/scrollfx.js +2 -2
- package/dist/modules/scrollfx.mjs +2 -2
- package/dist/modules/scrub.js +2 -2
- package/dist/modules/scrub.mjs +2 -2
- package/dist/modules/three.js +2 -2
- package/dist/modules/three.mjs +2 -2
- package/dist/node/assets.mjs +4 -2
- package/dist/node/astro.mjs +26 -18
- package/dist/node/cli.mjs +63 -10
- package/dist/node/shared-NFSQ5J4B.mjs +2116 -0
- package/dist/node/{shared-4FIU6DYP.mjs → shared-OUFNIXQ7.mjs} +106 -17
- package/dist/node/vite.mjs +7 -3
- package/dist/prepared.mjs +2 -0
- package/dist/umber.css +1 -1
- package/dist/umber.js +2 -2
- package/dist/umber.mjs +2 -2
- package/docs/AI-quick.md +43 -87
- package/docs/AI.md +1977 -1829
- package/docs/npm.md +13 -16
- package/package.json +32 -48
- package/types/assets.d.ts +109 -4
- package/types/astro.d.ts +20 -23
- package/types/debug.d.ts +1 -1
- package/types/esm.d.ts +2 -6
- package/types/input.d.ts +3 -3
- package/types/loop.d.ts +21 -9
- package/types/module.d.ts +0 -2
- package/types/scrollfx.d.ts +5 -41
- package/types/scrub.d.ts +2 -2
- package/types/three.d.ts +26 -1
- package/types/umber.d.ts +152 -155
- package/types/vite.d.ts +3 -3
- package/dist/chunks/views.js +0 -2
- package/dist/frameworks/astro.mjs +0 -2
- package/dist/frameworks/react.mjs +0 -2
- package/dist/frameworks/svelte.mjs +0 -2
- package/dist/frameworks/vue.mjs +0 -2
- package/dist/modules/router-swap.js +0 -2
- package/dist/modules/router.js +0 -2
- package/dist/modules/router.mjs +0 -2
- package/dist/modules/scroll-more.js +0 -2
- package/dist/modules/scroll-touch.js +0 -2
- package/dist/modules/scroll.js +0 -2
- package/dist/modules/scroll.mjs +0 -2
- package/dist/node/shared-3Q24RNIF.mjs +0 -602
- package/types/react.d.ts +0 -15
- package/types/router.d.ts +0 -223
- package/types/scroll.d.ts +0 -190
- package/types/svelte.d.ts +0 -16
- package/types/vue.d.ts +0 -14
package/types/scrollfx.d.ts
CHANGED
|
@@ -1,56 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types for the scroll effects module (@occluze/umber/scrollfx).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Scroll effects from attributes on Umber's one clock, for any element, with GL planes in
|
|
5
5
|
* step: in-view classes and calls, a scroll-progress CSS variable, parallax, lag,
|
|
6
|
-
* per-element velocity (CSS and GL uniforms), pinned and horizontal sections
|
|
7
|
-
* snapping (with the scroll module).
|
|
6
|
+
* per-element velocity (CSS and GL uniforms), and pinned and horizontal sections.
|
|
8
7
|
*
|
|
9
8
|
* import { ScrollFx } from "@occluze/umber/scrollfx";
|
|
10
9
|
* umber.use(ScrollFx); // or createUmber({ modules: [ScrollFx] })
|
|
11
|
-
* <script src=".../umber@x.y.z/umber.js" data-umber-modules="
|
|
10
|
+
* <script src=".../umber@x.y.z/umber.js" data-umber-modules="scrollfx"></script>
|
|
12
11
|
*
|
|
13
|
-
* HTML: data-umber="inview"
|
|
12
|
+
* HTML: data-umber="inview" or data-umber-inview="class" (+ -repeat, -start, -end), data-umber-call="event",
|
|
14
13
|
* data-umber-progress[="--var"] (+ -start, -end, -event), data-umber-speed="0.2" (+ -touch, -ignore-fold),
|
|
15
|
-
* data-umber-lag="0.1", data-umber-velocity[="0.12"], data-umber="pin"
|
|
16
|
-
* data-umber-snap[="start|center|end"].
|
|
14
|
+
* data-umber-lag="0.1", data-umber-velocity[="0.12"], data-umber="pin" or data-umber-pin="80px", data-umber="horizontal".
|
|
17
15
|
*/
|
|
18
16
|
|
|
19
17
|
import type { UmberModule } from "./umber.js";
|
|
20
18
|
|
|
21
|
-
export interface SnapOptions {
|
|
22
|
-
/** "proximity": only to a point within `distance` of where the scroll is heading; "mandatory": always to the nearest. @default "proximity" */
|
|
23
|
-
type?: "proximity" | "mandatory";
|
|
24
|
-
/** How near (px, or "50%" of a screen) a point must be for proximity snapping. @default "50%" */
|
|
25
|
-
distance?: number | string;
|
|
26
|
-
/** ms after the last wheel or touch move before it snaps. @default 150 */
|
|
27
|
-
debounce?: number;
|
|
28
|
-
/** This snap's lerp (else the scroll module's). */
|
|
29
|
-
lerp?: number;
|
|
30
|
-
/** Seconds, with `easing` (instead of the lerp). */
|
|
31
|
-
duration?: number;
|
|
32
|
-
easing?: (t: number) => number;
|
|
33
|
-
/** As it starts toward point `index` (in page order) at `value` px. */
|
|
34
|
-
onSnapStart?: (snap: { index: number; value: number }) => void;
|
|
35
|
-
/** When it landed there. */
|
|
36
|
-
onSnapComplete?: (snap: { index: number; value: number }) => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** umber.scrollFx.snap: smooth snapping's controls. */
|
|
40
|
-
export interface SnapApi {
|
|
41
|
-
/** To the next or the previous snap point. */
|
|
42
|
-
next(): void;
|
|
43
|
-
previous(): void;
|
|
44
|
-
/** To snap point `index` (page order). */
|
|
45
|
-
goTo(index: number): void;
|
|
46
|
-
/** No snapping until start(). */
|
|
47
|
-
stop(): void;
|
|
48
|
-
start(): void;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
19
|
export interface ScrollFxOptions {
|
|
52
|
-
/** Smooth snapping to [data-umber-snap] elements after a wheel or touch gesture (needs the scroll module); false: off. @default true */
|
|
53
|
-
snap?: boolean | SnapOptions;
|
|
54
20
|
/** The smoothing of data-umber-velocity when it gives none: the share of the way per 60 fps frame. @default 0.12 */
|
|
55
21
|
velocitySmooth?: number;
|
|
56
22
|
/** px per second that reads as 1 in --umber-velocity and uPlaneVelocity (clamped to -1..1). @default 3600 */
|
|
@@ -61,8 +27,6 @@ export interface ScrollFxOptions {
|
|
|
61
27
|
export interface ScrollFxApi {
|
|
62
28
|
/** Look for the attributes in `root` now (new content that no "added" event reports). */
|
|
63
29
|
scan(root?: ParentNode): void;
|
|
64
|
-
/** Smooth snapping's controls. */
|
|
65
|
-
readonly snap: SnapApi;
|
|
66
30
|
destroy(): void;
|
|
67
31
|
}
|
|
68
32
|
|
package/types/scrub.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Scroll-scrubbed video. Load the module, then mark a video:
|
|
5
5
|
*
|
|
6
6
|
* import { Scrub } from "@occluze/umber/scrub";
|
|
7
|
-
* const
|
|
7
|
+
* const umber = createUmber({ modules: [Scrub] });
|
|
8
8
|
* <video data-umber="video" data-umber-scrub src="/scrub.mp4" poster="/scrub.jpg" muted playsinline preload="none">
|
|
9
9
|
*
|
|
10
10
|
* const s = umber.plane(el)?.scrub;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* data-umber-scrub "" (scroll drives it) | "manual"
|
|
15
15
|
* data-umber-scrub-start / -end "top bottom" / "bottom top" (element edge, viewport line; %, px)
|
|
16
16
|
* data-umber-scrub-track "parent" | "closest section" | a selector (default: the video)
|
|
17
|
-
* data-umber-scrub-smooth seconds to catch up (default 0.12; 0
|
|
17
|
+
* data-umber-scrub-smooth seconds to catch up (default 0.12; set 0 beside a smooth scroller, which smooths already)
|
|
18
18
|
* data-umber-scrub-source auto | decoder | video | frames
|
|
19
19
|
* data-umber-scrub-src / -src-mobile the scrub MP4 (default: the video's src); -mobile on
|
|
20
20
|
* phones and weak GPUs (device tier not "high")
|
package/types/three.d.ts
CHANGED
|
@@ -23,7 +23,18 @@ import type { KTX2Loader } from "three/addons/loaders/KTX2Loader.js";
|
|
|
23
23
|
import type { MeshoptDecoder } from "three/addons/libs/meshopt_decoder.module.js";
|
|
24
24
|
import type { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";
|
|
25
25
|
import type { clone } from "three/addons/utils/SkeletonUtils.js";
|
|
26
|
-
import type {
|
|
26
|
+
import type {
|
|
27
|
+
CameraLike,
|
|
28
|
+
RectLike,
|
|
29
|
+
ScreenPoint,
|
|
30
|
+
Tracker,
|
|
31
|
+
Umber,
|
|
32
|
+
UmberModule,
|
|
33
|
+
Vec3Like,
|
|
34
|
+
View,
|
|
35
|
+
ViewFrame,
|
|
36
|
+
WorldBox,
|
|
37
|
+
} from "./umber.js";
|
|
27
38
|
|
|
28
39
|
/** The three.js module (`import * as THREE from "three"`). */
|
|
29
40
|
export type ThreeModule = typeof THREE;
|
|
@@ -192,6 +203,20 @@ export interface ThreeApi {
|
|
|
192
203
|
page(): Promise<PageScene | null>;
|
|
193
204
|
/** A soft key, fill and sky light added to `scene` (for materials the environment does not light enough). null until three.js is here. */
|
|
194
205
|
lights(scene: Scene, intensity?: number): Group | null;
|
|
206
|
+
// The maths between DOM px and world units: pure functions. `frame` = the canvas box in viewport px (default: the viewport).
|
|
207
|
+
/** CSS px per world unit at `distance` (default: the camera's distance to z = 0) on a picture `heightPx` tall (default: the viewport). */
|
|
208
|
+
pxPerWorld(camera: CameraLike, distance?: number, heightPx?: number): number;
|
|
209
|
+
/** Aim the camera so it sees exactly `size` at z = 0, `unit` CSS px per world unit (default 1). */
|
|
210
|
+
fitCamera<C extends CameraLike>(camera: C, size: { width: number; height: number }, unit?: number): C;
|
|
211
|
+
/** A DOM rect's centre on the plane z (default 0) and its size there; writes x, y, z into `out`. */
|
|
212
|
+
rectToWorld(
|
|
213
|
+
rect: RectLike,
|
|
214
|
+
camera: CameraLike,
|
|
215
|
+
out?: Partial<Vec3Like> | null,
|
|
216
|
+
options?: { z?: number; frame?: RectLike },
|
|
217
|
+
): WorldBox;
|
|
218
|
+
/** A world point in viewport CSS px. */
|
|
219
|
+
worldToRect(point: Vec3Like, camera: CameraLike, frame?: RectLike): ScreenPoint;
|
|
195
220
|
}
|
|
196
221
|
|
|
197
222
|
/** data-umber-model-<key> / --umber-model-<key>, with their defaults. */
|