flet-box 1.0.4 → 1.0.5
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 +10 -0
- package/bin/cli.js +15 -0
- package/bin/commands/checkApi.js +761 -0
- package/bin/commands/create.js +77 -5
- package/bin/utils/dtsProps.js +191 -0
- package/bin/utils/moduleExports.js +165 -0
- package/bin/utils/neutralise.js +64 -0
- package/bin/utils/templates.js +366 -27
- package/docs/CONTRIBUTING.md +156 -0
- package/docs/README.md +68 -0
- package/docs/arquitectura.md +164 -0
- package/docs/cli/README.md +542 -0
- package/docs/guides/README.md +33 -0
- package/docs/guides/app-templates.md +197 -0
- package/docs/guides/compatibility.md +95 -0
- package/docs/guides/embedding.md +284 -0
- package/docs/guides/first-app.md +208 -0
- package/docs/guides/frontend-services.md +171 -0
- package/docs/guides/minification-and-protection.md +260 -0
- package/docs/guides/mobile-and-platforms.md +439 -0
- package/docs/guides/online-updates.md +196 -0
- package/docs/guides/router.md +282 -0
- package/docs/guides/state.md +283 -0
- package/docs/guides/syntax-philosophy.md +150 -0
- package/docs/guides/utilities.md +241 -0
- package/docs/guides/widget-structure.md +163 -0
- package/docs/server/README.md +68 -0
- package/docs/server/START_HERE.md +121 -0
- package/docs/server/api.md +225 -0
- package/docs/server/data-services.md +300 -0
- package/docs/server/deployment.md +113 -0
- package/docs/server/security.md +196 -0
- package/docs/services/README.md +79 -0
- package/docs/services/RamStore.md +84 -0
- package/docs/services/Session.md +84 -0
- package/docs/services/Storage.md +88 -0
- package/docs/services/http.md +86 -0
- package/docs/tools/README.md +138 -0
- package/docs/tools/animation.md +87 -0
- package/docs/tools/async-ids-log.md +80 -0
- package/docs/tools/device.md +132 -0
- package/docs/tools/introspection.md +67 -0
- package/docs/tools/lists.md +96 -0
- package/docs/tools/markdown.md +79 -0
- package/docs/tools/reactivity.md +288 -0
- package/docs/tools/state.md +103 -0
- package/docs/tools/styling.md +92 -0
- package/docs/tools/text-and-time.md +89 -0
- package/docs/tools/theme.md +102 -0
- package/docs/tools/validation.md +75 -0
- package/docs/tools/visual-effects.md +84 -0
- package/docs/widget/Accordion.md +144 -0
- package/docs/widget/AdMob.md +144 -0
- package/docs/widget/AdSense.md +133 -0
- package/docs/widget/AdaptiveScaffold.md +105 -0
- package/docs/widget/AlertDialog.md +103 -0
- package/docs/widget/AnimatedBox.md +130 -0
- package/docs/widget/AnimatedText.md +123 -0
- package/docs/widget/AppBar.md +118 -0
- package/docs/widget/Audio.md +135 -0
- package/docs/widget/Avatar.md +119 -0
- package/docs/widget/Badge.md +128 -0
- package/docs/widget/BottomNavigation.md +116 -0
- package/docs/widget/BottomSheet.md +125 -0
- package/docs/widget/Button.md +137 -0
- package/docs/widget/COMMON_PROPS.md +150 -0
- package/docs/widget/Card.md +125 -0
- package/docs/widget/Carousel.md +151 -0
- package/docs/widget/Chart.md +151 -0
- package/docs/widget/Checkbox.md +118 -0
- package/docs/widget/Chip.md +126 -0
- package/docs/widget/CircularBar.md +168 -0
- package/docs/widget/CircularChart.md +164 -0
- package/docs/widget/CodeViewer.md +130 -0
- package/docs/widget/CollapsibleSideBar.md +112 -0
- package/docs/widget/Column.md +129 -0
- package/docs/widget/Container.md +136 -0
- package/docs/widget/DataTable.md +150 -0
- package/docs/widget/Divider.md +109 -0
- package/docs/widget/DraggBox.md +129 -0
- package/docs/widget/Drawer.md +135 -0
- package/docs/widget/DrawerItem.md +98 -0
- package/docs/widget/Dropdown.md +139 -0
- package/docs/widget/DroppBox.md +152 -0
- package/docs/widget/FloatingActionButton.md +120 -0
- package/docs/widget/GridView.md +140 -0
- package/docs/widget/Icon.md +117 -0
- package/docs/widget/Image.md +125 -0
- package/docs/widget/Input.md +151 -0
- package/docs/widget/Inspector.md +92 -0
- package/docs/widget/InstallButton.md +128 -0
- package/docs/widget/ListTile.md +132 -0
- package/docs/widget/ListView.md +138 -0
- package/docs/widget/Markdown.md +175 -0
- package/docs/widget/MatrixRain.md +122 -0
- package/docs/widget/Modal.md +129 -0
- package/docs/widget/Pagination.md +135 -0
- package/docs/widget/ParallaxBox.md +128 -0
- package/docs/widget/ProgressBar.md +130 -0
- package/docs/widget/QRCode.md +117 -0
- package/docs/widget/README.md +188 -0
- package/docs/widget/Radio.md +123 -0
- package/docs/widget/Rating.md +131 -0
- package/docs/widget/Row.md +131 -0
- package/docs/widget/START_HERE.md +146 -0
- package/docs/widget/Scaffold.md +152 -0
- package/docs/widget/Skeleton.md +130 -0
- package/docs/widget/Slider.md +146 -0
- package/docs/widget/SnackBar.md +102 -0
- package/docs/widget/Stack.md +128 -0
- package/docs/widget/Stepper.md +145 -0
- package/docs/widget/Switch.md +118 -0
- package/docs/widget/Tabs.md +124 -0
- package/docs/widget/Text.md +133 -0
- package/docs/widget/Tooltip.md +145 -0
- package/docs/widget/TreeView.md +176 -0
- package/docs/widget/Video.md +127 -0
- package/docs/widget/_template.md +61 -0
- package/package.json +3 -2
- package/src/animations/animate.js +180 -70
- package/src/animations/index.js +1 -0
- package/src/create-index.sh +1 -1
- package/src/index.d.ts +45 -22
- package/src/index.js +1 -0
- package/src/navigations/AdaptiveScaffold.js +11 -2
- package/src/navigations/BottomNavigation.js +10 -3
- package/src/navigations/Tabs.js +6 -2
- package/src/tools/useState.js +54 -63
- package/src/widget-factory/assignProps.js +23 -1
- package/src/widget-factory/processProps.js +10 -3
- package/src/widget-factory/reactiveValue.js +43 -18
- package/src/widget-factory/translateProps.js +777 -901
- package/src/widgets/AlertDialog.js +7 -5
- package/src/widgets/Checkbox.js +9 -7
- package/src/widgets/CircularBar.js +12 -1
- package/src/widgets/FloatingActionButton.js +4 -7
- package/src/widgets/Image.js +5 -7
- package/src/widgets/Input.js +92 -0
- package/src/widgets/ListView.js +73 -29
- package/src/widgets/Pagination.js +6 -3
- package/src/widgets/ProgressBar.js +16 -13
- package/src/widgets/Radio.js +6 -7
- package/src/widgets/Slider.js +23 -4
- package/src/widgets/Stack.js +36 -3
- package/src/widgets/Stepper.js +4 -3
- package/src/widgets/Switch.js +3 -4
- package/src/widgets/TreeView.js +0 -1
package/src/widgets/Slider.js
CHANGED
|
@@ -50,8 +50,8 @@ export const Slider = (props) => {
|
|
|
50
50
|
stripeColor = "rgba(255,255,255,0.25)",
|
|
51
51
|
glow = false,
|
|
52
52
|
// Events
|
|
53
|
+
/** @deprecated Alias of `onPress`. */
|
|
53
54
|
onChanged,
|
|
54
|
-
/** @deprecated Use onPress instead */
|
|
55
55
|
onPress: onPressProp,
|
|
56
56
|
onChangeEnd,
|
|
57
57
|
// Rest
|
|
@@ -77,6 +77,13 @@ export const Slider = (props) => {
|
|
|
77
77
|
typeof trackSizePx === "number" ? `${trackSizePx}px` : trackSizePx;
|
|
78
78
|
let thumbSizeNum = typeof thumbSize === "number" ? thumbSize : 20;
|
|
79
79
|
|
|
80
|
+
// Positioning retries while the track still measures 0 (hidden parent, not laid
|
|
81
|
+
// out yet). Both handles are tracked so unmounting can stop them: an untracked
|
|
82
|
+
// recursive rAF outlived the widget and re-armed itself every frame, forever.
|
|
83
|
+
let thumbRaf = 0;
|
|
84
|
+
let initTimer = 0;
|
|
85
|
+
let disposed = false;
|
|
86
|
+
|
|
80
87
|
injectKeyframes(
|
|
81
88
|
"slider-stripes",
|
|
82
89
|
"0% { background-position: 0 0; } 100% { background-position: 20px 0; }",
|
|
@@ -329,10 +336,16 @@ export const Slider = (props) => {
|
|
|
329
336
|
}
|
|
330
337
|
|
|
331
338
|
function updateThumbPosition() {
|
|
332
|
-
if (!track || !thumb) return;
|
|
339
|
+
if (disposed || !track || !thumb) return;
|
|
333
340
|
const trackRect = track.getBoundingClientRect();
|
|
334
341
|
if (trackRect.width === 0 && trackRect.height === 0) {
|
|
335
|
-
|
|
342
|
+
// Not measurable yet: wait one frame for layout, keeping a single pending
|
|
343
|
+
// frame instead of stacking one retry per caller.
|
|
344
|
+
if (thumbRaf) cancelAnimationFrame(thumbRaf);
|
|
345
|
+
thumbRaf = requestAnimationFrame(() => {
|
|
346
|
+
thumbRaf = 0;
|
|
347
|
+
updateThumbPosition();
|
|
348
|
+
});
|
|
336
349
|
return;
|
|
337
350
|
}
|
|
338
351
|
if (isHorizontal) {
|
|
@@ -506,6 +519,9 @@ export const Slider = (props) => {
|
|
|
506
519
|
|
|
507
520
|
// ---------- Cleanup ----------
|
|
508
521
|
const cleanup = () => {
|
|
522
|
+
disposed = true;
|
|
523
|
+
if (thumbRaf) cancelAnimationFrame(thumbRaf);
|
|
524
|
+
if (initTimer) clearTimeout(initTimer);
|
|
509
525
|
if (resizeObserver) {
|
|
510
526
|
resizeObserver.disconnect();
|
|
511
527
|
} else {
|
|
@@ -523,7 +539,10 @@ export const Slider = (props) => {
|
|
|
523
539
|
container.onUnmount(cleanup);
|
|
524
540
|
|
|
525
541
|
// Initialize position
|
|
526
|
-
setTimeout(() =>
|
|
542
|
+
initTimer = setTimeout(() => {
|
|
543
|
+
initTimer = 0;
|
|
544
|
+
updateThumbPosition();
|
|
545
|
+
}, 0);
|
|
527
546
|
return container;
|
|
528
547
|
};
|
|
529
548
|
|
package/src/widgets/Stack.js
CHANGED
|
@@ -1,27 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Stack.js
|
|
3
3
|
* @description Positioning container for overlaying children (relative by default,
|
|
4
|
-
* use `position: "stack"` for absolute centering).
|
|
4
|
+
* use `position: "stack"` for absolute centering). Supports a nine-point
|
|
5
|
+
* `alignment` that anchors its children inside the box.
|
|
5
6
|
*/
|
|
6
7
|
import { WidgetFactory } from "../widget-factory/index.js";
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Nine-point grid → [vertical anchor, horizontal anchor].
|
|
11
|
+
* `alignment` turns the stack into a column flex container, so `justifyContent`
|
|
12
|
+
* carries the top/center/bottom anchor and `alignItems` the left/center/right one.
|
|
13
|
+
*/
|
|
14
|
+
const ALIGNMENTS = {
|
|
15
|
+
"top-left": ["flex-start", "flex-start"],
|
|
16
|
+
"top-center": ["flex-start", "center"],
|
|
17
|
+
"top-right": ["flex-start", "flex-end"],
|
|
18
|
+
"center-left": ["center", "flex-start"],
|
|
19
|
+
center: ["center", "center"],
|
|
20
|
+
"center-right": ["center", "flex-end"],
|
|
21
|
+
"bottom-left": ["flex-end", "flex-start"],
|
|
22
|
+
"bottom-center": ["flex-end", "center"],
|
|
23
|
+
"bottom-right": ["flex-end", "flex-end"],
|
|
24
|
+
};
|
|
25
|
+
|
|
8
26
|
export const Stack = (props = {}) => {
|
|
9
27
|
const {
|
|
10
28
|
// Default layout
|
|
11
29
|
position = "relative",
|
|
12
|
-
display
|
|
30
|
+
display,
|
|
13
31
|
boxSizing = "border-box",
|
|
14
32
|
|
|
33
|
+
// Nine-point anchor for the children
|
|
34
|
+
alignment,
|
|
35
|
+
|
|
15
36
|
// Everything else
|
|
16
37
|
...rest
|
|
17
38
|
} = props;
|
|
18
39
|
|
|
40
|
+
const preset = alignment ? ALIGNMENTS[alignment] : undefined;
|
|
41
|
+
|
|
42
|
+
// The preset sits before `...rest`, so an explicit `flexDirection`,
|
|
43
|
+
// `justifyContent` or `alignItems` from the caller always overrides it;
|
|
44
|
+
// `alignment` only fills the axes nobody claimed.
|
|
19
45
|
return WidgetFactory({
|
|
20
46
|
tag: "div",
|
|
21
47
|
widgetName: "Stack",
|
|
22
48
|
position: position,
|
|
23
|
-
display: display,
|
|
49
|
+
display: display ?? (preset ? "flex" : "block"),
|
|
24
50
|
boxSizing: boxSizing,
|
|
51
|
+
...(preset
|
|
52
|
+
? {
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
justifyContent: preset[0],
|
|
55
|
+
alignItems: preset[1],
|
|
56
|
+
}
|
|
57
|
+
: null),
|
|
25
58
|
...rest,
|
|
26
59
|
});
|
|
27
60
|
};
|
package/src/widgets/Stepper.js
CHANGED
|
@@ -274,12 +274,13 @@ export const Stepper = (props) => {
|
|
|
274
274
|
overflow: "auto",
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
-
// Navigation container
|
|
278
|
-
|
|
277
|
+
// Navigation container — only built when the stepper is allowed to drive itself.
|
|
278
|
+
// `updateUI()` below skips the whole nav branch while `navContainer` is null.
|
|
279
|
+
navContainer = showNavigation ? Container({ width: "100%" }) : null;
|
|
279
280
|
|
|
280
281
|
container.appendChild(stepsWrapper);
|
|
281
282
|
container.appendChild(contentContainer);
|
|
282
|
-
container.appendChild(navContainer);
|
|
283
|
+
if (navContainer) container.appendChild(navContainer);
|
|
283
284
|
|
|
284
285
|
// Initial render
|
|
285
286
|
updateUI();
|
package/src/widgets/Switch.js
CHANGED
|
@@ -12,6 +12,7 @@ export const Switch = (props) => {
|
|
|
12
12
|
onPress: onPressProp,
|
|
13
13
|
disabled = false,
|
|
14
14
|
size = "medium",
|
|
15
|
+
activeColor = colors.success,
|
|
15
16
|
...rest
|
|
16
17
|
} = props;
|
|
17
18
|
|
|
@@ -33,9 +34,7 @@ export const Switch = (props) => {
|
|
|
33
34
|
|
|
34
35
|
const updateUI = (newValue) => {
|
|
35
36
|
if (switchRef) {
|
|
36
|
-
switchRef.style.backgroundColor = newValue
|
|
37
|
-
? colors.success
|
|
38
|
-
: colors.gray300;
|
|
37
|
+
switchRef.style.backgroundColor = newValue ? activeColor : colors.gray300;
|
|
39
38
|
}
|
|
40
39
|
if (knobRef) {
|
|
41
40
|
knobRef.style.transform = newValue
|
|
@@ -63,7 +62,7 @@ export const Switch = (props) => {
|
|
|
63
62
|
widgetName: "Switch",
|
|
64
63
|
width: sz.width,
|
|
65
64
|
height: sz.height,
|
|
66
|
-
backgroundColor: internalValue ?
|
|
65
|
+
backgroundColor: internalValue ? activeColor : colors.gray300,
|
|
67
66
|
borderRadius: sz.height / 2,
|
|
68
67
|
display: "flex",
|
|
69
68
|
alignItems: "center",
|
package/src/widgets/TreeView.js
CHANGED
|
@@ -104,7 +104,6 @@ export const TreeView = (props) => {
|
|
|
104
104
|
typeof borderRadius === "number" ? `${borderRadius}px` : borderRadius,
|
|
105
105
|
marginLeft: `${level * indent}px`,
|
|
106
106
|
transition: `background-color ${transitionDuration} ease`,
|
|
107
|
-
hoverBackgroundColor: hoverBgColor,
|
|
108
107
|
});
|
|
109
108
|
|
|
110
109
|
// Add hover effect
|