Skip to content

Commit

Permalink
Merge branch 'master' into 2680-remove_entities
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard authored May 25, 2023
2 parents 823b786 + 0ed2ad1 commit 9e4736a
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ template: |
In this case:
- release the `examples` repository first
- add a link to the RN https://github.com/$OWNER/bpmn-visualization-examples/releases/tag/v0.34.0
Optional: add link to sthe live tatically.io environment including the tag (not the `master` branch)
Optional: add link to the live statically.io environment including the tag (not the `master` branch)
# What's Changed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Send message to Slack channel
if: success()
uses: slackapi/slack-github-action@v1.23.0
uses: slackapi/slack-github-action@v1.24.0
with:
channel-id: 'CSF7TG6N5'
payload: |
Expand Down
34 changes: 20 additions & 14 deletions dev/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type {
ZoomType,
} from '../../src/bpmn-visualization';
import { FlowKind, ShapeBpmnElementKind } from '../../src/bpmn-visualization';
import { fetchBpmnContent, logDownload, logError, logErrorAndOpenAlert, logStartup, stringify } from './utils/internal-helpers';
import { fetchBpmnContent, logDownload, logError, logErrorAndOpenAlert, logStartup } from './utils/internal-helpers';
import { log } from './utils/shared-helpers';
import { DropFileUserInterface } from './component/DropFileUserInterface';
import { SvgExporter } from './component/SvgExporter';
Expand All @@ -44,9 +44,9 @@ let currentTheme: string;
let style: StyleUpdate;

export function updateLoadOptions(fitOptions: FitOptions): void {
log('Updating load options', fitOptions);
log('Updating load options');
loadOptions.fit = fitOptions;
log('Load options updated!', stringify(loadOptions));
log('Load options updated', loadOptions);
}

export function getCurrentLoadOptions(): LoadOptions {
Expand All @@ -73,7 +73,7 @@ function loadBpmn(bpmn: string, handleError = true): void {
log('Loading bpmn...');
try {
bpmnVisualization.load(bpmn, loadOptions);
log('BPMN loaded with configuration', stringify(loadOptions));
log('BPMN loaded with configuration', loadOptions);
collapseBpmnElement(bpmnElementIdToCollapse);
document.dispatchEvent(new CustomEvent('diagramLoaded'));
} catch (error) {
Expand All @@ -88,7 +88,7 @@ function loadBpmn(bpmn: string, handleError = true): void {
export function fit(fitOptions: FitOptions): void {
log('Fitting...');
bpmnVisualization.navigation.fit(fitOptions);
log('Fit done with configuration', stringify(fitOptions));
log('Fit done with configuration', fitOptions);
}

export function zoom(zoomType: ZoomType): void {
Expand Down Expand Up @@ -239,15 +239,21 @@ function configureStyleFromParameters(parameters: URLSearchParams): void {
}

// Collect style properties to update them later with the bpmn-visualization API
// The implementation will be generalized when more properties will be supported (in particular, the query parameter name)
// For example, we could extract all query params starting with style.api, then rebuild the StyleUpdate from the extracted params
style = { stroke: {}, font: {}, fill: {} };

parameters.get('style.api.stroke.color') && (style.stroke.color = parameters.get('style.api.stroke.color'));
parameters.get('style.api.font.color') && (style.font.color = parameters.get('style.api.font.color'));
parameters.get('style.api.font.opacity') && (style.font.opacity = Number(parameters.get('style.api.font.opacity')));
parameters.get('style.api.fill.color') && (style.fill.color = parameters.get('style.api.fill.color'));
parameters.get('style.api.fill.opacity') && (style.fill.opacity = Number(parameters.get('style.api.fill.opacity')));
logStartup(`Configuring the "Update Style" API from query parameters`);
// Only create the StyleUpdate object if some parameters are set
if (Array.from(parameters.keys()).filter(key => key.startsWith('style.api.')).length > 0) {
style = { stroke: {}, font: {}, fill: {} };

parameters.get('style.api.stroke.color') && (style.stroke.color = parameters.get('style.api.stroke.color'));
parameters.get('style.api.font.color') && (style.font.color = parameters.get('style.api.font.color'));
parameters.get('style.api.font.opacity') && (style.font.opacity = Number(parameters.get('style.api.font.opacity')));
parameters.get('style.api.fill.color') && (style.fill.color = parameters.get('style.api.fill.color'));
parameters.get('style.api.fill.opacity') && (style.fill.opacity = Number(parameters.get('style.api.fill.opacity')));

logStartup(`Prepared "Update Style" API object`, style);
} else {
logStartup(`No query parameters, do not set the "Update Style" API object`);
}
}

function configureBpmnElementIdToCollapseFromParameters(parameters: URLSearchParams): void {
Expand Down
4 changes: 0 additions & 4 deletions dev/ts/utils/internal-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ limitations under the License.

import { log } from './shared-helpers';

export function stringify(value: unknown): string {
return JSON.stringify(value, undefined, 2);
}

export function _log(header: string, message: unknown, ...optionalParams: unknown[]): void {
// eslint-disable-next-line no-console
console.info(header + ' ' + message, ...optionalParams);
Expand Down
Loading

0 comments on commit 9e4736a

Please sign in to comment.