Skip to content

Commit

Permalink
feat(linter): fixing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
manoncarbonnel authored and dpellier committed Oct 26, 2023
1 parent d586677 commit 9181a5a
Show file tree
Hide file tree
Showing 776 changed files with 9,324 additions and 9,269 deletions.
4 changes: 2 additions & 2 deletions packages/cdk/dev/src/components/ocdk-dummy/ocdk-dummy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Element, Host, h } from '@stencil/core';
import { HTMLStencilElement } from '@stencil/core/internal';
import {Component, Element, Host, h} from '@stencil/core';
import {HTMLStencilElement} from '@stencil/core/internal';

@Component({
tag: 'ocdk-dummy',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Component, Element, h, Host, Listen, Prop, Watch } from '@stencil/core';
import { HTMLStencilElement } from '@stencil/core/internal';
import {Component, Element, Host, Listen, Prop, Watch, h} from '@stencil/core';
import {HTMLStencilElement} from '@stencil/core/internal';
import {
ocdkAssertEventTargetIsNode,
ocdkDefineCustomElements,
ocdkIsSurface,
OcdkLogger,
OcdkSurface,
OcdkSurfaceCorner,
ocdkAssertEventTargetIsNode,
ocdkDefineCustomElements,
ocdkIsSurface,
} from '@ovhcloud/ods-cdk';
import { OcdkSurfaceSelectItemExample } from './ocdk-surface-select-item-example';
import { OcdkSurfaceSelectPosition } from './ocdk-surface-select-position';
import {OcdkSurfaceSelectItemExample} from './ocdk-surface-select-item-example';
import {OcdkSurfaceSelectPosition} from './ocdk-surface-select-position';

// define custom elements from CDK
ocdkDefineCustomElements()
ocdkDefineCustomElements();

@Component({
tag: 'ocdk-surface-select-example',
Expand All @@ -22,11 +22,11 @@ ocdkDefineCustomElements()
export class OcdkSurfaceSelectExample {
static totalIds = 0;
@Element() el!: HTMLStencilElement;
@Prop({ reflect: true }) value = '';
@Prop({ reflect: true }) position: OcdkSurfaceSelectPosition = OcdkSurfaceSelectPosition.BOTTOM;
@Prop({ reflect: true }) opened = false;
@Prop({ reflect: true }) animation: null | 'none' = null;
@Prop({ reflect: false }) debug = false;
@Prop({reflect: true}) value = '';
@Prop({reflect: true}) position: OcdkSurfaceSelectPosition = OcdkSurfaceSelectPosition.BOTTOM;
@Prop({reflect: true}) opened = false;
@Prop({reflect: true}) animation: null | 'none' = null;
@Prop({reflect: false}) debug = false;
/** anchor reference. can be considered as fulfilled by the stencil ref system */
private anchor!: HTMLElement;
/** surface reference. initialized when cdk is */
Expand All @@ -43,7 +43,7 @@ export class OcdkSurfaceSelectExample {
@Listen('ocdkSurfaceSelectItemExampleClick')
onItemSelection(event: CustomEvent<{ item: OcdkSurfaceSelectItemExample, value: string }>) {
const details = event.detail;
this.logger.log('[onItemSelection]', 'one item selected', { details });
this.logger.log('[onItemSelection]', 'one item selected', {details});
this.value = details.value;
this.surface?.close();
}
Expand All @@ -54,7 +54,7 @@ export class OcdkSurfaceSelectExample {
}

// Hide overlay when we click anywhere else in the window.
@Listen('click', { target: 'window' })
@Listen('click', {target: 'window'})
checkForClickOutside(ev: PointerEvent) {
ocdkAssertEventTargetIsNode(ev.target);
if (!this.dirty || this.el.contains(ev.target)) { // click on component, do nothing
Expand All @@ -79,16 +79,16 @@ export class OcdkSurfaceSelectExample {
}

render() {
const debugHTML = this.debug ?
<div style={{ fontSize: '0.75rem', color: '#bbbbbb', position: 'absolute', left: '10px' }}>debug: #{this.uniqueId} - value: "{this.value}"</div> : '';
const debugHTML = this.debug
? <div style={{fontSize: '0.75rem', color: '#bbbbbb', position: 'absolute', left: '10px'}}>debug: #{this.uniqueId} - value: "{this.value}"</div> : '';
return (
<Host>
<div
class="trigger"
onClick={this.handleTriggerClick.bind(this)}
ref={(el?: HTMLElement) => {
this.anchor = el as HTMLDivElement;
this.syncReferences()
this.syncReferences();
}}>
{debugHTML}
<slot name={'trigger'}></slot>
Expand All @@ -100,7 +100,7 @@ export class OcdkSurfaceSelectExample {
ref={(el: HTMLElement) => {
if (ocdkIsSurface(el)) {
this.surface = el as OcdkSurface;
this.syncReferences()
this.syncReferences();
}
}}>
<slot></slot>
Expand Down Expand Up @@ -133,28 +133,28 @@ export class OcdkSurfaceSelectExample {
}

private syncPosition() {
this.logger.log('[syncPosition]', { position: this.position.toUpperCase() });
this.logger.log('[syncPosition]', {position: this.position.toUpperCase()});
if (!this.surface) {
return;
}

switch (this.position.toUpperCase()) {
// two methods exist to set corners
case OcdkSurfaceSelectPosition.TOP:
this.surface.setAnchorCorner(OcdkSurfaceCorner.TOP_LEFT);
this.surface.setOriginCorner(OcdkSurfaceCorner.BOTTOM_LEFT);
break;
case OcdkSurfaceSelectPosition.BOTTOM:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.BOTTOM_LEFT, origin: OcdkSurfaceCorner.TOP_LEFT });
break;
default:
break;
case OcdkSurfaceSelectPosition.LEFT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.TOP_LEFT, origin: OcdkSurfaceCorner.TOP_RIGHT });
break;
case OcdkSurfaceSelectPosition.RIGHT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.TOP_RIGHT, origin: OcdkSurfaceCorner.TOP_LEFT });
break;
// two methods exist to set corners
case OcdkSurfaceSelectPosition.TOP:
this.surface.setAnchorCorner(OcdkSurfaceCorner.TOP_LEFT);
this.surface.setOriginCorner(OcdkSurfaceCorner.BOTTOM_LEFT);
break;
case OcdkSurfaceSelectPosition.BOTTOM:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.BOTTOM_LEFT, origin: OcdkSurfaceCorner.TOP_LEFT});
break;
default:
break;
case OcdkSurfaceSelectPosition.LEFT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.TOP_LEFT, origin: OcdkSurfaceCorner.TOP_RIGHT});
break;
case OcdkSurfaceSelectPosition.RIGHT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.TOP_RIGHT, origin: OcdkSurfaceCorner.TOP_LEFT});
break;
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Element, Event, EventEmitter, h, Host, Listen, Prop } from '@stencil/core';
import { HTMLStencilElement } from '@stencil/core/internal';
import { OcdkLogger } from '@ovhcloud/ods-cdk';
import {Component, Element, Event, EventEmitter, Host, Listen, Prop, h} from '@stencil/core';
import {HTMLStencilElement} from '@stencil/core/internal';
import {OcdkLogger} from '@ovhcloud/ods-cdk';

