@oxy.so/bloom 23.8.0 → 23.8.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/android/src/main/java/so/oxy/bloom/AvatarLoops.kt +293 -0
- package/android/src/main/java/so/oxy/bloom/AvatarSurface.kt +351 -0
- package/android/src/main/java/so/oxy/bloom/BloomPackage.kt +1 -1
- package/docs/agent-avatar.mdx +77 -1
- package/docs/no-nativewind.mdx +3 -1
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/docs/theme.mdx +21 -0
- package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js +267 -111
- package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js.map +1 -1
- package/lib/commonjs/agent-avatar/VectorNativeSurface.js +75 -0
- package/lib/commonjs/agent-avatar/VectorNativeSurface.js.map +1 -0
- package/lib/commonjs/agent-avatar/vector-loop.js +161 -0
- package/lib/commonjs/agent-avatar/vector-loop.js.map +1 -0
- package/lib/commonjs/agent-avatar/vector-visibility.js +4 -1
- package/lib/commonjs/agent-avatar/vector-visibility.js.map +1 -1
- package/lib/commonjs/blur/BlurIsland.js +112 -118
- package/lib/commonjs/blur/BlurIsland.js.map +1 -1
- package/lib/commonjs/button/Button.js +12 -22
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/button/GroupBase.js +35 -50
- package/lib/commonjs/button/GroupBase.js.map +1 -1
- package/lib/commonjs/floating/lens/lens-frame.js +286 -0
- package/lib/commonjs/floating/lens/lens-frame.js.map +1 -0
- package/lib/commonjs/floating/lens/lens-material.js +1 -1
- package/lib/commonjs/page-header/PageHeader.js +24 -15
- package/lib/commonjs/page-header/PageHeader.js.map +1 -1
- package/lib/commonjs/panel-routing/expo-router/StackScene.js +1 -0
- package/lib/commonjs/panel-routing/expo-router/StackScene.js.map +1 -1
- package/lib/commonjs/surface/Surface.js +64 -193
- package/lib/commonjs/surface/Surface.js.map +1 -1
- package/lib/commonjs/tab-bar/TabBarBase.js +18 -15
- package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -1
- package/lib/module/agent-avatar/VectorCharacterAvatar.js +268 -112
- package/lib/module/agent-avatar/VectorCharacterAvatar.js.map +1 -1
- package/lib/module/agent-avatar/VectorNativeSurface.js +66 -0
- package/lib/module/agent-avatar/VectorNativeSurface.js.map +1 -0
- package/lib/module/agent-avatar/vector-loop.js +150 -0
- package/lib/module/agent-avatar/vector-loop.js.map +1 -0
- package/lib/module/agent-avatar/vector-visibility.js +3 -1
- package/lib/module/agent-avatar/vector-visibility.js.map +1 -1
- package/lib/module/blur/BlurIsland.js +112 -116
- package/lib/module/blur/BlurIsland.js.map +1 -1
- package/lib/module/button/Button.js +13 -23
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/button/GroupBase.js +37 -52
- package/lib/module/button/GroupBase.js.map +1 -1
- package/lib/module/floating/lens/lens-frame.js +282 -0
- package/lib/module/floating/lens/lens-frame.js.map +1 -0
- package/lib/module/floating/lens/lens-material.js +1 -1
- package/lib/module/page-header/PageHeader.js +24 -15
- package/lib/module/page-header/PageHeader.js.map +1 -1
- package/lib/module/panel-routing/expo-router/StackScene.js +1 -0
- package/lib/module/panel-routing/expo-router/StackScene.js.map +1 -1
- package/lib/module/surface/Surface.js +65 -194
- package/lib/module/surface/Surface.js.map +1 -1
- package/lib/module/tab-bar/TabBarBase.js +18 -15
- package/lib/module/tab-bar/TabBarBase.js.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/VectorNativeSurface.d.ts +75 -0
- package/lib/typescript/commonjs/agent-avatar/VectorNativeSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/vector-loop.d.ts +93 -0
- package/lib/typescript/commonjs/agent-avatar/vector-loop.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/vector-visibility.d.ts +2 -0
- package/lib/typescript/commonjs/agent-avatar/vector-visibility.d.ts.map +1 -1
- package/lib/typescript/commonjs/blur/BlurIsland.d.ts +1 -1
- package/lib/typescript/commonjs/blur/BlurIsland.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/GroupBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/lens/lens-frame.d.ts +52 -0
- package/lib/typescript/commonjs/floating/lens/lens-frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/floating/lens/lens-material.d.ts +1 -1
- package/lib/typescript/commonjs/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/panel-routing/expo-router/StackScene.d.ts.map +1 -1
- package/lib/typescript/commonjs/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/VectorNativeSurface.d.ts +75 -0
- package/lib/typescript/module/agent-avatar/VectorNativeSurface.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/vector-loop.d.ts +93 -0
- package/lib/typescript/module/agent-avatar/vector-loop.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/vector-visibility.d.ts +2 -0
- package/lib/typescript/module/agent-avatar/vector-visibility.d.ts.map +1 -1
- package/lib/typescript/module/blur/BlurIsland.d.ts +1 -1
- package/lib/typescript/module/blur/BlurIsland.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/button/GroupBase.d.ts.map +1 -1
- package/lib/typescript/module/floating/lens/lens-frame.d.ts +52 -0
- package/lib/typescript/module/floating/lens/lens-frame.d.ts.map +1 -0
- package/lib/typescript/module/floating/lens/lens-material.d.ts +1 -1
- package/lib/typescript/module/page-header/PageHeader.d.ts.map +1 -1
- package/lib/typescript/module/panel-routing/expo-router/StackScene.d.ts.map +1 -1
- package/lib/typescript/module/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent-avatar/VectorCharacterAvatar.tsx +327 -120
- package/src/agent-avatar/VectorNativeSurface.tsx +117 -0
- package/src/agent-avatar/vector-loop.ts +213 -0
- package/src/agent-avatar/vector-visibility.ts +3 -1
- package/src/blur/BlurIsland.tsx +16 -14
- package/src/button/Button.tsx +19 -36
- package/src/button/GroupBase.tsx +42 -56
- package/src/floating/lens/lens-frame.tsx +195 -0
- package/src/floating/lens/lens-material.ts +1 -1
- package/src/page-header/PageHeader.tsx +26 -13
- package/src/panel-routing/expo-router/StackScene.tsx +9 -0
- package/src/surface/Surface.tsx +13 -28
- package/src/tab-bar/TabBarBase.tsx +13 -8
- package/lib/commonjs/floating/lens/lens-button-host.js +0 -218
- package/lib/commonjs/floating/lens/lens-button-host.js.map +0 -1
- package/lib/module/floating/lens/lens-button-host.js +0 -214
- package/lib/module/floating/lens/lens-button-host.js.map +0 -1
- package/lib/typescript/commonjs/floating/lens/lens-button-host.d.ts +0 -34
- package/lib/typescript/commonjs/floating/lens/lens-button-host.d.ts.map +0 -1
- package/lib/typescript/module/floating/lens/lens-button-host.d.ts +0 -34
- package/lib/typescript/module/floating/lens/lens-button-host.d.ts.map +0 -1
- package/src/floating/lens/lens-button-host.tsx +0 -148
package/docs/agent-avatar.mdx
CHANGED
|
@@ -360,7 +360,83 @@ contexts or shared instanced GPU scenes in the production avatar path.
|
|
|
360
360
|
Browser checks do not establish native crowd performance. Native device verification is
|
|
361
361
|
still required; the shared numeric renderer alone does not prove native SVG drawing speed.
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
### The rest loop
|
|
364
|
+
|
|
365
|
+
A frame is expensive: every one projects the meshes, rasterises a 322 × 322 depth buffer for the
|
|
366
|
+
occlusion masks and traces their contours, whatever size the avatar is drawn at. On Hermes that
|
|
367
|
+
was about 95 ms for Alia, so on a Pixel 8a the "Ask Alia" icon on Mention's Home kept the JS thread
|
|
368
|
+
at 94 % and still only reached about 10 frames a second.
|
|
369
|
+
|
|
370
|
+
At rest, though, a character repeats itself. With no gesture, pointer, mood or transition, and no
|
|
371
|
+
reference face (the `bot_*` shapes, see below), its frame depends only on where it is in its idle
|
|
372
|
+
clip. So the idle clip is drawn once, on a grid of about 30 frames a second (`vector-loop.ts`), and
|
|
373
|
+
every avatar with the same geometry and paint shares those frames: the loop. Each grid frame is
|
|
374
|
+
painted in turn, computed the first time and remembered after. The web replays the remembered
|
|
375
|
+
frames itself. The loops kept are bounded by `VECTOR_LOOP_CACHE_CHARACTERS` (Alia's loop is about
|
|
376
|
+
2 M path characters, the largest preset's 10 M).
|
|
377
|
+
|
|
378
|
+
### The native surface (Android)
|
|
379
|
+
|
|
380
|
+
On Android every frame is drawn by Bloom's own view, `BloomAvatarSurfaceV1`
|
|
381
|
+
(`android/.../AvatarSurface.kt`, `VectorNativeSurface.tsx`), not by `react-native-svg`: JS hands it
|
|
382
|
+
the frame's outlines, clips and paint as one prop, and it draws them on the hardware canvas with
|
|
383
|
+
the paint `react-native-svg` used (alpha rounding, miter limit, one layer for the entrance
|
|
384
|
+
opacity). At rest it does more: a complete loop is handed to it once and it plays the loop itself,
|
|
385
|
+
its paths parsed once, on its own `Choreographer` clock (waking only when the next loop frame is
|
|
386
|
+
due). Nothing goes through the shadow tree, no bitmap is drawn and no layout event is sent per
|
|
387
|
+
frame, and the JS thread does nothing.
|
|
388
|
+
|
|
389
|
+
Loops are named by `vectorLoopKey`: a hash of the character, its idle clip's tracks and its first
|
|
390
|
+
frame as drawn, so a change to the assets, the paint or the renderer names a different loop. The
|
|
391
|
+
surface keeps the loops in memory and in the app's cache directory (`bloom-avatar-loops`, 48 MB at
|
|
392
|
+
most). At rest the avatar asks its surface for the loop of that name (`loopKey`, answered by
|
|
393
|
+
`onLoop`); a surface that has it, from this start or an earlier one, plays it straight away, so a
|
|
394
|
+
cold start draws only the frame on screen and the first frame. One that has not got it is handed
|
|
395
|
+
the loop once it is complete (`loopTracks`). Playing is `loopClock`: at `epoch`, a
|
|
396
|
+
`performance.now()` reading, the loop is `time` seconds in; Android's `performance.now()` and the
|
|
397
|
+
`Choreographer` frame time are the same monotonic clock, so JS knows exactly which frame is on
|
|
398
|
+
screen. A gesture, a mood, the pointer or the screen going out of view takes the drawing back:
|
|
399
|
+
the JS clock moves on by the time played, the gesture blends from that frame's pose, and the
|
|
400
|
+
surface keeps the frame on screen until JS draws one. `capture` answers the avatar flights'
|
|
401
|
+
snapshot with a PNG. A binary without the view (a JS-only update, an older build) keeps
|
|
402
|
+
`react-native-svg`.
|
|
403
|
+
|
|
404
|
+
iOS: `ios/BloomAvatarSurface.swift` is the same view on Core Animation and `CADisplayLink`. It
|
|
405
|
+
has never been compiled (it was written without a Mac), so it is neither linked
|
|
406
|
+
(`react-native.config.js` keeps `ios: null`) nor packed, and iOS draws with `react-native-svg` and
|
|
407
|
+
replays the remembered frames on the JS thread, as the web does. Link it only after building it
|
|
408
|
+
and checking it on a device.
|
|
409
|
+
|
|
410
|
+
The `bot_*` shapes cannot be played as a loop. Their gaze wanders by a sum of sines at unrelated
|
|
411
|
+
frequencies (`vector-motion.ts`), and their blink repeats every 23 s on top of an 8.8 s idle clip,
|
|
412
|
+
so their motion never repeats and every frame is a new projection: about a third of Alia's frame
|
|
413
|
+
cost (Bun: 1.3 to 2 ms against 5.7 ms). The surface still draws their frames, but the JS cost stays
|
|
414
|
+
until their motion is made periodic, which would change it.
|
|
415
|
+
|
|
416
|
+
Measured on the Pixel 8a, Mention release build, idle on Home with the "Ask Alia" avatar
|
|
417
|
+
(`vector-rest-loop.test.tsx` pins the hand-off, that the surface is handed exactly the JS thread's
|
|
418
|
+
frames, the clock hand-back and a cold start with a kept loop; `AvatarLoopsTest.kt` the native
|
|
419
|
+
path parser, file format and clock):
|
|
420
|
+
|
|
421
|
+
| | JS thread | UI thread | RenderThread | process | window frames/s | cold start, JS |
|
|
422
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
423
|
+
| SVG, every frame computed | 94 % | 9 % | 9 % | 118 % | about 10 | busy throughout |
|
|
424
|
+
| rest loop on the UI thread (Reanimated) | 5 % | 35 % | 28 % | 77 % | 51 | 15.7 s of JS, busy 17 s |
|
|
425
|
+
| native surface | 1 % | 21 % | 24 % | 53 % | 32 | 2.7 s of JS, busy 5 s (loop kept); 17.3 s, busy 20 s (first start) |
|
|
426
|
+
|
|
427
|
+
(2026-11-20, two runs each, back to back; the first row is the earlier measurement. A screen
|
|
428
|
+
recording confirms 30 distinct avatar frames a second.) The first start after installing, or after
|
|
429
|
+
the loop's assets, paint or renderer change, still computes the loop once.
|
|
430
|
+
|
|
431
|
+
What remains is not the avatar's drawing but the window's: a profile of the native-surface build
|
|
432
|
+
puts the avatar's paths at about 3 % of the RenderThread and its `onDraw` at about 4 % of the UI
|
|
433
|
+
thread. The rest is Android redrawing Mention's whole window 30 times a second (`prepareTree` over
|
|
434
|
+
every view, replaying every display list, submitting the buffer) and React Native's per-frame
|
|
435
|
+
callbacks, which any view animating in that window costs. With the avatar still, the process idles
|
|
436
|
+
at about 9 %. Going lower needs the avatar off the window's surface (its own `SurfaceView`), which
|
|
437
|
+
draws above every view of the window, sheets and menus included.
|
|
438
|
+
|
|
439
|
+
`className` and `style` apply to the outer layout node. `label` defaults to the
|
|
364
440
|
translated “Agent avatar”; `locale` overrides the scope and `accessibilityLabel`
|
|
365
441
|
overrides the accessible name. Use an agent's name when it identifies them.
|
|
366
442
|
|
package/docs/no-nativewind.mdx
CHANGED
|
@@ -47,7 +47,9 @@ tokens. Colour comes from `useColorTokens()` (`theme/color-tokens.ts`):
|
|
|
47
47
|
|
|
48
48
|
- Native: the nearest scope's token record (the provider's, a colour scope's, a
|
|
49
49
|
seed scope's, or the one a portal bridge carries), so a colour is exactly the
|
|
50
|
-
value the class read, in an adaptive theme too.
|
|
50
|
+
value the class read, in an adaptive theme too. That record is the preset's
|
|
51
|
+
in `mode="adaptive"`, not the platform's dynamic colours `useTheme()` holds
|
|
52
|
+
([Theme](./theme.mdx), *Which reader*).
|
|
51
53
|
- Web: the token's CSS variable (`var(--primary)`), which the theme writes on
|
|
52
54
|
the document and a colour scope on its element, as the classes read it. A
|
|
53
55
|
theme switch re-renders nothing on the web; the server's first paint is the
|
package/docs/task-catalog.json
CHANGED
package/docs/task-catalog.mdx
CHANGED
|
@@ -8,7 +8,7 @@ order: 1
|
|
|
8
8
|
|
|
9
9
|
# Choose an API by task
|
|
10
10
|
|
|
11
|
-
This guide belongs to **@oxy.so/bloom 23.8.
|
|
11
|
+
This guide belongs to **@oxy.so/bloom 23.8.1**. Read it from the installed package alongside [the structured index](./task-catalog.json). A source build version is not a registry-publication receipt. Use the containing package’s manifest for exact peer ranges.
|
|
12
12
|
|
|
13
13
|
Start under the application’s BloomProvider and follow [getting started](./getting-started.mdx) for CSS, fonts and platform setup. These examples accept domain content/actions and require a bounded host. They do not add a provider per route. For document scrolling, follow [the host contract](./compose-layouts.mdx); Expo’s bounded reset must not silently prevent document overflow.
|
|
14
14
|
|
package/docs/theme.mdx
CHANGED
|
@@ -152,6 +152,27 @@ function Row() {
|
|
|
152
152
|
Tokens are what the theme publishes; `useTheme().colors` keeps the JS palette
|
|
153
153
|
for colour arithmetic.
|
|
154
154
|
|
|
155
|
+
### Which reader
|
|
156
|
+
|
|
157
|
+
Bloom has one reader for the colours a style paints: `useColorTokens()` (or
|
|
158
|
+
`createTokenStyles`). The other two have narrower jobs:
|
|
159
|
+
|
|
160
|
+
- `useTheme()` is the theme itself: its mode, `isDark`, and `colors` as values
|
|
161
|
+
to compute with (mixing, contrast, alpha on a colour that is not a token).
|
|
162
|
+
Paint the result; do not read `colors` for a colour a style takes as it is.
|
|
163
|
+
- `useThemePaint()` is the older paint reader (on a prepainted web document its
|
|
164
|
+
colours are `--bloom-paint-*` variables). It stays public, as apps call it,
|
|
165
|
+
and new Bloom code does not.
|
|
166
|
+
|
|
167
|
+
Bloom's components still read `useTheme().colors` for final styles in most
|
|
168
|
+
families; they move to the tokens family by family, each move proved by the
|
|
169
|
+
no-NativeWind parity harness on native and Chrome on the web, with no rendered
|
|
170
|
+
value changed. One gap comes first: on native in `mode="adaptive"` the
|
|
171
|
+
provider's token record is the preset's, while `useTheme().colors` holds the
|
|
172
|
+
platform's dynamic colours (`BloomThemeProvider` builds `themeVars` from the
|
|
173
|
+
preset alone and `themeColors` with `isAdaptive`). Until the record follows the
|
|
174
|
+
adaptive palette, a family moved to the tokens would change colour there.
|
|
175
|
+
|
|
155
176
|
## Mobile web document appearance
|
|
156
177
|
|
|
157
178
|
The app-wide provider is the sole runtime owner of document appearance. It
|