PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / AutoLaunch / templates / index.js

index.js in Extendify 3.2.1, at src/AutoLaunch/templates/index.js

51 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Page as Centered } from './centered/Page';
2 import { Page as Choice } from './choice/Page';
3 import { Page as Modal } from './modal/Page';
4 import { Page as Split } from './split/Page';
5 import { Page as Stacked } from './stacked/Page';
6
7 /**
8 * A template arranges the page; it never builds its parts. The flow passes them
9 * in already wired, so no template can drop the required-plugin pre-install, an
10 * A/B assignment or the submit flow by omitting a slot.
11 *
12 * One registry per screen: a template built for one renders blank in the other.
13 */
14 export const DESCRIPTION_PAGES = { centered: Centered, split: Split };
15 export const PROGRESS_PAGES = { stacked: Stacked };
16 export const CHOICE_PAGES = { choice: Choice };
17 export const MODAL_PAGES = { modal: Modal };
18
19 // Which layout ships when a design names none. Change these to ship another.
20 export const ACTIVE_DESCRIPTION_TEMPLATE = 'centered';
21 export const ACTIVE_PROGRESS_TEMPLATE = 'stacked';
22 export const ACTIVE_CHOICE_TEMPLATE = 'choice';
23 export const ACTIVE_MODAL_TEMPLATE = 'modal';
24
25 let chosen = {};
26
27 // An unknown layout falls back to the shipped one, or an old install draws blank.
28 export const chooseTemplates = (templates) => {
29 chosen = templates ?? {};
30 };
31
32 const pageFor = (pages, name, shipped, fallback) =>
33 pages[chosen[name]] ?? pages[shipped] ?? fallback;
34
35 export const activeDescriptionTemplate = () =>
36 pageFor(
37 DESCRIPTION_PAGES,
38 'description',
39 ACTIVE_DESCRIPTION_TEMPLATE,
40 Centered,
41 );
42
43 export const activeProgressTemplate = () =>
44 pageFor(PROGRESS_PAGES, 'progress', ACTIVE_PROGRESS_TEMPLATE, Stacked);
45
46 export const activeChoiceTemplate = () =>
47 pageFor(CHOICE_PAGES, 'choice', ACTIVE_CHOICE_TEMPLATE, Choice);
48
49 export const activeModalTemplate = () =>
50 pageFor(MODAL_PAGES, 'modal', ACTIVE_MODAL_TEMPLATE, Modal);
51