@flexireact/core 3.0.3 → 4.0.0
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 +14 -15
- package/dist/cli/index.js +31 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/core/build/index.js +689 -0
- package/dist/core/build/index.js.map +1 -0
- package/dist/core/client/index.js +12 -15
- package/dist/core/client/index.js.map +1 -1
- package/dist/core/config.js +86 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.js +94 -51
- package/dist/core/index.js.map +1 -1
- package/dist/core/server/index.js +3 -0
- package/dist/core/server/index.js.map +1 -1
- package/dist/core/start-dev.js +3095 -0
- package/dist/core/start-dev.js.map +1 -0
- package/dist/core/start-prod.js +3095 -0
- package/dist/core/start-prod.js.map +1 -0
- package/package.json +11 -9
package/dist/core/index.js
CHANGED
|
@@ -2911,6 +2911,9 @@ function isMethod(request, method) {
|
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
2913
|
// core/actions/index.ts
|
|
2914
|
+
import { useActionState, useOptimistic } from "react";
|
|
2915
|
+
import { useFormStatus } from "react-dom";
|
|
2916
|
+
import { useActionState as useActionStateReact } from "react";
|
|
2914
2917
|
globalThis.__FLEXI_ACTIONS__ = globalThis.__FLEXI_ACTIONS__ || {};
|
|
2915
2918
|
globalThis.__FLEXI_ACTION_CONTEXT__ = null;
|
|
2916
2919
|
function serverAction(fn, actionId) {
|
|
@@ -3075,11 +3078,18 @@ function formAction(action) {
|
|
|
3075
3078
|
}
|
|
3076
3079
|
};
|
|
3077
3080
|
}
|
|
3081
|
+
function useFlexiAction(action, initialState, permalink) {
|
|
3082
|
+
return useActionStateReact(action, initialState, permalink);
|
|
3083
|
+
}
|
|
3078
3084
|
function createFormState(action, initialState = null) {
|
|
3085
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
3086
|
+
console.warn(
|
|
3087
|
+
"[FlexiReact] createFormState is deprecated. Use useActionState from React 19 instead.\nSee migration guide: https://flexireact.dev/docs/react-19-migration"
|
|
3088
|
+
);
|
|
3089
|
+
}
|
|
3079
3090
|
return {
|
|
3080
3091
|
action,
|
|
3081
3092
|
initialState,
|
|
3082
|
-
// This will be enhanced on the client
|
|
3083
3093
|
pending: false,
|
|
3084
3094
|
error: null,
|
|
3085
3095
|
data: initialState
|
|
@@ -5749,8 +5759,34 @@ var jsonLd = {
|
|
|
5749
5759
|
})
|
|
5750
5760
|
};
|
|
5751
5761
|
|
|
5762
|
+
// core/index.ts
|
|
5763
|
+
import { useActionState as useActionState3, useOptimistic as useOptimistic3 } from "react";
|
|
5764
|
+
import { useFormStatus as useFormStatus3 } from "react-dom";
|
|
5765
|
+
|
|
5766
|
+
// core/hooks/index.ts
|
|
5767
|
+
import { useActionState as useActionState2, useOptimistic as useOptimistic2 } from "react";
|
|
5768
|
+
import { useFormStatus as useFormStatus2 } from "react-dom";
|
|
5769
|
+
import { use } from "react";
|
|
5770
|
+
|
|
5771
|
+
// core/client/Link.tsx
|
|
5772
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5773
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5774
|
+
|
|
5775
|
+
// core/hooks/index.ts
|
|
5776
|
+
import { use as use2, useOptimistic as useOptimisticReact } from "react";
|
|
5777
|
+
function useAsyncData(promise) {
|
|
5778
|
+
return use2(promise);
|
|
5779
|
+
}
|
|
5780
|
+
function useOptimisticMutation(currentState, updateFn) {
|
|
5781
|
+
return useOptimisticReact(currentState, updateFn);
|
|
5782
|
+
}
|
|
5783
|
+
function preloadResource(fetcher) {
|
|
5784
|
+
const promise = fetcher();
|
|
5785
|
+
return promise;
|
|
5786
|
+
}
|
|
5787
|
+
|
|
5752
5788
|
// core/devtools/index.ts
|
|
5753
|
-
import
|
|
5789
|
+
import React8 from "react";
|
|
5754
5790
|
var devToolsState = {
|
|
5755
5791
|
routes: [],
|
|
5756
5792
|
components: /* @__PURE__ */ new Map(),
|
|
@@ -5928,24 +5964,24 @@ function initNetworkInterceptor() {
|
|
|
5928
5964
|
};
|
|
5929
5965
|
}
|
|
5930
5966
|
function DevToolsOverlay() {
|
|
5931
|
-
const [state, setState] =
|
|
5967
|
+
const [state, setState] = React8.useState({
|
|
5932
5968
|
enabled: true,
|
|
5933
5969
|
position: "bottom-right",
|
|
5934
5970
|
expanded: false,
|
|
5935
5971
|
activeTab: "routes",
|
|
5936
5972
|
theme: "dark"
|
|
5937
5973
|
});
|
|
5938
|
-
const [data, setData] =
|
|
5939
|
-
|
|
5974
|
+
const [data, setData] = React8.useState(devtools.getState());
|
|
5975
|
+
React8.useEffect(() => {
|
|
5940
5976
|
return devtools.subscribe(() => {
|
|
5941
5977
|
setData(devtools.getState());
|
|
5942
5978
|
});
|
|
5943
5979
|
}, []);
|
|
5944
|
-
|
|
5980
|
+
React8.useEffect(() => {
|
|
5945
5981
|
initPerformanceMonitoring();
|
|
5946
5982
|
initNetworkInterceptor();
|
|
5947
5983
|
}, []);
|
|
5948
|
-
|
|
5984
|
+
React8.useEffect(() => {
|
|
5949
5985
|
const handler = (e) => {
|
|
5950
5986
|
if (e.ctrlKey && e.shiftKey && e.key === "D") {
|
|
5951
5987
|
setState((s) => ({ ...s, expanded: !s.expanded }));
|
|
@@ -5962,7 +5998,7 @@ function DevToolsOverlay() {
|
|
|
5962
5998
|
"top-left": { top: 16, left: 16 }
|
|
5963
5999
|
};
|
|
5964
6000
|
if (!state.expanded) {
|
|
5965
|
-
return
|
|
6001
|
+
return React8.createElement("button", {
|
|
5966
6002
|
onClick: () => setState((s) => ({ ...s, expanded: true })),
|
|
5967
6003
|
style: {
|
|
5968
6004
|
position: "fixed",
|
|
@@ -5983,7 +6019,7 @@ function DevToolsOverlay() {
|
|
|
5983
6019
|
onMouseEnter: (e) => e.target.style.transform = "scale(1.1)",
|
|
5984
6020
|
onMouseLeave: (e) => e.target.style.transform = "scale(1)",
|
|
5985
6021
|
title: "FlexiReact DevTools (Ctrl+Shift+D)"
|
|
5986
|
-
},
|
|
6022
|
+
}, React8.createElement("span", { style: { fontSize: 24 } }, "\u26A1"));
|
|
5987
6023
|
}
|
|
5988
6024
|
const tabs = [
|
|
5989
6025
|
{ id: "routes", label: "\u{1F5FA}\uFE0F Routes", count: data.routes.length },
|
|
@@ -5992,7 +6028,7 @@ function DevToolsOverlay() {
|
|
|
5992
6028
|
{ id: "performance", label: "\u{1F4CA} Performance", count: data.performance.length },
|
|
5993
6029
|
{ id: "console", label: "\u{1F4DD} Console", count: data.logs.length }
|
|
5994
6030
|
];
|
|
5995
|
-
return
|
|
6031
|
+
return React8.createElement("div", {
|
|
5996
6032
|
style: {
|
|
5997
6033
|
position: "fixed",
|
|
5998
6034
|
...positionStyles[state.position],
|
|
@@ -6010,7 +6046,7 @@ function DevToolsOverlay() {
|
|
|
6010
6046
|
}
|
|
6011
6047
|
}, [
|
|
6012
6048
|
// Header
|
|
6013
|
-
|
|
6049
|
+
React8.createElement("div", {
|
|
6014
6050
|
key: "header",
|
|
6015
6051
|
style: {
|
|
6016
6052
|
display: "flex",
|
|
@@ -6021,14 +6057,14 @@ function DevToolsOverlay() {
|
|
|
6021
6057
|
background: "#111"
|
|
6022
6058
|
}
|
|
6023
6059
|
}, [
|
|
6024
|
-
|
|
6060
|
+
React8.createElement("div", {
|
|
6025
6061
|
key: "title",
|
|
6026
6062
|
style: { display: "flex", alignItems: "center", gap: 8 }
|
|
6027
6063
|
}, [
|
|
6028
|
-
|
|
6029
|
-
|
|
6064
|
+
React8.createElement("span", { key: "icon" }, "\u26A1"),
|
|
6065
|
+
React8.createElement("span", { key: "text", style: { fontWeight: 600 } }, "FlexiReact DevTools")
|
|
6030
6066
|
]),
|
|
6031
|
-
|
|
6067
|
+
React8.createElement("button", {
|
|
6032
6068
|
key: "close",
|
|
6033
6069
|
onClick: () => setState((s) => ({ ...s, expanded: false })),
|
|
6034
6070
|
style: {
|
|
@@ -6041,7 +6077,7 @@ function DevToolsOverlay() {
|
|
|
6041
6077
|
}, "\xD7")
|
|
6042
6078
|
]),
|
|
6043
6079
|
// Tabs
|
|
6044
|
-
|
|
6080
|
+
React8.createElement("div", {
|
|
6045
6081
|
key: "tabs",
|
|
6046
6082
|
style: {
|
|
6047
6083
|
display: "flex",
|
|
@@ -6050,7 +6086,7 @@ function DevToolsOverlay() {
|
|
|
6050
6086
|
overflowX: "auto"
|
|
6051
6087
|
}
|
|
6052
6088
|
}, tabs.map(
|
|
6053
|
-
(tab) =>
|
|
6089
|
+
(tab) => React8.createElement("button", {
|
|
6054
6090
|
key: tab.id,
|
|
6055
6091
|
onClick: () => setState((s) => ({ ...s, activeTab: tab.id })),
|
|
6056
6092
|
style: {
|
|
@@ -6066,7 +6102,7 @@ function DevToolsOverlay() {
|
|
|
6066
6102
|
}, `${tab.label} (${tab.count})`)
|
|
6067
6103
|
)),
|
|
6068
6104
|
// Content
|
|
6069
|
-
|
|
6105
|
+
React8.createElement("div", {
|
|
6070
6106
|
key: "content",
|
|
6071
6107
|
style: {
|
|
6072
6108
|
padding: 16,
|
|
@@ -6079,11 +6115,11 @@ function DevToolsOverlay() {
|
|
|
6079
6115
|
function renderTabContent(tab, data) {
|
|
6080
6116
|
switch (tab) {
|
|
6081
6117
|
case "routes":
|
|
6082
|
-
return
|
|
6118
|
+
return React8.createElement(
|
|
6083
6119
|
"div",
|
|
6084
6120
|
{ style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
6085
|
-
data.routes.length === 0 ?
|
|
6086
|
-
(route, i) =>
|
|
6121
|
+
data.routes.length === 0 ? React8.createElement("div", { style: { color: "#666", textAlign: "center", padding: 20 } }, "No routes tracked yet") : data.routes.map(
|
|
6122
|
+
(route, i) => React8.createElement("div", {
|
|
6087
6123
|
key: i,
|
|
6088
6124
|
style: {
|
|
6089
6125
|
padding: 12,
|
|
@@ -6092,8 +6128,8 @@ function renderTabContent(tab, data) {
|
|
|
6092
6128
|
border: "1px solid #222"
|
|
6093
6129
|
}
|
|
6094
6130
|
}, [
|
|
6095
|
-
|
|
6096
|
-
|
|
6131
|
+
React8.createElement("div", { key: "path", style: { fontWeight: 600, color: "#00FF9C" } }, route.path),
|
|
6132
|
+
React8.createElement(
|
|
6097
6133
|
"div",
|
|
6098
6134
|
{ key: "component", style: { fontSize: 11, color: "#888", marginTop: 4 } },
|
|
6099
6135
|
`Component: ${route.component} \u2022 ${route.loadTime}ms`
|
|
@@ -6102,11 +6138,11 @@ function renderTabContent(tab, data) {
|
|
|
6102
6138
|
)
|
|
6103
6139
|
);
|
|
6104
6140
|
case "components":
|
|
6105
|
-
return
|
|
6141
|
+
return React8.createElement(
|
|
6106
6142
|
"div",
|
|
6107
6143
|
{ style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
6108
|
-
data.components.length === 0 ?
|
|
6109
|
-
(comp, i) =>
|
|
6144
|
+
data.components.length === 0 ? React8.createElement("div", { style: { color: "#666", textAlign: "center", padding: 20 } }, "No components tracked") : data.components.map(
|
|
6145
|
+
(comp, i) => React8.createElement("div", {
|
|
6110
6146
|
key: i,
|
|
6111
6147
|
style: {
|
|
6112
6148
|
padding: 12,
|
|
@@ -6115,12 +6151,12 @@ function renderTabContent(tab, data) {
|
|
|
6115
6151
|
border: "1px solid #222"
|
|
6116
6152
|
}
|
|
6117
6153
|
}, [
|
|
6118
|
-
|
|
6154
|
+
React8.createElement("div", {
|
|
6119
6155
|
key: "name",
|
|
6120
6156
|
style: { display: "flex", alignItems: "center", gap: 8 }
|
|
6121
6157
|
}, [
|
|
6122
|
-
|
|
6123
|
-
comp.isIsland &&
|
|
6158
|
+
React8.createElement("span", { key: "text", style: { fontWeight: 600 } }, comp.name),
|
|
6159
|
+
comp.isIsland && React8.createElement("span", {
|
|
6124
6160
|
key: "island",
|
|
6125
6161
|
style: {
|
|
6126
6162
|
fontSize: 10,
|
|
@@ -6131,7 +6167,7 @@ function renderTabContent(tab, data) {
|
|
|
6131
6167
|
}
|
|
6132
6168
|
}, "Island")
|
|
6133
6169
|
]),
|
|
6134
|
-
|
|
6170
|
+
React8.createElement(
|
|
6135
6171
|
"div",
|
|
6136
6172
|
{ key: "info", style: { fontSize: 11, color: "#888", marginTop: 4 } },
|
|
6137
6173
|
`Renders: ${comp.renderCount} \u2022 Last: ${new Date(comp.lastRenderTime).toLocaleTimeString()}`
|
|
@@ -6140,11 +6176,11 @@ function renderTabContent(tab, data) {
|
|
|
6140
6176
|
)
|
|
6141
6177
|
);
|
|
6142
6178
|
case "network":
|
|
6143
|
-
return
|
|
6179
|
+
return React8.createElement(
|
|
6144
6180
|
"div",
|
|
6145
6181
|
{ style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
6146
|
-
data.network.length === 0 ?
|
|
6147
|
-
(req, i) =>
|
|
6182
|
+
data.network.length === 0 ? React8.createElement("div", { style: { color: "#666", textAlign: "center", padding: 20 } }, "No requests yet") : data.network.map(
|
|
6183
|
+
(req, i) => React8.createElement("div", {
|
|
6148
6184
|
key: i,
|
|
6149
6185
|
style: {
|
|
6150
6186
|
padding: 12,
|
|
@@ -6153,11 +6189,11 @@ function renderTabContent(tab, data) {
|
|
|
6153
6189
|
border: "1px solid #222"
|
|
6154
6190
|
}
|
|
6155
6191
|
}, [
|
|
6156
|
-
|
|
6192
|
+
React8.createElement("div", {
|
|
6157
6193
|
key: "url",
|
|
6158
6194
|
style: { display: "flex", alignItems: "center", gap: 8 }
|
|
6159
6195
|
}, [
|
|
6160
|
-
|
|
6196
|
+
React8.createElement("span", {
|
|
6161
6197
|
key: "method",
|
|
6162
6198
|
style: {
|
|
6163
6199
|
fontSize: 10,
|
|
@@ -6168,7 +6204,7 @@ function renderTabContent(tab, data) {
|
|
|
6168
6204
|
fontWeight: 600
|
|
6169
6205
|
}
|
|
6170
6206
|
}, req.method),
|
|
6171
|
-
|
|
6207
|
+
React8.createElement("span", {
|
|
6172
6208
|
key: "status",
|
|
6173
6209
|
style: {
|
|
6174
6210
|
fontSize: 10,
|
|
@@ -6178,12 +6214,12 @@ function renderTabContent(tab, data) {
|
|
|
6178
6214
|
borderRadius: 4
|
|
6179
6215
|
}
|
|
6180
6216
|
}, req.status || "ERR"),
|
|
6181
|
-
|
|
6217
|
+
React8.createElement("span", {
|
|
6182
6218
|
key: "path",
|
|
6183
6219
|
style: { fontSize: 12, color: "#fff", overflow: "hidden", textOverflow: "ellipsis" }
|
|
6184
6220
|
}, new URL(req.url, "http://localhost").pathname)
|
|
6185
6221
|
]),
|
|
6186
|
-
|
|
6222
|
+
React8.createElement(
|
|
6187
6223
|
"div",
|
|
6188
6224
|
{ key: "info", style: { fontSize: 11, color: "#888", marginTop: 4 } },
|
|
6189
6225
|
`${req.duration}ms \u2022 ${formatBytes2(req.size)}`
|
|
@@ -6192,11 +6228,11 @@ function renderTabContent(tab, data) {
|
|
|
6192
6228
|
)
|
|
6193
6229
|
);
|
|
6194
6230
|
case "performance":
|
|
6195
|
-
return
|
|
6231
|
+
return React8.createElement(
|
|
6196
6232
|
"div",
|
|
6197
6233
|
{ style: { display: "flex", flexDirection: "column", gap: 8 } },
|
|
6198
|
-
data.performance.length === 0 ?
|
|
6199
|
-
(metric, i) =>
|
|
6234
|
+
data.performance.length === 0 ? React8.createElement("div", { style: { color: "#666", textAlign: "center", padding: 20 } }, "Collecting metrics...") : data.performance.map(
|
|
6235
|
+
(metric, i) => React8.createElement("div", {
|
|
6200
6236
|
key: i,
|
|
6201
6237
|
style: {
|
|
6202
6238
|
padding: 12,
|
|
@@ -6208,14 +6244,14 @@ function renderTabContent(tab, data) {
|
|
|
6208
6244
|
alignItems: "center"
|
|
6209
6245
|
}
|
|
6210
6246
|
}, [
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6247
|
+
React8.createElement("span", { key: "name", style: { fontWeight: 600 } }, metric.name),
|
|
6248
|
+
React8.createElement("div", { key: "value", style: { display: "flex", alignItems: "center", gap: 8 } }, [
|
|
6249
|
+
React8.createElement(
|
|
6214
6250
|
"span",
|
|
6215
6251
|
{ key: "num" },
|
|
6216
6252
|
metric.name === "CLS" ? metric.value.toFixed(3) : `${Math.round(metric.value)}ms`
|
|
6217
6253
|
),
|
|
6218
|
-
|
|
6254
|
+
React8.createElement("span", {
|
|
6219
6255
|
key: "rating",
|
|
6220
6256
|
style: {
|
|
6221
6257
|
width: 8,
|
|
@@ -6229,11 +6265,11 @@ function renderTabContent(tab, data) {
|
|
|
6229
6265
|
)
|
|
6230
6266
|
);
|
|
6231
6267
|
case "console":
|
|
6232
|
-
return
|
|
6268
|
+
return React8.createElement(
|
|
6233
6269
|
"div",
|
|
6234
6270
|
{ style: { display: "flex", flexDirection: "column", gap: 4 } },
|
|
6235
|
-
data.logs.length === 0 ?
|
|
6236
|
-
(log, i) =>
|
|
6271
|
+
data.logs.length === 0 ? React8.createElement("div", { style: { color: "#666", textAlign: "center", padding: 20 } }, "No logs yet") : data.logs.map(
|
|
6272
|
+
(log, i) => React8.createElement("div", {
|
|
6237
6273
|
key: i,
|
|
6238
6274
|
style: {
|
|
6239
6275
|
padding: "8px 12px",
|
|
@@ -6244,7 +6280,7 @@ function renderTabContent(tab, data) {
|
|
|
6244
6280
|
color: log.level === "error" ? "#EF4444" : log.level === "warn" ? "#F59E0B" : "#888"
|
|
6245
6281
|
}
|
|
6246
6282
|
}, [
|
|
6247
|
-
|
|
6283
|
+
React8.createElement(
|
|
6248
6284
|
"span",
|
|
6249
6285
|
{ key: "time", style: { color: "#444", marginRight: 8 } },
|
|
6250
6286
|
new Date(log.timestamp).toLocaleTimeString()
|
|
@@ -6254,7 +6290,7 @@ function renderTabContent(tab, data) {
|
|
|
6254
6290
|
)
|
|
6255
6291
|
);
|
|
6256
6292
|
default:
|
|
6257
|
-
return
|
|
6293
|
+
return React8.createElement("div", {}, "Unknown tab");
|
|
6258
6294
|
}
|
|
6259
6295
|
}
|
|
6260
6296
|
function formatBytes2(bytes) {
|
|
@@ -6266,7 +6302,7 @@ function formatBytes2(bytes) {
|
|
|
6266
6302
|
}
|
|
6267
6303
|
|
|
6268
6304
|
// core/index.ts
|
|
6269
|
-
var VERSION = "3.
|
|
6305
|
+
var VERSION = "3.1.0";
|
|
6270
6306
|
var core_default = {
|
|
6271
6307
|
VERSION,
|
|
6272
6308
|
createServer
|
|
@@ -6384,6 +6420,7 @@ export {
|
|
|
6384
6420
|
parseSearchParams,
|
|
6385
6421
|
pluginManager,
|
|
6386
6422
|
pprFetch,
|
|
6423
|
+
preloadResource,
|
|
6387
6424
|
prerenderWithPPR,
|
|
6388
6425
|
processServerComponent,
|
|
6389
6426
|
reactCache,
|
|
@@ -6407,6 +6444,12 @@ export {
|
|
|
6407
6444
|
text,
|
|
6408
6445
|
unstable_cache,
|
|
6409
6446
|
useActionContext,
|
|
6447
|
+
useActionState3 as useActionState,
|
|
6448
|
+
useAsyncData,
|
|
6449
|
+
useFlexiAction,
|
|
6450
|
+
useFormStatus3 as useFormStatus,
|
|
6451
|
+
useOptimistic3 as useOptimistic,
|
|
6452
|
+
useOptimisticMutation,
|
|
6410
6453
|
useParams,
|
|
6411
6454
|
usePathname,
|
|
6412
6455
|
useQuery,
|