flet-box 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/bin/cli.js +77 -11
- package/bin/commands/auditFix.js +682 -0
- package/bin/commands/checkApi.js +7 -5
- package/bin/commands/create.js +40 -10
- package/bin/commands/createBundle.js +54 -1
- package/bin/commands/images.js +349 -0
- package/bin/commands/pruneAssets.js +170 -0
- package/bin/commands/release.js +34 -1
- package/bin/commands/runCloudflare.js +47 -9
- package/bin/commands/runServer.js +81 -24
- package/bin/commands/toPng.js +346 -0
- package/bin/commands/unpack.js +1173 -0
- package/bin/ota/loader.js +90 -0
- package/bin/utils/appSources.js +101 -0
- package/bin/utils/bundleConfig.js +166 -0
- package/bin/utils/dtsProps.js +147 -0
- package/bin/utils/imageTools.js +271 -0
- package/bin/utils/images/bmp.js +99 -0
- package/bin/utils/images/gif.js +244 -0
- package/bin/utils/images/index.js +163 -0
- package/bin/utils/images/jpeg.js +643 -0
- package/bin/utils/images/png.js +486 -0
- package/bin/utils/images/unsupported.js +29 -0
- package/bin/utils/neutralise.js +109 -6
- package/bin/utils/templates.js +307 -64
- package/docs/cli/README.md +82 -0
- package/docs/guides/online-updates.md +57 -9
- package/docs/widget/Accordion.md +1 -0
- package/docs/widget/AdMob.md +1 -0
- package/docs/widget/AdSense.md +1 -0
- package/docs/widget/AnimatedBox.md +1 -0
- package/docs/widget/AnimatedText.md +1 -0
- package/docs/widget/Audio.md +2 -1
- package/docs/widget/Avatar.md +12 -3
- package/docs/widget/Badge.md +1 -0
- package/docs/widget/Button.md +1 -0
- package/docs/widget/Card.md +1 -0
- package/docs/widget/Carousel.md +1 -0
- package/docs/widget/Chart.md +1 -0
- package/docs/widget/Checkbox.md +1 -0
- package/docs/widget/Chip.md +1 -0
- package/docs/widget/CircularBar.md +1 -0
- package/docs/widget/CircularChart.md +1 -0
- package/docs/widget/CodeViewer.md +1 -0
- package/docs/widget/Column.md +1 -0
- package/docs/widget/Container.md +1 -0
- package/docs/widget/DataTable.md +1 -0
- package/docs/widget/Divider.md +1 -0
- package/docs/widget/DraggBox.md +3 -2
- package/docs/widget/Dropdown.md +3 -0
- package/docs/widget/DroppBox.md +2 -1
- package/docs/widget/FloatingActionButton.md +1 -0
- package/docs/widget/GridView.md +1 -0
- package/docs/widget/Icon.md +1 -0
- package/docs/widget/Image.md +11 -3
- package/docs/widget/Input.md +1 -0
- package/docs/widget/InstallButton.md +1 -0
- package/docs/widget/ListTile.md +1 -0
- package/docs/widget/ListView.md +1 -0
- package/docs/widget/Maps.md +188 -0
- package/docs/widget/Markdown.md +1 -0
- package/docs/widget/MatrixRain.md +1 -0
- package/docs/widget/Pagination.md +1 -0
- package/docs/widget/ParallaxBox.md +1 -0
- package/docs/widget/ProgressBar.md +1 -0
- package/docs/widget/QRCode.md +1 -0
- package/docs/widget/README.md +12 -10
- package/docs/widget/Radio.md +1 -0
- package/docs/widget/Rating.md +1 -0
- package/docs/widget/Row.md +1 -0
- package/docs/widget/Skeleton.md +1 -0
- package/docs/widget/Slider.md +1 -0
- package/docs/widget/Stack.md +1 -0
- package/docs/widget/Stepper.md +1 -0
- package/docs/widget/Switch.md +1 -0
- package/docs/widget/Text.md +1 -0
- package/docs/widget/Tooltip.md +11 -13
- package/docs/widget/TreeView.md +1 -0
- package/docs/widget/Video.md +3 -2
- package/package.json +2 -2
- package/src/core/hmr-client.js +129 -34
- package/src/index.d.ts +132 -0
- package/src/index.js +1 -0
- package/src/navigations/AppBar.js +15 -4
- package/src/navigations/Drawer.js +9 -1
- package/src/widget-factory/translateProps.js +32 -1
- package/src/widgets/Avatar.js +228 -131
- package/src/widgets/Container.js +13 -0
- package/src/widgets/Dropdown.js +33 -1
- package/src/widgets/Image.js +102 -3
- package/src/widgets/Maps.js +1495 -0
- package/src/widgets/Tooltip.js +12 -2
- package/src/widgets/index.js +1 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Maps
|
|
2
|
+
|
|
3
|
+
An interactive map — pan, zoom, markers and polylines — with no map library behind it. The Web Mercator projection and the XYZ tile grid are implemented inside the widget, so any provider that answers `{z}/{x}/{y}` works and nothing needs an API key, a CDN or a build step.
|
|
4
|
+
|
|
5
|
+
## When to use it
|
|
6
|
+
|
|
7
|
+
Use it to show a venue, plot delivery stops, draw a route, or let a picker return a coordinate.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import { Maps } from "flet-box";
|
|
13
|
+
|
|
14
|
+
const place = Maps({
|
|
15
|
+
center: [40.4168, -3.7038],
|
|
16
|
+
zoom: 12,
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> The prop table is generated from `src/index.d.ts`; the examples use only documented props.
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Description |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `center` | `LatLng` | View centre as `[lat, lng]`, `{lat, lng}` or `{latitude, longitude}`. |
|
|
27
|
+
| `zoom` | `number` | Integer zoom level: `0` shows the whole world, each step doubles the scale. |
|
|
28
|
+
| `minZoom` | `number` | Lowest zoom level the user can reach. |
|
|
29
|
+
| `maxZoom` | `number` | Highest zoom level the user can reach, usually the provider's last tile level. |
|
|
30
|
+
| `markers` | `Array<MapMarker \| LatLng>` | Pins to draw: bare positions or `{position, label, color, id, rotation, clickable, data}` records. |
|
|
31
|
+
| `markerColor` | `Color` | Colour of the pins that do not set a `color` of their own. |
|
|
32
|
+
| `polylines` | `Array<MapPolyline \| LatLng[]>` | Stroked paths: bare position lists or `{points, color, width, opacity, dashed, id}` records. |
|
|
33
|
+
| `polylineColor` | `Color` | Stroke of the lines that do not set a `color` of their own. |
|
|
34
|
+
| `tileUrl` | `string` | `{z}/{x}/{y}` tile template of the provider. |
|
|
35
|
+
| `attribution` | `string` | Credit line shown in the corner; most tile providers require one. |
|
|
36
|
+
| `showAttribution` | `boolean` | Shows the credit line. |
|
|
37
|
+
| `showZoomControl` | `boolean` | Shows the ± zoom buttons in the top-right corner. |
|
|
38
|
+
| `interactive` | `boolean` | Lets the user pan and zoom. When false, only the imperative API moves the view. |
|
|
39
|
+
| `scrollZoom` | `boolean` | Zooms with the mouse wheel, centred on the cursor. |
|
|
40
|
+
| `doubleClickZoom` | `boolean` | Zooms on double-click; `Shift` + double-click zooms out. |
|
|
41
|
+
| `showUserLocation` | `boolean` | Draws the browser's position; asks for permission on the first paint. |
|
|
42
|
+
| `followUser` | `boolean` | Keeps the view centred on the browser's position, asking for fresh high-accuracy fixes. |
|
|
43
|
+
| `onMapClick` | `(point: MapClick, event: PointerEvent) => void` | Fired with `{ lat, lng, zoom }` when the map is clicked without panning. |
|
|
44
|
+
| `onMarkerClick` | `(marker: MapMarker, event: MouseEvent) => void` | Fired with the clicked marker. |
|
|
45
|
+
| `onMoveEnd` | `(state: MapState) => void` | Fired with `{ center, zoom, bounds }` once the view stops changing. |
|
|
46
|
+
| `onUserUpdate` | `(fix: MapFix) => void` | Fired with `{ lat, lng, accuracy }` on each position the watcher reports. |
|
|
47
|
+
|
|
48
|
+
### Common props
|
|
49
|
+
|
|
50
|
+
Every widget also accepts these shared props — see [common props](COMMON_PROPS.md) for the full rules and aliases.
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Description |
|
|
53
|
+
| --- | --- | --- |
|
|
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` | Overall size preset or pixel value, depending on the widget. |
|
|
57
|
+
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
58
|
+
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
59
|
+
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
60
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
61
|
+
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
62
|
+
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
63
|
+
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
64
|
+
| `shadow` | `string` | Raw CSS `box-shadow` value, for a custom shadow. |
|
|
65
|
+
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
66
|
+
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
67
|
+
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
68
|
+
| `onPress` | `(widget: Widget) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
69
|
+
| `onClick` | `(widget: Widget) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
70
|
+
| `id` | `string` | DOM `id` for the rendered element. |
|
|
71
|
+
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
72
|
+
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
73
|
+
| `disableTransform` | `boolean` | Disables the default press/scale transform animation. |
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
### Everyday
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
import { Maps, colors } from "flet-box";
|
|
81
|
+
|
|
82
|
+
const stops = Maps({
|
|
83
|
+
center: [40.4168, -3.7038],
|
|
84
|
+
zoom: 13,
|
|
85
|
+
height: 420,
|
|
86
|
+
markerColor: colors.primary,
|
|
87
|
+
polylineColor: colors.primary,
|
|
88
|
+
markers: [
|
|
89
|
+
{ position: [40.4168, -3.7038], label: "Sol" },
|
|
90
|
+
{ position: [40.4308, -3.693], label: "Chueca", color: "#0ea5e9" },
|
|
91
|
+
],
|
|
92
|
+
polylines: [
|
|
93
|
+
[[40.4168, -3.7038], [40.424, -3.698], [40.4308, -3.693]],
|
|
94
|
+
],
|
|
95
|
+
onMarkerClick: (marker) => pick(marker),
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Full
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import { Maps, colors } from "flet-box";
|
|
103
|
+
|
|
104
|
+
const picker = Maps({
|
|
105
|
+
center: [40.4168, -3.7038],
|
|
106
|
+
zoom: 14,
|
|
107
|
+
minZoom: 5,
|
|
108
|
+
maxZoom: 18,
|
|
109
|
+
height: 480,
|
|
110
|
+
borderRadius: 12,
|
|
111
|
+
tileUrl: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
112
|
+
attribution: "© OpenStreetMap contributors",
|
|
113
|
+
showAttribution: true,
|
|
114
|
+
showZoomControl: true,
|
|
115
|
+
interactive: true,
|
|
116
|
+
scrollZoom: true,
|
|
117
|
+
doubleClickZoom: true,
|
|
118
|
+
showUserLocation: true,
|
|
119
|
+
followUser: false,
|
|
120
|
+
markers: stops.map((stop) => ({ id: stop.id, position: stop.at, label: stop.name })),
|
|
121
|
+
polylines: [
|
|
122
|
+
{ id: "route", points: route.geometry, color: colors.primary, width: 5 },
|
|
123
|
+
{ id: "track", points: breadcrumbs, dashed: true, opacity: 0.7 },
|
|
124
|
+
],
|
|
125
|
+
onMapClick: (point) => setPicked(point),
|
|
126
|
+
onMarkerClick: (marker) => setPicked(marker.position),
|
|
127
|
+
onMoveEnd: (view) => saveView(view),
|
|
128
|
+
onUserUpdate: (fix) => breadcrumbs.push([fix.lat, fix.lng]),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
picker.fitBounds(route.geometry);
|
|
132
|
+
picker.addMarker({ position: [40.42, -3.7], label: "Dropped" });
|
|
133
|
+
picker.setMarker({ id: "taxi", position: [40.42, -3.7], rotation: 128, clickable: false });
|
|
134
|
+
picker.addPolyline({ id: "leg", points: [picked, stop.at] });
|
|
135
|
+
picker.locate();
|
|
136
|
+
picker.setFollowUser(true);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Tips
|
|
140
|
+
|
|
141
|
+
- The default tile server is OpenStreetMap and its credit line renders by default; when you change tileUrl, change attribution in the same breath.
|
|
142
|
+
- Match maxZoom to the provider. Asking level 20 from a server that stops at 18 shows the offline notice instead of a map.
|
|
143
|
+
- `locate()` takes `{ timeout, maximumAge, highAccuracy, setCenter, zoom }`. Desktop laptops can need more than the 10 s default for a first fix, and a slow fix (code 3) is not the same failure as a denied permission (code 1) — branch on `error.code` in the rejected handler instead of reporting one generic error.
|
|
144
|
+
- Give markers an id: the pin node is then reused across updates instead of rebuilt, which matters for a list that moves often.
|
|
145
|
+
- `setMarker({id, ...})` replaces the pin with that id instead of stacking another under it — that is the call to make on every GPS fix, and `addMarker()` is the one that grows the list forever. The reused node restates what it shows, so a new `label`, `color` or `rotation` reaches the screen, the tooltip and the accessibility name.
|
|
146
|
+
- `rotation` is degrees clockwise from north, the compass convention `onUserUpdate` reports as `fix.heading`. The pin turns around its own tip, so the point it marks never moves, and its caption stays upright to read.
|
|
147
|
+
- `clickable: false` makes a pin transparent to the pointer: the tap reaches `onMapClick` with the coordinate under it. A vehicle drawn at the centre of the view would otherwise cover that whole spot, and every attempt to pick a pick-up point would answer with the car.
|
|
148
|
+
- A polyline needs two usable points; `addPolyline()` returns null for one-point input rather than drawing a speck that looks like a broken route. Lines are stroked on a canvas above the tiles and below the pins, so a long route costs no DOM nodes — but it also means a line is not clickable; put an invisible marker on each stop you want tappable.
|
|
149
|
+
- `fitBounds(pointList)` frames a route in one call: pass the coordinates and it picks the zoom and centre. Feed it the geometry an OSRM or GraphHopper reply returns, and keep the distance and duration from that same reply for the readout.
|
|
150
|
+
- A track grows by re-passing `polylines` with the fixes collected so far, or by keeping one line with an id and calling `update()`. `onUserUpdate` is the source of those fixes: it fires for every watched position, following or not.
|
|
151
|
+
- `followUser` is a different promise from `showUserLocation`: it recentres the view on every fix and asks the browser for fresh high-accuracy ones, so it is the option that costs battery. Turn it off when the user pans away to look at something else.
|
|
152
|
+
- The widget defaults to 400 tall and full width. Any size you give it is fine — a ResizeObserver repaints the tiles when the box changes.
|
|
153
|
+
- Wheel zoom is one level per gesture and follows the cursor, so a long trackpad flick does not throw the view across the world.
|
|
154
|
+
|
|
155
|
+
## Accessibility
|
|
156
|
+
|
|
157
|
+
- The map is focusable and keyboard-driven: arrows pan, + and - zoom, and the ± buttons carry aria-labels.
|
|
158
|
+
- Each marker is a real button, so it is reachable with Tab and announced with its label.
|
|
159
|
+
- A map cannot be read by a screen reader, so keep the same places in a list next to it.
|
|
160
|
+
|
|
161
|
+
## Behavior
|
|
162
|
+
|
|
163
|
+
- Tiles are pooled per zoom level and the previous level is kept until the new one is on screen, so a zoom step never flashes an empty grid.
|
|
164
|
+
- onMoveEnd is debounced — it fires once the view settles, not on every pan frame.
|
|
165
|
+
- Lines are redrawn from their geographic points on every frame, so a polyline follows the pan and the zoom instead of being pinned to the screen. A line whose bounding box misses the viewport is skipped before any coordinate is projected.
|
|
166
|
+
- Whether a press was a drag is judged by how far the pointer ended up from the point it went down on, not by the length of the path it walked: a trembling finger keeps its click and never nudges the view.
|
|
167
|
+
- A press on a pin answers onMarkerClick only; the map never reports the same press twice.
|
|
168
|
+
- A press on the widget's own chrome — the ± buttons or the credit link — is not a click on the map underneath, so onMapClick reports only the bare map surface.
|
|
169
|
+
- Props bound with useState patch this widget alone — the map subscribes to the key and redraws without re-rendering the app.
|
|
170
|
+
- Nothing is fetched until the widget enters the DOM; unmount cancels the frame, the observer and the geolocation watch.
|
|
171
|
+
- When every visible tile fails, a notice appears over the map instead of a blank panel.
|
|
172
|
+
|
|
173
|
+
## Related widgets
|
|
174
|
+
|
|
175
|
+
- [Card](Card.md)
|
|
176
|
+
- [Button](Button.md)
|
|
177
|
+
- [ListView](ListView.md)
|
|
178
|
+
- [Image](Image.md)
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Continue reading
|
|
183
|
+
|
|
184
|
+
- **Previous:** [Video](Video.md)
|
|
185
|
+
- **Next:** [DraggBox](DraggBox.md)
|
|
186
|
+
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
187
|
+
|
|
188
|
+
You are reading **Chapter 7 · Media and drag & drop** (3 of 5).
|
package/docs/widget/Markdown.md
CHANGED
|
@@ -79,6 +79,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
79
79
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
80
80
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
81
81
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
82
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
82
83
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
83
84
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
84
85
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -41,6 +41,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
42
42
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
43
43
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
44
45
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
45
46
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
46
47
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -50,6 +50,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
50
50
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
51
51
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
52
52
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
53
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
53
54
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
54
55
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
55
56
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -45,6 +45,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
45
45
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
46
46
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
47
47
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
48
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
48
49
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
49
50
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
50
51
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -48,6 +48,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
48
48
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
49
49
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
50
50
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
51
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
51
52
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
52
53
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
53
54
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/QRCode.md
CHANGED
|
@@ -41,6 +41,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
42
42
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
43
43
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
44
45
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
45
46
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
46
47
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/README.md
CHANGED
|
@@ -102,21 +102,22 @@ _audio, video and drag-and-drop_
|
|
|
102
102
|
|
|
103
103
|
52. [Audio](Audio.md) — A thin wrapper around the native <audio> element with reliable duration detection, progress callbacks, and an imperative playback API
|
|
104
104
|
53. [Video](Video.md) — Renders a native <video> element with proper media attributes and a convenient playback API
|
|
105
|
-
54. [
|
|
106
|
-
55. [
|
|
105
|
+
54. [Maps](Maps.md) — An interactive map — pan, zoom, markers and polylines — with no map library behind it
|
|
106
|
+
55. [DraggBox](DraggBox.md) — Wraps a child so it can be dragged with the native drag-and-drop API
|
|
107
|
+
56. [DroppBox](DroppBox.md) — A drop target for DraggBox items
|
|
107
108
|
|
|
108
109
|
### Chapter 8 · App navigation
|
|
109
110
|
|
|
110
111
|
_Build the shell of a real application and wire it to the router._
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
57. [Scaffold](Scaffold.md) — the app shell: app bar, body, drawer, side bars
|
|
114
|
+
58. [AdaptiveScaffold](AdaptiveScaffold.md) — the same shell, adapted to phone and desktop
|
|
115
|
+
59. [AppBar](AppBar.md) — a top bar for titles, actions, and back navigation
|
|
116
|
+
60. [Drawer](Drawer.md) — a panel that slides in from the side
|
|
117
|
+
61. [DrawerItem](DrawerItem.md) — a router-aware row for a drawer or side bar
|
|
118
|
+
62. [BottomNavigation](BottomNavigation.md) — a bottom tab bar synced with the router
|
|
119
|
+
63. [Tabs](Tabs.md) — switch panes inside a screen
|
|
120
|
+
64. [CollapsibleSideBar](CollapsibleSideBar.md) — a side panel that collapses to icons
|
|
120
121
|
|
|
121
122
|
Then continue with [State, Router & Services](../guides/state.md) — Chapter 9.
|
|
122
123
|
|
|
@@ -163,6 +164,7 @@ Then continue with [State, Router & Services](../guides/state.md) — Chapter 9.
|
|
|
163
164
|
- [InstallButton](InstallButton.md)
|
|
164
165
|
- [ListTile](ListTile.md)
|
|
165
166
|
- [ListView](ListView.md)
|
|
167
|
+
- [Maps](Maps.md)
|
|
166
168
|
- [Markdown](Markdown.md)
|
|
167
169
|
- [MatrixRain](MatrixRain.md)
|
|
168
170
|
- [Modal](Modal.md)
|
package/docs/widget/Radio.md
CHANGED
|
@@ -44,6 +44,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
44
44
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
45
45
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
46
46
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
47
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
47
48
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
48
49
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
49
50
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Rating.md
CHANGED
|
@@ -50,6 +50,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
50
50
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
51
51
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
52
52
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
53
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
53
54
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
54
55
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
55
56
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Row.md
CHANGED
|
@@ -45,6 +45,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
45
45
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
46
46
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
47
47
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
48
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
48
49
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
49
50
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
50
51
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Skeleton.md
CHANGED
|
@@ -48,6 +48,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
48
48
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
49
49
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
50
50
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
51
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
51
52
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
52
53
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
53
54
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Slider.md
CHANGED
|
@@ -59,6 +59,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
59
59
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
60
60
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
61
61
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
62
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
62
63
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
63
64
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
64
65
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Stack.md
CHANGED
|
@@ -41,6 +41,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
42
42
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
43
43
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
44
45
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
45
46
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
46
47
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Stepper.md
CHANGED
|
@@ -58,6 +58,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
58
58
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
59
59
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
60
60
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
61
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
61
62
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
62
63
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
63
64
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Switch.md
CHANGED
|
@@ -41,6 +41,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
42
42
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
43
43
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
44
45
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
45
46
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
46
47
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Text.md
CHANGED
|
@@ -49,6 +49,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
49
49
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
50
50
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
51
51
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
52
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
52
53
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
53
54
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
54
55
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Tooltip.md
CHANGED
|
@@ -26,7 +26,8 @@ const tip = Tooltip({
|
|
|
26
26
|
| `text` | `string` | Visible text content. |
|
|
27
27
|
| `child` | `Widget` | A single child widget. Alias: `children` for a list. |
|
|
28
28
|
| `position` | `'top' \| 'bottom' \| 'left' \| 'right'` | CSS `position` value, or `stack` for centered stacking. |
|
|
29
|
-
| `delay` | `number` |
|
|
29
|
+
| `delay` | `number` | Milliseconds the pointer has to stay on the widget before the tooltip appears. |
|
|
30
|
+
| `tooltipDelay` | `number` | Deprecated alias of `delay`. |
|
|
30
31
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
31
32
|
| `textColor` | `Color` | Color of the button label. |
|
|
32
33
|
| `fontSize` | `number` | Size of the font. |
|
|
@@ -56,6 +57,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
56
57
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
57
58
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
58
59
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
60
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
59
61
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
60
62
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
61
63
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -109,24 +111,20 @@ const tip = Tooltip({
|
|
|
109
111
|
|
|
110
112
|
## Tips
|
|
111
113
|
|
|
112
|
-
- Attach it to any widget via child; the tooltip is a separate portal, so overflow
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
- for dense toolbars, raise it for error-prone hints.
|
|
116
|
-
- The bubble is clamped to the viewport edges, so top/left placements can sit slightly
|
|
117
|
-
- inside the window bounds.
|
|
114
|
+
- Attach it to any widget via child; the tooltip is a separate portal, so overflow hidden ancestors do not cut it off.
|
|
115
|
+
- delay controls how long the pointer must rest before the tooltip appears; lower it for dense toolbars, raise it for error-prone hints.
|
|
116
|
+
- The bubble is clamped to the viewport edges, so top/left placements can sit slightly inside the window bounds.
|
|
118
117
|
|
|
119
118
|
## Accessibility
|
|
120
119
|
|
|
121
|
-
- The wrapped child keeps its focus handlers, so keyboard users tabbing onto it get
|
|
122
|
-
- the same tooltip as mouse hover.
|
|
120
|
+
- The wrapped child keeps its focus handlers, so keyboard users tabbing onto it get the same tooltip as mouse hover.
|
|
123
121
|
|
|
124
122
|
## Behavior
|
|
125
123
|
|
|
126
|
-
- The tooltip hides itself on window scroll or resize and removes its body portal plus
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
124
|
+
- The tooltip hides itself on window scroll or resize and removes its body portal plus listeners on unmount.
|
|
125
|
+
- The wrapped child gains showTooltip, hideTooltip, updateContent, and updatePosition helpers for imperative control.
|
|
126
|
+
- A pointer that leaves before the wait is over never shows the bubble: leaving clears the timer.
|
|
127
|
+
- tooltipDelay is the old name of delay. When both are given, delay wins.
|
|
130
128
|
|
|
131
129
|
## Related widgets
|
|
132
130
|
|
package/docs/widget/TreeView.md
CHANGED
|
@@ -72,6 +72,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
72
72
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
73
73
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
74
74
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
75
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
75
76
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
76
77
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
77
78
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
package/docs/widget/Video.md
CHANGED
|
@@ -44,6 +44,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
44
44
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
45
45
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
46
46
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
47
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
47
48
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
48
49
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
49
50
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
@@ -121,7 +122,7 @@ const clip = Video({
|
|
|
121
122
|
## Continue reading
|
|
122
123
|
|
|
123
124
|
- **Previous:** [Audio](Audio.md)
|
|
124
|
-
- **Next:** [
|
|
125
|
+
- **Next:** [Maps](Maps.md)
|
|
125
126
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
126
127
|
|
|
127
|
-
You are reading **Chapter 7 · Media and drag & drop** (2 of
|
|
128
|
+
You are reading **Chapter 7 · Media and drag & drop** (2 of 5).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flet-box",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dev": "node bin/cli.js run --hot",
|
|
20
20
|
"build": "node bin/cli.js createBundle",
|
|
21
21
|
"release": "node bin/cli.js release",
|
|
22
|
-
"test": "node scripts/check-widgets.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && node scripts/check-api-surface.mjs && node scripts/check-router-base.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
22
|
+
"test": "node scripts/check-widgets.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && node scripts/check-api-surface.mjs && node scripts/check-router-base.mjs && node scripts/check-ota-assets.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
23
23
|
"test:browser": "node scripts/run-browser-tests.mjs"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|