Merge pull request #150 from webzard-io/fix/ts-path

Support absolute path in runtime and editor
This commit is contained in:
yz-yu 2021-12-03 12:29:43 +08:00 committed by GitHub
commit 23d5bdfcad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 182 additions and 119 deletions

View File

@ -6,7 +6,8 @@
"preserveConstEnums": true,
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true
"skipLibCheck": true,
"jsx": "react-jsx"
},
"exclude": ["node_modules", "*.d.ts"]
"exclude": ["node_modules", "*.d.ts", "lib"]
}

View File

@ -10,8 +10,8 @@ import { GeneralTraitFormList } from './GeneralTraitFormList';
import { FetchTraitForm } from './FetchTraitForm';
import { Registry } from '@sunmao-ui/runtime/lib/services/registry';
import SchemaField from './JsonSchemaForm/SchemaField';
import { genOperation } from '../../operations';
import { editorStore } from '../../EditorStore';
import { genOperation } from 'operations';
import { editorStore } from 'EditorStore';
import { observer } from 'mobx-react-lite';
type Props = {

View File

@ -16,7 +16,7 @@ import { useFormik } from 'formik';
import { EventHandlerSchema, Registry } from '@sunmao-ui/runtime';
import { formWrapperCSS } from '../style';
import { KeyValueEditor } from '../../KeyValueEditor';
import { editorStore } from '../../../EditorStore';
import { editorStore } from 'EditorStore';
type Props = {
registry: Registry;
eventTypes: string[];

View File

@ -8,7 +8,7 @@ import { EventHandlerSchema } from '@sunmao-ui/runtime';
import { eventBus } from '../../../eventBus';
import { EventHandlerForm } from './EventHandlerForm';
import { Registry } from '@sunmao-ui/runtime/lib/services/registry';
import { genOperation } from '../../../operations';
import { genOperation } from 'operations';
type EventHandler = Static<typeof EventHandlerSchema>;

View File

@ -19,7 +19,7 @@ import { KeyValueEditor } from '../../KeyValueEditor';
import { EventHandlerForm } from '../EventTraitForm/EventHandlerForm';
import { eventBus } from '../../../eventBus';
import { Registry } from '@sunmao-ui/runtime/lib/services/registry';
import { genOperation } from '../../../operations';
import { genOperation } from 'operations';
type EventHandler = Static<typeof EventHandlerSchema>;

View File

@ -7,7 +7,7 @@ import { GeneralTraitForm } from './GeneralTraitForm';
import { eventBus } from '../../../eventBus';
import { ignoreTraitsList } from '../../../constants';
import { Registry } from '@sunmao-ui/runtime/lib/services/registry';
import { genOperation } from '../../../operations';
import { genOperation } from 'operations';
type Props = {
registry: Registry;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { FormControl, FormLabel, Input, VStack } from '@chakra-ui/react';
import { useFormik } from 'formik';
import { observer } from 'mobx-react-lite';
import { editorStore } from '../../../EditorStore';
import { editorStore } from 'EditorStore';
type AppMetaDataFormData = {
name: string;

View File

@ -4,7 +4,7 @@ import { Button, Text, VStack } from '@chakra-ui/react';
import { ArrowLeftIcon } from '@chakra-ui/icons';
import { AppMetaDataForm } from './AppMetaDataForm';
import { ModuleMetaDataForm } from './ModuleMetaDataForm';
import { registry } from '../../../setup';
import { registry } from 'setup';
type Props = {
formType: 'app' | 'module';

View File

@ -2,7 +2,7 @@ import React from 'react';
import { FormControl, FormLabel, Input, VStack } from '@chakra-ui/react';
import { useFormik } from 'formik';
import { observer } from 'mobx-react-lite';
import { editorStore } from '../../../EditorStore';
import { editorStore } from 'EditorStore';
import { KeyValueEditor } from '../../KeyValueEditor';
type ModuleMetaDataFormData = {

View File

@ -3,7 +3,7 @@ import React from 'react';
import { observer } from 'mobx-react-lite';
import { AddIcon, DeleteIcon, EditIcon } from '@chakra-ui/icons';
import { ImplementedRuntimeModule } from '@sunmao-ui/runtime';
import { editorStore } from '../../EditorStore';
import { editorStore } from 'EditorStore';
type ExplorerTreeProps = {
onEdit: (type: 'app' | 'module', version: string, name: string) => void;

View File

@ -6,7 +6,7 @@ import { eventBus } from '../../eventBus';
import { ComponentItemView } from './ComponentItemView';
import { DropComponentWrapper } from './DropComponentWrapper';
import { ChildrenMap } from './StructureTree';
import { genOperation } from '../../operations';
import { genOperation } from 'operations';
type Props = {
registry: Registry;

View File

@ -6,7 +6,7 @@ import { ComponentItemView } from './ComponentItemView';
import { ComponentTree } from './ComponentTree';
import { DropComponentWrapper } from './DropComponentWrapper';
import { Registry } from '@sunmao-ui/runtime/lib/services/registry';
import { genOperation as genOperation } from '../../operations';
import { genOperation as genOperation } from 'operations';
export type ChildrenMap = Map<string, SlotsMap>;
type SlotsMap = Map<string, ApplicationComponent[]>;

View File

@ -1,6 +1,6 @@
import { ApplicationComponent } from '@sunmao-ui/core';
import produce from 'immer';
import { tryOriginal } from '../../../operations/util';
import { tryOriginal } from 'operations/util';
import { BaseLeafOperation } from '../../type';
export type RemoveComponentLeafOperationContext = {

View File

@ -1,6 +1,6 @@
import { ApplicationComponent, ComponentTrait } from '@sunmao-ui/core';
import produce from 'immer';
import { tryOriginal } from '../../../operations/util';
import { tryOriginal } from 'operations/util';
import { BaseLeafOperation } from '../../type';
export type RemoveTraitLeafOperationContext = {

View File

@ -19,7 +19,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["@emotion/react/types/css-prop"],
"baseUrl": "./",
"baseUrl": "./src",
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"rootDir": "src"

View File

@ -2,11 +2,13 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { virtualExamplePlugin } from '@sunmao-ui/vite-plugins';
import { resolve } from 'path';
import tsconfigPaths from 'vite-tsconfig-paths'
// https://vitejs.dev/config/
export default defineConfig({
base: './',
plugins: [
tsconfigPaths(),
react({
babel: {
plugins: [

View File

@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import Text from '../../src/components/_internal/Text';
import React from 'react';
import Text from '../../src/components/_internal/Text';
describe('Text component', () => {
it('should render plain text', () => {

View File

@ -71,6 +71,7 @@
"jest": "^27.1.0",
"tsup": "^5.5.0",
"typescript": "^4.5.0",
"vite": "^2.6.13"
"vite": "^2.6.13",
"vite-tsconfig-paths": "^3.3.17"
}
}

View File

@ -5,7 +5,7 @@ import { useResizeDetector } from 'react-resize-detector';
import 'react-grid-layout/css/styles.css';
import 'react-resizable/css/styles.css';
import { DROP_EXAMPLE_SIZE_PREFIX, GRID_HEIGHT } from '../../constants';
import { decodeDragDataTransfer } from '../../utils/encodeDragDataTransfer';
import { decodeDragDataTransfer } from 'utils/encodeDragDataTransfer';
const GridLayout: React.FC<RGL.ReactGridLayoutProps> = props => {
const { children } = props;

View File

@ -3,13 +3,13 @@ import React, { useEffect, useMemo } from 'react';
import { get } from 'lodash-es';
import { useDeepCompareMemo } from 'use-deep-compare';
import { RuntimeApplication } from '@sunmao-ui/core';
import { UIServices, RuntimeModuleSchema } from '../../types/RuntimeSchema';
import { EventHandlerSchema } from '../../types/TraitPropertiesSchema';
import { resolveAppComponents } from '../../services/resolveAppComponents';
import { ImplWrapper } from '../../services/ImplWrapper';
import { watch } from '../../utils/watchReactivity';
import { parseTypeComponents } from '../../utils/parseType';
import { ImplementedRuntimeModule } from '../../services/registry';
import { UIServices, RuntimeModuleSchema } from 'types/RuntimeSchema';
import { EventHandlerSchema } from 'types/TraitPropertiesSchema';
import { resolveAppComponents } from 'services/resolveAppComponents';
import { ImplWrapper } from 'services/ImplWrapper';
import { watch } from 'utils/watchReactivity';
import { parseTypeComponents } from 'utils/parseType';
import { ImplementedRuntimeModule } from 'services/registry';
type Props = Static<typeof RuntimeModuleSchema> & {
evalScope?: Record<string, any>;

View File

@ -1,5 +1,5 @@
import React from 'react';
import { SlotsMap } from 'src/types/RuntimeSchema';
import { SlotsMap } from 'types/RuntimeSchema';
export function getSlots(slotsMap: SlotsMap | undefined, slot: string) {
return (slotsMap?.get(slot) || []).map(({ component: ImplWrapper, id }) => (

View File

@ -1,7 +1,7 @@
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Box as BaseBox } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import { pick } from 'lodash-es';
import { GRID_HEIGHT } from '../../constants';

View File

@ -4,7 +4,7 @@ import { css } from '@emotion/react';
import { Static, Type } from '@sinclair/typebox';
import { Button as BaseButton } from '@chakra-ui/react';
import Text, { TextPropertySchema } from '../_internal/Text';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { ColorSchemePropertySchema } from './Types/ColorScheme';
const Button: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Checkbox as BaseCheckbox, useCheckboxGroupContext } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Text, { TextPropertySchema } from '../_internal/Text';
import { ColorSchemePropertySchema } from './Types/ColorScheme';
import { css } from '@emotion/react';

View File

@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { CheckboxGroup as BaseCheckboxGroup } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import { SizePropertySchema, IsDisabledSchema } from './Checkbox';
import { css } from '@emotion/react';

View File

@ -1,6 +1,6 @@
import { useEffect, useState, useRef } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import {
AlertDialog,
AlertDialogBody,

View File

@ -1,7 +1,7 @@
import { Divider } from '@chakra-ui/react';
import { css } from '@emotion/react';
import { createComponent } from '@sunmao-ui/core';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
const DividerImpl: ComponentImplementation = ({customStyle}) => {
return <Divider css={css`${customStyle?.content}`} />;

View File

@ -3,8 +3,8 @@ import { css } from '@emotion/react';
import { Type, Static } from '@sinclair/typebox';
import { createComponent } from '@sunmao-ui/core';
import { Button, VStack } from '@chakra-ui/react';
import { watch } from '../../../utils/watchReactivity';
import { ComponentImplementation } from '../../../services/registry';
import { watch } from 'utils/watchReactivity';
import { ComponentImplementation } from 'services/registry';
import Slot from '../../_internal/Slot';
const FormImpl: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -11,8 +11,8 @@ import {
Text,
} from '@chakra-ui/react';
import { css } from '@emotion/react';
import { watch } from '../../../utils/watchReactivity';
import { ComponentImplementation } from '../../../services/registry';
import { watch } from 'utils/watchReactivity';
import { ComponentImplementation } from 'services/registry';
import Slot from '../../_internal/Slot';
import { CheckboxStateSchema } from '../Checkbox';

View File

@ -2,7 +2,7 @@ import { createComponent } from '@sunmao-ui/core';
import { css } from '@emotion/react';
import { Static, Type } from '@sinclair/typebox';
import { HStack as BaseHStack } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import {
DirectionSchema,

View File

@ -2,7 +2,7 @@ import { Image as BaseImage } from '@chakra-ui/react';
import { css } from '@emotion/react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
const BoxSizePropertySchema = Type.Optional(
Type.Union([

View File

@ -9,7 +9,7 @@ import {
} from '@chakra-ui/react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { css } from '@emotion/react';
const AppendElementPropertySchema = Type.Union([

View File

@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { Kbd as BaseKbd } from '@chakra-ui/react';
import { Static, Type } from '@sinclair/typebox';
import { createComponent } from '@sunmao-ui/core';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Text, { TextPropertySchema } from '../_internal/Text';
import { css } from '@emotion/react';

View File

@ -2,7 +2,7 @@ import { Link } from '@chakra-ui/react';
import { css } from '@emotion/react';
import { Static, Type } from '@sinclair/typebox';
import { createComponent } from '@sunmao-ui/core';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Text, { TextPropertySchema } from '../_internal/Text';
const LinkImpl: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -1,9 +1,9 @@
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { List as BaseList, ListItem as BaseListItem } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { LIST_ITEM_EXP, LIST_ITEM_INDEX_EXP } from '../../constants';
import { RuntimeModuleSchema } from '../../types/RuntimeSchema';
import { RuntimeModuleSchema } from 'types/RuntimeSchema';
import { ModuleRenderer } from '../_internal/ModuleRenderer';
import { css } from '@emotion/react';

View File

@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Select as BaseMultiSelect } from 'chakra-react-select';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { Box } from '@chakra-ui/react';
import { css } from '@emotion/react';

View File

@ -8,7 +8,7 @@ import {
} from '@chakra-ui/react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { css } from '@emotion/react';
const NumberInput: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -2,7 +2,7 @@ import { useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Radio as BaseRadio } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Text, { TextPropertySchema } from '../_internal/Text';
import { ColorSchemePropertySchema } from './Types/ColorScheme';
import { css } from '@emotion/react';

View File

@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { RadioGroup as BaseRadioGroup } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import { css } from '@emotion/react';

View File

@ -1,5 +1,5 @@
import { ChakraProvider, extendTheme } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { createComponent } from '@sunmao-ui/core';
import Slot from '../_internal/Slot';

View File

@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Select as BaseSelect } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { css } from '@emotion/react';
const StateSchema = Type.Object({

View File

@ -1,7 +1,7 @@
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Stack as BaseStack } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
export const DirectionSchema = Type.Union([

View File

@ -13,7 +13,7 @@ import {
} from '@chakra-ui/react';
import { Static } from '@sinclair/typebox';
import { TablePagination } from './Pagination';
import { ComponentImplementation } from '../../../services/registry';
import { ComponentImplementation } from 'services/registry';
import {
ColumnsPropertySchema,
DataPropertySchema,

View File

@ -3,7 +3,7 @@ import { Static } from '@sinclair/typebox';
import { ColumnSchema } from './TableTypes';
import { Button, Link, Td, Text } from '@chakra-ui/react';
import { LIST_ITEM_EXP, LIST_ITEM_INDEX_EXP } from '../../../constants';
import { UIServices } from 'src/types/RuntimeSchema';
import { UIServices } from 'types/RuntimeSchema';
import { ModuleRenderer } from '../../_internal/ModuleRenderer';
export const TableTd: React.FC<{

View File

@ -1,6 +1,6 @@
import { Type } from '@sinclair/typebox';
import { RuntimeModuleSchema } from '../../../types/RuntimeSchema';
import { EventHandlerSchema } from '../../../types/TraitPropertiesSchema';
import { RuntimeModuleSchema } from 'types/RuntimeSchema';
import { EventHandlerSchema } from 'types/TraitPropertiesSchema';
export const MajorKeyPropertySchema = Type.String();
export const RowsPerPagePropertySchema = Type.Number();

View File

@ -3,7 +3,7 @@ import { css } from '@emotion/react';
import { createComponent } from '@sunmao-ui/core';
import { Tabs as BaseTabs, TabList, Tab, TabPanels, TabPanel } from '@chakra-ui/react';
import { Type, Static } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { getSlots } from '../_internal/Slot';
const Tabs: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -2,7 +2,7 @@ import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { Tooltip } from '@chakra-ui/react';
import { TextPropertySchema } from '../_internal/Text';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import { ColorSchemePropertySchema } from './Types/ColorScheme';

View File

@ -2,7 +2,7 @@ import { createComponent } from '@sunmao-ui/core';
import { css } from '@emotion/react';
import { Static, Type } from '@sinclair/typebox';
import { VStack as BaseVStack } from '@chakra-ui/react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import Slot from '../_internal/Slot';
import {
DirectionSchema,

View File

@ -1,6 +1,6 @@
import { createComponent } from '@sunmao-ui/core';
import { useEffect } from 'react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
const Dummy: ComponentImplementation<Record<string, unknown>> = ({ effects }) => {
useEffect(() => {

View File

@ -1,5 +1,5 @@
import React, { Suspense } from 'react';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { createComponent } from '@sunmao-ui/core';
import { getSlots } from '../_internal/Slot';
import { Static, Type } from '@sinclair/typebox';

View File

@ -1,7 +1,7 @@
import { createComponent } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { RuntimeModuleSchema } from '../../types/RuntimeSchema';
import { ComponentImplementation } from 'services/registry';
import { RuntimeModuleSchema } from 'types/RuntimeSchema';
import { ModuleRenderer } from '../_internal/ModuleRenderer';
import { css } from '@emotion/react';

View File

@ -21,7 +21,7 @@ import {
RouterCtx,
useNavigate,
} from './hooks';
import { SlotsMap } from 'src/types/RuntimeSchema';
import { SlotsMap } from 'types/RuntimeSchema';
export type RouteLikeElement = PropsWithChildren<{
path?: string;

View File

@ -1,6 +1,6 @@
import { Static, Type } from '@sinclair/typebox';
import { createComponent } from '@sunmao-ui/core';
import { ComponentImplementation } from '../../../services/registry';
import { ComponentImplementation } from 'services/registry';
import { Switch } from './component';
const Router: ComponentImplementation<{

View File

@ -1,6 +1,6 @@
import { createComponent } from '@sunmao-ui/core';
import { Type, Static } from '@sinclair/typebox';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
import _Text, { TextPropertySchema } from '../_internal/Text';
const Text: ComponentImplementation<Static<typeof PropsSchema>> = ({

View File

@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react';
import { createComponent } from '@sunmao-ui/core';
import { Type, Static } from '@sinclair/typebox';
import Text, { TextPropertySchema } from '../_internal/Text';
import { ComponentImplementation } from '../../services/registry';
import { ComponentImplementation } from 'services/registry';
const Button: ComponentImplementation<Static<typeof PropsSchema>> = ({
text,

View File

@ -1,5 +1,5 @@
import { StateManager } from './services/stateStore';
import { genApp } from './App';
import { genApp } from 'App';
import { initRegistry } from './services/registry';
import { initApiService } from './services/apiService';
import { mountUtilMethods } from './services/util-methods';

View File

@ -6,38 +6,38 @@ import {
} from '@sunmao-ui/core';
// components
/* --- plain --- */
import PlainButton from '../components/plain/Button';
import CoreText from '../components/core/Text';
import CoreGridLayout from '../components/core/GridLayout';
import CoreRouter from '../components/core/Router';
import CoreDummy from '../components/core/Dummy';
import CoreModuleContainer from '../components/core/ModuleContainer';
import PlainButton from 'components/plain/Button';
import CoreText from 'components/core/Text';
import CoreGridLayout from 'components/core/GridLayout';
import CoreRouter from 'components/core/Router';
import CoreDummy from 'components/core/Dummy';
import CoreModuleContainer from 'components/core/ModuleContainer';
/* --- chakra-ui --- */
import ChakraUIRoot from '../components/chakra-ui/Root';
import ChakraUIButton from '../components/chakra-ui/Button';
import ChakraUITabs from '../components/chakra-ui/Tabs';
import ChakraUITable from '../components/chakra-ui/Table';
import ChakraUIInput from '../components/chakra-ui/Input';
import ChakraUIBox from '../components/chakra-ui/Box';
import ChakraUIDivider from '../components/chakra-ui/Divider';
import ChakraUIFormControl from '../components/chakra-ui/Form/FormControl';
import ChakraUIForm from '../components/chakra-ui/Form/Form';
import ChakraUIKbd from '../components/chakra-ui/Kbd';
import ChakraUIList from '../components/chakra-ui/List';
import ChakraUILink from '../components/chakra-ui/Link';
import ChakraUINumberInput from '../components/chakra-ui/NumberInput';
import ChakraUIMultiSelect from '../components/chakra-ui/MultiSelect';
import ChakraUICheckboxGroup from '../components/chakra-ui/CheckboxGroup';
import ChakraUICheckbox from '../components/chakra-ui/Checkbox';
import ChakraUIStack from '../components/chakra-ui/Stack';
import ChakraUITooltip from '../components/chakra-ui/Tooltip';
import ChakraUIHStack from '../components/chakra-ui/HStack';
import ChakraUIVStack from '../components/chakra-ui/VStack';
import ChakraUIImage from '../components/chakra-ui/Image';
import ChakraUIDialog from '../components/chakra-ui/Dialog';
import ChakraUISelect from '../components/chakra-ui/Select';
import ChakraUIRadioGroup from '../components/chakra-ui/RadioGroup';
import ChakraUIRadio from '../components/chakra-ui/Radio';
import ChakraUIRoot from 'components/chakra-ui/Root';
import ChakraUIButton from 'components/chakra-ui/Button';
import ChakraUITabs from 'components/chakra-ui/Tabs';
import ChakraUITable from 'components/chakra-ui/Table';
import ChakraUIInput from 'components/chakra-ui/Input';
import ChakraUIBox from 'components/chakra-ui/Box';
import ChakraUIDivider from 'components/chakra-ui/Divider';
import ChakraUIFormControl from 'components/chakra-ui/Form/FormControl';
import ChakraUIForm from 'components/chakra-ui/Form/Form';
import ChakraUIKbd from 'components/chakra-ui/Kbd';
import ChakraUIList from 'components/chakra-ui/List';
import ChakraUILink from 'components/chakra-ui/Link';
import ChakraUINumberInput from 'components/chakra-ui/NumberInput';
import ChakraUIMultiSelect from 'components/chakra-ui/MultiSelect';
import ChakraUICheckboxGroup from 'components/chakra-ui/CheckboxGroup';
import ChakraUICheckbox from 'components/chakra-ui/Checkbox';
import ChakraUIStack from 'components/chakra-ui/Stack';
import ChakraUITooltip from 'components/chakra-ui/Tooltip';
import ChakraUIHStack from 'components/chakra-ui/HStack';
import ChakraUIVStack from 'components/chakra-ui/VStack';
import ChakraUIImage from 'components/chakra-ui/Image';
import ChakraUIDialog from 'components/chakra-ui/Dialog';
import ChakraUISelect from 'components/chakra-ui/Select';
import ChakraUIRadioGroup from 'components/chakra-ui/RadioGroup';
import ChakraUIRadio from 'components/chakra-ui/Radio';
// traits
import CoreArrayState from '../traits/core/arrayState';
@ -51,7 +51,7 @@ import CoreValidation from '../traits/core/validation';
import {
ComponentImplementationProps,
TraitImplementation,
} from 'src/types/RuntimeSchema';
} from 'types/RuntimeSchema';
import { parseType } from '../utils/parseType';
import { parseModuleSchema } from '../utils/parseModuleSchema';
import { cloneDeep } from 'lodash';

View File

@ -6,7 +6,7 @@ import {
ComponentParamsFromApp,
UIServices,
SlotComponentMap,
} from 'src/types/RuntimeSchema';
} from 'types/RuntimeSchema';
import { ImplWrapper } from './ImplWrapper';
export function resolveAppComponents(

View File

@ -1,6 +1,6 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
const HasInitializedMap = new Map<string, boolean>();

View File

@ -1,8 +1,8 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { debounce, throttle, delay } from 'lodash-es';
import { CallbackMap, TraitImplementation } from 'src/types/RuntimeSchema';
import { EventHandlerSchema } from '../../types/TraitPropertiesSchema';
import { CallbackMap, TraitImplementation } from 'types/RuntimeSchema';
import { EventHandlerSchema } from 'types/TraitPropertiesSchema';
const useEventTrait: TraitImplementation<Static<typeof PropsSchema>> = ({
handlers,

View File

@ -1,7 +1,7 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { FetchTraitPropertiesSchema } from '../../types/TraitPropertiesSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
import { FetchTraitPropertiesSchema } from 'types/TraitPropertiesSchema';
const hasFetchedMap = new Map<string, boolean>();

View File

@ -1,6 +1,6 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
const useHiddenTrait: TraitImplementation<Static<typeof PropsSchema>> = ({
hidden,

View File

@ -1,6 +1,6 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
const HasInitializedMap = new Map<string, boolean>();

View File

@ -1,6 +1,6 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
const StyleTrait: TraitImplementation<Static<typeof PropsSchema>> = ({
styleSlot,

View File

@ -1,8 +1,8 @@
import { createTrait } from '@sunmao-ui/core';
import { Static, Type } from '@sinclair/typebox';
import { isEqual } from 'lodash-es';
import { TraitImplementation } from 'src/types/RuntimeSchema';
import { ValidResultSchema } from '../../types/ValidResultSchema';
import { TraitImplementation } from 'types/RuntimeSchema';
import { ValidResultSchema } from 'types/ValidResultSchema';
type ValidationResult = Static<typeof ValidResultSchema>;
type ValidationRule = (text: string) => ValidationResult;

View File

@ -1,8 +1,8 @@
import RGL from 'react-grid-layout';
import { ApiService } from 'src/services/apiService';
import { GlobalHandlerMap } from 'src/services/handler';
import { Registry } from 'src/services/registry';
import { StateManager } from 'src/services/stateStore';
import { ApiService } from 'services/apiService';
import { GlobalHandlerMap } from 'services/handler';
import { Registry } from 'services/registry';
import { StateManager } from 'services/stateStore';
import { Application, RuntimeApplication } from '@sunmao-ui/core';
import { EventHandlerSchema } from './TraitPropertiesSchema';
import { Type } from '@sinclair/typebox';

View File

@ -1,7 +1,7 @@
import { RuntimeApplication } from '@sunmao-ui/core';
import { Static, TSchema } from '@sinclair/typebox';
import { Registry } from 'src/services/registry';
import { StateManager } from 'src/services/stateStore';
import { Registry } from 'services/registry';
import { StateManager } from 'services/stateStore';
import { RuntimeModuleSchema } from '../types/RuntimeSchema';
import { parseTypeBox } from './parseTypeBox';

View File

@ -19,10 +19,10 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["@emotion/react/types/css-prop"],
"baseUrl": "./",
"baseUrl": "./src",
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"rootDir": "src"
},
"include": ["./src"]
"include": ["./src"],
}

View File

@ -1,10 +1,12 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { virtualExamplePlugin } from '@sunmao-ui/vite-plugins';
import tsconfigPaths from 'vite-tsconfig-paths'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
tsconfigPaths(),
react({
babel: {
plugins: [

View File

@ -1572,6 +1572,11 @@
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f"
integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ==
"@cush/relative@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@cush/relative/-/relative-1.0.0.tgz#8cd1769bf9bde3bb27dac356b1bc94af40f6cc16"
integrity sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==
"@emotion/babel-plugin@^11.3.0":
version "11.3.0"
resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.3.0.tgz#3a16850ba04d8d9651f07f3fb674b3436a4fb9d7"
@ -2972,6 +2977,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
"@types/lodash-es@^4.17.5":
version "4.17.5"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.5.tgz#1c3fdd16849d84aea43890b1c60da379fb501353"
@ -5256,6 +5266,11 @@ glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.2:
dependencies:
is-glob "^4.0.1"
glob-regex@^0.3.0:
version "0.3.2"
resolved "https://registry.yarnpkg.com/glob-regex/-/glob-regex-0.3.2.tgz#27348f2f60648ec32a4a53137090b9fb934f3425"
integrity sha512-m5blUd3/OqDTWwzBBtWBPrGlAzatRywHameHeekAZyZrskYouOGdNB8T/q6JucucvJXtOuyHIn0/Yia7iDasDw==
glob@7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
@ -5304,6 +5319,11 @@ globby@^11.0.2, globby@^11.0.3:
merge2 "^1.3.0"
slash "^3.0.0"
globrex@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==
graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4:
version "4.2.8"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
@ -6459,6 +6479,13 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
dependencies:
minimist "^1.2.0"
json5@^2.1.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
@ -8444,6 +8471,16 @@ readdirp@~3.6.0:
dependencies:
picomatch "^2.2.1"
recrawl-sync@^2.0.3:
version "2.2.1"
resolved "https://registry.yarnpkg.com/recrawl-sync/-/recrawl-sync-2.2.1.tgz#cb02c8084c22b3cea103abf46bb88734076ed6bb"
integrity sha512-A2yLDgeXNaduJJMlqyUdIN7fewopnNm/mVeeGytS1d2HLXKpS5EthQ0j8tWeX+as9UXiiwQRwfoslKC+/gjqxg==
dependencies:
"@cush/relative" "^1.0.0"
glob-regex "^0.3.0"
slash "^3.0.0"
tslib "^1.9.3"
redent@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f"
@ -9378,6 +9415,16 @@ ts-interface-checker@^0.1.9:
resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699"
integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==
tsconfig-paths@^3.9.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b"
integrity sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==
dependencies:
"@types/json5" "^0.0.29"
json5 "^1.0.1"
minimist "^1.2.0"
strip-bom "^3.0.0"
tslib@^1.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@ -9780,6 +9827,16 @@ vfile@^5.0.0:
unist-util-stringify-position "^3.0.0"
vfile-message "^3.0.0"
vite-tsconfig-paths@^3.3.17:
version "3.3.17"
resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-3.3.17.tgz#b1421c4a01e6b446b78cc1dd12d45f302bc3a27b"
integrity sha512-wx+rfC53moVLxMBj2EApJZgY6HtvWUFVZ4dBxNGYBxSSqU6UaHdKlcOxrfGDxyTGtYEr9beWCryHn18C4EtZkg==
dependencies:
debug "^4.1.1"
globrex "^0.1.2"
recrawl-sync "^2.0.3"
tsconfig-paths "^3.9.0"
vite@^2.6.13:
version "2.6.13"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.6.13.tgz#16b3ec85a66d5b461ac29a903874d4357f9af432"