-
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
UI/Core Initialization Dependency Report (Japanese)
目的
この文書は、MaplatCore と Maplat UI の初期化依存関係を現在/改善後の両方で整理します。
- Confluence に貼り付けて記録として残せること
- 実装担当の LLM に対して、構造と作業対象が一意に伝わること
参照(主要ファイル)
- Maplat UI constructor と waitReady ロジック: ..\Maplat\src\index.ts
- Maplat UI 初期化フロー: ..\Maplat\src\ui_init.ts
- MaplatCore 初期化フロー: ..\MaplatCore\src\index.ts
現行の初期化パス
パスA: stateUrl が OFF(直列初期化)
- MaplatUi constructor が waitReady を initializer(appOption) に設定。
- uiInit が MaplatCore を作成し、appdata を購読。
- Core が settingLoader -> handleSetting -> appdata を発火。
- UI が appdata を受け取り、i18nLoader を開始し uiPrepare を待機、appDataLoaded を実行。
- Core が prepareMap で DOM 挿入前に uiPrepare を発火。
- UI の uiPrepare が走り(controls + 翻訳)、appDataLoaded が完了。
- Core が sources ロード -> setInitialMap -> map イベント -> waitReady 解決。
- UI が core.waitReady 後に map イベントや modal ハンドラを bind。
パスB: stateUrl が ON(遅延初期化)
- MaplatUi constructor が page を初期化し、waitReady を未解決の Promise に設定。
- page のコールバックが発火し、core が未生成なら initializer(appOption) を実行。
- 以後の流れはパスAと同様。
- restore と更新後に waitReadyBridge を解決。
現行の処理インベントリ(生産者別)
MaplatCore(現行順序)
- C1: settingLoader(app data 読み込み)
- C2: handleSetting(appData 正規化、appdata 発火)
- C3: prepareMap(uiPrepare 発火、DOM 挿入、MaplatMap/back map 作成)
- C4: normalize layers / pois
- C5: sourcesLoader -> handleSources -> setInitialMap -> changeMap
- C6: geolocation と GPS イベント初期化
- C7: map click / pointer ハンドラ
Maplat UI(現行順序)
- U1: uiInit(core 作成、appdata を購読)
- U2: i18nLoader(async)
- U3: uiPrepare ハンドラ(DOM 翻訳、controls 作成)
- U4: appDataLoaded(restore、class 付与、DOM 初期化、modal ハンドラ)
- U5: initMapEventListeners(core.waitReady 後)
- U6: initGpsHandlers(appDataLoaded 後、waitReady 前後)
現行依存関係マトリクス(抜粋)
| ID | タスク | 生産者 | 依存 | 出力 | 消費者 | 備考 |
|---|---|---|---|---|---|---|
| D1 | appdata event | Core | C1 | appData | UI | UI が i18n と UI 初期化を開始 |
| D2 | uiPrepare event | Core | C2 | event only | UI | DOM 挿入前に発火 |
| D3 | i18nLoader | UI | D1 | ui.i18n, ui._t | uiPrepare | 非同期依存 |
| D4 | controls 作成 | UI | D3 | controls 配列 | Core | MaplatMap 作成前に必要 |
| D5 | DOM 翻訳 | UI | D3 + DOM | 翻訳済 DOM | UI | DOM が必要 |
| D6 | mapObject イベント | UI | core.waitReady | listener | mapObject | core-ready 後 |
| D7 | modal ハンドラ | UI | mapDivDocument | UI DOM listener | UI | DOM が必要 |
現行の競合点
- uiPrepare が DOM 挿入前に発火するため、DOM 翻訳と衝突。
- controls は MaplatMap 作成前に必要だが、DOM 翻訳は DOM 後に必要。
- stateUrl on/off で初期化の起点が変わる。
改善後フェーズ(提案)
| フェーズ | 内容 | 提供されるもの |
|---|---|---|
| lifecycle:setting-loaded | 設定読み込み | appData(raw) |
| lifecycle:appdata-ready | appData 正規化完了 | appData(normalized) |
| lifecycle:ui-configure | i18n + controls + UI flags(DOM なし) | controls, i18n, UI flags |
| lifecycle:core-dom-ready | mapDiv DOM 挿入完了 | mapDivDocument |
| lifecycle:ui-dom-ready | DOM 翻訳 + DOM 依存 UI 初期化 | 翻訳済 DOM, DOM UI bind |
| lifecycle:core-ready | mapObject / sources 準備完了 | mapObject, sources |
| lifecycle:ui-ready | UI bind 完了 | UI interactions |
改善後依存マトリクス(抜粋)
| フェーズ | タスク | 生産者 | 依存 | 出力 | 備考 |
|---|---|---|---|---|---|
| ui-configure | i18nLoader | UI | appdata-ready | ui.i18n, ui._t | DOM を触らない |
| ui-configure | controls 作成 | UI | i18nLoader | controls 配列 | Map 作成前に Core へ渡す |
| core-dom-ready | DOM 挿入 | Core | ui-configure 完了 | mapDivDocument | DOM 翻訳より先 |
| ui-dom-ready | DOM 翻訳 | UI | core-dom-ready + i18n | 翻訳済 DOM | data-i18n/din を置換 |
| core-ready | mapObject イベント | UI | core-ready | listener | mapObject 利用可能 |
| ui-ready | modal ハンドラ | UI | ui-dom-ready | modal bind | DOM 依存 |
段階移行計画(1つずつ)
- lifecycle イベントの枠組み追加(挙動は変えない)。
- controls 作成を lifecycle:ui-configure に移動。
- i18n 初期化を lifecycle:ui-configure に移動。
- DOM 翻訳を lifecycle:ui-dom-ready に移動。
- modal ハンドラ bind を ui-dom-ready か ui-ready に移動。
- map event listener を core-ready に移動。
- stateUrl on/off の両パスで確認。
検証チェックリスト(LLM 実装向け)
- ui-configure が map 作成前に実行され、controls を Core に渡す。
- core-dom-ready が DOM 挿入後に実行される。
- ui-dom-ready が core-dom-ready と i18n 後に実行される。
- core-ready が sources / mapObject 完了後に実行される。
- ui-ready が UI bind 完了後に実行される。
- stateUrl ON/OFF 両方で waitReady が正常に解決する。
Metadata
Metadata
Assignees
Labels
No labels