@jbrowse/plugin-config 1.7.9 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/ConfigurationEditorWidget/components/CallbackEditor.d.ts +10 -7
  2. package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +108 -115
  3. package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
  4. package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +4 -3
  5. package/dist/ConfigurationEditorWidget/components/CodeEditor.js +78 -73
  6. package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
  7. package/dist/ConfigurationEditorWidget/components/ColorEditor.d.ts +9 -33
  8. package/dist/ConfigurationEditorWidget/components/ColorEditor.js +82 -116
  9. package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
  10. package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
  11. package/dist/ConfigurationEditorWidget/components/ColorPicker.js +64 -67
  12. package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
  13. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +7 -3
  14. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +113 -160
  15. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
  16. package/dist/ConfigurationEditorWidget/components/JsonEditor.js +74 -75
  17. package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
  18. package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +11 -1
  19. package/dist/ConfigurationEditorWidget/components/SlotEditor.js +228 -423
  20. package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
  21. package/dist/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
  22. package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +81 -0
  23. package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
  24. package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +8 -6
  25. package/dist/ConfigurationEditorWidget/components/TypeSelector.js +16 -46
  26. package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
  27. package/dist/ConfigurationEditorWidget/index.js +25 -42
  28. package/dist/ConfigurationEditorWidget/index.js.map +1 -0
  29. package/dist/ConfigurationEditorWidget/model.js +18 -26
  30. package/dist/ConfigurationEditorWidget/model.js.map +1 -0
  31. package/dist/FromConfigAdapter/FromConfigAdapter.js +172 -204
  32. package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
  33. package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +151 -142
  34. package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
  35. package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +182 -181
  36. package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
  37. package/dist/FromConfigAdapter/configSchema.js +33 -49
  38. package/dist/FromConfigAdapter/configSchema.js.map +1 -0
  39. package/dist/FromConfigAdapter/index.js +16 -50
  40. package/dist/FromConfigAdapter/index.js.map +1 -0
  41. package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +111 -123
  42. package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
  43. package/dist/RefNameAliasAdapter/configSchema.js +16 -25
  44. package/dist/RefNameAliasAdapter/configSchema.js.map +1 -0
  45. package/dist/RefNameAliasAdapter/index.js +10 -22
  46. package/dist/RefNameAliasAdapter/index.js.map +1 -0
  47. package/dist/index.d.ts +9 -3
  48. package/dist/index.js +129 -144
  49. package/dist/index.js.map +1 -0
  50. package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +12 -0
  51. package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +71 -0
  52. package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
  53. package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +5 -0
  54. package/esm/ConfigurationEditorWidget/components/CodeEditor.js +42 -0
  55. package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
  56. package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +20 -0
  57. package/esm/ConfigurationEditorWidget/components/ColorEditor.js +37 -0
  58. package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
  59. package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +7 -0
  60. package/esm/ConfigurationEditorWidget/components/ColorPicker.js +26 -0
  61. package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
  62. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +8 -0
  63. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +83 -0
  64. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
  65. package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -0
  66. package/esm/ConfigurationEditorWidget/components/JsonEditor.js +39 -0
  67. package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
  68. package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +16 -0
  69. package/esm/ConfigurationEditorWidget/components/SlotEditor.js +176 -0
  70. package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
  71. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
  72. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +36 -0
  73. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
  74. package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +9 -0
  75. package/esm/ConfigurationEditorWidget/components/TypeSelector.js +12 -0
  76. package/esm/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
  77. package/esm/ConfigurationEditorWidget/index.d.ts +3 -0
  78. package/esm/ConfigurationEditorWidget/index.js +20 -0
  79. package/esm/ConfigurationEditorWidget/index.js.map +1 -0
  80. package/esm/ConfigurationEditorWidget/model.d.ts +8 -0
  81. package/esm/ConfigurationEditorWidget/model.js +16 -0
  82. package/esm/ConfigurationEditorWidget/model.js.map +1 -0
  83. package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +24 -0
  84. package/esm/FromConfigAdapter/FromConfigAdapter.js +63 -0
  85. package/esm/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
  86. package/esm/FromConfigAdapter/FromConfigRegionsAdapter.d.ts +23 -0
  87. package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js +50 -0
  88. package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
  89. package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +25 -0
  90. package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +73 -0
  91. package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
  92. package/esm/FromConfigAdapter/configSchema.d.ts +3 -0
  93. package/esm/FromConfigAdapter/configSchema.js +32 -0
  94. package/esm/FromConfigAdapter/configSchema.js.map +1 -0
  95. package/esm/FromConfigAdapter/index.d.ts +4 -0
  96. package/esm/FromConfigAdapter/index.js +5 -0
  97. package/esm/FromConfigAdapter/index.js.map +1 -0
  98. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +8 -0
  99. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +24 -0
  100. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
  101. package/esm/RefNameAliasAdapter/configSchema.d.ts +2 -0
  102. package/esm/RefNameAliasAdapter/configSchema.js +15 -0
  103. package/esm/RefNameAliasAdapter/configSchema.js.map +1 -0
  104. package/esm/RefNameAliasAdapter/index.d.ts +2 -0
  105. package/esm/RefNameAliasAdapter/index.js +3 -0
  106. package/esm/RefNameAliasAdapter/index.js.map +1 -0
  107. package/esm/index.d.ts +18 -0
  108. package/esm/index.js +72 -0
  109. package/esm/index.js.map +1 -0
  110. package/package.json +20 -13
  111. package/src/ConfigurationEditorWidget/components/{CallbackEditor.js → CallbackEditor.tsx} +36 -21
  112. package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +59 -0
  113. package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +8 -33
  114. package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +4 -13
  115. package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +169 -0
  116. package/src/ConfigurationEditorWidget/components/JsonEditor.js +4 -8
  117. package/src/ConfigurationEditorWidget/components/SlotEditor.js +11 -69
  118. package/src/ConfigurationEditorWidget/components/StringArrayEditor.tsx +115 -0
  119. package/src/ConfigurationEditorWidget/components/{TypeSelector.js → TypeSelector.tsx} +15 -7
  120. package/src/ConfigurationEditorWidget/components/__snapshots__/ConfigurationEditor.test.js.snap +883 -691
  121. package/src/ConfigurationEditorWidget/index.js +2 -2
  122. package/src/RefNameAliasAdapter/RefNameAliasAdapter.ts +1 -1
  123. package/src/index.ts +20 -14
  124. package/dist/ConfigurationEditorWidget/components/ColorEditor.test.js +0 -31
  125. package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.test.js +0 -121
  126. package/dist/FromConfigAdapter/FromConfigAdapter.test.js +0 -100
  127. package/dist/FromConfigAdapter/FromConfigRegionsAdapter.test.js +0 -200
  128. package/dist/FromConfigAdapter/FromConfigSequenceAdapter.test.js +0 -110
  129. package/dist/RefNameAliasAdapter/RefNameAliasAdapter.test.js +0 -41
  130. package/dist/index.test.js +0 -41
  131. package/src/ConfigurationEditorWidget/components/CodeEditor.js +0 -60
  132. package/src/ConfigurationEditorWidget/components/ConfigurationEditor.js +0 -154
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,gGAAyE;AACzE,8FAAuE;AACvE,gEAAyC;AAEzC,yEAIoC;AACpC,yDAI4B;AAC5B,6DAAuF;AAEvF,IAAM,gCAAgC,GAAG,IAAA,YAAI,EAC3C,cAAM,wEAAO,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,CAAS,CACf;gBAFD,CAEC;gBACH,eAAe,EAAE;oBACf,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,IAAI;oBACnB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE,IAAI;iBAClB;aACF,CAAC;QAbF,CAaE,CACL,CAAA;QACD,aAAa,CAAC,cAAc,CAC1B;YACE,OAAA,IAAI,qBAAW,CAAC;gBACd,IAAI,EAAE,qBAAqB;gBAC3B,YAAY,EAAE,kCAA+B;gBAC7C,eAAe,EAAE;oBACf,OAAA,iEAAO,2CAA2C,OAAE,IAAI,CACtD,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CACf;gBAFD,CAEC;gBACH,eAAe,EAAE;oBACf,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,IAAI;oBACnB,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE,IAAI;iBAClB;aACF,CAAC;QAbF,CAaE,CACL,CAAA;QAED,aAAa,CAAC,aAAa,CAAC;YAC1B,OAAO,IAAI,oBAAU,CAAC;gBACpB,IAAI,EAAE,2BAA2B;gBACjC,gBAAgB,EAAE,4CAAmC;gBACrD,YAAY,EAAE,wCAA+B;gBAC7C,UAAU,EAAE,IAAA,6CAAoC,EAAC,aAAa,CAAC;gBAC/D,cAAc,EAAE,gCAAgC;aACjD,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AAnFD,CAA6B,gBAAM,GAmFlC;;AAED,gFAAyF;AAAhF,yHAAA,OAAO,OAAc"}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ declare function CallbackEditor({ slot, }: {
3
+ slot: {
4
+ set: (arg: string) => void;
5
+ description: string;
6
+ name: string;
7
+ value: string;
8
+ contextVariable: string;
9
+ };
10
+ }): JSX.Element;
11
+ declare const _default: typeof CallbackEditor;
12
+ export default _default;
@@ -0,0 +1,71 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { useDebounce } from '@jbrowse/core/util';
3
+ import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
4
+ import { FormControl, FormHelperText, InputLabel, Tooltip, IconButton, TextField, } from '@mui/material';
5
+ import { makeStyles } from 'tss-react/mui';
6
+ import HelpIcon from '@mui/icons-material/Help';
7
+ import { getEnv } from 'mobx-state-tree';
8
+ import { observer } from 'mobx-react';
9
+ // Optimize by using system default fonts:
10
+ // https://css-tricks.com/snippets/css/font-stacks/
11
+ const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
12
+ const useStyles = makeStyles()(theme => ({
13
+ callbackEditor: {
14
+ marginTop: '16px',
15
+ borderBottom: `1px solid ${theme.palette.divider}`,
16
+ fontFamily,
17
+ },
18
+ textAreaFont: {
19
+ fontFamily,
20
+ },
21
+ }));
22
+ function CallbackEditor({ slot, }) {
23
+ const { classes } = useStyles();
24
+ const [code, setCode] = useState(slot.value);
25
+ const [error, setCodeError] = useState();
26
+ const debouncedCode = useDebounce(code, 400);
27
+ useEffect(() => {
28
+ var _a;
29
+ try {
30
+ const jexlDebouncedCode = debouncedCode.startsWith('jexl:')
31
+ ? debouncedCode
32
+ : `jexl:${debouncedCode}`;
33
+ if (jexlDebouncedCode === 'jexl:') {
34
+ throw new Error('Empty jexl expression is not valid');
35
+ }
36
+ stringToJexlExpression(jexlDebouncedCode, (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.jexl);
37
+ slot.set(jexlDebouncedCode);
38
+ setCodeError(undefined);
39
+ }
40
+ catch (e) {
41
+ console.error({ e });
42
+ setCodeError(e);
43
+ }
44
+ }, [debouncedCode, slot]);
45
+ // if default value is a callback, will have to remove jexl:
46
+ // do this last
47
+ return (React.createElement(React.Fragment, null,
48
+ React.createElement(FormControl, null,
49
+ React.createElement(InputLabel, { shrink: true, htmlFor: "callback-editor" }, slot.name),
50
+ React.createElement(TextField, { multiline: true, className: classes.callbackEditor, value: code.startsWith('jexl:') ? code.split('jexl:')[1] : code, onChange: event => setCode(event.target.value), style: { background: error ? '#fdd' : undefined }, InputProps: {
51
+ classes: {
52
+ input: classes.textAreaFont,
53
+ },
54
+ } }),
55
+ error ? (React.createElement(FormHelperText, { style: { color: '#f00' } }, `${error}`)) : null,
56
+ React.createElement(FormHelperText, null, slot.description)),
57
+ React.createElement(Tooltip, { title: React.createElement("div", null,
58
+ "Callbacks are written in Jexl format. Click to learn more.",
59
+ React.createElement("br", null),
60
+ " Names of available context items: ",
61
+ slot.contextVariable), arrow: true },
62
+ React.createElement(IconButton, { color: "primary", onClick: () => {
63
+ const newWindow = window.open('https://github.com/TomFrost/Jexl', '_blank', 'noopener,noreferrer');
64
+ if (newWindow) {
65
+ newWindow.opener = null;
66
+ }
67
+ } },
68
+ React.createElement(HelpIcon, null)))));
69
+ }
70
+ export default observer(CallbackEditor);
71
+ //# sourceMappingURL=CallbackEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallbackEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/CallbackEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,QAAQ,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,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AAI,CAAA;qBACxB;gBACH,CAAC;gBAED,oBAAC,QAAQ,OAAG,CACD,CACL,CACT,CACJ,CAAA;AACH,CAAC;AAED,eAAe,QAAQ,CAAC,cAAc,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export default function CodeEditor({ contents, setContents, }: {
3
+ contents: string;
4
+ setContents: (arg: string) => void;
5
+ }): JSX.Element;
@@ -0,0 +1,42 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { TextField } from '@mui/material';
3
+ import { makeStyles } from 'tss-react/mui';
4
+ // fontSize and fontFamily have to match between Editor and SyntaxHighlighter
5
+ const fontSize = '12px';
6
+ // Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
7
+ const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
8
+ const useStyles = makeStyles()(theme => ({
9
+ callbackEditor: {
10
+ fontFamily,
11
+ fontSize,
12
+ background: theme.palette.background.default,
13
+ overflowX: 'auto',
14
+ marginTop: '16px',
15
+ border: '1px solid rgba(0,0,0,0.42)',
16
+ },
17
+ textAreaFont: {
18
+ fontFamily,
19
+ },
20
+ }));
21
+ export default function CodeEditor({ contents, setContents, }) {
22
+ const { classes } = useStyles();
23
+ const [error, setCodeError] = useState();
24
+ const [val, setVal] = useState(contents);
25
+ useEffect(() => {
26
+ try {
27
+ JSON.parse(contents);
28
+ setCodeError(undefined);
29
+ setContents(val);
30
+ }
31
+ catch (e) {
32
+ console.error({ e });
33
+ setCodeError(e);
34
+ }
35
+ }, [val, contents, setContents]);
36
+ return (React.createElement(TextField, { className: classes.callbackEditor, value: contents, onChange: event => setVal(event.target.value), style: { background: error ? '#fdd' : undefined }, InputProps: {
37
+ classes: {
38
+ input: classes.textAreaFont,
39
+ },
40
+ } }));
41
+ }
42
+ //# sourceMappingURL=CodeEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/CodeEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,2FAA2F;AAC3F,MAAM,UAAU,GACd,sNAAsN,CAAA;AAExN,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvC,cAAc,EAAE;QACd,UAAU;QACV,QAAQ;QACR,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;QAC5C,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,4BAA4B;KACrC;IACD,YAAY,EAAE;QACZ,UAAU;KACX;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,WAAW,GAIZ;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAW,CAAA;IACjD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI;YACF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACpB,YAAY,CAAC,SAAS,CAAC,CAAA;YACvB,WAAW,CAAC,GAAG,CAAC,CAAA;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACpB,YAAY,CAAC,CAAC,CAAC,CAAA;SAChB;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA;IAEhC,OAAO,CACL,oBAAC,SAAS,IACR,SAAS,EAAE,OAAO,CAAC,cAAc,EACjC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7C,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,EACjD,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,YAAY;aAC5B;SACF,GACD,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ export declare const ColorSlot: (props: {
3
+ value: string;
4
+ label?: string | undefined;
5
+ TextFieldProps?: {
6
+ helperText: string;
7
+ fullWidth: boolean;
8
+ } | undefined;
9
+ onChange: (arg: string) => void;
10
+ }) => JSX.Element;
11
+ declare function ColorEditorSlot(props: {
12
+ slot: {
13
+ name: string;
14
+ value: string;
15
+ description: string;
16
+ set: (arg: string) => void;
17
+ };
18
+ }): JSX.Element;
19
+ declare const _default: typeof ColorEditorSlot;
20
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import React, { lazy, useState } from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { TextField } from '@mui/material';
4
+ const ColorPicker = lazy(() => import('./ColorPicker'));
5
+ // this is needed because passing a entire color object into the react-color
6
+ // for alpha, can't pass in an rgba string for example
7
+ function serializeColor(color) {
8
+ if (color instanceof Object) {
9
+ const { r, g, b, a } = color;
10
+ return a === undefined ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${a})`;
11
+ }
12
+ return color;
13
+ }
14
+ export const ColorSlot = (props) => {
15
+ const { value = '#000', label = '', TextFieldProps = {}, onChange } = props;
16
+ const [displayed, setDisplayed] = useState(false);
17
+ return (React.createElement(React.Fragment, null,
18
+ React.createElement(TextField, { value: value, label: label, InputProps: {
19
+ style: {
20
+ color: value,
21
+ borderRightWidth: '25px',
22
+ borderRightStyle: 'solid',
23
+ borderRightColor: value,
24
+ },
25
+ }, onClick: () => setDisplayed(!displayed), onChange: event => onChange(event.target.value), ...TextFieldProps }),
26
+ displayed ? (React.createElement(React.Suspense, { fallback: React.createElement("div", null) },
27
+ React.createElement(ColorPicker, { color: value, onChange: event => onChange(serializeColor(event.rgb)) }))) : null));
28
+ };
29
+ function ColorEditorSlot(props) {
30
+ const { slot } = props;
31
+ return (React.createElement(ColorSlot, { label: slot.name, value: slot.value, onChange: color => slot.set(color), TextFieldProps: {
32
+ helperText: slot.description,
33
+ fullWidth: true,
34
+ } }));
35
+ }
36
+ export default observer(ColorEditorSlot);
37
+ //# sourceMappingURL=ColorEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/ColorEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAA;AAEvD,4EAA4E;AAC5E,sDAAsD;AACtD,SAAS,cAAc,CAAC,KAAY;IAClC,IAAI,KAAK,YAAY,MAAM,EAAE;QAC3B,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,KAAiB,CAAA;QACxC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,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AI,CAAC,IAAI,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAClC,cAAc,EAAE;YACd,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,SAAS,EAAE,IAAI;SAChB,GACD,CACH,CAAA;AACH,CAAC;AAED,eAAe,QAAQ,CAAC,eAAe,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Color, ColorResult } from 'react-color';
3
+ export declare function ColorPicker(props: {
4
+ color: Color;
5
+ onChange: (color: ColorResult) => void;
6
+ }): JSX.Element;
7
+ export default ColorPicker;
@@ -0,0 +1,26 @@
1
+ import React, { useState } from 'react';
2
+ import { makeStyles } from 'tss-react/mui';
3
+ import { ChromePicker } from 'react-color';
4
+ const useStyles = makeStyles()({
5
+ popover: {
6
+ position: 'absolute',
7
+ zIndex: 2,
8
+ },
9
+ cover: {
10
+ position: 'fixed',
11
+ top: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ left: 0,
15
+ },
16
+ });
17
+ export function ColorPicker(props) {
18
+ const { color, onChange } = props;
19
+ const { classes } = useStyles();
20
+ const [displayColorPicker, setDisplayColorPicker] = useState(true);
21
+ return (React.createElement("div", null, displayColorPicker ? (React.createElement("div", { className: classes.popover },
22
+ React.createElement("div", { role: "presentation", className: classes.cover, onClick: () => setDisplayColorPicker(false) }),
23
+ React.createElement(ChromePicker, { color: color, onChange: onChange }))) : null));
24
+ }
25
+ export default ColorPicker;
26
+ //# sourceMappingURL=ColorPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAA;AAE9D,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC7B,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,CAAC;KACV;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,WAAW,CAAC,KAG3B;IACC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAElE,OAAO,CACL,iCACG,kBAAkB,CAAC,CAAC,CAAC,CACpB,6BAAK,SAAS,EAAE,OAAO,CAAC,OAAO;QAC7B,6BACE,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,OAAO,CAAC,KAAK,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAC3C;QACF,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAC9C,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAA;AACH,CAAC;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ declare const ConfigurationEditor: ({ model }: {
4
+ model: {
5
+ target: AnyConfigurationModel;
6
+ };
7
+ }) => JSX.Element;
8
+ export default ConfigurationEditor;
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import { readConfObject, getTypeNamesFromExplicitlyTypedUnion, isConfigurationSchemaType, isConfigurationSlotType, } from '@jbrowse/core/configuration';
3
+ import { FormGroup, Accordion, AccordionDetails, AccordionSummary, Typography, } from '@mui/material';
4
+ import { makeStyles } from 'tss-react/mui';
5
+ import { observer } from 'mobx-react';
6
+ import { getMembers } from 'mobx-state-tree';
7
+ import { singular } from 'pluralize';
8
+ // icons
9
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
10
+ // locals
11
+ import SlotEditor from './SlotEditor';
12
+ import TypeSelector from './TypeSelector';
13
+ const useStyles = makeStyles()(theme => ({
14
+ expandIcon: {
15
+ color: '#fff',
16
+ },
17
+ root: {
18
+ padding: theme.spacing(1, 3, 1, 1),
19
+ },
20
+ expansionPanelDetails: {
21
+ display: 'block',
22
+ padding: theme.spacing(1),
23
+ },
24
+ accordion: {
25
+ border: `1px solid ${theme.palette.text.primary}`,
26
+ },
27
+ }));
28
+ const Member = observer((props) => {
29
+ const { classes } = useStyles();
30
+ const { slotName, slotSchema, schema, slot = schema[slotName], path = [], } = props;
31
+ let typeSelector;
32
+ if (isConfigurationSchemaType(slotSchema)) {
33
+ if (slot.length) {
34
+ return slot.map((subslot, slotIndex) => {
35
+ const key = `${singular(slotName)} ${slotIndex + 1}`;
36
+ return React.createElement(Member, { ...props, key: key, slot: subslot, slotName: key });
37
+ });
38
+ }
39
+ // if this is an explicitly typed schema, make a type-selecting dropdown
40
+ // that can be used to change its type
41
+ const typeNameChoices = getTypeNamesFromExplicitlyTypedUnion(slotSchema);
42
+ if (typeNameChoices.length) {
43
+ typeSelector = (React.createElement(TypeSelector, { typeNameChoices: typeNameChoices, slotName: slotName, slot: slot, onChange: evt => {
44
+ if (evt.target.value !== slot.type) {
45
+ schema.setSubschema(slotName, { type: evt.target.value });
46
+ }
47
+ } }));
48
+ }
49
+ return (React.createElement(Accordion, { defaultExpanded: true, className: classes.accordion },
50
+ React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, { className: classes.expandIcon }) },
51
+ React.createElement(Typography, null, [...path, slotName].join('🡒'))),
52
+ React.createElement(AccordionDetails, { className: classes.expansionPanelDetails },
53
+ typeSelector,
54
+ React.createElement(FormGroup, null,
55
+ React.createElement(Schema, { schema: slot, path: [...path, slotName] })))));
56
+ }
57
+ if (isConfigurationSlotType(slotSchema)) {
58
+ // this is a regular config slot
59
+ return React.createElement(SlotEditor, { key: slotName, slot: slot, slotSchema: slotSchema });
60
+ }
61
+ return null;
62
+ });
63
+ const Schema = observer(({ schema, path = [], }) => {
64
+ const properties = getMembers(schema).properties;
65
+ return (React.createElement(React.Fragment, null, Object.entries(properties).map(([slotName, slotSchema]) => (React.createElement(Member, { key: slotName, slotName: slotName, slotSchema: slotSchema, path: path, schema: schema })))));
66
+ });
67
+ const ConfigurationEditor = observer(({ model }) => {
68
+ const { classes } = useStyles();
69
+ // key forces a re-render, otherwise the same field can end up being used
70
+ // for different tracks since only the backing model changes for example
71
+ // see pr #804
72
+ const { target } = model;
73
+ const key = target && readConfObject(target, 'trackId');
74
+ const name = target && readConfObject(target, 'name');
75
+ return (React.createElement(React.Fragment, null,
76
+ React.createElement(Accordion, { key: key, defaultExpanded: true, className: classes.accordion },
77
+ React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, { className: classes.expandIcon }) },
78
+ React.createElement(Typography, null, name !== null && name !== void 0 ? name : 'Configuration')),
79
+ React.createElement(AccordionDetails, { className: classes.expansionPanelDetails, "data-testid": "configEditor" }, !target ? 'no target set' : React.createElement(Schema, { schema: target }))),
80
+ React.createElement("div", { style: { height: 300 } })));
81
+ });
82
+ export default ConfigurationEditor;
83
+ //# sourceMappingURL=ConfigurationEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigurationEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,cAAc,EACd,oCAAoC,EACpC,yBAAyB,EACzB,uBAAuB,GAExB,M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AAC,GAAG,EAAE,GAAG,EAAE,eAAe,QAAC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC/D,oBAAC,gBAAgB,IACf,UAAU,EAAE,oBAAC,cAAc,IAAC,SAAS,EAAE,OAAO,CAAC,UAAU,GAAI;gBAE7D,oBAAC,UAAU,QAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,eAAe,CAAc,CACjC;YACnB,oBAAC,gBAAgB,IACf,SAAS,EAAE,OAAO,CAAC,qBAAqB,iBAC5B,cAAc,IAEzB,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAC,MAAM,IAAC,MAAM,EAAE,MAAM,GAAI,CACtC,CACT;QAGZ,6BAAK,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAI,CAC9B,CACJ,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,9 @@
1
+ declare function _default({ slot }: {
2
+ slot: any;
3
+ }): JSX.Element;
4
+ declare namespace _default {
5
+ namespace propTypes {
6
+ const slot: import("prop-types").Validator<any>;
7
+ }
8
+ }
9
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import React, { lazy, useEffect, useState } from 'react';
2
+ import { useDebounce } from '@jbrowse/core/util';
3
+ import { FormControl, FormHelperText, InputLabel } from '@mui/material';
4
+ import { makeStyles } from 'tss-react/mui';
5
+ import { observer, PropTypes } from 'mobx-react';
6
+ const useStyles = makeStyles()({
7
+ error: {
8
+ color: 'red',
9
+ fontSize: '0.8em',
10
+ },
11
+ });
12
+ const CodeEditor = lazy(() => import('./CodeEditor'));
13
+ function JsonEditor({ slot }) {
14
+ const { classes } = useStyles();
15
+ const [contents, setContents] = useState(JSON.stringify(slot.value, null, ' '));
16
+ const [error, setError] = useState();
17
+ const debouncedJson = useDebounce(contents, 400);
18
+ useEffect(() => {
19
+ try {
20
+ slot.set(JSON.parse(debouncedJson));
21
+ setError(undefined);
22
+ }
23
+ catch (e) {
24
+ setError(e.message);
25
+ }
26
+ }, [debouncedJson, slot]);
27
+ return (React.createElement(React.Fragment, null,
28
+ error ? React.createElement("p", { className: classes.error }, error) : null,
29
+ React.createElement(FormControl, { error: error },
30
+ React.createElement(InputLabel, { shrink: true, htmlFor: "callback-editor" }, slot.name),
31
+ React.createElement(React.Suspense, { fallback: React.createElement("div", null) },
32
+ React.createElement(CodeEditor, { contents: contents, setContents: setContents })),
33
+ React.createElement(FormHelperText, null, slot.description))));
34
+ }
35
+ JsonEditor.propTypes = {
36
+ slot: PropTypes.objectOrObservableObject.isRequired,
37
+ };
38
+ export default observer(JsonEditor);
39
+ //# sourceMappingURL=JsonEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonEditor.js","sourceRoot":"","sources":["../../../src/ConfigurationEditorWidget/components/JsonEditor.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC7B,KAAK,EAAE;QACL,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;AAErD,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,Q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, string> | undefined;
4
+ } & Record<string, unknown>;
5
+ ownerState?: Record<string, unknown> | undefined;
6
+ } | undefined) => {
7
+ classes: Record<"paper" | "paperContent" | "slotModeSwitch", string>;
8
+ theme: import("@mui/material").Theme;
9
+ css: import("tss-react/types").Css;
10
+ cx: import("tss-react/types").Cx;
11
+ };
12
+ export default SlotEditor;
13
+ declare function SlotEditor({ slot, slotSchema }: {
14
+ slot: any;
15
+ slotSchema: any;
16
+ }): JSX.Element;
@@ -0,0 +1,176 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { getPropertyMembers, getEnv } from 'mobx-state-tree';
4
+ import { FileSelector, SanitizedHTML } from '@jbrowse/core/ui';
5
+ import { getPropertyType, getSubType, getUnionSubTypes, } from '@jbrowse/core/util/mst-reflection';
6
+ import { Card, CardContent, CardHeader, Checkbox, FormControl, FormControlLabel, FormHelperText, IconButton, InputAdornment, InputLabel, MenuItem, Paper, SvgIcon, TextField, } from '@mui/material';
7
+ import { makeStyles } from 'tss-react/mui';
8
+ // icons
9
+ import DeleteIcon from '@mui/icons-material/Delete';
10
+ import AddIcon from '@mui/icons-material/Add';
11
+ import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';
12
+ // locals
13
+ import StringArrayEditor from './StringArrayEditor';
14
+ import CallbackEditor from './CallbackEditor';
15
+ import ColorEditor from './ColorEditor';
16
+ import JsonEditor from './JsonEditor';
17
+ // adds ability to have html in helperText. note that FormHelperTextProps is
18
+ // div because the default is p which does not like div children
19
+ const MyTextField = props => {
20
+ const { helperText } = props;
21
+ return (React.createElement(TextField, { ...props, helperText: React.createElement(SanitizedHTML, { html: helperText }), FormHelperTextProps: {
22
+ component: 'div',
23
+ }, fullWidth: true }));
24
+ };
25
+ const StringEditor = observer(({ slot }) => (React.createElement(MyTextField, { label: slot.name, helperText: slot.description, value: slot.value, onChange: evt => slot.set(evt.target.value) })));
26
+ const TextEditor = observer(({ slot }) => (React.createElement(TextField, { label: slot.name, helperText: slot.description, multiline: true, value: slot.value, onChange: evt => slot.set(evt.target.value) })));
27
+ // checked checkbox, looks like a styled (x)
28
+ const SvgCheckbox = () => (React.createElement(SvgIcon, null,
29
+ React.createElement("path", { d: "M20.41,3C21.8,5.71 22.35,8.84 22,12C21.8,15.16 20.7,18.29 18.83,21L17.3,20C18.91,17.57 19.85,14.8 20,12C20.34,9.2 19.89,6.43 18.7,4L20.41,3M5.17,3L6.7,4C5.09,6.43 4.15,9.2 4,12C3.66,14.8 4.12,17.57 5.3,20L3.61,21C2.21,18.29 1.65,15.17 2,12C2.2,8.84 3.3,5.71 5.17,3M12.08,10.68L14.4,7.45H16.93L13.15,12.45L15.35,17.37H13.09L11.71,14L9.28,17.33H6.76L10.66,12.21L8.53,7.45H10.8L12.08,10.68Z" })));
30
+ const useMapEditorStyles = makeStyles()(theme => ({
31
+ card: {
32
+ marginTop: theme.spacing(1),
33
+ },
34
+ }));
35
+ const StringArrayMapEditor = observer(({ slot }) => {
36
+ const { classes } = useMapEditorStyles();
37
+ const [value, setValue] = useState('');
38
+ return (React.createElement(React.Fragment, null,
39
+ React.createElement(InputLabel, null, slot.name),
40
+ Array.from(slot.value, ([key, val]) => (React.createElement(Card, { raised: true, key: key, className: classes.card },
41
+ React.createElement(CardHeader, { title: key, action: React.createElement(IconButton, { color: "secondary", onClick: () => slot.remove(key) },
42
+ React.createElement(DeleteIcon, null)) }),
43
+ React.createElement(CardContent, null,
44
+ React.createElement(StringArrayEditor, { slot: {
45
+ value: val,
46
+ description: `Values associated with entry ${key}`,
47
+ setAtIndex: (idx, strValue) => {
48
+ slot.setAtKeyIndex(key, idx, strValue);
49
+ },
50
+ removeAtIndex: idx => {
51
+ slot.removeAtKeyIndex(key, idx);
52
+ },
53
+ add: strValue => {
54
+ slot.addToKey(key, strValue);
55
+ },
56
+ } }))))),
57
+ React.createElement(Card, { raised: true, className: classes.card },
58
+ React.createElement(CardHeader, { disableTypography: true, title: React.createElement(TextField, { fullWidth: true, value: value, placeholder: "add new", onChange: event => setValue(event.target.value), InputProps: {
59
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
60
+ React.createElement(IconButton, { disabled: value === '', onClick: () => {
61
+ slot.add(value, []);
62
+ setValue('');
63
+ }, color: "secondary" },
64
+ React.createElement(AddIcon, null)))),
65
+ } }) })),
66
+ React.createElement(FormHelperText, null, slot.description)));
67
+ });
68
+ const NumberMapEditor = observer(({ slot }) => {
69
+ const { classes } = useMapEditorStyles();
70
+ const [value, setValue] = useState('');
71
+ return (React.createElement(React.Fragment, null,
72
+ React.createElement(InputLabel, null, slot.name),
73
+ Array.from(slot.value, ([key, val]) => (React.createElement(Card, { raised: true, key: key, className: classes.card },
74
+ React.createElement(CardHeader, { title: key, action: React.createElement(IconButton, { color: "secondary", onClick: () => slot.remove(key) },
75
+ React.createElement(DeleteIcon, null)) }),
76
+ React.createElement(CardContent, null,
77
+ React.createElement(NumberEditor, { slot: {
78
+ value: val,
79
+ set: numValue => slot.add(key, numValue),
80
+ } }))))),
81
+ React.createElement(Card, { raised: true, className: classes.card },
82
+ React.createElement(CardHeader, { disableTypography: true, title: React.createElement(TextField, { fullWidth: true, value: value, placeholder: "add new", onChange: event => setValue(event.target.value), InputProps: {
83
+ endAdornment: (React.createElement(InputAdornment, { position: "end" },
84
+ React.createElement(IconButton, { disabled: value === '', onClick: () => {
85
+ slot.add(value, 0);
86
+ setValue('');
87
+ }, color: "secondary" },
88
+ React.createElement(AddIcon, null)))),
89
+ } }) })),
90
+ React.createElement(FormHelperText, null, slot.description)));
91
+ });
92
+ const NumberEditor = observer(({ slot }) => {
93
+ const [val, setVal] = useState(slot.value);
94
+ useEffect(() => {
95
+ const num = parseFloat(val, 10);
96
+ if (!Number.isNaN(num)) {
97
+ slot.set(num);
98
+ }
99
+ else {
100
+ slot.reset();
101
+ }
102
+ }, [slot, val]);
103
+ return (React.createElement(MyTextField, { label: slot.name, helperText: slot.description, value: val, type: "number", onChange: evt => setVal(evt.target.value) }));
104
+ });
105
+ const IntegerEditor = observer(({ slot }) => {
106
+ const [val, setVal] = useState(slot.value);
107
+ useEffect(() => {
108
+ const num = parseInt(val, 10);
109
+ if (!Number.isNaN(num)) {
110
+ slot.set(num);
111
+ }
112
+ }, [slot, val]);
113
+ return (React.createElement(MyTextField, { label: slot.name, helperText: slot.description, value: val, type: "number", onChange: evt => setVal(evt.target.value) }));
114
+ });
115
+ const BooleanEditor = observer(({ slot }) => (React.createElement(FormControl, null,
116
+ React.createElement(FormControlLabel, { label: slot.name, control: React.createElement(Checkbox, { checked: slot.value, onChange: evt => slot.set(evt.target.checked) }) }),
117
+ React.createElement(FormHelperText, null, slot.description))));
118
+ const StringEnumEditor = observer(({ slot, slotSchema }) => {
119
+ const p = getPropertyMembers(getSubType(slotSchema));
120
+ const choices = getUnionSubTypes(getUnionSubTypes(getSubType(getPropertyType(p, 'value')))[1]).map(t => t.value);
121
+ return (React.createElement(MyTextField, { value: slot.value, label: slot.name, select: true, helperText: slot.description, onChange: evt => slot.set(evt.target.value) }, choices.map(str => (React.createElement(MenuItem, { key: str, value: str }, str)))));
122
+ });
123
+ const FileSelectorWrapper = observer(({ slot }) => {
124
+ var _a;
125
+ return (React.createElement(FileSelector, { location: slot.value, setLocation: location => slot.set(location), name: slot.name, description: slot.description, rootModel: (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.rootModel }));
126
+ });
127
+ const valueComponents = {
128
+ string: StringEditor,
129
+ text: TextEditor,
130
+ fileLocation: FileSelectorWrapper,
131
+ stringArray: StringArrayEditor,
132
+ stringArrayMap: StringArrayMapEditor,
133
+ numberMap: NumberMapEditor,
134
+ number: NumberEditor,
135
+ integer: IntegerEditor,
136
+ color: ColorEditor,
137
+ stringEnum: StringEnumEditor,
138
+ boolean: BooleanEditor,
139
+ frozen: JsonEditor,
140
+ configRelationships: JsonEditor,
141
+ };
142
+ export const useSlotEditorStyles = makeStyles()(theme => ({
143
+ paper: {
144
+ display: 'flex',
145
+ marginBottom: theme.spacing(2),
146
+ position: 'relative',
147
+ },
148
+ paperContent: {
149
+ width: '100%',
150
+ },
151
+ slotModeSwitch: {
152
+ width: 24,
153
+ background: theme.palette.secondary.light,
154
+ display: 'flex',
155
+ justifyContent: 'center',
156
+ alignItems: 'center',
157
+ },
158
+ }));
159
+ const SlotEditor = observer(({ slot, slotSchema }) => {
160
+ const { classes } = useSlotEditorStyles();
161
+ const { type } = slot;
162
+ let ValueComponent = slot.isCallback ? CallbackEditor : valueComponents[type];
163
+ if (!ValueComponent) {
164
+ console.warn(`no slot editor defined for ${type}, editing as string`);
165
+ ValueComponent = StringEditor;
166
+ }
167
+ if (!(type in valueComponents)) {
168
+ console.warn(`SlotEditor needs to implement ${type}`);
169
+ }
170
+ return (React.createElement(Paper, { className: classes.paper },
171
+ React.createElement("div", { className: classes.paperContent },
172
+ React.createElement(ValueComponent, { slot: slot, slotSchema: slotSchema })),
173
+ React.createElement("div", { className: classes.slotModeSwitch }, slot.contextVariable.length ? (React.createElement(IconButton, { className: classes.slotModeIcon, onClick: () => slot.isCallback ? slot.convertToValue() : slot.convertToCallback(), title: `convert to ${slot.isCallback ? 'regular value' : 'callback'}`, color: "secondary" }, !slot.isCallback ? React.createElement(RadioButtonUncheckedIcon, null) : React.createElement(SvgCheckbox, null))) : null)));
174
+ });
175
+ export default SlotEditor;
176
+ //# sourceMappingURL=SlotEditor.js.map