@Component({
tag: 'ocdk-surface-select-item-example',
Expand All @@ -11,7 +11,7 @@ export class OcdkSurfaceSelectItemExample {
static totalIds = 0;
@Element() el!: HTMLStencilElement;
@Event() ocdkSurfaceSelectItemExampleClick!: EventEmitter<{ item: OcdkSurfaceSelectItemExample, value: string }>;
@Prop({ reflect: true }) value = '';
@Prop({reflect: true}) value = '';
private uniqueId = OcdkSurfaceSelectItemExample.totalIds++;
private logger = new OcdkLogger(`OcdkSurfaceSelectItemExample #${this.uniqueId}`);

Expand All @@ -21,7 +21,7 @@ export class OcdkSurfaceSelectItemExample {
@Listen('click')
onCLick() {
this.logger.log('onCLick', 'send value');
this.ocdkSurfaceSelectItemExampleClick.emit({ item: this, value: this.value })
this.ocdkSurfaceSelectItemExampleClick.emit({item: this, value: this.value});
}

render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, Element, h, Host, Listen, Prop } from '@stencil/core';
import { HTMLStencilElement } from '@stencil/core/internal';
import { ocdkDefineCustomElements, ocdkIsSurface, OcdkLogger, OcdkSurface, OcdkSurfaceCorner } from '@ovhcloud/ods-cdk';
import { OcdkSurfaceTooltipPosition } from './ocdk-surface-tooltip-position';
import {Component, Element, Host, Listen, Prop, h} from '@stencil/core';
import {HTMLStencilElement} from '@stencil/core/internal';
import {OcdkLogger, OcdkSurface, OcdkSurfaceCorner, ocdkDefineCustomElements, ocdkIsSurface} from '@ovhcloud/ods-cdk';
import {OcdkSurfaceTooltipPosition} from './ocdk-surface-tooltip-position';

// define custom elements from CDK
ocdkDefineCustomElements()
ocdkDefineCustomElements();

@Component({
tag: 'ocdk-surface-tooltip-example',
Expand All @@ -14,8 +14,8 @@ ocdkDefineCustomElements()
export class OcdkSurfaceTooltipExample {
static totalIds = 0;
@Element() el!: HTMLStencilElement;
@Prop({ reflect: true }) value = '';
@Prop({ reflect: true }) position: OcdkSurfaceTooltipPosition = OcdkSurfaceTooltipPosition.BOTTOM;
@Prop({reflect: true}) value = '';
@Prop({reflect: true}) position: OcdkSurfaceTooltipPosition = OcdkSurfaceTooltipPosition.BOTTOM;
private anchor!: HTMLElement;
/** surface reference. initialized when cdk is */
private surface?: OcdkSurface = undefined;
Expand All @@ -31,16 +31,16 @@ export class OcdkSurfaceTooltipExample {
render() {
return (
<Host onMouseEnter={this.debounce(this.handleMouseEnter, 500)}
onMouseLeave={this.debounce(this.handleMouseLeave)}
ref={(el: HTMLElement | null) => {
this.anchor = el as HTMLElement;
this.syncReferences()
}}>
onMouseLeave={this.debounce(this.handleMouseLeave)}
ref={(el: HTMLElement | null) => {
this.anchor = el as HTMLElement;
this.syncReferences();
}}>
<slot></slot>
<ocdk-surface animation={'scaling'} ref={(el: HTMLElement) => {
if (ocdkIsSurface(el)) {
this.surface = el as OcdkSurface;
this.syncReferences()
this.syncReferences();
}
}}>
{this.value}
Expand Down Expand Up @@ -88,39 +88,39 @@ export class OcdkSurfaceTooltipExample {
}

private syncPosition() {
this.logger.log('[syncPosition]', { position: this.position.toUpperCase() });
this.logger.log('[syncPosition]', {position: this.position.toUpperCase()});
if (!this.surface) {
return;
}

switch (this.position.toUpperCase()) {
case OcdkSurfaceTooltipPosition.TOP:
this.surface.setAnchorCorner(OcdkSurfaceCorner.TOP_LEFT);
this.surface.setOriginCorner(OcdkSurfaceCorner.BOTTOM_LEFT);
break;
case OcdkSurfaceTooltipPosition.BOTTOM:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.BOTTOM_LEFT, origin: OcdkSurfaceCorner.TOP_LEFT });
break;
default:
break;
case OcdkSurfaceTooltipPosition.LEFT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.TOP_LEFT, origin: OcdkSurfaceCorner.TOP_RIGHT });
break;
case OcdkSurfaceTooltipPosition.RIGHT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.TOP_RIGHT, origin: OcdkSurfaceCorner.TOP_LEFT });
break;
case OcdkSurfaceTooltipPosition.BOTTOM_CENTER:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.BOTTOM_CENTER, origin: OcdkSurfaceCorner.TOP_CENTER });
break;
case OcdkSurfaceTooltipPosition.TOP_CENTER:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.TOP_CENTER, origin: OcdkSurfaceCorner.BOTTOM_CENTER });
break;
case OcdkSurfaceTooltipPosition.CENTER_LEFT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.CENTER_LEFT, origin: OcdkSurfaceCorner.CENTER_RIGHT });
break;
case OcdkSurfaceTooltipPosition.CENTER_RIGHT:
this.surface.setCornerPoints({ anchor: OcdkSurfaceCorner.CENTER_RIGHT, origin: OcdkSurfaceCorner.CENTER_LEFT });
break;
case OcdkSurfaceTooltipPosition.TOP:
this.surface.setAnchorCorner(OcdkSurfaceCorner.TOP_LEFT);
this.surface.setOriginCorner(OcdkSurfaceCorner.BOTTOM_LEFT);
break;
case OcdkSurfaceTooltipPosition.BOTTOM:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.BOTTOM_LEFT, origin: OcdkSurfaceCorner.TOP_LEFT});
break;
default:
break;
case OcdkSurfaceTooltipPosition.LEFT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.TOP_LEFT, origin: OcdkSurfaceCorner.TOP_RIGHT});
break;
case OcdkSurfaceTooltipPosition.RIGHT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.TOP_RIGHT, origin: OcdkSurfaceCorner.TOP_LEFT});
break;
case OcdkSurfaceTooltipPosition.BOTTOM_CENTER:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.BOTTOM_CENTER, origin: OcdkSurfaceCorner.TOP_CENTER});
break;
case OcdkSurfaceTooltipPosition.TOP_CENTER:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.TOP_CENTER, origin: OcdkSurfaceCorner.BOTTOM_CENTER});
break;
case OcdkSurfaceTooltipPosition.CENTER_LEFT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.CENTER_LEFT, origin: OcdkSurfaceCorner.CENTER_RIGHT});
break;
case OcdkSurfaceTooltipPosition.CENTER_RIGHT:
this.surface.setCornerPoints({anchor: OcdkSurfaceCorner.CENTER_RIGHT, origin: OcdkSurfaceCorner.CENTER_LEFT});
break;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
OcdkSurfaceNormalizedCorner,
OcdkSurfaceOnePositionStrategy,
OcdkSurfaceStrategyDefiner,
OcdkSurfaceStrategyDefinerConfig
OcdkSurfaceStrategyDefinerConfig,
} from '@ovhcloud/ods-cdk';

