moriajs 0.1.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 +380 -0
- package/apps/playground/dist/index.d.ts +8 -0
- package/apps/playground/dist/index.d.ts.map +1 -0
- package/apps/playground/dist/index.js +36 -0
- package/apps/playground/dist/index.js.map +1 -0
- package/apps/playground/node_modules/.bin/rimraf +17 -0
- package/apps/playground/node_modules/.bin/rimraf.CMD +12 -0
- package/apps/playground/node_modules/.bin/rimraf.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsc +17 -0
- package/apps/playground/node_modules/.bin/tsc.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsc.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsserver +17 -0
- package/apps/playground/node_modules/.bin/tsserver.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsserver.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsx +17 -0
- package/apps/playground/node_modules/.bin/tsx.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsx.ps1 +41 -0
- package/apps/playground/package.json +25 -0
- package/apps/playground/src/index.ts +41 -0
- package/apps/playground/tsconfig.json +10 -0
- package/package.json +23 -0
- package/packages/auth/dist/index.d.ts +84 -0
- package/packages/auth/dist/index.d.ts.map +1 -0
- package/packages/auth/dist/index.js +78 -0
- package/packages/auth/dist/index.js.map +1 -0
- package/packages/auth/node_modules/.bin/rimraf +17 -0
- package/packages/auth/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/auth/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsc +17 -0
- package/packages/auth/node_modules/.bin/tsc.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsserver +17 -0
- package/packages/auth/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/auth/package.json +34 -0
- package/packages/auth/src/index.ts +138 -0
- package/packages/auth/tsconfig.json +10 -0
- package/packages/cli/dist/bin.d.ts +7 -0
- package/packages/cli/dist/bin.d.ts.map +1 -0
- package/packages/cli/dist/bin.js +8 -0
- package/packages/cli/dist/bin.js.map +1 -0
- package/packages/cli/dist/index.d.ts +8 -0
- package/packages/cli/dist/index.d.ts.map +1 -0
- package/packages/cli/dist/index.js +60 -0
- package/packages/cli/dist/index.js.map +1 -0
- package/packages/cli/node_modules/.bin/rimraf +17 -0
- package/packages/cli/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/cli/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsc +17 -0
- package/packages/cli/node_modules/.bin/tsc.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsserver +17 -0
- package/packages/cli/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/cli/package.json +33 -0
- package/packages/cli/src/bin.ts +10 -0
- package/packages/cli/src/index.ts +71 -0
- package/packages/cli/tsconfig.json +10 -0
- package/packages/core/dist/app.d.ts +42 -0
- package/packages/core/dist/app.d.ts.map +1 -0
- package/packages/core/dist/app.js +65 -0
- package/packages/core/dist/app.js.map +1 -0
- package/packages/core/dist/config.d.ts +61 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +18 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/index.d.ts +13 -0
- package/packages/core/dist/index.d.ts.map +1 -0
- package/packages/core/dist/index.js +10 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/core/dist/plugins.d.ts +38 -0
- package/packages/core/dist/plugins.d.ts.map +1 -0
- package/packages/core/dist/plugins.js +19 -0
- package/packages/core/dist/plugins.js.map +1 -0
- package/packages/core/node_modules/.bin/pino-pretty +17 -0
- package/packages/core/node_modules/.bin/pino-pretty.CMD +12 -0
- package/packages/core/node_modules/.bin/pino-pretty.ps1 +41 -0
- package/packages/core/node_modules/.bin/rimraf +17 -0
- package/packages/core/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/core/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsc +17 -0
- package/packages/core/node_modules/.bin/tsc.CMD +12 -0
- package/packages/core/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsserver +17 -0
- package/packages/core/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/core/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/core/package.json +35 -0
- package/packages/core/src/app.ts +103 -0
- package/packages/core/src/config.ts +66 -0
- package/packages/core/src/index.ts +14 -0
- package/packages/core/src/plugins.ts +42 -0
- package/packages/core/tsconfig.json +10 -0
- package/packages/create-moria/dist/bin.d.ts +7 -0
- package/packages/create-moria/dist/bin.d.ts.map +1 -0
- package/packages/create-moria/dist/bin.js +8 -0
- package/packages/create-moria/dist/bin.js.map +1 -0
- package/packages/create-moria/dist/index.d.ts +13 -0
- package/packages/create-moria/dist/index.d.ts.map +1 -0
- package/packages/create-moria/dist/index.js +142 -0
- package/packages/create-moria/dist/index.js.map +1 -0
- package/packages/create-moria/node_modules/.bin/rimraf +17 -0
- package/packages/create-moria/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsc +17 -0
- package/packages/create-moria/node_modules/.bin/tsc.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsserver +17 -0
- package/packages/create-moria/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/create-moria/package.json +28 -0
- package/packages/create-moria/src/bin.ts +10 -0
- package/packages/create-moria/src/index.ts +168 -0
- package/packages/create-moria/tsconfig.json +10 -0
- package/packages/db/dist/index.d.ts +71 -0
- package/packages/db/dist/index.d.ts.map +1 -0
- package/packages/db/dist/index.js +89 -0
- package/packages/db/dist/index.js.map +1 -0
- package/packages/db/node_modules/.bin/rimraf +17 -0
- package/packages/db/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/db/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsc +17 -0
- package/packages/db/node_modules/.bin/tsc.CMD +12 -0
- package/packages/db/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsserver +17 -0
- package/packages/db/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/db/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/db/package.json +37 -0
- package/packages/db/src/index.ts +119 -0
- package/packages/db/tsconfig.json +10 -0
- package/packages/renderer/dist/index.d.ts +55 -0
- package/packages/renderer/dist/index.d.ts.map +1 -0
- package/packages/renderer/dist/index.js +85 -0
- package/packages/renderer/dist/index.js.map +1 -0
- package/packages/renderer/node_modules/.bin/rimraf +17 -0
- package/packages/renderer/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/renderer/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsc +17 -0
- package/packages/renderer/node_modules/.bin/tsc.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsserver +17 -0
- package/packages/renderer/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/renderer/package.json +34 -0
- package/packages/renderer/src/index.ts +110 -0
- package/packages/renderer/tsconfig.json +14 -0
- package/packages/ui/dist/index.d.ts +76 -0
- package/packages/ui/dist/index.d.ts.map +1 -0
- package/packages/ui/dist/index.js +176 -0
- package/packages/ui/dist/index.js.map +1 -0
- package/packages/ui/node_modules/.bin/rimraf +17 -0
- package/packages/ui/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/ui/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsc +17 -0
- package/packages/ui/node_modules/.bin/tsc.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsserver +17 -0
- package/packages/ui/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/ui/package.json +29 -0
- package/packages/ui/src/index.ts +230 -0
- package/packages/ui/tsconfig.json +16 -0
- package/pnpm-workspace.yaml +3 -0
- package/tsconfig.base.json +25 -0
- package/turbo.json +35 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @moriajs/ui
|
|
3
|
+
*
|
|
4
|
+
* UI component library for Mithril.js.
|
|
5
|
+
* Includes toaster notifications, modals, and layout primitives.
|
|
6
|
+
* CSS-framework agnostic — ships its own minimal styles.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import m from 'mithril';
|
|
10
|
+
|
|
11
|
+
// ─── Toaster ────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
14
|
+
|
|
15
|
+
export interface Toast {
|
|
16
|
+
id: string;
|
|
17
|
+
message: string;
|
|
18
|
+
type: ToastType;
|
|
19
|
+
duration?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Internal toast state */
|
|
23
|
+
const toasts: Toast[] = [];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Show a toast notification.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { toast } from '@moriajs/ui';
|
|
31
|
+
*
|
|
32
|
+
* toast.success('Saved successfully!');
|
|
33
|
+
* toast.error('Something went wrong');
|
|
34
|
+
* toast.info('New update available');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const toast = {
|
|
38
|
+
show(message: string, type: ToastType = 'info', duration = 3000) {
|
|
39
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
40
|
+
toasts.push({ id, message, type, duration });
|
|
41
|
+
m.redraw();
|
|
42
|
+
|
|
43
|
+
if (duration > 0) {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
const index = toasts.findIndex((t) => t.id === id);
|
|
46
|
+
if (index !== -1) {
|
|
47
|
+
toasts.splice(index, 1);
|
|
48
|
+
m.redraw();
|
|
49
|
+
}
|
|
50
|
+
}, duration);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return id;
|
|
54
|
+
},
|
|
55
|
+
success(message: string, duration?: number) {
|
|
56
|
+
return this.show(message, 'success', duration);
|
|
57
|
+
},
|
|
58
|
+
error(message: string, duration?: number) {
|
|
59
|
+
return this.show(message, 'error', duration);
|
|
60
|
+
},
|
|
61
|
+
warning(message: string, duration?: number) {
|
|
62
|
+
return this.show(message, 'warning', duration);
|
|
63
|
+
},
|
|
64
|
+
info(message: string, duration?: number) {
|
|
65
|
+
return this.show(message, 'info', duration);
|
|
66
|
+
},
|
|
67
|
+
dismiss(id: string) {
|
|
68
|
+
const index = toasts.findIndex((t) => t.id === id);
|
|
69
|
+
if (index !== -1) {
|
|
70
|
+
toasts.splice(index, 1);
|
|
71
|
+
m.redraw();
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
clear() {
|
|
75
|
+
toasts.length = 0;
|
|
76
|
+
m.redraw();
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const TOAST_COLORS: Record<ToastType, string> = {
|
|
81
|
+
success: '#16a34a',
|
|
82
|
+
error: '#dc2626',
|
|
83
|
+
warning: '#d97706',
|
|
84
|
+
info: '#2563eb',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Toaster container component.
|
|
89
|
+
* Mount once in your app layout.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* import { Toaster } from '@moriajs/ui';
|
|
94
|
+
* m(Toaster); // Place in your root layout
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export const Toaster: m.Component = {
|
|
98
|
+
view() {
|
|
99
|
+
return m(
|
|
100
|
+
'.moria-toaster',
|
|
101
|
+
{
|
|
102
|
+
style: {
|
|
103
|
+
position: 'fixed',
|
|
104
|
+
top: '1rem',
|
|
105
|
+
right: '1rem',
|
|
106
|
+
zIndex: '9999',
|
|
107
|
+
display: 'flex',
|
|
108
|
+
flexDirection: 'column',
|
|
109
|
+
gap: '0.5rem',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
toasts.map((t) =>
|
|
113
|
+
m(
|
|
114
|
+
'.moria-toast',
|
|
115
|
+
{
|
|
116
|
+
key: t.id,
|
|
117
|
+
'data-type': t.type,
|
|
118
|
+
style: {
|
|
119
|
+
padding: '0.75rem 1rem',
|
|
120
|
+
borderRadius: '0.5rem',
|
|
121
|
+
color: '#fff',
|
|
122
|
+
fontSize: '0.875rem',
|
|
123
|
+
minWidth: '250px',
|
|
124
|
+
cursor: 'pointer',
|
|
125
|
+
background: TOAST_COLORS[t.type],
|
|
126
|
+
},
|
|
127
|
+
onclick: () => toast.dismiss(t.id),
|
|
128
|
+
},
|
|
129
|
+
t.message
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// ─── Modal ──────────────────────────────────────────
|
|
137
|
+
|
|
138
|
+
export interface ModalAttrs {
|
|
139
|
+
/** Whether the modal is visible */
|
|
140
|
+
isOpen: boolean;
|
|
141
|
+
/** Callback when modal is closed */
|
|
142
|
+
onClose: () => void;
|
|
143
|
+
/** Modal title */
|
|
144
|
+
title?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Modal dialog component.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* import { Modal } from '@moriajs/ui';
|
|
153
|
+
*
|
|
154
|
+
* let showModal = false;
|
|
155
|
+
*
|
|
156
|
+
* m(Modal, {
|
|
157
|
+
* isOpen: showModal,
|
|
158
|
+
* onClose: () => { showModal = false; },
|
|
159
|
+
* title: 'Confirm Action',
|
|
160
|
+
* }, [
|
|
161
|
+
* m('p', 'Are you sure?'),
|
|
162
|
+
* m('button', { onclick: () => { showModal = false; } }, 'Yes'),
|
|
163
|
+
* ]);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export const Modal: m.Component<ModalAttrs> = {
|
|
167
|
+
view(vnode) {
|
|
168
|
+
if (!vnode.attrs.isOpen) return m('div', { style: { display: 'none' } });
|
|
169
|
+
|
|
170
|
+
return m(
|
|
171
|
+
'.moria-modal-overlay',
|
|
172
|
+
{
|
|
173
|
+
style: {
|
|
174
|
+
position: 'fixed',
|
|
175
|
+
inset: '0',
|
|
176
|
+
background: 'rgba(0,0,0,0.5)',
|
|
177
|
+
display: 'flex',
|
|
178
|
+
alignItems: 'center',
|
|
179
|
+
justifyContent: 'center',
|
|
180
|
+
zIndex: '9998',
|
|
181
|
+
},
|
|
182
|
+
onclick: (e: MouseEvent) => {
|
|
183
|
+
if (e.target === e.currentTarget) vnode.attrs.onClose();
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
m(
|
|
187
|
+
'.moria-modal',
|
|
188
|
+
{
|
|
189
|
+
style: {
|
|
190
|
+
background: '#fff',
|
|
191
|
+
borderRadius: '0.75rem',
|
|
192
|
+
padding: '1.5rem',
|
|
193
|
+
minWidth: '400px',
|
|
194
|
+
maxWidth: '90vw',
|
|
195
|
+
maxHeight: '90vh',
|
|
196
|
+
overflowY: 'auto',
|
|
197
|
+
boxShadow: '0 25px 50px -12px rgba(0,0,0,0.25)',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
[
|
|
201
|
+
vnode.attrs.title
|
|
202
|
+
? m(
|
|
203
|
+
'.moria-modal-header',
|
|
204
|
+
{
|
|
205
|
+
style: {
|
|
206
|
+
display: 'flex',
|
|
207
|
+
justifyContent: 'space-between',
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
marginBottom: '1rem',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
[
|
|
213
|
+
m('h2', { style: { margin: '0', fontSize: '1.25rem', fontWeight: '600' } }, vnode.attrs.title),
|
|
214
|
+
m(
|
|
215
|
+
'button',
|
|
216
|
+
{
|
|
217
|
+
style: { background: 'none', border: 'none', fontSize: '1.5rem', cursor: 'pointer', color: '#6b7280' },
|
|
218
|
+
onclick: vnode.attrs.onClose,
|
|
219
|
+
},
|
|
220
|
+
'×'
|
|
221
|
+
),
|
|
222
|
+
]
|
|
223
|
+
)
|
|
224
|
+
: m('span'),
|
|
225
|
+
m('.moria-modal-body', vnode.children as m.Children),
|
|
226
|
+
]
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022"
|
|
8
|
+
],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"rootDir": "src"
|
|
20
|
+
},
|
|
21
|
+
"exclude": [
|
|
22
|
+
"node_modules",
|
|
23
|
+
"dist"
|
|
24
|
+
]
|
|
25
|
+
}
|
package/turbo.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turbo.build/schema.json",
|
|
3
|
+
"tasks": {
|
|
4
|
+
"build": {
|
|
5
|
+
"dependsOn": [
|
|
6
|
+
"^build"
|
|
7
|
+
],
|
|
8
|
+
"outputs": [
|
|
9
|
+
"dist/**"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"dev": {
|
|
13
|
+
"cache": false,
|
|
14
|
+
"persistent": true
|
|
15
|
+
},
|
|
16
|
+
"lint": {
|
|
17
|
+
"dependsOn": [
|
|
18
|
+
"^build"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"test": {
|
|
22
|
+
"dependsOn": [
|
|
23
|
+
"build"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"typecheck": {
|
|
27
|
+
"dependsOn": [
|
|
28
|
+
"^build"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"clean": {
|
|
32
|
+
"cache": false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|