@finos/legend-application 7.0.4 → 7.1.2

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 (40) hide show
  1. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  2. package/lib/components/shared/BasicValueSpecificationEditor.js +5 -3
  3. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  4. package/lib/components/shared/LambdaEditor.d.ts +1 -0
  5. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  6. package/lib/components/shared/LambdaEditor.js +12 -5
  7. package/lib/components/shared/LambdaEditor.js.map +1 -1
  8. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  9. package/lib/components/shared/LambdaParameterValuesEditor.js +2 -2
  10. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  11. package/lib/components/shared/PackageableElementOptionRenderer.d.ts +1 -2
  12. package/lib/components/shared/PackageableElementOptionRenderer.d.ts.map +1 -1
  13. package/lib/components/shared/PackageableElementOptionRenderer.js +28 -11
  14. package/lib/components/shared/PackageableElementOptionRenderer.js.map +1 -1
  15. package/lib/components/shared/TextInputEditor.d.ts.map +1 -1
  16. package/lib/components/shared/TextInputEditor.js +3 -1
  17. package/lib/components/shared/TextInputEditor.js.map +1 -1
  18. package/lib/const.d.ts +2 -1
  19. package/lib/const.d.ts.map +1 -1
  20. package/lib/const.js +1 -0
  21. package/lib/const.js.map +1 -1
  22. package/lib/index.css +2 -2
  23. package/lib/index.css.map +1 -1
  24. package/lib/stores/ApplicationStore.d.ts +7 -0
  25. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  26. package/lib/stores/ApplicationStore.js +11 -0
  27. package/lib/stores/ApplicationStore.js.map +1 -1
  28. package/lib/stores/shared/LambdaParameterState.d.ts +2 -1
  29. package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
  30. package/lib/stores/shared/LambdaParameterState.js +4 -2
  31. package/lib/stores/shared/LambdaParameterState.js.map +1 -1
  32. package/package.json +10 -10
  33. package/src/components/shared/BasicValueSpecificationEditor.tsx +6 -4
  34. package/src/components/shared/LambdaEditor.tsx +19 -2
  35. package/src/components/shared/LambdaParameterValuesEditor.tsx +7 -5
  36. package/src/components/shared/PackageableElementOptionRenderer.tsx +19 -25
  37. package/src/components/shared/TextInputEditor.tsx +3 -1
  38. package/src/const.ts +1 -0
  39. package/src/stores/ApplicationStore.ts +13 -0
  40. package/src/stores/shared/LambdaParameterState.ts +6 -1
