mikuru 1.0.0 → 1.0.2

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2
4
+
5
+ - Reworked the README for npm package consumers with CLI-first setup, Vite integration, package exports, TypeScript declarations, and v1 limits.
6
+ - Updated npm usage docs and release documentation to match the published package contents.
7
+ - Updated the starter template to depend on `mikuru@^1.0.2`.
8
+
9
+ ## 1.0.1
10
+
11
+ - Added the `mikuru` CLI with `mikuru create [project-name]`.
12
+ - Added a Vite starter template that shows a Mikuru welcome screen and counter after setup.
13
+ - Added create CLI smoke coverage and included it in CI.
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  - Stabilized the v1 SFC compiler surface for `.mikuru` files.
@@ -7,8 +19,8 @@
7
19
  - Added `v-if` / `v-else-if` / `v-else`, `v-show`, `v-for`, `v-model`, DOM event modifiers, style injection, and basic scoped CSS support.
8
20
  - Added CI, library build checks, basic example build checks, and browser E2E coverage.
9
21
  - Added a realworld example, public package smoke test, parser-limit coverage, debug sourceURL support, and performance smoke coverage.
10
- - Added v3 source maps, keyed `v-for` reuse, npm pack smoke coverage, and a v1 API contract.
11
- - Added a dogfood notes app written in Mikuru to exercise daily authoring flows.
12
- - Added generated DOM coverage for keyed insert/remove/reorder behavior, component cleanup, and slot cleanup.
13
- - Added explicit unsupported-syntax errors with source frames, Vite error forwarding coverage, and debug `sourceURL` path normalization coverage.
14
- - Documented runtime helpers including `nextTick`, `watch`, lifecycle callbacks, `provide`, and `inject`.
22
+ - Added v3 source maps, keyed `v-for` reuse, npm pack smoke coverage, and a v1 API contract.
23
+ - Added a dogfood notes app written in Mikuru to exercise daily authoring flows.
24
+ - Added generated DOM coverage for keyed insert/remove/reorder behavior, component cleanup, and slot cleanup.
25
+ - Added explicit unsupported-syntax errors with source frames, Vite error forwarding coverage, and debug `sourceURL` path normalization coverage.
26
+ - Documented runtime helpers including `nextTick`, `watch`, lifecycle callbacks, `provide`, and `inject`.
package/README.md CHANGED
@@ -1,18 +1,48 @@
1
1
  # Mikuru
2
2
 
3
- Mikuruは、Vueの書き心地を残しながら、Svelte寄りにDOM更新コードを生成するコンパイル型JavaScriptフレームワークです。
3
+ Mikuru is a compile-first JavaScript framework for Vue-like single-file components that generate direct DOM update code instead of using a virtual DOM.
4
4
 
5
- Vueのように単一ファイルコンポーネントと宣言的なテンプレートで書き、Svelteのようにビルド時にテンプレートを解析して、仮想DOMに依存しない小さなJavaScriptへ変換することを目指します。
5
+ It is intentionally small. Mikuru v1 is a practical validation release for writing `.mikuru` components in Vite apps, not a Vue compatibility layer.
6
6
 
7
- ## 目標
7
+ ## Requirements
8
8
 
9
- - `.mikuru` ファイルでコンポーネントを書く。
10
- - `<template>` / `<script>` / `<style>` のSFC構造を使う。
11
- - `ref`、`computed`、`effect` 風の小さなリアクティビティを提供する。
12
- - `{{ value }}`、`@click` / `v-on:click`、`:class` / `v-bind:class`、`v-if`、`v-for` のようなVue風テンプレート構文を使う。
13
- - コンパイラが更新箇所を静的に把握し、直接DOMを更新するコードを生成する。
9
+ - Node.js 22 or newer
10
+ - Vite 8 or newer for app development
14
11
 
