Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit b363b4b

Browse files
feat(web-components): only import and create components when it's in the right environment
1 parent 02da3a3 commit b363b4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+432
-449
lines changed

src/components/comments/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Logger } from '../../common/utils';
55
import ApiService from '../../services/api';
66
import config from '../../services/config';
77
import subject from '../../services/stores/subject';
8-
import type { Comments as CommentElement } from '../../web-components';
8+
import type { Comments as CommentElement } from '../../web-components/comments';
99
import { CommentsFloatButton } from '../../web-components/comments/components/float-button';
1010
import { BaseComponent } from '../base';
1111
import { ComponentNames } from '../types';

src/components/who-is-online/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Participant, Avatar } from '../../common/types/participant.types';
55
import { StoreType } from '../../common/types/stores.types';
66
import { Logger } from '../../common/utils';
77
import { Following } from '../../services/stores/who-is-online/types';
8-
import { WhoIsOnline as WhoIsOnlineElement } from '../../web-components';
8+
import type { WhoIsOnline as WhoIsOnlineElement } from '../../web-components/who-is-online';
99
import { DropdownOption } from '../../web-components/dropdown/types';
1010
import { BaseComponent } from '../base';
1111
import { ComponentNames } from '../types';

src/web-components/comments/comments.test.ts

-114
This file was deleted.

src/web-components/comments/comments.ts

-164
This file was deleted.

src/web-components/comments/components/annotation-filter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MOCK_ANNOTATION } from '../../../../__mocks__/comments.mock';
22
import sleep from '../../../common/utils/sleep';
33

4-
import '.';
4+
import './annotation-filter';
55
import { AnnotationFilter } from './types';
66

77
let element: HTMLElement;

src/web-components/comments/components/annotation-filter.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CSSResultGroup, LitElement, PropertyValueMap, html } from 'lit';
2-
import { customElement } from 'lit/decorators.js';
32
import { classMap } from 'lit/directives/class-map.js';
43

54
import { WebComponentsBase } from '../../base';
@@ -8,6 +7,7 @@ import { DropdownOption } from '../../dropdown/types';
87
import { annotationFilterStyle } from '../css';
98

109
import { AnnotationFilter } from './types';
10+
import { CreateElement } from '../../global/decorators/create-element.decorator';
1111

1212
const WebComponentsBaseElement = WebComponentsBase(LitElement);
1313
const styles: CSSResultGroup[] = [WebComponentsBaseElement.styles, annotationFilterStyle];
@@ -21,7 +21,7 @@ const options: DropdownOption[] = [
2121
},
2222
];
2323

24-
@customElement('superviz-comments-annotation-filter')
24+
@CreateElement('superviz-comments-annotation-filter')
2525
export class CommentsAnnotationFilter extends WebComponentsBaseElement {
2626
constructor() {
2727
super();

src/web-components/comments/components/annotation-item.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MOCK_ANNOTATION } from '../../../../__mocks__/comments.mock';
22
import sleep from '../../../common/utils/sleep';
33

4-
import '.';
4+
import './annotation-item';
55
import { AnnotationFilter } from './types';
66

77
let element: HTMLElement;

src/web-components/comments/components/annotation-item.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CSSResultGroup, LitElement, PropertyValueMap, html } from 'lit';
2-
import { customElement } from 'lit/decorators.js';
2+
33
import { classMap } from 'lit/directives/class-map.js';
44

55
import { ParticipantByGroupApi } from '../../../common/types/participant.types';
@@ -9,11 +9,12 @@ import importStyle from '../../base/utils/importStyle';
99
import { annotationItemStyle } from '../css';
1010

1111
import { AnnotationFilter } from './types';
12+
import { CreateElement } from '../../global/decorators/create-element.decorator';
1213

1314
const WebComponentsBaseElement = WebComponentsBase(LitElement);
1415
const styles: CSSResultGroup[] = [WebComponentsBaseElement.styles, annotationItemStyle];
1516

16-
@customElement('superviz-comments-annotation-item')
17+
@CreateElement('superviz-comments-annotation-item')
1718
export class CommentsAnnotationItem extends WebComponentsBaseElement {
1819
static styles = styles;
1920

src/web-components/comments/components/annotation-pin.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useGlobalStore } from '../../../services/stores';
66
import type { CommentsAnnotationPin } from './annotation-pin';
77
import { PinMode } from './types';
88

9-
import '.';
9+
import './annotation-pin';
1010
import '../../icon';
1111

1212
interface CreateAnnotationPinOptions {

src/web-components/comments/components/annotation-pin.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CSSResultGroup, LitElement, PropertyValueMap, html } from 'lit';
2-
import { customElement } from 'lit/decorators.js';
2+
33
import { classMap } from 'lit/directives/class-map.js';
44

55
import { Participant, ParticipantByGroupApi } from '../../../common/types/participant.types';
@@ -10,11 +10,12 @@ import importStyle from '../../base/utils/importStyle';
1010
import { annotationPinStyles } from '../css';
1111

1212
import { PinMode, HorizontalSide, Sides } from './types';
13+
import { CreateElement } from '../../global/decorators/create-element.decorator';
1314

1415
const WebComponentsBaseElement = WebComponentsBase(LitElement);
1516
const styles: CSSResultGroup[] = [WebComponentsBaseElement.styles, annotationPinStyles];
1617

17-
@customElement('superviz-comments-annotation-pin')
18+
@CreateElement('superviz-comments-annotation-pin')
1819
export class CommentsAnnotationPin extends WebComponentsBaseElement {
1920
declare type: PinMode;
2021
declare active: boolean;

0 commit comments

Comments
 (0)