create-mikstack 0.1.16 → 0.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mikstack",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,7 +4,7 @@ import { zql } from "./schema";
4
4
  export const queries = defineQueries({
5
5
  note: {
6
6
  mine: defineQuery(({ ctx }) =>
7
- zql.note.where("userId", ctx.userID).orderBy("updatedAt", "desc"),
7
+ zql.note.where("userId", ctx.userID).orderBy("createdAt", "desc"),
8
8
  ),
9
9
  },
10
10
  inAppNotification: {
@@ -25,6 +25,17 @@
25
25
  const notesQuery = z.q(queries.note.mine());
26
26
  const notes = $derived(notesQuery.data);
27
27
 
28
+ const isMac = $derived(navigator.platform.startsWith("Mac") || navigator.platform === "iPhone");
29
+ const isMobile = $derived(/Android|iPhone|iPad|iPod/i.test(navigator.userAgent));
30
+ const modLabel = $derived(isMac ? "⌘" : "Ctrl");
31
+
32
+ function submitOnModEnter(e: KeyboardEvent) {
33
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
34
+ e.preventDefault();
35
+ (e.currentTarget as HTMLFormElement).requestSubmit();
36
+ }
37
+ }
38
+
28
39
  let editingId = $state<string | null>(null);
29
40
 
30
41
  const noteSchema = v.object({
@@ -107,7 +118,7 @@
107
118
 
108
119
  <section>
109
120
  <h2>New note</h2>
110
- <form id={createNoteForm.id} onsubmit={createNoteForm.onsubmit} class="note-form">
121
+ <form id={createNoteForm.id} onsubmit={createNoteForm.onsubmit} onkeydown={submitOnModEnter} class="note-form">
111
122
  <FormField for={createNoteForm.fields.title.as("text").id}>
112
123
  {#snippet label(attrs)}
113
124
  <label {...attrs}>Title</label>
@@ -129,12 +140,6 @@
129
140
  id="{createNoteForm.id}-content"
130
141
  oninput={(e) =>
131
142
  createNoteForm.fields.content.set((e.target as HTMLTextAreaElement).value)}
132
- onkeydown={(e) => {
133
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
134
- e.preventDefault();
135
- document.getElementById(createNoteForm.id)?.requestSubmit();
136
- }
137
- }}
138
143
  value={createNoteForm.fields.content.value() as string}
139
144
  placeholder="Write something..."
140
145
  />
@@ -146,7 +151,8 @@
146
151
 
147
152
  <Button type="submit" disabled={createNoteForm.pending}>
148
153
  <Plus size={16} weight="bold" />
149
- {createNoteForm.pending ? "Creating..." : "Create note"} <kbd>Ctrl+Enter</kbd>
154
+ {createNoteForm.pending ? "Creating..." : "Create note"}
155
+ {#if !isMobile}<kbd>{modLabel}+Enter</kbd>{/if}
150
156
  </Button>
151
157
  </form>
152
158
  </section>
@@ -162,7 +168,7 @@
162
168
  {#each notes as note (note.id)}
163
169
  <li class="note-card">
164
170
  {#if editingId === note.id}
165
- <form id={editForm.id} onsubmit={editForm.onsubmit} class="note-form">
171
+ <form id={editForm.id} onsubmit={editForm.onsubmit} onkeydown={submitOnModEnter} class="note-form">
166
172
  <FormField for={editForm.fields.title.as("text").id}>
167
173
  {#snippet label(attrs)}
168
174
  <label {...attrs}>Title</label>
@@ -184,13 +190,8 @@
184
190
  id="{editForm.id}-content"
185
191
  oninput={(e) =>
186
192
  editForm.fields.content.set((e.target as HTMLTextAreaElement).value)}
187
- onkeydown={(e) => {
188
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
189
- e.preventDefault();
190
- document.getElementById(editForm.id)?.requestSubmit();
191
- }
192
- }}
193
193
  value={editForm.fields.content.value() as string}
194
+ autofocus
194
195
  />
195
196
  </FormField>
196
197
 
@@ -201,6 +202,7 @@
201
202
  <div class="actions">
202
203
  <Button type="submit" disabled={editForm.pending}>
203
204
  {editForm.pending ? "Saving..." : "Save"}
205
+ {#if !isMobile}<kbd>{modLabel}+Enter</kbd>{/if}
204
206
  </Button>
205
207
  <Button variant="ghost" type="button" onclick={cancelEdit}>
206
208
  <X size={16} weight="bold" /> Cancel
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "svelte": {
4
+ "type": "stdio",
5
+ "command": "bunx",
6
+ "args": ["@sveltejs/mcp"]
7
+ },
8
+ "chrome-devtools": {
9
+ "command": "bunx",
10
+ "args": ["chrome-devtools-mcp@latest"]
11
+ }
12
+ }
13
+ }
@@ -4,6 +4,10 @@
4
4
  "type": "stdio",
5
5
  "command": "npx",
6
6
  "args": ["-y", "@sveltejs/mcp"]
7
+ },
8
+ "chrome-devtools": {
9
+ "command": "npx",
10
+ "args": ["-y", "chrome-devtools-mcp@latest"]
7
11
  }
8
12
  }
9
13
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "svelte": {
4
+ "type": "stdio",
5
+ "command": "pnpx",
6
+ "args": ["@sveltejs/mcp"]
7
+ },
8
+ "chrome-devtools": {
9
+ "command": "pnpx",
10
+ "args": ["chrome-devtools-mcp@latest"]
11
+ }
12
+ }
13
+ }