mikuru 1.0.4 → 1.0.6
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/CHANGELOG.md +13 -0
- package/README.md +200 -179
- package/dist/cli.js +28 -10
- package/dist/cli.js.map +1 -1
- package/dist/compiler/analyzeTemplate.js +2 -8
- package/dist/compiler/analyzeTemplate.js.map +1 -1
- package/dist/compiler/generate.js +178 -13
- package/dist/compiler/generate.js.map +1 -1
- package/dist/compiler/parseSfc.js +84 -7
- package/dist/compiler/parseSfc.js.map +1 -1
- package/package.json +1 -1
- package/templates/basic/_gitignore +3 -0
- package/templates/basic/index.html +13 -0
- package/templates/basic/package.json +18 -0
- package/templates/basic/public/favicon.svg +4 -0
- package/templates/basic/src/App.mikuru +37 -0
- package/templates/basic/src/MoodBadge.mikuru +26 -0
- package/templates/basic/src/main.ts +9 -0
- package/templates/basic/src/mikuru-env.d.ts +1 -0
- package/templates/basic/vite.config.ts +6 -0
- package/templates/starter/package.json +1 -1
- package/types/env.d.ts +6 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Mikuru Basic</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<main id="app"></main>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__MIKURU_APP_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"mikuru": "^1.0.6"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^6.0.3",
|
|
16
|
+
"vite": "^8.0.10"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="app">
|
|
3
|
+
<h1>Mikuru Counter</h1>
|
|
4
|
+
<button @click="increment">count: {{ count }}</button>
|
|
5
|
+
<MoodBadge label="Mood" v-model="mood">
|
|
6
|
+
<span>Current mood is {{ mood }}</span>
|
|
7
|
+
</MoodBadge>
|
|
8
|
+
</section>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { ref } from "mikuru";
|
|
13
|
+
import MoodBadge from "./MoodBadge.mikuru";
|
|
14
|
+
|
|
15
|
+
const count = ref(0);
|
|
16
|
+
const mood = ref("curious");
|
|
17
|
+
|
|
18
|
+
function increment() {
|
|
19
|
+
count.value += 1;
|
|
20
|
+
mood.value = count.value % 2 === 0 ? "curious" : "building";
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style scoped>
|
|
25
|
+
.app {
|
|
26
|
+
display: grid;
|
|
27
|
+
gap: 16px;
|
|
28
|
+
max-width: 520px;
|
|
29
|
+
margin: 48px auto;
|
|
30
|
+
font-family: system-ui, sans-serif;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
button {
|
|
34
|
+
font: inherit;
|
|
35
|
+
width: fit-content;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article class="badge">
|
|
3
|
+
<strong>{{ label }}</strong>
|
|
4
|
+
<button @click="toggle">{{ modelValue }}</button>
|
|
5
|
+
<slot />
|
|
6
|
+
</article>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
const { label, modelValue } = defineProps({ label: String, modelValue: String });
|
|
11
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
12
|
+
|
|
13
|
+
function toggle() {
|
|
14
|
+
emit("update:modelValue", modelValue.value === "curious" ? "building" : "curious");
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.badge {
|
|
20
|
+
display: grid;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
padding: 12px;
|
|
23
|
+
border: 1px solid #d7dce2;
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mikuru/env";
|
package/types/env.d.ts
CHANGED
|
@@ -3,19 +3,19 @@ type EnvMikuruComponentInstance = {
|
|
|
3
3
|
unmount(): void;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
type EnvMikuruMount = (
|
|
6
|
+
type EnvMikuruMount<Props = Record<string, unknown>> = (
|
|
7
7
|
target: Element | DocumentFragment,
|
|
8
|
-
props?:
|
|
8
|
+
props?: Props
|
|
9
9
|
) => EnvMikuruComponentInstance;
|
|
10
10
|
|
|
11
|
-
type EnvMikuruComponent = {
|
|
12
|
-
mount: EnvMikuruMount
|
|
11
|
+
type EnvMikuruComponent<Props = Record<string, unknown>> = {
|
|
12
|
+
mount: EnvMikuruMount<Props>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
declare module "mikuru/env" {
|
|
16
16
|
export type MikuruComponentInstance = EnvMikuruComponentInstance;
|
|
17
|
-
export type MikuruMount = EnvMikuruMount
|
|
18
|
-
export type MikuruComponent = EnvMikuruComponent
|
|
17
|
+
export type MikuruMount<Props = Record<string, unknown>> = EnvMikuruMount<Props>;
|
|
18
|
+
export type MikuruComponent<Props = Record<string, unknown>> = EnvMikuruComponent<Props>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
declare module "*.mikuru" {
|