create-middag-ui 0.15.2 → 0.15.4
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/cli.js +4 -3
- package/lib/scaffold.js +45 -8
- package/lib/templates/pro/mock-navigation.ts +15 -37
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
scaffoldFreeAdapters,
|
|
33
33
|
scaffoldFreeApp,
|
|
34
34
|
scaffoldFreeRegister,
|
|
35
|
+
scaffoldProAdapters,
|
|
35
36
|
scaffoldHostEntry,
|
|
36
37
|
scaffoldHostThemeCSS,
|
|
37
38
|
scaffoldHostViteConfig,
|
|
@@ -213,9 +214,9 @@ if (isPro) {
|
|
|
213
214
|
pro.scaffoldMockEntities(targetDir);
|
|
214
215
|
pro.scaffoldMockPageContracts(targetDir);
|
|
215
216
|
pro.scaffoldMockRoutes(targetDir);
|
|
216
|
-
// Inertia
|
|
217
|
-
//
|
|
218
|
-
|
|
217
|
+
// PRO Inertia adapters — re-export from @middag-io/react/mock so usePage()
|
|
218
|
+
// shares the same React context as MockPageProvider (no context mismatch).
|
|
219
|
+
scaffoldProAdapters(targetDir);
|
|
219
220
|
success("PRO: using MockProductShell from @middag-io/react/mock");
|
|
220
221
|
} catch {
|
|
221
222
|
// npm version — PRO file excluded, fall back to FREE
|
package/lib/scaffold.js
CHANGED
|
@@ -1011,10 +1011,12 @@ const sharedProps = {
|
|
|
1011
1011
|
|
|
1012
1012
|
function buildNavigation(activeKey: string) {
|
|
1013
1013
|
return {
|
|
1014
|
-
|
|
1015
|
-
{ key: "overview", label: "
|
|
1016
|
-
{ key: "integration", label: "
|
|
1017
|
-
|
|
1014
|
+
tree: [
|
|
1015
|
+
{ key: "overview.dashboard", label: "Dashboard", icon: "home", href: "/", children: [] },
|
|
1016
|
+
{ key: "integration.connectors", label: "Connectors", icon: "plug", href: "/connectors", children: [] },
|
|
1017
|
+
],
|
|
1018
|
+
footer: [
|
|
1019
|
+
{ key: "system.settings", label: "Settings", icon: "settings", href: "/settings", children: [] },
|
|
1018
1020
|
],
|
|
1019
1021
|
activeKey,
|
|
1020
1022
|
};
|
|
@@ -1129,6 +1131,39 @@ export { router };
|
|
|
1129
1131
|
}
|
|
1130
1132
|
}
|
|
1131
1133
|
|
|
1134
|
+
/**
|
|
1135
|
+
* Scaffold PRO adapters: thin re-exports from @middag-io/react/mock.
|
|
1136
|
+
*
|
|
1137
|
+
* PRO uses MockPageProvider from the lib, so usePage() must read from the
|
|
1138
|
+
* same React context. These adapters delegate to the lib mock instead of
|
|
1139
|
+
* defining their own context (which would cause context mismatch).
|
|
1140
|
+
*/
|
|
1141
|
+
export function scaffoldProAdapters(targetDir) {
|
|
1142
|
+
ensureDir(join(targetDir, "src", "adapters"));
|
|
1143
|
+
|
|
1144
|
+
const corePath = join(targetDir, "src", "adapters", "inertia-core.ts");
|
|
1145
|
+
if (!skipIfExists(corePath, "src/adapters/inertia-core.ts")) {
|
|
1146
|
+
writeFile(corePath, `/**
|
|
1147
|
+
* Mock @inertiajs/core — PRO re-export from @middag-io/react/mock.
|
|
1148
|
+
* Shares the same navigate function as MockProductShell.
|
|
1149
|
+
*/
|
|
1150
|
+
export { router, setMockNavigate } from "@middag-io/react/mock";
|
|
1151
|
+
`, "src/adapters/inertia-core.ts (PRO)");
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
const reactPath = join(targetDir, "src", "adapters", "inertia-react.ts");
|
|
1155
|
+
if (!skipIfExists(reactPath, "src/adapters/inertia-react.ts")) {
|
|
1156
|
+
writeFile(reactPath, `/**
|
|
1157
|
+
* Mock @inertiajs/react — PRO re-export from @middag-io/react/mock.
|
|
1158
|
+
* Shares the same React context as MockPageProvider so usePage()
|
|
1159
|
+
* returns the data set by the mock shell.
|
|
1160
|
+
*/
|
|
1161
|
+
export { usePage, Head, Link } from "@middag-io/react/mock";
|
|
1162
|
+
export { router } from "./inertia-core";
|
|
1163
|
+
`, "src/adapters/inertia-react.ts (PRO)");
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1132
1167
|
/**
|
|
1133
1168
|
* Scaffold FREE DevShell: src/shells/DevShell.tsx.
|
|
1134
1169
|
*/
|
|
@@ -1258,10 +1293,12 @@ const sharedProps = {
|
|
|
1258
1293
|
|
|
1259
1294
|
function buildNavigation(activeKey: string) {
|
|
1260
1295
|
return {
|
|
1261
|
-
|
|
1262
|
-
{ key: "overview", label: "
|
|
1263
|
-
{ key: "integration", label: "
|
|
1264
|
-
|
|
1296
|
+
tree: [
|
|
1297
|
+
{ key: "overview.dashboard", label: "Dashboard", icon: "home", href: "/", children: [] },
|
|
1298
|
+
{ key: "integration.connectors", label: "Connectors", icon: "plug", href: "/connectors", children: [] },
|
|
1299
|
+
],
|
|
1300
|
+
footer: [
|
|
1301
|
+
{ key: "system.settings", label: "Settings", icon: "settings", href: "/settings", children: [] },
|
|
1265
1302
|
],
|
|
1266
1303
|
activeKey,
|
|
1267
1304
|
};
|
|
@@ -7,51 +7,29 @@
|
|
|
7
7
|
|
|
8
8
|
export function buildNavigation(activeKey: string) {
|
|
9
9
|
return {
|
|
10
|
-
|
|
10
|
+
tree: [
|
|
11
11
|
{
|
|
12
|
-
key: "overview",
|
|
13
|
-
label: "
|
|
12
|
+
key: "overview.dashboard",
|
|
13
|
+
label: "Dashboard",
|
|
14
14
|
icon: "home",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
key: "overview.dashboard",
|
|
19
|
-
label: "Dashboard",
|
|
20
|
-
href: "/",
|
|
21
|
-
active: activeKey === "overview.dashboard",
|
|
22
|
-
children: [],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
15
|
+
href: "/",
|
|
16
|
+
children: [],
|
|
25
17
|
},
|
|
26
18
|
{
|
|
27
|
-
key: "integration",
|
|
28
|
-
label: "
|
|
19
|
+
key: "integration.connectors",
|
|
20
|
+
label: "Connectors",
|
|
29
21
|
icon: "plug",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
key: "integration.connectors",
|
|
34
|
-
label: "Connectors",
|
|
35
|
-
href: "/connectors",
|
|
36
|
-
active: activeKey === "integration.connectors",
|
|
37
|
-
children: [],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
22
|
+
href: "/connectors",
|
|
23
|
+
children: [],
|
|
40
24
|
},
|
|
25
|
+
],
|
|
26
|
+
footer: [
|
|
41
27
|
{
|
|
42
|
-
key: "system",
|
|
43
|
-
label: "
|
|
28
|
+
key: "system.settings",
|
|
29
|
+
label: "Settings",
|
|
44
30
|
icon: "settings",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
key: "system.settings",
|
|
49
|
-
label: "Settings",
|
|
50
|
-
href: "/settings",
|
|
51
|
-
active: activeKey === "system.settings",
|
|
52
|
-
children: [],
|
|
53
|
-
},
|
|
54
|
-
],
|
|
31
|
+
href: "/settings",
|
|
32
|
+
children: [],
|
|
55
33
|
},
|
|
56
34
|
],
|
|
57
35
|
activeKey,
|