Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Visual Cube Editor 3</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"typecheck": "tsc --noEmit",
"typecheck": "vue-tsc --noEmit",
"lint": "eslint .",
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\""
},
Expand All @@ -19,17 +19,23 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.59.0",
"@typescript-eslint/parser": "^8.59.0",
"@vitejs/plugin-vue": "^6.0.6",
"@vitest/coverage-v8": "^4.1.5",
"@vue/test-utils": "^2.4.10",
"eslint": "^10.2.1",
"eslint-config-prettier": "^10.1.8",
"happy-dom": "^20.9.0",
"prettier": "^3.8.3",
"typescript": "^6.0.3",
"vite": "^8.0.10",
"vitest": "^4.1.5"
"vitest": "^4.1.5",
"vue-tsc": "^3.2.7"
},
"dependencies": {
"@resvg/resvg-js": "^2.6.2",
"pinia": "^3.0.4",
"sr-visualizer": "^1.0.13",
"svgdom": "^0.1.23"
"svgdom": "^0.1.23",
"vue": "^3.5.33"
}
}
714 changes: 705 additions & 9 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions specs/003-ui-layer/checklists/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 仕様品質チェックリスト: UI レイヤー(Vue 3 + Pinia)

**目的**: 計画フェーズに進む前に仕様の完成度と品質を検証する
**作成日**: 2026-05-02
**フィーチャー**: [spec.md](../spec.md)

## コンテンツ品質

- [x] 実装の詳細(言語・フレームワーク・API)を含まない
- [x] ユーザー価値とビジネスニーズに焦点を当てている
- [x] 非技術系ステークホルダー向けに記述されている
- [x] 必須セクションがすべて完成している

## 要件の完全性

- [x] [NEEDS CLARIFICATION] マーカーが残っていない
- [x] 要件はテスト可能で曖昧さがない
- [x] 成功基準は測定可能である
- [x] 成功基準は技術スタックに非依存である
- [x] 受け入れシナリオがすべて定義されている
- [x] エッジケースが特定されている
- [x] スコープが明確に区切られている
- [x] 依存関係と前提条件が特定されている

## フィーチャーの準備状況

- [x] すべての機能要件に明確な受け入れ基準がある
- [x] ユーザーシナリオが主要フローをカバーしている
- [x] フィーチャーは成功基準で定義された測定可能なアウトカムを満たす
- [x] 仕様に実装の詳細が漏れ込んでいない

## メモ

- 本仕様は spec 001(ロジックレイヤー)と spec 002(描画レイヤー)に依存する。
両方完成済みであることを前提とする。
- Undo/Redo・スクランブル生成・キーボードショートカット・クラウド同期はスコープ外。
Constitution v1.2.1 の優先機能リストに含まれない。
- LocalStorage の永続化は Constitution 原則VI の「作成状態の永続化」要件を満たす最小実装。
- svgdom / happy-dom の競合は実装上の技術制約(plan.md に記録)。spec には含めない。

## 検証履歴

### 第1回検証(事後作成: 2026-05-02)

| 項目 | 結果 | 補足 |
|---|---|---|
| 実装詳細の漏れ | ⚠️ 軽微 | FR-010 に vi.mock の記述あり。テスト実装詳細だが、svgdom 競合という制約を明示するため許容 |
| テスト可能性 | ✅ | 全 FR が観測可能なふるまいで記述 |
| 成功基準の測定可能性 | ✅ | SC-001〜006 はすべて自動テストまたはブラウザ確認で検証可能 |
| 技術非依存 | ⚠️ 一部技術名あり | Vue / Pinia / LocalStorage / Vitest は Constitution 確定スタック。spec 001/002 と同じ扱い |
| 受け入れシナリオ | ✅ | US1〜US4 すべて Given-When-Then 形式で記述 |
| エッジケース | ✅ | N=2/N=7・空入力・LocalStorage 破損など主要ケース網羅 |
| スコープ境界 | ✅ | Undo/Redo・スクランブル・クラウド同期は明確に除外 |
| 依存関係 | ✅ | spec 001/002 との依存関係を前提条件に明記 |
112 changes: 112 additions & 0 deletions specs/003-ui-layer/contracts/store-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* UI レイヤー公開 API 契約
* ファイル: src/stores/cube.ts として実装される
*
* このファイルはコントラクト定義のみ(実装なし)。
* 実装は src/stores/ および src/composables/ に配置する。
*/

