@oxy.so/bloom 23.9.0 → 23.10.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/docs/bloom-lang-spec.mdx +730 -0
- package/docs/bloom-language-classnames.mdx +6 -6
- package/docs/bloom-language-codemod.mdx +10 -0
- package/docs/bloom-language-for-agents.mdx +20 -4
- package/docs/bloom-language-from-jsx.mdx +1 -0
- package/docs/bloom-language-getting-started.mdx +2 -1
- package/docs/bloom-language-modifiers.mdx +28 -16
- package/docs/bloom-language-nodes.mdx +1301 -440
- package/docs/bloom-language-tokens.mdx +2 -0
- package/docs/bloom-language-tour.mdx +54 -9
- package/docs/bloom-language.mdx +142 -33
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js +18 -10
- package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js.map +1 -1
- package/lib/commonjs/agent-avatar/VectorStaticPortrait.js +102 -77
- package/lib/commonjs/agent-avatar/VectorStaticPortrait.js.map +1 -1
- package/lib/commonjs/agent-avatar/vector-halo.js +57 -0
- package/lib/commonjs/agent-avatar/vector-halo.js.map +1 -0
- package/lib/commonjs/avatar/Avatar.js +65 -62
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/avatar/CharacterFace.js +50 -45
- package/lib/commonjs/avatar/CharacterFace.js.map +1 -1
- package/lib/commonjs/avatar-group/AvatarGroupBase.js +311 -244
- package/lib/commonjs/avatar-group/AvatarGroupBase.js.map +1 -1
- package/lib/commonjs/data-table/DataTable.js +10 -11
- package/lib/commonjs/data-table/DataTable.js.map +1 -1
- package/lib/commonjs/image/BloomImage.js +3 -0
- package/lib/commonjs/image/BloomImage.js.map +1 -1
- package/lib/commonjs/stat-bar/StatBar.js +41 -43
- package/lib/commonjs/stat-bar/StatBar.js.map +1 -1
- package/lib/module/agent-avatar/VectorCharacterAvatar.js +18 -10
- package/lib/module/agent-avatar/VectorCharacterAvatar.js.map +1 -1
- package/lib/module/agent-avatar/VectorStaticPortrait.js +103 -78
- package/lib/module/agent-avatar/VectorStaticPortrait.js.map +1 -1
- package/lib/module/agent-avatar/vector-halo.js +52 -0
- package/lib/module/agent-avatar/vector-halo.js.map +1 -0
- package/lib/module/avatar/Avatar.js +65 -62
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/avatar/CharacterFace.js +50 -45
- package/lib/module/avatar/CharacterFace.js.map +1 -1
- package/lib/module/avatar-group/AvatarGroupBase.js +311 -244
- package/lib/module/avatar-group/AvatarGroupBase.js.map +1 -1
- package/lib/module/data-table/DataTable.js +10 -11
- package/lib/module/data-table/DataTable.js.map +1 -1
- package/lib/module/image/BloomImage.js +3 -0
- package/lib/module/image/BloomImage.js.map +1 -1
- package/lib/module/stat-bar/StatBar.js +41 -43
- package/lib/module/stat-bar/StatBar.js.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/VectorStaticPortrait.d.ts +2 -2
- package/lib/typescript/commonjs/agent-avatar/VectorStaticPortrait.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/types.d.ts +6 -0
- package/lib/typescript/commonjs/agent-avatar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/vector-halo.d.ts +32 -0
- package/lib/typescript/commonjs/agent-avatar/vector-halo.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/CharacterFace.d.ts +4 -1
- package/lib/typescript/commonjs/avatar/CharacterFace.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/types.d.ts +9 -0
- package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar-group/AvatarGroupBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/data-table/DataTable.d.ts.map +1 -1
- package/lib/typescript/commonjs/image/BloomImage.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/VectorStaticPortrait.d.ts +2 -2
- package/lib/typescript/module/agent-avatar/VectorStaticPortrait.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/types.d.ts +6 -0
- package/lib/typescript/module/agent-avatar/types.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/vector-halo.d.ts +32 -0
- package/lib/typescript/module/agent-avatar/vector-halo.d.ts.map +1 -0
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/avatar/CharacterFace.d.ts +4 -1
- package/lib/typescript/module/avatar/CharacterFace.d.ts.map +1 -1
- package/lib/typescript/module/avatar/types.d.ts +9 -0
- package/lib/typescript/module/avatar/types.d.ts.map +1 -1
- package/lib/typescript/module/avatar-group/AvatarGroupBase.d.ts.map +1 -1
- package/lib/typescript/module/data-table/DataTable.d.ts.map +1 -1
- package/lib/typescript/module/image/BloomImage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent-avatar/VectorCharacterAvatar.tsx +26 -7
- package/src/agent-avatar/VectorStaticPortrait.tsx +18 -5
- package/src/agent-avatar/types.ts +6 -0
- package/src/agent-avatar/vector-halo.ts +52 -0
- package/src/avatar/Avatar.tsx +2 -0
- package/src/avatar/CharacterFace.tsx +6 -0
- package/src/avatar/types.ts +6 -0
- package/src/avatar-group/AvatarGroupBase.tsx +36 -4
- package/src/data-table/DataTable.tsx +8 -10
- package/src/image/BloomImage.tsx +3 -0
- package/src/stat-bar/StatBar.tsx +14 -14
|
@@ -129,6 +129,7 @@ Taken by: [`.margin()`](bloom-language-modifiers.mdx#margin).
|
|
|
129
129
|
| `'90%'` | "90%" |
|
|
130
130
|
| `'31%'` | "31%" |
|
|
131
131
|
| `'fit'` | "fit-content" |
|
|
132
|
+
| `'auto'` | "auto" |
|
|
132
133
|
| `'1'` | |
|
|
133
134
|
| `'3'` | |
|
|
134
135
|
| `'6'` | |
|
|
@@ -199,6 +200,7 @@ Taken by: [`.frame()`](bloom-language-modifiers.mdx#frame), [`.basis()`](bloom-l
|
|
|
199
200
|
| `'30'` | 30 |
|
|
200
201
|
| `'50'` | 50 |
|
|
201
202
|
| `'60'` | 60 |
|
|
203
|
+
| `'1000'` | 1000 |
|
|
202
204
|
|
|
203
205
|
Taken by: [`.zIndex()`](bloom-language-modifiers.mdx#zindex).
|
|
204
206
|
|
|
@@ -167,7 +167,16 @@ writes it, as SwiftUI's `$value`.
|
|
|
167
167
|
|
|
168
168
|
```tsx check
|
|
169
169
|
import { useState } from 'react';
|
|
170
|
-
import { Button,
|
|
170
|
+
import { Button, Text, VStack, HStack, Spacer } from '@oxy.so/bloom-language';
|
|
171
|
+
import {
|
|
172
|
+
Field,
|
|
173
|
+
Option,
|
|
174
|
+
Picker,
|
|
175
|
+
Segmented,
|
|
176
|
+
TextEditor,
|
|
177
|
+
TextField,
|
|
178
|
+
Toggle,
|
|
179
|
+
} from '@oxy.so/bloom-language/inputs';
|
|
171
180
|
|
|
172
181
|
export function ProfileForm({ save }: { save: (profile: { name: string; bio: string }) => void }) {
|
|
173
182
|
const [name, setName] = useState('');
|
|
@@ -199,7 +208,15 @@ export function ProfileForm({ save }: { save: (profile: { name: string; bio: str
|
|
|
199
208
|
A view sets values on everything inside it, as SwiftUI's environment does.
|
|
200
209
|
|
|
201
210
|
```tsx check
|
|
202
|
-
import {
|
|
211
|
+
import {
|
|
212
|
+
Button,
|
|
213
|
+
HStack,
|
|
214
|
+
Text,
|
|
215
|
+
VStack,
|
|
216
|
+
defineEnvironment,
|
|
217
|
+
useEnvironment,
|
|
218
|
+
view,
|
|
219
|
+
} from '@oxy.so/bloom-language';
|
|
203
220
|
|
|
204
221
|
export const Compact = defineEnvironment('compact', false);
|
|
205
222
|
|
|
@@ -249,7 +266,18 @@ Bloom, not in each app.
|
|
|
249
266
|
## Layout
|
|
250
267
|
|
|
251
268
|
```tsx check
|
|
252
|
-
import {
|
|
269
|
+
import {
|
|
270
|
+
Avatar,
|
|
271
|
+
Badge,
|
|
272
|
+
Button,
|
|
273
|
+
HStack,
|
|
274
|
+
Icon,
|
|
275
|
+
Text,
|
|
276
|
+
VStack,
|
|
277
|
+
ZStack,
|
|
278
|
+
Fill,
|
|
279
|
+
} from '@oxy.so/bloom-language';
|
|
280
|
+
import { ViewThatFits } from '@oxy.so/bloom-language/view-that-fits';
|
|
253
281
|
import { RiCloseLine } from '@oxy.so/bloom/icons/RiCloseLine';
|
|
254
282
|
|
|
255
283
|
export const header = HStack(Avatar('https://example.com/a.png').size('md'), Text('Ana Lima'))
|
|
@@ -291,7 +319,8 @@ export const progress = ViewThatFits('horizontal', Text('12 of 40 done'), Text('
|
|
|
291
319
|
|
|
292
320
|
```tsx check
|
|
293
321
|
import { useCallback } from 'react';
|
|
294
|
-
import { Avatar, HStack,
|
|
322
|
+
import { Avatar, HStack, ScrollView, Text, VStack } from '@oxy.so/bloom-language';
|
|
323
|
+
import { ListItem, VirtualList, type VirtualListRow } from '@oxy.so/bloom-language/list';
|
|
295
324
|
|
|
296
325
|
interface Person { id: string; name: string; role: string; avatar: string }
|
|
297
326
|
|
|
@@ -349,7 +378,8 @@ export default layout(() => TabView());
|
|
|
349
378
|
```tsx check
|
|
350
379
|
// app/(app)/(tabs)/index.tsx
|
|
351
380
|
import { useState } from 'react';
|
|
352
|
-
import { Button, Icon,
|
|
381
|
+
import { Button, Icon, ScrollView, Text, VStack } from '@oxy.so/bloom-language';
|
|
382
|
+
import { ListItem } from '@oxy.so/bloom-language/list';
|
|
353
383
|
import { navigate, screen } from '@oxy.so/bloom-language/router';
|
|
354
384
|
import { RiFilter3Line } from '@oxy.so/bloom/icons/RiFilter3Line';
|
|
355
385
|
|
|
@@ -387,7 +417,9 @@ What a view presents is a modifier on it, shown while its binding holds:
|
|
|
387
417
|
|
|
388
418
|
```tsx check
|
|
389
419
|
import { useState } from 'react';
|
|
390
|
-
import {
|
|
420
|
+
import { Button, Icon, Item, Text, toast } from '@oxy.so/bloom-language';
|
|
421
|
+
import { ConfirmationDialog } from '@oxy.so/bloom-language/confirmation-dialog';
|
|
422
|
+
import { Alert, Dialog, Popover } from '@oxy.so/bloom-language/overlays';
|
|
391
423
|
import { RiInformationLine } from '@oxy.so/bloom/icons/RiInformationLine';
|
|
392
424
|
|
|
393
425
|
export function DeleteButton({ remove }: { remove: () => void }) {
|
|
@@ -438,7 +470,18 @@ Motion is a token too (Bloom's `select`, `expand`, `pop`, `fade`…, or an
|
|
|
438
470
|
app's `defineTokens({ motion })`). A view says what animates and with what:
|
|
439
471
|
|
|
440
472
|
```tsx check
|
|
441
|
-
import {
|
|
473
|
+
import {
|
|
474
|
+
Button,
|
|
475
|
+
HStack,
|
|
476
|
+
Icon,
|
|
477
|
+
Text,
|
|
478
|
+
VStack,
|
|
479
|
+
animate,
|
|
480
|
+
move,
|
|
481
|
+
opacity,
|
|
482
|
+
useMappedValue,
|
|
483
|
+
useMotionValue,
|
|
484
|
+
} from '@oxy.so/bloom-language';
|
|
442
485
|
import { RiHeart3Line } from '@oxy.so/bloom/icons/RiHeart3Line';
|
|
443
486
|
|
|
444
487
|
export function Like({ liked, toggle }: { liked: boolean; toggle: () => void }) {
|
|
@@ -497,7 +540,8 @@ Nearby glasses go in one `GlassGroup`, so they render together and blend:
|
|
|
497
540
|
|
|
498
541
|
```tsx check
|
|
499
542
|
import { useState } from 'react';
|
|
500
|
-
import { Button,
|
|
543
|
+
import { Button, HStack, Icon, useNamespace } from '@oxy.so/bloom-language';
|
|
544
|
+
import { GlassGroup } from '@oxy.so/bloom-language/glass-group';
|
|
501
545
|
import { RiMarkPenLine } from '@oxy.so/bloom/icons/RiMarkPenLine';
|
|
502
546
|
import { RiPencilLine } from '@oxy.so/bloom/icons/RiPencilLine';
|
|
503
547
|
|
|
@@ -557,7 +601,8 @@ re-renders only for the fields it read.
|
|
|
557
601
|
|
|
558
602
|
```tsx check
|
|
559
603
|
import { action, entity, list, source, useEntity, useList } from '@oxy.so/bloom-data';
|
|
560
|
-
import { Button,
|
|
604
|
+
import { Button, ScrollView, Text, view } from '@oxy.so/bloom-language';
|
|
605
|
+
import { ListItem } from '@oxy.so/bloom-language/list';
|
|
561
606
|
|
|
562
607
|
interface Note { id: string; title: string; done: boolean }
|
|
563
608
|
|
package/docs/bloom-language.mdx
CHANGED
|
@@ -9,7 +9,7 @@ Bloom's UI language is a way to write Bloom interfaces in TypeScript the way
|
|
|
9
9
|
SwiftUI writes them in Swift: a component is a function, and its look is a chain
|
|
10
10
|
of modifiers applied in order. Every modifier value is a Bloom token, never a
|
|
11
11
|
pixel or a colour; only geometry the view computes as it renders (a size, a
|
|
12
|
-
pinned edge, a stacking order) is a number of points (see
|
|
12
|
+
pinned edge, a stacking order, an offset) is a number of points (see
|
|
13
13
|
[Styles computed at runtime](#styles-computed-at-runtime)). The package is `packages/bloom-language`
|
|
14
14
|
(`@oxy.so/bloom-language`, published from 1.0.0 beside Bloom 23):
|
|
15
15
|
|
|
@@ -38,7 +38,16 @@ reference lists every [node](bloom-language-nodes.mdx),
|
|
|
38
38
|
## Syntax
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
view,
|
|
43
|
+
HStack,
|
|
44
|
+
VStack,
|
|
45
|
+
Text,
|
|
46
|
+
Avatar,
|
|
47
|
+
Spacer,
|
|
48
|
+
Action,
|
|
49
|
+
ActionBar,
|
|
50
|
+
} from '@oxy.so/bloom-language';
|
|
42
51
|
import { ReplyIcon } from '@oxy.so/bloom/icons/ReplyIcon';
|
|
43
52
|
import { LikeIcon } from '@oxy.so/bloom/icons/LikeIcon';
|
|
44
53
|
|
|
@@ -241,20 +250,22 @@ Measured on Mention (the codemod at this commit, `style` kept 222 elements):
|
|
|
241
250
|
| A static value off Tailwind's scale: an `rgba()` scrim, a radius of half a fixed side, an app constant (`HPAD`), a font size and its line | 36 | Tokens: an app colour, `'full'`, a numeric token; the codemod's to read |
|
|
242
251
|
| A theme colour read at render: `useColorTokens()`, `theme.colors.*` in a list or chosen by state, `withAlpha(…)`, a hook that builds the app's ink styles | 73 | A role, chosen at render where the state chooses it: `.background(active ? 'primary' : 'card')`, `'primary/10'` for `withAlpha(primary, 0.1)` |
|
|
243
252
|
| A style a caller hands in (`style`, `style?.handle`, `rowStyle`, a spread of props) | 26 | Modifiers, not a style object: the caller chains them on the view it places; a part inside takes a `ViewModifier` |
|
|
244
|
-
| Geometry computed at render: a size from props or a measurement, a pinned edge, a stacking order, a playback fraction | 20 | Points: `.frame({ width: itemSize })`, `.position({ left })`, `.zIndex(count - index)`; a fraction that moves with playback is a `MotionValue` or Bloom's progress |
|
|
253
|
+
| Geometry computed at render: a size from props or a measurement, a pinned edge, a stacking order, a nudge, a media's own aspect ratio, a playback fraction | 20 | Points: `.frame({ width: itemSize })`, `.position({ left })`, `.zIndex(count - index)`, `.offset({ y: nudge })`; a ratio is a number, `.aspectRatio(media.aspect)`; a fraction that moves with playback is a `MotionValue` or Bloom's progress |
|
|
245
254
|
| Safe-area and bar insets | 11 | `.safeAreaPadding()` for a padding; points for a pinned edge (`.position({ top: insets.top + 8 })`) |
|
|
246
255
|
| Spacing computed at render (an indent times a depth, an offset of the header's rows) | 7 | Stays JSX: spacing is a token, chosen at render (`compact ? 'none' : 'md'`), never arithmetic |
|
|
247
256
|
| A colour from data (an artwork's accent, a severity's hex) | 4 | A closed set is an app colour table indexed at render (`.background(severity.color[level])`); an open one (an artwork's accent) stays JSX |
|
|
248
257
|
| A style of the press state (`({ pressed }) => …`) | 1 | `.when('pressed', (v) => …)` |
|
|
249
258
|
|
|
250
|
-
No element among them animates a style
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
No element among them animates a style: Mention's moving views are the
|
|
260
|
+
engine's already (`MotionValue`, see [Animations](#animations)). A view drawn
|
|
261
|
+
shifted by an amount its props give (a name size's nudge) is an offset of
|
|
262
|
+
points, below.
|
|
253
263
|
|
|
254
264
|
**Points: geometry takes numbers computed at render.** SwiftUI's `.frame`,
|
|
255
|
-
`.position` and `.zIndex` take any `CGFloat` and `Double`; so do the
|
|
256
|
-
language's, for geometry alone: a frame's six lengths, a pinned view's edges
|
|
257
|
-
and its stacking order take a number of points (`Points`) besides
|
|
265
|
+
`.position`, `.offset` and `.zIndex` take any `CGFloat` and `Double`; so do the
|
|
266
|
+
language's, for geometry alone: a frame's six lengths, a pinned view's edges,
|
|
267
|
+
its offset and its stacking order take a number of points (`Points`) besides
|
|
268
|
+
their tokens.
|
|
258
269
|
|
|
259
270
|
```ts
|
|
260
271
|
const Cell = view(function Cell({ item, size }: { item: Media; size: number }) {
|
|
@@ -262,6 +273,8 @@ const Cell = view(function Cell({ item, size }: { item: Media; size: number }) {
|
|
|
262
273
|
});
|
|
263
274
|
CheckoutBadge().position({ top: insets.top + 8, right: 'lg' })
|
|
264
275
|
Avatar(actor.avatar).zIndex(shown.length - index)
|
|
276
|
+
AccountBadge({ kind }).offset({ y: NAME_SIZES[size].nudge })
|
|
277
|
+
Embed(<iframe src={url} />).frame({ width: 'full' }).aspectRatio(getPlayerAspect(provider))
|
|
265
278
|
```
|
|
266
279
|
|
|
267
280
|
- **Only what the view computes.** A number written out is a token: `.frame({
|
|
@@ -281,9 +294,12 @@ Avatar(actor.avatar).zIndex(shown.length - index)
|
|
|
281
294
|
in state is still that: the language draws it, but a `Grid`, a fraction of
|
|
282
295
|
the parent (`'1/3'`) or `.aspectRatio()` says the layout without a second
|
|
283
296
|
pass, and is the form for new screens.
|
|
284
|
-
- **
|
|
285
|
-
|
|
286
|
-
|
|
297
|
+
- **A ratio is a number.** `.aspectRatio()` is no token: a ratio written out
|
|
298
|
+
(`16 / 9`) and a media's own one computed at render (`media.width /
|
|
299
|
+
media.height`) are both numbers, React Native's `aspectRatio` as it is.
|
|
300
|
+
- **The spec.** `points.params` names them (`frame`, `edges`, `zIndex`,
|
|
301
|
+
`padding`, `offset`); the compiler holds every other parameter to tokens and
|
|
302
|
+
rejects a number written out anywhere, with the token to write.
|
|
287
303
|
|
|
288
304
|
**A style a caller hands in is modifiers.** In SwiftUI a caller modifies the
|
|
289
305
|
view it places, and a view never takes a style object. So it is here:
|
|
@@ -517,16 +533,17 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
517
533
|
| `justify(j)`, `wrap()`, `axis(a)` | a stack's distribution: `start` `center` `end` `between` `around` `evenly`; lines that wrap; `horizontal` or `vertical` over its constructor's (see [Layout](#layout)) |
|
|
518
534
|
| `frame({ width, height, min…, max… })` | space, or a length of the parent: `full`, `1/2` `1/3` `2/3` `1/4` `3/4` `1/5` `2/5` `3/5`, and the percentages apps write that no fraction holds, named by their value (`90%`, `31%`), or points computed at render (`{ width: itemSize }`; see [Styles computed at runtime](#styles-computed-at-runtime)) |
|
|
519
535
|
| `frame({ width: 'fit' })` | as wide (or tall) as its content: `fit-content` (`w-fit`) |
|
|
520
|
-
| `
|
|
536
|
+
| `frame({ width: 'auto' })` | the view's own size, React Native's and the web's `auto` (`w-auto`, `h-auto`): what a view draws with no length, and what takes back a Bloom component's own length for its content's (a `Field`, full width by default, as wide as its content beside `.grow()`). A width's or a height's, not a minimum's or a maximum's |
|
|
537
|
+
| `aspectRatio(r)` | the view's width to its height (`1`, `1.6`, or a ratio computed at render: `media.aspect`), React Native's `aspectRatio`, in its frame's view: the frame's width or height (or the view's stretch) sets the other side. Any view, a pressable one included; an `Image`'s sizes the image in its box |
|
|
521
538
|
| `grow()`, `shrink(p)`, `basis(l)` | `never` `normal` `first` (0, 1, 10), or a rank named by its value (`'20'`); a frame length, its `flex-basis` |
|
|
522
539
|
| `flex(f)` | Tailwind's flex utility, exactly as NativeWind writes it: `'1'` (`flex-1`: grow 1, shrink 1, basis 0%), `auto`, `initial`, `none`, `grow` (`flex-grow: 1` alone). `grow()` stays React Native's `flex: 1` |
|
|
523
540
|
| `margin(edge?, v)` | space (negatives included), or `auto` (the free space on that side: `.margin('leading', 'auto')` is `ms-auto`), on the view itself: no view around it |
|
|
524
541
|
| `clipped(on?)` | clips what the view draws to its bounds and its corner; `clipped(false)` draws what overflows it, React Native's `overflow: 'visible'` written out (NativeWind's `overflow-visible`), over a clip the view would otherwise have |
|
|
525
542
|
| `align(a)`, `alignSelf(a)` | `start` `center` `end` `stretch` `baseline` (a stack's children; the view's own place) |
|
|
526
|
-
| `position({ top, bottom, leading, trailing, left, right, horizontal, vertical })`, `offset({ x, y })` | space, negatives included (see [Layout](#layout)); a position's edge also a percentage of the parent (`'25%'`, `'100%'`: pinned above its parent with `bottom`, the spec's `insetPercent`) and points computed at render (`{ top: insets.top + 8 }`). `horizontal` is both inline edges at once (React Native's `insetInline`), `vertical` both block edges (`insetBlock`) |
|
|
543
|
+
| `position({ top, bottom, leading, trailing, left, right, horizontal, vertical })`, `offset({ x, y })` | space, negatives included (see [Layout](#layout)); a position's edge also a percentage of the parent (`'25%'`, `'100%'`: pinned above its parent with `bottom`, the spec's `insetPercent`) and points computed at render (`{ top: insets.top + 8 }`), an offset's axis points computed at render too (`{ y: nudge }`, React Native's `translateY`). `horizontal` is both inline edges at once (React Native's `insetInline`), `vertical` both block edges (`insetBlock`); `.position({})` is a view taken out of the flow where it would sit, pinned by no edge (`position: 'absolute'` alone) |
|
|
527
544
|
| `sticky(edge?)` | the web's `position: sticky` at `top` (the default) or `bottom`: held at its scroll container's edge once scrolled to it. React Native has no sticky position, so native draws the view in place; a list's or a scroll's sticky rows are `.stickyIndices()` |
|
|
528
545
|
| `cursor(c)` | the pointer's shape over the view on the web (CSS's `cursor`): `auto` `default` `pointer` `grab` `grabbing` `text` `move` `not-allowed`; native has none, as NativeWind's `cursor-*` writes nothing there |
|
|
529
|
-
| `zIndex(z)`, `hidden(on?)` | Bloom's `Z_INDEX`: `base` `raised` `floating` `dropdown`, or Tailwind's `'20'` `'30'` `'50'`, or an exact level (`'-1'` `'2'`…`'7'` `'60'`), or `auto` (Tailwind's `z-auto` as NativeWind writes it: `z-index: auto` on the web, nothing on native), or an order computed at render (`count - index`); out of the layout |
|
|
546
|
+
| `zIndex(z)`, `hidden(on?)` | Bloom's `Z_INDEX`: `base` `raised` `floating` `dropdown`, or Tailwind's `'20'` `'30'` `'50'`, or an exact level (`'-1'` `'2'`…`'7'` `'60'` `'1000'`), or `auto` (Tailwind's `z-auto` as NativeWind writes it: `z-index: auto` on the web, nothing on native), or an order computed at render (`count - index`); out of the layout |
|
|
530
547
|
| `scale(s)` | drawn scaled about its anchor (its centre unless `anchor` says otherwise): Bloom's `dip` 0.7, `pressed` 0.98, `full`, `swell` 1.2, or a percent (`'95'` `'105'`…) |
|
|
531
548
|
| `anchor(a)` | the point the view scales and rotates about (SwiftUI's `anchor:`, Tailwind's `origin-*`): `center` `top` `bottom` `leading` `trailing` `top-leading` `top-trailing` `bottom-leading` `bottom-trailing`; leading and trailing are left and right, as an offset's x |
|
|
532
549
|
| `allowsHitTesting(on)`, `accessibilityOnly()` | `false`: touches pass through it and everything in it; `'children'`: only what is inside it takes them, `'self'`: only the view; read by a screen reader and not drawn (`sr-only`) |
|
|
@@ -539,7 +556,7 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
539
556
|
| `leading(l)` | Bloom line heights (ratios of the size) `tight` 1.15, `close` 1.25, `snug` 1.3, `easy` 1.375, `normal` 1.5, `relaxed` 1.625; or an exact px height (`'14px'` … `'40px'`, and `'96px'`, Tailwind's `text-8xl` line, a 96pt countdown's) |
|
|
540
557
|
| `foreground(c)`, `background(c)` | colour roles: `foreground` `muted` `primary` `surface` `card` `mutedFill` `border` `error` `destructive` `primaryText` `white` `black`…, or a role at an opacity token (`'muted/70'`); `foreground(undefined)` is no ink of its own (SwiftUI's `foregroundColor(nil)`), so `.foreground(invalid ? 'error' : undefined)` inks the view only when it is invalid |
|
|
541
558
|
| `borderStyle(s)` | the border's line: `solid` (the default), `dashed`, `dotted` (React Native's `borderStyle`), in the border's view |
|
|
542
|
-
| `border(c, width?, edge?)` | colour role (or a role at an opacity); `hairline` (the platform hairline), `thin` or `thick`, or an exact width (`'0.5'`, a fixed half point; `'1.5'` `'2.5'` `'3'` `'4'`) |
|
|
559
|
+
| `border(c, width?, edge?)` | colour role (or a role at an opacity); `hairline` (the platform hairline), `thin` or `thick`, or an exact width (`'0.5'`, a fixed half point; `'1.5'` `'2.5'` `'3'` `'4'`). A colour of `undefined` writes the width alone, as a style with a `borderWidth` and no `borderColor`: the line keeps the platform's default colour (black natively, react-native-web's own on the web), so `.border(subscribed ? 'border' : undefined, 'thin')` is Mention's labelers pill; it reads no theme |
|
|
543
560
|
| edges | `padding`, `margin` and `border` take `leading` and `trailing` (the reading direction's sides) and `left` and `right` (physical, the same right to left) |
|
|
544
561
|
| `corner(r, side?)`, `cornerCurve(c)` | radius rungs, numeric radii (`'6'` `'7'` `'10'` `'14'` `'15'` `'18'` `'22'`), `full` (Bloom's `radius-max`, 9999; an app's 999 is `full` too, since both round any box under 1998pt fully), `infinite` (Tailwind's `rounded-full` as NativeWind writes it: 9007199254740000 on native, `calc(infinity * 1px)` on the web; a Bloom component that takes a radius in points gets `full`), `concentric`; the corners it rounds: `all`, `top` `bottom` `leading` `trailing`, or one (`top-leading`…), which follow the reading direction, or `left` `right` and one (`top-left`…), which do not (Tailwind's `rounded-l`, `rounded-tl`…); `round` `smooth` (see [Material](#material)) |
|
|
545
562
|
| `opacity(o)` | `transparent` 0, `half` 0.5, `opaque` 1; or a percent (`'5'` `'10'` `'20'` `'25'` `'30'` `'40'` `'45'` `'60'` `'70'` `'75'` `'80'` `'85'` `'90'`) |
|
|
@@ -553,7 +570,7 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
553
570
|
| `accessibilityState(s)`, `accessibilityValue(v)`, `liveRegion(r)`, `accessibilityHidden(on?)` | what assistive technology reads: a state (`selected`, `checked` or `'mixed'`, `busy`, `expanded`, `disabled`: React Native's `accessibilityState`); a value, a range (`min`, `max`, `now`) or a text (React Native's `accessibilityValue`; numbers and a text, no tokens); a region whose changes are announced (`polite`, `assertive`, `none`: `accessibilityLiveRegion`); hidden from screen readers with what is inside (see [Layout](#layout)) |
|
|
554
571
|
| `hitSlop(edge?, s)` | how far beyond its bounds a press reaches: Bloom's `sm` `md` `lg`, `none`, or an exact slop (`'4'` `'5'`); with a side first (`top` `bottom` `horizontal` `vertical` `left` `right`, physical as React Native's insets are) only that side, a later one of a side over the earlier. Every side alike is one number (`hitSlop={8}`), sides of their own React Native's insets with the sides named. An `Action`'s is its `EngagementAction`'s (an `Action` takes no `hitSlop` option) |
|
|
555
572
|
| `ref(r)`, `onLayout(f)` | escape hatches, on the view's outermost box (its host, or the Bloom component that draws it): React Native's `ref` (a ref object or a callback, for a visibility tracker, a measurement, a DOM lookup on the web) and `onLayout`. Laying a view out from state its own `onLayout` wrote is discouraged: it draws twice, the second time moved, and can loop; a frame, a grow, an aspect ratio or a `ZStack` says the layout instead |
|
|
556
|
-
| `label`, `hint`, `role`, `testID`, `id` | accessibility and identity. `role` is React Native's `accessibilityRole` of the same name: `button` `link` `header` `image` `text` `none` `checkbox` `radio` `tab` `radiogroup` `tablist` `list` `alert` `progressbar` `imagebutton` `summary`; `option` and `listbox`, which React Native names only as a web role, are its `role` (`listbox` is react-native-web's, outside React Native's types; native has neither) (a `Row`'s `.role('option')` is Bloom Item's `role="option"`, whose `.selected()` is `aria-selected`) |
|
|
573
|
+
| `label`, `hint`, `role`, `testID`, `id` | accessibility and identity. `role` is React Native's `accessibilityRole` of the same name: `button` `link` `header` `image` `text` `none` `checkbox` `radio` `tab` `radiogroup` `tablist` `list` `alert` `progressbar` `imagebutton` `summary`; `option` and `listbox`, which React Native names only as a web role, are its `role` (`listbox` is react-native-web's, outside React Native's types; native has neither) (a `Row`'s `.role('option')` is Bloom Item's `role="option"`, whose `.selected()` is `aria-selected`; an option's or a tab's `.accessibilityState({ selected })` is also a flat `aria-selected` on the web, which react-native-web reads in place of the state) |
|
|
557
574
|
| `lines(n)`, `noWrap()`, `truncation`, `selectable`, `textStyle`, `link`, `textAlign`, `italic`, `underline`, `strikethrough`, `textCase`, `monospacedDigit`, `wordBreak`, `textShadow` | text only (see [Text](#text)) |
|
|
558
575
|
| `listMarker(m)` | a stack only: a web list behind `disc` or `decimal` markers (see [Layout](#layout)) |
|
|
559
576
|
| `contentFit`, `aspectRatio`, `tint`, `crossFade`, `onLoad`, `onError` | `Image` only (see [Image](#image)) |
|
|
@@ -684,7 +701,8 @@ VStack(...).background('surface').corner('xl').shadow('m')
|
|
|
684
701
|
`raised` 1, `floating` 10, `dropdown` 40; Tailwind's `z-20`, `z-30` and
|
|
685
702
|
`z-50` are the numeric tokens `'20'`, `'30'`, `'50'`, and the exact levels
|
|
686
703
|
apps write are named by their value: `'-1'` (under its siblings), `'2'` to
|
|
687
|
-
`'7'`, `'60'
|
|
704
|
+
`'7'`, `'60'`, and `'1000'`, a picker raised over a whole screen (Mention's
|
|
705
|
+
mention picker, `z-[1000]`).
|
|
688
706
|
- **Defaults that are no modifier.** Every view is the positioned parent of
|
|
689
707
|
what it pins (`position: relative`, React Native's and react-native-web's
|
|
690
708
|
default) and draws what overflows it (`overflow: visible`, the default of
|
|
@@ -721,7 +739,13 @@ VStack(...).background('surface').corner('xl').shadow('m')
|
|
|
721
739
|
(`box-none`: `pointer-events: none` on the view, `auto` on each child), held
|
|
722
740
|
equal to it by the layout parity, a value chosen at render included;
|
|
723
741
|
react-native-web drops an inline `pointerEvents`, so on the web a Bloom
|
|
724
|
-
component's is a box of its own around it.
|
|
742
|
+
component's is a box of its own around it. React Native's `pointerEvents`
|
|
743
|
+
written in an inline style is a native hit testing: react-native-web writes
|
|
744
|
+
`box-none` and `box-only` there as they are, CSS values the browser drops,
|
|
745
|
+
so the web view takes touches as any view does. Its form is
|
|
746
|
+
`.when('native', (v) => v.allowsHitTesting('children'))`, held equal to the
|
|
747
|
+
inline style by the layout parity; a StyleSheet's style is compiled into
|
|
748
|
+
the prop's classes, and is `.allowsHitTesting()` on every platform.
|
|
725
749
|
- **Drawn, not read.** `.accessibilityHidden()` hides the view and everything
|
|
726
750
|
inside it from screen readers, each platform its own way: on Android and iOS
|
|
727
751
|
`accessibilityElementsHidden` and `importantForAccessibility:
|
|
@@ -960,6 +984,28 @@ Text('Read the ', Text('terms').link('https://oxy.so/terms'), '.').font('caption
|
|
|
960
984
|
Markdown nests its runs: it writes only what its own chain names (a weight,
|
|
961
985
|
an ink, a link) and inherits the rest, so a span of an `h1` keeps the
|
|
962
986
|
heading's size.
|
|
987
|
+
- **Pressable runs.** A span takes `.onPress()` and `.onLongPress()`, as a
|
|
988
|
+
React Native `Text` nested in a text takes `onPress`: it stays a span of the
|
|
989
|
+
line (no box of its own), a URL that opens on a press or a "Read more"
|
|
990
|
+
(`RawText(body, Text(' Read more').foreground('primary').onPress(expand))`).
|
|
991
|
+
A whole `Text` takes them too, a footer link.
|
|
992
|
+
- **Element runs.** `Embed(element)` is a run like any other, drawn as it is
|
|
993
|
+
inside the line: a router's `Link`, an app's own component. A render
|
|
994
|
+
function hands an element that takes a child (`asChild`) a span: inside a
|
|
995
|
+
text, `render(Text(…))` draws the span's host, so expo-router's `Link
|
|
996
|
+
asChild` gives it its `href`, its role and its press (an anchor on the web),
|
|
997
|
+
and its own props (`hrefAttrs` with `rel: 'nofollow'`) reach the span as
|
|
998
|
+
they reach a JSX child:
|
|
999
|
+
|
|
1000
|
+
```tsx
|
|
1001
|
+
const mention = (handle: string) =>
|
|
1002
|
+
Embed((render) => (
|
|
1003
|
+
<Link href={`/@${handle}`} push asChild>
|
|
1004
|
+
{render(Text(`@${handle}`).foreground('primary'))}
|
|
1005
|
+
</Link>
|
|
1006
|
+
));
|
|
1007
|
+
RawText('Hi ', mention('bob'), ', see ', Text('oxy.so').foreground('primary').onPress(open))
|
|
1008
|
+
```
|
|
963
1009
|
- **Raw text.** `RawText(...runs)` is React Native's own `Text`, not Bloom's:
|
|
964
1010
|
it writes only what its chain names, so a text that names no family draws
|
|
965
1011
|
the platform face (Roboto on Android, San Francisco on iOS,
|
|
@@ -967,7 +1013,10 @@ Text('Read the ', Text('terms').link('https://oxy.so/terms'), '.').font('caption
|
|
|
967
1013
|
codemod writes for a React Native `Text`, so the move changes no pixel: a
|
|
968
1014
|
face the app's bundler gives React Native's `Text` (`@oxy.so/app-preset`'s
|
|
969
1015
|
`baseFont`) reaches `RawText` alike. New screens use `Text`. Inside a `Text`
|
|
970
|
-
it is a span that inherits its parent's face.
|
|
1016
|
+
it is a span that inherits its parent's face. It takes nothing set above it,
|
|
1017
|
+
so a root or a `view()` body over one reads no environment, and the theme
|
|
1018
|
+
only when a role inks it, as React Native's `Text` in a component that reads
|
|
1019
|
+
the theme to ink it.
|
|
971
1020
|
|
|
972
1021
|
- **Digits and breaking.** `.monospacedDigit()` draws digits of one width
|
|
973
1022
|
(`tabular-nums`, React Native's `fontVariant`). `.wordBreak('all')` lets a
|
|
@@ -1844,6 +1893,25 @@ export default screen(function EditList() {
|
|
|
1844
1893
|
});
|
|
1845
1894
|
```
|
|
1846
1895
|
|
|
1896
|
+
A branch that is not a Screen says so, as the same branch of a JSX route
|
|
1897
|
+
returns something else: a root with `.ownScreen()` is a surface of its own
|
|
1898
|
+
(Bloom's `CallScreen` or `IncomingCallScreen`, a story viewer), drawn as it is
|
|
1899
|
+
with no `Screen` around it, and `null` draws nothing (a viewer with no story
|
|
1900
|
+
yet). An own surface takes no screen chrome (its title, header, footer and
|
|
1901
|
+
floating action are the Screen's and draw nothing); its sheets, colour scope,
|
|
1902
|
+
keyboard avoidance and providers are drawn around it as they are around a
|
|
1903
|
+
Screen. Moving between a Screen branch and an own surface draws the other
|
|
1904
|
+
tree, as React does when a component returns a different element.
|
|
1905
|
+
|
|
1906
|
+
```ts
|
|
1907
|
+
export default screen(function Call() {
|
|
1908
|
+
const session = useCall();
|
|
1909
|
+
if (!session) return Text(t('calls.noParticipants')).title(t('calls.title'));
|
|
1910
|
+
if (session.ringing) return IncomingCallScreen(session.name, { onAccept }).ownScreen();
|
|
1911
|
+
return CallScreen(session.name, session.status, { controls }).ownScreen();
|
|
1912
|
+
});
|
|
1913
|
+
```
|
|
1914
|
+
|
|
1847
1915
|
**`AppLayout(navigator)`.** Bloom's `AppShell` around the navigator. The shell
|
|
1848
1916
|
draws its navigation from the `TabPagerProvider` above it (the sidebar's rows
|
|
1849
1917
|
and selection), which stays above the shell: bottom sheets and Bloom's native
|
|
@@ -2123,7 +2191,7 @@ Three more draw around the `Screen`, as a route's JSX wrapped it:
|
|
|
2123
2191
|
| --- | --- |
|
|
2124
2192
|
| `.colorScope('light' \| 'dark' \| undefined)` | `<BloomColorScope mode asChild>`: the screen in a scheme of its own (a dark reel or camera in a light app); `undefined` is the app's, the scope still drawn so a scheme chosen at render never remounts the screen |
|
|
2125
2193
|
| `.keyboardAvoiding(fill?)` | React Native's `<KeyboardAvoidingView>`: filling (React Native's `flex: 1`, or a flex token as `.flex()` writes it: `'1'` is Tailwind's `flex-1`, `flex: 1 1 0%`), padded on iOS and resized elsewhere, as React Native recommends (SwiftUI avoids the keyboard itself; React Native does not) |
|
|
2126
|
-
| `.provider(Component)` | a provider of children around the screen (Bloom's `<HeaderDockProvider>`, or an app's own): a context the screen's header and content share |
|
|
2194
|
+
| `.provider(Component, props?)` | a provider of children around the screen (Bloom's `<HeaderDockProvider>`, or an app's own, with the props it takes besides its children): a context the screen's header and content share; `undefined` draws none (a provider only some people get), the screen drawn again inside one when that changes, as JSX that wraps it in one branch is |
|
|
2127
2195
|
|
|
2128
2196
|
Each wraps what the root's modifiers before it drew, in chain order, as
|
|
2129
2197
|
SwiftUI's modifiers do, so the last is outermost:
|
|
@@ -2473,6 +2541,12 @@ Image(post.cover, 'Cover')
|
|
|
2473
2541
|
`crossFade` is a Bloom duration (`instant` 100, `fast` 150, `normal` 200,
|
|
2474
2542
|
`slow` 300 ms); without it the image appears at once. `onLoad` receives the
|
|
2475
2543
|
intrinsic `{ width, height }` and `onError` `{ error }`.
|
|
2544
|
+
- **Name.** `alt` is the image's name, Bloom's `alt`: expo-image and React
|
|
2545
|
+
Native's Image read it as `accessibilityLabel` (natively it also makes the
|
|
2546
|
+
image an accessibility element), and on the web react-native-web's Image
|
|
2547
|
+
writes it as its `aria-label` and `<img alt>`, as React Native's Image with
|
|
2548
|
+
an `accessibilityLabel` does (`parity/image-name.cases.tsx`). `.label()`
|
|
2549
|
+
names it the same way on the web.
|
|
2476
2550
|
- **Presses.** `BloomImage` takes accessibility props but no presses, so an image
|
|
2477
2551
|
with `onPress`, `onHover` or `hoverGroup` is drawn inside its pressable host,
|
|
2478
2552
|
which also takes `grow` and `shrink`.
|
|
@@ -2531,6 +2605,16 @@ ErrorBoundary(Feed()).title('The feed failed').resetKey(userId)
|
|
|
2531
2605
|
`.lines(n)`. The box modifiers (padding, frame, background, corner, margin,
|
|
2532
2606
|
flex) are the card's `style`, as an app writes them; on the web a role in
|
|
2533
2607
|
it is its CSS variable, as Bloom's prepainted theme hands it to an app.
|
|
2608
|
+
The card's own box is the one its padding, frame and fill share, in that
|
|
2609
|
+
order: a `.background()` there is Bloom Card's `style.backgroundColor`,
|
|
2610
|
+
which its surface paints from, so `.background('transparent')` draws no
|
|
2611
|
+
surface at all (Mention's composer zeroes a card's fill so:
|
|
2612
|
+
`.padding('lg').frame({ width: 'full', height: 'full' }).background('transparent').grow()`).
|
|
2613
|
+
A background after a `.corner()` or a second padding is a view around the
|
|
2614
|
+
card, as anywhere (see [Order means nesting](#order-means-nesting)), and
|
|
2615
|
+
the card still paints its own surface inside it. Its corner and outline are
|
|
2616
|
+
`.radius()` and `.outline()`: a border width or a corner in its `style` is
|
|
2617
|
+
Bloom's to ignore, so the chain writes neither.
|
|
2534
2618
|
- **Row.** `.subtitle()`, `.leadingView(...)` and `.trailing(...)` (its slots,
|
|
2535
2619
|
as views), `.size()`, `.lines(n)` (the title's), `.disabled()`,
|
|
2536
2620
|
`.destructive()`, `.selected()`, `.active()`, `.highlighted()`,
|
|
@@ -2855,10 +2939,12 @@ Text(InlineMarkdown(post.body).plainRun(mentions).suffix(Text(' Read more').link
|
|
|
2855
2939
|
Inline markdown inside a line is `InlineMarkdown(source)`, Bloom's own: a run
|
|
2856
2940
|
of a `Text` (emphasis, strikethrough, code and links as spans of it), its
|
|
2857
2941
|
source a string or Bloom's parsed runs. It takes `.streaming()`,
|
|
2858
|
-
`.onLinkPress()`, `.plainRun(text =>
|
|
2859
|
-
or code), `.linkView(link =>
|
|
2860
|
-
Bloom's) and `.suffix(
|
|
2861
|
-
spans
|
|
2942
|
+
`.onLinkPress()`, `.plainRun(text => runs)` (each plain run, not inside links
|
|
2943
|
+
or code), `.linkView(link => runs)` (a link of your own; `undefined` keeps
|
|
2944
|
+
Bloom's) and `.suffix(runs)`. Each hands back runs of the text, as `Text`
|
|
2945
|
+
takes them: one, or several in order, strings beside spans and element runs,
|
|
2946
|
+
so a post's linkified plain run is its prose as strings and its mentions,
|
|
2947
|
+
tags and URLs as spans, with no span around the prose (see [Text](#text)).
|
|
2862
2948
|
|
|
2863
2949
|
### Sliders
|
|
2864
2950
|
|
|
@@ -4506,10 +4592,25 @@ inside it. It reads the theme when a node paints a theme colour; a fixed
|
|
|
4506
4592
|
colour (`white`, `black/60`, natively) and an app's own colour read none. A
|
|
4507
4593
|
tree of fixed geometry, a glyph in a fixed colour, an embedded element or a
|
|
4508
4594
|
`view()` (which reads what it takes itself) reads nothing, and a `view()`
|
|
4509
|
-
inside it still reads what is set above.
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4595
|
+
inside it still reads what is set above. A RawText takes no trait set above it
|
|
4596
|
+
(it writes only what its chain names), so it reads the theme only when a role
|
|
4597
|
+
inks it; an `Avatar` or an `AvatarGroup` hands Bloom its props as they are (a
|
|
4598
|
+
size, a shape, an avatar colour by name) and reads only what its box paints
|
|
4599
|
+
(an AvatarGroup's ring in a role, its item action), so a `view()` that hands
|
|
4600
|
+
its props to one costs what the component that renders Bloom's does (Mention's
|
|
4601
|
+
`AccountAvatar`). What a tree reads is known from its nodes, once per node
|
|
4602
|
+
(the modifiers that read nothing are the spec's `reads.nothing`), and read with
|
|
4603
|
+
React's `use`, so a root whose tree comes to read more stays the same component
|
|
4604
|
+
and keeps its state; a `view()` body reads the same way. A root whose tree is
|
|
4605
|
+
host views alone (stacks and spacers, `reads.hostViews`) and reads nothing has
|
|
4606
|
+
nothing for a boundary to provide: it is those views, with no fiber of its own
|
|
4607
|
+
(Mention's splash marker, `VStack().frame({ width: 'none', height: 'none' })
|
|
4608
|
+
.position({}).allowsHitTesting(false).onLayout(release)`, is the `View` it
|
|
4609
|
+
replaced). Such a tree holds no component and no state, so one that comes to
|
|
4610
|
+
read something is drawn again under a boundary, as JSX that comes to wrap a
|
|
4611
|
+
view in a component is; a root that holds a `view()`, an embedded element, a
|
|
4612
|
+
control or a list (whose items leave through a component of their own) keeps
|
|
4613
|
+
its boundary whatever it reads. Mention's feed video preview (a tap area and a mute button
|
|
4513
4614
|
in one root) is its JSX's fibers, hooks and reads, and one read more, the
|
|
4514
4615
|
environment its presses take. A component whose JSX holds two roots pays them
|
|
4515
4616
|
twice; converting a region into one root, not each of its pieces into a root
|
|
@@ -4917,10 +5018,10 @@ the owner's decision, or an app's `defineTokens`) before a codemod moves it.
|
|
|
4917
5018
|
|
|
4918
5019
|
| | Utilities | Uses | Share of uses |
|
|
4919
5020
|
| --- | ---: | ---: | ---: |
|
|
4920
|
-
| Maps to a modifier and a token |
|
|
5021
|
+
| Maps to a modifier and a token | 1090 | 47358 | 88.2% |
|
|
4921
5022
|
| Expressed by the view’s structure | 48 | 3426 | 6.4% |
|
|
4922
|
-
| Redundant in the language |
|
|
4923
|
-
| Needs a named token (raw value) |
|
|
5023
|
+
| Redundant in the language | 28 | 407 | 0.8% |
|
|
5024
|
+
| Needs a named token (raw value) | 258 | 608 | 1.1% |
|
|
4924
5025
|
| An app’s own token (a brand colour) | 30 | 76 | 0.1% |
|
|
4925
5026
|
| Maps to the motion layer | 13 | 236 | 0.4% |
|
|
4926
5027
|
| Needs a modifier the language lacks | 26 | 63 | 0.1% |
|
|
@@ -4939,7 +5040,7 @@ condition. The values with no rung, by scale (the owner names each as a token or
|
|
|
4939
5040
|
| font | 37 | 10.5px (8), 23px (5), 34px (4), 48px / 48px (2), 11.5px (2), 13.5px (2), 15.5px (2), 21px (2), 29px (2), 28px / 34px (2), 60px / 60px (1), 19px (1) |
|
|
4940
5041
|
| corner | 29 | 23px (6), 5px (5), 13px (3), 27px (3), 25px (2), 26px (2), 3px (2), 9px (2), 19px (1), 30px (1), 35px (1), 32px (1) |
|
|
4941
5042
|
| shadow | 16 | shadow-shop-s (10), shadow-shop-m (2), shadow-dropdown (1), shadow-foreground/10 (1), shadow-foreground/20 (1), shadow-l (1) |
|
|
4942
|
-
| zIndex |
|
|
5043
|
+
| zIndex | 5 | 10000 (1), 2000 (1), 2001 (1), 80 (1), 9998 (1) |
|
|
4943
5044
|
| rotation | 1 | -12° (1) |
|
|
4944
5045
|
| weight | 1 | 900 (1) |
|
|
4945
5046
|
| scale | 1 | 1.01 (1) |
|
|
@@ -5034,6 +5135,14 @@ every chain, and the pass changes only what it proves keeps its meaning.
|
|
|
5034
5135
|
prefix (`HStack(…).padding('md')` before `.spacing(gap)`). Names resolve
|
|
5035
5136
|
through scope analysis, so a local that shadows an import is never hoisted.
|
|
5036
5137
|
- **Adds `"use memo"`** to every function passed to `view()`.
|
|
5138
|
+
- **Builds a root as it renders.** A dynamic `toElement(chain)` in JSX becomes
|
|
5139
|
+
`<LanguageRoot build={() => chain} />`, so the handlers and refs the chain
|
|
5140
|
+
takes reach the React Compiler as one JSX prop, never as arguments a call
|
|
5141
|
+
might read during render (which costs the whole component its memoization).
|
|
5142
|
+
A bare `view()` node stays `toElement`, which mounts its component, and so
|
|
5143
|
+
does a chain of host views that reads nothing and takes no handler or ref
|
|
5144
|
+
(the spec's `reads`), which `toElement` draws as those views, with no
|
|
5145
|
+
boundary to build it in.
|
|
5037
5146
|
- **Checks chains** against the spec: an unknown modifier for the node, a wrong
|
|
5038
5147
|
argument count, or a literal token outside its set fails the build with the
|
|
5039
5148
|
source line and a suggestion. Every chain is checked before anything is
|
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.
|
|
11
|
+
This guide belongs to **@oxy.so/bloom 23.10.0**. 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
|
|
|
@@ -31,6 +31,7 @@ var _useStaticPortraits = require("./use-static-portraits.js");
|
|
|
31
31
|
var _defaultCatalog = require("./default-catalog.js");
|
|
32
32
|
var _vectorCompose = require("./vector-compose.js");
|
|
33
33
|
var _vectorFrame = require("./vector-frame.js");
|
|
34
|
+
var _vectorHalo = require("./vector-halo.js");
|
|
34
35
|
var _vectorLoop = require("./vector-loop.js");
|
|
35
36
|
var _VectorNativeSurface = require("./VectorNativeSurface.js");
|
|
36
37
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -121,8 +122,11 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
121
122
|
portrait,
|
|
122
123
|
interactive,
|
|
123
124
|
previewPart,
|
|
124
|
-
mood
|
|
125
|
+
mood,
|
|
126
|
+
halo
|
|
125
127
|
} = props;
|
|
128
|
+
const haloColor = halo?.color;
|
|
129
|
+
const haloWidth = halo?.width;
|
|
126
130
|
const {
|
|
127
131
|
messages
|
|
128
132
|
} = (0, _messages.useMessages)(_messages2.AGENT_AVATAR_MESSAGES, props.locale);
|
|
@@ -143,7 +147,9 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
143
147
|
const latestResolved = (0, _react.useRef)(resolved);
|
|
144
148
|
latestResolved.current = resolved;
|
|
145
149
|
const paintedAsset = (0, _react.useMemo)(() => asset ? (0, _vectorCompose.paintVectorCharacter)(asset, resolved) : undefined, [asset, resolved]);
|
|
146
|
-
const frameRecipeKey = (0, _react.useMemo)(() => (0, _vectorScheduler.vectorFrameRecipeKey)(asset,
|
|
150
|
+
const frameRecipeKey = (0, _react.useMemo)(() => (0, _vectorScheduler.vectorFrameRecipeKey)(asset,
|
|
151
|
+
// The halo is drawn into the frame, so it is part of what a frame is shared and cached by.
|
|
152
|
+
haloColor !== undefined && haloWidth ? `${geometryKey}|${haloColor}|${haloWidth}|${size}` : geometryKey, resolved.paint), [asset, geometryKey, resolved.paint, haloColor, haloWidth, size]);
|
|
147
153
|
const latestFrameRecipe = (0, _react.useRef)(frameRecipeKey);
|
|
148
154
|
latestFrameRecipe.current = frameRecipeKey;
|
|
149
155
|
const latestAsset = (0, _react.useRef)(paintedAsset);
|
|
@@ -466,13 +472,17 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
466
472
|
yaw: portrait ? 0 : motion_0.yaw,
|
|
467
473
|
pitch: portrait ? 0 : motion_0.pitch
|
|
468
474
|
}, feeling);
|
|
469
|
-
const
|
|
475
|
+
const plain = (0, _vectorFrame.renderVectorFrame)(asset_0, {
|
|
470
476
|
action: action_1,
|
|
471
477
|
time,
|
|
472
478
|
...framed,
|
|
473
479
|
eyesOnly: previewPart === 'eyes',
|
|
474
480
|
pose
|
|
475
481
|
});
|
|
482
|
+
const drawing = haloColor !== undefined && haloWidth ? (0, _vectorHalo.withHalo)(plain, size, {
|
|
483
|
+
color: haloColor,
|
|
484
|
+
width: haloWidth
|
|
485
|
+
}) : plain;
|
|
476
486
|
return {
|
|
477
487
|
pose,
|
|
478
488
|
procedural,
|
|
@@ -545,7 +555,7 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
545
555
|
disposed = true;
|
|
546
556
|
unsubscribe?.();
|
|
547
557
|
};
|
|
548
|
-
}, [asset, visible, screenVisible, paused, portrait, reduced, previewPart, revision, looping, endLoop]);
|
|
558
|
+
}, [asset, visible, screenVisible, paused, portrait, reduced, previewPart, revision, looping, endLoop, haloColor, haloWidth, size]);
|
|
549
559
|
(0, _react.useEffect)(() => {
|
|
550
560
|
if (paused || portrait || reduced) setRevision(value_4 => value_4 + 1);
|
|
551
561
|
}, [resolved.paint, paused, portrait, reduced]);
|
|
@@ -645,10 +655,7 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
645
655
|
},
|
|
646
656
|
children: messages.unavailable
|
|
647
657
|
}) : display && _VectorNativeSurface.VectorNativeSurface ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_VectorNativeSurface.VectorNativeSurface, {
|
|
648
|
-
style:
|
|
649
|
-
width: '100%',
|
|
650
|
-
height: '100%'
|
|
651
|
-
},
|
|
658
|
+
style: (0, _vectorHalo.haloSurfaceStyle)(size, halo),
|
|
652
659
|
pointerEvents: "none",
|
|
653
660
|
accessible: false,
|
|
654
661
|
importantForAccessibility: "no-hide-descendants",
|
|
@@ -662,8 +669,9 @@ function AnimatedVectorCharacterAvatar(props) {
|
|
|
662
669
|
onCapture: onCapture
|
|
663
670
|
}) : display ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
664
671
|
ref: svg,
|
|
665
|
-
width:
|
|
666
|
-
height:
|
|
672
|
+
width: (0, _vectorHalo.haloSurfaceStyle)(size, halo).width,
|
|
673
|
+
height: (0, _vectorHalo.haloSurfaceStyle)(size, halo).height,
|
|
674
|
+
style: halo ? (0, _vectorHalo.haloSurfaceStyle)(size, halo) : undefined,
|
|
667
675
|
viewBox: (0, _vectorViewbox.avatarViewBox)(display.drawing.viewBox),
|
|
668
676
|
testID: "bloom-vector-drawing",
|
|
669
677
|
...(0, _svgA11y.svgA11yProps)(),
|