Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ examples/workflow-standalone/server

.claude/local.settings.json
.claude/plans

.playwright-cli
11 changes: 11 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ Eclipse GLSP Client monorepo. Provides the sprotty-based client framework for th
- After completing any code changes, always run the `/verify` skill before reporting completion
- If verification fails, run the `/fix` skill to auto-fix issues, then re-run `/verify`

## Commenting Style

- **TSDoc (`/** ... \*/`) on the public API\*\*: document exported interfaces, types, classes, methods, and notable properties/getters. Describe intent and behavior, not the obvious signature.
- **Cross-reference with `{@link Symbol}`** instead of writing bare type/method names in prose.
- **Document non-trivial methods** with `@param`/`@returns` (and `@throws` where relevant). Skip them for self-explanatory one-liners.
- **Deprecations** use the fixed form `/** @deprecated Use {@link Replacement} instead */`.
- **Inline `//` comments explain _why_, not _what_** — keep them short and lowercase, and reserve them for non-obvious decisions or rationale.
- **Mark known limitations** with `// FIXME:` / `// TODO:`, and justify suppressions with `// eslint-disable-next-line <rule>`.
- Don't restate code in comments; let clear naming carry the _what_.
- Copyright headers are required on every file but are handled by `/verify` + `/fix` — don't add them manually.

## Inter-Package Import Rules

These are enforced by ESLint and are easy to get wrong:
Expand Down
4 changes: 3 additions & 1 deletion examples/workflow-glsp/src/workflow-diagram-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import '../css/diagram.css';
import { taskEditorModule } from './direct-task-editing/task-editor-module';
import { BranchingNode, CategoryNode, Icon, SynchronizationNode, TaskNode, WeightedEdge } from './model';
import { WorkflowSnapper } from './workflow-snapper';
import { WorkflowStartup } from './workflow-startup';
import { GridDefaultVisible, WorkflowStartup } from './workflow-startup';
import { IconView, WorkflowEdgeView } from './workflow-views';

export const workflowDiagramModule = new FeatureModule(
Expand Down Expand Up @@ -92,6 +92,8 @@ export const workflowDiagramModule = new FeatureModule(
});

bindAsService(context, TYPES.IDiagramStartup, WorkflowStartup);
bind(GridDefaultVisible).toConstantValue(true);

bindOrRebind(context, TYPES.ISnapper).to(WorkflowSnapper);
},
{ featureId: Symbol('workflowDiagram') }
Expand Down
13 changes: 11 additions & 2 deletions examples/workflow-glsp/src/workflow-startup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2024 EclipseSource and others.
* Copyright (c) 2024-2026 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -18,13 +18,22 @@ import { IDiagramStartup, IGridManager } from '@eclipse-glsp/client';
import { MaybePromise, TYPES } from '@eclipse-glsp/sprotty';
import { inject, injectable, optional } from 'inversify';

/**
* Injection symbol for the initial grid visibility applied by the {@link WorkflowStartup}.
* Defaults to `true` (grid shown); rebind to override (e.g. the standalone app derives it from a url
* parameter).
*/
export const GridDefaultVisible = Symbol('GridDefaultVisible');

@injectable()
export class WorkflowStartup implements IDiagramStartup {
rank = -1;

@inject(TYPES.IGridManager) @optional() protected gridManager?: IGridManager;

@inject(GridDefaultVisible) @optional() protected gridDefaultVisible?: boolean;

preRequestModel(): MaybePromise<void> {
this.gridManager?.setGridVisible(true);
this.gridManager?.setGridVisible(this.gridDefaultVisible ?? true);
}
}
4 changes: 2 additions & 2 deletions examples/workflow-glsp/src/workflow-views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
<path
class-sprotty-edge={true}
class-arrow={true}
d='M 1,0 L 10,-4 L 10,4 Z'
d='M 0,0 L 9,-3.5 L 9,3.5 Z'
transform={`rotate(${toDegrees(angleOfPoint(Point.subtract(p1, p2)))} ${p2.x} ${p2.y}) translate(${p2.x} ${p2.y})`}
/>
);
Expand Down Expand Up @@ -77,7 +77,7 @@ export class IconView extends ShapeView {

d={icon}
/>
<rect class-icon-background x={0} y={0} width={25} height={20} />
<rect class-icon-background x={0} y={0} width={25} height={20} rx={4} ry={4} />
{context.renderChildren(element)}
</g>
);
Expand Down
19 changes: 19 additions & 0 deletions examples/workflow-standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,22 @@ All `start` and `dev` scripts support the following flags:
- `--client-port <port>` – Set the webpack dev server port (default: 8082 in Node mode, 8083 in Browser mode)

The server bundle download can also be skipped by setting the `SKIP_DOWNLOAD=true` environment variable.

## URL Parameters

The running application reads the following query parameters from the diagram URL. They are independent and can be combined, e.g.:

```
http://localhost:8082/diagram.html?grid&theme=ember&mode=dark
```

| Parameter | Values | Default | Description |
| ---------- | ------------------------------------------------ | ------------- | ---------------------------------------------------------------------------------------------- |
| `readonly` | _flag_ (presence only) | editable | Open the diagram in read-only mode (editing disabled). |
| `grid` | _flag_ (presence only) | off | Show the background grid. |
| `theme` | `tide`, `graphite`, `ember`, `orchid`, `verdant` | `tide` | Set the color theme. Persisted in local storage, so it also updates the in-app theme switcher. |
| `mode` | `light`, `dark` | OS preference | Set light or dark appearance. Persisted in local storage. |
| `mcp` | _flag_ (presence only) | off | Enable the MCP server integration (Node mode only). Also available via the `*:mcp` scripts. |

Flag parameters only need to be present (their value is ignored), e.g. `?grid` or `?readonly`.
Invalid `theme`/`mode` values are ignored and fall back to the stored value or, for `mode`, the OS preference.
Loading
Loading