flet-box 1.1.2 → 1.1.3
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/AGENTS_FOR_CODE_GEN.md +284 -0
- package/CONTRIBUTING.md +238 -0
- package/README.md +2 -2
- package/bin/cli.js +88 -1
- package/bin/commands/auditFix.js +181 -27
- package/bin/commands/checkApi.js +14 -3
- package/bin/commands/checkStructure.js +368 -0
- package/bin/commands/checkSyntax.js +293 -0
- package/bin/commands/checkUi.js +666 -14
- package/bin/commands/create.js +14 -0
- package/bin/commands/createBundle.js +2 -2
- package/bin/commands/metrics.js +448 -0
- package/bin/commands/release.js +18 -0
- package/bin/commands/report.js +849 -0
- package/bin/commands/tools.js +76 -0
- package/bin/commands/unpack.js +39 -11
- package/bin/commands/verify.js +879 -0
- package/bin/mcp.js +280 -0
- package/bin/utils/contract.js +27 -0
- package/bin/utils/dtsProps.js +5 -1
- package/bin/utils/migrationGuide.js +146 -0
- package/bin/utils/moduleExports.js +9 -5
- package/bin/utils/templates.js +225 -18
- package/bin/utils/toolkit.js +191 -0
- package/docs/README.md +5 -1
- package/docs/arquitectura.md +1 -1
- package/docs/cli/README.md +168 -2
- package/docs/guides/README.md +6 -0
- package/docs/guides/accessibility.md +2 -1
- package/docs/guides/ai-toolkit.md +166 -0
- package/docs/guides/compatibility.md +1 -1
- package/docs/guides/migration.md +92 -0
- package/docs/guides/minification-and-protection.md +2 -1
- package/docs/guides/mobile-and-platforms.md +1 -1
- package/docs/guides/online-updates.md +2 -0
- package/docs/server/deployment.md +1 -1
- package/docs/tools/styling.md +2 -2
- package/docs/tools/theme.md +139 -4
- package/docs/widget/Accordion.md +74 -8
- package/docs/widget/AdMob.md +68 -3
- package/docs/widget/AdSense.md +67 -2
- package/docs/widget/AlertDialog.md +1 -1
- package/docs/widget/AnimatedBox.md +80 -39
- package/docs/widget/AnimatedText.md +74 -18
- package/docs/widget/Audio.md +73 -14
- package/docs/widget/Avatar.md +69 -4
- package/docs/widget/Badge.md +68 -3
- package/docs/widget/BottomSheet.md +2 -2
- package/docs/widget/Button.md +69 -3
- package/docs/widget/Card.md +69 -4
- package/docs/widget/Carousel.md +67 -2
- package/docs/widget/Chart.md +67 -2
- package/docs/widget/Checkbox.md +74 -8
- package/docs/widget/Chip.md +68 -3
- package/docs/widget/CircularBar.md +74 -15
- package/docs/widget/CircularChart.md +71 -10
- package/docs/widget/CodeViewer.md +67 -2
- package/docs/widget/Column.md +68 -3
- package/docs/widget/Container.md +68 -3
- package/docs/widget/DataTable.md +67 -2
- package/docs/widget/Divider.md +67 -2
- package/docs/widget/DraggBox.md +67 -2
- package/docs/widget/Dropdown.md +76 -10
- package/docs/widget/DroppBox.md +67 -2
- package/docs/widget/FloatingActionButton.md +68 -3
- package/docs/widget/GridView.md +67 -2
- package/docs/widget/Icon.md +71 -5
- package/docs/widget/Image.md +68 -3
- package/docs/widget/Input.md +68 -3
- package/docs/widget/Inspector.md +2 -2
- package/docs/widget/InstallButton.md +73 -13
- package/docs/widget/ListTile.md +69 -3
- package/docs/widget/ListView.md +67 -2
- package/docs/widget/Maps.md +68 -3
- package/docs/widget/Markdown.md +74 -15
- package/docs/widget/MatrixRain.md +72 -11
- package/docs/widget/Menu.md +209 -0
- package/docs/widget/Modal.md +3 -3
- package/docs/widget/Pagination.md +68 -3
- package/docs/widget/ParallaxBox.md +72 -12
- package/docs/widget/ProgressBar.md +69 -4
- package/docs/widget/QRCode.md +67 -2
- package/docs/widget/README.md +54 -50
- package/docs/widget/Radio.md +76 -10
- package/docs/widget/Rating.md +70 -6
- package/docs/widget/Row.md +68 -3
- package/docs/widget/Skeleton.md +68 -3
- package/docs/widget/Slider.md +75 -9
- package/docs/widget/SnackBar.md +2 -2
- package/docs/widget/Stack.md +68 -3
- package/docs/widget/Stepper.md +68 -3
- package/docs/widget/Switch.md +74 -8
- package/docs/widget/Text.md +71 -4
- package/docs/widget/ThemePicker.md +197 -0
- package/docs/widget/Tooltip.md +72 -7
- package/docs/widget/TreeView.md +70 -10
- package/docs/widget/Video.md +71 -10
- package/package.json +10 -3
- package/skills/fletbox-design/SKILL.md +89 -5
- package/skills/fletbox-motion/SKILL.md +1 -1
- package/skills/fletbox-rules/SKILL.md +56 -4
- package/src/core/runApp.js +12 -0
- package/src/index.d.ts +374 -101
- package/src/index.js +9 -0
- package/src/navigations/AdaptiveScaffold.js +2 -2
- package/src/navigations/BottomNavigation.js +1 -1
- package/src/navigations/Scaffold.js +18 -6
- package/src/tools/useState.js +11 -4
- package/src/utils/colors.js +275 -0
- package/src/utils/errorBoundary.js +288 -0
- package/src/utils/index.js +10 -2
- package/src/utils/stackPosition.js +39 -24
- package/src/utils/syntaxHighlight.js +4 -1
- package/src/utils/themes.js +279 -3
- package/src/widget-factory/addChildren.js +17 -10
- package/src/widget-factory/assignProps.js +18 -6
- package/src/widget-factory/createWidget.js +7 -0
- package/src/widget-factory/deprecations.js +77 -0
- package/src/widget-factory/translateProps.js +11 -1
- package/src/widget-factory/warnings.js +1 -27
- package/src/widget-factory/widgetFactory.js +59 -17
- package/src/widgets/Accordion.js +21 -7
- package/src/widgets/Badge.js +11 -2
- package/src/widgets/Button.js +15 -3
- package/src/widgets/Carousel.js +12 -4
- package/src/widgets/Chart.js +7 -2
- package/src/widgets/Checkbox.js +1 -2
- package/src/widgets/Chip.js +24 -10
- package/src/widgets/CircularBar.js +9 -3
- package/src/widgets/CircularChart.js +5 -3
- package/src/widgets/Container.js +6 -0
- package/src/widgets/Divider.js +3 -1
- package/src/widgets/DraggBox.js +9 -0
- package/src/widgets/Dropdown.js +3 -3
- package/src/widgets/DroppBox.js +5 -0
- package/src/widgets/FloatingActionButton.js +1 -1
- package/src/widgets/Icon.js +5 -1
- package/src/widgets/InstallButton.js +4 -2
- package/src/widgets/Markdown.js +171 -103
- package/src/widgets/Menu.js +340 -0
- package/src/widgets/Modal.js +7 -1
- package/src/widgets/Pagination.js +10 -5
- package/src/widgets/ProgressBar.js +5 -4
- package/src/widgets/QRCode.js +4 -0
- package/src/widgets/Radio.js +1 -2
- package/src/widgets/Rating.js +9 -0
- package/src/widgets/Slider.js +4 -1
- package/src/widgets/SnackBar.js +2 -2
- package/src/widgets/Switch.js +1 -2
- package/src/widgets/Text.js +9 -5
- package/src/widgets/ThemePicker.js +234 -0
- package/src/widgets/TreeView.js +2 -1
- package/src/widgets/index.js +2 -0
- package/docs/CONTRIBUTING.md +0 -156
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# ThemePicker
|
|
2
|
+
|
|
3
|
+
A row of two-tone squares, one per accent family, that picks the color the screen paints its buttons, icons and plates with.
|
|
4
|
+
|
|
5
|
+
## When to use it
|
|
6
|
+
|
|
7
|
+
Use it wherever the reader is allowed to choose the app's color — a settings screen or a preferences sheet. It picks the accent, not the theme: light and dark stay the reader's own decision.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import { ThemePicker } from "flet-box";
|
|
13
|
+
|
|
14
|
+
const accents = ThemePicker({});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> The prop table is generated from `src/index.d.ts`; the examples use only documented props.
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Description |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `accents` | `Accent[]` | The families on offer, as `listAccents()` returns them: `{ id, label, light, dark }`. Defaults to every registered family — an app that ships one brand color filters the list rather than registering fewer. |
|
|
24
|
+
| `size` | `number` | Edge of one swatch, in framework units. Defaults to 40 — the tap minimum — and the tick badge scales with it. |
|
|
25
|
+
| `showLabels` | `boolean` | Print each family's name under its swatch. Off by default, because the two-tone square is the answer and twelve captions is a color survey. |
|
|
26
|
+
| `surfaces` | `boolean` | Offer each family as a theme rather than only as a brand: the tap also paints the page, the panels, the cards and the hairlines from that family's own ramp. Off by default, because a tinted page is a bigger promise than a button color. |
|
|
27
|
+
| `label` | `string` | Accessible name of the color group. Nothing is painted from it; a screen reader announces the row as one question with this wording. |
|
|
28
|
+
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
29
|
+
| `onChange` | `(id: string) => void` | Called with the chosen family id after the accent has already been applied to the screen, so the app only has to remember the choice. |
|
|
30
|
+
|
|
31
|
+
### Common props
|
|
32
|
+
|
|
33
|
+
Every widget also accepts these shared props — see [common props](COMMON_PROPS.md) for the full rules and aliases.
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
38
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
39
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
40
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
41
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
42
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
43
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
44
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
45
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
46
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
47
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
48
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
49
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
50
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
51
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
52
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
53
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
54
|
+
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
55
|
+
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `size` | `Size` | Edge of one swatch, in framework units. Defaults to 40 — the tap minimum — and the tick badge scales with it. |
|
|
57
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
58
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
59
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
60
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
61
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
62
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
63
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
64
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
65
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
66
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
67
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
68
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
69
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
70
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
71
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
72
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
73
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
74
|
+
| `fontSize` | `number` | Size of the font. |
|
|
75
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
76
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
77
|
+
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
78
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
79
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
80
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
81
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
82
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
83
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
84
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
85
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
86
|
+
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
87
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
88
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
89
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
90
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
91
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
92
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
93
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
94
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
95
|
+
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
96
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
97
|
+
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
98
|
+
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
99
|
+
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
100
|
+
| `shadow` | `string` | Raw CSS `box-shadow` value, for a custom shadow. |
|
|
101
|
+
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
102
|
+
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
103
|
+
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
104
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
105
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
106
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
107
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
108
|
+
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
109
|
+
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
110
|
+
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
111
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
112
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
113
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
114
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
115
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
116
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
117
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
118
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
119
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
120
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
121
|
+
| `id` | `string` | DOM `id` for the rendered element. |
|
|
122
|
+
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
123
|
+
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
124
|
+
| `disableTransform` | `boolean` | Disables the default press/scale transform animation. |
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Everyday
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
import { ThemePicker } from "flet-box";
|
|
132
|
+
|
|
133
|
+
const accentRow = ThemePicker({
|
|
134
|
+
size: 48,
|
|
135
|
+
showLabels: true,
|
|
136
|
+
onChange: (id) => console.log("accent:", id),
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Full
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
import { BottomSheet, Column, Text, ThemePicker, color, filter, includes, listAccents } from "flet-box";
|
|
144
|
+
|
|
145
|
+
const preferences = BottomSheet({
|
|
146
|
+
content: Column({
|
|
147
|
+
gap: 16,
|
|
148
|
+
children: [
|
|
149
|
+
Text({ text: "Accent color", size: 18, fontWeight: 600 }),
|
|
150
|
+
ThemePicker({
|
|
151
|
+
accents: listAccents().filter((a) => ["teal", "blue", "rose", "orange"].includes(a.id)),
|
|
152
|
+
size: 44,
|
|
153
|
+
showLabels: true,
|
|
154
|
+
label: "Choose the color of the app",
|
|
155
|
+
onChange: (id) => console.log("picked:", id),
|
|
156
|
+
}),
|
|
157
|
+
],
|
|
158
|
+
}),
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Tips
|
|
163
|
+
|
|
164
|
+
- The tap is not decoration: it calls `setAccent(id)`, which repaints every widget already on screen and stores the choice, so the next visit opens the same color.
|
|
165
|
+
- An app sets its own brand at boot with `applyAccentPreference(id)`, never with `setAccent`: the first leaves the picker blank on a reader's first visit, the second answers for them before they have chosen.
|
|
166
|
+
- Twelve squares is a color survey; four is a decision. Cut the list to what the brand allows with `accents: listAccents().filter((a) => [...].includes(a.id))`.
|
|
167
|
+
- Each half of a square is the same hue in one theme: the upper-left is what it wears on a light page, the lower-right what it wears on a dark one. Only one of the two is on screen at a time, and showing both is what makes the choice safe.
|
|
168
|
+
- `surfaces: true` makes the same tap a theme instead of a brand color: the page, the panels, the cards and the hairlines are read off the family's ramp, from its palest stop down. The words never change color with it — the ink scale is the palette's own — so a tinted theme cannot make itself unreadable.
|
|
169
|
+
|
|
170
|
+
## Accessibility
|
|
171
|
+
|
|
172
|
+
- The row is a `radiogroup` named by `label` and every square is a `radio` that carries its family's name and `aria-checked`, so the answer is read and not only seen. Tab reaches the squares and Enter or Space picks one.
|
|
173
|
+
- The selected state is the page's own ink plus a tick badge, never color alone; an empty square rims in the same 3:1 gray a `Checkbox` uses for an unchecked box.
|
|
174
|
+
|
|
175
|
+
## Behavior
|
|
176
|
+
|
|
177
|
+
- `onChange(id)` fires after the screen is repainted, and re-tapping the square already chosen fires nothing.
|
|
178
|
+
- The picker subscribes to the theme, so a toggle anywhere else on the screen moves the tick here without a prop change; the subscription is released on unmount.
|
|
179
|
+
- `update({ accents, showLabels, surfaces, label, disabled })` rebuilds the grid. Any other key goes to the factory and styles the row itself.
|
|
180
|
+
- `size` is the edge of the square and defaults to the 40-unit tap minimum; the tick and its badge scale with it.
|
|
181
|
+
- Every shipped family is measured, not eyeballed: the accent carries white or dark words at 4.5:1, reads as text on the page and as a glyph on a card, and its wash sits just off the background. `tests/regression.test.js` re-measures all of it in both themes.
|
|
182
|
+
|
|
183
|
+
## Related widgets
|
|
184
|
+
|
|
185
|
+
- [Radio](Radio.md)
|
|
186
|
+
- [Switch](Switch.md)
|
|
187
|
+
- [BottomSheet](BottomSheet.md)
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Continue reading
|
|
192
|
+
|
|
193
|
+
- **Previous:** [Rating](Rating.md)
|
|
194
|
+
- **Next:** [Card](Card.md)
|
|
195
|
+
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
196
|
+
|
|
197
|
+
You are reading **Chapter 2 · Interaction basics** (9 of 9).
|
package/docs/widget/Tooltip.md
CHANGED
|
@@ -25,7 +25,7 @@ const tip = Tooltip({
|
|
|
25
25
|
| --- | --- | --- |
|
|
26
26
|
| `text` | `string` | Visible text content. |
|
|
27
27
|
| `child` | `Widget` | A single child widget. Alias: `children` for a list. |
|
|
28
|
-
| `position` | `'top' \| 'bottom' \| 'left' \| 'right'` |
|
|
28
|
+
| `position` | `'top' \| 'bottom' \| 'left' \| 'right'` | Side of the child the bubble appears on. |
|
|
29
29
|
| `delay` | `number` | Milliseconds the pointer has to stay on the widget before the tooltip appears. |
|
|
30
30
|
| `tooltipDelay` | `number` | Deprecated alias of `delay`. |
|
|
31
31
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
@@ -38,7 +38,7 @@ const tip = Tooltip({
|
|
|
38
38
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
39
39
|
| `maxWidth` | `number` | Maximum width the widget may grow to. |
|
|
40
40
|
| `textAlign` | `'left' \| 'center' \| 'right'` | The `textAlign` value for the widget. |
|
|
41
|
-
| `zIndex` | `number` |
|
|
41
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
42
42
|
| `animationDuration` | `number` | Duration for the animation, in milliseconds. |
|
|
43
43
|
| `arrowSize` | `number` | Size of the arrow. |
|
|
44
44
|
| `borderColor` | `Color` | Color used for the border. |
|
|
@@ -51,11 +51,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
51
51
|
|
|
52
52
|
| Prop | Type | Description |
|
|
53
53
|
| --- | --- | --- |
|
|
54
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
55
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
56
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
57
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
58
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
59
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
60
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
61
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
62
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
63
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
64
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
65
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
66
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
67
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
68
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
69
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
70
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Side of the child the bubble appears on. |
|
|
54
71
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
55
72
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
56
73
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
74
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
75
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
76
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
77
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
78
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
79
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
80
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
81
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
82
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
83
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
84
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
85
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
86
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
87
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
88
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
89
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
90
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
91
|
+
| `fontSize` | `number` | Size of the font. |
|
|
92
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
93
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
57
94
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
95
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
96
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
97
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
98
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
99
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
100
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
101
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
102
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
58
103
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
104
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
105
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
106
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
107
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
108
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
109
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
110
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
111
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
59
112
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
60
113
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
61
114
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -65,11 +118,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
65
118
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
66
119
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
67
120
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
121
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
122
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
123
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
124
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
68
125
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
69
126
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
70
127
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
71
|
-
| `onPress` | `(
|
|
72
|
-
| `onClick` | `(
|
|
128
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
129
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
130
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
131
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
132
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
133
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
134
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
135
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
136
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
137
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
73
138
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
74
139
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
75
140
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -128,7 +193,7 @@ const tip = Tooltip({
|
|
|
128
193
|
- The tooltip hides itself on window scroll or resize and removes its body portal plus listeners on unmount.
|
|
129
194
|
- The wrapped child gains showTooltip, hideTooltip, updateContent, and updatePosition helpers for imperative control.
|
|
130
195
|
- A pointer that leaves before the wait is over never shows the bubble: leaving clears the timer.
|
|
131
|
-
- tooltipDelay is the old name of delay. When both are given, delay wins.
|
|
196
|
+
- tooltipDelay is the old name of delay and is deprecated: write delay. When both are given, delay wins.
|
|
132
197
|
- The requested position is a preference, not a promise: when the bubble would not fit between the trigger and the safe-area edge it is placed on the opposite side, and the arrow follows it.
|
|
133
198
|
|
|
134
199
|
## Related widgets
|
|
@@ -142,7 +207,7 @@ const tip = Tooltip({
|
|
|
142
207
|
## Continue reading
|
|
143
208
|
|
|
144
209
|
- **Previous:** [SnackBar](SnackBar.md)
|
|
145
|
-
- **Next:** [
|
|
210
|
+
- **Next:** [Menu](Menu.md)
|
|
146
211
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
147
212
|
|
|
148
|
-
You are reading **Chapter 4 · Feedback and overlays** (5 of
|
|
213
|
+
You are reading **Chapter 4 · Feedback and overlays** (5 of 11).
|
package/docs/widget/TreeView.md
CHANGED
|
@@ -24,14 +24,9 @@ const tree = TreeView({
|
|
|
24
24
|
|
|
25
25
|
| Prop | Type | Description |
|
|
26
26
|
| --- | --- | --- |
|
|
27
|
-
| `nodes` | `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `icon` | `string` | Name of the icon to render. |
|
|
31
|
-
| `iconColor` | `Color` | Color of the field icons. |
|
|
32
|
-
| `children` | `any[]` | An array of child widgets. Alias: `child` for a single child. |
|
|
33
|
-
| `badge` | `string \| number` | The `badge` value for the widget. |
|
|
34
|
-
| `onSelect` | `(node: any) => void` | Fired when the widget or an option is selected. |
|
|
27
|
+
| `nodes` | `TreeViewNode[]` | Tree nodes, each with `id`, `label`, and optional `children`. |
|
|
28
|
+
| `onSelect` | `(node: TreeViewNode) => void` | Fired when the widget or an option is selected. |
|
|
29
|
+
| `onPress` | `(node: TreeViewNode) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
35
30
|
| `onToggle` | `(nodeId: string, expanded: boolean) => void` | Fired with the new toggled state. |
|
|
36
31
|
| `expandedNodes` | `string[]` | Ids of nodes that start expanded. |
|
|
37
32
|
| `indent` | `number` | Indentation depth used when printing nested structures. |
|
|
@@ -66,11 +61,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
66
61
|
|
|
67
62
|
| Prop | Type | Description |
|
|
68
63
|
| --- | --- | --- |
|
|
64
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
65
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
66
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
67
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
68
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
69
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
70
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
71
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
72
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
73
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
74
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
75
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
76
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
77
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
78
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
79
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
80
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
69
81
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
70
82
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
71
83
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
84
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
85
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
86
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
87
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
88
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
89
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
90
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
91
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
92
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
93
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
94
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
95
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
96
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
97
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
98
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
99
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
100
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
101
|
+
| `fontSize` | `number` | Size of the font. |
|
|
102
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
103
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
72
104
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
105
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
106
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
107
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
108
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
109
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
110
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
111
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
112
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
73
113
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
114
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
115
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
116
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
117
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
118
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
119
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
120
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
121
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
74
122
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
75
123
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
76
124
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -80,11 +128,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
80
128
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
81
129
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
82
130
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
131
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
132
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
133
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
134
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
83
135
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
84
136
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
85
137
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
86
|
-
| `onPress` | `(
|
|
87
|
-
| `onClick` | `(
|
|
138
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
139
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
140
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
141
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
142
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
143
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
144
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
145
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
146
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
147
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
88
148
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
89
149
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
90
150
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
package/docs/widget/Video.md
CHANGED
|
@@ -38,11 +38,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
38
38
|
|
|
39
39
|
| Prop | Type | Description |
|
|
40
40
|
| --- | --- | --- |
|
|
41
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
42
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
43
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
44
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
45
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
46
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
47
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
48
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
49
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
50
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
51
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
52
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
53
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
54
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
55
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
57
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
41
58
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
42
59
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
43
60
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
61
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
62
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
63
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
64
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
65
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
66
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
67
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
68
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
69
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
70
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
71
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
72
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
73
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
74
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
75
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
76
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
77
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
78
|
+
| `fontSize` | `number` | Size of the font. |
|
|
79
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
80
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
44
81
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
82
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
83
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
84
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
85
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
86
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
87
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
88
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
89
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
45
90
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
91
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
92
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
93
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
94
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
95
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
96
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
97
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
98
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
46
99
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
47
100
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
48
101
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -52,11 +105,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
52
105
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
53
106
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
54
107
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
108
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
109
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
110
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
111
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
55
112
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
56
113
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
57
114
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
58
|
-
| `onPress` | `(
|
|
59
|
-
| `onClick` | `(
|
|
115
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
116
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
117
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
118
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
119
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
120
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
121
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
122
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
123
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
124
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
60
125
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
61
126
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
62
127
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -98,12 +163,9 @@ const clip = Video({
|
|
|
98
163
|
|
|
99
164
|
## Tips
|
|
100
165
|
|
|
101
|
-
- controls, loop, muted, and autoplay are set as element properties, not CSS, so they
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
- reliable ambient loop.
|
|
105
|
-
- The ref callback receives the element extended with playVideo, pauseVideo, stop,
|
|
106
|
-
- restart, volumeUp, and muteVideo helpers.
|
|
166
|
+
- controls, loop, muted, and autoplay are set as element properties, not CSS, so they work even though they look like styling props.
|
|
167
|
+
- Browsers block autoplay with sound; pair autoplay: true with muted: true for a reliable ambient loop.
|
|
168
|
+
- The ref callback receives the element extended with playVideo, pauseVideo, stop, restart, volumeUp, and muteVideo helpers.
|
|
107
169
|
|
|
108
170
|
## Accessibility
|
|
109
171
|
|
|
@@ -111,8 +173,7 @@ const clip = Video({
|
|
|
111
173
|
|
|
112
174
|
## Behavior
|
|
113
175
|
|
|
114
|
-
- playVideo swallows the browser's autoplay rejection instead of throwing, so it is
|
|
115
|
-
- safe to call from a click handler.
|
|
176
|
+
- playVideo swallows the browser's autoplay rejection instead of throwing, so it is safe to call from a click handler.
|
|
116
177
|
|
|
117
178
|
## Related widgets
|
|
118
179
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flet-box",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Declarative, zero-dependency UI framework in vanilla JS — ship web, PWA, Android and iOS from one codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -16,11 +16,16 @@
|
|
|
16
16
|
"flet-box": "bin/cli.js"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
+
"predev": "node bin/cli.js check-api --emit-api --root . && node bin/cli.js unpack --all --md --root .",
|
|
19
20
|
"dev": "node bin/cli.js run --hot",
|
|
21
|
+
"verify": "node scripts/verify.mjs",
|
|
22
|
+
"metrics": "node bin/cli.js metrics",
|
|
23
|
+
"selftest": "node scripts/selftest-gates.mjs",
|
|
20
24
|
"build": "node bin/cli.js createBundle",
|
|
21
25
|
"release": "node bin/cli.js release",
|
|
22
|
-
"test": "node scripts/check-widgets.mjs && node scripts/check-widget-scale.mjs && node scripts/check-shared-helpers.mjs && node scripts/check-a11y.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && node scripts/check-api-surface.mjs && node scripts/check-api-propscan.mjs && node scripts/check-time-helpers.mjs && node scripts/check-router-base.mjs && node scripts/check-clean-ui.mjs && node scripts/check-framework-ui.mjs && node scripts/check-skills.mjs && node scripts/check-app-types.mjs && node scripts/check-ota-assets.mjs && node scripts/check-pwa-shell.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
23
|
-
"test:browser": "node scripts/run-browser-tests.mjs"
|
|
26
|
+
"test": "node scripts/check-widgets.mjs && node scripts/check-widget-scale.mjs && node scripts/check-shared-helpers.mjs && node scripts/check-a11y.mjs && node scripts/check-error-boundary.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && python3 scripts/generate_widget_docs.py --check && node scripts/check-api-contract.mjs && node scripts/check-api-surface.mjs && node scripts/check-bundle-size.mjs && node scripts/check-api-propscan.mjs && node scripts/check-module-exports.mjs && node scripts/check-time-helpers.mjs && node scripts/check-router-base.mjs && node scripts/check-clean-ui.mjs && node scripts/check-framework-ui.mjs && node scripts/check-structure.mjs && node scripts/check-ui-rules.mjs && node scripts/check-syntax.mjs && node scripts/check-metrics.mjs && node scripts/check-report.mjs && node scripts/check-skills.mjs && node scripts/check-app-types.mjs && node scripts/check-codegen-contract.mjs && node scripts/check-migrations.mjs && node scripts/check-ota-assets.mjs && node scripts/check-pwa-shell.mjs && node scripts/check-image-convert.mjs && node scripts/check-images-cli.mjs && node scripts/selftest-gates.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
27
|
+
"test:browser": "node scripts/run-browser-tests.mjs",
|
|
28
|
+
"test:visual": "node scripts/check-visual.mjs"
|
|
24
29
|
},
|
|
25
30
|
"keywords": [
|
|
26
31
|
"fletbox",
|
|
@@ -55,6 +60,8 @@
|
|
|
55
60
|
"src/",
|
|
56
61
|
"docs/",
|
|
57
62
|
"skills/",
|
|
63
|
+
"AGENTS_FOR_CODE_GEN.md",
|
|
64
|
+
"CONTRIBUTING.md",
|
|
58
65
|
"README.md",
|
|
59
66
|
"LICENSE"
|
|
60
67
|
],
|