@eclipse-glsp/client 2.2.0-next.346 → 2.2.0-next.348

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 (61) hide show
  1. package/css/grid.css +6 -1
  2. package/lib/base/auto-complete/base-autocomplete-palette.d.ts +3 -2
  3. package/lib/base/auto-complete/base-autocomplete-palette.d.ts.map +1 -1
  4. package/lib/base/auto-complete/base-autocomplete-palette.js +3 -2
  5. package/lib/base/auto-complete/base-autocomplete-palette.js.map +1 -1
  6. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.d.ts +3 -2
  7. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.d.ts.map +1 -1
  8. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js +3 -2
  9. package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js.map +1 -1
  10. package/lib/features/accessibility/keyboard-grid/keyboard-grid.d.ts +3 -2
  11. package/lib/features/accessibility/keyboard-grid/keyboard-grid.d.ts.map +1 -1
  12. package/lib/features/accessibility/keyboard-grid/keyboard-grid.js +4 -3
  13. package/lib/features/accessibility/keyboard-grid/keyboard-grid.js.map +1 -1
  14. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts +19 -3
  15. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts.map +1 -1
  16. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js +6 -5
  17. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js.map +1 -1
  18. package/lib/features/accessibility/toast/toast-tool.d.ts +4 -3
  19. package/lib/features/accessibility/toast/toast-tool.d.ts.map +1 -1
  20. package/lib/features/accessibility/toast/toast-tool.js +3 -2
  21. package/lib/features/accessibility/toast/toast-tool.js.map +1 -1
  22. package/lib/features/grid/grid-style.d.ts +25 -0
  23. package/lib/features/grid/grid-style.d.ts.map +1 -0
  24. package/lib/features/grid/grid-style.js +29 -0
  25. package/lib/features/grid/grid-style.js.map +1 -0
  26. package/lib/features/label-edit-ui/label-edit-ui.d.ts.map +1 -1
  27. package/lib/features/label-edit-ui/label-edit-ui.js +1 -0
  28. package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
  29. package/lib/features/status/status-overlay.d.ts +18 -2
  30. package/lib/features/status/status-overlay.d.ts.map +1 -1
  31. package/lib/features/status/status-overlay.js +3 -2
  32. package/lib/features/status/status-overlay.js.map +1 -1
  33. package/lib/features/tool-palette/tool-palette.d.ts +3 -2
  34. package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
  35. package/lib/features/tool-palette/tool-palette.js +2 -1
  36. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  37. package/lib/index.d.ts +1 -0
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/index.js +1 -0
  40. package/lib/index.js.map +1 -1
  41. package/lib/views/ggraph-view.d.ts +2 -2
  42. package/lib/views/ggraph-view.d.ts.map +1 -1
  43. package/lib/views/ggraph-view.js +14 -7
  44. package/lib/views/ggraph-view.js.map +1 -1
  45. package/lib/views/glsp-projection-view.d.ts +2 -2
  46. package/lib/views/glsp-projection-view.d.ts.map +1 -1
  47. package/lib/views/glsp-projection-view.js +14 -7
  48. package/lib/views/glsp-projection-view.js.map +1 -1
  49. package/package.json +3 -3
  50. package/src/base/auto-complete/base-autocomplete-palette.ts +3 -2
  51. package/src/features/accessibility/key-shortcut/accessible-key-shortcut.ts +3 -2
  52. package/src/features/accessibility/keyboard-grid/keyboard-grid.ts +9 -9
  53. package/src/features/accessibility/keyboard-pointer/keyboard-pointer.ts +6 -13
  54. package/src/features/accessibility/toast/toast-tool.ts +5 -4
  55. package/src/features/grid/grid-style.ts +25 -0
  56. package/src/features/label-edit-ui/label-edit-ui.ts +1 -0
  57. package/src/features/status/status-overlay.ts +3 -2
  58. package/src/features/tool-palette/tool-palette.ts +2 -2
  59. package/src/index.ts +1 -0
  60. package/src/views/ggraph-view.tsx +14 -7
  61. package/src/views/glsp-projection-view.tsx +14 -7
package/src/index.ts CHANGED
@@ -142,6 +142,7 @@ export * from './features/grid/grid-manager';
142
142
  export * from './features/grid/grid-model';
143
143
  export * from './features/grid/grid-module';
144
144
  export * from './features/grid/grid-snapper';
145
+ export * from './features/grid/grid-style';
145
146
  export * from './features/helper-lines/helper-line-feedback';
146
147
  export * from './features/helper-lines/helper-line-manager';
147
148
  export * from './features/helper-lines/helper-line-manager-default';