15
- ## 最小サンプル
12
+ ## Create a New App
13
+
14
+ The fastest way to try Mikuru is the package CLI:
15
+
16
+ ```sh
17
+ npx mikuru create my-app
18
+ cd my-app
19
+ npm install
20
+ npm run dev
21
+ ```
22
+
23
+ The generated starter includes Vite, TypeScript, a `.mikuru` module declaration, and a welcome component at `src/App.mikuru`.
24
+
25
+ ## Add Mikuru to a Vite App
26
+
27
+ Install Mikuru and the Vite tooling:
28
+
29
+ ```sh
30
+ npm install mikuru
31
+ npm install -D vite typescript
32
+ ```
33
+
34
+ Configure Vite:
35
+
36
+ ```ts
37
+ import { defineConfig } from "vite";
38
+ import { mikuru } from "mikuru/vite";
39
+
40
+ export default defineConfig({
41
+ plugins: [mikuru()]
42
+ });
43
+ ```
44
+
45
+ Create a `.mikuru` component:
16
46
 
17
47
  ```mikuru
18
48
  <template>
@@ -36,107 +66,124 @@ button {
36
66
  </style>
37
67
  ```
38
68
 
39
- このコンポーネントは、概念的に次のようなJavaScript moduleへ変換されます。
69
+ Mount it from your app entry:
70
+
71
+ ```ts
72
+ import { mount } from "./App.mikuru";
40
73
 
41
- ```js
42
- import { ref, effect } from "mikuru/runtime";
74
+ const app = document.querySelector("#app");
43
75
 