import type { CubeState } from '../../../src/logic/index.js'
import type { CubeSize } from '../../../src/logic/types.js'

// ---------------------------------------------------------------------------
// Move 型(ロジックレイヤーからの再エクスポート参照)
// ---------------------------------------------------------------------------

import type { Move, MoveSequence } from '../../../src/logic/index.js'

// ---------------------------------------------------------------------------
// CubeStore — Pinia setup ストア
// ---------------------------------------------------------------------------

/**
* useCubeStore() の戻り値型(概念定義)。
* 実装は defineStore('cube', () => { ... }) で行う。
*/
export interface CubeStore {
/** 現在のキューブサイズ(N=2〜7) */
readonly size: CubeSize

/** 現在のキューブ状態(Pinia reactive ref) */
cubeState: CubeState

/**
* 単一ムーブを適用する。
* `applyMove(cubeState, move)` の結果を `cubeState` に反映する。
*/
applyMove(move: Move): void

/**
* ムーブ列を適用する。
* `applySequence(cubeState, moves)` の結果を `cubeState` に反映する。
*/
applySequence(moves: MoveSequence): void

/**
* 現在のサイズで solved 状態にリセットする。
*/
reset(): void

/**
* キューブサイズを変更し、solved 状態にリセットする。
* @param n 新しいサイズ(2〜7)
*/
setSize(n: CubeSize): void
}

// ---------------------------------------------------------------------------
// useCubePersist — LocalStorage 永続化コンポーザブル
// ---------------------------------------------------------------------------

/**
* LocalStorage へのキューブ状態の自動保存と起動時復元を行うコンポーザブル。
*
* - `onMounted`: `vce3-cube-state` キーから JSON を読み込み `deserialize` で復元する。
* 不正 JSON またはスキーマ不一致の場合は solved 状態を維持する(フォールバック)。
* - `watch(() => store.cubeState)`: 変化のたびに `serialize(state)` を
* JSON 化して `vce3-cube-state` キーに保存する。
*
* LocalStorage キー: `vce3-cube-state`
* シリアライズ形式: `SerializedCube`(`serialize` / `deserialize` から)
*
* 使用例:
* ```typescript
* // App.vue の <script setup> 内
* useCubePersist()
* ```
*/
export declare function useCubePersist(): void

// ---------------------------------------------------------------------------
// コンポーネント Props(参考)
// ---------------------------------------------------------------------------

/** CubeDisplay コンポーネント — Props なし(ストアを直接参照) */
export interface CubeDisplayProps {
// なし — useCubeStore() で cubeState を取得
}

/** MoveInput コンポーネント — Props なし(ストアを直接参照) */
export interface MoveInputProps {
// なし — useCubeStore() で applyMove / applySequence を呼び出す
}

/** SizeSelector コンポーネント — Props なし(ストアを直接参照) */
export interface SizeSelectorProps {
// なし — useCubeStore() で size / setSize を参照
}

// ---------------------------------------------------------------------------
// テスト用 data-testid 一覧
// ---------------------------------------------------------------------------

/**
* コンポーネントテストで使用する data-testid 属性の一覧。
* セレクタ文字列として利用: `wrapper.find('[data-testid="notation-input"]')`
*/
export const TEST_IDS = {
/** MoveInput のテキスト入力欄 */
NOTATION_INPUT: 'notation-input',
/** MoveInput のエラーメッセージ表示要素 */
ERROR_MESSAGE: 'error-message',
} as const
Loading
Loading