@@ -17,6 +17,7 @@ import { Bounds, Dimension, Point, RenderingContext, SGraphImpl, SGraphView, Wri
17
17
  import { inject, injectable, optional } from 'inversify';
18
18
  import { VNode } from 'snabbdom';
19
19
  import { GridManager, GridStyle } from '../features/grid/grid-manager';
20
+ import { GridProperty } from '../features/grid/grid-style';
20
21
 
21
22
  @injectable()
22
23
  export class GGraphView extends SGraphView {
@@ -30,16 +31,21 @@ export class GGraphView extends SGraphView {
30
31
  return graph;
31
32
  }
32
33
 
33
- protected getGridStyle(model: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
34
+ protected getGridStyle(viewport: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
34
35
  if (context.targetKind === 'hidden' || !this.gridManager?.isGridVisible) {
35
36
  return {};
36
37
  }
37
- const bounds = this.getBackgroundBounds(model, context, this.gridManager);
38
+ const bounds = this.getBackgroundBounds(viewport, context, this.gridManager);
38
39
  return {
40
+ [GridProperty.GRID_BACKGROUND_X]: bounds.x + 'px',
41
+ [GridProperty.GRID_BACKGROUND_Y]: bounds.y + 'px',
42
+ [GridProperty.GRID_BACKGROUND_WIDTH]: bounds.width + 'px',
43
+ [GridProperty.GRID_BACKGROUND_HEIGHT]: bounds.height + 'px',
44
+ [GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + '',
45
+ [GridProperty.GRID_BACKGROUND_IMAGE]: this.getBackgroundImage(viewport, context, this.gridManager),
39
46
  backgroundPosition: `${bounds.x}px ${bounds.y}px`,
40
- backgroundSize: `${bounds.width}px ${bounds.height}px`,
41
- // we do not set the background image directly in the style object, because we want to toggle it on and off via CSS
42
- '--grid-background-image': this.getBackgroundImage(model, context, this.gridManager)
47
+ backgroundSize: `${bounds.width}px ${bounds.height}px`
48
+ // we do not set the background-image directly in the style object, because we want to toggle it on and off via CSS
43
49
  };
44
50
  }
45
51
 
@@ -49,8 +55,9 @@ export class GGraphView extends SGraphView {
49
55
  return { ...position, ...size };
50
56
  }
51
57
 
52
- protected getBackgroundImage(model: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
58
+ protected getBackgroundImage(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
59
+ const color = getComputedStyle(document.documentElement).getPropertyValue(GridProperty.GRID_COLOR).trim().replace(/#/g, '%23');
53
60
  // eslint-disable-next-line max-len
54
- return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="black" stroke-width="1" stroke-opacity="0.10" /></svg>')`;
61
+ return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="${color}" stroke-width="1" /></svg>')`;
55
62
  }
56
63
  }
@@ -34,6 +34,7 @@ import {
34
34
  import { inject, injectable, optional } from 'inversify';
35
35
  import { VNode, VNodeStyle, h } from 'snabbdom';
36
36
  import { GridManager, GridStyle } from '../features/grid/grid-manager';
37
+ import { GridProperty } from '../features/grid/grid-style';
37
38
 
38
39
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
40
  const JSX = { createElement: html };
@@ -71,16 +72,21 @@ export class GLSPProjectionView extends ProjectedViewportView {
71
72
  return svg;
72
73
  }
73
74
 
74
- protected getGridStyle(model: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
75
+ protected getGridStyle(viewport: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
75
76
  if (context.targetKind === 'hidden' || !this.gridManager?.isGridVisible) {
76
77
  return {};
77
78
  }
78
- const bounds = this.getBackgroundBounds(model, context, this.gridManager);
79
+ const bounds = this.getBackgroundBounds(viewport, context, this.gridManager);
79
80
  return {
81
+ [GridProperty.GRID_BACKGROUND_X]: bounds.x + 'px',
82
+ [GridProperty.GRID_BACKGROUND_Y]: bounds.y + 'px',
83
+ [GridProperty.GRID_BACKGROUND_WIDTH]: bounds.width + 'px',
84
+ [GridProperty.GRID_BACKGROUND_HEIGHT]: bounds.height + 'px',
85
+ [GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + '',
86
+ [GridProperty.GRID_BACKGROUND_IMAGE]: this.getBackgroundImage(viewport, context, this.gridManager),
80
87
  backgroundPosition: `${bounds.x}px ${bounds.y}px`,
81
- backgroundSize: `${bounds.width}px ${bounds.height}px`,
82
- // we do not set the background image directly in the style object, because we want to toggle it on and off via CSS
83
- '--grid-background-image': this.getBackgroundImage(model, context, this.gridManager)
88
+ backgroundSize: `${bounds.width}px ${bounds.height}px`
89
+ // we do not set the background-image directly in the style object, because we want to toggle it on and off via CSS
84
90
  };
85
91
  }
86
92
 
@@ -90,9 +96,10 @@ export class GLSPProjectionView extends ProjectedViewportView {
90
96
  return { ...position, ...size };
91
97
  }
92
98
 
93
- protected getBackgroundImage(model: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
99
+ protected getBackgroundImage(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
100
+ const color = getComputedStyle(document.documentElement).getPropertyValue(GridProperty.GRID_COLOR).trim().replace(/#/g, '%23');
94
101
  // eslint-disable-next-line max-len
95
- return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="black" stroke-width="1" stroke-opacity="0.10" /></svg>')`;
102
+ return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="${color}" stroke-width="1" /></svg>')`;
96
103
  }
97
104
 
98
105
  protected override renderProjectionBar(