From 6e9e5c53ef85b1469b73aa450c70cdbf50666342 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Fri, 4 Nov 2022 17:57:21 -0400 Subject: [PATCH] Fix types build --- core/package.json | 4 +- .../MediaLibrary/MediaLibraryButtons.tsx | 60 +------------------ .../MediaLibrary/MediaLibraryTop.tsx | 41 ++++++++++++- core/src/components/UI/Icon.tsx | 2 +- .../components/UI/WidgetPreviewContainer.tsx | 13 +++- core/src/components/UI/index.ts | 1 - core/tsconfig.json | 4 +- 7 files changed, 59 insertions(+), 66 deletions(-) diff --git a/core/package.json b/core/package.json index a1ea21c2..cc264200 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/core", - "version": "1.0.0-alpha32", + "version": "1.0.0-alpha33", "license": "MIT", "description": "Static CMS core application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -13,7 +13,7 @@ "scripts": { "build:webpack": "webpack", "build:types": "tsc", - "build": "cross-env NODE_ENV=production run-s build:webpack build:types", + "build": "cross-env NODE_ENV=production run-s clean build:webpack build:types", "clean": "rimraf dist dev-test/dist", "develop": "webpack serve", "format:prettier": "prettier \"{{src,scripts,website}/**/,}*.{js,jsx,ts,tsx,css}\"", diff --git a/core/src/components/MediaLibrary/MediaLibraryButtons.tsx b/core/src/components/MediaLibrary/MediaLibraryButtons.tsx index 18c5a8cc..db9a8500 100644 --- a/core/src/components/MediaLibrary/MediaLibraryButtons.tsx +++ b/core/src/components/MediaLibrary/MediaLibraryButtons.tsx @@ -1,67 +1,11 @@ -import React, { useCallback, useEffect, useState } from 'react'; -import { css } from '@emotion/react'; -import { styled } from '@mui/material/styles'; -import copyToClipboard from 'copy-text-to-clipboard'; import Button from '@mui/material/Button'; +import copyToClipboard from 'copy-text-to-clipboard'; +import React, { useCallback, useEffect, useState } from 'react'; -import { buttons, shadows, zIndex } from '../../components/UI/styles'; import { isAbsolutePath } from '../../lib/util'; -import { FileUploadButton } from '../UI'; import type { TranslatedProps } from '../../interface'; -const styles = { - button: css` - ${buttons.button}; - ${buttons.default}; - display: inline-block; - margin-left: 15px; - margin-right: 2px; - - &[disabled] { - ${buttons.disabled}; - cursor: default; - } - `, -}; - -export const UploadButton = styled(FileUploadButton)` - ${styles.button}; - ${buttons.gray}; - ${shadows.dropMain}; - margin-bottom: 0; - - span { - font-size: 14px; - font-weight: 500; - display: flex; - justify-content: center; - align-items: center; - } - - input { - height: 0.1px; - width: 0.1px; - margin: 0; - padding: 0; - opacity: 0; - overflow: hidden; - position: absolute; - z-index: ${zIndex.zIndex0}; - outline: none; - } -`; - -export const DeleteButton = styled('button')` - ${styles.button}; - ${buttons.lightRed}; -`; - -export const InsertButton = styled('button')` - ${styles.button}; - ${buttons.green}; -`; - export interface CopyToClipBoardButtonProps { disabled: boolean; draft?: boolean; diff --git a/core/src/components/MediaLibrary/MediaLibraryTop.tsx b/core/src/components/MediaLibrary/MediaLibraryTop.tsx index f5312683..5130a4da 100644 --- a/core/src/components/MediaLibrary/MediaLibraryTop.tsx +++ b/core/src/components/MediaLibrary/MediaLibraryTop.tsx @@ -3,8 +3,10 @@ import Button from '@mui/material/Button'; import DialogTitle from '@mui/material/DialogTitle'; import React from 'react'; -import { CopyToClipBoardButton, UploadButton } from './MediaLibraryButtons'; +import { CopyToClipBoardButton } from './MediaLibraryButtons'; import MediaLibrarySearch from './MediaLibrarySearch'; +import { buttons, shadows, zIndex } from '../../components/UI/styles'; +import FileUploadButton from '../UI/FileUploadButton'; import type { ChangeEvent, ChangeEventHandler, KeyboardEventHandler } from 'react'; import type { MediaFile, TranslatedProps } from '../../interface'; @@ -27,6 +29,43 @@ const StyledDialogTitle = styled(DialogTitle)` align-items: center; `; +const UploadButton = styled(FileUploadButton)` + ${buttons.button}; + ${buttons.default}; + display: inline-block; + margin-left: 15px; + margin-right: 2px; + + &[disabled] { + ${buttons.disabled}; + cursor: default; + } + + ${buttons.gray}; + ${shadows.dropMain}; + margin-bottom: 0; + + span { + font-size: 14px; + font-weight: 500; + display: flex; + justify-content: center; + align-items: center; + } + + input { + height: 0.1px; + width: 0.1px; + margin: 0; + padding: 0; + opacity: 0; + overflow: hidden; + position: absolute; + z-index: ${zIndex.zIndex0}; + outline: none; + } +`; + export interface MediaLibraryTopProps { onClose: () => void; forImage?: boolean; diff --git a/core/src/components/UI/Icon.tsx b/core/src/components/UI/Icon.tsx index 4c8ff334..da5a390c 100644 --- a/core/src/components/UI/Icon.tsx +++ b/core/src/components/UI/Icon.tsx @@ -94,4 +94,4 @@ const Icon = ({ type, direction, width, height, size = 'medium', className }: Ic ); }; -export default styled(Icon)``; +export default Icon; diff --git a/core/src/components/UI/WidgetPreviewContainer.tsx b/core/src/components/UI/WidgetPreviewContainer.tsx index c3857522..9e3485a8 100644 --- a/core/src/components/UI/WidgetPreviewContainer.tsx +++ b/core/src/components/UI/WidgetPreviewContainer.tsx @@ -1,7 +1,18 @@ +import React from 'react'; import { styled } from '@mui/material/styles'; -const WidgetPreviewContainer = styled('div')` +import type { ReactNode } from 'react'; + +const StyledWidgetPreviewContainer = styled('div')` margin: 15px 2px; `; +interface WidgetPreviewContainerProps { + children?: ReactNode; +} + +const WidgetPreviewContainer = ({ children }: WidgetPreviewContainerProps) => { + return {children}; +}; + export default WidgetPreviewContainer; diff --git a/core/src/components/UI/index.ts b/core/src/components/UI/index.ts index ff23e204..b03847c0 100644 --- a/core/src/components/UI/index.ts +++ b/core/src/components/UI/index.ts @@ -1,3 +1,2 @@ export { default as ErrorBoundary } from './ErrorBoundary'; -export { default as FileUploadButton } from './FileUploadButton'; export { default as SettingsDropdown } from './SettingsDropdown'; diff --git a/core/tsconfig.json b/core/tsconfig.json index a66dcf26..3265c190 100644 --- a/core/tsconfig.json +++ b/core/tsconfig.json @@ -2,14 +2,14 @@ "compilerOptions": { "declaration": true, "declarationDir": "dist", - "emitDeclarationOnly": false, + "emitDeclarationOnly": true, "jsx": "react", "target": "esnext", "module": "esnext", "moduleResolution": "node", "esModuleInterop": true, "preserveSymlinks": true, - "noEmit": true, + "noEmit": false, "strict": true, "isolatedModules": true, "skipLibCheck": true,