From d8fe6a09f4b7637a3af65bc6754feb7e5e6d956c Mon Sep 17 00:00:00 2001 From: Anton Malofeev Date: Mon, 1 Mar 2021 19:11:50 +0300 Subject: [PATCH 01/10] feat: vite wip: vite build bug: .vue declarations --- .browserslistrc | 3 - .eslintrc.js | 17 +- .gitignore | 1 - .prettierrc | 4 +- .vscode/settings.json | 4 + CHANGELOG.md | 5 + README.md | 42 +++- babel.config.js | 3 - cypress.json | 3 - example/index.html | 13 ++ {src/example => example/src}/App.tsx | 23 +-- {src/example => example/src}/AppProvider.tsx | 5 +- {src/example => example/src}/HeroButton.tsx | 7 +- {src/example => example/src}/HeroesModel.ts | 4 +- {src => example/src}/main.ts | 6 +- jest.config.js | 10 - {src => lib}/abstract/Alignment.ts | 0 {src => lib}/abstract/Axis.ts | 0 {src => lib}/abstract/BasicTypes.ts | 0 {src => lib}/abstract/Border.ts | 0 {src => lib}/abstract/BorderRadius.ts | 0 {src => lib}/abstract/BorderSide.ts | 0 {src => lib}/abstract/BoxBorder.ts | 0 {src => lib}/abstract/BoxConstraints.ts | 0 {src => lib}/abstract/BoxDecoration.ts | 0 {src => lib}/abstract/BoxFit.ts | 0 {src => lib}/abstract/BoxShadow.ts | 0 {src => lib}/abstract/BoxShape.ts | 0 {src => lib}/abstract/ButtonStyle.ts | 0 {src => lib}/abstract/Color.ts | 0 {src => lib}/abstract/ColorNames.ts | 0 {src => lib}/abstract/Colors.ts | 0 {src => lib}/abstract/CrossAxisAlignment.ts | 0 {src => lib}/abstract/DividerDecoration.ts | 0 {src => lib}/abstract/DividerThickness.ts | 0 .../abstract/DropdownFieldController.ts | 0 {src => lib}/abstract/DropdownMenuItem.ts | 0 {src => lib}/abstract/EdgeInsets.ts | 0 {src => lib}/abstract/FontSize.ts | 0 {src => lib}/abstract/FontWeight.ts | 0 {src => lib}/abstract/Gradient.ts | 0 {src => lib}/abstract/Grid.ts | 0 {src => lib}/abstract/InputDecoration.ts | 0 {src => lib}/abstract/ItemBuilder.ts | 0 {src => lib}/abstract/Key.ts | 0 {src => lib}/abstract/ListTile.ts | 0 {src => lib}/abstract/MainAxisAlignment.ts | 0 {src => lib}/abstract/MainAxisSize.ts | 0 {src => lib}/abstract/MouseCursor.ts | 0 {src => lib}/abstract/Navigation.ts | 0 {src => lib}/abstract/OpacityDecoration.ts | 0 {src => lib}/abstract/PackageTypes.d.ts | 0 {src => lib}/abstract/SizedBox.ts | 0 {src => lib}/abstract/TextAlign.ts | 0 {src => lib}/abstract/TextDecoration.ts | 0 {src => lib}/abstract/TextDecorationStyle.ts | 0 .../abstract/TextEditingController.ts | 0 {src => lib}/abstract/TextInputType.ts | 0 {src => lib}/abstract/TextOverflow.ts | 0 {src => lib}/abstract/TextStyle.ts | 0 {src => lib}/abstract/VerticalDirection.ts | 0 {src => lib}/abstract/index.ts | 0 {src => lib}/components/Align.tsx | 0 {src => lib}/components/ButtonStyleButton.tsx | 0 {src => lib}/components/Center.tsx | 0 {src => lib}/components/Checkbox.tsx | 0 {src => lib}/components/CheckboxListTile.tsx | 0 {src => lib}/components/ColoredBox.tsx | 0 {src => lib}/components/Column.tsx | 0 {src => lib}/components/ConstrainedBox.tsx | 0 {src => lib}/components/Container.tsx | 0 {src => lib}/components/Dialog.tsx | 0 {src => lib}/components/Divider.tsx | 0 {src => lib}/components/DropdownButton.tsx | 5 +- {src => lib}/components/DropdownMenuItem.tsx | 0 {src => lib}/components/ElevatedButton.tsx | 0 {src => lib}/components/FittedBox.tsx | 0 {src => lib}/components/Flex.tsx | 0 {src => lib}/components/GestureDetector.tsx | 0 {src => lib}/components/GridView.tsx | 0 lib/components/GridViewBuilder.vue | 189 ++++++++++++++++++ {src => lib}/components/GridViewItem.tsx | 0 .../components/GridViewItemBuilder.tsx | 0 {src => lib}/components/GridViewStyle.scss | 0 {src => lib}/components/Icon.tsx | 0 {src => lib}/components/InkWell.tsx | 0 {src => lib}/components/ListTile.tsx | 0 {src => lib}/components/ListView.tsx | 0 lib/components/ListViewBuilder.vue | 67 +++++++ {src => lib}/components/ListViewItem.tsx | 0 {src => lib}/components/Margin.tsx | 0 {src => lib}/components/Material.tsx | 0 {src => lib}/components/MouseRegion.tsx | 0 .../components/MultiDropdownButton.tsx | 7 +- {src => lib}/components/Navigation.tsx | 0 {src => lib}/components/Opacity.tsx | 0 {src => lib}/components/Padding.tsx | 0 {src => lib}/components/Positioned.tsx | 0 {src => lib}/components/Provider.tsx | 0 {src => lib}/components/Row.tsx | 0 {src => lib}/components/Scaffold.tsx | 0 {src => lib}/components/SizedBox.tsx | 0 {src => lib}/components/Stack.tsx | 0 {src => lib}/components/Text.tsx | 0 {src => lib}/components/TextButton.tsx | 0 {src => lib}/components/TextField.tsx | 0 {src => lib}/components/VerticalDivider.tsx | 0 {src => lib}/components/Visibility.tsx | 0 lib/components/VueTeleport.vue | 16 ++ {src => lib}/components/Wrap.tsx | 0 {src => lib}/components/index.scss | 0 {src => lib}/components/index.ts | 0 {src => lib}/directives/VClickOutside.ts | 0 {src => lib}/functions/createMap.ts | 12 +- {src => lib}/functions/deepCopyObj.ts | 0 {src => lib}/functions/findUnshiftSplice.ts | 7 +- .../getChangesFromOldAndNewArrays.spec.ts | 0 .../getChangesFromOldAndNewArrays.ts | 2 +- {src => lib}/functions/index.ts | 0 {src => lib}/functions/isNotNull.ts | 0 {src => lib}/functions/reduceHtmlClasses.ts | 0 {src => lib}/functions/unifyValue.ts | 0 lib/index.d.ts | 3 + lib/index.scss | 1 + {src => lib}/index.ts | 1 + lib/shims-vue.d.ts | 10 + {src => lib}/tailwind.css | 0 lib/types.d.ts | 2 + {src => lib}/utils.ts | 0 package.json | 106 +++++----- packagelint.md | 11 + public/index.html | 21 -- public/robots.txt | 2 - src/abstract/Wrap.ts | 0 src/components/AppBar.tsx | 0 src/components/Card.tsx | 0 src/components/Drawer.tsx | 0 src/components/Flexible.tsx | 0 src/components/GridViewBuilder.vue | 189 ------------------ src/components/ListViewBuilder.vue | 67 ------- src/components/VueTeleport.vue | 16 -- src/index.d.ts | 1 - src/shims-vue.d.ts | 8 - tailwind.config.js | 2 +- tests/e2e/.eslintrc.js | 10 - tests/e2e/plugins/index.js | 25 --- tests/e2e/specs/test.js | 8 - tests/e2e/support/commands.js | 25 --- tests/e2e/support/index.js | 20 -- tests/unit/example.spec.ts | 12 -- tsconfig.json | 37 ++-- vite.config.ts | 51 +++++ vue.config.js | 30 --- 153 files changed, 534 insertions(+), 579 deletions(-) delete mode 100644 .browserslistrc create mode 100644 .vscode/settings.json delete mode 100644 babel.config.js delete mode 100644 cypress.json create mode 100644 example/index.html rename {src/example => example/src}/App.tsx (98%) rename {src/example => example/src}/AppProvider.tsx (68%) rename {src/example => example/src}/HeroButton.tsx (91%) rename {src/example => example/src}/HeroesModel.ts (76%) rename {src => example/src}/main.ts (64%) delete mode 100644 jest.config.js rename {src => lib}/abstract/Alignment.ts (100%) rename {src => lib}/abstract/Axis.ts (100%) rename {src => lib}/abstract/BasicTypes.ts (100%) rename {src => lib}/abstract/Border.ts (100%) rename {src => lib}/abstract/BorderRadius.ts (100%) rename {src => lib}/abstract/BorderSide.ts (100%) rename {src => lib}/abstract/BoxBorder.ts (100%) rename {src => lib}/abstract/BoxConstraints.ts (100%) rename {src => lib}/abstract/BoxDecoration.ts (100%) rename {src => lib}/abstract/BoxFit.ts (100%) rename {src => lib}/abstract/BoxShadow.ts (100%) rename {src => lib}/abstract/BoxShape.ts (100%) rename {src => lib}/abstract/ButtonStyle.ts (100%) rename {src => lib}/abstract/Color.ts (100%) rename {src => lib}/abstract/ColorNames.ts (100%) rename {src => lib}/abstract/Colors.ts (100%) rename {src => lib}/abstract/CrossAxisAlignment.ts (100%) rename {src => lib}/abstract/DividerDecoration.ts (100%) rename {src => lib}/abstract/DividerThickness.ts (100%) rename {src => lib}/abstract/DropdownFieldController.ts (100%) rename {src => lib}/abstract/DropdownMenuItem.ts (100%) rename {src => lib}/abstract/EdgeInsets.ts (100%) rename {src => lib}/abstract/FontSize.ts (100%) rename {src => lib}/abstract/FontWeight.ts (100%) rename {src => lib}/abstract/Gradient.ts (100%) rename {src => lib}/abstract/Grid.ts (100%) rename {src => lib}/abstract/InputDecoration.ts (100%) rename {src => lib}/abstract/ItemBuilder.ts (100%) rename {src => lib}/abstract/Key.ts (100%) rename {src => lib}/abstract/ListTile.ts (100%) rename {src => lib}/abstract/MainAxisAlignment.ts (100%) rename {src => lib}/abstract/MainAxisSize.ts (100%) rename {src => lib}/abstract/MouseCursor.ts (100%) rename {src => lib}/abstract/Navigation.ts (100%) rename {src => lib}/abstract/OpacityDecoration.ts (100%) rename {src => lib}/abstract/PackageTypes.d.ts (100%) rename {src => lib}/abstract/SizedBox.ts (100%) rename {src => lib}/abstract/TextAlign.ts (100%) rename {src => lib}/abstract/TextDecoration.ts (100%) rename {src => lib}/abstract/TextDecorationStyle.ts (100%) rename {src => lib}/abstract/TextEditingController.ts (100%) rename {src => lib}/abstract/TextInputType.ts (100%) rename {src => lib}/abstract/TextOverflow.ts (100%) rename {src => lib}/abstract/TextStyle.ts (100%) rename {src => lib}/abstract/VerticalDirection.ts (100%) rename {src => lib}/abstract/index.ts (100%) rename {src => lib}/components/Align.tsx (100%) rename {src => lib}/components/ButtonStyleButton.tsx (100%) rename {src => lib}/components/Center.tsx (100%) rename {src => lib}/components/Checkbox.tsx (100%) rename {src => lib}/components/CheckboxListTile.tsx (100%) rename {src => lib}/components/ColoredBox.tsx (100%) rename {src => lib}/components/Column.tsx (100%) rename {src => lib}/components/ConstrainedBox.tsx (100%) rename {src => lib}/components/Container.tsx (100%) rename {src => lib}/components/Dialog.tsx (100%) rename {src => lib}/components/Divider.tsx (100%) rename {src => lib}/components/DropdownButton.tsx (97%) rename {src => lib}/components/DropdownMenuItem.tsx (100%) rename {src => lib}/components/ElevatedButton.tsx (100%) rename {src => lib}/components/FittedBox.tsx (100%) rename {src => lib}/components/Flex.tsx (100%) rename {src => lib}/components/GestureDetector.tsx (100%) rename {src => lib}/components/GridView.tsx (100%) create mode 100644 lib/components/GridViewBuilder.vue rename {src => lib}/components/GridViewItem.tsx (100%) rename {src => lib}/components/GridViewItemBuilder.tsx (100%) rename {src => lib}/components/GridViewStyle.scss (100%) rename {src => lib}/components/Icon.tsx (100%) rename {src => lib}/components/InkWell.tsx (100%) rename {src => lib}/components/ListTile.tsx (100%) rename {src => lib}/components/ListView.tsx (100%) create mode 100644 lib/components/ListViewBuilder.vue rename {src => lib}/components/ListViewItem.tsx (100%) rename {src => lib}/components/Margin.tsx (100%) rename {src => lib}/components/Material.tsx (100%) rename {src => lib}/components/MouseRegion.tsx (100%) rename {src => lib}/components/MultiDropdownButton.tsx (98%) rename {src => lib}/components/Navigation.tsx (100%) rename {src => lib}/components/Opacity.tsx (100%) rename {src => lib}/components/Padding.tsx (100%) rename {src => lib}/components/Positioned.tsx (100%) rename {src => lib}/components/Provider.tsx (100%) rename {src => lib}/components/Row.tsx (100%) rename {src => lib}/components/Scaffold.tsx (100%) rename {src => lib}/components/SizedBox.tsx (100%) rename {src => lib}/components/Stack.tsx (100%) rename {src => lib}/components/Text.tsx (100%) rename {src => lib}/components/TextButton.tsx (100%) rename {src => lib}/components/TextField.tsx (100%) rename {src => lib}/components/VerticalDivider.tsx (100%) rename {src => lib}/components/Visibility.tsx (100%) create mode 100644 lib/components/VueTeleport.vue rename {src => lib}/components/Wrap.tsx (100%) rename {src => lib}/components/index.scss (100%) rename {src => lib}/components/index.ts (100%) rename {src => lib}/directives/VClickOutside.ts (100%) rename {src => lib}/functions/createMap.ts (66%) rename {src => lib}/functions/deepCopyObj.ts (100%) rename {src => lib}/functions/findUnshiftSplice.ts (96%) rename {src => lib}/functions/getChangesFromOldAndNewArrays.spec.ts (100%) rename {src => lib}/functions/getChangesFromOldAndNewArrays.ts (98%) rename {src => lib}/functions/index.ts (100%) rename {src => lib}/functions/isNotNull.ts (100%) rename {src => lib}/functions/reduceHtmlClasses.ts (100%) rename {src => lib}/functions/unifyValue.ts (100%) create mode 100644 lib/index.d.ts create mode 100644 lib/index.scss rename {src => lib}/index.ts (90%) create mode 100644 lib/shims-vue.d.ts rename {src => lib}/tailwind.css (100%) create mode 100644 lib/types.d.ts rename {src => lib}/utils.ts (100%) create mode 100644 packagelint.md delete mode 100644 public/index.html delete mode 100644 public/robots.txt delete mode 100644 src/abstract/Wrap.ts delete mode 100644 src/components/AppBar.tsx delete mode 100644 src/components/Card.tsx delete mode 100644 src/components/Drawer.tsx delete mode 100644 src/components/Flexible.tsx delete mode 100644 src/components/GridViewBuilder.vue delete mode 100644 src/components/ListViewBuilder.vue delete mode 100644 src/components/VueTeleport.vue delete mode 100644 src/index.d.ts delete mode 100644 src/shims-vue.d.ts delete mode 100644 tests/e2e/.eslintrc.js delete mode 100644 tests/e2e/plugins/index.js delete mode 100644 tests/e2e/specs/test.js delete mode 100644 tests/e2e/support/commands.js delete mode 100644 tests/e2e/support/index.js delete mode 100644 tests/unit/example.spec.ts create mode 100644 vite.config.ts delete mode 100644 vue.config.js diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 214388f..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,3 +0,0 @@ -> 1% -last 2 versions -not dead diff --git a/.eslintrc.js b/.eslintrc.js index 1d9cd29..bee0f5b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,18 +1,22 @@ module.exports = { root: true, env: { + browser: true, + es2021: true, node: true, }, extends: [ - 'plugin:vue/vue3-essential', + 'plugin:vue/vue3-recommended', 'eslint:recommended', '@vue/typescript/recommended', + // 他のルールの下に追加 '@vue/prettier', '@vue/prettier/@typescript-eslint', ], parserOptions: { ecmaVersion: 2021, }, + plugins: [], rules: { 'no-case-declarations': 'off', 'no-fallthrough': 'off', @@ -20,15 +24,4 @@ module.exports = { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', }, - overrides: [ - { - files: [ - '**/__tests__/*.{j,t}s?(x)', - '**/tests/unit/**/*.spec.{j,t}s?(x)', - ], - env: { - mocha: true, - }, - }, - ], } diff --git a/.gitignore b/.gitignore index aa5a6c8..0b9a054 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ pnpm-debug.log* # Editor directories and files .idea -.vscode *.suo *.ntvs* *.njsproj diff --git a/.prettierrc b/.prettierrc index 84445fd..91560c4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,8 +1,8 @@ { - "trailingComma": "es5", "tabWidth": 2, "semi": false, "singleQuote": true, "printWidth": 80, - "bracketSpacing": true + "bracketSpacing": true, + "vueIndentScriptAndStyle": true } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1b6457c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 71cb8c6..6c1bfd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.8.0 + +BREAKING CHANGE: Now package name vuefer +BREAKING CHANGE: Webpack replaced with Vite + ## 0.7.0 ### feat: MultiDropdownButton diff --git a/README.md b/README.md index b0dec5d..7428db7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# Vue3 styled like Flutter with Tailwind CSS +# vuefer = Vue3 styled like Flutter with Tailwind CSS and AndDesign -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/xsoulspace/vft) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/xsoulspace/vuefer) + +**Please notice: this project was renamed from vuefer to independent name: vuefer** **Please notice: this project is a work in progress and completely experimental!** -The reason & motivation why this project have been started is a question: Flutter & Dart awesome! Vue3 & Typescript & Tailwind awesome too! +The reason & motivation why this project have been started is a question: Flutter & Dart awesome! Vue3 & Typescript awesome too! But... @@ -12,6 +14,8 @@ Flutter is not working inside Excel:( and its kind of complicated to work with w So, what if we will write Vue3 TS in style of Flutter, because it's just simplier and faster? +Purpose: fast prototyping and fast MVP development + Please notice: - It is **not** a Flutter **at all** and even close, but hopefully will be use its style of components & methods writing. @@ -25,6 +29,7 @@ Please notice: - Typescript - Vue3 - Tailwind +- AntDesign - [vue3-virtual-scroller](https://www.npmjs.com/package/vue3-virtual-scroller) - [vue-grid-layout](https://www.npmjs.com/package/vue-grid-layout/v/3.0.0-beta1) @@ -34,14 +39,14 @@ Add this package to your package.json file: ```json "dependencies": { - "@xsoulspace/vue_flutter_tailwind": "next" + "@xsoulspace/vuefer": "next" } ``` add styling to your main.ts ```typescript -import '@xsoulspace/vue_flutter_tailwind/dist/vft.css' +import '@xsoulspace/vuefer/dist/vft.css' ``` add styling to app div (temporary and will be removed during Scaffold widget refactoring) @@ -330,4 +335,29 @@ MultiProvider.create({ # Changelog -Changelog can be found in [Releases](https://github.com/xsoulspace/vue_flutter_tailwind/releases) +Changelog can be found in [Releases](https://github.com/xsoulspace/vuefer/releases) + +# Setup with Vue 3 + Typescript + Vite + +## Recommended IDE Setup + +[VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings! + +### If Using ` + + diff --git a/src/example/App.tsx b/example/src/App.tsx similarity index 98% rename from src/example/App.tsx rename to example/src/App.tsx index 48ac090..99e39d4 100644 --- a/src/example/App.tsx +++ b/example/src/App.tsx @@ -1,11 +1,4 @@ -import { - Dialog, - GridView, - GridViewItem, - MultiDropdownButton, - MultiProvider, - showDialog, -} from '@/components' +import { computed, defineComponent, h, reactive, ref, watch } from 'vue' import { Align, Alignment, @@ -17,28 +10,34 @@ import { Column, Container, CrossAxisAlignment, + Dialog, DropdownButton, DropdownFieldController, DropdownMenuItem, EdgeInsets, EdgeInsetsStep, ElevatedButton, + GridView, + GridViewDelegate, + GridViewItem, ListView, MainAxisAlignment, MouseRegion, + MultiDropdownButton, MultiDropdownFieldController, + MultiProvider, + NavigationController, Padding, Row, Scaffold, + showDialog, SizedBox, SystemMouseCursors, Text, TextButton, TextEditingController, TextField, -} from '@/index' -import { computed, defineComponent, h, reactive, ref, watch } from 'vue' -import { GridViewDelegate, NavigationController } from '../abstract' +} from '../../lib' import { HeroButton } from './HeroButton' type IndexedText = { id: number @@ -59,7 +58,7 @@ export const WrapperApp = () => { const controller = TextEditingController.default controller.text = text - const obj = reactive>(new Map()) + const obj = reactive>(new Map()) obj.set(0, 'test') obj.set(1, 'test1') obj.set(2, 'test1') diff --git a/src/example/AppProvider.tsx b/example/src/AppProvider.tsx similarity index 68% rename from src/example/AppProvider.tsx rename to example/src/AppProvider.tsx index 1965b16..8f80fd6 100644 --- a/src/example/AppProvider.tsx +++ b/example/src/AppProvider.tsx @@ -1,7 +1,6 @@ -import { NavigationController } from '@/abstract' -import { MultiProvider, Navigation } from '@/components' import { h } from 'vue' -import { WrapperApp } from '../example/App' +import { MultiProvider, Navigation, NavigationController } from '../../lib' +import { WrapperApp } from './App' import { HeroesModel } from './HeroesModel' export const AppProvider = { setup() { diff --git a/src/example/HeroButton.tsx b/example/src/HeroButton.tsx similarity index 91% rename from src/example/HeroButton.tsx rename to example/src/HeroButton.tsx index 7de9b95..68a8041 100644 --- a/src/example/HeroButton.tsx +++ b/example/src/HeroButton.tsx @@ -1,12 +1,13 @@ -import { CrossAxisAlignment, EdgeInsetsStep } from '@/abstract' +import { computed, defineComponent, h, ref } from 'vue' import { + CrossAxisAlignment, + EdgeInsetsStep, ElevatedButton, MultiProvider, Row, SizedBox, Text, -} from '@/components' -import { computed, defineComponent, h, ref } from 'vue' +} from '../../lib' import { HeroesModel } from './HeroesModel' export const HeroButton = () => { diff --git a/src/example/HeroesModel.ts b/example/src/HeroesModel.ts similarity index 76% rename from src/example/HeroesModel.ts rename to example/src/HeroesModel.ts index b87ade5..5b6b475 100644 --- a/src/example/HeroesModel.ts +++ b/example/src/HeroesModel.ts @@ -1,5 +1,5 @@ -import { reactive } from '@vue/reactivity' -import { Maybe } from '..' +import { reactive } from 'vue' +import { Maybe } from '../../lib' export class Hero { constructor(public name: string) {} } diff --git a/src/main.ts b/example/src/main.ts similarity index 64% rename from src/main.ts rename to example/src/main.ts index 12817a9..d9f827c 100644 --- a/src/main.ts +++ b/example/src/main.ts @@ -1,8 +1,8 @@ import { createApp } from 'vue' import vueGridLayout from 'vue-grid-layout' import 'vue3-virtual-scroller/dist/vue3-virtual-scroller.css' -import './components/index.scss' -import { AppProvider } from './example/AppProvider' -import './tailwind.css' +import '../../lib/index.scss' +import '../../lib/tailwind.css' +import { AppProvider } from './AppProvider' createApp(AppProvider).use(vueGridLayout).mount('#app') diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index a948798..0000000 --- a/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', - transform: { - '^.+\\.vue$': 'vue-jest', - }, - testMatch: [ - '/tests/unit/**/*.spec.(js|jsx|ts|tsx)', - '/src/**/*.spec.(js|jsx|ts|tsx)', - ], -} diff --git a/src/abstract/Alignment.ts b/lib/abstract/Alignment.ts similarity index 100% rename from src/abstract/Alignment.ts rename to lib/abstract/Alignment.ts diff --git a/src/abstract/Axis.ts b/lib/abstract/Axis.ts similarity index 100% rename from src/abstract/Axis.ts rename to lib/abstract/Axis.ts diff --git a/src/abstract/BasicTypes.ts b/lib/abstract/BasicTypes.ts similarity index 100% rename from src/abstract/BasicTypes.ts rename to lib/abstract/BasicTypes.ts diff --git a/src/abstract/Border.ts b/lib/abstract/Border.ts similarity index 100% rename from src/abstract/Border.ts rename to lib/abstract/Border.ts diff --git a/src/abstract/BorderRadius.ts b/lib/abstract/BorderRadius.ts similarity index 100% rename from src/abstract/BorderRadius.ts rename to lib/abstract/BorderRadius.ts diff --git a/src/abstract/BorderSide.ts b/lib/abstract/BorderSide.ts similarity index 100% rename from src/abstract/BorderSide.ts rename to lib/abstract/BorderSide.ts diff --git a/src/abstract/BoxBorder.ts b/lib/abstract/BoxBorder.ts similarity index 100% rename from src/abstract/BoxBorder.ts rename to lib/abstract/BoxBorder.ts diff --git a/src/abstract/BoxConstraints.ts b/lib/abstract/BoxConstraints.ts similarity index 100% rename from src/abstract/BoxConstraints.ts rename to lib/abstract/BoxConstraints.ts diff --git a/src/abstract/BoxDecoration.ts b/lib/abstract/BoxDecoration.ts similarity index 100% rename from src/abstract/BoxDecoration.ts rename to lib/abstract/BoxDecoration.ts diff --git a/src/abstract/BoxFit.ts b/lib/abstract/BoxFit.ts similarity index 100% rename from src/abstract/BoxFit.ts rename to lib/abstract/BoxFit.ts diff --git a/src/abstract/BoxShadow.ts b/lib/abstract/BoxShadow.ts similarity index 100% rename from src/abstract/BoxShadow.ts rename to lib/abstract/BoxShadow.ts diff --git a/src/abstract/BoxShape.ts b/lib/abstract/BoxShape.ts similarity index 100% rename from src/abstract/BoxShape.ts rename to lib/abstract/BoxShape.ts diff --git a/src/abstract/ButtonStyle.ts b/lib/abstract/ButtonStyle.ts similarity index 100% rename from src/abstract/ButtonStyle.ts rename to lib/abstract/ButtonStyle.ts diff --git a/src/abstract/Color.ts b/lib/abstract/Color.ts similarity index 100% rename from src/abstract/Color.ts rename to lib/abstract/Color.ts diff --git a/src/abstract/ColorNames.ts b/lib/abstract/ColorNames.ts similarity index 100% rename from src/abstract/ColorNames.ts rename to lib/abstract/ColorNames.ts diff --git a/src/abstract/Colors.ts b/lib/abstract/Colors.ts similarity index 100% rename from src/abstract/Colors.ts rename to lib/abstract/Colors.ts diff --git a/src/abstract/CrossAxisAlignment.ts b/lib/abstract/CrossAxisAlignment.ts similarity index 100% rename from src/abstract/CrossAxisAlignment.ts rename to lib/abstract/CrossAxisAlignment.ts diff --git a/src/abstract/DividerDecoration.ts b/lib/abstract/DividerDecoration.ts similarity index 100% rename from src/abstract/DividerDecoration.ts rename to lib/abstract/DividerDecoration.ts diff --git a/src/abstract/DividerThickness.ts b/lib/abstract/DividerThickness.ts similarity index 100% rename from src/abstract/DividerThickness.ts rename to lib/abstract/DividerThickness.ts diff --git a/src/abstract/DropdownFieldController.ts b/lib/abstract/DropdownFieldController.ts similarity index 100% rename from src/abstract/DropdownFieldController.ts rename to lib/abstract/DropdownFieldController.ts diff --git a/src/abstract/DropdownMenuItem.ts b/lib/abstract/DropdownMenuItem.ts similarity index 100% rename from src/abstract/DropdownMenuItem.ts rename to lib/abstract/DropdownMenuItem.ts diff --git a/src/abstract/EdgeInsets.ts b/lib/abstract/EdgeInsets.ts similarity index 100% rename from src/abstract/EdgeInsets.ts rename to lib/abstract/EdgeInsets.ts diff --git a/src/abstract/FontSize.ts b/lib/abstract/FontSize.ts similarity index 100% rename from src/abstract/FontSize.ts rename to lib/abstract/FontSize.ts diff --git a/src/abstract/FontWeight.ts b/lib/abstract/FontWeight.ts similarity index 100% rename from src/abstract/FontWeight.ts rename to lib/abstract/FontWeight.ts diff --git a/src/abstract/Gradient.ts b/lib/abstract/Gradient.ts similarity index 100% rename from src/abstract/Gradient.ts rename to lib/abstract/Gradient.ts diff --git a/src/abstract/Grid.ts b/lib/abstract/Grid.ts similarity index 100% rename from src/abstract/Grid.ts rename to lib/abstract/Grid.ts diff --git a/src/abstract/InputDecoration.ts b/lib/abstract/InputDecoration.ts similarity index 100% rename from src/abstract/InputDecoration.ts rename to lib/abstract/InputDecoration.ts diff --git a/src/abstract/ItemBuilder.ts b/lib/abstract/ItemBuilder.ts similarity index 100% rename from src/abstract/ItemBuilder.ts rename to lib/abstract/ItemBuilder.ts diff --git a/src/abstract/Key.ts b/lib/abstract/Key.ts similarity index 100% rename from src/abstract/Key.ts rename to lib/abstract/Key.ts diff --git a/src/abstract/ListTile.ts b/lib/abstract/ListTile.ts similarity index 100% rename from src/abstract/ListTile.ts rename to lib/abstract/ListTile.ts diff --git a/src/abstract/MainAxisAlignment.ts b/lib/abstract/MainAxisAlignment.ts similarity index 100% rename from src/abstract/MainAxisAlignment.ts rename to lib/abstract/MainAxisAlignment.ts diff --git a/src/abstract/MainAxisSize.ts b/lib/abstract/MainAxisSize.ts similarity index 100% rename from src/abstract/MainAxisSize.ts rename to lib/abstract/MainAxisSize.ts diff --git a/src/abstract/MouseCursor.ts b/lib/abstract/MouseCursor.ts similarity index 100% rename from src/abstract/MouseCursor.ts rename to lib/abstract/MouseCursor.ts diff --git a/src/abstract/Navigation.ts b/lib/abstract/Navigation.ts similarity index 100% rename from src/abstract/Navigation.ts rename to lib/abstract/Navigation.ts diff --git a/src/abstract/OpacityDecoration.ts b/lib/abstract/OpacityDecoration.ts similarity index 100% rename from src/abstract/OpacityDecoration.ts rename to lib/abstract/OpacityDecoration.ts diff --git a/src/abstract/PackageTypes.d.ts b/lib/abstract/PackageTypes.d.ts similarity index 100% rename from src/abstract/PackageTypes.d.ts rename to lib/abstract/PackageTypes.d.ts diff --git a/src/abstract/SizedBox.ts b/lib/abstract/SizedBox.ts similarity index 100% rename from src/abstract/SizedBox.ts rename to lib/abstract/SizedBox.ts diff --git a/src/abstract/TextAlign.ts b/lib/abstract/TextAlign.ts similarity index 100% rename from src/abstract/TextAlign.ts rename to lib/abstract/TextAlign.ts diff --git a/src/abstract/TextDecoration.ts b/lib/abstract/TextDecoration.ts similarity index 100% rename from src/abstract/TextDecoration.ts rename to lib/abstract/TextDecoration.ts diff --git a/src/abstract/TextDecorationStyle.ts b/lib/abstract/TextDecorationStyle.ts similarity index 100% rename from src/abstract/TextDecorationStyle.ts rename to lib/abstract/TextDecorationStyle.ts diff --git a/src/abstract/TextEditingController.ts b/lib/abstract/TextEditingController.ts similarity index 100% rename from src/abstract/TextEditingController.ts rename to lib/abstract/TextEditingController.ts diff --git a/src/abstract/TextInputType.ts b/lib/abstract/TextInputType.ts similarity index 100% rename from src/abstract/TextInputType.ts rename to lib/abstract/TextInputType.ts diff --git a/src/abstract/TextOverflow.ts b/lib/abstract/TextOverflow.ts similarity index 100% rename from src/abstract/TextOverflow.ts rename to lib/abstract/TextOverflow.ts diff --git a/src/abstract/TextStyle.ts b/lib/abstract/TextStyle.ts similarity index 100% rename from src/abstract/TextStyle.ts rename to lib/abstract/TextStyle.ts diff --git a/src/abstract/VerticalDirection.ts b/lib/abstract/VerticalDirection.ts similarity index 100% rename from src/abstract/VerticalDirection.ts rename to lib/abstract/VerticalDirection.ts diff --git a/src/abstract/index.ts b/lib/abstract/index.ts similarity index 100% rename from src/abstract/index.ts rename to lib/abstract/index.ts diff --git a/src/components/Align.tsx b/lib/components/Align.tsx similarity index 100% rename from src/components/Align.tsx rename to lib/components/Align.tsx diff --git a/src/components/ButtonStyleButton.tsx b/lib/components/ButtonStyleButton.tsx similarity index 100% rename from src/components/ButtonStyleButton.tsx rename to lib/components/ButtonStyleButton.tsx diff --git a/src/components/Center.tsx b/lib/components/Center.tsx similarity index 100% rename from src/components/Center.tsx rename to lib/components/Center.tsx diff --git a/src/components/Checkbox.tsx b/lib/components/Checkbox.tsx similarity index 100% rename from src/components/Checkbox.tsx rename to lib/components/Checkbox.tsx diff --git a/src/components/CheckboxListTile.tsx b/lib/components/CheckboxListTile.tsx similarity index 100% rename from src/components/CheckboxListTile.tsx rename to lib/components/CheckboxListTile.tsx diff --git a/src/components/ColoredBox.tsx b/lib/components/ColoredBox.tsx similarity index 100% rename from src/components/ColoredBox.tsx rename to lib/components/ColoredBox.tsx diff --git a/src/components/Column.tsx b/lib/components/Column.tsx similarity index 100% rename from src/components/Column.tsx rename to lib/components/Column.tsx diff --git a/src/components/ConstrainedBox.tsx b/lib/components/ConstrainedBox.tsx similarity index 100% rename from src/components/ConstrainedBox.tsx rename to lib/components/ConstrainedBox.tsx diff --git a/src/components/Container.tsx b/lib/components/Container.tsx similarity index 100% rename from src/components/Container.tsx rename to lib/components/Container.tsx diff --git a/src/components/Dialog.tsx b/lib/components/Dialog.tsx similarity index 100% rename from src/components/Dialog.tsx rename to lib/components/Dialog.tsx diff --git a/src/components/Divider.tsx b/lib/components/Divider.tsx similarity index 100% rename from src/components/Divider.tsx rename to lib/components/Divider.tsx diff --git a/src/components/DropdownButton.tsx b/lib/components/DropdownButton.tsx similarity index 97% rename from src/components/DropdownButton.tsx rename to lib/components/DropdownButton.tsx index 6785e0e..6e8af0f 100644 --- a/src/components/DropdownButton.tsx +++ b/lib/components/DropdownButton.tsx @@ -1,4 +1,5 @@ import { computed, defineComponent, h, ref } from 'vue' +import { Maybe } from '../abstract/BasicTypes' import { BoxDecoration } from '../abstract/BoxDecoration' import { BoxShadow } from '../abstract/BoxShadow' import { Colors } from '../abstract/Colors' @@ -26,8 +27,8 @@ export const DropdownButton = < | string | number | boolean - | { [prop: string]: any } - | { [prop: number]: any } + | { [prop: string]: Maybe } + | { [prop: number]: Maybe } >({ items, elevation, diff --git a/src/components/DropdownMenuItem.tsx b/lib/components/DropdownMenuItem.tsx similarity index 100% rename from src/components/DropdownMenuItem.tsx rename to lib/components/DropdownMenuItem.tsx diff --git a/src/components/ElevatedButton.tsx b/lib/components/ElevatedButton.tsx similarity index 100% rename from src/components/ElevatedButton.tsx rename to lib/components/ElevatedButton.tsx diff --git a/src/components/FittedBox.tsx b/lib/components/FittedBox.tsx similarity index 100% rename from src/components/FittedBox.tsx rename to lib/components/FittedBox.tsx diff --git a/src/components/Flex.tsx b/lib/components/Flex.tsx similarity index 100% rename from src/components/Flex.tsx rename to lib/components/Flex.tsx diff --git a/src/components/GestureDetector.tsx b/lib/components/GestureDetector.tsx similarity index 100% rename from src/components/GestureDetector.tsx rename to lib/components/GestureDetector.tsx diff --git a/src/components/GridView.tsx b/lib/components/GridView.tsx similarity index 100% rename from src/components/GridView.tsx rename to lib/components/GridView.tsx diff --git a/lib/components/GridViewBuilder.vue b/lib/components/GridViewBuilder.vue new file mode 100644 index 0000000..6dce845 --- /dev/null +++ b/lib/components/GridViewBuilder.vue @@ -0,0 +1,189 @@ + + diff --git a/src/components/GridViewItem.tsx b/lib/components/GridViewItem.tsx similarity index 100% rename from src/components/GridViewItem.tsx rename to lib/components/GridViewItem.tsx diff --git a/src/components/GridViewItemBuilder.tsx b/lib/components/GridViewItemBuilder.tsx similarity index 100% rename from src/components/GridViewItemBuilder.tsx rename to lib/components/GridViewItemBuilder.tsx diff --git a/src/components/GridViewStyle.scss b/lib/components/GridViewStyle.scss similarity index 100% rename from src/components/GridViewStyle.scss rename to lib/components/GridViewStyle.scss diff --git a/src/components/Icon.tsx b/lib/components/Icon.tsx similarity index 100% rename from src/components/Icon.tsx rename to lib/components/Icon.tsx diff --git a/src/components/InkWell.tsx b/lib/components/InkWell.tsx similarity index 100% rename from src/components/InkWell.tsx rename to lib/components/InkWell.tsx diff --git a/src/components/ListTile.tsx b/lib/components/ListTile.tsx similarity index 100% rename from src/components/ListTile.tsx rename to lib/components/ListTile.tsx diff --git a/src/components/ListView.tsx b/lib/components/ListView.tsx similarity index 100% rename from src/components/ListView.tsx rename to lib/components/ListView.tsx diff --git a/lib/components/ListViewBuilder.vue b/lib/components/ListViewBuilder.vue new file mode 100644 index 0000000..dc5bfb7 --- /dev/null +++ b/lib/components/ListViewBuilder.vue @@ -0,0 +1,67 @@ + + + diff --git a/src/components/ListViewItem.tsx b/lib/components/ListViewItem.tsx similarity index 100% rename from src/components/ListViewItem.tsx rename to lib/components/ListViewItem.tsx diff --git a/src/components/Margin.tsx b/lib/components/Margin.tsx similarity index 100% rename from src/components/Margin.tsx rename to lib/components/Margin.tsx diff --git a/src/components/Material.tsx b/lib/components/Material.tsx similarity index 100% rename from src/components/Material.tsx rename to lib/components/Material.tsx diff --git a/src/components/MouseRegion.tsx b/lib/components/MouseRegion.tsx similarity index 100% rename from src/components/MouseRegion.tsx rename to lib/components/MouseRegion.tsx diff --git a/src/components/MultiDropdownButton.tsx b/lib/components/MultiDropdownButton.tsx similarity index 98% rename from src/components/MultiDropdownButton.tsx rename to lib/components/MultiDropdownButton.tsx index 0d106c7..b4f6211 100644 --- a/src/components/MultiDropdownButton.tsx +++ b/lib/components/MultiDropdownButton.tsx @@ -1,5 +1,6 @@ import { computed, defineComponent, h, ref } from 'vue' -import { BorderRadius } from '../abstract' +import { Maybe } from '../abstract/BasicTypes' +import { BorderRadius } from '../abstract/BorderRadius' import { BoxDecoration } from '../abstract/BoxDecoration' import { BoxShadow } from '../abstract/BoxShadow' import { Colors } from '../abstract/Colors' @@ -79,8 +80,8 @@ export const MultiDropdownButton = < | string | number | boolean - | { [prop: string]: any } - | { [prop: number]: any }, + | { [prop: string]: Maybe } + | { [prop: number]: Maybe }, TKeyValue extends MultiDropdownSelectedItemI >({ items, diff --git a/src/components/Navigation.tsx b/lib/components/Navigation.tsx similarity index 100% rename from src/components/Navigation.tsx rename to lib/components/Navigation.tsx diff --git a/src/components/Opacity.tsx b/lib/components/Opacity.tsx similarity index 100% rename from src/components/Opacity.tsx rename to lib/components/Opacity.tsx diff --git a/src/components/Padding.tsx b/lib/components/Padding.tsx similarity index 100% rename from src/components/Padding.tsx rename to lib/components/Padding.tsx diff --git a/src/components/Positioned.tsx b/lib/components/Positioned.tsx similarity index 100% rename from src/components/Positioned.tsx rename to lib/components/Positioned.tsx diff --git a/src/components/Provider.tsx b/lib/components/Provider.tsx similarity index 100% rename from src/components/Provider.tsx rename to lib/components/Provider.tsx diff --git a/src/components/Row.tsx b/lib/components/Row.tsx similarity index 100% rename from src/components/Row.tsx rename to lib/components/Row.tsx diff --git a/src/components/Scaffold.tsx b/lib/components/Scaffold.tsx similarity index 100% rename from src/components/Scaffold.tsx rename to lib/components/Scaffold.tsx diff --git a/src/components/SizedBox.tsx b/lib/components/SizedBox.tsx similarity index 100% rename from src/components/SizedBox.tsx rename to lib/components/SizedBox.tsx diff --git a/src/components/Stack.tsx b/lib/components/Stack.tsx similarity index 100% rename from src/components/Stack.tsx rename to lib/components/Stack.tsx diff --git a/src/components/Text.tsx b/lib/components/Text.tsx similarity index 100% rename from src/components/Text.tsx rename to lib/components/Text.tsx diff --git a/src/components/TextButton.tsx b/lib/components/TextButton.tsx similarity index 100% rename from src/components/TextButton.tsx rename to lib/components/TextButton.tsx diff --git a/src/components/TextField.tsx b/lib/components/TextField.tsx similarity index 100% rename from src/components/TextField.tsx rename to lib/components/TextField.tsx diff --git a/src/components/VerticalDivider.tsx b/lib/components/VerticalDivider.tsx similarity index 100% rename from src/components/VerticalDivider.tsx rename to lib/components/VerticalDivider.tsx diff --git a/src/components/Visibility.tsx b/lib/components/Visibility.tsx similarity index 100% rename from src/components/Visibility.tsx rename to lib/components/Visibility.tsx diff --git a/lib/components/VueTeleport.vue b/lib/components/VueTeleport.vue new file mode 100644 index 0000000..5fadc68 --- /dev/null +++ b/lib/components/VueTeleport.vue @@ -0,0 +1,16 @@ + + diff --git a/src/components/Wrap.tsx b/lib/components/Wrap.tsx similarity index 100% rename from src/components/Wrap.tsx rename to lib/components/Wrap.tsx diff --git a/src/components/index.scss b/lib/components/index.scss similarity index 100% rename from src/components/index.scss rename to lib/components/index.scss diff --git a/src/components/index.ts b/lib/components/index.ts similarity index 100% rename from src/components/index.ts rename to lib/components/index.ts diff --git a/src/directives/VClickOutside.ts b/lib/directives/VClickOutside.ts similarity index 100% rename from src/directives/VClickOutside.ts rename to lib/directives/VClickOutside.ts diff --git a/src/functions/createMap.ts b/lib/functions/createMap.ts similarity index 66% rename from src/functions/createMap.ts rename to lib/functions/createMap.ts index 8743224..d197166 100644 --- a/src/functions/createMap.ts +++ b/lib/functions/createMap.ts @@ -15,9 +15,11 @@ export const createKeyedMap = ({ const map = new Map() for (const value of arr) { - const rawKey = value[key] as any - const newKey = unifyValues ? unifyValue(rawKey) : rawKey - map.set(newKey as TKey, valueIsKey ? newKey : value) + const rawKey = value[key] as Maybe + if (rawKey) { + const newKey = unifyValues ? unifyValue({ str: rawKey }) : rawKey + map.set(newKey as TKey, valueIsKey ? (newKey as TValue) : value) + } } return map } @@ -33,8 +35,8 @@ export const createKeyedIndexMap = ({ const map = new Map() for (const [i, value] of arr.entries()) { - const rawKey = value[key] as any - const newKey = unifyValues ? unifyValue(rawKey) : rawKey + const rawKey = value[key] as Maybe + const newKey = unifyValues ? unifyValue({ str: rawKey }) : rawKey map.set(newKey as TKey, i) } return map diff --git a/src/functions/deepCopyObj.ts b/lib/functions/deepCopyObj.ts similarity index 100% rename from src/functions/deepCopyObj.ts rename to lib/functions/deepCopyObj.ts diff --git a/src/functions/findUnshiftSplice.ts b/lib/functions/findUnshiftSplice.ts similarity index 96% rename from src/functions/findUnshiftSplice.ts rename to lib/functions/findUnshiftSplice.ts index 351f0fc..21a7c8b 100644 --- a/src/functions/findUnshiftSplice.ts +++ b/lib/functions/findUnshiftSplice.ts @@ -15,7 +15,7 @@ export const checkId = (e: T) => { return e case 'object': if ('id' in e) { - return e['id'] + return (e as any)['id'] } // try to search for key with id const ids: string[] = [] @@ -26,7 +26,8 @@ export const checkId = (e: T) => { } switch (ids.length) { case 1: - return (e as any)[ids[0]] + const idKey = ids[0] + return (e as any)[idKey] } default: throw Error( @@ -47,7 +48,7 @@ const getIndexById = ({ idKey, }: { arr: T[] - idToFind: any + idToFind: unknown idKey: Maybe }) => { const index = arr.findIndex((e) => { diff --git a/src/functions/getChangesFromOldAndNewArrays.spec.ts b/lib/functions/getChangesFromOldAndNewArrays.spec.ts similarity index 100% rename from src/functions/getChangesFromOldAndNewArrays.spec.ts rename to lib/functions/getChangesFromOldAndNewArrays.spec.ts diff --git a/src/functions/getChangesFromOldAndNewArrays.ts b/lib/functions/getChangesFromOldAndNewArrays.ts similarity index 98% rename from src/functions/getChangesFromOldAndNewArrays.ts rename to lib/functions/getChangesFromOldAndNewArrays.ts index 0e8fee5..fb2f5a4 100644 --- a/src/functions/getChangesFromOldAndNewArrays.ts +++ b/lib/functions/getChangesFromOldAndNewArrays.ts @@ -1,7 +1,7 @@ import { Maybe } from '../abstract/BasicTypes' import { unifyValue } from './unifyValue' -const getUnifiedValue = (val: any) => { +const getUnifiedValue = (val: Maybe) => { return typeof val == 'object' ? unifyValue({ str: val }) : val } diff --git a/src/functions/index.ts b/lib/functions/index.ts similarity index 100% rename from src/functions/index.ts rename to lib/functions/index.ts diff --git a/src/functions/isNotNull.ts b/lib/functions/isNotNull.ts similarity index 100% rename from src/functions/isNotNull.ts rename to lib/functions/isNotNull.ts diff --git a/src/functions/reduceHtmlClasses.ts b/lib/functions/reduceHtmlClasses.ts similarity index 100% rename from src/functions/reduceHtmlClasses.ts rename to lib/functions/reduceHtmlClasses.ts diff --git a/src/functions/unifyValue.ts b/lib/functions/unifyValue.ts similarity index 100% rename from src/functions/unifyValue.ts rename to lib/functions/unifyValue.ts diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..0272a50 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,3 @@ +/// + +export * from './index' diff --git a/lib/index.scss b/lib/index.scss new file mode 100644 index 0000000..d7837b3 --- /dev/null +++ b/lib/index.scss @@ -0,0 +1 @@ +@forward './components/'; diff --git a/src/index.ts b/lib/index.ts similarity index 90% rename from src/index.ts rename to lib/index.ts index aa2ecd2..53e0197 100644 --- a/src/index.ts +++ b/lib/index.ts @@ -1,3 +1,4 @@ +/// export * from './abstract' export * from './components' // thanks to How to build: diff --git a/lib/shims-vue.d.ts b/lib/shims-vue.d.ts new file mode 100644 index 0000000..a70d4e5 --- /dev/null +++ b/lib/shims-vue.d.ts @@ -0,0 +1,10 @@ +/* eslint-disable */ +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent< + Record, + Record, + unknown + > + export default component +} diff --git a/src/tailwind.css b/lib/tailwind.css similarity index 100% rename from src/tailwind.css rename to lib/tailwind.css diff --git a/lib/types.d.ts b/lib/types.d.ts new file mode 100644 index 0000000..a095b62 --- /dev/null +++ b/lib/types.d.ts @@ -0,0 +1,2 @@ +declare module 'vue3-virtual-scroller' +declare module 'vue-grid-layout' diff --git a/src/utils.ts b/lib/utils.ts similarity index 100% rename from src/utils.ts rename to lib/utils.ts diff --git a/package.json b/package.json index 59f6854..daa6767 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@xsoulspace/vue_flutter_tailwind", - "description": "Vue3 styled like Flutter with Tailwind CSS", - "version": "0.7.2", + "name": "@xsoulspace/vuefer", + "description": "vuefer = Vue3 styled like Flutter with Tailwind and AntDesign", + "version": "0.8.0", "private": false, "author": { "name": "Anton Malofeev", @@ -10,66 +10,72 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/xsoulspace/vue_flutter_tailwind.git" + "url": "git+https://github.com/xsoulspace/vuefer.git" }, "bugs": { - "url": "https://github.com/xsoulspace/vue_flutter_tailwind/issues" + "url": "https://github.com/xsoulspace/vuefer/issues" }, - "homepage": "https://github.com/xsoulspace/vue_flutter_tailwind#readme", - "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build", - "build:js": "vue-cli-service build --target lib --name vft 'src/index.ts'", - "test:unit": "vue-cli-service test:unit", - "test:e2e": "vue-cli-service test:e2e", - "lint": "vue-cli-service lint" + "homepage": "https://github.com/xsoulspace/vuefer#readme", + "main": "./dist/vuefer.umd.js", + "module": "./dist/vuefer.es.js", + "exports": { + ".": { + "import": "./dist/vuefer.es.js", + "require": "./dist/vuefer.umd.js" + } }, - "main": "./dist/vft.common.js", "files": [ - "dist/*" + "dist" ], "typings": "./dist/index.d.ts", + "scripts": { + "dev": "vite", + "build": "vite build", + "serve": "vite preview", + "upgrade": "yarn yarn-upgrade-all add vue@next ant-design-vue@next", + "lint": "eslint --ext .ts,vue --ignore-path .gitignore ." + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, "dependencies": { - "core-js": "^3.6.5", - "@tailwindcss/postcss7-compat": "^2.0.3", - "postcss": "^7", - "tailwindcss": "npm:@tailwindcss/postcss7-compat", - "vue": "^3.0.5", - "vue3-virtual-scroller": "^0.2.1", - "vue-grid-layout": "3.0.0-beta1" + "@ant-design/colors": "^6.0.0", + "@ant-design/icons-vue": "^6.0.1", + "ant-design-vue": "^2.0.1", + "tailwindcss": "^2.0.3", + "vue": "^3.0.6", + "vue-grid-layout": "^3.0.0-beta1", + "vue3-virtual-scroller": "^0.2.1" }, "devDependencies": { - "@types/jest": "^26.0.20", - "@typescript-eslint/eslint-plugin": "^4.15.1", - "@typescript-eslint/parser": "^4.15.1", - "@vue/cli-plugin-babel": "^4.5.11", - "@vue/cli-plugin-e2e-cypress": "^4.5.11", - "@vue/cli-plugin-eslint": "^4.5.11", - "@vue/cli-plugin-typescript": "^4.5.11", - "@vue/cli-plugin-unit-jest": "^4.5.11", - "@vue/cli-service": "^4.5.11", - "@vue/compiler-sfc": "^3.0.0", + "@types/node": "^14.14.31", + "@typescript-eslint/eslint-plugin": "^4.15.2", + "@typescript-eslint/parser": "^4.15.2", + "@vitejs/plugin-vue": "^1.1.4", + "@vitejs/plugin-vue-jsx": "^1.1.2", + "@vue/compiler-sfc": "^3.0.5", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", - "@vue/test-utils": "^2.0.0-0", - "eslint": "^7.20.0", - "autoprefixer": "^9", - "eslint-plugin-prettier": "^3.1.3", - "eslint-plugin-vue": "^7.0.0-0", + "autoprefixer": "^10.2.4", + "eslint": "^7.21.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-vue": "^7.6.0", + "husky": "^5.1.2", "lint-staged": "^10.5.4", "prettier": "^2.2.1", - "sass": "^1.26.5", - "sass-loader": "^10.1.1", - "typescript": "^4.1.5", - "vue-jest": "^5.0.0-0" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.{js,jsx,vue,ts,tsx}": [ - "vue-cli-service lint", - "git add" - ] + "rollup-plugin-typescript2": "^0.30.0", + "sass": "^1.32.8", + "typescript": "^4.2.2", + "vite": "^2.0.1", + "yarn-upgrade-all": "^0.5.4" } } diff --git a/packagelint.md b/packagelint.md new file mode 100644 index 0000000..dcfadda --- /dev/null +++ b/packagelint.md @@ -0,0 +1,11 @@ +``` + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{ts,,tsx,vue}": "eslint --fix", + "*": "prettier -w -u" + } +``` diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 5f1393c..0000000 --- a/public/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- - - diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index eb05362..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: diff --git a/src/abstract/Wrap.ts b/src/abstract/Wrap.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/AppBar.tsx b/src/components/AppBar.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Card.tsx b/src/components/Card.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Drawer.tsx b/src/components/Drawer.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Flexible.tsx b/src/components/Flexible.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/GridViewBuilder.vue b/src/components/GridViewBuilder.vue deleted file mode 100644 index 8c6dadc..0000000 --- a/src/components/GridViewBuilder.vue +++ /dev/null @@ -1,189 +0,0 @@ - - diff --git a/src/components/ListViewBuilder.vue b/src/components/ListViewBuilder.vue deleted file mode 100644 index ceb0c68..0000000 --- a/src/components/ListViewBuilder.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - diff --git a/src/components/VueTeleport.vue b/src/components/VueTeleport.vue deleted file mode 100644 index 4a95a46..0000000 --- a/src/components/VueTeleport.vue +++ /dev/null @@ -1,16 +0,0 @@ - - diff --git a/src/index.d.ts b/src/index.d.ts deleted file mode 100644 index df7053e..0000000 --- a/src/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './index' diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts deleted file mode 100644 index b062ae4..0000000 --- a/src/shims-vue.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable */ -declare module "*.vue" { - import type { DefineComponent } from "vue"; - const component: DefineComponent<{}, {}, any>; - export default component; -} - -declare module "vue3-virtual-scroller"; diff --git a/tailwind.config.js b/tailwind.config.js index 3d4645b..85abf1f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,6 @@ module.exports = { // purge: ["./public/**/*.html", "./src/**/*.{vue,js,ts,jsx,tsx}"], - darkMode: 'class', // or 'media' or 'class' + darkMode: false, // or 'media' or 'class' theme: { extend: {}, }, diff --git a/tests/e2e/.eslintrc.js b/tests/e2e/.eslintrc.js deleted file mode 100644 index a3e436b..0000000 --- a/tests/e2e/.eslintrc.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - plugins: ['cypress'], - env: { - mocha: true, - 'cypress/globals': true, - }, - rules: { - strict: 'off', - }, -} diff --git a/tests/e2e/plugins/index.js b/tests/e2e/plugins/index.js deleted file mode 100644 index 3cd3f22..0000000 --- a/tests/e2e/plugins/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable arrow-body-style */ -// https://docs.cypress.io/guides/guides/plugins-guide.html - -// if you need a custom webpack configuration you can uncomment the following import -// and then use the `file:preprocessor` event -// as explained in the cypress docs -// https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples - -// /* eslint-disable import/no-extraneous-dependencies, global-require */ -// const webpack = require('@cypress/webpack-preprocessor') - -module.exports = (on, config) => { - // on('file:preprocessor', webpack({ - // webpackOptions: require('@vue/cli-service/webpack.config'), - // watchOptions: {} - // })) - - return Object.assign({}, config, { - fixturesFolder: 'tests/e2e/fixtures', - integrationFolder: 'tests/e2e/specs', - screenshotsFolder: 'tests/e2e/screenshots', - videosFolder: 'tests/e2e/videos', - supportFile: 'tests/e2e/support/index.js', - }) -} diff --git a/tests/e2e/specs/test.js b/tests/e2e/specs/test.js deleted file mode 100644 index 479bea8..0000000 --- a/tests/e2e/specs/test.js +++ /dev/null @@ -1,8 +0,0 @@ -// https://docs.cypress.io/api/introduction/api.html - -describe('My First Test', () => { - it('Visits the app root url', () => { - cy.visit('/') - cy.contains('h1', 'Welcome to Your Vue.js + TypeScript App') - }) -}) diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js deleted file mode 100644 index c1f5a77..0000000 --- a/tests/e2e/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add("login", (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This is will overwrite an existing command -- -// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/tests/e2e/support/index.js b/tests/e2e/support/index.js deleted file mode 100644 index d68db96..0000000 --- a/tests/e2e/support/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/tests/unit/example.spec.ts b/tests/unit/example.spec.ts deleted file mode 100644 index cd032c3..0000000 --- a/tests/unit/example.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -// import { shallowMount } from "@vue/test-utils"; -// import HelloWorld from "@/components/HelloWorld.vue"; - -// describe("HelloWorld.vue", () => { -// it("renders props.msg when passed", () => { -// const msg = "new message"; -// const wrapper = shallowMount(HelloWorld, { -// props: { msg } -// }); -// expect(wrapper.text()).toMatch(msg); -// }); -// }); diff --git a/tsconfig.json b/tsconfig.json index 73e34d4..20d5ca1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,33 +2,36 @@ "compilerOptions": { "target": "esnext", "module": "esnext", + "moduleResolution": "node", "strict": true, "jsx": "preserve", - "importHelpers": true, "noImplicitAny": false, - "moduleResolution": "node", - "experimentalDecorators": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, "declaration": true, "baseUrl": ".", - "types": ["webpack-env", "jest", "./src"], + "importHelpers": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, "paths": { - "@/*": ["src/*"] + "@/*": ["example/src/*"] }, "outDir": "dist", + "typeRoots": ["./lib"], "declarationDir": "dist", - "lib": ["esnext", "dom", "dom.iterable", "scripthost"] + "lib": ["esnext", "dom", "dom.iterable", "scripthost"], + "types": ["vite/client", "./lib"] }, + "exclude": ["node_modules", "dist"], "include": [ - "src/**/*.ts", - "src/**/*.d.ts", - "src/**/*.tsx", - "src/**/*.vue" - // "tests/**/*.ts", - // "tests/**/*.tsx" - ], - "exclude": ["node_modules", "dist"] + "lib/**/*.ts", + "lib/**/*.d.ts", + "lib/**/*.tsx", + "lib/**/*.vue", + "example/**/*.ts", + "example/**/*.d.ts", + "example/**/*.tsx", + "example/**/*.vue" + ] } diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..f9edcbd --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,51 @@ +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import { join, resolve } from 'path' +import typescript from 'rollup-plugin-typescript2' +import { defineConfig } from 'vite' + +// https://vitejs.dev/config/ +export default defineConfig({ + resolve: { + alias: { + '@/': join(__dirname, 'example/'), + }, + }, + root: './example', + plugins: [ + vue(), + vueJsx({ + // options are passed on to @vue/babel-plugin-jsx + }), + ], + optimizeDeps: { + include: ['@ant-design/icons-vue'], + }, + build: { + lib: { + entry: resolve(__dirname, 'lib/index.ts'), + name: 'vuefer', + }, + rollupOptions: { + input: { + main: resolve(__dirname, 'example/index.html'), + }, + // make sure to externalize deps that shouldn't be bundled + // into your library + external: ['vue'], + plugins: [ + typescript({ + rollupCommonJSResolveHack: false, + clean: true, + }), + ], + output: { + // Provide global variables to use in the UMD build + // for externalized deps + globals: { + vue: 'Vue', + }, + }, + }, + }, +}) diff --git a/vue.config.js b/vue.config.js deleted file mode 100644 index b0f99cd..0000000 --- a/vue.config.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * These are some necessary steps changing the default webpack config of the Vue CLI - * that need to be changed in order for TypeScript based components to generate their - * declaration (.d.ts) files. - * Discussed here https://github.com/vuejs/vue-cli/issues/1081 - */ -const fixEmitDeclarationFilesForTypeScript = { - chainWebpack: config => { - if (process.env.NODE_ENV === 'production') { - config.module - .rule('ts') - .use('ts-loader') - .loader('ts-loader') - .tap(options => ({ - ...options, - transpileOnly: false, - happyPackMode: false, - compilerOptions: { - declaration: true, - }, - })) - } - }, - parallel: false, -} - -module.exports = { - ...fixEmitDeclarationFilesForTypeScript, - // some other configuration -} From 0c46c199130cac183f95493048dba65c74b8735f Mon Sep 17 00:00:00 2001 From: Anton Malofeev Date: Mon, 1 Mar 2021 19:51:30 +0300 Subject: [PATCH 02/10] wip: build --- lib/index.d.ts | 2 -- lib/index.ts | 2 +- package.json | 2 +- vite.config.ts | 13 ++----------- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 0272a50..df7053e 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,3 +1 @@ -/// - export * from './index' diff --git a/lib/index.ts b/lib/index.ts index 53e0197..635899c 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,4 +1,3 @@ -/// export * from './abstract' export * from './components' // thanks to How to build: @@ -7,3 +6,4 @@ export * from './components' import 'vue3-virtual-scroller/dist/vue3-virtual-scroller.css' import './components/index.scss' import './tailwind.css' +import './types' diff --git a/package.json b/package.json index daa6767..5862e9b 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,8 @@ "husky": "^5.1.2", "lint-staged": "^10.5.4", "prettier": "^2.2.1", - "rollup-plugin-typescript2": "^0.30.0", "sass": "^1.32.8", + "tsc-prog": "^2.2.1", "typescript": "^4.2.2", "vite": "^2.0.1", "yarn-upgrade-all": "^0.5.4" diff --git a/vite.config.ts b/vite.config.ts index f9edcbd..7720163 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,7 @@ import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import { join, resolve } from 'path' -import typescript from 'rollup-plugin-typescript2' import { defineConfig } from 'vite' - // https://vitejs.dev/config/ export default defineConfig({ resolve: { @@ -27,19 +25,12 @@ export default defineConfig({ name: 'vuefer', }, rollupOptions: { - input: { - main: resolve(__dirname, 'example/index.html'), - }, // make sure to externalize deps that shouldn't be bundled // into your library external: ['vue'], - plugins: [ - typescript({ - rollupCommonJSResolveHack: false, - clean: true, - }), - ], + plugins: [], output: { + dir: './dist', // Provide global variables to use in the UMD build // for externalized deps globals: { From eb98f4bd31faaa0c6fcdc82e0080686aa5f63735 Mon Sep 17 00:00:00 2001 From: Anton Malofeev Date: Mon, 1 Mar 2021 21:08:34 +0300 Subject: [PATCH 03/10] fix: linter errors wip: build - its working but has numerous errors --- .eslintrc.js | 1 + lib/abstract/BasicTypes.ts | 2 ++ lib/components/GridViewBuilder.vue | 17 ++++++------ lib/components/ListViewBuilder.vue | 19 ++++++------- lib/directives/VClickOutside.ts | 2 ++ lib/functions/findUnshiftSplice.ts | 6 ++++- .../getChangesFromOldAndNewArrays.ts | 11 ++++++-- lib/index.d.ts | 2 ++ lib/index.ts | 1 - package.json | 2 ++ tsconfig.json | 4 +++ vite.config.ts | 27 ++++++++++++++++--- 12 files changed, 69 insertions(+), 25 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bee0f5b..cc6e9ca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,5 +23,6 @@ module.exports = { quotes: ['error', 'single'], 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', }, } diff --git a/lib/abstract/BasicTypes.ts b/lib/abstract/BasicTypes.ts index 35af416..e8a8408 100644 --- a/lib/abstract/BasicTypes.ts +++ b/lib/abstract/BasicTypes.ts @@ -1,3 +1,5 @@ export type ValueChanged = (value: Maybe, oldValue?: Maybe) => void export type Maybe = T | undefined | null + +//eslint-disable-next-line @typescript-eslint/no-explicit-any export type Constructor = new (...args: any[]) => T diff --git a/lib/components/GridViewBuilder.vue b/lib/components/GridViewBuilder.vue index 6dce845..890de91 100644 --- a/lib/components/GridViewBuilder.vue +++ b/lib/components/GridViewBuilder.vue @@ -1,5 +1,6 @@