Skip to content

Commit

Permalink
tsc & rollup have same compilation characteristics
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglass committed Mar 4, 2024
1 parent 560b128 commit 57876fa
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 23 deletions.
19 changes: 12 additions & 7 deletions packages/chat-widget/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ import { createRoot } from "react-dom/client";
import { ThemeProvider } from "@emotion/react";
import { useChat, type ChatHook } from "@nlxai/chat-react";
import { type Response, type ConversationHandler } from "@nlxai/chat-core";
import { CloseIcon, ChatIcon, AirplaneIcon, ErrorOutlineIcon } from "./icons";
import * as constants from "./ui/constants";
import {
CloseIcon,
ChatIcon,
AirplaneIcon,
ErrorOutlineIcon,
} from "./icons.js";
import * as constants from "./ui/constants.js";
import {
type Props,
type StorageType,
type CustomModalityComponent,
} from "./props";
import * as C from "./ui/components";
} from "./props.js";
import * as C from "./ui/components.js";

export { default as React } from "react";
export { default as ReactDOM } from "react-dom";
Expand All @@ -33,9 +38,9 @@ export {
type Props,
type TitleBar,
type CustomModalityComponent,
} from "./props";
export { type Theme } from "./theme";
export { defaultTheme } from "./ui/constants";
} from "./props.js";
export { type Theme } from "./theme.js";
export { defaultTheme } from "./ui/constants.js";

export interface WidgetInstance {
teardown: () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/chat-widget/src/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type FC } from "react";
import { type Config, type ConversationHandler } from "@nlxai/chat-core";
import { type Theme } from "./theme";
import { type Theme } from "./theme.js";

export interface TitleBar {
logo?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/chat-widget/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Theme as ThemeType } from "./theme";
import { type Theme as ThemeType } from "./theme.js";
import "@emotion/react";

declare module "@emotion/react" {
Expand Down
4 changes: 2 additions & 2 deletions packages/chat-widget/src/ui/components.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import styled from "@emotion/styled";
import { keyframes } from "@emotion/react";
import { Theme } from "../theme";
import * as constants from "./constants";
import { Theme } from "../theme.js";
import * as constants from "./constants.js";
import tinycolor from "tinycolor2";

// Mixins
Expand Down
2 changes: 1 addition & 1 deletion packages/chat-widget/src/ui/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Theme } from "../theme";
import { Theme } from "../theme.js";

export const bottomHeight = 60;

Expand Down
4 changes: 2 additions & 2 deletions packages/website/src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadIcon } from "./Icons";
import { DownloadIcon } from "./icons.js";
import React, { type FC, useRef, useEffect } from "react";

const escapeForHighlightJs = (str: string) =>
Expand All @@ -22,7 +22,7 @@ export const CodeEditor: FC<{ code: string }> = (props) => {
href={window.URL.createObjectURL(
new Blob([props.code], {
type: "text/plain",
})
}),
)}
download={`index.html`}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/components/PageContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { type FC, type ReactNode, useState } from "react";
import Markdown from "react-markdown";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { CheckIcon, ContentCopyIcon } from "./Icons";
import { CheckIcon, ContentCopyIcon } from "./icons.js";

const CopyToClipboardButton: FC<{ text: string; className?: string }> = ({
text,
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/content/01-01-getting-started.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { PageTitle } from "../components/PageTitle";
import { PageContent } from "../components/PageContent";
import { packageUrls } from "../constants";
import { packageUrls } from "../constants.js";

export const content = `
This is the official JavaScript SDK to communicate with conversational bots created using NLX Dialog Studio. It contains the following packages:
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/content/01-02-installation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { PageTitle } from "../components/PageTitle";
import { PageContent } from "../components/PageContent";
import { umdScriptTags, packageUrls } from "../constants";
import { umdScriptTags, packageUrls } from "../constants.js";

export const content = `
SDK packages can be installed as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { PageTitle } from "../components/PageTitle";
import { PageContent } from "../components/PageContent";
import { Note } from "../components/Note";
import { packageUrls } from "../constants";
import { packageUrls } from "../constants.js";

export const content = `
If you are using a different frontend framework, you can easily integrate the [@nlxai/chat-core](${packageUrls.chatCore}) package covered in the next chapter to build a custom widget. In fact, the [React](${packageUrls.chatReact}) and [Preact](${packageUrls.chatReact}) packages are both under 100 lines of TypeScript.
Expand Down
10 changes: 5 additions & 5 deletions packages/website/src/snippets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Config } from "@nlxai/chat-core";
import { type TitleBar, type Theme } from "@nlxai/chat-widget";
import { umdScriptTags } from "./constants";
import { umdScriptTags } from "./constants.js";
import { type Config as MMConfig } from "./components/MultimodalConfiguration";

export enum Behavior {
Expand Down Expand Up @@ -211,8 +211,8 @@ const CustomWidget = () => {
}
})}
{chat.waiting && <div>...</div>}
<input
value={chat.inputValue}
<input
value={chat.inputValue}
onInput={(event) => {
chat.setInputValue(event.target.value);
}}
Expand Down Expand Up @@ -429,7 +429,7 @@ export const fileUploadSnippet = `const FileUpload = ({ onUploadComplete }) => {
<input type="file" id="file-upload" hidden onChange=\${handleFileChange} />
<div className="file-input-custom">
<div className="file-input-custom-icon">
\${uploadProgress > 0 ?
\${uploadProgress > 0 ?
'<CircularProgressBar progress=' + uploadProgress + ' size=25 strokeWidth=2 />' :
'<img src=' + uploadIcon + ' alt="upload" className="file-input-button-icon" />'}
</div>
Expand Down Expand Up @@ -529,7 +529,7 @@ export const addressInputSnippet = `const AddressInput = ({ onAddressChange, add
rows={5}
className="address-textarea"
/>
\${coordinates ?
\${coordinates ?
'<Map className="map-container" lat=' + coordinates.lat + ' lng=' + coordinates.lng + ' />' :
'<div className="map-placeholder"></div>'
}
Expand Down

0 comments on commit 57876fa

Please sign in to comment.