Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify TS paths directly to avoid losing declarations when building #707

Merged
merged 6 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"sourceMap": true
"sourceMap": true,
"paths": {
"@livekit/components-core": ["../../packages/core/dist/index.d.ts"],
"@livekit/components-react": ["../../packages/react/dist/index.d.ts"],
"@livekit/components-styles": ["../../packages/styles/dist/types/general/index.css.d.ts"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
Expand Down
8 changes: 6 additions & 2 deletions packages/core/etc/components-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ export function isSourcesWithOptions(sources: SourcesArray): sources is TrackSou
// @public (undocumented)
export function isSourceWitOptions(source: SourcesArray[number]): source is TrackSourceWithOptions;

// @public (undocumented)
// Warning: (ae-internal-missing-underscore) The name "isTrackReference" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export function isTrackReference(trackReference: unknown): trackReference is TrackReference;

// @public
Expand Down Expand Up @@ -265,7 +267,9 @@ export function observeRoomEvents(room: Room, ...events: RoomEvent[]): Observabl
// @public (undocumented)
export function observeTrackEvents(track: TrackPublication, ...events: TrackEvent_2[]): Observable<TrackPublication>;

// @public (undocumented)
// Warning: (ae-internal-missing-underscore) The name "ParticipantClickEvent" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export interface ParticipantClickEvent {
// (undocumented)
participant: Participant;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { DataPacket_Kind } from 'livekit-client';
import { BehaviorSubject, Subject, scan, map, takeUntil } from 'rxjs';
import { DataTopic, sendMessage, setupDataMessageHandler } from '../observables/dataChannel';

/** @public */
export interface ChatMessage {
timestamp: number;
message: string;
}

/** @public */
export interface ReceivedChatMessage extends ChatMessage {
from?: Participant;
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/persistent-storage/user-choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createLocalStorageInterface } from './local-storage-helpers';
const USER_CHOICES_KEY = `${cssPrefix}-user-choices` as const;

/**
* @public
* Represents the user's choices for video and audio input devices,
* as well as their username.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/track-reference/track-reference.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
import type { Participant, Track, TrackPublication } from 'livekit-client';
// ## TrackReference Types

/** @public */
export type TrackReferencePlaceholder = {
participant: Participant;
publication?: never;
source: Track.Source;
};

/** @public */
export type TrackReference = {
participant: Participant;
publication: TrackPublication;
source: Track.Source;
};

/** @public */
export type TrackReferenceOrPlaceholder = TrackReference | TrackReferencePlaceholder;

// ### TrackReference Type Predicates
/** @internal */
export function isTrackReference(trackReference: unknown): trackReference is TrackReference {
if (typeof trackReference === 'undefined') {
return false;
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import type { Participant, Track, TrackPublication } from 'livekit-client';
import type { TrackReference, TrackReferenceOrPlaceholder } from './track-reference';

// ## PinState Type
/** @public */
export type PinState = TrackReferenceOrPlaceholder[];
export const PIN_DEFAULT_STATE: PinState = [];

// ## WidgetState Types
/** @public */
export type WidgetState = {
showChat: boolean;
unreadMessages: number;
Expand Down Expand Up @@ -34,6 +36,7 @@ export type TrackReferenceFilter = Parameters<TrackReferenceOrPlaceholder[]['fil
export type ParticipantFilter = Parameters<Participant[]['filter']>['0'];

// ## Other Types
/** @internal */
export interface ParticipantClickEvent {
participant: Participant;
track?: TrackPublication;
Expand Down
122 changes: 92 additions & 30 deletions packages/react/etc/components-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,31 @@
/// <reference types="react" />

import type { AudioCaptureOptions } from 'livekit-client';
import type { AudioSource } from '@livekit/components-core';
import { CaptureOptionsBySource } from '@livekit/components-core';
import { ChatMessage } from '@livekit/components-core';
import { ConnectionQuality } from 'livekit-client';
import { ConnectionState as ConnectionState_2 } from 'livekit-client';
import type { CreateLocalTracksOptions } from 'livekit-client';
import type { DataSendOptions } from '@livekit/components-core';
import type { GridLayoutDefinition } from '@livekit/components-core';
import { DataPacket_Kind } from 'livekit-client';
import { HTMLAttributes } from 'react';
import { isTrackReference } from '@livekit/components-core';
import type { LocalAudioTrack } from 'livekit-client';
import { LocalParticipant } from 'livekit-client';
import type { LocalTrack } from 'livekit-client';
import { LocalTrackPublication } from 'livekit-client';
import { LocalUserChoices } from '@livekit/components-core';
import type { LocalVideoTrack } from 'livekit-client';
import type { MediaDeviceFailure } from 'livekit-client';
import { MessageDecoder } from '@livekit/components-core';
import { MessageEncoder } from '@livekit/components-core';
import { Participant } from 'livekit-client';
import type { ParticipantClickEvent } from '@livekit/components-core';
import type { ParticipantEvent } from 'livekit-client';
import { ParticipantPermission } from 'livekit-client/dist/src/proto/livekit_models_pb';
import type { PinState } from '@livekit/components-core';
import * as React_2 from 'react';
import { ReceivedChatMessage } from '@livekit/components-core';
import type { ReceivedDataMessage } from '@livekit/components-core';
import { RemoteParticipant } from 'livekit-client';
import { Room } from 'livekit-client';
import type { RoomConnectOptions } from 'livekit-client';
import type { RoomEvent } from 'livekit-client';
import type { RoomOptions } from 'livekit-client';
import type { ScreenShareCaptureOptions } from 'livekit-client';
import { setLogLevel } from '@livekit/components-core';
import { SetMediaDeviceOptions } from '@livekit/components-core';
import type { SourcesArray } from '@livekit/components-core';
import type { ToggleSource } from '@livekit/components-core';
import { setLogLevel as setLogLevel_2 } from 'livekit-client';
import { Track } from 'livekit-client';
import type { TrackIdentifier } from '@livekit/components-core';
import { TrackPublication } from 'livekit-client';
import type { TrackReference } from '@livekit/components-core';
import { TrackReferenceOrPlaceholder } from '@livekit/components-core';
import type { TrackSourceWithOptions } from '@livekit/components-core';
import type { VideoCaptureOptions } from 'livekit-client';
import type { VideoSource } from '@livekit/components-core';
import type { WidgetState } from '@livekit/components-core';

// @public (undocumented)
export interface AllowAudioPlaybackProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
Expand Down Expand Up @@ -128,7 +107,13 @@ export interface ChatEntryProps extends React_2.HTMLAttributes<HTMLLIElement> {
messageFormatter?: MessageFormatter;
}

export { ChatMessage }
// @public (undocumented)
export interface ChatMessage {
// (undocumented)
message: string;
// (undocumented)
timestamp: number;
}

// @public (undocumented)
export interface ChatProps extends React_2.HTMLAttributes<HTMLDivElement> {
Expand Down Expand Up @@ -239,6 +224,8 @@ export interface FocusLayoutContainerProps extends React_2.HTMLAttributes<HTMLDi

// @public (undocumented)
export interface FocusLayoutProps extends React_2.HTMLAttributes<HTMLElement> {
// Warning: (ae-incompatible-release-tags) The symbol "onParticipantClick" is marked as @public, but its signature references "ParticipantClickEvent" which is marked as @internal
//
// (undocumented)
onParticipantClick?: (evt: ParticipantClickEvent) => void;
// @deprecated (undocumented)
Expand Down Expand Up @@ -273,7 +260,10 @@ export interface GridLayoutProps extends React_2.HTMLAttributes<HTMLDivElement>,
tracks: TrackReferenceOrPlaceholder[];
}

export { isTrackReference }
// Warning: (ae-internal-missing-underscore) The name "isTrackReference" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export function isTrackReference(trackReference: unknown): trackReference is TrackReference;

// @public (undocumented)
export const LayoutContext: React_2.Context<LayoutContextType | undefined>;
Expand Down Expand Up @@ -332,7 +322,16 @@ export interface LiveKitRoomProps extends Omit<React_2.HTMLAttributes<HTMLDivEle
// @internal (undocumented)
export const LKFeatureContext: React_2.Context<FeatureFlags | undefined>;

export { LocalUserChoices }
// @public
export type LocalUserChoices = {
videoEnabled: boolean;
audioEnabled: boolean;
videoDeviceId: string;
audioDeviceId: string;
username: string;
e2ee: boolean;
sharedPassphrase: string;
};

// @public
export function MediaDeviceMenu({ kind, initialSelection, onActiveDeviceChange, tracks, requestPermissions, ...props }: MediaDeviceMenuProps): React_2.JSX.Element;
Expand Down Expand Up @@ -371,16 +370,28 @@ export interface MediaDeviceSelectProps extends React_2.HTMLAttributes<HTMLUList
track?: LocalAudioTrack | LocalVideoTrack;
}

export { MessageDecoder }
// @public (undocumented)
export type MessageDecoder = (message: Uint8Array) => ReceivedChatMessage;

export { MessageEncoder }
// @public (undocumented)
export type MessageEncoder = (message: ChatMessage) => Uint8Array;

// @public (undocumented)
export type MessageFormatter = (message: string) => React_2.ReactNode;

// @public
export function ParticipantAudioTile({ participant, children, source, publication, disableSpeakingIndicator, onParticipantClick, ...htmlProps }: ParticipantTileProps): React_2.JSX.Element;

// Warning: (ae-internal-missing-underscore) The name "ParticipantClickEvent" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export interface ParticipantClickEvent {
// (undocumented)
participant: Participant;
// (undocumented)
track?: TrackPublication;
}

// @public (undocumented)
export const ParticipantContext: React_2.Context<Participant | undefined>;

Expand Down Expand Up @@ -412,6 +423,8 @@ export function ParticipantTile({ trackRef, participant, children, source, onPar
export interface ParticipantTileProps extends React_2.HTMLAttributes<HTMLDivElement> {
// (undocumented)
disableSpeakingIndicator?: boolean;
// Warning: (ae-incompatible-release-tags) The symbol "onParticipantClick" is marked as @public, but its signature references "ParticipantClickEvent" which is marked as @internal
//
// (undocumented)
onParticipantClick?: (event: ParticipantClickEvent) => void;
// @deprecated (undocumented)
Expand All @@ -423,6 +436,9 @@ export interface ParticipantTileProps extends React_2.HTMLAttributes<HTMLDivElem
trackRef?: TrackReferenceOrPlaceholder;
}

// @public (undocumented)
export type PinState = TrackReferenceOrPlaceholder[];

// @public
export function PreJoin({ defaults, onValidate, onSubmit, onError, debug, joinLabel, micLabel, camLabel, userLabel, showE2EEOptions, persistUserChoices, ...htmlProps }: PreJoinProps): React_2.JSX.Element;

Expand All @@ -448,7 +464,11 @@ export interface PreJoinProps extends Omit<React_2.HTMLAttributes<HTMLDivElement
userLabel?: string;
}

export { ReceivedChatMessage }
// @public (undocumented)
export interface ReceivedChatMessage extends ChatMessage {
// (undocumented)
from?: Participant;
}

// @public
export function RoomAudioRenderer({ volume, muted }: RoomAudioRendererProps): React_2.JSX.Element;
Expand All @@ -472,7 +492,11 @@ export interface RoomNameProps extends React_2.HTMLAttributes<HTMLSpanElement> {
childrenPosition?: 'before' | 'after';
}

export { setLogLevel }
// Warning: (ae-forgotten-export) The symbol "LogLevel" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "SetLogLevelOptions" needs to be exported by the entry point index.d.ts
//
// @public
export function setLogLevel(level: LogLevel, options?: SetLogLevelOptions): void;

// @public
export function StartAudio({ label, ...props }: AllowAudioPlaybackProps): React_2.JSX.Element;
Expand Down Expand Up @@ -510,11 +534,27 @@ export interface TrackMutedIndicatorProps extends React_2.HTMLAttributes<HTMLDiv
// @public
export const TrackRefContext: React_2.Context<TrackReferenceOrPlaceholder | undefined>;

// @public (undocumented)
export type TrackReference = {
participant: Participant;
publication: TrackPublication;
source: Track.Source;
};

// Warning: (ae-forgotten-export) The symbol "TrackReferencePlaceholder" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type TrackReferenceOrPlaceholder = TrackReference | TrackReferencePlaceholder;

// Warning: (ae-forgotten-export) The symbol "ToggleSource" needs to be exported by the entry point index.d.ts
//
// @public
export function TrackToggle<T extends ToggleSource>({ showIcon, ...props }: TrackToggleProps<T>): React_2.JSX.Element;

// @public (undocumented)
export interface TrackToggleProps<T extends ToggleSource> extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
// Warning: (ae-forgotten-export) The symbol "CaptureOptionsBySource" needs to be exported by the entry point index.d.ts
//
// (undocumented)
captureOptions?: CaptureOptionsBySource<T>;
// (undocumented)
Expand Down Expand Up @@ -580,6 +620,7 @@ export function useConnectionState(room?: Room): ConnectionState_2;
// @public (undocumented)
export function useCreateLayoutContext(): LayoutContextType;

// Warning: (ae-forgotten-export) The symbol "ReceivedDataMessage" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "UseDataChannelReturnType" needs to be exported by the entry point index.d.ts
//
// @public
Expand Down Expand Up @@ -735,6 +776,9 @@ export interface UseMediaDeviceSelectProps {
track?: LocalAudioTrack | LocalVideoTrack;
}

// Warning: (ae-forgotten-export) The symbol "VideoSource" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "AudioSource" needs to be exported by the entry point index.d.ts
//
// @public @deprecated (undocumented)
export function useMediaTrack(source: VideoSource | AudioSource, participant?: Participant, options?: UseMediaTrackOptions): {
publication: TrackPublication | undefined;
Expand Down Expand Up @@ -818,6 +862,8 @@ export interface UseParticipantTileProps<T extends HTMLElement> extends React_2.
disableSpeakingIndicator?: boolean;
// (undocumented)
htmlProps: React_2.HTMLAttributes<T>;
// Warning: (ae-incompatible-release-tags) The symbol "onParticipantClick" is marked as @public, but its signature references "ParticipantClickEvent" which is marked as @internal
//
// (undocumented)
onParticipantClick?: (event: ParticipantClickEvent) => void;
// @deprecated (undocumented)
Expand Down Expand Up @@ -946,6 +992,8 @@ export interface UseTokenOptions {
userInfo?: UserInfo;
}

// Warning: (ae-forgotten-export) The symbol "TrackIdentifier" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function useTrack(trackRef: TrackIdentifier, options?: UseTrackOptions): {
publication: TrackPublication | undefined;
Expand Down Expand Up @@ -992,9 +1040,13 @@ export interface UseTrackOptions {
// @public
export function useTrackRefContext(): TrackReferenceOrPlaceholder;

// Warning: (ae-forgotten-export) The symbol "SourcesArray" needs to be exported by the entry point index.d.ts
//
// @public
export function useTracks<T extends SourcesArray = Track.Source[]>(sources?: T, options?: UseTracksOptions): UseTracksHookReturnType<T>;

// Warning: (ae-forgotten-export) The symbol "TrackSourceWithOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type UseTracksHookReturnType<T> = T extends Track.Source[] ? TrackReference[] : T extends TrackSourceWithOptions[] ? TrackReferenceOrPlaceholder[] : never;

Expand Down Expand Up @@ -1051,6 +1103,8 @@ export interface VideoTrackProps extends React_2.VideoHTMLAttributes<HTMLVideoEl
name?: string;
// (undocumented)
onSubscriptionStatusChanged?: (subscribed: boolean) => void;
// Warning: (ae-incompatible-release-tags) The symbol "onTrackClick" is marked as @public, but its signature references "ParticipantClickEvent" which is marked as @internal
//
// (undocumented)
onTrackClick?: (evt: ParticipantClickEvent) => void;
// @deprecated (undocumented)
Expand All @@ -1062,10 +1116,18 @@ export interface VideoTrackProps extends React_2.VideoHTMLAttributes<HTMLVideoEl
trackRef?: TrackReference;
}

// @public (undocumented)
export type WidgetState = {
showChat: boolean;
unreadMessages: number;
};

// Warnings were encountered during analysis:
//
// src/context/layout-context.ts:10:3 - (ae-forgotten-export) The symbol "PinContextType" needs to be exported by the entry point index.d.ts
// src/context/layout-context.ts:11:3 - (ae-forgotten-export) The symbol "ChatContextType" needs to be exported by the entry point index.d.ts
// src/hooks/useGridLayout.ts:24:6 - (ae-forgotten-export) The symbol "GridLayoutDefinition" needs to be exported by the entry point index.d.ts
// src/hooks/useMediaDeviceSelect.ts:40:29 - (ae-forgotten-export) The symbol "SetMediaDeviceOptions" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
Loading