@ethlete/cdk 5.0.0-next.15 → 5.0.0-next.16
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.
- package/CHANGELOG.md +10 -0
- package/fesm2022/ethlete-cdk.mjs +476 -277
- package/fesm2022/ethlete-cdk.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ethlete-cdk.d.ts +38 -5
package/fesm2022/ethlete-cdk.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, TemplateRef, ViewContainerRef, Directive, input, booleanAttribute, computed, isDevMode, model, contentChild, effect, untracked, ChangeDetectionStrategy, ViewEncapsulation, Component, contentChildren, ElementRef, Injector, Input, numberAttribute,
|
|
2
|
+
import { InjectionToken, inject, TemplateRef, ViewContainerRef, Directive, input, booleanAttribute, computed, isDevMode, model, contentChild, effect, untracked, ChangeDetectionStrategy, ViewEncapsulation, Component, contentChildren, ElementRef, Injector, Input, numberAttribute, NgZone, Injectable, ChangeDetectorRef, signal, forwardRef, ViewChild, ContentChildren, assertInInjectionContext, createComponent, EnvironmentInjector, DOCUMENT, createEnvironmentInjector, runInInjectionContext, linkedSignal, DestroyRef, isSignal, viewChild, viewChildren, provideEnvironmentInitializer, ApplicationRef, output, ContentChild, ViewChildren, EventEmitter, Output, Optional, SkipSelf, IterableDiffers, ComponentFactoryResolver, HostAttributeToken } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/cdk/portal';
|
|
4
4
|
import { CdkPortal, PortalModule, ComponentPortal, CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
|
|
5
5
|
import { DomSanitizer, Title } from '@angular/platform-browser';
|
|
@@ -2413,6 +2413,20 @@ const generateBracketRoundSwissGroupMaps = (bracketData) => {
|
|
|
2413
2413
|
return roundsWithSwissGroups;
|
|
2414
2414
|
};
|
|
2415
2415
|
|
|
2416
|
+
class NewBracketDefaultContinueComponent {
|
|
2417
|
+
constructor() {
|
|
2418
|
+
this.bracketMatches = input.required(...(ngDevMode ? [{ debugName: "bracketMatches" }] : /* istanbul ignore next */ []));
|
|
2419
|
+
}
|
|
2420
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: NewBracketDefaultContinueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2421
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: NewBracketDefaultContinueComponent, isStandalone: true, selector: "et-new-bracket-default-continue", inputs: { bracketMatches: { classPropertyName: "bracketMatches", publicName: "bracketMatches", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "et-new-bracket-default-continue-host" }, ngImport: i0, template: ` Next stage ({{ bracketMatches().length }}) `, isInline: true, styles: [".et-new-bracket-default-continue-host{display:flex;padding:8px;border:1px dashed cyan;inline-size:100%;block-size:100%;justify-content:center;align-items:center;box-sizing:border-box;font-size:12px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2422
|
+
}
|
|
2423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: NewBracketDefaultContinueComponent, decorators: [{
|
|
2424
|
+
type: Component,
|
|
2425
|
+
args: [{ selector: 'et-new-bracket-default-continue', template: ` Next stage ({{ bracketMatches().length }}) `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
2426
|
+
class: 'et-new-bracket-default-continue-host',
|
|
2427
|
+
}, styles: [".et-new-bracket-default-continue-host{display:flex;padding:8px;border:1px dashed cyan;inline-size:100%;block-size:100%;justify-content:center;align-items:center;box-sizing:border-box;font-size:12px}\n"] }]
|
|
2428
|
+
}], propDecorators: { bracketMatches: [{ type: i0.Input, args: [{ isSignal: true, alias: "bracketMatches", required: true }] }] } });
|
|
2429
|
+
|
|
2416
2430
|
class NewBracketDefaultMatchComponent {
|
|
2417
2431
|
constructor() {
|
|
2418
2432
|
this.bracketRound = input.required(...(ngDevMode ? [{ debugName: "bracketRound" }] : /* istanbul ignore next */ []));
|
|
@@ -2493,233 +2507,6 @@ const curvePath = (from, to, direction, options) => {
|
|
|
2493
2507
|
return path(d, options.path);
|
|
2494
2508
|
};
|
|
2495
2509
|
|
|
2496
|
-
const linePath = (from, to, options) => {
|
|
2497
|
-
return path(`M ${from.inline.end} ${from.block.center} L ${to.inline.start} ${to.block.center}`, options.path);
|
|
2498
|
-
};
|
|
2499
|
-
|
|
2500
|
-
const makePos = (dimensions) => ({
|
|
2501
|
-
block: {
|
|
2502
|
-
start: dimensions.top,
|
|
2503
|
-
end: dimensions.top + dimensions.height,
|
|
2504
|
-
center: dimensions.top + dimensions.height / 2,
|
|
2505
|
-
},
|
|
2506
|
-
inline: {
|
|
2507
|
-
start: dimensions.left,
|
|
2508
|
-
end: dimensions.left + dimensions.width,
|
|
2509
|
-
center: dimensions.left + dimensions.width / 2,
|
|
2510
|
-
},
|
|
2511
|
-
});
|
|
2512
|
-
const drawMan = (dimensions) => {
|
|
2513
|
-
const svgParts = [];
|
|
2514
|
-
for (const col of dimensions.bracketGrid.columns) {
|
|
2515
|
-
for (const el of col.elements) {
|
|
2516
|
-
if (el.type === 'header')
|
|
2517
|
-
continue;
|
|
2518
|
-
const currentMatchParticipantsShortIds = [el.match.home?.shortId, el.match.away?.shortId]
|
|
2519
|
-
.filter((id) => !!id)
|
|
2520
|
-
.join(' ');
|
|
2521
|
-
const pathOptions = { ...dimensions.path, className: currentMatchParticipantsShortIds };
|
|
2522
|
-
const currentPos = makePos(el.dimensions);
|
|
2523
|
-
// No lines for the third place match
|
|
2524
|
-
if (el.round.type === COMMON_BRACKET_ROUND_TYPE.THIRD_PLACE)
|
|
2525
|
-
continue;
|
|
2526
|
-
switch (el.match.relation.type) {
|
|
2527
|
-
case 'nothing-to-one': {
|
|
2528
|
-
continue;
|
|
2529
|
-
}
|
|
2530
|
-
case 'one-to-nothing':
|
|
2531
|
-
case 'one-to-one': {
|
|
2532
|
-
const prev = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousMatch.id);
|
|
2533
|
-
const prevPos = makePos(prev.dimensions);
|
|
2534
|
-
// draw a straight line
|
|
2535
|
-
svgParts.push(linePath(prevPos, currentPos, { path: pathOptions }));
|
|
2536
|
-
break;
|
|
2537
|
-
}
|
|
2538
|
-
case 'two-to-nothing':
|
|
2539
|
-
case 'two-to-one': {
|
|
2540
|
-
const prevUpper = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousUpperMatch.id);
|
|
2541
|
-
const prevLower = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousLowerMatch.id);
|
|
2542
|
-
const prevUpperPos = makePos(prevUpper.dimensions);
|
|
2543
|
-
const prevLowerPos = makePos(prevLower.dimensions);
|
|
2544
|
-
const isLowerUpperMerger = el.match.relation.previousLowerRound.id !== el.match.relation.previousUpperRound.id;
|
|
2545
|
-
const invertCurve = el.round.mirrorRoundType === BRACKET_ROUND_MIRROR_TYPE.RIGHT;
|
|
2546
|
-
const curveOptions = {
|
|
2547
|
-
...dimensions.curve,
|
|
2548
|
-
inverted: invertCurve,
|
|
2549
|
-
path: { ...dimensions.path, className: '' },
|
|
2550
|
-
};
|
|
2551
|
-
if (isLowerUpperMerger) {
|
|
2552
|
-
svgParts.push(linePath(prevUpperPos, currentPos, { path: pathOptions }));
|
|
2553
|
-
}
|
|
2554
|
-
else {
|
|
2555
|
-
// draw two lines that merge into one in the middle
|
|
2556
|
-
svgParts.push(curvePath(prevUpperPos, currentPos, 'down', {
|
|
2557
|
-
...curveOptions,
|
|
2558
|
-
path: {
|
|
2559
|
-
...curveOptions.path,
|
|
2560
|
-
className: el.match.relation.previousUpperMatch.winner?.shortId || '',
|
|
2561
|
-
},
|
|
2562
|
-
}));
|
|
2563
|
-
}
|
|
2564
|
-
svgParts.push(curvePath(prevLowerPos, currentPos, 'up', {
|
|
2565
|
-
...curveOptions,
|
|
2566
|
-
path: {
|
|
2567
|
-
...curveOptions.path,
|
|
2568
|
-
className: el.match.relation.previousLowerMatch.winner?.shortId || '',
|
|
2569
|
-
},
|
|
2570
|
-
}));
|
|
2571
|
-
if (el.round.mirrorRoundType === BRACKET_ROUND_MIRROR_TYPE.RIGHT &&
|
|
2572
|
-
el.match.relation.type === 'two-to-one' &&
|
|
2573
|
-
el.match.relation.nextRound.mirrorRoundType === null) {
|
|
2574
|
-
// draw a straight line for the special case of connecting the final match to the mirrored semi final match
|
|
2575
|
-
const next = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.nextMatch.id);
|
|
2576
|
-
const nextPos = makePos(next.dimensions);
|
|
2577
|
-
svgParts.push(linePath(nextPos, currentPos, { path: pathOptions }));
|
|
2578
|
-
}
|
|
2579
|
-
break;
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
return svgParts.join('');
|
|
2585
|
-
};
|
|
2586
|
-
|
|
2587
|
-
// Every finalized column of a swiss grid is one group section. The connection lines run
|
|
2588
|
-
// from group to group instead of match to match: the winners of group (w-l) move to group
|
|
2589
|
-
// (w+1-l) inside the next round, the losers move to group (w-l+1).
|
|
2590
|
-
const collectSwissRoundGeometries = (bracketGrid) => {
|
|
2591
|
-
const rounds = new Map();
|
|
2592
|
-
for (const column of bracketGrid.columns) {
|
|
2593
|
-
const matchElements = column.elements.filter((element) => element.type === 'match');
|
|
2594
|
-
const group = matchElements[0]?.roundSwissGroup;
|
|
2595
|
-
const round = matchElements[0]?.round;
|
|
2596
|
-
if (!group || !round)
|
|
2597
|
-
continue;
|
|
2598
|
-
const [wins, losses] = group.id.split('-').map(Number);
|
|
2599
|
-
if (wins === undefined || losses === undefined || isNaN(wins) || isNaN(losses)) {
|
|
2600
|
-
throw new Error(`Unable to parse wins and losses from Swiss group id: ${group.id}`);
|
|
2601
|
-
}
|
|
2602
|
-
const matchesTop = Math.min(...matchElements.map((element) => element.dimensions.top));
|
|
2603
|
-
const matchesBottom = Math.max(...matchElements.map((element) => element.dimensions.top + element.dimensions.height));
|
|
2604
|
-
const winnerShortIds = [];
|
|
2605
|
-
const loserShortIds = [];
|
|
2606
|
-
for (const element of matchElements) {
|
|
2607
|
-
if (!element.match.winner)
|
|
2608
|
-
continue;
|
|
2609
|
-
const winner = element.match.winner;
|
|
2610
|
-
const loser = element.match.home?.id === winner.id ? element.match.away : element.match.home;
|
|
2611
|
-
winnerShortIds.push(winner.shortId);
|
|
2612
|
-
if (loser)
|
|
2613
|
-
loserShortIds.push(loser.shortId);
|
|
2614
|
-
}
|
|
2615
|
-
// The lines attach to the group border, which wraps the matches plus the group
|
|
2616
|
-
// padding and therefore matches the section bounds horizontally.
|
|
2617
|
-
const position = {
|
|
2618
|
-
block: {
|
|
2619
|
-
start: matchesTop,
|
|
2620
|
-
end: matchesBottom,
|
|
2621
|
-
center: (matchesTop + matchesBottom) / 2,
|
|
2622
|
-
},
|
|
2623
|
-
inline: {
|
|
2624
|
-
start: column.dimensions.left,
|
|
2625
|
-
end: column.dimensions.left + column.dimensions.width,
|
|
2626
|
-
center: column.dimensions.left + column.dimensions.width / 2,
|
|
2627
|
-
},
|
|
2628
|
-
};
|
|
2629
|
-
let roundGeometry = rounds.get(round.id);
|
|
2630
|
-
if (!roundGeometry) {
|
|
2631
|
-
roundGeometry = { groups: new Map() };
|
|
2632
|
-
rounds.set(round.id, roundGeometry);
|
|
2633
|
-
}
|
|
2634
|
-
roundGeometry.groups.set(group.id, {
|
|
2635
|
-
id: group.id,
|
|
2636
|
-
wins,
|
|
2637
|
-
losses,
|
|
2638
|
-
colorType: getSwissGroupColorType(wins, losses),
|
|
2639
|
-
position,
|
|
2640
|
-
winnerShortIds,
|
|
2641
|
-
loserShortIds,
|
|
2642
|
-
});
|
|
2643
|
-
}
|
|
2644
|
-
// The finalized columns are ordered left to right, so first appearance equals round order
|
|
2645
|
-
return Array.from(rounds.values());
|
|
2646
|
-
};
|
|
2647
|
-
const groupBorderRect = (group, border, color) => {
|
|
2648
|
-
// The group box wraps the matches plus the group padding plus the border itself. The
|
|
2649
|
-
// rect is inset by half the stroke width so the stroke renders fully inside the group
|
|
2650
|
-
// bounds instead of getting cut off at the edges of the bracket container.
|
|
2651
|
-
const boxPadding = border.padding + border.width;
|
|
2652
|
-
const strokeInset = border.width / 2;
|
|
2653
|
-
const x = group.position.inline.start + strokeInset;
|
|
2654
|
-
const y = group.position.block.start - boxPadding + strokeInset;
|
|
2655
|
-
const width = group.position.inline.end - group.position.inline.start - border.width;
|
|
2656
|
-
const height = group.position.block.end - group.position.block.start + boxPadding * 2 - border.width;
|
|
2657
|
-
return `<rect x="${x}" y="${y}" width="${width}" height="${height}" rx="${border.radius}" stroke="${color ?? 'currentColor'}" fill="none" stroke-width="${border.width}" class="et-bracket-new-swiss-group-border et-bracket-new-swiss-group-border--${group.id} et-bracket-new-swiss-group-border--${group.colorType}" />`;
|
|
2658
|
-
};
|
|
2659
|
-
// A horizontal gradient for the connection lines: they leave the source group in its
|
|
2660
|
-
// color, fade to the neutral color towards their vertical jog in the middle and fade into
|
|
2661
|
-
// the target group color on the second half. The connection lines always run from left to
|
|
2662
|
-
// right, so user space coordinates can be used (they also work for straight lines, where
|
|
2663
|
-
// the bounding box has no height).
|
|
2664
|
-
const lineGradientDef = (id, fromX, toX, from, neutral, to) => `<linearGradient id="${id}" gradientUnits="userSpaceOnUse" x1="${fromX}" y1="0" x2="${toX}" y2="0"><stop offset="0%" stop-color="${from}" /><stop offset="50%" stop-color="${neutral}" /><stop offset="100%" stop-color="${to}" /></linearGradient>`;
|
|
2665
|
-
const drawSwissMan = (dimensions) => {
|
|
2666
|
-
const svgParts = [];
|
|
2667
|
-
const gradientDefs = [];
|
|
2668
|
-
const roundGeometries = collectSwissRoundGeometries(dimensions.bracketGrid);
|
|
2669
|
-
const colors = dimensions.colors;
|
|
2670
|
-
for (const roundGeometry of roundGeometries) {
|
|
2671
|
-
for (const group of roundGeometry.groups.values()) {
|
|
2672
|
-
svgParts.push(groupBorderRect(group, dimensions.groupBorder, colors?.[group.colorType]));
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
const curveOptions = {
|
|
2676
|
-
lineStartingCurveAmount: dimensions.curve.lineStartingCurveAmount,
|
|
2677
|
-
lineEndingCurveAmount: dimensions.curve.lineStartingCurveAmount,
|
|
2678
|
-
};
|
|
2679
|
-
let edgeIndex = 0;
|
|
2680
|
-
for (const [roundIndex, roundGeometry] of roundGeometries.entries()) {
|
|
2681
|
-
const nextRoundGeometry = roundGeometries[roundIndex + 1];
|
|
2682
|
-
if (!nextRoundGeometry)
|
|
2683
|
-
break;
|
|
2684
|
-
for (const group of roundGeometry.groups.values()) {
|
|
2685
|
-
const targets = [
|
|
2686
|
-
{ geometry: nextRoundGeometry.groups.get(`${group.wins + 1}-${group.losses}`), shortIds: group.winnerShortIds },
|
|
2687
|
-
{ geometry: nextRoundGeometry.groups.get(`${group.wins}-${group.losses + 1}`), shortIds: group.loserShortIds },
|
|
2688
|
-
];
|
|
2689
|
-
for (const { geometry: target, shortIds } of targets) {
|
|
2690
|
-
if (!target)
|
|
2691
|
-
continue;
|
|
2692
|
-
const neutralColor = colors?.neutral;
|
|
2693
|
-
const fromColor = colors?.[group.colorType] ?? neutralColor;
|
|
2694
|
-
const toColor = colors?.[target.colorType] ?? neutralColor;
|
|
2695
|
-
let stroke = neutralColor;
|
|
2696
|
-
if (neutralColor && (fromColor !== neutralColor || toColor !== neutralColor)) {
|
|
2697
|
-
const gradientId = `${dimensions.idPrefix}-swiss-line-${edgeIndex}`;
|
|
2698
|
-
const fromX = group.position.inline.end;
|
|
2699
|
-
const toX = target.position.inline.start;
|
|
2700
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2701
|
-
gradientDefs.push(lineGradientDef(gradientId, fromX, toX, fromColor, neutralColor, toColor));
|
|
2702
|
-
stroke = `url(#${gradientId})`;
|
|
2703
|
-
}
|
|
2704
|
-
const pathOptions = { ...dimensions.path, className: shortIds.join(' '), stroke };
|
|
2705
|
-
const blockDelta = target.position.block.center - group.position.block.center;
|
|
2706
|
-
if (Math.abs(blockDelta) < 0.5) {
|
|
2707
|
-
svgParts.push(linePath(group.position, target.position, { path: pathOptions }));
|
|
2708
|
-
}
|
|
2709
|
-
else {
|
|
2710
|
-
svgParts.push(curvePath(group.position, target.position, blockDelta > 0 ? 'down' : 'up', {
|
|
2711
|
-
...curveOptions,
|
|
2712
|
-
path: pathOptions,
|
|
2713
|
-
}));
|
|
2714
|
-
}
|
|
2715
|
-
edgeIndex++;
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
const defs = gradientDefs.length ? `<defs>${gradientDefs.join('')}</defs>` : '';
|
|
2720
|
-
return defs + svgParts.join('');
|
|
2721
|
-
};
|
|
2722
|
-
|
|
2723
2510
|
const createBracketElementPart = (config) => {
|
|
2724
2511
|
const { elementPartHeight } = config;
|
|
2725
2512
|
const newElementPart = {
|
|
@@ -2781,6 +2568,13 @@ const createBracketElement = (config) => {
|
|
|
2781
2568
|
...newElementBase,
|
|
2782
2569
|
type,
|
|
2783
2570
|
};
|
|
2571
|
+
case 'continue':
|
|
2572
|
+
return {
|
|
2573
|
+
...newElementBase,
|
|
2574
|
+
type,
|
|
2575
|
+
component: config.component,
|
|
2576
|
+
matches: config.matches,
|
|
2577
|
+
};
|
|
2784
2578
|
default:
|
|
2785
2579
|
throw new Error(`Unknown element type: ${type}`);
|
|
2786
2580
|
}
|
|
@@ -2837,6 +2631,14 @@ const finalizeBracketGrid = (grid) => {
|
|
|
2837
2631
|
elements.push(matchEl);
|
|
2838
2632
|
finalizedElementMap.set(element.match.id, matchEl);
|
|
2839
2633
|
}
|
|
2634
|
+
else if (element.type === 'continue') {
|
|
2635
|
+
elements.push({
|
|
2636
|
+
type: 'continue',
|
|
2637
|
+
dimensions: element.dimensions,
|
|
2638
|
+
component: element.component,
|
|
2639
|
+
matches: element.matches,
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2840
2642
|
}
|
|
2841
2643
|
if (!lastSubColumn.span.isEnd) {
|
|
2842
2644
|
for (let index = masterColumnIndex + 1; index < grid.grid.masterColumns.length; index++) {
|
|
@@ -3384,14 +3186,23 @@ const calculateUpperRoundIndex = (subColumnIndex, upperToLowerRatio, splitFactor
|
|
|
3384
3186
|
return Math.floor(adjustedColumnIndex / upperToLowerRatio) + 1;
|
|
3385
3187
|
};
|
|
3386
3188
|
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3189
|
+
const isBracketContinueMatch = (match) => match.round.type !== COMMON_BRACKET_ROUND_TYPE.THIRD_PLACE &&
|
|
3190
|
+
(match.relation.type === 'one-to-nothing' || match.relation.type === 'two-to-nothing');
|
|
3191
|
+
const getBracketContinueMatches = (bracketData) => Array.from(bracketData.matches.values()).filter((match) => isBracketContinueMatch(match));
|
|
3192
|
+
const createBracketContinueMasterColumn = (config) => {
|
|
3193
|
+
const { existingMasterColumns, columnWidth, elementHeight, headerOffset, component, matches } = config;
|
|
3389
3194
|
const lastMasterColumn = existingMasterColumns[existingMasterColumns.length - 1];
|
|
3390
3195
|
if (!lastMasterColumn) {
|
|
3391
3196
|
throw new Error('No last master column found in existing master columns');
|
|
3392
3197
|
}
|
|
3198
|
+
// Dimensions are not calculated yet at this point, but all part heights are static, so the
|
|
3199
|
+
// total column height is the sum of the tallest sub column of every section.
|
|
3200
|
+
const totalHeight = lastMasterColumn.sections.reduce((height, section) => {
|
|
3201
|
+
const sectionHeight = Math.max(0, ...section.subColumns.map((subColumn) => subColumn.elements.reduce((subColumnHeight, element) => subColumnHeight + element.parts.reduce((sum, part) => sum + part.dimensions.height, 0), 0)));
|
|
3202
|
+
return height + sectionHeight;
|
|
3203
|
+
}, 0);
|
|
3393
3204
|
const { masterColumn, pushSection } = createBracketMasterColumn({
|
|
3394
|
-
columnWidth
|
|
3205
|
+
columnWidth,
|
|
3395
3206
|
padding: {
|
|
3396
3207
|
bottom: 0,
|
|
3397
3208
|
left: 0,
|
|
@@ -3399,13 +3210,61 @@ const createBracketGapMasterColumn = (config) => {
|
|
|
3399
3210
|
top: 0,
|
|
3400
3211
|
},
|
|
3401
3212
|
});
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3213
|
+
const { masterColumnSection, pushSubColumn } = createBracketMasterColumnSection({
|
|
3214
|
+
type: 'round',
|
|
3215
|
+
});
|
|
3216
|
+
const { subColumn, pushElement } = createBracketSubColumn({
|
|
3217
|
+
span: {
|
|
3218
|
+
isStart: true,
|
|
3219
|
+
isEnd: true,
|
|
3220
|
+
},
|
|
3221
|
+
});
|
|
3222
|
+
if (headerOffset > 0) {
|
|
3223
|
+
const { element: headerGapElement } = createBracketElement({
|
|
3224
|
+
area: '.',
|
|
3225
|
+
type: 'colGap',
|
|
3226
|
+
elementHeight: headerOffset,
|
|
3227
|
+
partHeights: [headerOffset],
|
|
3405
3228
|
});
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3229
|
+
pushElement(headerGapElement);
|
|
3230
|
+
}
|
|
3231
|
+
const containerHeight = Math.max(elementHeight, totalHeight - headerOffset);
|
|
3232
|
+
const { element: continueElement } = createBracketElement({
|
|
3233
|
+
area: 'continue',
|
|
3234
|
+
type: 'continue',
|
|
3235
|
+
elementHeight,
|
|
3236
|
+
partHeights: [containerHeight],
|
|
3237
|
+
component,
|
|
3238
|
+
matches,
|
|
3239
|
+
});
|
|
3240
|
+
pushElement(continueElement);
|
|
3241
|
+
pushSubColumn(subColumn);
|
|
3242
|
+
pushSection(masterColumnSection);
|
|
3243
|
+
return masterColumn;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
const createBracketGapMasterColumn = (config) => {
|
|
3247
|
+
const { existingMasterColumns, columnGap } = config;
|
|
3248
|
+
const lastMasterColumn = existingMasterColumns[existingMasterColumns.length - 1];
|
|
3249
|
+
if (!lastMasterColumn) {
|
|
3250
|
+
throw new Error('No last master column found in existing master columns');
|
|
3251
|
+
}
|
|
3252
|
+
const { masterColumn, pushSection } = createBracketMasterColumn({
|
|
3253
|
+
columnWidth: columnGap,
|
|
3254
|
+
padding: {
|
|
3255
|
+
bottom: 0,
|
|
3256
|
+
left: 0,
|
|
3257
|
+
right: 0,
|
|
3258
|
+
top: 0,
|
|
3259
|
+
},
|
|
3260
|
+
});
|
|
3261
|
+
for (const section of lastMasterColumn.sections) {
|
|
3262
|
+
const { masterColumnSection, pushSubColumn } = createBracketMasterColumnSection({
|
|
3263
|
+
type: 'gap',
|
|
3264
|
+
});
|
|
3265
|
+
const lastSubColumn = section.subColumns[section.subColumns.length - 1];
|
|
3266
|
+
if (!lastSubColumn) {
|
|
3267
|
+
throw new Error('No last sub column found in section');
|
|
3409
3268
|
}
|
|
3410
3269
|
const { pushElement, subColumn } = createBracketSubColumn({
|
|
3411
3270
|
span: {
|
|
@@ -3797,6 +3656,23 @@ const createDoubleEliminationGrid = (bracketData, options, components) => {
|
|
|
3797
3656
|
}));
|
|
3798
3657
|
}
|
|
3799
3658
|
}
|
|
3659
|
+
if (options.continueElement && components.continue) {
|
|
3660
|
+
const continueMatches = getBracketContinueMatches(bracketData);
|
|
3661
|
+
if (continueMatches.length) {
|
|
3662
|
+
grid.pushMasterColumn(createBracketGapMasterColumn({
|
|
3663
|
+
existingMasterColumns: grid.grid.masterColumns,
|
|
3664
|
+
columnGap: options.columnGap,
|
|
3665
|
+
}));
|
|
3666
|
+
grid.pushMasterColumn(createBracketContinueMasterColumn({
|
|
3667
|
+
existingMasterColumns: grid.grid.masterColumns,
|
|
3668
|
+
columnWidth: options.continueElement.columnWidth,
|
|
3669
|
+
elementHeight: options.continueElement.elementHeight,
|
|
3670
|
+
headerOffset: options.roundHeaderHeight > 0 ? options.roundHeaderHeight + options.roundHeaderGap : 0,
|
|
3671
|
+
component: components.continue,
|
|
3672
|
+
matches: continueMatches,
|
|
3673
|
+
}));
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3800
3676
|
grid.setupElementSpans();
|
|
3801
3677
|
grid.calculateDimensions();
|
|
3802
3678
|
const finalizedGrid = finalizeBracketGrid(grid);
|
|
@@ -3849,6 +3725,23 @@ const createSingleEliminationGrid = (bracketData, options, components) => {
|
|
|
3849
3725
|
}));
|
|
3850
3726
|
}
|
|
3851
3727
|
}
|
|
3728
|
+
if (options.continueElement && components.continue) {
|
|
3729
|
+
const continueMatches = getBracketContinueMatches(bracketData);
|
|
3730
|
+
if (continueMatches.length) {
|
|
3731
|
+
grid.pushMasterColumn(createBracketGapMasterColumn({
|
|
3732
|
+
existingMasterColumns: grid.grid.masterColumns,
|
|
3733
|
+
columnGap: options.columnGap,
|
|
3734
|
+
}));
|
|
3735
|
+
grid.pushMasterColumn(createBracketContinueMasterColumn({
|
|
3736
|
+
existingMasterColumns: grid.grid.masterColumns,
|
|
3737
|
+
columnWidth: options.continueElement.columnWidth,
|
|
3738
|
+
elementHeight: options.continueElement.elementHeight,
|
|
3739
|
+
headerOffset: options.roundHeaderHeight > 0 ? options.roundHeaderHeight + options.roundHeaderGap : 0,
|
|
3740
|
+
component: components.continue,
|
|
3741
|
+
matches: continueMatches,
|
|
3742
|
+
}));
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3852
3745
|
grid.calculateDimensions();
|
|
3853
3746
|
const finalizedGrid = finalizeBracketGrid(grid);
|
|
3854
3747
|
return {
|
|
@@ -4058,22 +3951,329 @@ const createSwissGrid = (bracketData, options, components) => {
|
|
|
4058
3951
|
};
|
|
4059
3952
|
};
|
|
4060
3953
|
|
|
4061
|
-
const
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
3954
|
+
const linePath = (from, to, options) => {
|
|
3955
|
+
return path(`M ${from.inline.end} ${from.block.center} L ${to.inline.start} ${to.block.center}`, options.path);
|
|
3956
|
+
};
|
|
3957
|
+
|
|
3958
|
+
const makePos = (dimensions) => ({
|
|
3959
|
+
block: {
|
|
3960
|
+
start: dimensions.top,
|
|
3961
|
+
end: dimensions.top + dimensions.height,
|
|
3962
|
+
center: dimensions.top + dimensions.height / 2,
|
|
3963
|
+
},
|
|
3964
|
+
inline: {
|
|
3965
|
+
start: dimensions.left,
|
|
3966
|
+
end: dimensions.left + dimensions.width,
|
|
3967
|
+
center: dimensions.left + dimensions.width / 2,
|
|
3968
|
+
},
|
|
3969
|
+
});
|
|
3970
|
+
const drawMan = (dimensions) => {
|
|
3971
|
+
const svgParts = [];
|
|
3972
|
+
const continueElement = dimensions.bracketGrid.columns
|
|
3973
|
+
.flatMap((col) => col.elements)
|
|
3974
|
+
.find((el) => el.type === 'continue');
|
|
3975
|
+
const continuePos = continueElement ? makePos(continueElement.dimensions) : null;
|
|
3976
|
+
const continueSources = [];
|
|
3977
|
+
for (const col of dimensions.bracketGrid.columns) {
|
|
3978
|
+
for (const el of col.elements) {
|
|
3979
|
+
if (el.type !== 'match')
|
|
3980
|
+
continue;
|
|
3981
|
+
const currentMatchParticipantsShortIds = [el.match.home?.shortId, el.match.away?.shortId]
|
|
3982
|
+
.filter((id) => !!id)
|
|
3983
|
+
.join(' ');
|
|
3984
|
+
const pathOptions = { ...dimensions.path, className: currentMatchParticipantsShortIds };
|
|
3985
|
+
const currentPos = makePos(el.dimensions);
|
|
3986
|
+
// No lines for the third place match
|
|
3987
|
+
if (el.round.type === COMMON_BRACKET_ROUND_TYPE.THIRD_PLACE)
|
|
3988
|
+
continue;
|
|
3989
|
+
if (continuePos && isBracketContinueMatch(el.match)) {
|
|
3990
|
+
continueSources.push({ pos: currentPos, className: el.match.winner?.shortId || '' });
|
|
4068
3991
|
}
|
|
3992
|
+
switch (el.match.relation.type) {
|
|
3993
|
+
case 'nothing-to-one': {
|
|
3994
|
+
continue;
|
|
3995
|
+
}
|
|
3996
|
+
case 'one-to-nothing':
|
|
3997
|
+
case 'one-to-one': {
|
|
3998
|
+
const prev = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousMatch.id);
|
|
3999
|
+
const prevPos = makePos(prev.dimensions);
|
|
4000
|
+
// draw a straight line
|
|
4001
|
+
svgParts.push(linePath(prevPos, currentPos, { path: pathOptions }));
|
|
4002
|
+
break;
|
|
4003
|
+
}
|
|
4004
|
+
case 'two-to-nothing':
|
|
4005
|
+
case 'two-to-one': {
|
|
4006
|
+
const prevUpper = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousUpperMatch.id);
|
|
4007
|
+
const prevLower = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.previousLowerMatch.id);
|
|
4008
|
+
const prevUpperPos = makePos(prevUpper.dimensions);
|
|
4009
|
+
const prevLowerPos = makePos(prevLower.dimensions);
|
|
4010
|
+
const isLowerUpperMerger = el.match.relation.previousLowerRound.id !== el.match.relation.previousUpperRound.id;
|
|
4011
|
+
const invertCurve = el.round.mirrorRoundType === BRACKET_ROUND_MIRROR_TYPE.RIGHT;
|
|
4012
|
+
const curveOptions = {
|
|
4013
|
+
...dimensions.curve,
|
|
4014
|
+
inverted: invertCurve,
|
|
4015
|
+
path: { ...dimensions.path, className: '' },
|
|
4016
|
+
};
|
|
4017
|
+
if (isLowerUpperMerger) {
|
|
4018
|
+
svgParts.push(linePath(prevUpperPos, currentPos, { path: pathOptions }));
|
|
4019
|
+
}
|
|
4020
|
+
else {
|
|
4021
|
+
// draw two lines that merge into one in the middle
|
|
4022
|
+
svgParts.push(curvePath(prevUpperPos, currentPos, 'down', {
|
|
4023
|
+
...curveOptions,
|
|
4024
|
+
path: {
|
|
4025
|
+
...curveOptions.path,
|
|
4026
|
+
className: el.match.relation.previousUpperMatch.winner?.shortId || '',
|
|
4027
|
+
},
|
|
4028
|
+
}));
|
|
4029
|
+
}
|
|
4030
|
+
svgParts.push(curvePath(prevLowerPos, currentPos, 'up', {
|
|
4031
|
+
...curveOptions,
|
|
4032
|
+
path: {
|
|
4033
|
+
...curveOptions.path,
|
|
4034
|
+
className: el.match.relation.previousLowerMatch.winner?.shortId || '',
|
|
4035
|
+
},
|
|
4036
|
+
}));
|
|
4037
|
+
if (el.round.mirrorRoundType === BRACKET_ROUND_MIRROR_TYPE.RIGHT &&
|
|
4038
|
+
el.match.relation.type === 'two-to-one' &&
|
|
4039
|
+
el.match.relation.nextRound.mirrorRoundType === null) {
|
|
4040
|
+
// draw a straight line for the special case of connecting the final match to the mirrored semi final match
|
|
4041
|
+
const next = dimensions.bracketGrid.matchElementMap.getOrThrow(el.match.relation.nextMatch.id);
|
|
4042
|
+
const nextPos = makePos(next.dimensions);
|
|
4043
|
+
svgParts.push(linePath(nextPos, currentPos, { path: pathOptions }));
|
|
4044
|
+
}
|
|
4045
|
+
break;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
if (continuePos && continueSources.length) {
|
|
4051
|
+
const continuePathOptions = dimensions.continuePath ?? dimensions.path;
|
|
4052
|
+
const sharedPathOptions = { ...continuePathOptions, className: '' };
|
|
4053
|
+
const curveAmount = dimensions.curve.lineStartingCurveAmount;
|
|
4054
|
+
const trunkInline = continuePos.inline.start - dimensions.columnGap / 2;
|
|
4055
|
+
const continueBlockCenter = continuePos.block.center;
|
|
4056
|
+
const sourceBlocks = continueSources.map((source) => source.pos.block.center);
|
|
4057
|
+
const firstSourceBlock = Math.min(...sourceBlocks);
|
|
4058
|
+
const lastSourceBlock = Math.max(...sourceBlocks);
|
|
4059
|
+
const trunkBlocks = [continueBlockCenter];
|
|
4060
|
+
for (const source of continueSources) {
|
|
4061
|
+
const sourceBlockCenter = source.pos.block.center;
|
|
4062
|
+
const blockDistance = continueBlockCenter - sourceBlockCenter;
|
|
4063
|
+
const sourcePathOptions = { ...continuePathOptions, className: source.className };
|
|
4064
|
+
const isTrunkCorner = (sourceBlockCenter === firstSourceBlock && blockDistance > 0.5) ||
|
|
4065
|
+
(sourceBlockCenter === lastSourceBlock && blockDistance < -0.5);
|
|
4066
|
+
if (!isTrunkCorner) {
|
|
4067
|
+
svgParts.push(path(`M ${source.pos.inline.end} ${sourceBlockCenter} H ${trunkInline}`, sourcePathOptions));
|
|
4068
|
+
trunkBlocks.push(sourceBlockCenter);
|
|
4069
|
+
}
|
|
4070
|
+
else {
|
|
4071
|
+
const curve = Math.min(curveAmount, Math.abs(blockDistance));
|
|
4072
|
+
const curveEndBlock = sourceBlockCenter + curve * Math.sign(blockDistance);
|
|
4073
|
+
svgParts.push(path(`M ${source.pos.inline.end} ${sourceBlockCenter}
|
|
4074
|
+
H ${trunkInline - curve}
|
|
4075
|
+
Q ${trunkInline} ${sourceBlockCenter}, ${trunkInline} ${curveEndBlock}`, sourcePathOptions));
|
|
4076
|
+
trunkBlocks.push(curveEndBlock);
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
const trunkBlockStart = Math.min(...trunkBlocks);
|
|
4080
|
+
const trunkBlockEnd = Math.max(...trunkBlocks);
|
|
4081
|
+
if (trunkBlockEnd - trunkBlockStart > 0.5) {
|
|
4082
|
+
svgParts.push(path(`M ${trunkInline} ${trunkBlockStart} V ${trunkBlockEnd}`, sharedPathOptions));
|
|
4083
|
+
}
|
|
4084
|
+
svgParts.push(path(`M ${trunkInline} ${continueBlockCenter} H ${continuePos.inline.start}`, sharedPathOptions));
|
|
4085
|
+
}
|
|
4086
|
+
return svgParts.join('');
|
|
4087
|
+
};
|
|
4069
4088
|
|
|
4070
|
-
|
|
4071
|
-
|
|
4089
|
+
// Every finalized column of a swiss grid is one group section. The connection lines run
|
|
4090
|
+
// from group to group instead of match to match: the winners of group (w-l) move to group
|
|
4091
|
+
// (w+1-l) inside the next round, the losers move to group (w-l+1).
|
|
4092
|
+
const collectSwissRoundGeometries = (bracketGrid) => {
|
|
4093
|
+
const rounds = new Map();
|
|
4094
|
+
for (const column of bracketGrid.columns) {
|
|
4095
|
+
const matchElements = column.elements.filter((element) => element.type === 'match');
|
|
4096
|
+
const group = matchElements[0]?.roundSwissGroup;
|
|
4097
|
+
const round = matchElements[0]?.round;
|
|
4098
|
+
if (!group || !round)
|
|
4099
|
+
continue;
|
|
4100
|
+
const [wins, losses] = group.id.split('-').map(Number);
|
|
4101
|
+
if (wins === undefined || losses === undefined || isNaN(wins) || isNaN(losses)) {
|
|
4102
|
+
throw new Error(`Unable to parse wins and losses from Swiss group id: ${group.id}`);
|
|
4103
|
+
}
|
|
4104
|
+
const matchesTop = Math.min(...matchElements.map((element) => element.dimensions.top));
|
|
4105
|
+
const matchesBottom = Math.max(...matchElements.map((element) => element.dimensions.top + element.dimensions.height));
|
|
4106
|
+
const winnerShortIds = [];
|
|
4107
|
+
const loserShortIds = [];
|
|
4108
|
+
for (const element of matchElements) {
|
|
4109
|
+
if (!element.match.winner)
|
|
4110
|
+
continue;
|
|
4111
|
+
const winner = element.match.winner;
|
|
4112
|
+
const loser = element.match.home?.id === winner.id ? element.match.away : element.match.home;
|
|
4113
|
+
winnerShortIds.push(winner.shortId);
|
|
4114
|
+
if (loser)
|
|
4115
|
+
loserShortIds.push(loser.shortId);
|
|
4116
|
+
}
|
|
4117
|
+
// The lines attach to the group border, which wraps the matches plus the group
|
|
4118
|
+
// padding and therefore matches the section bounds horizontally.
|
|
4119
|
+
const position = {
|
|
4120
|
+
block: {
|
|
4121
|
+
start: matchesTop,
|
|
4122
|
+
end: matchesBottom,
|
|
4123
|
+
center: (matchesTop + matchesBottom) / 2,
|
|
4124
|
+
},
|
|
4125
|
+
inline: {
|
|
4126
|
+
start: column.dimensions.left,
|
|
4127
|
+
end: column.dimensions.left + column.dimensions.width,
|
|
4128
|
+
center: column.dimensions.left + column.dimensions.width / 2,
|
|
4129
|
+
},
|
|
4130
|
+
};
|
|
4131
|
+
let roundGeometry = rounds.get(round.id);
|
|
4132
|
+
if (!roundGeometry) {
|
|
4133
|
+
roundGeometry = { groups: new Map() };
|
|
4134
|
+
rounds.set(round.id, roundGeometry);
|
|
4135
|
+
}
|
|
4136
|
+
roundGeometry.groups.set(group.id, {
|
|
4137
|
+
id: group.id,
|
|
4138
|
+
wins,
|
|
4139
|
+
losses,
|
|
4140
|
+
colorType: getSwissGroupColorType(wins, losses),
|
|
4141
|
+
position,
|
|
4142
|
+
winnerShortIds,
|
|
4143
|
+
loserShortIds,
|
|
4144
|
+
});
|
|
4145
|
+
}
|
|
4146
|
+
// The finalized columns are ordered left to right, so first appearance equals round order
|
|
4147
|
+
return Array.from(rounds.values());
|
|
4148
|
+
};
|
|
4149
|
+
const groupBorderRect = (group, border, color) => {
|
|
4150
|
+
// The group box wraps the matches plus the group padding plus the border itself. The
|
|
4151
|
+
// rect is inset by half the stroke width so the stroke renders fully inside the group
|
|
4152
|
+
// bounds instead of getting cut off at the edges of the bracket container.
|
|
4153
|
+
const boxPadding = border.padding + border.width;
|
|
4154
|
+
const strokeInset = border.width / 2;
|
|
4155
|
+
const x = group.position.inline.start + strokeInset;
|
|
4156
|
+
const y = group.position.block.start - boxPadding + strokeInset;
|
|
4157
|
+
const width = group.position.inline.end - group.position.inline.start - border.width;
|
|
4158
|
+
const height = group.position.block.end - group.position.block.start + boxPadding * 2 - border.width;
|
|
4159
|
+
return `<rect x="${x}" y="${y}" width="${width}" height="${height}" rx="${border.radius}" stroke="${color ?? 'currentColor'}" fill="none" stroke-width="${border.width}" class="et-bracket-new-swiss-group-border et-bracket-new-swiss-group-border--${group.id} et-bracket-new-swiss-group-border--${group.colorType}" />`;
|
|
4160
|
+
};
|
|
4161
|
+
// A horizontal gradient for the connection lines: they leave the source group in its
|
|
4162
|
+
// color, fade to the neutral color towards their vertical jog in the middle and fade into
|
|
4163
|
+
// the target group color on the second half. The connection lines always run from left to
|
|
4164
|
+
// right, so user space coordinates can be used (they also work for straight lines, where
|
|
4165
|
+
// the bounding box has no height).
|
|
4166
|
+
const lineGradientDef = (id, fromX, toX, from, neutral, to) => `<linearGradient id="${id}" gradientUnits="userSpaceOnUse" x1="${fromX}" y1="0" x2="${toX}" y2="0"><stop offset="0%" stop-color="${from}" /><stop offset="50%" stop-color="${neutral}" /><stop offset="100%" stop-color="${to}" /></linearGradient>`;
|
|
4167
|
+
const drawSwissMan = (dimensions) => {
|
|
4168
|
+
const svgParts = [];
|
|
4169
|
+
const gradientDefs = [];
|
|
4170
|
+
const roundGeometries = collectSwissRoundGeometries(dimensions.bracketGrid);
|
|
4171
|
+
const colors = dimensions.colors;
|
|
4172
|
+
for (const roundGeometry of roundGeometries) {
|
|
4173
|
+
for (const group of roundGeometry.groups.values()) {
|
|
4174
|
+
svgParts.push(groupBorderRect(group, dimensions.groupBorder, colors?.[group.colorType]));
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
const curveOptions = {
|
|
4178
|
+
lineStartingCurveAmount: dimensions.curve.lineStartingCurveAmount,
|
|
4179
|
+
lineEndingCurveAmount: dimensions.curve.lineStartingCurveAmount,
|
|
4180
|
+
};
|
|
4181
|
+
let edgeIndex = 0;
|
|
4182
|
+
for (const [roundIndex, roundGeometry] of roundGeometries.entries()) {
|
|
4183
|
+
const nextRoundGeometry = roundGeometries[roundIndex + 1];
|
|
4184
|
+
if (!nextRoundGeometry)
|
|
4185
|
+
break;
|
|
4186
|
+
for (const group of roundGeometry.groups.values()) {
|
|
4187
|
+
const targets = [
|
|
4188
|
+
{ geometry: nextRoundGeometry.groups.get(`${group.wins + 1}-${group.losses}`), shortIds: group.winnerShortIds },
|
|
4189
|
+
{ geometry: nextRoundGeometry.groups.get(`${group.wins}-${group.losses + 1}`), shortIds: group.loserShortIds },
|
|
4190
|
+
];
|
|
4191
|
+
for (const { geometry: target, shortIds } of targets) {
|
|
4192
|
+
if (!target)
|
|
4193
|
+
continue;
|
|
4194
|
+
const neutralColor = colors?.neutral;
|
|
4195
|
+
const fromColor = colors?.[group.colorType] ?? neutralColor;
|
|
4196
|
+
const toColor = colors?.[target.colorType] ?? neutralColor;
|
|
4197
|
+
let stroke = neutralColor;
|
|
4198
|
+
if (neutralColor && (fromColor !== neutralColor || toColor !== neutralColor)) {
|
|
4199
|
+
const gradientId = `${dimensions.idPrefix}-swiss-line-${edgeIndex}`;
|
|
4200
|
+
const fromX = group.position.inline.end;
|
|
4201
|
+
const toX = target.position.inline.start;
|
|
4202
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
4203
|
+
gradientDefs.push(lineGradientDef(gradientId, fromX, toX, fromColor, neutralColor, toColor));
|
|
4204
|
+
stroke = `url(#${gradientId})`;
|
|
4205
|
+
}
|
|
4206
|
+
const pathOptions = { ...dimensions.path, className: shortIds.join(' '), stroke };
|
|
4207
|
+
const blockDelta = target.position.block.center - group.position.block.center;
|
|
4208
|
+
if (Math.abs(blockDelta) < 0.5) {
|
|
4209
|
+
svgParts.push(linePath(group.position, target.position, { path: pathOptions }));
|
|
4210
|
+
}
|
|
4211
|
+
else {
|
|
4212
|
+
svgParts.push(curvePath(group.position, target.position, blockDelta > 0 ? 'down' : 'up', {
|
|
4213
|
+
...curveOptions,
|
|
4214
|
+
path: pathOptions,
|
|
4215
|
+
}));
|
|
4216
|
+
}
|
|
4217
|
+
edgeIndex++;
|
|
4072
4218
|
}
|
|
4073
|
-
|
|
4074
|
-
`;
|
|
4219
|
+
}
|
|
4075
4220
|
}
|
|
4076
|
-
|
|
4221
|
+
const defs = gradientDefs.length ? `<defs>${gradientDefs.join('')}</defs>` : '';
|
|
4222
|
+
return defs + svgParts.join('');
|
|
4223
|
+
};
|
|
4224
|
+
|
|
4225
|
+
const PARTICIPANT_SHORT_ID_PATTERN = /^p\d+$/;
|
|
4226
|
+
const JOURNEY_HOVER_HOST_CLASS = 'et-new-bracket-host--journey-hover';
|
|
4227
|
+
const JOURNEY_ACTIVE_ELEMENT_CLASS = 'et-bracket-new-journey-active';
|
|
4228
|
+
const getParticipantShortIds = (element) => element ? Array.from(element.classList).filter((cls) => PARTICIPANT_SHORT_ID_PATTERN.test(cls)) : [];
|
|
4229
|
+
const setupJourneyHighlight = (host, renderer) => {
|
|
4230
|
+
let activeElements = [];
|
|
4231
|
+
let activeShortIds = [];
|
|
4232
|
+
const clear = () => {
|
|
4233
|
+
if (!activeElements.length)
|
|
4234
|
+
return;
|
|
4235
|
+
for (const el of activeElements) {
|
|
4236
|
+
renderer.removeClass(el, JOURNEY_ACTIVE_ELEMENT_CLASS);
|
|
4237
|
+
}
|
|
4238
|
+
renderer.removeClass(host, JOURNEY_HOVER_HOST_CLASS);
|
|
4239
|
+
activeElements = [];
|
|
4240
|
+
activeShortIds = [];
|
|
4241
|
+
};
|
|
4242
|
+
const activate = (shortIds) => {
|
|
4243
|
+
const isSame = shortIds.length === activeShortIds.length && shortIds.every((id, index) => id === activeShortIds[index]);
|
|
4244
|
+
if (isSame)
|
|
4245
|
+
return;
|
|
4246
|
+
clear();
|
|
4247
|
+
const elements = [];
|
|
4248
|
+
for (const shortId of shortIds) {
|
|
4249
|
+
elements.push(...Array.from(host.querySelectorAll(`.${shortId}`)));
|
|
4250
|
+
}
|
|
4251
|
+
for (const el of elements) {
|
|
4252
|
+
renderer.addClass(el, JOURNEY_ACTIVE_ELEMENT_CLASS);
|
|
4253
|
+
}
|
|
4254
|
+
renderer.addClass(host, JOURNEY_HOVER_HOST_CLASS);
|
|
4255
|
+
activeElements = elements;
|
|
4256
|
+
activeShortIds = shortIds;
|
|
4257
|
+
};
|
|
4258
|
+
const onMouseOver = (event) => {
|
|
4259
|
+
const target = event.target;
|
|
4260
|
+
const container = target?.closest('.et-bracket-new-element--match, path') ?? null;
|
|
4261
|
+
const shortIds = getParticipantShortIds(container);
|
|
4262
|
+
if (shortIds.length) {
|
|
4263
|
+
activate(shortIds);
|
|
4264
|
+
}
|
|
4265
|
+
else {
|
|
4266
|
+
clear();
|
|
4267
|
+
}
|
|
4268
|
+
};
|
|
4269
|
+
const onMouseLeave = () => clear();
|
|
4270
|
+
const removeMouseOverListener = renderer.listen(host, 'mouseover', onMouseOver);
|
|
4271
|
+
const removeMouseLeaveListener = renderer.listen(host, 'mouseleave', onMouseLeave);
|
|
4272
|
+
return () => {
|
|
4273
|
+
removeMouseOverListener();
|
|
4274
|
+
removeMouseLeaveListener();
|
|
4275
|
+
clear();
|
|
4276
|
+
};
|
|
4077
4277
|
};
|
|
4078
4278
|
|
|
4079
4279
|
const [provideNewBracketConfig, injectNewBracketConfig] = createStaticRootProvider({}, { name: 'NewBracketConfig' });
|
|
@@ -4104,9 +4304,14 @@ class NewBracketComponent {
|
|
|
4104
4304
|
this.swissColors = input(this.config.swiss?.colors, ...(ngDevMode ? [{ debugName: "swissColors" }] : /* istanbul ignore next */ []));
|
|
4105
4305
|
this.layout = input(this.config.layout ?? BRACKET_DATA_LAYOUT.LEFT_TO_RIGHT, ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
4106
4306
|
this.hideRoundHeaders = input(this.config.hideRoundHeaders ?? false, { ...(ngDevMode ? { debugName: "hideRoundHeaders" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4307
|
+
this.showContinueElement = input(this.config.showContinueElement ?? false, { ...(ngDevMode ? { debugName: "showContinueElement" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4308
|
+
this.continueColumnWidth = input(this.config.continueColumnWidth ?? 250, { ...(ngDevMode ? { debugName: "continueColumnWidth" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
4309
|
+
this.continueElementHeight = input(this.config.continueElementHeight ?? 75, { ...(ngDevMode ? { debugName: "continueElementHeight" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
4310
|
+
this.continueLineDashArray = input(this.config.continueLineDashArray ?? 6, { ...(ngDevMode ? { debugName: "continueLineDashArray" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
4107
4311
|
this.roundHeaderComponent = input(...(ngDevMode ? [undefined, { debugName: "roundHeaderComponent" }] : /* istanbul ignore next */ []));
|
|
4108
4312
|
this.matchComponent = input(...(ngDevMode ? [undefined, { debugName: "matchComponent" }] : /* istanbul ignore next */ []));
|
|
4109
4313
|
this.finalMatchComponent = input(...(ngDevMode ? [undefined, { debugName: "finalMatchComponent" }] : /* istanbul ignore next */ []));
|
|
4314
|
+
this.continueComponent = input(...(ngDevMode ? [undefined, { debugName: "continueComponent" }] : /* istanbul ignore next */ []));
|
|
4110
4315
|
this.bracketData = computed(() => createNewBracket(this.source(), { layout: this.layout() }), ...(ngDevMode ? [{ debugName: "bracketData" }] : /* istanbul ignore next */ []));
|
|
4111
4316
|
this.swissGroups = computed(() => generateBracketRoundSwissGroupMaps(this.bracketData()), ...(ngDevMode ? [{ debugName: "swissGroups" }] : /* istanbul ignore next */ []));
|
|
4112
4317
|
this.bracketGrid = computed(() => {
|
|
@@ -4125,6 +4330,12 @@ class NewBracketComponent {
|
|
|
4125
4330
|
roundHeaderGap: this.hideRoundHeaders() ? 0 : this.roundHeaderGap(),
|
|
4126
4331
|
swissGroupPadding: this.swissGroupPadding(),
|
|
4127
4332
|
swissGroupBorderWidth: this.lineWidth(),
|
|
4333
|
+
continueElement: this.showContinueElement() && this.layout() === BRACKET_DATA_LAYOUT.LEFT_TO_RIGHT
|
|
4334
|
+
? {
|
|
4335
|
+
columnWidth: this.continueColumnWidth(),
|
|
4336
|
+
elementHeight: this.continueElementHeight(),
|
|
4337
|
+
}
|
|
4338
|
+
: null,
|
|
4128
4339
|
};
|
|
4129
4340
|
const swissConfig = bracketData.mode === TOURNAMENT_MODE.SWISS_WITH_ELIMINATION ? this.config.swiss : undefined;
|
|
4130
4341
|
const components = {
|
|
@@ -4137,6 +4348,7 @@ class NewBracketComponent {
|
|
|
4137
4348
|
swissConfig?.roundHeaderComponent ??
|
|
4138
4349
|
this.config.roundHeaderComponent ??
|
|
4139
4350
|
NewBracketDefaultRoundHeaderComponent,
|
|
4351
|
+
continue: this.continueComponent() ?? this.config.continueComponent ?? NewBracketDefaultContinueComponent,
|
|
4140
4352
|
};
|
|
4141
4353
|
switch (bracketData.mode) {
|
|
4142
4354
|
case TOURNAMENT_MODE.DOUBLE_ELIMINATION:
|
|
@@ -4188,50 +4400,36 @@ class NewBracketComponent {
|
|
|
4188
4400
|
dashOffset: this.lineDashOffset(),
|
|
4189
4401
|
width: this.lineWidth(),
|
|
4190
4402
|
},
|
|
4403
|
+
continuePath: {
|
|
4404
|
+
dashArray: this.continueLineDashArray(),
|
|
4405
|
+
dashOffset: this.lineDashOffset(),
|
|
4406
|
+
width: this.lineWidth(),
|
|
4407
|
+
},
|
|
4191
4408
|
});
|
|
4192
4409
|
}, ...(ngDevMode ? [{ debugName: "drawManData" }] : /* istanbul ignore next */ []));
|
|
4193
4410
|
this.svgContent = computed(() => this.domSanitizer.bypassSecurityTrustHtml(this.drawManData()), ...(ngDevMode ? [{ debugName: "svgContent" }] : /* istanbul ignore next */ []));
|
|
4194
|
-
this.journeyHighlight = computed(() => this.disableJourneyHighlight() ? null : createJourneyHighlight(this.bracketData()), ...(ngDevMode ? [{ debugName: "journeyHighlight" }] : /* istanbul ignore next */ []));
|
|
4195
4411
|
this.setupJourneyHighlight();
|
|
4196
4412
|
}
|
|
4197
4413
|
setupJourneyHighlight() {
|
|
4198
4414
|
const renderer = injectRenderer();
|
|
4199
|
-
const
|
|
4200
|
-
const
|
|
4201
|
-
let oldStyleEl = null;
|
|
4415
|
+
const ngZone = inject(NgZone);
|
|
4416
|
+
const host = inject((ElementRef)).nativeElement;
|
|
4202
4417
|
effect(() => {
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
}
|
|
4208
|
-
if (newHighlightStyle) {
|
|
4209
|
-
const el = renderer.createElement('style');
|
|
4210
|
-
renderer.setAttribute(el, 'id', styleId);
|
|
4211
|
-
renderer.appendChild(el, renderer.createText(newHighlightStyle));
|
|
4212
|
-
renderer.appendChild(head, el);
|
|
4213
|
-
oldStyleEl = el;
|
|
4214
|
-
}
|
|
4215
|
-
else {
|
|
4216
|
-
oldStyleEl = null;
|
|
4217
|
-
}
|
|
4218
|
-
return () => {
|
|
4219
|
-
if (oldStyleEl) {
|
|
4220
|
-
renderer.removeChild(head, oldStyleEl);
|
|
4221
|
-
oldStyleEl = null;
|
|
4222
|
-
}
|
|
4223
|
-
};
|
|
4418
|
+
if (this.disableJourneyHighlight())
|
|
4419
|
+
return;
|
|
4420
|
+
const teardown = ngZone.runOutsideAngular(() => setupJourneyHighlight(host, renderer));
|
|
4421
|
+
return () => teardown();
|
|
4224
4422
|
});
|
|
4225
4423
|
}
|
|
4226
4424
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: NewBracketComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4227
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: NewBracketComponent, isStandalone: true, selector: "et-new-bracket", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, columnWidth: { classPropertyName: "columnWidth", publicName: "columnWidth", isSignal: true, isRequired: false, transformFunction: null }, matchHeight: { classPropertyName: "matchHeight", publicName: "matchHeight", isSignal: true, isRequired: false, transformFunction: null }, finalMatchHeight: { classPropertyName: "finalMatchHeight", publicName: "finalMatchHeight", isSignal: true, isRequired: false, transformFunction: null }, finalColumnWidth: { classPropertyName: "finalColumnWidth", publicName: "finalColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderHeight: { classPropertyName: "roundHeaderHeight", publicName: "roundHeaderHeight", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderGap: { classPropertyName: "roundHeaderGap", publicName: "roundHeaderGap", isSignal: true, isRequired: false, transformFunction: null }, columnGap: { classPropertyName: "columnGap", publicName: "columnGap", isSignal: true, isRequired: false, transformFunction: null }, rowGap: { classPropertyName: "rowGap", publicName: "rowGap", isSignal: true, isRequired: false, transformFunction: null }, rowRoundGap: { classPropertyName: "rowRoundGap", publicName: "rowRoundGap", isSignal: true, isRequired: false, transformFunction: null }, lineStartingCurveAmount: { classPropertyName: "lineStartingCurveAmount", publicName: "lineStartingCurveAmount", isSignal: true, isRequired: false, transformFunction: null }, lineEndingCurveAmount: { classPropertyName: "lineEndingCurveAmount", publicName: "lineEndingCurveAmount", isSignal: true, isRequired: false, transformFunction: null }, lineWidth: { classPropertyName: "lineWidth", publicName: "lineWidth", isSignal: true, isRequired: false, transformFunction: null }, lineDashArray: { classPropertyName: "lineDashArray", publicName: "lineDashArray", isSignal: true, isRequired: false, transformFunction: null }, lineDashOffset: { classPropertyName: "lineDashOffset", publicName: "lineDashOffset", isSignal: true, isRequired: false, transformFunction: null }, disableJourneyHighlight: { classPropertyName: "disableJourneyHighlight", publicName: "disableJourneyHighlight", isSignal: true, isRequired: false, transformFunction: null }, swissGroupPadding: { classPropertyName: "swissGroupPadding", publicName: "swissGroupPadding", isSignal: true, isRequired: false, transformFunction: null }, swissGroupBorderRadius: { classPropertyName: "swissGroupBorderRadius", publicName: "swissGroupBorderRadius", isSignal: true, isRequired: false, transformFunction: null }, swissColors: { classPropertyName: "swissColors", publicName: "swissColors", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, hideRoundHeaders: { classPropertyName: "hideRoundHeaders", publicName: "hideRoundHeaders", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderComponent: { classPropertyName: "roundHeaderComponent", publicName: "roundHeaderComponent", isSignal: true, isRequired: false, transformFunction: null }, matchComponent: { classPropertyName: "matchComponent", publicName: "matchComponent", isSignal: true, isRequired: false, transformFunction: null }, finalMatchComponent: { classPropertyName: "finalMatchComponent", publicName: "finalMatchComponent", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "et-new-bracket-host" }, ngImport: i0, template: "@if (bracketGrid(); as grid) {\n <section\n [style.width.px]=\"grid.raw.grid.dimensions.width\"\n [style.height.px]=\"grid.raw.grid.dimensions.height\"\n class=\"et-bracket-new et-bracket-new--{{ bracketData().mode }}\"\n >\n <svg [innerHTML]=\"svgContent()\" class=\"et-bracket-new-svg\" xmlns=\"http://www.w3.org/2000/svg\" />\n\n @for (round of grid.columns; track $index) {\n <ul\n [style.width.px]=\"round.dimensions.width\"\n [style.height.px]=\"round.dimensions.height\"\n [style.top.px]=\"round.dimensions.top\"\n [style.left.px]=\"round.dimensions.left\"\n class=\"et-bracket-new-round\"\n >\n @for (element of round.elements; track $index) {\n @let inputs =\n element.type === 'header'\n ? { bracketRound: element.round, bracketRoundSwissGroup: element.roundSwissGroup }\n : {\n
|
|
4425
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.13", type: NewBracketComponent, isStandalone: true, selector: "et-new-bracket", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, columnWidth: { classPropertyName: "columnWidth", publicName: "columnWidth", isSignal: true, isRequired: false, transformFunction: null }, matchHeight: { classPropertyName: "matchHeight", publicName: "matchHeight", isSignal: true, isRequired: false, transformFunction: null }, finalMatchHeight: { classPropertyName: "finalMatchHeight", publicName: "finalMatchHeight", isSignal: true, isRequired: false, transformFunction: null }, finalColumnWidth: { classPropertyName: "finalColumnWidth", publicName: "finalColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderHeight: { classPropertyName: "roundHeaderHeight", publicName: "roundHeaderHeight", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderGap: { classPropertyName: "roundHeaderGap", publicName: "roundHeaderGap", isSignal: true, isRequired: false, transformFunction: null }, columnGap: { classPropertyName: "columnGap", publicName: "columnGap", isSignal: true, isRequired: false, transformFunction: null }, rowGap: { classPropertyName: "rowGap", publicName: "rowGap", isSignal: true, isRequired: false, transformFunction: null }, rowRoundGap: { classPropertyName: "rowRoundGap", publicName: "rowRoundGap", isSignal: true, isRequired: false, transformFunction: null }, lineStartingCurveAmount: { classPropertyName: "lineStartingCurveAmount", publicName: "lineStartingCurveAmount", isSignal: true, isRequired: false, transformFunction: null }, lineEndingCurveAmount: { classPropertyName: "lineEndingCurveAmount", publicName: "lineEndingCurveAmount", isSignal: true, isRequired: false, transformFunction: null }, lineWidth: { classPropertyName: "lineWidth", publicName: "lineWidth", isSignal: true, isRequired: false, transformFunction: null }, lineDashArray: { classPropertyName: "lineDashArray", publicName: "lineDashArray", isSignal: true, isRequired: false, transformFunction: null }, lineDashOffset: { classPropertyName: "lineDashOffset", publicName: "lineDashOffset", isSignal: true, isRequired: false, transformFunction: null }, disableJourneyHighlight: { classPropertyName: "disableJourneyHighlight", publicName: "disableJourneyHighlight", isSignal: true, isRequired: false, transformFunction: null }, swissGroupPadding: { classPropertyName: "swissGroupPadding", publicName: "swissGroupPadding", isSignal: true, isRequired: false, transformFunction: null }, swissGroupBorderRadius: { classPropertyName: "swissGroupBorderRadius", publicName: "swissGroupBorderRadius", isSignal: true, isRequired: false, transformFunction: null }, swissColors: { classPropertyName: "swissColors", publicName: "swissColors", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, hideRoundHeaders: { classPropertyName: "hideRoundHeaders", publicName: "hideRoundHeaders", isSignal: true, isRequired: false, transformFunction: null }, showContinueElement: { classPropertyName: "showContinueElement", publicName: "showContinueElement", isSignal: true, isRequired: false, transformFunction: null }, continueColumnWidth: { classPropertyName: "continueColumnWidth", publicName: "continueColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, continueElementHeight: { classPropertyName: "continueElementHeight", publicName: "continueElementHeight", isSignal: true, isRequired: false, transformFunction: null }, continueLineDashArray: { classPropertyName: "continueLineDashArray", publicName: "continueLineDashArray", isSignal: true, isRequired: false, transformFunction: null }, roundHeaderComponent: { classPropertyName: "roundHeaderComponent", publicName: "roundHeaderComponent", isSignal: true, isRequired: false, transformFunction: null }, matchComponent: { classPropertyName: "matchComponent", publicName: "matchComponent", isSignal: true, isRequired: false, transformFunction: null }, finalMatchComponent: { classPropertyName: "finalMatchComponent", publicName: "finalMatchComponent", isSignal: true, isRequired: false, transformFunction: null }, continueComponent: { classPropertyName: "continueComponent", publicName: "continueComponent", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "et-new-bracket-host" }, ngImport: i0, template: "@if (bracketGrid(); as grid) {\n <section\n [style.width.px]=\"grid.raw.grid.dimensions.width\"\n [style.height.px]=\"grid.raw.grid.dimensions.height\"\n class=\"et-bracket-new et-bracket-new--{{ bracketData().mode }}\"\n >\n <svg [innerHTML]=\"svgContent()\" class=\"et-bracket-new-svg\" xmlns=\"http://www.w3.org/2000/svg\" />\n\n @for (round of grid.columns; track $index) {\n <ul\n [style.width.px]=\"round.dimensions.width\"\n [style.height.px]=\"round.dimensions.height\"\n [style.top.px]=\"round.dimensions.top\"\n [style.left.px]=\"round.dimensions.left\"\n class=\"et-bracket-new-round\"\n >\n @for (element of round.elements; track $index) {\n @let inputs =\n element.type === 'header'\n ? { bracketRound: element.round, bracketRoundSwissGroup: element.roundSwissGroup }\n : element.type === 'continue'\n ? { bracketMatches: element.matches }\n : {\n bracketRound: element.round,\n bracketMatch: element.match,\n bracketRoundSwissGroup: element.roundSwissGroup,\n };\n\n @let highlightClass = element.type === 'match' ? element.classes : '';\n\n <li\n [style.width.px]=\"element.dimensions.width\"\n [style.height.px]=\"element.dimensions.height\"\n [style.top.px]=\"element.dimensions.top - round.dimensions.top\"\n [style.left.px]=\"element.dimensions.left - round.dimensions.left\"\n class=\"et-bracket-new-element et-bracket-new-element--{{ element.type }} {{ highlightClass }}\"\n >\n <ng-container *ngComponentOutlet=\"$any(element.component); inputs: inputs\" />\n </li>\n }\n </ul>\n }\n </section>\n}\n", styles: [".et-bracket-new{position:relative;--bracket-line-color: red}.et-bracket-new-round{position:absolute;list-style:none;margin:0;padding:0}.et-bracket-new-element{position:absolute;list-style:none;margin:0;padding:0;transition:opacity .2s}.et-bracket-new-svg{inline-size:100%;block-size:100%;position:absolute}.et-bracket-new-svg path{color:var(--bracket-line-color);transition:opacity .2s}.et-bracket-new-svg .et-bracket-new-swiss-group-border{color:var(--bracket-swiss-group-border-color, var(--bracket-line-color))}.et-new-bracket-host--journey-hover path,.et-new-bracket-host--journey-hover .et-bracket-new-element--match{opacity:.5}.et-new-bracket-host--journey-hover .et-bracket-new-journey-active{opacity:1!important}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
4228
4426
|
}
|
|
4229
4427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: NewBracketComponent, decorators: [{
|
|
4230
4428
|
type: Component,
|
|
4231
4429
|
args: [{ selector: 'et-new-bracket', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4232
4430
|
class: 'et-new-bracket-host',
|
|
4233
|
-
}, imports: [NgComponentOutlet], template: "@if (bracketGrid(); as grid) {\n <section\n [style.width.px]=\"grid.raw.grid.dimensions.width\"\n [style.height.px]=\"grid.raw.grid.dimensions.height\"\n class=\"et-bracket-new et-bracket-new--{{ bracketData().mode }}\"\n >\n <svg [innerHTML]=\"svgContent()\" class=\"et-bracket-new-svg\" xmlns=\"http://www.w3.org/2000/svg\" />\n\n @for (round of grid.columns; track $index) {\n <ul\n [style.width.px]=\"round.dimensions.width\"\n [style.height.px]=\"round.dimensions.height\"\n [style.top.px]=\"round.dimensions.top\"\n [style.left.px]=\"round.dimensions.left\"\n class=\"et-bracket-new-round\"\n >\n @for (element of round.elements; track $index) {\n @let inputs =\n element.type === 'header'\n ? { bracketRound: element.round, bracketRoundSwissGroup: element.roundSwissGroup }\n : {\n
|
|
4234
|
-
}], ctorParameters: () => [], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], columnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnWidth", required: false }] }], matchHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchHeight", required: false }] }], finalMatchHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalMatchHeight", required: false }] }], finalColumnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalColumnWidth", required: false }] }], roundHeaderHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderHeight", required: false }] }], roundHeaderGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderGap", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnGap", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], rowRoundGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowRoundGap", required: false }] }], lineStartingCurveAmount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineStartingCurveAmount", required: false }] }], lineEndingCurveAmount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineEndingCurveAmount", required: false }] }], lineWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineWidth", required: false }] }], lineDashArray: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineDashArray", required: false }] }], lineDashOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineDashOffset", required: false }] }], disableJourneyHighlight: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableJourneyHighlight", required: false }] }], swissGroupPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissGroupPadding", required: false }] }], swissGroupBorderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissGroupBorderRadius", required: false }] }], swissColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissColors", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], hideRoundHeaders: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideRoundHeaders", required: false }] }], roundHeaderComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderComponent", required: false }] }], matchComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchComponent", required: false }] }], finalMatchComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalMatchComponent", required: false }] }] } });
|
|
4431
|
+
}, imports: [NgComponentOutlet], template: "@if (bracketGrid(); as grid) {\n <section\n [style.width.px]=\"grid.raw.grid.dimensions.width\"\n [style.height.px]=\"grid.raw.grid.dimensions.height\"\n class=\"et-bracket-new et-bracket-new--{{ bracketData().mode }}\"\n >\n <svg [innerHTML]=\"svgContent()\" class=\"et-bracket-new-svg\" xmlns=\"http://www.w3.org/2000/svg\" />\n\n @for (round of grid.columns; track $index) {\n <ul\n [style.width.px]=\"round.dimensions.width\"\n [style.height.px]=\"round.dimensions.height\"\n [style.top.px]=\"round.dimensions.top\"\n [style.left.px]=\"round.dimensions.left\"\n class=\"et-bracket-new-round\"\n >\n @for (element of round.elements; track $index) {\n @let inputs =\n element.type === 'header'\n ? { bracketRound: element.round, bracketRoundSwissGroup: element.roundSwissGroup }\n : element.type === 'continue'\n ? { bracketMatches: element.matches }\n : {\n bracketRound: element.round,\n bracketMatch: element.match,\n bracketRoundSwissGroup: element.roundSwissGroup,\n };\n\n @let highlightClass = element.type === 'match' ? element.classes : '';\n\n <li\n [style.width.px]=\"element.dimensions.width\"\n [style.height.px]=\"element.dimensions.height\"\n [style.top.px]=\"element.dimensions.top - round.dimensions.top\"\n [style.left.px]=\"element.dimensions.left - round.dimensions.left\"\n class=\"et-bracket-new-element et-bracket-new-element--{{ element.type }} {{ highlightClass }}\"\n >\n <ng-container *ngComponentOutlet=\"$any(element.component); inputs: inputs\" />\n </li>\n }\n </ul>\n }\n </section>\n}\n", styles: [".et-bracket-new{position:relative;--bracket-line-color: red}.et-bracket-new-round{position:absolute;list-style:none;margin:0;padding:0}.et-bracket-new-element{position:absolute;list-style:none;margin:0;padding:0;transition:opacity .2s}.et-bracket-new-svg{inline-size:100%;block-size:100%;position:absolute}.et-bracket-new-svg path{color:var(--bracket-line-color);transition:opacity .2s}.et-bracket-new-svg .et-bracket-new-swiss-group-border{color:var(--bracket-swiss-group-border-color, var(--bracket-line-color))}.et-new-bracket-host--journey-hover path,.et-new-bracket-host--journey-hover .et-bracket-new-element--match{opacity:.5}.et-new-bracket-host--journey-hover .et-bracket-new-journey-active{opacity:1!important}\n"] }]
|
|
4432
|
+
}], ctorParameters: () => [], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], columnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnWidth", required: false }] }], matchHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchHeight", required: false }] }], finalMatchHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalMatchHeight", required: false }] }], finalColumnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalColumnWidth", required: false }] }], roundHeaderHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderHeight", required: false }] }], roundHeaderGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderGap", required: false }] }], columnGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnGap", required: false }] }], rowGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowGap", required: false }] }], rowRoundGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowRoundGap", required: false }] }], lineStartingCurveAmount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineStartingCurveAmount", required: false }] }], lineEndingCurveAmount: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineEndingCurveAmount", required: false }] }], lineWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineWidth", required: false }] }], lineDashArray: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineDashArray", required: false }] }], lineDashOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineDashOffset", required: false }] }], disableJourneyHighlight: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableJourneyHighlight", required: false }] }], swissGroupPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissGroupPadding", required: false }] }], swissGroupBorderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissGroupBorderRadius", required: false }] }], swissColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "swissColors", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], hideRoundHeaders: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideRoundHeaders", required: false }] }], showContinueElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "showContinueElement", required: false }] }], continueColumnWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "continueColumnWidth", required: false }] }], continueElementHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "continueElementHeight", required: false }] }], continueLineDashArray: [{ type: i0.Input, args: [{ isSignal: true, alias: "continueLineDashArray", required: false }] }], roundHeaderComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "roundHeaderComponent", required: false }] }], matchComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchComponent", required: false }] }], finalMatchComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "finalMatchComponent", required: false }] }], continueComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "continueComponent", required: false }] }] } });
|
|
4235
4433
|
|
|
4236
4434
|
var index = /*#__PURE__*/Object.freeze({
|
|
4237
4435
|
__proto__: null,
|
|
@@ -4243,6 +4441,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4243
4441
|
DOUBLE_ELIMINATION_BRACKET_ROUND_TYPE: DOUBLE_ELIMINATION_BRACKET_ROUND_TYPE,
|
|
4244
4442
|
GROUP_BRACKET_ROUND_TYPE: GROUP_BRACKET_ROUND_TYPE,
|
|
4245
4443
|
NewBracketComponent: NewBracketComponent,
|
|
4444
|
+
NewBracketDefaultContinueComponent: NewBracketDefaultContinueComponent,
|
|
4246
4445
|
NewBracketDefaultMatchComponent: NewBracketDefaultMatchComponent,
|
|
4247
4446
|
NewBracketDefaultRoundHeaderComponent: NewBracketDefaultRoundHeaderComponent,
|
|
4248
4447
|
SINGLE_ELIMINATION_BRACKET_ROUND_TYPE: SINGLE_ELIMINATION_BRACKET_ROUND_TYPE,
|