Skip to content

Commit

Permalink
🐛 fix: update stencil to version 4.23.0 to fix the event issues (#1557)
Browse files Browse the repository at this point in the history
* Create PR for #1556

* fix: update stencil to 4.23.0

* chore: remove workaround

* chore: fix build issue

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gery Hirschfeld <gerhard.hirschfeld@baloise.ch>
  • Loading branch information
github-actions[bot] and hirsch88 authored Jan 7, 2025
1 parent 878e0a7 commit 3145ebd
Show file tree
Hide file tree
Showing 34 changed files with 118 additions and 176 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-ways-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**core**: update stencil to fix event issue
2 changes: 1 addition & 1 deletion libs/output-target-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@stencil/core": "4.22.3",
"@stencil/core": "4.23.0",
"tslib": "~2.3.0"
},
"type": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion libs/output-target-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"tslib": "~2.3.0",
"@stencil/core": "4.22.3"
"@stencil/core": "4.23.0"
},
"peerDependencies": {
"react": "~18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion libs/output-target-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"tslib": "~2.3.0",
"@stencil/core": "4.22.3"
"@stencil/core": "4.23.0"
},
"type": "commonjs",
"main": "./dist/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion libs/output-target-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"tslib": "~2.3.0",
"@stencil/core": "4.22.3",
"@stencil/core": "4.23.0",
"fs-extra": "11.2.0",
"replace-in-file": "~7.1.0"
},
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@nx/web": "~18.0.4",
"@nxkit/style-dictionary": "~5.0.0",
"@schematics/angular": "~15.0.0",
"@stencil/core": "4.22.3",
"@stencil/core": "4.23.0",
"@stencil/sass": "~3.0.12",
"@swc-node/register": "~1.8.0",
"@swc/cli": "~0.1.62",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@baloise/web-app-utils": "3.15.0",
"@floating-ui/dom": "~1.6.3",
"@popperjs/core": "~2.11.4",
"@stencil/core": "4.22.3",
"@stencil/core": "4.23.0",
"big.js": "~6.2.1",
"contactjs": "2.1.7",
"filesize.js": "~2.0.0",
Expand Down
16 changes: 13 additions & 3 deletions packages/core/src/components/bal-button/bal-button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { Component, h, Prop, Host, Event, EventEmitter, ComponentInterface, Element, State } from '@stencil/core'
import {
Component,
h,
Prop,
Host,
Event,
EventEmitter,
ComponentInterface,
Element,
State,
Listen,
} from '@stencil/core'
import { Attributes, inheritAttributes } from '../../utils/attributes'
import { rLCP } from '../../utils/helpers'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-button',
Expand Down Expand Up @@ -159,7 +169,7 @@ export class Button implements ComponentInterface {
*/
@Event() balDidRender!: EventEmitter<BalEvents.BalButtonDidRenderDetail>

@ListenTo('click', { capture: true, target: 'document' })
@Listen('click', { capture: true, target: 'document' })
listenOnClick(ev: UIEvent) {
if (this.disabled && ev.target && ev.target === this.el) {
ev.preventDefault()
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/bal-carousel/bal-carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Event,
EventEmitter,
State,
Listen,
} from '@stencil/core'
import { debounce, raf, rLCP } from '../../utils/helpers'
import { BEM } from '../../utils/bem'
Expand All @@ -26,7 +27,6 @@ import { BalResizeObserver, ListenToResize } from '../../utils/resize'
import { getComputedWidth } from '../../utils/style'
import { BalConfigState, BalLanguage, ListenToConfig, defaultConfig } from '../../utils/config'
import { i18nControlLabel } from './bal-carousel.i18n'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-carousel',
Expand Down Expand Up @@ -143,7 +143,7 @@ export class Carousel
* ------------------------------------------------------
*/

@ListenTo('touchmove', { target: 'window', passive: false })
@Listen('touchmove', { target: 'window', passive: false })
async blockVerticalScrolling(ev: any) {
if (!this.scrollY && this.el?.contains(ev.target)) {
stopEventBubbling(ev)
Expand Down Expand Up @@ -177,7 +177,7 @@ export class Carousel
this.itemsChanged()
}

@ListenTo('keydown')
@Listen('keydown')
listenToKeyDown(ev: KeyboardEvent) {
if (this.htmlRole !== 'tablist') {
if (ev.code === 'Tab') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EventEmitter,
Method,
State,
Listen,
} from '@stencil/core'
import { stopEventBubbling } from '../../../utils/form-input'
import { hasTagName, isDescendant } from '../../../utils/helpers'
Expand All @@ -21,7 +22,6 @@ import { Loggable, Logger, LogInstance } from '../../../utils/log'
import { BalMutationObserver, ListenToMutation } from '../../../utils/mutation'
import { BalAriaForm, BalAriaFormLinking, defaultBalAriaForm } from '../../../utils/form'
import { BalFocusObserver, ListenToFocus } from '../../../utils/focus'
import { ListenTo } from 'packages/core/src/utils/listen'

@Component({
tag: 'bal-checkbox-group',
Expand Down Expand Up @@ -268,7 +268,7 @@ export class CheckboxGroup
this.onOptionChange()
}

@ListenTo('balChange', { capture: true, target: 'document' })
@Listen('balChange', { capture: true, target: 'document' })
listenOnClick(ev: UIEvent) {
if (this.control) {
if (isDescendant(this.el, ev.target as HTMLElement)) {
Expand All @@ -277,7 +277,7 @@ export class CheckboxGroup
}
}

@ListenTo('reset', { capture: true, target: 'document' })
@Listen('reset', { capture: true, target: 'document' })
resetHandler(ev: UIEvent) {
const formElement = ev.target as HTMLElement
if (formElement?.contains(this.el)) {
Expand All @@ -288,15 +288,15 @@ export class CheckboxGroup
}
}

@ListenTo('balFocus', { capture: true, target: 'document' })
@Listen('balFocus', { capture: true, target: 'document' })
checkboxFocusListener(ev: CustomEvent<FocusEvent>) {
const { target } = ev
if (target && isDescendant(this.el, target) && hasTagName(target, 'bal-checkbox')) {
stopEventBubbling(ev)
}
}

@ListenTo('balBlur', { capture: true, target: 'document' })
@Listen('balBlur', { capture: true, target: 'document' })
checkboxBlurListener(ev: CustomEvent<FocusEvent>) {
const { target } = ev
if (target && isDescendant(this.el, target) && hasTagName(target, 'bal-checkbox')) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/bal-checkbox/bal-checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Event,
Method,
State,
Listen,
ComponentInterface,
} from '@stencil/core'
import { FormInput, inputSetBlur, inputSetFocus, stopEventBubbling } from '../../utils/form-input'
Expand All @@ -20,7 +21,6 @@ import { Loggable, Logger, LogInstance } from '../../utils/log'
import { FOCUS_KEYS } from '../../utils/focus-visible'
import { BalAriaForm, BalAriaFormLinking, defaultBalAriaForm } from '../../utils/form'
import { ariaBooleanToString } from '../../utils/aria'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-checkbox',
Expand Down Expand Up @@ -203,7 +203,7 @@ export class Checkbox implements ComponentInterface, FormInput<any>, Loggable, B
* ------------------------------------------------------
*/

@ListenTo('click', { capture: true, target: 'document' })
@Listen('click', { capture: true, target: 'document' })
listenOnClick(ev: UIEvent) {
if (
(this.disabled || this.readonly) &&
Expand All @@ -214,7 +214,7 @@ export class Checkbox implements ComponentInterface, FormInput<any>, Loggable, B
}
}

@ListenTo('reset', { capture: true, target: 'document' })
@Listen('reset', { capture: true, target: 'document' })
resetHandler(ev: UIEvent) {
const formElement = ev.target as HTMLElement
if (formElement?.contains(this.el)) {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/components/bal-date/bal-date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Event,
EventEmitter,
Watch,
Listen,
} from '@stencil/core'
import { isSpaceKey } from '../../utils/keyboard'
import { i18nBalDate } from './bal-date.i18n'
Expand All @@ -22,7 +23,6 @@ import { BalConfigState, BalLanguage, ListenToConfig, defaultConfig } from '../.
import { debounceEvent } from '../../utils/helpers'
import { BalAriaForm, defaultBalAriaForm, BalAriaFormLinking } from '../../utils/form'
import { balFloatingUi } from '../../utils/floating-ui'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-date',
Expand Down Expand Up @@ -238,31 +238,31 @@ export class Date implements ComponentInterface, Loggable, BalAriaFormLinking {
* ------------------------------------------------------
*/

@ListenTo('keydown', { target: 'window' })
@Listen('keydown', { target: 'window' })
async listenToKeydown(ev: KeyboardEvent) {
if (this.isExpanded && (ev.key === 'Escape' || ev.key === 'Esc')) {
ev.preventDefault()
await this.close()
}
}

@ListenTo('keyup', { target: 'window' })
@Listen('keyup', { target: 'window' })
async listenOnKeyup(ev: KeyboardEvent) {
// dismiss popup when focus next form control
if (ev.key === 'Tab' && !this.el.contains(document.activeElement) && this.isExpanded) {
await this.close()
}
}

@ListenTo('click', { target: 'document' })
@Listen('click', { target: 'document' })
async listenOnclick(ev: UIEvent) {
// when clicked outside dismiss popup
if (this.isExpanded && !this.el.contains(ev.target as Node)) {
await this.close()
}
}

@ListenTo('balPopoverPrepare', { target: 'document' })
@Listen('balPopoverPrepare', { target: 'document' })
async listenOnPopoverPrepare(ev: CustomEvent<string>) {
// dismiss this popover, because another will open
if (this.inputId !== ev.detail) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { areArraysEqual } from '../../utils/array'
import { Component, Host, h, Element, State, Prop, Event, EventEmitter, Watch, Method } from '@stencil/core'
import { Component, Host, h, Element, State, Prop, Event, EventEmitter, Watch, Method, Listen } from '@stencil/core'
import {
FormInput,
inputHandleBlur,
Expand All @@ -14,7 +14,6 @@ import { FileListComponent } from './components/file-list'
import { toFileArray, toFileList } from './utils/file-list.util'
import { validateFileArray } from './utils/file-validation.util'
import { BalAriaForm, BalAriaFormLinking, defaultBalAriaForm } from '../../utils/form'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-file-upload',
Expand Down Expand Up @@ -196,7 +195,7 @@ export class FileUpload implements FormInput<File[]>, BalAriaFormLinking {

private resetHandlerTimer?: NodeJS.Timeout

@ListenTo('reset', { capture: true, target: 'document' })
@Listen('reset', { capture: true, target: 'document' })
resetHandler(ev: UIEvent) {
const formElement = ev.target as HTMLElement
if (formElement?.contains(this.el)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Component, h, Host, Element, Prop, EventEmitter, Event, Method, Watch, State } from '@stencil/core'
import { Component, h, Host, Element, Prop, EventEmitter, Event, Method, Watch, State, Listen } from '@stencil/core'
import isNil from 'lodash.isnil'
import { debounceEvent } from '../../utils/helpers'
import { stopEventBubbling } from '../../utils/form-input'
import { BEM } from '../../utils/bem'
import { BalAriaForm, BalAriaFormLinking, defaultBalAriaForm } from '../../utils/form'
import { ListenTo } from '../../utils/listen'

@Component({
tag: 'bal-input-slider',
Expand Down Expand Up @@ -116,7 +115,7 @@ export class InputSlider implements BalAriaFormLinking {
*/
@Event() balChange!: EventEmitter<BalEvents.BalInputSliderChangeDetail>

@ListenTo('click', { capture: true, target: 'document' })
@Listen('click', { capture: true, target: 'document' })
listenOnClick(ev: UIEvent) {
if ((this.disabled || this.readonly) && ev.target && ev.target === this.el) {
stopEventBubbling(ev)
Expand All @@ -125,7 +124,7 @@ export class InputSlider implements BalAriaFormLinking {

private resetHandlerTimer?: NodeJS.Timeout

@ListenTo('reset', { capture: true, target: 'document' })
@Listen('reset', { capture: true, target: 'document' })
resetHandler(ev: UIEvent) {
const formElement = ev.target as HTMLElement
if (formElement?.contains(this.el)) {
Expand Down
Loading

0 comments on commit 3145ebd

Please sign in to comment.