mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
createSceneDialog keeps its builder but publishes the dialog's lines, fields, buttons and status to a scene sharing store; SceneDialog.vue, teleported to the body from the scene panels view, draws the same modal with the same styles and opens it with Cancel focused. The EDIT DETAILS / SHARE SCENE bar is drawn by that view while sharing offers it. The status directive is shared with Provider Settings, and the two QA scripts that drove the old DOM read the new dialog.
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* Scene sharing as its views render it. The sharing owner
|
|
* (src/scenes/sharing.js) offers the EDIT DETAILS / SHARE SCENE bar and
|
|
* presents its one open dialog here; the views send clicks, typing and file
|
|
* choices back to the connected dialog.
|
|
*/
|
|
export const useSceneSharingStore = defineStore('gev-scene-sharing', () => {
|
|
/** The bar's actions ({edit, share}), or null while no owner offers it. */
|
|
const toolbar = shallowRef(null);
|
|
|
|
/** @param {?{edit: Function, share: Function}} next */
|
|
function offerToolbar(next) {
|
|
toolbar.value = next && markRaw(next);
|
|
}
|
|
|
|
/** The open dialog's presentation, or null while none is open. */
|
|
const dialog = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
|
function publishDialog(next) {
|
|
dialog.value = next && markRaw(next);
|
|
}
|
|
|
|
/** The open dialog the view calls, or null while none is wired. */
|
|
const controls = shallowRef(null);
|
|
|
|
/** @param {?object} next The dialog, or null to disconnect. */
|
|
function connect(next) {
|
|
controls.value = next && markRaw(next);
|
|
}
|
|
|
|
return { toolbar, offerToolbar, dialog, publishDialog, controls, connect };
|
|
});
|