Skip to content
Merged
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
14 changes: 2 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,10 @@ jobs:
path: packages/core/coverage/lcov-report
- name: Test TypeScript support
run: npm test -w packages/ts-support
- name: Build ts-example (custom shapes)
run: npm run build -w packages/ts-example
- name: Build ts-example (selected features)
run: npm run build -w packages/ts-example-selected-features
- name: Build ts-example (without defaults)
run: npm run build -w packages/ts-example-without-defaults
- name: Build all examples
run: ./build-all-examples.bash
- name: Build Storybook mini-site
run: npm run build -w packages/html
- name: Build js-example
run: npm run build -w packages/js-example
- name: Build js-example (selected features)
run: npm run build -w packages/js-example-selected-features
- name: Build js-example (without defaults)
run: npm run build -w packages/js-example-without-defaults
- name: Upload all examples as artifact
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _**Note:** Yet to be released breaking changes appear here._
- `constants.ARROW` --> `ArrowValue`
- `constants.DIRECTION` --> `DirectionValue`
- `constants.EDGESTYLE` --> `EdgeStyleValue`
- `constants.ELBOW` --> `ElbowValue`
- `constants.PERIMETER` --> `PerimeterValue`
- `constants.RENDERING_HINT`: no replacement as it wasn't used
- `constants.SHAPE` --> `ShapeValue`
Expand Down
17 changes: 17 additions & 0 deletions build-all-examples.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

# This script builds all examples in the packages directory.
echo "Building all examples..."

for dir in packages/ts-example* packages/js-example*; do
if [ -d "$dir" ]; then
echo
echo "##################################################"
echo "Building $dir"
echo "##################################################"
(cd "$dir" && npm run build)
fi
done

echo "All examples built successfully."
8 changes: 6 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ export type CellStateStyle = {
* This defines how the three-segment orthogonal edge style leaves its terminal vertices.
* The 'vertical' style leaves the terminal vertices at the top and bottom sides.
*
* The possible values are 'horizontal' and 'vertical'.
* @default 'horizontal'
*/
elbow?: 'horizontal' | 'vertical';
elbow?: ElbowValue;
/**
* This defines the style of the end arrow marker.
*
Expand Down Expand Up @@ -1468,3 +1467,8 @@ export type DialectValue =
| 'strictHtml'
/** The SVG display dialect name. */
| 'svg';

/**
* @since 0.20.0
*/
export type ElbowValue = 'horizontal' | 'vertical';
8 changes: 0 additions & 8 deletions packages/core/src/util/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,3 @@ export const DIRECTION_MASK = {
/** All directions. */
ALL: 15,
};

/**
* Default is horizontal.
*/
export enum ELBOW {
VERTICAL = 'vertical',
HORIZONTAL = 'horizontal',
}
4 changes: 2 additions & 2 deletions packages/core/src/view/handler/ElbowEdgeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
*/

import EdgeHandler from './EdgeHandler';
import { CURSOR, ELBOW } from '../../util/Constants';
import { CURSOR } from '../../util/Constants';
import InternalEvent from '../event/InternalEvent';
import Point from '../geometry/Point';
import Rectangle from '../geometry/Rectangle';
Expand Down Expand Up @@ -113,7 +113,7 @@ class ElbowEdgeHandler extends EdgeHandler {
getCursorForBend() {
return this.state.style.edgeStyle === 'topToBottomEdgeStyle' ||
(this.state.style.edgeStyle === 'elbowEdgeStyle' &&
this.state.style.elbow === ELBOW.VERTICAL)
this.state.style.elbow === 'vertical')
? 'row-resize'
: 'col-resize';
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/view/mixins/EdgeMixin.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ declare module '../AbstractGraph' {
* graph.flipEdge = function(edge) {
* if (edge) {
* const style = this.getCurrentCellStyle(edge);
* const elbow = style.elbow ?? Constants.ELBOW.HORIZONTAL;
* const value = (elbow == Constants.ELBOW.HORIZONTAL) ? Constants.ELBOW.VERTICAL : Constants.ELBOW.HORIZONTAL;
* const elbow = style.elbow ?? 'horizontal';
* const value = (elbow == 'horizontal') ? 'vertical' : 'horizontal';
* this.setCellStyles('elbow', value, [edge]);
* }
* };
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/view/style/edge/Elbow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { SideToSide } from './SideToSide';
import { TopToBottom } from './TopToBottom';
import CellState from '../../cell/CellState';
import Point from '../../geometry/Point';
import { ELBOW } from '../../../util/Constants';

import type { EdgeStyleFunction } from '../../../types';

Expand Down Expand Up @@ -67,7 +66,7 @@ export const ElbowConnector: EdgeStyleFunction = (
}
}

if (!horizontal && (vertical || state.style.elbow === ELBOW.VERTICAL)) {
if (!horizontal && (vertical || state.style.elbow === 'vertical')) {
TopToBottom(state, source, target, points, result);
} else {
SideToSide(state, source, target, points, result);
Expand Down
4 changes: 2 additions & 2 deletions packages/html/stories/Indicators.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { Graph, EdgeStyle, constants, KeyHandler } from '@maxgraph/core';
import { Graph, EdgeStyle, KeyHandler } from '@maxgraph/core';
import { globalTypes, globalValues } from './shared/args.js';
import { createGraphContainer } from './shared/configure.js';

Expand Down Expand Up @@ -58,7 +58,7 @@ const Template = ({ label, ...args }) => {
style = graph.getStylesheet().getDefaultEdgeStyle();

style.edge = EdgeStyle.ElbowConnector;
style.elbow = constants.ELBOW.VERTICAL;
style.elbow = 'vertical';
style.rounded = true;

// Gets the default parent for inserting new cells. This
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-example-selected-features/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig(({ mode }) => {
},
},
},
chunkSizeWarningLimit: 380, // @maxgraph/core
chunkSizeWarningLimit: 378, // @maxgraph/core
},
};
});
2 changes: 1 addition & 1 deletion packages/ts-example-without-defaults/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig(({ mode }) => {
},
},
},
chunkSizeWarningLimit: 329, // @maxgraph/core
chunkSizeWarningLimit: 327, // @maxgraph/core
},
};
});
2 changes: 1 addition & 1 deletion packages/ts-example/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig(({ mode }) => {
},
},
},
chunkSizeWarningLimit: 438, // @maxgraph/core
chunkSizeWarningLimit: 436, // @maxgraph/core
},
};
});