flet-box 1.0.7 → 1.0.8
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/bin/cli.js +13 -0
- package/bin/commands/checkApi.js +13 -1
- package/bin/commands/checkUi.js +1369 -0
- package/bin/commands/create.js +49 -5
- package/bin/commands/createBundle.js +21 -0
- package/bin/commands/runServer.js +11 -2
- package/bin/utils/pwaShell.js +137 -0
- package/bin/utils/templates.js +1373 -434
- package/docs/README.md +2 -0
- package/docs/cli/README.md +62 -1
- package/docs/guides/README.md +2 -0
- package/docs/guides/clean-ui.md +211 -0
- package/docs/guides/minification-and-protection.md +1 -1
- package/docs/guides/online-updates.md +48 -0
- package/docs/tools/README.md +1 -1
- package/docs/tools/animation.md +1 -1
- package/docs/tools/markdown.md +3 -3
- package/docs/tools/theme.md +41 -1
- package/docs/widget/Accordion.md +3 -0
- package/docs/widget/AdMob.md +4 -1
- package/docs/widget/AdSense.md +3 -0
- package/docs/widget/AnimatedBox.md +6 -3
- package/docs/widget/AnimatedText.md +3 -0
- package/docs/widget/Audio.md +3 -0
- package/docs/widget/Avatar.md +3 -0
- package/docs/widget/Badge.md +3 -0
- package/docs/widget/Button.md +3 -0
- package/docs/widget/COMMON_PROPS.md +52 -0
- package/docs/widget/Card.md +3 -0
- package/docs/widget/Carousel.md +3 -0
- package/docs/widget/Chart.md +3 -0
- package/docs/widget/Checkbox.md +3 -0
- package/docs/widget/Chip.md +3 -0
- package/docs/widget/CircularBar.md +3 -0
- package/docs/widget/CircularChart.md +3 -0
- package/docs/widget/CodeViewer.md +3 -0
- package/docs/widget/Column.md +3 -0
- package/docs/widget/Container.md +3 -0
- package/docs/widget/DataTable.md +3 -0
- package/docs/widget/Divider.md +3 -0
- package/docs/widget/DraggBox.md +3 -0
- package/docs/widget/Dropdown.md +3 -0
- package/docs/widget/DroppBox.md +3 -0
- package/docs/widget/FloatingActionButton.md +3 -0
- package/docs/widget/GridView.md +3 -0
- package/docs/widget/Icon.md +3 -0
- package/docs/widget/Image.md +3 -0
- package/docs/widget/Input.md +3 -0
- package/docs/widget/Inspector.md +2 -2
- package/docs/widget/InstallButton.md +3 -0
- package/docs/widget/ListTile.md +3 -0
- package/docs/widget/ListView.md +3 -0
- package/docs/widget/Maps.md +3 -0
- package/docs/widget/Markdown.md +3 -0
- package/docs/widget/MatrixRain.md +3 -0
- package/docs/widget/Pagination.md +3 -0
- package/docs/widget/ParallaxBox.md +3 -0
- package/docs/widget/ProgressBar.md +3 -0
- package/docs/widget/QRCode.md +3 -0
- package/docs/widget/Radio.md +4 -1
- package/docs/widget/Rating.md +3 -0
- package/docs/widget/Row.md +3 -0
- package/docs/widget/Skeleton.md +3 -0
- package/docs/widget/Slider.md +3 -0
- package/docs/widget/Stack.md +3 -0
- package/docs/widget/Stepper.md +3 -0
- package/docs/widget/Switch.md +3 -0
- package/docs/widget/Tabs.md +5 -5
- package/docs/widget/Text.md +3 -0
- package/docs/widget/Tooltip.md +3 -0
- package/docs/widget/TreeView.md +3 -0
- package/docs/widget/Video.md +3 -0
- package/package.json +2 -2
- package/src/animations/AnimatedBox.js +4 -1
- package/src/animations/MatrixRain.js +3 -3
- package/src/index.d.ts +64 -8
- package/src/index.js +1 -0
- package/src/navigations/AppBar.js +7 -12
- package/src/navigations/BottomNavigation.js +8 -13
- package/src/navigations/CollapsibleSideBar.js +30 -8
- package/src/navigations/Drawer.js +16 -14
- package/src/navigations/DrawerItem.js +3 -1
- package/src/navigations/Scaffold.js +26 -12
- package/src/navigations/Tabs.js +104 -59
- package/src/tools/color.js +54 -0
- package/src/tools/index.js +9 -1
- package/src/tools/scale.js +41 -0
- package/src/tools/shadow.js +20 -0
- package/src/utils/index.js +1 -0
- package/src/utils/readableInk.js +19 -0
- package/src/utils/syntaxHighlight.js +78 -10
- package/src/utils/themes.js +217 -54
- package/src/utils/units.js +33 -11
- package/src/widget-factory/effects.js +56 -5
- package/src/widget-factory/processProps.js +10 -1
- package/src/widget-factory/remTool.js +15 -29
- package/src/widget-factory/stackPosition.js +18 -3
- package/src/widget-factory/translateProps.js +28 -0
- package/src/widgets/Accordion.js +20 -23
- package/src/widgets/AdMob.js +7 -2
- package/src/widgets/Avatar.js +18 -12
- package/src/widgets/Badge.js +3 -2
- package/src/widgets/BottomSheet.js +14 -13
- package/src/widgets/Button.js +69 -30
- package/src/widgets/Card.js +6 -2
- package/src/widgets/Carousel.js +12 -10
- package/src/widgets/Chart.js +28 -5
- package/src/widgets/Checkbox.js +76 -18
- package/src/widgets/Chip.js +31 -10
- package/src/widgets/CircularBar.js +7 -7
- package/src/widgets/CircularChart.js +26 -8
- package/src/widgets/CodeViewer.js +93 -20
- package/src/widgets/DataTable.js +17 -11
- package/src/widgets/DraggBox.js +2 -1
- package/src/widgets/Dropdown.js +26 -13
- package/src/widgets/DroppBox.js +4 -2
- package/src/widgets/FloatingActionButton.js +13 -7
- package/src/widgets/Icon.js +3 -1
- package/src/widgets/Input.js +30 -23
- package/src/widgets/Inspector.js +54 -1
- package/src/widgets/InstallButton.js +6 -4
- package/src/widgets/ListTile.js +4 -3
- package/src/widgets/ListView.js +30 -12
- package/src/widgets/Markdown.js +37 -26
- package/src/widgets/Modal.js +14 -11
- package/src/widgets/Pagination.js +16 -11
- package/src/widgets/ProgressBar.js +6 -4
- package/src/widgets/Radio.js +73 -15
- package/src/widgets/Rating.js +24 -6
- package/src/widgets/Skeleton.js +31 -31
- package/src/widgets/Slider.js +29 -18
- package/src/widgets/SnackBar.js +35 -39
- package/src/widgets/Stepper.js +13 -9
- package/src/widgets/Switch.js +59 -18
- package/src/widgets/Tooltip.js +12 -10
- package/src/widgets/TreeView.js +27 -15
package/src/widgets/Tooltip.js
CHANGED
|
@@ -6,6 +6,8 @@ import { WidgetFactory } from "../widget-factory/index.js";
|
|
|
6
6
|
import { resolveReactive } from "../widget-factory/reactiveValue.js";
|
|
7
7
|
import { colors } from "../utils/themes.js";
|
|
8
8
|
|
|
9
|
+
import { toREM } from "../utils/units.js";
|
|
10
|
+
|
|
9
11
|
export const Tooltip = (props) => {
|
|
10
12
|
let {
|
|
11
13
|
text,
|
|
@@ -18,10 +20,10 @@ export const Tooltip = (props) => {
|
|
|
18
20
|
/** @deprecated Use `delay` instead. */
|
|
19
21
|
tooltipDelay = null,
|
|
20
22
|
bgColor = colors.secondary,
|
|
21
|
-
textColor =
|
|
23
|
+
textColor = colors.onSecondary,
|
|
22
24
|
fontSize = 12,
|
|
23
|
-
padding =
|
|
24
|
-
borderRadius =
|
|
25
|
+
padding = `${toREM(4)} ${toREM(8)}`,
|
|
26
|
+
borderRadius = 4,
|
|
25
27
|
offset = 8,
|
|
26
28
|
showArrow = true,
|
|
27
29
|
disabled = false,
|
|
@@ -66,16 +68,16 @@ export const Tooltip = (props) => {
|
|
|
66
68
|
widgetName: "Tooltip",
|
|
67
69
|
backgroundColor: bgColor,
|
|
68
70
|
borderRadius:
|
|
69
|
-
|
|
71
|
+
toREM(borderRadius),
|
|
70
72
|
padding: padding,
|
|
71
|
-
maxWidth:
|
|
73
|
+
maxWidth: toREM(maxWidth),
|
|
72
74
|
boxShadow: shadow,
|
|
73
75
|
border:
|
|
74
76
|
borderWidth > 0 ? `${borderWidth}px solid ${borderColor}` : "none",
|
|
75
77
|
child: WidgetFactory({
|
|
76
78
|
tag: "span",
|
|
77
79
|
text: text, // ✅ "text" is the correct prop in FletBox
|
|
78
|
-
fontSize:
|
|
80
|
+
fontSize: toREM(fontSize),
|
|
79
81
|
color: textColor,
|
|
80
82
|
textAlign: textAlign,
|
|
81
83
|
display: "block",
|
|
@@ -129,7 +131,7 @@ export const Tooltip = (props) => {
|
|
|
129
131
|
if (tooltipElement._arrow) {
|
|
130
132
|
arrowTop = tooltipRect.height;
|
|
131
133
|
arrowLeft = tooltipRect.width / 2 - arrowSize;
|
|
132
|
-
tooltipElement._arrow.style.borderWidth = `${arrowSize}
|
|
134
|
+
tooltipElement._arrow.style.borderWidth = `${toREM(arrowSize)} ${toREM(arrowSize)} 0 ${toREM(arrowSize)}`;
|
|
133
135
|
tooltipElement._arrow.style.borderColor = `${bgColor} transparent transparent transparent`;
|
|
134
136
|
tooltipElement._arrow.style.top = `${arrowTop}px`;
|
|
135
137
|
tooltipElement._arrow.style.left = `${arrowLeft}px`;
|
|
@@ -141,7 +143,7 @@ export const Tooltip = (props) => {
|
|
|
141
143
|
if (tooltipElement._arrow) {
|
|
142
144
|
arrowTop = -arrowSize;
|
|
143
145
|
arrowLeft = tooltipRect.width / 2 - arrowSize;
|
|
144
|
-
tooltipElement._arrow.style.borderWidth = `0 ${arrowSize}
|
|
146
|
+
tooltipElement._arrow.style.borderWidth = `0 ${toREM(arrowSize)} ${toREM(arrowSize)} ${toREM(arrowSize)}`;
|
|
145
147
|
tooltipElement._arrow.style.borderColor = `transparent transparent ${bgColor} transparent`;
|
|
146
148
|
tooltipElement._arrow.style.top = `${arrowTop}px`;
|
|
147
149
|
tooltipElement._arrow.style.left = `${arrowLeft}px`;
|
|
@@ -153,7 +155,7 @@ export const Tooltip = (props) => {
|
|
|
153
155
|
if (tooltipElement._arrow) {
|
|
154
156
|
arrowTop = tooltipRect.height / 2 - arrowSize;
|
|
155
157
|
arrowLeft = tooltipRect.width;
|
|
156
|
-
tooltipElement._arrow.style.borderWidth = `${arrowSize}
|
|
158
|
+
tooltipElement._arrow.style.borderWidth = `${toREM(arrowSize)} 0 ${toREM(arrowSize)} ${toREM(arrowSize)}`;
|
|
157
159
|
tooltipElement._arrow.style.borderColor = `transparent transparent transparent ${bgColor}`;
|
|
158
160
|
tooltipElement._arrow.style.top = `${arrowTop}px`;
|
|
159
161
|
tooltipElement._arrow.style.left = `${arrowLeft}px`;
|
|
@@ -165,7 +167,7 @@ export const Tooltip = (props) => {
|
|
|
165
167
|
if (tooltipElement._arrow) {
|
|
166
168
|
arrowTop = tooltipRect.height / 2 - arrowSize;
|
|
167
169
|
arrowLeft = -arrowSize;
|
|
168
|
-
tooltipElement._arrow.style.borderWidth = `${arrowSize}
|
|
170
|
+
tooltipElement._arrow.style.borderWidth = `${toREM(arrowSize)} ${toREM(arrowSize)} ${toREM(arrowSize)} 0`;
|
|
169
171
|
tooltipElement._arrow.style.borderColor = `transparent ${bgColor} transparent transparent`;
|
|
170
172
|
tooltipElement._arrow.style.top = `${arrowTop}px`;
|
|
171
173
|
tooltipElement._arrow.style.left = `${arrowLeft}px`;
|
package/src/widgets/TreeView.js
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { WidgetFactory } from "../widget-factory/index.js";
|
|
6
6
|
import { colors } from "../utils/themes.js";
|
|
7
7
|
|
|
8
|
+
import { toREM } from "../utils/units.js";
|
|
9
|
+
import { TAP_MINIMUM } from "../tools/index.js";
|
|
10
|
+
|
|
8
11
|
export const TreeView = (props) => {
|
|
9
12
|
const {
|
|
10
13
|
nodes = [],
|
|
@@ -13,7 +16,7 @@ export const TreeView = (props) => {
|
|
|
13
16
|
/** @deprecated Use onPress instead */
|
|
14
17
|
onPress: onPressProp,
|
|
15
18
|
expandedNodes = [],
|
|
16
|
-
indent =
|
|
19
|
+
indent = 16,
|
|
17
20
|
showIcons = true,
|
|
18
21
|
folderIcon = "folder",
|
|
19
22
|
folderOpenIcon = "folder_open",
|
|
@@ -31,14 +34,17 @@ export const TreeView = (props) => {
|
|
|
31
34
|
textColor = colors.text,
|
|
32
35
|
selectedTextColor = colors.primary,
|
|
33
36
|
iconColor = colors.textSecondary,
|
|
34
|
-
|
|
37
|
+
// Folders carry the brand tone, the same accent as the selected row. They
|
|
38
|
+
// used to default to `colors.warning`, which made a neutral folder the only
|
|
39
|
+
// alarm-coloured element in an otherwise grey tree.
|
|
40
|
+
folderIconColor = colors.primary,
|
|
35
41
|
borderColor = colors.border,
|
|
36
42
|
|
|
37
43
|
// Spacing props
|
|
38
|
-
nodePadding =
|
|
44
|
+
nodePadding = `${toREM(8)} ${toREM(12)}`,
|
|
39
45
|
nodeGap = 4,
|
|
40
|
-
childrenGap =
|
|
41
|
-
borderRadius =
|
|
46
|
+
childrenGap = 4,
|
|
47
|
+
borderRadius = 4,
|
|
42
48
|
|
|
43
49
|
// Font props
|
|
44
50
|
fontSize = 14,
|
|
@@ -96,13 +102,17 @@ export const TreeView = (props) => {
|
|
|
96
102
|
tag: "div",
|
|
97
103
|
display: "flex",
|
|
98
104
|
alignItems: "center",
|
|
99
|
-
gap:
|
|
105
|
+
gap: toREM(nodeGap),
|
|
100
106
|
cursor: selectable ? "pointer" : "default",
|
|
101
107
|
backgroundColor: isSelected ? selectedBgColor : bgColor,
|
|
102
108
|
padding: nodePadding,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
// A raw factory div is content-box, so without this the 40px touch
|
|
110
|
+
// target was added on top of the 8px vertical padding and every row
|
|
111
|
+
// measured 56px, spreading the tree far more than its 8px rhythm.
|
|
112
|
+
boxSizing: "border-box",
|
|
113
|
+
...(selectable ? { minHeight: TAP_MINIMUM } : {}),
|
|
114
|
+
borderRadius: toREM(borderRadius),
|
|
115
|
+
marginLeft: toREM(level * indent),
|
|
106
116
|
transition: `background-color ${transitionDuration} ease`,
|
|
107
117
|
});
|
|
108
118
|
|
|
@@ -144,7 +154,7 @@ export const TreeView = (props) => {
|
|
|
144
154
|
child: WidgetFactory({
|
|
145
155
|
tag: "span",
|
|
146
156
|
className: "material-icons",
|
|
147
|
-
fontSize:
|
|
157
|
+
fontSize: toREM(iconSize),
|
|
148
158
|
color: iconColor,
|
|
149
159
|
textContent: isExpanded ? collapseIcon : expandIcon,
|
|
150
160
|
}),
|
|
@@ -184,7 +194,7 @@ export const TreeView = (props) => {
|
|
|
184
194
|
const iconSpan = WidgetFactory({
|
|
185
195
|
tag: "span",
|
|
186
196
|
className: "material-icons",
|
|
187
|
-
fontSize:
|
|
197
|
+
fontSize: toREM(iconSize + 2),
|
|
188
198
|
color: node.iconColor || (hasChildren ? folderIconColor : iconColor),
|
|
189
199
|
textContent: iconName,
|
|
190
200
|
});
|
|
@@ -195,7 +205,7 @@ export const TreeView = (props) => {
|
|
|
195
205
|
const labelSpan = WidgetFactory({
|
|
196
206
|
tag: "span",
|
|
197
207
|
flex: 1,
|
|
198
|
-
fontSize:
|
|
208
|
+
fontSize: toREM(fontSize),
|
|
199
209
|
fontWeight: isSelected ? "bold" : "normal",
|
|
200
210
|
color: isSelected ? selectedTextColor : textColor,
|
|
201
211
|
textContent: node.label,
|
|
@@ -206,7 +216,9 @@ export const TreeView = (props) => {
|
|
|
206
216
|
if (node.badge) {
|
|
207
217
|
const badge = WidgetFactory({
|
|
208
218
|
tag: "div",
|
|
209
|
-
|
|
219
|
+
// `danger` is the signal tone; the plate is the fill white words can
|
|
220
|
+
// actually sit on (6.47:1 in the light theme, 10.02:1 in the dark one).
|
|
221
|
+
backgroundColor: colors.dangerPlate,
|
|
210
222
|
borderRadius: "12px",
|
|
211
223
|
padding: "2px 8px",
|
|
212
224
|
child: WidgetFactory({
|
|
@@ -228,7 +240,7 @@ export const TreeView = (props) => {
|
|
|
228
240
|
tag: "div",
|
|
229
241
|
display: "flex",
|
|
230
242
|
flexDirection: "column",
|
|
231
|
-
gap:
|
|
243
|
+
gap: toREM(childrenGap),
|
|
232
244
|
});
|
|
233
245
|
|
|
234
246
|
node.children.forEach((child) => {
|
|
@@ -254,7 +266,7 @@ export const TreeView = (props) => {
|
|
|
254
266
|
tag: "div",
|
|
255
267
|
display: "flex",
|
|
256
268
|
flexDirection: "column",
|
|
257
|
-
gap:
|
|
269
|
+
gap: toREM(childrenGap),
|
|
258
270
|
});
|
|
259
271
|
|
|
260
272
|
nodes.forEach((node) => {
|