@@ -14,41 +14,36 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type {
18
- PackageableElement,
19
- GraphManagerState,
17
+ import {
18
+ type PackageableElement,
19
+ isSystemElement,
20
+ isGeneratedElement,
21
+ isDependencyElement,
20
22
  } from '@finos/legend-graph';
21
23
  import type { PackageableElementOption } from '../../stores/shared/PackageableElementOption.js';
22
24
 
23
- const classifyElementGraphArea = (
24
- element: PackageableElement,
25
- graphManagerState: GraphManagerState,
26
- ): string =>
27
- graphManagerState.isSystemElement(element)
25
+ const getElementColorCode = (element: PackageableElement): string =>
26
+ isSystemElement(element)
28
27
  ? 'system'
29
- : graphManagerState.isGeneratedElement(element)
28
+ : isGeneratedElement(element)
30
29
  ? 'generated'
31
- : graphManagerState.isMainGraphElement(element)
32
- ? 'main'
33
- : graphManagerState.isDependencyElement(element)
30
+ : isDependencyElement(element)
34
31
  ? 'dependency'
35
32
  : '';
36
33
 
37
34
  const generateOptionTooltipText = (
38
35
  element: PackageableElement,
39
- graphManagerState: GraphManagerState,
40
36
  ): string | undefined =>
41
- graphManagerState.isSystemElement(element)
37
+ isSystemElement(element)
42
38
  ? 'system element'
43
- : graphManagerState.isGeneratedElement(element)
39
+ : isGeneratedElement(element)
44
40
  ? 'generated element'
45
- : graphManagerState.isDependencyElement(element)
41
+ : isDependencyElement(element)
46
42
  ? 'dependency element'
47
43
  : undefined;
48
44
 
49
45
  export const getPackageableElementOptionFormatter = (props: {
50
46
  darkMode?: boolean;
51
- graphManagerState: GraphManagerState;
52
47
  }): ((
53
48
  option: PackageableElementOption<PackageableElement>,
54
49
  ) => React.ReactNode) =>
@@ -58,18 +53,17 @@ export const getPackageableElementOptionFormatter = (props: {
58
53
  const className = props.darkMode
59
54
  ? 'packageable-element-format-option-label--dark'
60
55
  : 'packageable-element-format-option-label';
56
+ const colorCode = getElementColorCode(option.value);
61
57
 
62
58
  return (
63
59
  <div className={className}>
64
60
  <div
65
- title={`${generateOptionTooltipText(
66
- option.value,
67
- props.graphManagerState,
68
- )}`}
69
- className={`packageable-element-format-option-label-type packageable-element-format-option-label-type--${classifyElementGraphArea(
70
- option.value,
71
- props.graphManagerState,
72
- )}`}
61
+ title={generateOptionTooltipText(option.value)}
62
+ className={`packageable-element-format-option-label-type ${
63
+ colorCode
64
+ ? `packageable-element-format-option-label-type--${colorCode}`
65
+ : ''
66
+ } `}
73
67
  ></div>
74
68
  <div className={`${className}__name`}>{option.label}</div>
75
69
  {option.value.package && (
@@ -92,7 +92,9 @@ export const TextInputEditor: React.FC<{
92
92
  const element = textInputRef.current;
93
93
  const _editor = monacoEditorAPI.create(element, {
94
94
  ...baseTextEditorSettings,
95
- theme: EDITOR_THEME.LEGEND,
95
+ theme: applicationStore.TEMPORARY__isLightThemeEnabled
96
+ ? EDITOR_THEME.TEMPORARY__VSCODE_LIGHT
97
+ : EDITOR_THEME.LEGEND,
96
98
  formatOnType: true,
97
99
  formatOnPaste: true,
98
100
  });
package/src/const.ts CHANGED
@@ -20,6 +20,7 @@ export const MONOSPACED_FONT_FAMILY = 'Roboto Mono';
20
20
 
21
21
  export enum EDITOR_THEME {
22
22
  LEGEND = 'LEGEND',
23
+ TEMPORARY__VSCODE_LIGHT = 'vs',
23
24
  }
24
25
 
25
26
  export enum EDITOR_LANGUAGE {
@@ -136,6 +136,14 @@ export class ApplicationStore<
136
136
  telemetryService = new TelemetryService();
137
137
  tracerService = new TracerService();
138
138
 
139
+ // theme
140
+ /**
141
+ * NOTE: this is the poor man way of doing theming
142
+ * we would need to revise this flag later
143
+ * See https://github.com/finos/legend-studio/issues/264
144
+ */
145
+ TEMPORARY__isLightThemeEnabled = false;
146
+
139
147
  constructor(
140
148
  config: T,
141
149
  navigator: WebApplicationNavigator,
@@ -151,6 +159,7 @@ export class ApplicationStore<
151
159
  notifyWarning: action,
152
160
  notifyIllegalState: action,
153
161
  notifyError: action,
162
+ TEMPORARY__setIsLightThemeEnabled: action,
154
163
  });
155
164
 
156
165
  this.config = config;
@@ -173,6 +182,10 @@ export class ApplicationStore<
173
182
  );
174
183
  }
175
184
 
185
+ TEMPORARY__setIsLightThemeEnabled(val: boolean): void {
186
+ this.TEMPORARY__isLightThemeEnabled = val;
187
+ }
188
+
176
189
  setBlockingAlert(alertInfo: BlockingAlertInfo | undefined): void {
177
190
  this.blockingAlertInfo = alertInfo;
178
191
  }
@@ -90,12 +90,14 @@ export const buildParametersLetLambdaFunc = (
90
90
  export class LambdaParameterState {
91
91
  readonly uuid = uuid();
92
92
  readonly parameter: VariableExpression;
93
+ readonly graph: PureModel;
93
94
  observableContext: ObserverContext;
94
95
  value: ValueSpecification | undefined;
95
96
 
96
97
  constructor(
97
98
  variableExpression: VariableExpression,
98
99
  observableContext: ObserverContext,
100
+ graph: PureModel,
99
101
  ) {
100
102
  makeObservable(this, {
101
103
  value: observable,
@@ -104,10 +106,13 @@ export class LambdaParameterState {
104
106
  });
105
107
  this.observableContext = observableContext;
106
108
  this.parameter = observe_VariableExpression(variableExpression);
109
+ this.graph = graph;
107
110
  }
108
111
 
109
112
  mockParameterValue(): void {
110
- this.setValue(generateVariableExpressionMockValue(this.parameter));
113
+ this.setValue(
114
+ generateVariableExpressionMockValue(this.parameter, this.graph),
115
+ );
111
116
  }
112
117
 
113
118
  setValue(value: ValueSpecification | undefined): void {