Skip to content

Commit

Permalink
fix: use verbatimModuleSyntax and isolatedModules (#1534)
Browse files Browse the repository at this point in the history
* feat: use verbatimModuleSyntax and isolatedModules

* prettier

* remove newline

* prettier
  • Loading branch information
KonnorRogers committed Aug 23, 2023
1 parent ec17e87 commit 43d1f9e
Show file tree
Hide file tree
Showing 47 changed files with 85 additions and 152 deletions.
1 change: 1 addition & 0 deletions docs/pages/resources/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti

## Next

- Added `--isolatedModules` and `--verbatimModuleSyntax` to `tsconfig.json`. For anyone directly importing event types, they no longer provide a default export due to these options being enabled. For people using the `events/event.js` file directly, there is no change.
- Added support for submenus in `<sl-menu-item>` [#1410]
- Added the `--submenu-offset` custom property to `<sl-menu-item>` [#1410]
- Fixed type issues with the `ref` attribute in React Wrappers. [#1526]
Expand Down
4 changes: 2 additions & 2 deletions src/components/color-picker/color-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import SlVisuallyHidden from '../visually-hidden/visually-hidden.component.js';
import styles from './color-picker.styles.js';
import type { CSSResultGroup } from 'lit';
import type { ShoelaceFormControl } from '../../internal/shoelace-element.js';
import type SlChangeEvent from '../../events/sl-change.js';
import type SlInputEvent from '../../events/sl-input.js';
import type { SlChangeEvent } from '../../events/sl-change.js';
import type { SlInputEvent } from '../../events/sl-input.js';

const hasEyeDropper = 'EyeDropper' in window;

Expand Down
4 changes: 2 additions & 2 deletions src/components/details/details.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import '../../../dist/shoelace.js';
// cspell:dictionaries lorem-ipsum
import { expect, fixture, html, waitUntil } from '@open-wc/testing';
import sinon from 'sinon';
import type { SlHideEvent } from '../../events/sl-hide';
import type { SlShowEvent } from '../../events/sl-show';
import type SlDetails from './details';
import type SlHideEvent from '../../events/sl-hide';
import type SlShowEvent from '../../events/sl-show';

describe('<sl-details>', () => {
describe('accessibility', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import ShoelaceElement from '../../internal/shoelace-element.js';
import SlPopup from '../popup/popup.component.js';
import styles from './dropdown.styles.js';
import type { CSSResultGroup } from 'lit';
import type { SlSelectEvent } from '../../events/sl-select.js';
import type SlButton from '../button/button.js';
import type SlIconButton from '../icon-button/icon-button.js';
import type SlMenu from '../menu/menu.js';
import type SlSelectEvent from '../../events/sl-select.js';

/**
* @summary Dropdowns expose additional content that "drops down" in a panel.
Expand Down
4 changes: 2 additions & 2 deletions src/components/icon/icon.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { aTimeout, elementUpdated, expect, fixture, html, oneEvent } from '@open-wc/testing';
import { registerIconLibrary } from '../../../dist/shoelace.js';
import type SlErrorEvent from '../../events/sl-error';
import type { SlErrorEvent } from '../../events/sl-error';
import type { SlLoadEvent } from '../../events/sl-load';
import type SlIcon from './icon';
import type SlLoadEvent from '../../events/sl-load';

const testLibraryIcons = {
'test-icon1': `
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu-item/menu-item.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import '../../../dist/shoelace.js';
import { expect, fixture, html, waitUntil } from '@open-wc/testing';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import type { SlSelectEvent } from '../../events/sl-select';
import type SlMenuItem from './menu-item';
import type SlSelectEvent from '../../events/sl-select';

describe('<sl-menu-item>', () => {
it('should pass accessibility tests', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { expect, fixture } from '@open-wc/testing';
import { html } from 'lit';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import type { SlSelectEvent } from '../../events/sl-select';
import type SlMenu from './menu';
import type SlSelectEvent from '../../events/sl-select';

describe('<sl-menu>', () => {
it('emits sl-select with the correct event detail when clicking an item', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio-group/radio-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { clickOnElement } from '../../internal/test.js';
import { runFormControlBaseTests } from '../../internal/test/form-control-base-tests.js';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';
import type SlChangeEvent from '../../events/sl-change.js';
import type { SlChangeEvent } from '../../events/sl-change.js';
import type SlRadio from '../radio/radio.js';
import type SlRadioGroup from './radio-group.js';

Expand Down
2 changes: 1 addition & 1 deletion src/components/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import SlTag from '../tag/tag.component.js';
import styles from './select.styles.js';
import type { CSSResultGroup, TemplateResult } from 'lit';
import type { ShoelaceFormControl } from '../../internal/shoelace-element.js';
import type { SlRemoveEvent } from '../../events/sl-remove.js';
import type SlOption from '../option/option.component.js';
import type SlRemoveEvent from '../../events/sl-remove.js';

/**
* @summary Selects allow you to choose items from a menu of predefined options.
Expand Down
2 changes: 1 addition & 1 deletion src/components/tab-group/tab-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { queryByTestId } from '../../internal/test/data-testid-helpers.js';
import { sendKeys } from '@web/test-runner-commands';
import { waitForScrollingToEnd } from '../../internal/test/wait-for-scrolling.js';
import type { HTMLTemplateResult } from 'lit';
import type { SlTabShowEvent } from '../../events/sl-tab-show.js';
import type SlTab from '../tab/tab.js';
import type SlTabGroup from './tab-group.js';
import type SlTabPanel from '../tab-panel/tab-panel.js';
import type SlTabShowEvent from '../../events/sl-tab-show.js';

interface ClientRectangles {
body?: DOMRect;
Expand Down
70 changes: 35 additions & 35 deletions src/events/events.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
export type { default as SlAfterCollapseEvent } from './sl-after-collapse';
export type { default as SlAfterExpandEvent } from './sl-after-expand';
export type { default as SlAfterHideEvent } from './sl-after-hide';
export type { default as SlAfterShowEvent } from './sl-after-show';
export type { default as SlBlurEvent } from './sl-blur';
export type { default as SlCancelEvent } from './sl-cancel';
export type { default as SlChangeEvent } from './sl-change';
export type { default as SlClearEvent } from './sl-clear';
export type { default as SlCloseEvent } from './sl-close';
export type { default as SlCollapseEvent } from './sl-collapse';
export type { default as SlCopyEvent } from './sl-copy';
export type { default as SlErrorEvent } from './sl-error';
export type { default as SlExpandEvent } from './sl-expand';
export type { default as SlFinishEvent } from './sl-finish';
export type { default as SlFocusEvent } from './sl-focus';
export type { default as SlHideEvent } from './sl-hide';
export type { default as SlHoverEvent } from './sl-hover';
export type { default as SlInitialFocusEvent } from './sl-initial-focus';
export type { default as SlInputEvent } from './sl-input';
export type { default as SlInvalidEvent } from './sl-invalid';
export type { default as SlLazyChangeEvent } from './sl-lazy-change';
export type { default as SlLazyLoadEvent } from './sl-lazy-load';
export type { default as SlLoadEvent } from './sl-load';
export type { default as SlMutationEvent } from './sl-mutation';
export type { default as SlRemoveEvent } from './sl-remove';
export type { default as SlRepositionEvent } from './sl-reposition';
export type { default as SlRequestCloseEvent } from './sl-request-close';
export type { default as SlResizeEvent } from './sl-resize';
export type { default as SlSelectEvent } from './sl-select';
export type { default as SlSelectionChangeEvent } from './sl-selection-change';
export type { default as SlShowEvent } from './sl-show';
export type { default as SlSlideChangeEvent } from './sl-slide-change';
export type { default as SlStartEvent } from './sl-start';
export type { default as SlTabHideEvent } from './sl-tab-hide';
export type { default as SlTabShowEvent } from './sl-tab-show';
export type { SlAfterCollapseEvent } from './sl-after-collapse';
export type { SlAfterExpandEvent } from './sl-after-expand';
export type { SlAfterHideEvent } from './sl-after-hide';
export type { SlAfterShowEvent } from './sl-after-show';
export type { SlBlurEvent } from './sl-blur';
export type { SlCancelEvent } from './sl-cancel';
export type { SlChangeEvent } from './sl-change';
export type { SlClearEvent } from './sl-clear';
export type { SlCloseEvent } from './sl-close';
export type { SlCollapseEvent } from './sl-collapse';
export type { SlCopyEvent } from './sl-copy';
export type { SlErrorEvent } from './sl-error';
export type { SlExpandEvent } from './sl-expand';
export type { SlFinishEvent } from './sl-finish';
export type { SlFocusEvent } from './sl-focus';
export type { SlHideEvent } from './sl-hide';
export type { SlHoverEvent } from './sl-hover';
export type { SlInitialFocusEvent } from './sl-initial-focus';
export type { SlInputEvent } from './sl-input';
export type { SlInvalidEvent } from './sl-invalid';
export type { SlLazyChangeEvent } from './sl-lazy-change';
export type { SlLazyLoadEvent } from './sl-lazy-load';
export type { SlLoadEvent } from './sl-load';
export type { SlMutationEvent } from './sl-mutation';
export type { SlRemoveEvent } from './sl-remove';
export type { SlRepositionEvent } from './sl-reposition';
export type { SlRequestCloseEvent } from './sl-request-close';
export type { SlResizeEvent } from './sl-resize';
export type { SlSelectEvent } from './sl-select';
export type { SlSelectionChangeEvent } from './sl-selection-change';
export type { SlShowEvent } from './sl-show';
export type { SlSlideChangeEvent } from './sl-slide-change';
export type { SlStartEvent } from './sl-start';
export type { SlTabHideEvent } from './sl-tab-hide';
export type { SlTabShowEvent } from './sl-tab-show';
4 changes: 1 addition & 3 deletions src/events/sl-after-collapse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlAfterCollapseEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlAfterCollapseEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-after-collapse': SlAfterCollapseEvent;
}
}

export default SlAfterCollapseEvent;
4 changes: 1 addition & 3 deletions src/events/sl-after-expand.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlAfterExpandEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlAfterExpandEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-after-expand': SlAfterExpandEvent;
}
}

export default SlAfterExpandEvent;
4 changes: 1 addition & 3 deletions src/events/sl-after-hide.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlAfterHideEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlAfterHideEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-after-hide': SlAfterHideEvent;
}
}

export default SlAfterHideEvent;
4 changes: 1 addition & 3 deletions src/events/sl-after-show.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlAfterShowEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlAfterShowEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-after-show': SlAfterShowEvent;
}
}

export default SlAfterShowEvent;
4 changes: 1 addition & 3 deletions src/events/sl-blur.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlBlurEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlBlurEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-blur': SlBlurEvent;
}
}

export default SlBlurEvent;
4 changes: 1 addition & 3 deletions src/events/sl-cancel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlCancelEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlCancelEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-cancel': SlCancelEvent;
}
}

export default SlCancelEvent;
4 changes: 1 addition & 3 deletions src/events/sl-change.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlChangeEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlChangeEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-change': SlChangeEvent;
}
}

export default SlChangeEvent;
4 changes: 1 addition & 3 deletions src/events/sl-clear.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlClearEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlClearEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-clear': SlClearEvent;
}
}

export default SlClearEvent;
4 changes: 1 addition & 3 deletions src/events/sl-close.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlCloseEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlCloseEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-close': SlCloseEvent;
}
}

export default SlCloseEvent;
4 changes: 1 addition & 3 deletions src/events/sl-collapse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlCollapseEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlCollapseEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-collapse': SlCollapseEvent;
}
}

export default SlCollapseEvent;
4 changes: 1 addition & 3 deletions src/events/sl-copy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlCopyEvent = CustomEvent<{ value: string }>;
export type SlCopyEvent = CustomEvent<{ value: string }>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-copy': SlCopyEvent;
}
}

export default SlCopyEvent;
4 changes: 1 addition & 3 deletions src/events/sl-error.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlErrorEvent = CustomEvent<{ status?: number }>;
export type SlErrorEvent = CustomEvent<{ status?: number }>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-error': SlErrorEvent;
}
}

export default SlErrorEvent;
4 changes: 1 addition & 3 deletions src/events/sl-expand.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlExpandEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlExpandEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-expand': SlExpandEvent;
}
}

export default SlExpandEvent;
4 changes: 1 addition & 3 deletions src/events/sl-finish.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlFinishEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlFinishEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-finish': SlFinishEvent;
}
}

export default SlFinishEvent;
4 changes: 1 addition & 3 deletions src/events/sl-focus.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlFocusEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlFocusEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-focus': SlFocusEvent;
}
}

export default SlFocusEvent;
4 changes: 1 addition & 3 deletions src/events/sl-hide.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlHideEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlHideEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-hide': SlHideEvent;
}
}

export default SlHideEvent;
4 changes: 1 addition & 3 deletions src/events/sl-hover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type SlHoverEvent = CustomEvent<{
export type SlHoverEvent = CustomEvent<{
phase: 'start' | 'move' | 'end';
value: number;
}>;
Expand All @@ -8,5 +8,3 @@ declare global {
'sl-hover': SlHoverEvent;
}
}

export default SlHoverEvent;
4 changes: 1 addition & 3 deletions src/events/sl-initial-focus.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlInitialFocusEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlInitialFocusEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-initial-focus': SlInitialFocusEvent;
}
}

export default SlInitialFocusEvent;
4 changes: 1 addition & 3 deletions src/events/sl-input.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlInputEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlInputEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-input': SlInputEvent;
}
}

export default SlInputEvent;
4 changes: 1 addition & 3 deletions src/events/sl-invalid.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
type SlInvalidEvent = CustomEvent<Record<PropertyKey, never>>;
export type SlInvalidEvent = CustomEvent<Record<PropertyKey, never>>;

declare global {
interface GlobalEventHandlersEventMap {
'sl-invalid': SlInvalidEvent;
}
}

export default SlInvalidEvent;
Loading

0 comments on commit 43d1f9e

Please sign in to comment.