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 / manifests.js

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

67 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import centered from './centered/manifest.json';
2 import choice from './choice/manifest.json';
3 import { globalManifests } from './global';
4 import modal from './modal/manifest.json';
5 import choicePage from './pages/choice.json';
6 import description from './pages/description.json';
7 import modalPage from './pages/modal.json';
8 import progress from './pages/progress.json';
9 import { idOf, mergeManifests } from './schema';
10 import split from './split/manifest.json';
11 import stacked from './stacked/manifest.json';
12
13 /**
14 * Properties live in JSON beside their page so a tool outside the plugin reads
15 * the same file the plugin does, rather than a second copy that drifts.
16 *
17 * Labels sit there untranslated on purpose: nothing in the flow renders them,
18 * and a string in JSON cannot reach make-pot anyway.
19 */
20 export const descriptionManifests = () => [centered, split];
21
22 export const progressManifests = () => [stacked];
23
24 export const choiceManifests = () => [choice];
25
26 export const modalManifests = () => [modal];
27
28 const everyTemplate = () => [
29 ...descriptionManifests(),
30 ...progressManifests(),
31 ...choiceManifests(),
32 ...modalManifests(),
33 ];
34
35 const PAGE_OF = {
36 centered: 'description',
37 split: 'description',
38 stacked: 'progress',
39 choice: 'choice',
40 modal: 'modal',
41 };
42
43 export const pageManifests = () => [
44 description,
45 progress,
46 choicePage,
47 modalPage,
48 ];
49
50 const pageManifest = (page) =>
51 pageManifests().find((entry) => idOf(entry) === page);
52
53 /**
54 * Global, then the page, then the template. Nothing reads this at runtime — a
55 * page reads its variables from the cascade — so it exists for a tool that has
56 * to know what it may set, and for the contract test over the three levels.
57 */
58 export const resolvedFor = (template) => {
59 const page = pageManifest(PAGE_OF[template]);
60 const own = everyTemplate().find((entry) => idOf(entry) === template);
61 return mergeManifests([
62 ...globalManifests(),
63 ...(page ? [page] : []),
64 ...(own ? [own] : []),
65 ]);
66 };
67