flet-box 0.0.0-stage → 1.0.2

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.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -2
  3. package/bin/cli.js +394 -0
  4. package/bin/commands/buildAndroid.js +200 -0
  5. package/bin/commands/buildIOS.js +237 -0
  6. package/bin/commands/create.js +406 -0
  7. package/bin/commands/createBundle.js +375 -0
  8. package/bin/commands/createComponent.js +115 -0
  9. package/bin/commands/createScreen.js +161 -0
  10. package/bin/commands/killServer.js +107 -0
  11. package/bin/commands/package.js +131 -0
  12. package/bin/commands/release.js +189 -0
  13. package/bin/commands/runBundle.js +62 -0
  14. package/bin/commands/runCloudflare.js +89 -0
  15. package/bin/commands/runNative.js +109 -0
  16. package/bin/commands/runServer.js +390 -0
  17. package/bin/ota/loader.js +361 -0
  18. package/bin/utils/bundleConfig.js +178 -0
  19. package/bin/utils/capacitor.js +137 -0
  20. package/bin/utils/colors.js +215 -0
  21. package/bin/utils/helpers.js +80 -0
  22. package/bin/utils/spinner.js +96 -0
  23. package/bin/utils/templates.js +1824 -0
  24. package/bin/utils/version.js +108 -0
  25. package/package.json +58 -4
  26. package/src/animations/AnimatedBox.js +607 -0
  27. package/src/animations/AnimatedText.js +105 -0
  28. package/src/animations/MatrixRain.js +220 -0
  29. package/src/animations/ParallaxBox.js +369 -0
  30. package/src/animations/animate.js +332 -0
  31. package/src/animations/index.js +25 -0
  32. package/src/app.js +41 -0
  33. package/src/assets/icon-1024-maskable.png +0 -0
  34. package/src/assets/icon-192-maskable.png +0 -0
  35. package/src/assets/icon-192.png +0 -0
  36. package/src/assets/icon-512-maskable.png +0 -0
  37. package/src/assets/icon-512.png +0 -0
  38. package/src/assets/logo.png +0 -0
  39. package/src/core/App.js +44 -0
  40. package/src/core/hmr-client.js +142 -0
  41. package/src/core/index.js +34 -0
  42. package/src/core/pwa.js +100 -0
  43. package/src/core/runApp.js +430 -0
  44. package/src/create-index.sh +237 -0
  45. package/src/fonts/MaterialIcons-Regular.woff2 +0 -0
  46. package/src/fonts/icons.css +23 -0
  47. package/src/index.d.ts +1930 -0
  48. package/src/index.js +288 -0
  49. package/src/navigations/AdaptiveScaffold.js +149 -0
  50. package/src/navigations/AppBar.js +331 -0
  51. package/src/navigations/BottomNavigation.js +298 -0
  52. package/src/navigations/CollapsibleSideBar.js +139 -0
  53. package/src/navigations/Drawer.js +333 -0
  54. package/src/navigations/DrawerItem.js +260 -0
  55. package/src/navigations/Router.js +475 -0
  56. package/src/navigations/Scaffold.js +537 -0
  57. package/src/navigations/Tabs.js +384 -0
  58. package/src/navigations/index.js +57 -0
  59. package/src/services/RamStore.js +213 -0
  60. package/src/services/Session.js +310 -0
  61. package/src/services/Storage.js +309 -0
  62. package/src/services/http.js +350 -0
  63. package/src/services/index.js +57 -0
  64. package/src/tools/animation.js +42 -0
  65. package/src/tools/array.js +95 -0
  66. package/src/tools/border.js +28 -0
  67. package/src/tools/clipboard.js +104 -0
  68. package/src/tools/color.js +329 -0
  69. package/src/tools/createList.js +215 -0
  70. package/src/tools/delay.js +55 -0
  71. package/src/tools/device.js +138 -0
  72. package/src/tools/dict.js +297 -0
  73. package/src/tools/dimensions.js +118 -0
  74. package/src/tools/filter.js +41 -0
  75. package/src/tools/flex.js +26 -0
  76. package/src/tools/gradient.js +34 -0
  77. package/src/tools/grid.js +57 -0
  78. package/src/tools/index.js +38 -0
  79. package/src/tools/mapList.js +107 -0
  80. package/src/tools/margin.js +93 -0
  81. package/src/tools/memo.js +60 -0
  82. package/src/tools/os.js +104 -0
  83. package/src/tools/padding.js +93 -0
  84. package/src/tools/print.js +69 -0
  85. package/src/tools/random.js +299 -0
  86. package/src/tools/ref.js +70 -0
  87. package/src/tools/rgba.js +4 -0
  88. package/src/tools/shadow.js +23 -0
  89. package/src/tools/string.js +85 -0
  90. package/src/tools/time.js +674 -0
  91. package/src/tools/transform.js +68 -0
  92. package/src/tools/transition.js +48 -0
  93. package/src/tools/useState.js +268 -0
  94. package/src/tools/uuid.js +42 -0
  95. package/src/utils/TextInputValidator.js +256 -0
  96. package/src/utils/composeUpdate.js +65 -0
  97. package/src/utils/getWidgetProps.js +35 -0
  98. package/src/utils/index.js +76 -0
  99. package/src/utils/markdownParser.js +368 -0
  100. package/src/utils/mediaTime.js +79 -0
  101. package/src/utils/navigation.js +263 -0
  102. package/src/utils/scriptInjector.js +73 -0
  103. package/src/utils/stackPosition.js +31 -0
  104. package/src/utils/stopWebRefresh.js +77 -0
  105. package/src/utils/styleInjector.js +38 -0
  106. package/src/utils/syntaxHighlight.js +339 -0
  107. package/src/utils/themes.js +347 -0
  108. package/src/utils/units.js +87 -0
  109. package/src/utils/visualEffects.js +169 -0
  110. package/src/widget-factory/addChildren.js +114 -0
  111. package/src/widget-factory/assignProps.js +256 -0
  112. package/src/widget-factory/createWidget.js +28 -0
  113. package/src/widget-factory/effects.js +132 -0
  114. package/src/widget-factory/index.js +7 -0
  115. package/src/widget-factory/lifecycle.js +210 -0
  116. package/src/widget-factory/makeParentable.js +89 -0
  117. package/src/widget-factory/pixTool.js +40 -0
  118. package/src/widget-factory/processProps.js +122 -0
  119. package/src/widget-factory/reactivity.js +98 -0
  120. package/src/widget-factory/remTool.js +34 -0
  121. package/src/widget-factory/stackPosition.js +87 -0
  122. package/src/widget-factory/stringTool.js +26 -0
  123. package/src/widget-factory/tools.js +249 -0
  124. package/src/widget-factory/translateProps.js +1049 -0
  125. package/src/widget-factory/warnings.js +284 -0
  126. package/src/widget-factory/widgetFactory.js +200 -0
  127. package/src/widgets/Accordion.js +562 -0
  128. package/src/widgets/AdMob.js +315 -0
  129. package/src/widgets/AdSense.js +268 -0
  130. package/src/widgets/AlertDialog.js +162 -0
  131. package/src/widgets/Audio.js +311 -0
  132. package/src/widgets/Avatar.js +210 -0
  133. package/src/widgets/Badge.js +189 -0
  134. package/src/widgets/BottomSheet.js +287 -0
  135. package/src/widgets/Button.js +247 -0
  136. package/src/widgets/Card.js +33 -0
  137. package/src/widgets/Carousel.js +301 -0
  138. package/src/widgets/Chart.js +632 -0
  139. package/src/widgets/Checkbox.js +106 -0
  140. package/src/widgets/Chip.js +153 -0
  141. package/src/widgets/CircularBar.js +352 -0
  142. package/src/widgets/CircularChart.js +549 -0
  143. package/src/widgets/CodeViewer.js +236 -0
  144. package/src/widgets/Column.js +29 -0
  145. package/src/widgets/Container.js +31 -0
  146. package/src/widgets/DataTable.js +257 -0
  147. package/src/widgets/Divider.js +93 -0
  148. package/src/widgets/DraggBox.js +115 -0
  149. package/src/widgets/Dropdown.js +505 -0
  150. package/src/widgets/DroppBox.js +180 -0
  151. package/src/widgets/FloatingActionButton.js +91 -0
  152. package/src/widgets/GridView.js +20 -0
  153. package/src/widgets/Icon.js +33 -0
  154. package/src/widgets/Image.js +15 -0
  155. package/src/widgets/Input.js +565 -0
  156. package/src/widgets/Inspector.js +254 -0
  157. package/src/widgets/InstallButton.js +110 -0
  158. package/src/widgets/ListTile.js +224 -0
  159. package/src/widgets/ListView.js +503 -0
  160. package/src/widgets/Markdown.js +1236 -0
  161. package/src/widgets/Modal.js +496 -0
  162. package/src/widgets/Pagination.js +195 -0
  163. package/src/widgets/ProgressBar.js +178 -0
  164. package/src/widgets/QRCode.js +467 -0
  165. package/src/widgets/Radio.js +132 -0
  166. package/src/widgets/Rating.js +261 -0
  167. package/src/widgets/Row.js +29 -0
  168. package/src/widgets/Skeleton.js +243 -0
  169. package/src/widgets/Slider.js +527 -0
  170. package/src/widgets/SnackBar.js +227 -0
  171. package/src/widgets/Stack.js +29 -0
  172. package/src/widgets/Stepper.js +296 -0
  173. package/src/widgets/Switch.js +102 -0
  174. package/src/widgets/Text.js +98 -0
  175. package/src/widgets/Tooltip.js +267 -0
  176. package/src/widgets/TreeView.js +370 -0
  177. package/src/widgets/Video.js +92 -0
  178. package/src/widgets/index.js +52 -0
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @file DroppBox.js
3
+ * @description Drop target for drag-and-drop, highlights while dragging over.
4
+ */
5
+ import { WidgetFactory } from "../widget-factory/index.js";
6
+ import { colors } from "../utils/themes.js";
7
+
8
+ export const DroppBox = (props) => {
9
+ const {
10
+ child,
11
+ onDrop,
12
+ onDragEnter,
13
+ onDragLeave,
14
+ onDragOver,
15
+ acceptGroups = ["default"],
16
+ disabled = false,
17
+
18
+ // Normal styles
19
+ bgColor = colors.surface,
20
+ borderRadius = 12,
21
+ borderWidth = 2,
22
+ borderStyle = "solid",
23
+ borderColor = colors.border,
24
+ shadow = "none",
25
+ padding = 16,
26
+
27
+ // Active styles (when dragging over)
28
+ activeBgColor = `${colors.primary}20`,
29
+ activeBorderColor = colors.primary,
30
+ activeBorderWidth = 2,
31
+ activeBorderStyle = "dashed",
32
+ activeShadow = `0 4px 12px ${colors.primary}40`,
33
+
34
+ // Valid/Invalid styles
35
+ validBgColor = `${colors.success}20`,
36
+ validBorderColor = colors.success,
37
+ invalidBgColor = `${colors.danger}20`,
38
+ invalidBorderColor = colors.danger,
39
+
40
+ // Animation
41
+ transitionDuration = "0.2s",
42
+ transitionTiming = "ease",
43
+
44
+ // Feedback
45
+ showFeedback = true,
46
+
47
+ ...rest
48
+ } = props;
49
+
50
+ let isActive = false;
51
+ let isValidTarget = false;
52
+
53
+ // ✅ FIXED: Use WidgetFactory correctly (without tag)
54
+ const wrapper = WidgetFactory({
55
+ tag: "div",
56
+ widgetName: "DroppBox",
57
+ position: "relative",
58
+ transition: `all ${transitionDuration} ${transitionTiming}`,
59
+ backgroundColor: bgColor,
60
+ borderRadius:
61
+ typeof borderRadius === "number" ? `${borderRadius}px` : borderRadius,
62
+ borderWidth: `${borderWidth}px`,
63
+ borderStyle: borderStyle,
64
+ borderColor: borderColor,
65
+ boxShadow: shadow,
66
+ padding: typeof padding === "number" ? `${padding}px` : padding,
67
+ ...rest,
68
+ });
69
+
70
+ // If there is a child, add it
71
+ if (child) {
72
+ if (child instanceof HTMLElement) {
73
+ wrapper.appendChild(child);
74
+ } else if (typeof child === "string") {
75
+ const textNode = document.createTextNode(child);
76
+ wrapper.appendChild(textNode);
77
+ } else if (Array.isArray(child)) {
78
+ child.forEach((item) => {
79
+ if (item instanceof HTMLElement) wrapper.appendChild(item);
80
+ else if (typeof item === "string") {
81
+ wrapper.appendChild(document.createTextNode(item));
82
+ }
83
+ });
84
+ }
85
+ }
86
+
87
+ const getDragData = () => {
88
+ if (window.__dragData) {
89
+ return window.__dragData;
90
+ }
91
+ return null;
92
+ };
93
+
94
+ const isValidDrag = () => {
95
+ const dragData = getDragData();
96
+ if (!dragData) return false;
97
+ return acceptGroups.includes(dragData.group);
98
+ };
99
+
100
+ const applyActiveStyles = () => {
101
+ if (!showFeedback) return;
102
+
103
+ isValidTarget = isValidDrag();
104
+
105
+ if (isValidTarget) {
106
+ wrapper.style.borderColor = validBorderColor;
107
+ wrapper.style.backgroundColor = validBgColor;
108
+ wrapper.style.borderStyle = activeBorderStyle;
109
+ } else {
110
+ wrapper.style.borderColor = invalidBorderColor;
111
+ wrapper.style.backgroundColor = invalidBgColor;
112
+ wrapper.style.borderStyle = activeBorderStyle;
113
+ }
114
+
115
+ wrapper.style.borderWidth = `${activeBorderWidth}px`;
116
+ if (activeShadow) wrapper.style.boxShadow = activeShadow;
117
+ };
118
+
119
+ const removeActiveStyles = () => {
120
+ wrapper.style.borderColor = borderColor;
121
+ wrapper.style.borderWidth = `${borderWidth}px`;
122
+ wrapper.style.borderStyle = borderStyle;
123
+ wrapper.style.backgroundColor = bgColor;
124
+ wrapper.style.boxShadow = shadow;
125
+ isValidTarget = false;
126
+ };
127
+
128
+ wrapper.addEventListener("dragover", (e) => {
129
+ if (disabled) return;
130
+ e.preventDefault();
131
+ e.dataTransfer.dropEffect = "copy";
132
+ if (onDragOver) onDragOver(e);
133
+ });
134
+
135
+ wrapper.addEventListener("dragenter", (e) => {
136
+ if (disabled) return;
137
+ e.preventDefault();
138
+
139
+ if (isValidDrag() && !isActive) {
140
+ isActive = true;
141
+ applyActiveStyles();
142
+ if (onDragEnter) onDragEnter(e);
143
+ }
144
+ });
145
+
146
+ wrapper.addEventListener("dragleave", (e) => {
147
+ if (disabled) return;
148
+ e.preventDefault();
149
+
150
+ if (isActive) {
151
+ isActive = false;
152
+ removeActiveStyles();
153
+ if (onDragLeave) onDragLeave(e);
154
+ }
155
+ });
156
+
157
+ wrapper.addEventListener("drop", (e) => {
158
+ if (disabled) return;
159
+ e.preventDefault();
160
+
161
+ const dragData = getDragData();
162
+
163
+ if (isActive) {
164
+ isActive = false;
165
+ removeActiveStyles();
166
+ }
167
+
168
+ if (!dragData || !acceptGroups.includes(dragData.group)) {
169
+ return;
170
+ }
171
+
172
+ if (onDrop) onDrop(dragData.data, dragData.group, e);
173
+
174
+ window.__dragData = null;
175
+ });
176
+
177
+ return wrapper;
178
+ };
179
+
180
+ export default DroppBox;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @file FloatingActionButton.js
3
+ * @description Circular floating action button anchored to a corner.
4
+ */
5
+ /**
6
+ * FloatingActionButton Component
7
+ * @module widgets/FloatingActionButton
8
+ */
9
+
10
+ import { Container } from "./Container.js";
11
+ import { Row } from "./Row.js";
12
+ import { Text } from "./Text.js";
13
+ import { Icon } from "./Icon.js";
14
+ import { colors } from "../utils/themes.js";
15
+
16
+ export const FloatingActionButton = (props) => {
17
+ const {
18
+ icon = "add",
19
+ label,
20
+ onPress,
21
+ backgroundColor = colors.primary,
22
+ foregroundColor = "#ffffff",
23
+ elevation = 6,
24
+ borderRadius = 48,
25
+ padding = 12,
26
+ mini = false,
27
+ extended = false,
28
+ disabled = false,
29
+ ...rest
30
+ } = props;
31
+
32
+ const size = mini ? 40 : 56;
33
+ const iconSize = mini ? 20 : 24;
34
+
35
+ const children = [
36
+ Icon({
37
+ padding,
38
+ borderRadius,
39
+ name: icon,
40
+ size: iconSize,
41
+ color: foregroundColor,
42
+ }),
43
+ ];
44
+
45
+ if (extended && label) {
46
+ children.push(
47
+ Text({
48
+ value: label,
49
+ size: 14,
50
+ fontWeight: "500",
51
+ color: foregroundColor,
52
+ }),
53
+ );
54
+ }
55
+
56
+ const button = Container({
57
+ widgetName: "FloatingActionButton",
58
+ display: "flex",
59
+ alignItems: "center",
60
+ justifyContent: "center",
61
+ gap: 8,
62
+ width: extended ? "auto" : size,
63
+ height: size,
64
+ borderRadius: extended ? "24px" : "50%",
65
+ backgroundColor: backgroundColor,
66
+ color: foregroundColor,
67
+ cursor: disabled ? "not-allowed" : "pointer",
68
+ opacity: disabled ? 0.6 : 1,
69
+ boxShadow: `0 ${elevation / 2}px ${elevation}px rgba(0,0,0,0.3)`,
70
+ transition: "all 0.2s ease",
71
+ padding: extended ? "0 20px" : 0,
72
+ child: extended
73
+ ? Row({ alignItems: "center", gap: 8, children })
74
+ : children[0],
75
+ ...rest,
76
+ });
77
+
78
+ if (onPress && !disabled) {
79
+ button.addEventListener("click", onPress);
80
+ button.addEventListener("mouseenter", () => {
81
+ button.style.transform = "scale(1.05)";
82
+ });
83
+ button.addEventListener("mouseleave", () => {
84
+ button.style.transform = "scale(1)";
85
+ });
86
+ }
87
+
88
+ return button;
89
+ };
90
+
91
+ export default FloatingActionButton;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @file GridView.js
3
+ * @description Grid layout, implemented as a `ListView` with `wrapItems`.
4
+ */
5
+ import { ListView } from "./ListView.js";
6
+
7
+ export const GridView = (props) => {
8
+ const { columns = 2, itemHeight = 150, spacing = 8, ...rest } = props;
9
+
10
+ return ListView({
11
+ widgetName: "GridView",
12
+ wrapItems: true, // ← enables grid mode
13
+ crossAxisCount: columns, // ← number of columns
14
+ itemSize: itemHeight, // ← height of each cell
15
+ gap: spacing, // ← spacing between items
16
+ ...rest,
17
+ });
18
+ };
19
+
20
+ export default GridView;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @file Icon.js
3
+ * @description Material icon glyph rendered as a `<span class="material-icons">`.
4
+ */
5
+ import { WidgetFactory } from "../widget-factory/index.js";
6
+ import { colors } from "../utils/themes.js";
7
+
8
+ export const Icon = (props) => {
9
+ const {
10
+ icon,
11
+ name,
12
+ size = 24,
13
+ color = colors.textSecondary,
14
+ ...rest
15
+ } = props;
16
+ const iconName = icon || name || "";
17
+
18
+ return WidgetFactory({
19
+ tag: "span",
20
+ widgetName: "Icon",
21
+ className: "material-icons",
22
+ text: iconName, // ✅ CHANGED: text instead of textContent
23
+ fontSize: typeof size === "number" ? `${size}px` : size,
24
+ color: color,
25
+ display: "inline-flex",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ userSelect: "none",
29
+ ...rest,
30
+ });
31
+ };
32
+
33
+ export default Icon;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file Image.js
3
+ * @description Thin `<img>` wrapper that forwards all props to the factory.
4
+ */
5
+ import { WidgetFactory } from "../widget-factory/index.js";
6
+
7
+ export const Image = (props) => {
8
+ return WidgetFactory({
9
+ tag: "img",
10
+ widgetName: "Image",
11
+ ...props,
12
+ });
13
+ };
14
+
15
+ export default Image;