@oxy.so/bloom 23.9.0 → 23.9.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/docs/bloom-language-classnames.mdx +6 -6
- package/docs/bloom-language-codemod.mdx +10 -0
- package/docs/bloom-language-for-agents.mdx +2 -0
- package/docs/bloom-language-from-jsx.mdx +1 -0
- package/docs/bloom-language-modifiers.mdx +12 -10
- package/docs/bloom-language-nodes.mdx +5 -5
- package/docs/bloom-language-tokens.mdx +2 -0
- package/docs/bloom-language.mdx +112 -31
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +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/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/data-table/DataTable.d.ts.map +1 -1
- package/lib/typescript/commonjs/image/BloomImage.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/data-table/DataTable.tsx +8 -10
- package/src/image/BloomImage.tsx +3 -0
- package/src/stat-bar/StatBar.tsx +14 -14
|
@@ -24,10 +24,10 @@ Alia `841e8843a`, Allo `ba28b38`, Astro `8ae8386`, Atlas `037990e`, Authenticato
|
|
|
24
24
|
|
|
25
25
|
| | Utilities | Uses | Share of uses |
|
|
26
26
|
| --- | ---: | ---: | ---: |
|
|
27
|
-
| Maps to a modifier and a token |
|
|
27
|
+
| Maps to a modifier and a token | 1090 | 47358 | 88.2% |
|
|
28
28
|
| Expressed by the view’s structure | 48 | 3426 | 6.4% |
|
|
29
|
-
| Redundant in the language |
|
|
30
|
-
| Needs a named token (raw value) |
|
|
29
|
+
| Redundant in the language | 28 | 407 | 0.8% |
|
|
30
|
+
| Needs a named token (raw value) | 258 | 608 | 1.1% |
|
|
31
31
|
| An app’s own token (a brand colour) | 30 | 76 | 0.1% |
|
|
32
32
|
| Maps to the motion layer | 13 | 236 | 0.4% |
|
|
33
33
|
| Needs a modifier the language lacks | 26 | 63 | 0.1% |
|
|
@@ -48,7 +48,7 @@ condition: `web:` 365 (`when('web')`), `active:` 332 (`when('pressed')`), `md:`
|
|
|
48
48
|
| 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) |
|
|
49
49
|
| 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) |
|
|
50
50
|
| shadow | 16 | shadow-shop-s (10), shadow-shop-m (2), shadow-dropdown (1), shadow-foreground/10 (1), shadow-foreground/20 (1), shadow-l (1) |
|
|
51
|
-
| zIndex |
|
|
51
|
+
| zIndex | 5 | 10000 (1), 2000 (1), 2001 (1), 80 (1), 9998 (1) |
|
|
52
52
|
| rotation | 1 | -12° (1) |
|
|
53
53
|
| weight | 1 | 900 (1) |
|
|
54
54
|
| scale | 1 | 1.01 (1) |
|
|
@@ -480,6 +480,7 @@ when the fill is a role's colour.
|
|
|
480
480
|
| `border-l-2` | .border(role, 'thick', 'left') | 7 | 5 |
|
|
481
481
|
| `gap-space-20` | .spacing('xl') | 7 | 3 |
|
|
482
482
|
| `h-[30px]` | .frame({ height: '30' }) | 7 | 3 |
|
|
483
|
+
| `h-auto` | .frame({ height: 'auto' }) | 7 | 4 |
|
|
483
484
|
| `justify-start` | .justify('start') | 7 | 5 |
|
|
484
485
|
| `line-through` | .strikethrough() | 7 | 3 |
|
|
485
486
|
| `max-h-96` | .frame({ maxHeight: '384' }) | 7 | 5 |
|
|
@@ -526,6 +527,7 @@ when the fill is a role's colour.
|
|
|
526
527
|
| `text-black` | .foreground('black') | 6 | 2 |
|
|
527
528
|
| `text-foreground/80` | .foreground('foreground/80') | 6 | 3 |
|
|
528
529
|
| `w-4` | .frame({ width: 'lg' }) | 6 | 6 |
|
|
530
|
+
| `w-auto` | .frame({ width: 'auto' }) | 6 | 3 |
|
|
529
531
|
| `-mt-3` | .margin('top', '-md') | 5 | 3 |
|
|
530
532
|
| `bg-fill-secondary` | .background('mutedFill') | 5 | 2 |
|
|
531
533
|
| `bg-foreground/10` | .background('foreground/10') | 5 | 3 |
|
|
@@ -773,9 +775,7 @@ when the fill is a role's colour.
|
|
|
773
775
|
| `font-sans` | the family is Bloom’s: Text takes it from its font | 25 | 4 |
|
|
774
776
|
| `font-bloom-mono` | the family is Bloom’s: Text takes it from its font | 20 | 2 |
|
|
775
777
|
| `shadow-none` | a view has no shadow unless it says so | 17 | 4 |
|
|
776
|
-
| `h-auto` | a view’s size is its content’s unless a frame says otherwise | 7 | 4 |
|
|
777
778
|
| `inline-block` | display: views are boxes | 6 | 2 |
|
|
778
|
-
| `w-auto` | a view’s size is its content’s unless a frame says otherwise | 6 | 3 |
|
|
779
779
|
| `border-b-0` | no border is the default | 3 | 2 |
|
|
780
780
|
| `border-r-0` | no border is the default | 3 | 2 |
|
|
781
781
|
|
|
@@ -36,6 +36,9 @@ is `toElement`'s second argument, a child's `.id()`).
|
|
|
36
36
|
| a style's `borderRadius` (and each corner's own, `borderTopLeftRadius`…`borderBottomEndRadius`), `zIndex`, `aspectRatio`, `overflow: 'visible'`, `inset` | `.corner(token)` (`.corner(token, side)` for one corner: `top-left`, `bottom-trailing`…) and `.zIndex(token)` of the exact value (a named rung over a numeric token; a radius of 999 is `full`, in a style and in a class (`rounded-[999px]`), which draws alike on any box under 1998pt), `.aspectRatio(ratio)`; `overflow: 'visible'` (and the class `overflow-visible`) is `.clipped(false)`, written out as the app wrote it, over a clip the view would otherwise have (a ScrollView's, an earlier style's); `inset` is its four edges; a value that is no token stays a reason |
|
|
37
37
|
| `hitSlop` on a view, a pressable or a text | `.hitSlop(token)` for one slop (a number of a hit slop token, `8` is `'md'`, or Bloom's `tokens.hitSlop.md`); an object of static sides is a call per pair of equal opposite sides, or per side, only the sides it names (`{ top: 8, bottom: 8 }` is `.hitSlop('vertical', 'md')`, a 0 side `'none'`); a side that is no token, or a slop set at runtime, is a reason |
|
|
38
38
|
| Bloom `Text` (`@oxy.so/bloom/typography`), its `variant` and `numberOfLines` | `Text(…runs)`, `.font()` / `.weight()`, `.lines()` |
|
|
39
|
+
| a Text's `onPress` or `onLongPress` (a span's too) | `.onPress()` / `.onLongPress()` on the `Text` or the span |
|
|
40
|
+
| an element inside a Text the codemod does not convert (a router's `Link`, an app's component) | an element run, `Embed(element)`, drawn as it is inside the line; one that converts as anything but a span of the Text (a Bloom `Text` inside React Native's) stays a reason (`text-child`) |
|
|
41
|
+
| an `asChild` element (expo-router's `Link asChild`) around one text, embedded | `Embed((render) => <Link … asChild>{render(Text(…))}</Link>)`: the element hands the text's host its props, as it did the JSX child. Outside a language view the child stays JSX (`as-child`): a root there would take the props in place of its host and drop them |
|
|
39
42
|
| Bloom's typography components (`Muted`, `H2`, `Small`…), without a `className` | `Text(…runs).textStyle('muted')` |
|
|
40
43
|
| a Bloom component with a rule (`src/components.ts`, below) | its node, prop by prop |
|
|
41
44
|
| React Native `Text` | `RawText(…runs)`: React Native's own Text, only what its chain names, in the platform face when it names no family |
|
|
@@ -378,6 +381,13 @@ A View's or a Pressable's `pointerEvents` is `.allowsHitTesting()`: `none`
|
|
|
378
381
|
`false`, `box-none` `'children'`, `box-only` `'self'`, and values chosen by a
|
|
379
382
|
plain condition that choice, `undefined` none and `auto` `true`
|
|
380
383
|
(`split ? 'box-none' : undefined` is `.allowsHitTesting(split ? 'children' : undefined)`).
|
|
384
|
+
A `pointerEvents` in a style is drawn where the JSX's is: a StyleSheet's
|
|
385
|
+
style is compiled by react-native-web into the prop's classes, so it is
|
|
386
|
+
`.allowsHitTesting()` alike; an inline object or a module style constant
|
|
387
|
+
writes `box-none` and `box-only` as CSS the browser drops, so it is
|
|
388
|
+
`.when('native', (v) => v.allowsHitTesting('children'))` (or `'self'`). An
|
|
389
|
+
inline `none` or `auto` stays JSX: the browser keeps it, and what is inside
|
|
390
|
+
inherits it rather than taking the prop's rule.
|
|
381
391
|
|
|
382
392
|
A theme colour at an opacity, Bloom's `withAlpha(colors.primary, 0.1)` or
|
|
383
393
|
`tokenAlpha(tokens.primary, 0.1)` of a `useTheme()` or `useColorTokens()` read,
|
|
@@ -106,6 +106,8 @@ export default screen(function Items() {
|
|
|
106
106
|
| `TextField(value, …)` | `TextField([value, setValue], …)` | a binding, not a value |
|
|
107
107
|
| `<Pressable>` around a node | `.onPress(fn)` | presses are modifiers |
|
|
108
108
|
| `.onPress(() => router.push('/x'))` | `.onPress(navigate('/x'))` | the panel-aware navigator |
|
|
109
|
+
| `<Link asChild>` around a span in a text | `Embed((render) => <Link href={h} asChild>{render(Text(…))}</Link>)` as a run | the Link hands the span's host its href and press |
|
|
110
|
+
| `.plainRun((t) => Text(...linkify(t)))` | `.plainRun(linkify)` returning strings and spans | runs, no extra span around the prose |
|
|
109
111
|
| `.when('hover', …)` | `.when('hovered', …)` | condition names |
|
|
110
112
|
| `.when('md', v => v.onPress(…))` | handlers outside `when()` | variants change style only |
|
|
111
113
|
| `.opacity('half')` on a glass | no opacity on glass | a material is never faded |
|
|
@@ -85,6 +85,7 @@ export const PersonRow = view(function PersonRow({ person, onOpen }: { person: P
|
|
|
85
85
|
| `bg-card`, `text-muted-foreground`, `bg-primary/10` | `.background('card')`, `.foreground('muted')`, `.background('primary/10')` |
|
|
86
86
|
| `rounded-xl`, `rounded-full` | `.corner('xl')`, `.corner('infinite')` |
|
|
87
87
|
| `border border-border` | `.border('border', 'thin')` |
|
|
88
|
+
| `border` with no colour class, `style={{ borderWidth: 1 }}` with no `borderColor` | `.border(undefined, 'thin')`: the width alone, in the platform's default colour (black natively, react-native-web's own on the web) |
|
|
88
89
|
| `shadow-sm` | Tailwind's shadow by its exact box-shadow (the table's token); Bloom's elevation `.shadow('s' \| 'm' \| 'floating')` in new code |
|
|
89
90
|
| `opacity-60` | `.opacity('60')` |
|
|
90
91
|
| `absolute top-2 right-2` | `.position({ top: 'sm', right: 'sm' })` |
|
|
@@ -45,7 +45,7 @@ Padded by the device's safe area on those sides (all by default), as SwiftUI's `
|
|
|
45
45
|
- Signature: `.frame(value: FrameSpec)`
|
|
46
46
|
- Taken by: every node (universal), and [dialog](bloom-language-nodes.mdx#dialog), [popover](bloom-language-nodes.mdx#popover), [groupedSectionItem](bloom-language-nodes.mdx#groupedsectionitem), [tabItem](bloom-language-nodes.mdx#tabitem), [errorBoundary](bloom-language-nodes.mdx#errorboundary)
|
|
47
47
|
- Varies under `.when(condition, v => v…)` ([variants](bloom-language-tour.mdx#variants)).
|
|
48
|
-
- `frame` tokens:
|
|
48
|
+
- `frame` tokens: 71, listed under [length](bloom-language-tokens.mdx#length)
|
|
49
49
|
|
|
50
50
|
### `grow`
|
|
51
51
|
|
|
@@ -118,7 +118,7 @@ Pinned to its parent's edges, out of the stack's flow (absolute): each edge give
|
|
|
118
118
|
|
|
119
119
|
### `offset`
|
|
120
120
|
|
|
121
|
-
Drawn shifted from where it is laid out (`x` right, `y` down); its siblings keep their places.
|
|
121
|
+
Drawn shifted from where it is laid out (`x` right, `y` down); its siblings keep their places. A space token, points computed at render (`.offset({ y: nudge })`), or a `MotionValue`.
|
|
122
122
|
|
|
123
123
|
- Parameters: `{ x, y }`, each [padding](bloom-language-tokens.mdx#padding)
|
|
124
124
|
- Signature: `.offset(value: OffsetSpec)`
|
|
@@ -134,7 +134,7 @@ Its stacking level among its siblings: Bloom's `base`, `raised`, `floating`, `dr
|
|
|
134
134
|
- Signature: `.zIndex(value: ZIndexValue)`
|
|
135
135
|
- Taken by: every node (universal)
|
|
136
136
|
- Varies under `.when(condition, v => v…)` ([variants](bloom-language-tour.mdx#variants)).
|
|
137
|
-
- `zIndex` tokens: `'base'`, `'raised'`, `'floating'`, `'dropdown'`, `'auto'`, `'-1'`, `'2'`, `'3'`, `'4'`, `'5'`, `'6'`, `'7'`, `'20'`, `'30'`, `'50'`, `'60'`
|
|
137
|
+
- `zIndex` tokens: `'base'`, `'raised'`, `'floating'`, `'dropdown'`, `'auto'`, `'-1'`, `'2'`, `'3'`, `'4'`, `'5'`, `'6'`, `'7'`, `'20'`, `'30'`, `'50'`, `'60'`, `'1000'`
|
|
138
138
|
|
|
139
139
|
### `hidden`
|
|
140
140
|
|
|
@@ -154,7 +154,7 @@ Its length along its parent's axis before free space is shared (`flex-basis`): a
|
|
|
154
154
|
- Taken by: every node (universal), and [dataColumn](bloom-language-nodes.mdx#datacolumn)
|
|
155
155
|
- Narrower on: [dataColumn](bloom-language-nodes.mdx#datacolumn) ([space](bloom-language-tokens.mdx#space))
|
|
156
156
|
- Varies under `.when(condition, v => v…)` ([variants](bloom-language-tour.mdx#variants)).
|
|
157
|
-
- `length` tokens:
|
|
157
|
+
- `length` tokens: 71, listed under [length](bloom-language-tokens.mdx#length)
|
|
158
158
|
|
|
159
159
|
### `flex`
|
|
160
160
|
|
|
@@ -257,8 +257,10 @@ Its own place across its parent's axis, over the parent's `align`.
|
|
|
257
257
|
|
|
258
258
|
### `border`
|
|
259
259
|
|
|
260
|
+
A border: a colour role (or a role at an opacity, or an app colour), a width (`hairline` by default) and an edge (`all` by default). A colour of `undefined` writes the width alone, so the line keeps the platform's default colour (black natively, react-native-web's own on the web), as a style with a `borderWidth` and no `borderColor` does: `.border(subscribed ? 'border' : undefined, 'thin')`.
|
|
261
|
+
|
|
260
262
|
- Parameters: [color](bloom-language-tokens.mdx#color); [borderWidth](bloom-language-tokens.mdx#borderwidth) (optional); [borderEdge](bloom-language-tokens.mdx#borderedge) (optional)
|
|
261
|
-
- Signature: `.border(value: InkToken, width?: BorderWidthName, edge?: BorderEdge)`
|
|
263
|
+
- Signature: `.border(value: InkToken | undefined, width?: BorderWidthName, edge?: BorderEdge)`
|
|
262
264
|
- Taken by: every node (universal), and [groupedSectionItem](bloom-language-nodes.mdx#groupedsectionitem), [errorBoundary](bloom-language-nodes.mdx#errorboundary)
|
|
263
265
|
- Varies under `.when(condition, v => v…)` ([variants](bloom-language-tour.mdx#variants)).
|
|
264
266
|
- `color` tokens: `'foreground'`, `'muted'`, `'textTertiary'`, `'primary'`, `'primaryText'`, `'onPrimary'`, `'secondary'`, `'onSecondary'`, `'tertiary'`, `'onTertiary'`, `'background'`, `'surface'`, `'popover'`, `'border'`, `'input'`, `'success'`, `'successText'`, `'warning'`, `'warningText'`, `'error'`, `'info'`, `'mutedFill'`, `'card'`, `'destructive'`, `'white'`, `'black'`, `'transparent'`, `'onSurface'`, `'accent'`, `'errorText'`, `'infoText'`, `'surfaceFill'`
|
|
@@ -749,7 +751,7 @@ The side or bottom panel's own frame (Bloom's `panelStyle`): a bottom dialog kep
|
|
|
749
751
|
- Parameters: `{ width, height, minWidth, minHeight, maxWidth, maxHeight }`, each [length](bloom-language-tokens.mdx#length)
|
|
750
752
|
- Signature: `.panelFrame(value: FrameSpec)`
|
|
751
753
|
- Taken by: [dialog](bloom-language-nodes.mdx#dialog)
|
|
752
|
-
- `frame` tokens:
|
|
754
|
+
- `frame` tokens: 71, listed under [length](bloom-language-tokens.mdx#length)
|
|
753
755
|
|
|
754
756
|
### `ringColor`
|
|
755
757
|
|
|
@@ -4730,18 +4732,18 @@ The trigger's text (Bloom's `Schedule a meeting` by default).
|
|
|
4730
4732
|
|
|
4731
4733
|
### `plainRun`
|
|
4732
4734
|
|
|
4733
|
-
|
|
4735
|
+
Runs of your own for each plain run (mentions, tags), not inside links or code: one run or several, strings beside spans, as a `Text` takes them.
|
|
4734
4736
|
|
|
4735
4737
|
- Parameters: a value
|
|
4736
|
-
- Signature: `.plainRun(value: (text: string) =>
|
|
4738
|
+
- Signature: `.plainRun(value: (text: string) => TextRuns)`
|
|
4737
4739
|
- Taken by: [inlineMarkdown](bloom-language-nodes.mdx#inlinemarkdown)
|
|
4738
4740
|
|
|
4739
4741
|
### `linkView`
|
|
4740
4742
|
|
|
4741
|
-
A link of your own; `undefined` keeps Bloom's.
|
|
4743
|
+
A link of your own, as runs of the text; `undefined` keeps Bloom's.
|
|
4742
4744
|
|
|
4743
4745
|
- Parameters: a value
|
|
4744
|
-
- Signature: `.linkView(value: (link: InlineMarkdownLink) =>
|
|
4746
|
+
- Signature: `.linkView(value: (link: InlineMarkdownLink) => TextRuns)`
|
|
4745
4747
|
- Taken by: [inlineMarkdown](bloom-language-nodes.mdx#inlinemarkdown)
|
|
4746
4748
|
|
|
4747
4749
|
### `cell`
|
|
@@ -1180,7 +1180,7 @@ Modifiers:
|
|
|
1180
1180
|
- [`.shrink()`](bloom-language-modifiers.mdx#shrink) `(value: ShrinkPriority)`
|
|
1181
1181
|
- [`.alignSelf()`](bloom-language-modifiers.mdx#alignself) `(value: Alignment)`: Its own place across its parent's axis, over the parent's `align`.
|
|
1182
1182
|
- [`.background()`](bloom-language-modifiers.mdx#background) `(value: InkToken)` or `(value: ViewNode, alignment?: OverlayAlignment)`: A fill: a colour role, or a role at a named opacity (`'primary/10'`); or a view behind it, placed at `alignment` (centred by default).
|
|
1183
|
-
- [`.border()`](bloom-language-modifiers.mdx#border) `(value: InkToken, width?: BorderWidthName, edge?: BorderEdge)`
|
|
1183
|
+
- [`.border()`](bloom-language-modifiers.mdx#border) `(value: InkToken | undefined, width?: BorderWidthName, edge?: BorderEdge)`: A border: a colour role (or a role at an opacity, or an app colour), a width (`hairline` by default) and an edge (`all` by default). A colour of `undefined` writes the width alone, so the line keeps the platform's default colour (black natively, react-native-web's own on the web), as a style with a `borderWidth` and no `borderColor` does: `.border(subscribed ? 'border' : undefined, 'thin')`.
|
|
1184
1184
|
- [`.corner()`](bloom-language-modifiers.mdx#corner) `(value: CornerName, side?: CornerSide)`: Rounds the box: a radius rung, `full`, or `concentric` (the radius of the shape it sits in, less the inset between them: a glass's, another concentric box's, a Bloom card's).
|
|
1185
1185
|
- [`.opacity()`](bloom-language-modifiers.mdx#opacity) `(value: OpacityName)`
|
|
1186
1186
|
|
|
@@ -1320,7 +1320,7 @@ Modifiers:
|
|
|
1320
1320
|
- [`.shrink()`](bloom-language-modifiers.mdx#shrink) `(value: ShrinkPriority)`
|
|
1321
1321
|
- [`.alignSelf()`](bloom-language-modifiers.mdx#alignself) `(value: Alignment)`: Its own place across its parent's axis, over the parent's `align`.
|
|
1322
1322
|
- [`.background()`](bloom-language-modifiers.mdx#background) `(value: InkToken)` or `(value: ViewNode, alignment?: OverlayAlignment)`: A fill: a colour role, or a role at a named opacity (`'primary/10'`); or a view behind it, placed at `alignment` (centred by default).
|
|
1323
|
-
- [`.border()`](bloom-language-modifiers.mdx#border) `(value: InkToken, width?: BorderWidthName, edge?: BorderEdge)`
|
|
1323
|
+
- [`.border()`](bloom-language-modifiers.mdx#border) `(value: InkToken | undefined, width?: BorderWidthName, edge?: BorderEdge)`: A border: a colour role (or a role at an opacity, or an app colour), a width (`hairline` by default) and an edge (`all` by default). A colour of `undefined` writes the width alone, so the line keeps the platform's default colour (black natively, react-native-web's own on the web), as a style with a `borderWidth` and no `borderColor` does: `.border(subscribed ? 'border' : undefined, 'thin')`.
|
|
1324
1324
|
- [`.corner()`](bloom-language-modifiers.mdx#corner) `(value: CornerName, side?: CornerSide)`: Rounds the box: a radius rung, `full`, or `concentric` (the radius of the shape it sits in, less the inset between them: a glass's, another concentric box's, a Bloom card's).
|
|
1325
1325
|
- [`.opacity()`](bloom-language-modifiers.mdx#opacity) `(value: OpacityName)`
|
|
1326
1326
|
|
|
@@ -3538,9 +3538,9 @@ Modifiers:
|
|
|
3538
3538
|
|
|
3539
3539
|
- [`.streaming()`](bloom-language-modifiers.mdx#streaming) `(value?: boolean)`: The text is still arriving: an unclosed span is drawn as it will close.
|
|
3540
3540
|
- [`.onLinkPress()`](bloom-language-modifiers.mdx#onlinkpress) `(value: (url: string) => void)`: What a link does (opened outside the app by default).
|
|
3541
|
-
- [`.plainRun()`](bloom-language-modifiers.mdx#plainrun) `(value: (text: string) =>
|
|
3542
|
-
- [`.linkView()`](bloom-language-modifiers.mdx#linkview) `(value: (link: InlineMarkdownLink) =>
|
|
3543
|
-
- [`.suffix()`](bloom-language-modifiers.mdx#suffix) `(value:
|
|
3541
|
+
- [`.plainRun()`](bloom-language-modifiers.mdx#plainrun) `(value: (text: string) => TextRuns)`: Runs of your own for each plain run (mentions, tags), not inside links or code: one run or several, strings beside spans, as a `Text` takes them.
|
|
3542
|
+
- [`.linkView()`](bloom-language-modifiers.mdx#linkview) `(value: (link: InlineMarkdownLink) => TextRuns)`: A link of your own, as runs of the text; `undefined` keeps Bloom's.
|
|
3543
|
+
- [`.suffix()`](bloom-language-modifiers.mdx#suffix) `(value: TextRuns)`: What follows the runs, in the line (a "Read more"): runs of the text.
|
|
3544
3544
|
|
|
3545
3545
|
And every universal modifier.
|
|
3546
3546
|
|
|
@@ -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
|
|
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
|
|
|
@@ -241,20 +241,22 @@ Measured on Mention (the codemod at this commit, `style` kept 222 elements):
|
|
|
241
241
|
| 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
242
|
| 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
243
|
| 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 |
|
|
244
|
+
| 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
245
|
| Safe-area and bar insets | 11 | `.safeAreaPadding()` for a padding; points for a pinned edge (`.position({ top: insets.top + 8 })`) |
|
|
246
246
|
| 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
247
|
| 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
248
|
| A style of the press state (`({ pressed }) => …`) | 1 | `.when('pressed', (v) => …)` |
|
|
249
249
|
|
|
250
|
-
No element among them animates a style
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
No element among them animates a style: Mention's moving views are the
|
|
251
|
+
engine's already (`MotionValue`, see [Animations](#animations)). A view drawn
|
|
252
|
+
shifted by an amount its props give (a name size's nudge) is an offset of
|
|
253
|
+
points, below.
|
|
253
254
|
|
|
254
255
|
**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
|
|
256
|
+
`.position`, `.offset` and `.zIndex` take any `CGFloat` and `Double`; so do the
|
|
257
|
+
language's, for geometry alone: a frame's six lengths, a pinned view's edges,
|
|
258
|
+
its offset and its stacking order take a number of points (`Points`) besides
|
|
259
|
+
their tokens.
|
|
258
260
|
|
|
259
261
|
```ts
|
|
260
262
|
const Cell = view(function Cell({ item, size }: { item: Media; size: number }) {
|
|
@@ -262,6 +264,8 @@ const Cell = view(function Cell({ item, size }: { item: Media; size: number }) {
|
|
|
262
264
|
});
|
|
263
265
|
CheckoutBadge().position({ top: insets.top + 8, right: 'lg' })
|
|
264
266
|
Avatar(actor.avatar).zIndex(shown.length - index)
|
|
267
|
+
AccountBadge({ kind }).offset({ y: NAME_SIZES[size].nudge })
|
|
268
|
+
Embed(<iframe src={url} />).frame({ width: 'full' }).aspectRatio(getPlayerAspect(provider))
|
|
265
269
|
```
|
|
266
270
|
|
|
267
271
|
- **Only what the view computes.** A number written out is a token: `.frame({
|
|
@@ -281,9 +285,12 @@ Avatar(actor.avatar).zIndex(shown.length - index)
|
|
|
281
285
|
in state is still that: the language draws it, but a `Grid`, a fraction of
|
|
282
286
|
the parent (`'1/3'`) or `.aspectRatio()` says the layout without a second
|
|
283
287
|
pass, and is the form for new screens.
|
|
284
|
-
- **
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
- **A ratio is a number.** `.aspectRatio()` is no token: a ratio written out
|
|
289
|
+
(`16 / 9`) and a media's own one computed at render (`media.width /
|
|
290
|
+
media.height`) are both numbers, React Native's `aspectRatio` as it is.
|
|
291
|
+
- **The spec.** `points.params` names them (`frame`, `edges`, `zIndex`,
|
|
292
|
+
`padding`, `offset`); the compiler holds every other parameter to tokens and
|
|
293
|
+
rejects a number written out anywhere, with the token to write.
|
|
287
294
|
|
|
288
295
|
**A style a caller hands in is modifiers.** In SwiftUI a caller modifies the
|
|
289
296
|
view it places, and a view never takes a style object. So it is here:
|
|
@@ -517,16 +524,17 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
517
524
|
| `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
525
|
| `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
526
|
| `frame({ width: 'fit' })` | as wide (or tall) as its content: `fit-content` (`w-fit`) |
|
|
520
|
-
| `
|
|
527
|
+
| `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 |
|
|
528
|
+
| `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
529
|
| `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
530
|
| `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
531
|
| `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
532
|
| `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
533
|
| `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`) |
|
|
534
|
+
| `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
535
|
| `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
536
|
| `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 |
|
|
537
|
+
| `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
538
|
| `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
539
|
| `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
540
|
| `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 +547,7 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
539
547
|
| `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
548
|
| `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
549
|
| `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'`) |
|
|
550
|
+
| `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
551
|
| 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
552
|
| `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
553
|
| `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 +561,7 @@ The vocabulary is closed. Every value is a name from the spec, whose every rung
|
|
|
553
561
|
| `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
562
|
| `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
563
|
| `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`) |
|
|
564
|
+
| `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
565
|
| `lines(n)`, `noWrap()`, `truncation`, `selectable`, `textStyle`, `link`, `textAlign`, `italic`, `underline`, `strikethrough`, `textCase`, `monospacedDigit`, `wordBreak`, `textShadow` | text only (see [Text](#text)) |
|
|
558
566
|
| `listMarker(m)` | a stack only: a web list behind `disc` or `decimal` markers (see [Layout](#layout)) |
|
|
559
567
|
| `contentFit`, `aspectRatio`, `tint`, `crossFade`, `onLoad`, `onError` | `Image` only (see [Image](#image)) |
|
|
@@ -684,7 +692,8 @@ VStack(...).background('surface').corner('xl').shadow('m')
|
|
|
684
692
|
`raised` 1, `floating` 10, `dropdown` 40; Tailwind's `z-20`, `z-30` and
|
|
685
693
|
`z-50` are the numeric tokens `'20'`, `'30'`, `'50'`, and the exact levels
|
|
686
694
|
apps write are named by their value: `'-1'` (under its siblings), `'2'` to
|
|
687
|
-
`'7'`, `'60'
|
|
695
|
+
`'7'`, `'60'`, and `'1000'`, a picker raised over a whole screen (Mention's
|
|
696
|
+
mention picker, `z-[1000]`).
|
|
688
697
|
- **Defaults that are no modifier.** Every view is the positioned parent of
|
|
689
698
|
what it pins (`position: relative`, React Native's and react-native-web's
|
|
690
699
|
default) and draws what overflows it (`overflow: visible`, the default of
|
|
@@ -721,7 +730,13 @@ VStack(...).background('surface').corner('xl').shadow('m')
|
|
|
721
730
|
(`box-none`: `pointer-events: none` on the view, `auto` on each child), held
|
|
722
731
|
equal to it by the layout parity, a value chosen at render included;
|
|
723
732
|
react-native-web drops an inline `pointerEvents`, so on the web a Bloom
|
|
724
|
-
component's is a box of its own around it.
|
|
733
|
+
component's is a box of its own around it. React Native's `pointerEvents`
|
|
734
|
+
written in an inline style is a native hit testing: react-native-web writes
|
|
735
|
+
`box-none` and `box-only` there as they are, CSS values the browser drops,
|
|
736
|
+
so the web view takes touches as any view does. Its form is
|
|
737
|
+
`.when('native', (v) => v.allowsHitTesting('children'))`, held equal to the
|
|
738
|
+
inline style by the layout parity; a StyleSheet's style is compiled into
|
|
739
|
+
the prop's classes, and is `.allowsHitTesting()` on every platform.
|
|
725
740
|
- **Drawn, not read.** `.accessibilityHidden()` hides the view and everything
|
|
726
741
|
inside it from screen readers, each platform its own way: on Android and iOS
|
|
727
742
|
`accessibilityElementsHidden` and `importantForAccessibility:
|
|
@@ -960,6 +975,28 @@ Text('Read the ', Text('terms').link('https://oxy.so/terms'), '.').font('caption
|
|
|
960
975
|
Markdown nests its runs: it writes only what its own chain names (a weight,
|
|
961
976
|
an ink, a link) and inherits the rest, so a span of an `h1` keeps the
|
|
962
977
|
heading's size.
|
|
978
|
+
- **Pressable runs.** A span takes `.onPress()` and `.onLongPress()`, as a
|
|
979
|
+
React Native `Text` nested in a text takes `onPress`: it stays a span of the
|
|
980
|
+
line (no box of its own), a URL that opens on a press or a "Read more"
|
|
981
|
+
(`RawText(body, Text(' Read more').foreground('primary').onPress(expand))`).
|
|
982
|
+
A whole `Text` takes them too, a footer link.
|
|
983
|
+
- **Element runs.** `Embed(element)` is a run like any other, drawn as it is
|
|
984
|
+
inside the line: a router's `Link`, an app's own component. A render
|
|
985
|
+
function hands an element that takes a child (`asChild`) a span: inside a
|
|
986
|
+
text, `render(Text(…))` draws the span's host, so expo-router's `Link
|
|
987
|
+
asChild` gives it its `href`, its role and its press (an anchor on the web),
|
|
988
|
+
and its own props (`hrefAttrs` with `rel: 'nofollow'`) reach the span as
|
|
989
|
+
they reach a JSX child:
|
|
990
|
+
|
|
991
|
+
```tsx
|
|
992
|
+
const mention = (handle: string) =>
|
|
993
|
+
Embed((render) => (
|
|
994
|
+
<Link href={`/@${handle}`} push asChild>
|
|
995
|
+
{render(Text(`@${handle}`).foreground('primary'))}
|
|
996
|
+
</Link>
|
|
997
|
+
));
|
|
998
|
+
RawText('Hi ', mention('bob'), ', see ', Text('oxy.so').foreground('primary').onPress(open))
|
|
999
|
+
```
|
|
963
1000
|
- **Raw text.** `RawText(...runs)` is React Native's own `Text`, not Bloom's:
|
|
964
1001
|
it writes only what its chain names, so a text that names no family draws
|
|
965
1002
|
the platform face (Roboto on Android, San Francisco on iOS,
|
|
@@ -967,7 +1004,10 @@ Text('Read the ', Text('terms').link('https://oxy.so/terms'), '.').font('caption
|
|
|
967
1004
|
codemod writes for a React Native `Text`, so the move changes no pixel: a
|
|
968
1005
|
face the app's bundler gives React Native's `Text` (`@oxy.so/app-preset`'s
|
|
969
1006
|
`baseFont`) reaches `RawText` alike. New screens use `Text`. Inside a `Text`
|
|
970
|
-
it is a span that inherits its parent's face.
|
|
1007
|
+
it is a span that inherits its parent's face. It takes nothing set above it,
|
|
1008
|
+
so a root or a `view()` body over one reads no environment, and the theme
|
|
1009
|
+
only when a role inks it, as React Native's `Text` in a component that reads
|
|
1010
|
+
the theme to ink it.
|
|
971
1011
|
|
|
972
1012
|
- **Digits and breaking.** `.monospacedDigit()` draws digits of one width
|
|
973
1013
|
(`tabular-nums`, React Native's `fontVariant`). `.wordBreak('all')` lets a
|
|
@@ -2473,6 +2513,12 @@ Image(post.cover, 'Cover')
|
|
|
2473
2513
|
`crossFade` is a Bloom duration (`instant` 100, `fast` 150, `normal` 200,
|
|
2474
2514
|
`slow` 300 ms); without it the image appears at once. `onLoad` receives the
|
|
2475
2515
|
intrinsic `{ width, height }` and `onError` `{ error }`.
|
|
2516
|
+
- **Name.** `alt` is the image's name, Bloom's `alt`: expo-image and React
|
|
2517
|
+
Native's Image read it as `accessibilityLabel` (natively it also makes the
|
|
2518
|
+
image an accessibility element), and on the web react-native-web's Image
|
|
2519
|
+
writes it as its `aria-label` and `<img alt>`, as React Native's Image with
|
|
2520
|
+
an `accessibilityLabel` does (`parity/image-name.cases.tsx`). `.label()`
|
|
2521
|
+
names it the same way on the web.
|
|
2476
2522
|
- **Presses.** `BloomImage` takes accessibility props but no presses, so an image
|
|
2477
2523
|
with `onPress`, `onHover` or `hoverGroup` is drawn inside its pressable host,
|
|
2478
2524
|
which also takes `grow` and `shrink`.
|
|
@@ -2531,6 +2577,16 @@ ErrorBoundary(Feed()).title('The feed failed').resetKey(userId)
|
|
|
2531
2577
|
`.lines(n)`. The box modifiers (padding, frame, background, corner, margin,
|
|
2532
2578
|
flex) are the card's `style`, as an app writes them; on the web a role in
|
|
2533
2579
|
it is its CSS variable, as Bloom's prepainted theme hands it to an app.
|
|
2580
|
+
The card's own box is the one its padding, frame and fill share, in that
|
|
2581
|
+
order: a `.background()` there is Bloom Card's `style.backgroundColor`,
|
|
2582
|
+
which its surface paints from, so `.background('transparent')` draws no
|
|
2583
|
+
surface at all (Mention's composer zeroes a card's fill so:
|
|
2584
|
+
`.padding('lg').frame({ width: 'full', height: 'full' }).background('transparent').grow()`).
|
|
2585
|
+
A background after a `.corner()` or a second padding is a view around the
|
|
2586
|
+
card, as anywhere (see [Order means nesting](#order-means-nesting)), and
|
|
2587
|
+
the card still paints its own surface inside it. Its corner and outline are
|
|
2588
|
+
`.radius()` and `.outline()`: a border width or a corner in its `style` is
|
|
2589
|
+
Bloom's to ignore, so the chain writes neither.
|
|
2534
2590
|
- **Row.** `.subtitle()`, `.leadingView(...)` and `.trailing(...)` (its slots,
|
|
2535
2591
|
as views), `.size()`, `.lines(n)` (the title's), `.disabled()`,
|
|
2536
2592
|
`.destructive()`, `.selected()`, `.active()`, `.highlighted()`,
|
|
@@ -2855,10 +2911,12 @@ Text(InlineMarkdown(post.body).plainRun(mentions).suffix(Text(' Read more').link
|
|
|
2855
2911
|
Inline markdown inside a line is `InlineMarkdown(source)`, Bloom's own: a run
|
|
2856
2912
|
of a `Text` (emphasis, strikethrough, code and links as spans of it), its
|
|
2857
2913
|
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
|
|
2914
|
+
`.onLinkPress()`, `.plainRun(text => runs)` (each plain run, not inside links
|
|
2915
|
+
or code), `.linkView(link => runs)` (a link of your own; `undefined` keeps
|
|
2916
|
+
Bloom's) and `.suffix(runs)`. Each hands back runs of the text, as `Text`
|
|
2917
|
+
takes them: one, or several in order, strings beside spans and element runs,
|
|
2918
|
+
so a post's linkified plain run is its prose as strings and its mentions,
|
|
2919
|
+
tags and URLs as spans, with no span around the prose (see [Text](#text)).
|
|
2862
2920
|
|
|
2863
2921
|
### Sliders
|
|
2864
2922
|
|
|
@@ -4506,10 +4564,25 @@ inside it. It reads the theme when a node paints a theme colour; a fixed
|
|
|
4506
4564
|
colour (`white`, `black/60`, natively) and an app's own colour read none. A
|
|
4507
4565
|
tree of fixed geometry, a glyph in a fixed colour, an embedded element or a
|
|
4508
4566
|
`view()` (which reads what it takes itself) reads nothing, and a `view()`
|
|
4509
|
-
inside it still reads what is set above.
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4567
|
+
inside it still reads what is set above. A RawText takes no trait set above it
|
|
4568
|
+
(it writes only what its chain names), so it reads the theme only when a role
|
|
4569
|
+
inks it; an `Avatar` or an `AvatarGroup` hands Bloom its props as they are (a
|
|
4570
|
+
size, a shape, an avatar colour by name) and reads only what its box paints
|
|
4571
|
+
(an AvatarGroup's ring in a role, its item action), so a `view()` that hands
|
|
4572
|
+
its props to one costs what the component that renders Bloom's does (Mention's
|
|
4573
|
+
`AccountAvatar`). What a tree reads is known from its nodes, once per node
|
|
4574
|
+
(the modifiers that read nothing are the spec's `reads.nothing`), and read with
|
|
4575
|
+
React's `use`, so a root whose tree comes to read more stays the same component
|
|
4576
|
+
and keeps its state; a `view()` body reads the same way. A root whose tree is
|
|
4577
|
+
host views alone (stacks and spacers, `reads.hostViews`) and reads nothing has
|
|
4578
|
+
nothing for a boundary to provide: it is those views, with no fiber of its own
|
|
4579
|
+
(Mention's splash marker, `VStack().frame({ width: 'none', height: 'none' })
|
|
4580
|
+
.position({}).allowsHitTesting(false).onLayout(release)`, is the `View` it
|
|
4581
|
+
replaced). Such a tree holds no component and no state, so one that comes to
|
|
4582
|
+
read something is drawn again under a boundary, as JSX that comes to wrap a
|
|
4583
|
+
view in a component is; a root that holds a `view()`, an embedded element, a
|
|
4584
|
+
control or a list (whose items leave through a component of their own) keeps
|
|
4585
|
+
its boundary whatever it reads. Mention's feed video preview (a tap area and a mute button
|
|
4513
4586
|
in one root) is its JSX's fibers, hooks and reads, and one read more, the
|
|
4514
4587
|
environment its presses take. A component whose JSX holds two roots pays them
|
|
4515
4588
|
twice; converting a region into one root, not each of its pieces into a root
|
|
@@ -4917,10 +4990,10 @@ the owner's decision, or an app's `defineTokens`) before a codemod moves it.
|
|
|
4917
4990
|
|
|
4918
4991
|
| | Utilities | Uses | Share of uses |
|
|
4919
4992
|
| --- | ---: | ---: | ---: |
|
|
4920
|
-
| Maps to a modifier and a token |
|
|
4993
|
+
| Maps to a modifier and a token | 1090 | 47358 | 88.2% |
|
|
4921
4994
|
| Expressed by the view’s structure | 48 | 3426 | 6.4% |
|
|
4922
|
-
| Redundant in the language |
|
|
4923
|
-
| Needs a named token (raw value) |
|
|
4995
|
+
| Redundant in the language | 28 | 407 | 0.8% |
|
|
4996
|
+
| Needs a named token (raw value) | 258 | 608 | 1.1% |
|
|
4924
4997
|
| An app’s own token (a brand colour) | 30 | 76 | 0.1% |
|
|
4925
4998
|
| Maps to the motion layer | 13 | 236 | 0.4% |
|
|
4926
4999
|
| Needs a modifier the language lacks | 26 | 63 | 0.1% |
|
|
@@ -4939,7 +5012,7 @@ condition. The values with no rung, by scale (the owner names each as a token or
|
|
|
4939
5012
|
| 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
5013
|
| 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
5014
|
| 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 |
|
|
5015
|
+
| zIndex | 5 | 10000 (1), 2000 (1), 2001 (1), 80 (1), 9998 (1) |
|
|
4943
5016
|
| rotation | 1 | -12° (1) |
|
|
4944
5017
|
| weight | 1 | 900 (1) |
|
|
4945
5018
|
| scale | 1 | 1.01 (1) |
|
|
@@ -5034,6 +5107,14 @@ every chain, and the pass changes only what it proves keeps its meaning.
|
|
|
5034
5107
|
prefix (`HStack(…).padding('md')` before `.spacing(gap)`). Names resolve
|
|
5035
5108
|
through scope analysis, so a local that shadows an import is never hoisted.
|
|
5036
5109
|
- **Adds `"use memo"`** to every function passed to `view()`.
|
|
5110
|
+
- **Builds a root as it renders.** A dynamic `toElement(chain)` in JSX becomes
|
|
5111
|
+
`<LanguageRoot build={() => chain} />`, so the handlers and refs the chain
|
|
5112
|
+
takes reach the React Compiler as one JSX prop, never as arguments a call
|
|
5113
|
+
might read during render (which costs the whole component its memoization).
|
|
5114
|
+
A bare `view()` node stays `toElement`, which mounts its component, and so
|
|
5115
|
+
does a chain of host views that reads nothing and takes no handler or ref
|
|
5116
|
+
(the spec's `reads`), which `toElement` draws as those views, with no
|
|
5117
|
+
boundary to build it in.
|
|
5037
5118
|
- **Checks chains** against the spec: an unknown modifier for the node, a wrong
|
|
5038
5119
|
argument count, or a literal token outside its set fails the build with the
|
|
5039
5120
|
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.9.
|
|
11
|
+
This guide belongs to **@oxy.so/bloom 23.9.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
|
|
|
@@ -16,7 +16,7 @@ var _index3 = require("../pagination/index.js");
|
|
|
16
16
|
var _index4 = require("../segmented-control/index.js");
|
|
17
17
|
var _breakpoints = require("../styles/breakpoints.js");
|
|
18
18
|
var _index5 = require("../table/index.js");
|
|
19
|
-
var
|
|
19
|
+
var _colorTokens = require("../theme/color-tokens.js");
|
|
20
20
|
var _index6 = require("../typography/index.js");
|
|
21
21
|
var _messages2 = require("./messages.js");
|
|
22
22
|
var _sorting = require("./sorting.js");
|
|
@@ -57,13 +57,12 @@ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e;
|
|
|
57
57
|
/** The `sm` breakpoint, applied to the surface's own width. */
|
|
58
58
|
const NARROW_WIDTH = _breakpoints.BREAKPOINTS.sm;
|
|
59
59
|
const DEFAULT_PAGE_SIZE = 8;
|
|
60
|
-
function resolveDataTablePalette(
|
|
61
|
-
const c = theme.colors;
|
|
60
|
+
function resolveDataTablePalette(tokens) {
|
|
62
61
|
return {
|
|
63
|
-
border:
|
|
64
|
-
separator:
|
|
65
|
-
textTertiary:
|
|
66
|
-
text:
|
|
62
|
+
border: tokens.input,
|
|
63
|
+
separator: tokens.input,
|
|
64
|
+
textTertiary: tokens.mutedForeground,
|
|
65
|
+
text: tokens.foreground
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
|
|
@@ -191,11 +190,11 @@ function DataTable(t0) {
|
|
|
191
190
|
const {
|
|
192
191
|
size: scopedSize
|
|
193
192
|
} = (0, _index.useBloomAppearance)(t10, t11);
|
|
194
|
-
const
|
|
193
|
+
const tokens = (0, _colorTokens.useColorTokens)();
|
|
195
194
|
let t12;
|
|
196
|
-
if ($[5] !==
|
|
197
|
-
t12 = resolveDataTablePalette(
|
|
198
|
-
$[5] =
|
|
195
|
+
if ($[5] !== tokens) {
|
|
196
|
+
t12 = resolveDataTablePalette(tokens);
|
|
197
|
+
$[5] = tokens;
|
|
199
198
|
$[6] = t12;
|
|
200
199
|
} else {
|
|
201
200
|
t12 = $[6];
|