@mmapp/react-compiler 0.1.0-alpha.16 → 0.1.0-alpha.17
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/dist/{chunk-NUPJYPFU.mjs → chunk-6LAII7OP.mjs} +79 -1
- package/dist/{chunk-GVCJJX7E.mjs → chunk-FPAMQXKB.mjs} +14 -18
- package/dist/cli/index.js +175 -35
- package/dist/cli/index.mjs +55 -8
- package/dist/dev-server.js +16 -28
- package/dist/dev-server.mjs +1 -1
- package/dist/index.js +16 -28
- package/dist/index.mjs +1 -1
- package/dist/{init-2CRSUGV5.mjs → init-CJCDWI33.mjs} +119 -0
- package/package.json +2 -2
- package/dist/chunk-26U577GB.mjs +0 -3465
- package/dist/chunk-2FBDFAX6.mjs +0 -2362
- package/dist/chunk-2L4QSMXG.mjs +0 -175
- package/dist/chunk-2REDFOER.mjs +0 -931
- package/dist/chunk-3USIFFE4.mjs +0 -2190
- package/dist/chunk-45YMGEVT.mjs +0 -186
- package/dist/chunk-46YKSHQR.mjs +0 -175
- package/dist/chunk-4FN2AISW.mjs +0 -148
- package/dist/chunk-4OPI5L7G.mjs +0 -2593
- package/dist/chunk-4RYTKOOJ.mjs +0 -186
- package/dist/chunk-4XHK6FWL.mjs +0 -2058
- package/dist/chunk-52XHYD2V.mjs +0 -214
- package/dist/chunk-5FTDWKHH.mjs +0 -244
- package/dist/chunk-5GUFFFGL.mjs +0 -148
- package/dist/chunk-5RKTOVR5.mjs +0 -244
- package/dist/chunk-5VNJ7C6N.mjs +0 -154
- package/dist/chunk-5YDMOO4X.mjs +0 -214
- package/dist/chunk-64ZWEMLJ.mjs +0 -148
- package/dist/chunk-6CQOAAMV.mjs +0 -1803
- package/dist/chunk-6SEVAAVT.mjs +0 -3516
- package/dist/chunk-6XP4KSWQ.mjs +0 -2190
- package/dist/chunk-6YLR5ZDA.mjs +0 -2829
- package/dist/chunk-72QWL54I.mjs +0 -175
- package/dist/chunk-7B4TRI7C.mjs +0 -4835
- package/dist/chunk-7JRAEFRB.mjs +0 -7510
- package/dist/chunk-7ZKGHTNB.mjs +0 -4952
- package/dist/chunk-AOGY2GK6.mjs +0 -3292
- package/dist/chunk-AXXUXRNA.mjs +0 -1434
- package/dist/chunk-CHLVKMQW.mjs +0 -175
- package/dist/chunk-CKGOZAB7.mjs +0 -939
- package/dist/chunk-D34RAZUX.mjs +0 -2223
- package/dist/chunk-DE3ZGQAC.mjs +0 -148
- package/dist/chunk-DMCY3BBG.mjs +0 -1933
- package/dist/chunk-DPIK3PJS.mjs +0 -244
- package/dist/chunk-E5IVH4RE.mjs +0 -186
- package/dist/chunk-E6FZNUR5.mjs +0 -4953
- package/dist/chunk-EJRBDQDP.mjs +0 -2607
- package/dist/chunk-ELO4TXJL.mjs +0 -186
- package/dist/chunk-EO6SYNCG.mjs +0 -175
- package/dist/chunk-EQGA6A6D.mjs +0 -121
- package/dist/chunk-EY2CSXYA.mjs +0 -822
- package/dist/chunk-FIQ65CDR.mjs +0 -925
- package/dist/chunk-FKRO52XH.mjs +0 -3446
- package/dist/chunk-FL4YAKU6.mjs +0 -4941
- package/dist/chunk-FOZXJFAR.mjs +0 -186
- package/dist/chunk-FX6URXWN.mjs +0 -186
- package/dist/chunk-FYT47UBU.mjs +0 -5076
- package/dist/chunk-G7SMOWOL.mjs +0 -828
- package/dist/chunk-GCLGPOJZ.mjs +0 -148
- package/dist/chunk-GGB4G5YY.mjs +0 -175
- package/dist/chunk-GXB4JOP7.mjs +0 -5072
- package/dist/chunk-HFXOUMTD.mjs +0 -175
- package/dist/chunk-HLRGCCIL.mjs +0 -4839
- package/dist/chunk-HOIUP6IF.mjs +0 -690
- package/dist/chunk-HRYR54PT.mjs +0 -175
- package/dist/chunk-HWIZ47US.mjs +0 -214
- package/dist/chunk-I3AU7GRD.mjs +0 -120
- package/dist/chunk-IB7MNPQL.mjs +0 -4953
- package/dist/chunk-ICSIHQCG.mjs +0 -148
- package/dist/chunk-ILFGMUVD.mjs +0 -1933
- package/dist/chunk-IPTX5MJU.mjs +0 -3223
- package/dist/chunk-ITGUSH2Z.mjs +0 -2783
- package/dist/chunk-IXHBCAMF.mjs +0 -3306
- package/dist/chunk-J7JUAHS4.mjs +0 -186
- package/dist/chunk-J7TWJ3TM.mjs +0 -2784
- package/dist/chunk-JDPLDGVF.mjs +0 -4810
- package/dist/chunk-JLA5VNQ3.mjs +0 -186
- package/dist/chunk-JQLWFCTM.mjs +0 -214
- package/dist/chunk-K53XP2DL.mjs +0 -148
- package/dist/chunk-K5HX2SVL.mjs +0 -1902
- package/dist/chunk-KFGYOOVS.mjs +0 -214
- package/dist/chunk-KFJJCQAL.mjs +0 -148
- package/dist/chunk-KFVVOS5N.mjs +0 -925
- package/dist/chunk-KJUIIEQE.mjs +0 -186
- package/dist/chunk-KNWTHRVQ.mjs +0 -175
- package/dist/chunk-KSG4XSZF.mjs +0 -175
- package/dist/chunk-L2OZ4CDV.mjs +0 -113
- package/dist/chunk-LF5N6DOU.mjs +0 -175
- package/dist/chunk-LJQCM2IM.mjs +0 -214
- package/dist/chunk-MIZV3TAN.mjs +0 -3293
- package/dist/chunk-NKKLQE5V.mjs +0 -148
- package/dist/chunk-NOW23XFZ.mjs +0 -186
- package/dist/chunk-NRXQKQ74.mjs +0 -148
- package/dist/chunk-NTB7OEX2.mjs +0 -2918
- package/dist/chunk-NW6555WJ.mjs +0 -186
- package/dist/chunk-O4AUS7EU.mjs +0 -148
- package/dist/chunk-OMZE6VLQ.mjs +0 -214
- package/dist/chunk-OPJKP747.mjs +0 -7506
- package/dist/chunk-OWI6XWCD.mjs +0 -3375
- package/dist/chunk-P4BR7WVO.mjs +0 -2190
- package/dist/chunk-PRUMNNDI.mjs +0 -3192
- package/dist/chunk-QQHVYH2X.mjs +0 -244
- package/dist/chunk-QTBD5B3F.mjs +0 -148
- package/dist/chunk-R57T26RR.mjs +0 -734
- package/dist/chunk-S5QLWLLT.mjs +0 -186
- package/dist/chunk-SCWGT2FY.mjs +0 -2190
- package/dist/chunk-SKSDPPNT.mjs +0 -3788
- package/dist/chunk-SMKJUSB3.mjs +0 -2190
- package/dist/chunk-SP2YUS33.mjs +0 -186
- package/dist/chunk-SU4E6E7B.mjs +0 -3153
- package/dist/chunk-SYUUKW5A.mjs +0 -3379
- package/dist/chunk-THFYE5ZX.mjs +0 -244
- package/dist/chunk-UBDNXVL2.mjs +0 -801
- package/dist/chunk-UDDTWG5J.mjs +0 -734
- package/dist/chunk-UL2XZEMA.mjs +0 -3128
- package/dist/chunk-VCAY2KGM.mjs +0 -175
- package/dist/chunk-VLTKQDJ3.mjs +0 -244
- package/dist/chunk-WBYMW4NQ.mjs +0 -3450
- package/dist/chunk-WECAV6QB.mjs +0 -148
- package/dist/chunk-WMKBXUCE.mjs +0 -3228
- package/dist/chunk-XAJ5BKKL.mjs +0 -4947
- package/dist/chunk-XG2X7AEA.mjs +0 -175
- package/dist/chunk-XG7Z23NQ.mjs +0 -148
- package/dist/chunk-XMWUHQVV.mjs +0 -939
- package/dist/chunk-XWZAOCQ7.mjs +0 -2607
- package/dist/chunk-XZNEDRGN.mjs +0 -3876
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-Y6MA7ULW.mjs +0 -148
- package/dist/chunk-YFS6JMYO.mjs +0 -3342
- package/dist/chunk-YMS7Q7LG.mjs +0 -214
- package/dist/chunk-Z2G5RZ4H.mjs +0 -186
- package/dist/chunk-Z6AIQ4KL.mjs +0 -113
- package/dist/chunk-ZA37XTGA.mjs +0 -175
- package/dist/chunk-ZE3KCHBM.mjs +0 -2918
- package/dist/config-PL24KEWL.mjs +0 -219
- package/dist/dev-server-Bs_sz2DG.d.mts +0 -111
- package/dist/dev-server-Bs_sz2DG.d.ts +0 -111
- package/dist/dev-server-CjoufJ-u.d.mts +0 -109
- package/dist/dev-server-CjoufJ-u.d.ts +0 -109
- package/dist/dev-server-RmGHIntF.d.mts +0 -113
- package/dist/dev-server-RmGHIntF.d.ts +0 -113
- package/dist/engine-binary-QQUDACBJ.mjs +0 -455
- package/dist/envelope-DD7v0v6E.d.mts +0 -265
- package/dist/envelope-DD7v0v6E.d.ts +0 -265
- package/dist/envelope-vCVjrHlo.d.mts +0 -265
- package/dist/envelope-vCVjrHlo.d.ts +0 -265
- package/dist/index-B5gSgvnd.d.mts +0 -44
- package/dist/index-B5gSgvnd.d.ts +0 -44
- package/dist/index-Bs0MnR54.d.mts +0 -103
- package/dist/index-Bs0MnR54.d.ts +0 -103
- package/dist/index-DR0nNc_f.d.mts +0 -101
- package/dist/index-DR0nNc_f.d.ts +0 -101
- package/dist/index-revho_gS.d.mts +0 -104
- package/dist/index-revho_gS.d.ts +0 -104
- package/dist/init-7FJENUDK.mjs +0 -407
- package/dist/init-7JQMAAXS.mjs +0 -363
- package/dist/init-DQDX3QK6.mjs +0 -369
- package/dist/init-EHO4VQ22.mjs +0 -369
- package/dist/init-IXEE2RCF.mjs +0 -340
- package/dist/init-UC3FWPIW.mjs +0 -367
- package/dist/init-UNSMVKIK.mjs +0 -366
- package/dist/init-UNV5XIDE.mjs +0 -367
- package/dist/project-compiler-2P4N4DR7.mjs +0 -10
- package/dist/project-compiler-D2LCC27O.mjs +0 -10
- package/dist/project-compiler-EGJUTAJU.mjs +0 -10
- package/dist/project-compiler-EJ3GANJE.mjs +0 -10
- package/dist/project-compiler-LOQKVRZJ.mjs +0 -10
- package/dist/project-compiler-NNK32MPG.mjs +0 -10
- package/dist/project-compiler-OP2VVGJQ.mjs +0 -10
- package/dist/project-compiler-RQ6OQKRM.mjs +0 -10
- package/dist/project-compiler-VFR6CSDX.mjs +0 -10
- package/dist/project-compiler-VWNNCHGO.mjs +0 -10
- package/dist/project-compiler-XVAAU4C5.mjs +0 -10
- package/dist/project-compiler-YES5FGMD.mjs +0 -10
- package/dist/project-compiler-ZKMQDLGU.mjs +0 -10
- package/dist/project-decompiler-5GY2KSG4.mjs +0 -7
- package/dist/project-decompiler-FLXCEJHS.mjs +0 -7
- package/dist/project-decompiler-US7GAVIC.mjs +0 -7
- package/dist/project-decompiler-VLPR22QF.mjs +0 -7
- package/dist/pull-A2QUHW4K.mjs +0 -109
- package/dist/pull-FUS5QYZS.mjs +0 -109
- package/dist/pull-JBEQWVPE.mjs +0 -109
- package/dist/pull-LD5ENLGY.mjs +0 -109
- package/dist/pull-P44LDRWB.mjs +0 -109
- package/dist/verify-BYHUKARQ.mjs +0 -1833
- package/dist/verify-SEIXUGN4.mjs +0 -1833
package/dist/init-EHO4VQ22.mjs
DELETED
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
import "./chunk-Y6FXYEAI.mjs";
|
|
2
|
-
|
|
3
|
-
// src/cli/init.ts
|
|
4
|
-
import { mkdirSync, writeFileSync, existsSync } from "fs";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
function toTitleCase(slug) {
|
|
7
|
-
return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
8
|
-
}
|
|
9
|
-
function toPascalCase(slug) {
|
|
10
|
-
return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
11
|
-
}
|
|
12
|
-
function generatePackageJson(name) {
|
|
13
|
-
return JSON.stringify(
|
|
14
|
-
{
|
|
15
|
-
name: `@mindmatrix/blueprint-${name}`,
|
|
16
|
-
version: "0.1.0",
|
|
17
|
-
private: true,
|
|
18
|
-
type: "module",
|
|
19
|
-
scripts: {
|
|
20
|
-
build: "mmrc build --src . --out dist",
|
|
21
|
-
dev: "mmrc dev --src . --port 5199",
|
|
22
|
-
deploy: "mmrc deploy --build --src ."
|
|
23
|
-
},
|
|
24
|
-
dependencies: {
|
|
25
|
-
"@mmapp/react": "^0.1.0-alpha.1"
|
|
26
|
-
},
|
|
27
|
-
devDependencies: {
|
|
28
|
-
typescript: "^5.5.0",
|
|
29
|
-
"@types/react": "^18.0.0",
|
|
30
|
-
react: "^18.0.0"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
null,
|
|
34
|
-
2
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
function generateMmConfig(name, opts) {
|
|
38
|
-
const title = toTitleCase(name);
|
|
39
|
-
const desc = opts.description ?? `${title} blueprint.`;
|
|
40
|
-
const icon = opts.icon ?? "box";
|
|
41
|
-
const author = opts.author ?? "MindMatrix";
|
|
42
|
-
return `import { defineBlueprint } from '@mmapp/react';
|
|
43
|
-
|
|
44
|
-
export default defineBlueprint({
|
|
45
|
-
slug: '${name}',
|
|
46
|
-
name: '${title}',
|
|
47
|
-
version: '1.0.0',
|
|
48
|
-
description: '${desc}',
|
|
49
|
-
author: '${author}',
|
|
50
|
-
icon: '${icon}',
|
|
51
|
-
mode: 'infer',
|
|
52
|
-
defaultRuntime: 'collaborative',
|
|
53
|
-
|
|
54
|
-
models: [
|
|
55
|
-
'models/item',
|
|
56
|
-
],
|
|
57
|
-
|
|
58
|
-
routes: [
|
|
59
|
-
{ path: '/', view: 'app/page', label: 'Home' },
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
dependencies: [],
|
|
63
|
-
});
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
66
|
-
function generateModel(name) {
|
|
67
|
-
const modelSlug = `${name}-item`;
|
|
68
|
-
const pascal = toPascalCase(name);
|
|
69
|
-
return `/**
|
|
70
|
-
* ${pascal} Item \u2014 data model with lifecycle states.
|
|
71
|
-
*
|
|
72
|
-
* States: draft \u2192 active \u2192 archived
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
import { defineModel } from '@mmapp/react';
|
|
76
|
-
|
|
77
|
-
export interface ${pascal}ItemFields {
|
|
78
|
-
title: string;
|
|
79
|
-
description: string;
|
|
80
|
-
priority: 'low' | 'medium' | 'high';
|
|
81
|
-
createdAt: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default defineModel({
|
|
85
|
-
slug: '${modelSlug}',
|
|
86
|
-
version: '1.0.0',
|
|
87
|
-
category: ['model', '${name}'],
|
|
88
|
-
|
|
89
|
-
fields: {
|
|
90
|
-
title: { type: 'string', required: true },
|
|
91
|
-
description: { type: 'string', default: '' },
|
|
92
|
-
priority: { type: 'string', default: 'medium', enum: ['low', 'medium', 'high'] },
|
|
93
|
-
createdAt: { type: 'number', default: 0 },
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
states: {
|
|
97
|
-
draft: {
|
|
98
|
-
type: 'initial',
|
|
99
|
-
onEnter: [
|
|
100
|
-
{ id: 'set-created', type: 'set_field', mode: 'auto', config: { field: 'createdAt', expression: 'NOW()' } },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
active: {
|
|
104
|
-
onEnter: [
|
|
105
|
-
{ id: 'log-activated', type: 'log_event', mode: 'auto', config: { event: '${modelSlug}.activated' } },
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
archived: {
|
|
109
|
-
type: 'end',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
transitions: {
|
|
114
|
-
activate: {
|
|
115
|
-
from: 'draft',
|
|
116
|
-
to: 'active',
|
|
117
|
-
description: 'Publish this item',
|
|
118
|
-
},
|
|
119
|
-
archive: {
|
|
120
|
-
from: 'active',
|
|
121
|
-
to: 'archived',
|
|
122
|
-
description: 'Archive this item',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
function generateTsconfig() {
|
|
129
|
-
return JSON.stringify(
|
|
130
|
-
{
|
|
131
|
-
compilerOptions: {
|
|
132
|
-
target: "ES2020",
|
|
133
|
-
module: "ESNext",
|
|
134
|
-
moduleResolution: "bundler",
|
|
135
|
-
jsx: "react-jsx",
|
|
136
|
-
strict: true,
|
|
137
|
-
esModuleInterop: true,
|
|
138
|
-
skipLibCheck: true,
|
|
139
|
-
forceConsistentCasingInFileNames: true,
|
|
140
|
-
declaration: false,
|
|
141
|
-
noEmit: true
|
|
142
|
-
},
|
|
143
|
-
include: ["**/*.ts", "**/*.tsx"],
|
|
144
|
-
exclude: ["node_modules", "dist"]
|
|
145
|
-
},
|
|
146
|
-
null,
|
|
147
|
-
2
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
function generateLayout(name) {
|
|
151
|
-
const title = toTitleCase(name);
|
|
152
|
-
return `/**
|
|
153
|
-
* @workflow slug="${name}-layout" version="1.0.0" category="view"
|
|
154
|
-
*
|
|
155
|
-
* Root layout with sidebar navigation.
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
import {
|
|
159
|
-
Row,
|
|
160
|
-
Stack,
|
|
161
|
-
Slot,
|
|
162
|
-
Text,
|
|
163
|
-
Icon,
|
|
164
|
-
Button,
|
|
165
|
-
Divider,
|
|
166
|
-
} from '@mmapp/react/atoms';
|
|
167
|
-
import { useRouter } from '@mmapp/react';
|
|
168
|
-
|
|
169
|
-
export default function Layout({ children }: { children: React.ReactNode }) {
|
|
170
|
-
const router = useRouter();
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<Row gap={0} height="100vh" overflow="hidden">
|
|
174
|
-
{/* Sidebar */}
|
|
175
|
-
<Stack
|
|
176
|
-
width={240}
|
|
177
|
-
borderRight="1px solid token:border"
|
|
178
|
-
height="100vh"
|
|
179
|
-
background="token:surface"
|
|
180
|
-
>
|
|
181
|
-
<Row padding={12} gap={8} align="center" borderBottom="1px solid token:border">
|
|
182
|
-
<Icon name="box" size={20} color="token:primary" />
|
|
183
|
-
<Text variant="label" size="sm" value="${title}" />
|
|
184
|
-
</Row>
|
|
185
|
-
|
|
186
|
-
<Stack padding={8} gap={4}>
|
|
187
|
-
<Button variant="ghost" onPress={() => router.push('/')}>
|
|
188
|
-
<Row gap={8} align="center">
|
|
189
|
-
<Icon name="home" size={16} />
|
|
190
|
-
<Text size="sm" value="Home" />
|
|
191
|
-
</Row>
|
|
192
|
-
</Button>
|
|
193
|
-
<Button variant="ghost" onPress={() => router.push('/settings')}>
|
|
194
|
-
<Row gap={8} align="center">
|
|
195
|
-
<Icon name="settings" size={16} />
|
|
196
|
-
<Text size="sm" value="Settings" />
|
|
197
|
-
</Row>
|
|
198
|
-
</Button>
|
|
199
|
-
</Stack>
|
|
200
|
-
|
|
201
|
-
<Divider />
|
|
202
|
-
<Stack flex={1} />
|
|
203
|
-
<Row padding={12}>
|
|
204
|
-
<Text variant="muted" size="xs" value="v1.0.0" />
|
|
205
|
-
</Row>
|
|
206
|
-
</Stack>
|
|
207
|
-
|
|
208
|
-
{/* Main content */}
|
|
209
|
-
<Stack flex={1} overflow="auto">
|
|
210
|
-
{children}
|
|
211
|
-
</Stack>
|
|
212
|
-
</Row>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
`;
|
|
216
|
-
}
|
|
217
|
-
function generatePage(name) {
|
|
218
|
-
const title = toTitleCase(name);
|
|
219
|
-
const pascal = toPascalCase(name);
|
|
220
|
-
return `/**
|
|
221
|
-
* @workflow slug="${name}-home" version="1.0.0" category="page"
|
|
222
|
-
*
|
|
223
|
-
* Index page \u2014 lists items with create and search.
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
import { useState } from 'react';
|
|
227
|
-
import itemModel from '../models/item';
|
|
228
|
-
import {
|
|
229
|
-
useQuery, useMutation, useRouter,
|
|
230
|
-
Stack, Row, Text, Button, Icon, Card, Show, Each, TextInput, Badge,
|
|
231
|
-
} from '@mmapp/react';
|
|
232
|
-
|
|
233
|
-
const PRIORITY_COLORS: Record<string, string> = {
|
|
234
|
-
high: 'token:error',
|
|
235
|
-
medium: 'token:warning',
|
|
236
|
-
low: 'token:success',
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export default function ${pascal}Home() {
|
|
240
|
-
const { data: items, loading } = useQuery(itemModel);
|
|
241
|
-
const mutation = useMutation(itemModel);
|
|
242
|
-
const router = useRouter();
|
|
243
|
-
const [search, setSearch] = useState('');
|
|
244
|
-
|
|
245
|
-
const activeItems = items.filter(i => i.state !== 'archived');
|
|
246
|
-
const filtered = activeItems.filter(i =>
|
|
247
|
-
i.fields.title.toLowerCase().includes(search.toLowerCase())
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
const handleCreate = async () => {
|
|
251
|
-
await mutation.create({ title: 'New Item', priority: 'medium' });
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
return (
|
|
255
|
-
<Stack gap={24} padding={24}>
|
|
256
|
-
{/* Header */}
|
|
257
|
-
<Row justify="space-between" align="center">
|
|
258
|
-
<Stack gap={4}>
|
|
259
|
-
<Text variant="h3" weight="bold" value="${title}" />
|
|
260
|
-
<Text variant="muted" size="sm" value={\`\${activeItems.length} items\`} />
|
|
261
|
-
</Stack>
|
|
262
|
-
<Button variant="primary" onPress={handleCreate}>
|
|
263
|
-
<Row gap={6} align="center">
|
|
264
|
-
<Icon name="plus" size={16} />
|
|
265
|
-
<Text value="Add Item" />
|
|
266
|
-
</Row>
|
|
267
|
-
</Button>
|
|
268
|
-
</Row>
|
|
269
|
-
|
|
270
|
-
{/* Search */}
|
|
271
|
-
<TextInput
|
|
272
|
-
value={search}
|
|
273
|
-
onChange={setSearch}
|
|
274
|
-
placeholder="Search items..."
|
|
275
|
-
/>
|
|
276
|
-
|
|
277
|
-
{/* Loading */}
|
|
278
|
-
<Show when={loading}>
|
|
279
|
-
<Card padding={32}>
|
|
280
|
-
<Stack align="center">
|
|
281
|
-
<Text variant="muted" value="Loading..." />
|
|
282
|
-
</Stack>
|
|
283
|
-
</Card>
|
|
284
|
-
</Show>
|
|
285
|
-
|
|
286
|
-
{/* Empty state */}
|
|
287
|
-
<Show when={!loading && filtered.length === 0}>
|
|
288
|
-
<Card padding={32}>
|
|
289
|
-
<Stack align="center" gap={12}>
|
|
290
|
-
<Icon name="inbox" size={40} color="token:muted" />
|
|
291
|
-
<Text variant="muted" value="No items yet" />
|
|
292
|
-
<Button variant="outline" onPress={handleCreate}>
|
|
293
|
-
<Text value="Create your first item" />
|
|
294
|
-
</Button>
|
|
295
|
-
</Stack>
|
|
296
|
-
</Card>
|
|
297
|
-
</Show>
|
|
298
|
-
|
|
299
|
-
{/* Item list */}
|
|
300
|
-
<Show when={!loading && filtered.length > 0}>
|
|
301
|
-
<Stack gap={4}>
|
|
302
|
-
<Each items={filtered} keyField="id">
|
|
303
|
-
{(item) => (
|
|
304
|
-
<Card padding={12}>
|
|
305
|
-
<Row align="center" gap={12}>
|
|
306
|
-
<Stack flex={1} gap={2}>
|
|
307
|
-
<Text weight="medium" value={item.fields.title} />
|
|
308
|
-
<Show when={!!item.fields.description}>
|
|
309
|
-
<Text size="sm" variant="muted" value={item.fields.description} />
|
|
310
|
-
</Show>
|
|
311
|
-
</Stack>
|
|
312
|
-
<Badge value={item.fields.priority} />
|
|
313
|
-
<Badge value={item.state} variant={item.state === 'active' ? 'success' : 'default'} />
|
|
314
|
-
</Row>
|
|
315
|
-
</Card>
|
|
316
|
-
)}
|
|
317
|
-
</Each>
|
|
318
|
-
</Stack>
|
|
319
|
-
</Show>
|
|
320
|
-
</Stack>
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
`;
|
|
324
|
-
}
|
|
325
|
-
async function init(options) {
|
|
326
|
-
const { name } = options;
|
|
327
|
-
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
328
|
-
console.error(`[mmrc] Error: Blueprint name must be lowercase alphanumeric with hyphens (got "${name}")`);
|
|
329
|
-
process.exit(1);
|
|
330
|
-
}
|
|
331
|
-
const cwd = process.cwd();
|
|
332
|
-
const packagesDir = existsSync(join(cwd, "packages")) ? join(cwd, "packages") : cwd;
|
|
333
|
-
const blueprintDir = join(packagesDir, `blueprint-${name}`);
|
|
334
|
-
if (existsSync(blueprintDir)) {
|
|
335
|
-
console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
|
|
336
|
-
process.exit(1);
|
|
337
|
-
}
|
|
338
|
-
console.log(`[mmrc] Creating blueprint: ${name}
|
|
339
|
-
`);
|
|
340
|
-
mkdirSync(join(blueprintDir, "models"), { recursive: true });
|
|
341
|
-
mkdirSync(join(blueprintDir, "app"), { recursive: true });
|
|
342
|
-
const files = [
|
|
343
|
-
["package.json", generatePackageJson(name)],
|
|
344
|
-
["tsconfig.json", generateTsconfig()],
|
|
345
|
-
["mm.config.ts", generateMmConfig(name, options)],
|
|
346
|
-
["models/item.ts", generateModel(name)],
|
|
347
|
-
["app/layout.tsx", generateLayout(name)],
|
|
348
|
-
["app/page.tsx", generatePage(name)]
|
|
349
|
-
];
|
|
350
|
-
for (const [relPath, content] of files) {
|
|
351
|
-
const fullPath = join(blueprintDir, relPath);
|
|
352
|
-
writeFileSync(fullPath, content, "utf-8");
|
|
353
|
-
console.log(` + ${relPath}`);
|
|
354
|
-
}
|
|
355
|
-
const title = toTitleCase(name);
|
|
356
|
-
console.log(`
|
|
357
|
-
[mmrc] Blueprint "${title}" created at:
|
|
358
|
-
${blueprintDir}
|
|
359
|
-
|
|
360
|
-
Next steps:
|
|
361
|
-
1. cd ${blueprintDir.startsWith(cwd) ? blueprintDir.slice(cwd.length + 1) : blueprintDir}
|
|
362
|
-
2. mmrc dev # Start dev server
|
|
363
|
-
3. mmrc build # Compile to IR
|
|
364
|
-
4. mmrc deploy --build # Build + deploy to backend
|
|
365
|
-
`);
|
|
366
|
-
}
|
|
367
|
-
export {
|
|
368
|
-
init
|
|
369
|
-
};
|
package/dist/init-IXEE2RCF.mjs
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import "./chunk-Y6FXYEAI.mjs";
|
|
2
|
-
|
|
3
|
-
// src/cli/init.ts
|
|
4
|
-
import { mkdirSync, writeFileSync, existsSync } from "fs";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
function toTitleCase(slug) {
|
|
7
|
-
return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
8
|
-
}
|
|
9
|
-
function toPascalCase(slug) {
|
|
10
|
-
return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
11
|
-
}
|
|
12
|
-
function generatePackageJson(name) {
|
|
13
|
-
return JSON.stringify(
|
|
14
|
-
{
|
|
15
|
-
name: `@mindmatrix/blueprint-${name}`,
|
|
16
|
-
version: "0.1.0",
|
|
17
|
-
private: true,
|
|
18
|
-
type: "module",
|
|
19
|
-
scripts: {
|
|
20
|
-
build: "mmrc build --src . --out dist",
|
|
21
|
-
dev: "mmrc dev --src . --port 5199",
|
|
22
|
-
deploy: "mmrc deploy --build --src ."
|
|
23
|
-
},
|
|
24
|
-
dependencies: {
|
|
25
|
-
"@mindmatrix/react": "workspace:*"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
null,
|
|
29
|
-
2
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
function generateMmConfig(name, opts) {
|
|
33
|
-
const title = toTitleCase(name);
|
|
34
|
-
const desc = opts.description ?? `${title} blueprint.`;
|
|
35
|
-
const icon = opts.icon ?? "box";
|
|
36
|
-
const author = opts.author ?? "MindMatrix";
|
|
37
|
-
return `import { defineBlueprint } from '@mindmatrix/react';
|
|
38
|
-
|
|
39
|
-
export default defineBlueprint({
|
|
40
|
-
slug: '${name}',
|
|
41
|
-
name: '${title}',
|
|
42
|
-
version: '1.0.0',
|
|
43
|
-
description: '${desc}',
|
|
44
|
-
author: '${author}',
|
|
45
|
-
icon: '${icon}',
|
|
46
|
-
mode: 'infer',
|
|
47
|
-
defaultRuntime: 'collaborative',
|
|
48
|
-
|
|
49
|
-
models: [
|
|
50
|
-
'models/item',
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
routes: [
|
|
54
|
-
{ path: '/', view: 'app/page', label: 'Home' },
|
|
55
|
-
],
|
|
56
|
-
|
|
57
|
-
dependencies: [],
|
|
58
|
-
});
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
function generateModel(name) {
|
|
62
|
-
const modelSlug = `${name}-item`;
|
|
63
|
-
const pascal = toPascalCase(name);
|
|
64
|
-
return `/**
|
|
65
|
-
* ${pascal} Item \u2014 data model with lifecycle states.
|
|
66
|
-
*
|
|
67
|
-
* States: draft \u2192 active \u2192 archived
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
import { defineModel } from '@mindmatrix/react';
|
|
71
|
-
|
|
72
|
-
export interface ${pascal}ItemFields {
|
|
73
|
-
title: string;
|
|
74
|
-
description: string;
|
|
75
|
-
priority: 'low' | 'medium' | 'high';
|
|
76
|
-
createdAt: number;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default defineModel({
|
|
80
|
-
slug: '${modelSlug}',
|
|
81
|
-
version: '1.0.0',
|
|
82
|
-
category: ['model', '${name}'],
|
|
83
|
-
|
|
84
|
-
fields: {
|
|
85
|
-
title: { type: 'string', required: true },
|
|
86
|
-
description: { type: 'string', default: '' },
|
|
87
|
-
priority: { type: 'string', default: 'medium', enum: ['low', 'medium', 'high'] },
|
|
88
|
-
createdAt: { type: 'number', default: 0 },
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
states: {
|
|
92
|
-
draft: {
|
|
93
|
-
type: 'initial',
|
|
94
|
-
onEnter: [
|
|
95
|
-
{ id: 'set-created', type: 'set_field', mode: 'auto', config: { field: 'createdAt', expression: 'NOW()' } },
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
active: {
|
|
99
|
-
onEnter: [
|
|
100
|
-
{ id: 'log-activated', type: 'log_event', mode: 'auto', config: { event: '${modelSlug}.activated' } },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
archived: {
|
|
104
|
-
type: 'end',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
transitions: {
|
|
109
|
-
activate: {
|
|
110
|
-
from: 'draft',
|
|
111
|
-
to: 'active',
|
|
112
|
-
description: 'Publish this item',
|
|
113
|
-
},
|
|
114
|
-
archive: {
|
|
115
|
-
from: 'active',
|
|
116
|
-
to: 'archived',
|
|
117
|
-
description: 'Archive this item',
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
`;
|
|
122
|
-
}
|
|
123
|
-
function generateLayout(name) {
|
|
124
|
-
const title = toTitleCase(name);
|
|
125
|
-
return `/**
|
|
126
|
-
* @workflow slug="${name}-layout" version="1.0.0" category="view"
|
|
127
|
-
*
|
|
128
|
-
* Root layout with sidebar navigation.
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
import {
|
|
132
|
-
Row,
|
|
133
|
-
Stack,
|
|
134
|
-
Slot,
|
|
135
|
-
Text,
|
|
136
|
-
Icon,
|
|
137
|
-
Button,
|
|
138
|
-
Divider,
|
|
139
|
-
} from '@mindmatrix/react/atoms';
|
|
140
|
-
import { useRouter } from '@mindmatrix/react';
|
|
141
|
-
|
|
142
|
-
export default function Layout({ children }: { children: React.ReactNode }) {
|
|
143
|
-
const router = useRouter();
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<Row gap={0} height="100vh" overflow="hidden">
|
|
147
|
-
{/* Sidebar */}
|
|
148
|
-
<Stack
|
|
149
|
-
width={240}
|
|
150
|
-
borderRight="1px solid token:border"
|
|
151
|
-
height="100vh"
|
|
152
|
-
background="token:surface"
|
|
153
|
-
>
|
|
154
|
-
<Row padding={12} gap={8} align="center" borderBottom="1px solid token:border">
|
|
155
|
-
<Icon name="box" size={20} color="token:primary" />
|
|
156
|
-
<Text variant="label" size="sm" value="${title}" />
|
|
157
|
-
</Row>
|
|
158
|
-
|
|
159
|
-
<Stack padding={8} gap={4}>
|
|
160
|
-
<Button variant="ghost" onPress={() => router.push('/')}>
|
|
161
|
-
<Row gap={8} align="center">
|
|
162
|
-
<Icon name="home" size={16} />
|
|
163
|
-
<Text size="sm" value="Home" />
|
|
164
|
-
</Row>
|
|
165
|
-
</Button>
|
|
166
|
-
<Button variant="ghost" onPress={() => router.push('/settings')}>
|
|
167
|
-
<Row gap={8} align="center">
|
|
168
|
-
<Icon name="settings" size={16} />
|
|
169
|
-
<Text size="sm" value="Settings" />
|
|
170
|
-
</Row>
|
|
171
|
-
</Button>
|
|
172
|
-
</Stack>
|
|
173
|
-
|
|
174
|
-
<Divider />
|
|
175
|
-
<Stack flex={1} />
|
|
176
|
-
<Row padding={12}>
|
|
177
|
-
<Text variant="muted" size="xs" value="v1.0.0" />
|
|
178
|
-
</Row>
|
|
179
|
-
</Stack>
|
|
180
|
-
|
|
181
|
-
{/* Main content */}
|
|
182
|
-
<Stack flex={1} overflow="auto">
|
|
183
|
-
{children}
|
|
184
|
-
</Stack>
|
|
185
|
-
</Row>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
`;
|
|
189
|
-
}
|
|
190
|
-
function generatePage(name) {
|
|
191
|
-
const title = toTitleCase(name);
|
|
192
|
-
const pascal = toPascalCase(name);
|
|
193
|
-
return `/**
|
|
194
|
-
* @workflow slug="${name}-home" version="1.0.0" category="page"
|
|
195
|
-
*
|
|
196
|
-
* Index page \u2014 lists items with create and search.
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
import itemModel from '../models/item';
|
|
200
|
-
import {
|
|
201
|
-
useQuery, useMutation, useRouter, useState,
|
|
202
|
-
Stack, Row, Text, Button, Icon, Card, Show, Each, TextInput, Badge,
|
|
203
|
-
} from '@mindmatrix/react';
|
|
204
|
-
|
|
205
|
-
const PRIORITY_COLORS: Record<string, string> = {
|
|
206
|
-
high: 'token:error',
|
|
207
|
-
medium: 'token:warning',
|
|
208
|
-
low: 'token:success',
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export default function ${pascal}Home() {
|
|
212
|
-
const { data: items, loading } = useQuery(itemModel);
|
|
213
|
-
const mutation = useMutation(itemModel);
|
|
214
|
-
const router = useRouter();
|
|
215
|
-
const [search, setSearch] = useState('');
|
|
216
|
-
|
|
217
|
-
const activeItems = items.filter(i => i.state !== 'archived');
|
|
218
|
-
const filtered = activeItems.filter(i =>
|
|
219
|
-
i.fields.title.toLowerCase().includes(search.toLowerCase())
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
const handleCreate = async () => {
|
|
223
|
-
await mutation.create({ title: 'New Item', priority: 'medium' });
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<Stack gap={24} padding={24}>
|
|
228
|
-
{/* Header */}
|
|
229
|
-
<Row justify="space-between" align="center">
|
|
230
|
-
<Stack gap={4}>
|
|
231
|
-
<Text variant="h3" weight="bold" value="${title}" />
|
|
232
|
-
<Text variant="muted" size="sm" value={\`\${activeItems.length} items\`} />
|
|
233
|
-
</Stack>
|
|
234
|
-
<Button variant="primary" onPress={handleCreate}>
|
|
235
|
-
<Row gap={6} align="center">
|
|
236
|
-
<Icon name="plus" size={16} />
|
|
237
|
-
<Text value="Add Item" />
|
|
238
|
-
</Row>
|
|
239
|
-
</Button>
|
|
240
|
-
</Row>
|
|
241
|
-
|
|
242
|
-
{/* Search */}
|
|
243
|
-
<TextInput
|
|
244
|
-
value={search}
|
|
245
|
-
onChange={setSearch}
|
|
246
|
-
placeholder="Search items..."
|
|
247
|
-
/>
|
|
248
|
-
|
|
249
|
-
{/* Loading */}
|
|
250
|
-
<Show when={loading}>
|
|
251
|
-
<Card padding={32}>
|
|
252
|
-
<Stack align="center">
|
|
253
|
-
<Text variant="muted" value="Loading..." />
|
|
254
|
-
</Stack>
|
|
255
|
-
</Card>
|
|
256
|
-
</Show>
|
|
257
|
-
|
|
258
|
-
{/* Empty state */}
|
|
259
|
-
<Show when={!loading && filtered.length === 0}>
|
|
260
|
-
<Card padding={32}>
|
|
261
|
-
<Stack align="center" gap={12}>
|
|
262
|
-
<Icon name="inbox" size={40} color="token:muted" />
|
|
263
|
-
<Text variant="muted" value="No items yet" />
|
|
264
|
-
<Button variant="outline" onPress={handleCreate}>
|
|
265
|
-
<Text value="Create your first item" />
|
|
266
|
-
</Button>
|
|
267
|
-
</Stack>
|
|
268
|
-
</Card>
|
|
269
|
-
</Show>
|
|
270
|
-
|
|
271
|
-
{/* Item list */}
|
|
272
|
-
<Show when={!loading && filtered.length > 0}>
|
|
273
|
-
<Stack gap={4}>
|
|
274
|
-
<Each items={filtered} keyField="id">
|
|
275
|
-
{(item) => (
|
|
276
|
-
<Card padding={12}>
|
|
277
|
-
<Row align="center" gap={12}>
|
|
278
|
-
<Stack flex={1} gap={2}>
|
|
279
|
-
<Text weight="medium" value={item.fields.title} />
|
|
280
|
-
<Show when={!!item.fields.description}>
|
|
281
|
-
<Text size="sm" variant="muted" value={item.fields.description} />
|
|
282
|
-
</Show>
|
|
283
|
-
</Stack>
|
|
284
|
-
<Badge value={item.fields.priority} />
|
|
285
|
-
<Badge value={item.state} variant={item.state === 'active' ? 'success' : 'default'} />
|
|
286
|
-
</Row>
|
|
287
|
-
</Card>
|
|
288
|
-
)}
|
|
289
|
-
</Each>
|
|
290
|
-
</Stack>
|
|
291
|
-
</Show>
|
|
292
|
-
</Stack>
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
`;
|
|
296
|
-
}
|
|
297
|
-
async function init(options) {
|
|
298
|
-
const { name } = options;
|
|
299
|
-
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
300
|
-
console.error(`[mmrc] Error: Blueprint name must be lowercase alphanumeric with hyphens (got "${name}")`);
|
|
301
|
-
process.exit(1);
|
|
302
|
-
}
|
|
303
|
-
const cwd = process.cwd();
|
|
304
|
-
const packagesDir = existsSync(join(cwd, "packages")) ? join(cwd, "packages") : cwd;
|
|
305
|
-
const blueprintDir = join(packagesDir, `blueprint-${name}`);
|
|
306
|
-
if (existsSync(blueprintDir)) {
|
|
307
|
-
console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
|
|
308
|
-
process.exit(1);
|
|
309
|
-
}
|
|
310
|
-
console.log(`[mmrc] Creating blueprint: ${name}
|
|
311
|
-
`);
|
|
312
|
-
mkdirSync(join(blueprintDir, "models"), { recursive: true });
|
|
313
|
-
mkdirSync(join(blueprintDir, "app"), { recursive: true });
|
|
314
|
-
const files = [
|
|
315
|
-
["package.json", generatePackageJson(name)],
|
|
316
|
-
["mm.config.ts", generateMmConfig(name, options)],
|
|
317
|
-
["models/item.ts", generateModel(name)],
|
|
318
|
-
["app/layout.tsx", generateLayout(name)],
|
|
319
|
-
["app/page.tsx", generatePage(name)]
|
|
320
|
-
];
|
|
321
|
-
for (const [relPath, content] of files) {
|
|
322
|
-
const fullPath = join(blueprintDir, relPath);
|
|
323
|
-
writeFileSync(fullPath, content, "utf-8");
|
|
324
|
-
console.log(` + ${relPath}`);
|
|
325
|
-
}
|
|
326
|
-
const title = toTitleCase(name);
|
|
327
|
-
console.log(`
|
|
328
|
-
[mmrc] Blueprint "${title}" created at:
|
|
329
|
-
${blueprintDir}
|
|
330
|
-
|
|
331
|
-
Next steps:
|
|
332
|
-
1. cd ${blueprintDir.startsWith(cwd) ? blueprintDir.slice(cwd.length + 1) : blueprintDir}
|
|
333
|
-
2. mmrc dev # Start dev server
|
|
334
|
-
3. mmrc build # Compile to IR
|
|
335
|
-
4. mmrc deploy --build # Build + deploy to backend
|
|
336
|
-
`);
|
|
337
|
-
}
|
|
338
|
-
export {
|
|
339
|
-
init
|
|
340
|
-
};
|