/**
Expand All @@ -26,7 +26,7 @@ export class OcdkSurfaceCustomStrategyExample implements OcdkSurfaceStrategyDefi
return [
// ### anchored at bottom
{
cornerPoints: { anchor: OcdkSurfaceNormalizedCorner.BOTTOM_LEFT, origin: OcdkSurfaceNormalizedCorner.TOP_LEFT },
cornerPoints: {anchor: OcdkSurfaceNormalizedCorner.BOTTOM_LEFT, origin: OcdkSurfaceNormalizedCorner.TOP_LEFT},
STRATEGIES: {
// main mode : standard
standard: {
Expand All @@ -44,7 +44,7 @@ export class OcdkSurfaceCustomStrategyExample implements OcdkSurfaceStrategyDefi
availableLeft: () => 0,
availableRight: () => 0,
availableTop: () => 0,
}
},
},
// use analyzed spaces (limit and margin) and fill final values
appliers: {
Expand All @@ -53,8 +53,8 @@ export class OcdkSurfaceCustomStrategyExample implements OcdkSurfaceStrategyDefi
verticalOffset: () => 0,
verticalAlignment: 'top',
horizontalOffset: (opt) => -opt.measurements.surfaceSize.width,
horizontalAlignment: 'right'
}
horizontalAlignment: 'right',
},
},
// fallback mode
FALLBACK: {
Expand All @@ -81,17 +81,17 @@ export class OcdkSurfaceCustomStrategyExample implements OcdkSurfaceStrategyDefi
verticalOffset: () => 0,
verticalAlignment: 'top',
horizontalOffset: () => 0,
horizontalAlignment: 'left'
}
horizontalAlignment: 'left',
},
},
// make a choice of position: keep, switch or fallback
COMPUTE: () => {
this.logger.log('[COMPUTE] position BOTTOM_LEFT TOP_LEFT');
return undefined; // no position switching: apply the current one
}
},

}
}
},
},
// write here all the other positions of the strategy table position
];
}
Expand Down
Loading

0 comments on commit 9181a5a

Please sign in to comment.