mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
initFirstRunExperience no longer writes the launcher card's classes, attributes and text, wires its listeners or removes it: it presents the card's visibility, busy state, status line, copy and scroll fade to the gev-first-run store and connects the controls the welcome view's choices, DISMISS and "Don't show this again" call. A refused save hands the tick back to the view to revert. The launcher still reads the rendered card for its hit test, keyboard trap, focus and overflow measurement. The owner-chosen copy moves to src/firstRunCopy.js, shared by both. The source-text tests give way to component tests, and the first-run mutation QA follows the new code (67/67 caught).
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* The first-run mission launcher as the welcome view renders it.
|
|
* initFirstRunExperience presents it and connects the controls its buttons
|
|
* and checkbox call.
|
|
*/
|
|
export const useFirstRunStore = defineStore('gev-first-run', () => {
|
|
/**
|
|
* `{removed, shown, visible, closing, state, busy, status, description,
|
|
* environmentalTitle, environmentalSub, scrollable}`, or null until the
|
|
* launcher is initialized (the card stays hidden).
|
|
*/
|
|
const launcher = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
launcher.value = next && markRaw(next);
|
|
}
|
|
|
|
/** `{choose(choice), dismiss(), suppress(wanted) → boolean}`, or null. */
|
|
const controls = shallowRef(null);
|
|
|
|
/** @param {?object} next The launcher's controls, or null to disconnect. */
|
|
function connect(next) {
|
|
controls.value = next && markRaw(next);
|
|
}
|
|
|
|
return { launcher, publish, controls, connect };
|
|
});
|