44
- export function mount(target) {
45
- const count = ref(0);
46
- const button = document.createElement("button");
76
+ if (!app) {
77
+ throw new Error("Missing #app");
78
+ }
79
+
80
+ mount(app);
81
+ ```
47
82
 
48
- function increment() {
49
- count.value += 1;
50
- }
83
+ ## TypeScript Declarations
51
84
 
52
- button.addEventListener("click", increment);
85
+ Until Mikuru ships global `.mikuru` declarations, add a local declaration file such as `src/mikuru-env.d.ts`:
53
86
 
54
- effect(() => {
55
- button.textContent = `count: ${count.value}`;
56
- });
87
+ ```ts
88
+ declare module "*.mikuru" {
89
+ export type MikuruComponentInstance = {
90
+ element: Element | Comment;
91
+ unmount(): void;
92
+ };
57
93
 
58
- target.appendChild(button);
94
+ export function mount(
95
+ target: Element | DocumentFragment,
96
+ props?: Record<string, unknown>
97
+ ): MikuruComponentInstance;
98
+
99
+ const component: {
100
+ mount: typeof mount;
101
+ };
102
+
103
+ export default component;
59
104
  }
60
105
  ```
61
106
 
62
- ## v1範囲
107
+ ## Supported v1 Surface
108
+
109
+ - `.mikuru` SFCs with `<template>`, `<script>`, and `<style>`
110
+ - Vite plugin support through `mikuru/vite`
111
+ - Template interpolation with `{{ value }}`
112
+ - DOM events with `@click`, `v-on:click`, `.prevent`, and `.stop`
113
+ - Attribute bindings with `:class` and `v-bind:class`
114
+ - `v-if`, `v-else-if`, `v-else`, `v-show`, and `v-for`
115
+ - `v-model` for common form controls and child components
116
+ - Component props, events, `defineProps`, `defineEmits`, and default slots
117
+ - Runtime helpers including `ref`, `computed`, `effect`, `watch`, `nextTick`, lifecycle callbacks, `provide`, and `inject`
118
+ - Style injection and basic `<style scoped>` selector rewriting
119
+ - Compile errors with filenames, line/column information, and code frames
120
+
121
+ ## Package Exports
122
+
123
+ Application code usually imports from `mikuru`:
63
124
 
64
- v1の成功条件は、Vue風の小さなSFC体験をVite上で実用的に書け、ブラウザで安定して動かせることです。最初のカウンターMVPは土台として維持し、v1では親子コンポーネント、フォーム入力、条件分岐、リスト表示、style注入までを公開対象として固定します。
125
+ ```ts
126
+ import { computed, ref } from "mikuru";
127
+ ```
65
128
 
66
- v1では次の機能を対象にします。
129
+ The Vite plugin is available from `mikuru/vite`:
67
130
 
68
- - SFC分割: `<template>`、`<script>`、`<style>`
69
- - Vite plugin: `.mikuru` importをJavaScript moduleへ変換
70
- - テキスト補間: `{{ count }}`
71
- - イベント: `@click="increment"`、`v-on:click="increment"`、DOMイベントの `.prevent` / `.stop`
72
- - 属性バインド: `:class="className"`、`v-bind:class="className"`
73
- - class正規化: `:class="['base', { active }]"` の配列・オブジェクト形式
74
- - フォーム同期: `input` / `textarea` / `checkbox` / `select` の `v-model`
75
- - 条件分岐: `v-if` / `v-else-if` / `v-else`
76
- - 表示切り替え: `v-show="visible"`
77
- - 繰り返し: `v-for="item in items"`、`v-for="(item, index) in items"`、`of` エイリアス
78
- - コンポーネント合成: `<Child :count="count" @select="select" />` のprops/event受け渡し、`v-model`
79
- - default slot: `<Panel>content</Panel>` と子側の `<slot />`
80
- - props宣言: `const { title } = defineProps()` のコンパイル専用API
81
- - emits宣言: `const emit = defineEmits()` で親の `@event` ハンドラを呼び出し
82
- - style注入: `<style>` をmount時に一度だけdocumentへ追加し、`<style scoped>` の基本セレクタを書き換える
83
- - unmount: 生成コンポーネントがイベント、effect、子コンポーネントを破棄する
84
- - パーサ強化: コメント、シングルクォート属性、属性値内の `>`、void要素に対応
85
- - 式検証: テンプレート式をExpressionとして検証し、文や代入など危険な構文を拒否
86
- - エラー表示: コンパイルエラーにファイル名、行、列、コードフレームを付与
87
- - 小さなランタイム: `ref`、`computed`、`effect`
131
+ ```ts
132
+ import { mikuru } from "mikuru/vite";
133
+ ```
88
134
 
89
- ## v1の非目標
135
+ Compiler and runtime entries are public for lower-level integrations:
90
136
 
91
- MikuruはVue完全互換を目指しません。SSR、hydration、transition、devtools、完全なテンプレート型チェック、Vue互換を名乗るための広範な仕様追従はv1後に検討します。scoped CSSはv1では基本セレクタのみを対象にし、`:global()`、深いセレクタ、複雑なネスト規則は後続課題です。
137
+ ```ts
138
+ import { compile } from "mikuru/compiler";
139
+ import { effect, nextTick, ref, unwrap, watch } from "mikuru/runtime";
140
+ ```
92
141
 
93
- ## 開発
142
+ The package also provides the `mikuru` binary:
143
+
144
+ ```sh
145
+ npx mikuru create my-app
146
+ ```
147
+
148
+ ## Not Included in v1
149
+
150
+ Mikuru does not claim Vue compatibility. The v1 package does not include SSR, hydration, transitions, devtools, named slots, slot props, dynamic components, `v-html`, object-form `v-bind` / `v-on`, or full template type checking.
151
+
152
+ Scoped CSS is a basic selector rewrite, not a full CSS compiler. Avoid relying on `:global()`, deep selectors, complex nesting, CSS Modules, or preprocessors in v1.
153
+
154
+ ## Repository Development
155
+
156
+ For local framework development:
94
157
 
95
158
  ```sh
96
159
  npm install
97
160
  npm run ci
98
161
  ```
99
162
 
100
- 個別に確認する場合は次を使います。
163
+ Useful targeted checks:
101
164
 
102
165
  ```sh
103
166
  npm run typecheck
104
167
  npm test
105
168
  npm run build
106
- npm run build:basic
107
- npm run build:realworld
108
- npm run build:dogfood
109
- npm run test:package
110
- npm run test:pack
111
- npm run test:e2e
112
- npm run test:e2e:dogfood
113
- ```
114
-
115
- 公式exampleはViteで起動できます。
169
+ npm run test:create
170
+ npm run test:package
171
+ npm run test:pack
172
+ npm run test:e2e
173
+ ```
116
174
 
117
- ```sh
118
- npm run dev:basic
119
- npm run dev:realworld
120
- npm run dev:dogfood
121
- ```
122
-
123
- 用途は次の通りです。
124
-
125
- - `examples/basic`: カウンター、props/events、component `v-model`、default slot の最小確認
126
- - `examples/realworld`: 検索、フォーム、keyed list を含むアプリ風の検証
127
- - `examples/dogfood`: Mikuru自身で書いた notes app による日常的な書き心地の検証
128
- - `examples/mikuru-sample` / `examples/mikuru-vue-like`: 追加の手書きDOM/runtimeサンプル
129
-
130
- 表示するときは、ブラウザで example の `index.html` を直接開かず、Viteが表示するローカルURLを開いてください。`.ts` と `.mikuru` はVite pluginで変換されます。
131
-
132
- exampleを本番ビルドする場合は次を使います。
175
+ Examples can be run from the repository root:
133
176
 
134
177
  ```sh
135
- npm run build:basic
136
- npm run build:realworld
137
- npm run build:dogfood
178
+ npm run dev:basic
179
+ npm run dev:realworld
180
+ npm run dev:dogfood
181
+ npm run dev:mikuru-sample
182
+ npm run dev:mikuru-vue-like
138
183
  ```
139
184
 
140
- ## 補足
141
-
142
- Mikuru v1は、Vue完全互換ではなく小さなVue風SFCサブセットです。設計文書、対応構文、非対応構文、リリース前チェック項目などの詳細文書は内部資料として扱います。
185
+ ## Documentation
186
+
187
+ - `CHANGELOG.md` lists published package changes.
188
+ - `docs/npm-usage.md` shows a manual Vite setup for package consumers.
189
+ - `docs/v1-api-contract.md` describes the v1 compatibility boundary used by this repository.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
3
+ import { basename, dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const command = process.argv[2];
6
+ const targetArg = process.argv[3];
7
+ if (command === "--help" || command === "-h" || !command) {
8
+ printHelp();
9
+ process.exit(0);
10
+ }
11
+ if (command !== "create") {
12
+ console.error(`Unknown command: ${command}`);
13
+ printHelp();
14
+ process.exit(1);
15
+ }
16
+ const targetDir = resolve(process.cwd(), targetArg ?? "mikuru-app");
17
+ const appName = toPackageName(basename(targetDir));
18
+ if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
19
+ console.error(`Target directory is not empty: ${targetDir}`);
20
+ process.exit(1);
21
+ }
22
+ const templateDir = resolve(dirname(fileURLToPath(import.meta.url)), "../templates/starter");
23
+ copyTemplate(templateDir, targetDir, { appName });
24
+ console.log(`Created ${appName} in ${targetDir}`);
25
+ console.log("");
26
+ console.log("Next steps:");
27
+ console.log(` cd ${basename(targetDir)}`);
28
+ console.log(" npm install");
29
+ console.log(" npm run dev");
30
+ function printHelp() {
31
+ console.log("Usage:");
32
+ console.log(" mikuru create [project-name]");
33
+ }
34
+ function copyTemplate(sourceDir, targetDir, variables) {
35
+ mkdirSync(targetDir, { recursive: true });
36
+ for (const entry of readdirSync(sourceDir)) {
37
+ const sourcePath = join(sourceDir, entry);
38
+ const targetName = entry === "_gitignore" ? ".gitignore" : entry;
39
+ const targetPath = join(targetDir, targetName);
40
+ const stat = statSync(sourcePath);
41
+ if (stat.isDirectory()) {
42
+ copyTemplate(sourcePath, targetPath, variables);
43
+ continue;
44
+ }
45
+ if (isTextTemplate(sourcePath)) {
46
+ const content = readFileSync(sourcePath, "utf8").replaceAll("__MIKURU_APP_NAME__", variables.appName);
47
+ writeFileSync(targetPath, content);
48
+ continue;
49
+ }
50
+ copyFileSync(sourcePath, targetPath);
51
+ }
52
+ }
53
+ function isTextTemplate(path) {
54
+ return /\.(css|html|json|mikuru|ts)$/.test(path) || path.endsWith("_gitignore");
55
+ }
56
+ function toPackageName(value) {
57
+ return value
58
+ .trim()
59
+ .toLowerCase()
60
+ .replace(/[^a-z0-9._-]+/g, "-")
61
+ .replace(/^-+|-+$/g, "") || "mikuru-app";
62
+ }
63
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,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,CAAC,qBAAqB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;YACtG,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACnC,SAAS;QACX,CAAC;QAED,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK;SACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC;AAC7C,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "mikuru",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
- "type": "module",
6
- "description": "A compile-first JavaScript framework with Vue-like authoring and Svelte-like generated DOM updates.",
7
- "homepage": "https://github.com/miyagawayuu/mikuru#readme",
8
- "bugs": {
9
- "url": "https://github.com/miyagawayuu/mikuru/issues"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/miyagawayuu/mikuru.git"
14
- },
15
- "exports": {
5
+ "type": "module",
6
+ "description": "A compile-first JavaScript framework with Vue-like authoring and Svelte-like generated DOM updates.",
7
+ "homepage": "https://github.com/miyagawayuu/mikuru#readme",
8
+ "bugs": {
9
+ "url": "https://github.com/miyagawayuu/mikuru/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/miyagawayuu/mikuru.git"
14
+ },
15
+ "exports": {
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
18
  "default": "./dist/index.js"
@@ -30,11 +30,15 @@
30
30
  "default": "./dist/vite.js"
31
31
  }
32
32
  },
33
- "files": [
34
- "dist",
35
- "README.md",
36
- "CHANGELOG.md"
37
- ],
33
+ "bin": {
34
+ "mikuru": "dist/cli.js"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "templates",
39
+ "README.md",
40
+ "CHANGELOG.md"
41
+ ],
38
42
  "engines": {
39
43
  "node": ">=22"
40
44
  },
@@ -45,15 +49,16 @@
45
49
  "build:realworld": "vite build --config examples/realworld/vite.config.ts",
46
50
  "build:mikuru-sample": "vite build --config examples/mikuru-sample/vite.config.ts",
47
51
  "build:mikuru-vue-like": "vite build --config examples/mikuru-vue-like/vite.config.ts",
48
- "ci": "npm run typecheck && npm test && npm run build && npm run build:basic && npm run build:realworld && npm run build:dogfood && npm run test:package && npm run test:pack && npm run test:e2e && npm run test:e2e:dogfood",
52
+ "ci": "npm run typecheck && npm test && npm run build && npm run test:create && npm run build:basic && npm run build:realworld && npm run build:dogfood && npm run test:package && npm run test:pack && npm run test:e2e && npm run test:e2e:dogfood",
49
53
  "dev:basic": "vite --config examples/basic/vite.config.ts",
50
- "dev:dogfood": "vite --config examples/dogfood/vite.config.ts",
51
- "dev:realworld": "vite --config examples/realworld/vite.config.ts",
52
- "dev:mikuru-sample": "vite --config examples/mikuru-sample/vite.config.ts",
53
- "dev:mikuru-vue-like": "vite --config examples/mikuru-vue-like/vite.config.ts",
54
+ "dev:dogfood": "vite --config examples/dogfood/vite.config.ts",
55
+ "dev:realworld": "vite --config examples/realworld/vite.config.ts",
56
+ "dev:mikuru-sample": "vite --config examples/mikuru-sample/vite.config.ts",
57
+ "dev:mikuru-vue-like": "vite --config examples/mikuru-vue-like/vite.config.ts",
54
58
  "test": "vitest run",
55
59
  "test:e2e": "playwright test",
56
60
  "test:e2e:dogfood": "playwright test --config playwright.dogfood.config.ts",
61
+ "test:create": "node tests/create-cli-smoke.mjs",
57
62
  "test:pack": "node tests/npm-pack-smoke.mjs",
58
63
  "test:package": "node tests/package-usage.mjs",
59
64
  "typecheck": "tsc -p tsconfig.json --noEmit"
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ dist
3
+ *.local
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Mikuru App</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </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.2"
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "^6.0.3",
16
+ "vite": "^8.0.10"
17
+ }
18
+ }
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <main class="shell">
3
+ <section class="hero">
4
+ <div class="mark">み</div>
5
+ <p class="eyebrow">Mikuru is ready</p>
6
+ <h1>Make tiny Vue-like apps feel sweet and fast.</h1>
7
+ <p class="summary">
8
+ Edit <code>src/App.mikuru</code> and save to test Mikuru with Vite HMR.
9
+ </p>
10
+ <button @click="increment">count: {{ count }}</button>
11
+ </section>
12
+
13
+ <section class="grid">
14
+ <article>
15
+ <h2>Template</h2>
16
+ <p>Write friendly SFC templates with interpolation, events, lists, and form models.</p>
17
+ </article>
18
+ <article>
19
+ <h2>Runtime</h2>
20
+ <p>Keep state small with <code>ref</code>, <code>computed</code>, and direct DOM updates.</p>
21
+ </article>
22
+ <article>
23
+ <h2>Compiler</h2>
24
+ <p>Compile SFCs into lightweight browser code without bringing a virtual DOM.</p>
25
+ </article>
26
+ </section>
27
+ </main>
28
+ </template>
29
+
30
+ <script>
31
+ import { ref } from "mikuru";
32
+
33
+ const count = ref(0);
34
+
35
+ function increment() {
36
+ count.value += 1;
37
+ }
38
+ </script>
@@ -0,0 +1,10 @@
1
+ import { mount } from "./App.mikuru";
2
+ import "./style.css";
3
+
4
+ const app = document.querySelector<HTMLDivElement>("#app");
5
+
6
+ if (!app) {
7
+ throw new Error("Missing #app");
8
+ }
9
+
10
+ mount(app);
@@ -0,0 +1,17 @@
1
+ declare module "*.mikuru" {
2
+ export type MikuruComponentInstance = {
3
+ element: Element | Comment;
4
+ unmount(): void;
5
+ };
6
+
7
+ export function mount(
8
+ target: Element | DocumentFragment,
9
+ props?: Record<string, unknown>
10
+ ): MikuruComponentInstance;
11
+
12
+ const component: {
13
+ mount: typeof mount;
14
+ };
15
+
16
+ export default component;
17
+ }
@@ -0,0 +1,151 @@
1
+ :root {
2
+ color: #3a2430;
3
+ background:
4
+ radial-gradient(circle at 18% 12%, rgba(255, 176, 211, 0.38), transparent 28%),
5
+ radial-gradient(circle at 82% 8%, rgba(255, 218, 235, 0.72), transparent 24%),
6
+ #fff7fb;
7
+ font-family:
8
+ Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
9
+ font-synthesis: none;
10
+ text-rendering: optimizeLegibility;
11
+ }
12
+
13
+ * {
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ min-width: 320px;
19
+ min-height: 100vh;
20
+ margin: 0;
21
+ }
22
+
23
+ button {
24
+ border: 1px solid #ff8abc;
25
+ border-radius: 999px;
26
+ background: #ff5fa2;
27
+ color: #ffffff;
28
+ cursor: pointer;
29
+ font: inherit;
30
+ font-weight: 700;
31
+ padding: 11px 18px;
32
+ box-shadow: 0 12px 26px rgba(255, 95, 162, 0.24);
33
+ }
34
+
35
+ button:hover {
36
+ background: #f34f96;
37
+ }
38
+
39
+ code {
40
+ border-radius: 6px;
41
+ background: #fff0f7;
42
+ color: #d93282;
43
+ padding: 2px 6px;
44
+ }
45
+
46
+ .shell {
47
+ width: min(1040px, calc(100vw - 32px));
48
+ margin: 0 auto;
49
+ padding: 72px 0;
50
+ }
51
+
52
+ .hero {
53
+ display: grid;
54
+ justify-items: center;
55
+ gap: 18px;
56
+ min-height: 520px;
57
+ align-content: center;
58
+ border: 1px solid #ffd2e4;
59
+ border-radius: 28px 28px 0 0;
60
+ background:
61
+ linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 244, 250, 0.96)),
62
+ #ffffff;
63
+ box-shadow: 0 24px 70px rgba(217, 50, 130, 0.14);
64
+ text-align: center;
65
+ }
66
+
67
+ .mark {
68
+ display: grid;
69
+ width: 84px;
70
+ height: 84px;
71
+ place-items: center;
72
+ border: 1px solid #ffb6d4;
73
+ border-radius: 26px;
74
+ background: linear-gradient(135deg, #ff6faf, #ffc1dc);
75
+ color: #ffffff;
76
+ font-size: 40px;
77
+ font-weight: 800;
78
+ box-shadow: 0 18px 34px rgba(255, 111, 175, 0.32);
79
+ }
80
+
81
+ .eyebrow {
82
+ margin: 0;
83
+ color: #e24e91;
84
+ font-size: 14px;
85
+ font-weight: 700;
86
+ letter-spacing: 0;
87
+ text-transform: uppercase;
88
+ }
89
+
90
+ h1 {
91
+ max-width: 760px;
92
+ margin: 0;
93
+ font-size: 56px;
94
+ font-weight: 750;
95
+ line-height: 1.05;
96
+ }
97
+
98
+ .summary {
99
+ max-width: 560px;
100
+ margin: 0;
101
+ color: #7b5b6a;
102
+ font-size: 18px;
103
+ line-height: 1.7;
104
+ }
105
+
106
+ .grid {
107
+ display: grid;
108
+ grid-template-columns: repeat(3, minmax(0, 1fr));
109
+ gap: 1px;
110
+ overflow: hidden;
111
+ border: 1px solid #ffd2e4;
112
+ border-top: 0;
113
+ border-radius: 0 0 28px 28px;
114
+ background: #ffd2e4;
115
+ }
116
+
117
+ article {
118
+ min-height: 180px;
119
+ padding: 28px;
120
+ background: rgba(255, 255, 255, 0.78);
121
+ }
122
+
123
+ h2 {
124
+ margin: 0 0 12px;
125
+ font-size: 22px;
126
+ }
127
+
128
+ article p {
129
+ margin: 0;
130
+ color: #7b5b6a;
131
+ line-height: 1.65;
132
+ }
133
+
134
+ @media (max-width: 760px) {
135
+ .shell {
136
+ padding: 24px 0;
137
+ }
138
+
139
+ .hero {
140
+ min-height: 460px;
141
+ padding: 32px 20px;
142
+ }
143
+
144
+ h1 {
145
+ font-size: 38px;
146
+ }
147
+
148
+ .grid {
149
+ grid-template-columns: 1fr;
150
+ }
151
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import { mikuru } from "mikuru/vite";
3
+
4
+ export default defineConfig({
5
+ plugins: [mikuru()]
6
+ });