Skip to content

Commit

Permalink
feat: support vue2(test)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulLyoko committed Oct 16, 2021
1 parent fb6a180 commit 57d5eaa
Show file tree
Hide file tree
Showing 42 changed files with 133 additions and 124 deletions.
4 changes: 2 additions & 2 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-nocheck
import { App } from "vue";
// import DefaultTheme from "vitepress/theme";
// @ts-ignore
import defaultTheme from "vitepress/dist/client/theme-default";
import VueTianditu from "../../../packages";
import VueTianditu from "../../../lib/index.es.js";
import components from "../components";
import "./index.css";

Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-tianditu",
"version": "2.0.5",
"version": "2.1.0",
"description": "vue tianditu",
"author": "Lyoko <519052532@qq.com>",
"private": false,
Expand All @@ -19,23 +19,24 @@
"serve": "vite preview",
"lint": "eslint src --ext .vue,.js,.ts",
"prepare": "husky install",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:dev": "npm run build && vitepress dev docs",
"docs:build": "npm run build && vitepress build docs",
"docs:serve": "vitepress serve docs"
},
"dependencies": {
"mitt": "^3.0.0",
"vue": "^3.2.20"
"vue": "^3.2.20",
"vue-demi": "^0.11.4"
},
"devDependencies": {
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@types/node": "^16.10.5",
"@types/node": "^16.11.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vitejs/plugin-vue": "^1.9.3",
"@vue/compiler-sfc": "3.2.20",
"eslint": "^8.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.19.1",
Expand All @@ -45,7 +46,7 @@
"typescript": "^4.4.4",
"vite": "2.6.7",
"vitepress": "^0.20.0",
"vue-tsc": "^0.28.3"
"vue-tsc": "^0.28.6"
},
"lint-staged": {
"*.{js,ts,vue}": [
Expand Down
4 changes: 2 additions & 2 deletions packages/control/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../types";
import { useEvent } from "../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/control/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { Point } from "../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/control/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toPoint } from "../../utils";
import { Props } from "../types";

Expand Down
2 changes: 1 addition & 1 deletion packages/install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from "vue";
import { App } from "vue-demi";
import { Options } from "./api-loader/types";
import { initApiLoader } from "./api-loader";
import * as components from "./components";
Expand Down
2 changes: 1 addition & 1 deletion packages/map/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {

<script lang="ts" setup>
import mitt from "mitt";
import { ref, provide, onMounted } from "vue";
import { ref, provide, onMounted } from "vue-demi";
import { apiLoaderInstance } from "../api-loader";
import { MapEmitEvents } from "../types";
import { useEvent } from "../use";
Expand Down
2 changes: 1 addition & 1 deletion packages/map/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { LngLat, Bounds } from "../../types";
import { uuid } from "../../utils";
import { ControlNames, ControlOpts } from "../types";
Expand Down
2 changes: 1 addition & 1 deletion packages/map/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toBounds, toLngLat } from "../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/circle/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/circle/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { LngLat } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/circle/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toLngLat } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/infowindow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/infowindow/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { LngLat, Point } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/infowindow/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toLngLat, toPoint } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/label/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/label/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { Point, LngLat } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/label/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toLngLat, toPoint } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/marker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/marker/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { IconOptions, LngLat } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/marker/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toIcon, toLngLat } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/polygon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/polygon/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { LngLat } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/polygon/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toLngLats } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/polyline/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/polyline/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { LngLat } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/polyline/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toLngLats } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/rectangle/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/rectangle/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { Bounds } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/rectangle/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { toBounds } from "../../../utils";
import { Props } from "../types";

Expand Down
4 changes: 2 additions & 2 deletions packages/tilelayer/tdt/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted, useAttrs } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted, useAttrs } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/tdt/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { Bounds } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/tdt/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { Props } from "../types";

export function useWatch({ props, instance }: { props: Props; instance: Tianditu.TileLayer.TDT }) {
Expand Down
4 changes: 2 additions & 2 deletions packages/tilelayer/tilelayer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted, useAttrs } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted, useAttrs } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/tilelayer/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";
import { Bounds } from "../../../types";

export const NATIVE_PROPS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/tilelayer/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { Props } from "../types";

export function useWatch({ props, instance }: { props: Props; instance: Tianditu.TileLayer }) {
Expand Down
4 changes: 2 additions & 2 deletions packages/tilelayer/wms/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
</script>

<script lang="ts" setup>
import { ref, inject, onUnmounted, useAttrs } from "vue";
import type { Ref } from "vue";
import { ref, inject, onUnmounted, useAttrs } from "vue-demi";
import type { Ref } from "vue-demi";
import type { MapEmitter } from "../../types";
import { useEvent } from "../../use";
import { useInit, useWatch, PROPS, EVENTS, NATIVE_EVENTS } from "./use";
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/wms/use/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from "vue";
import { PropType } from "vue-demi";

export const NATIVE_PROPS = {
/** 用","分隔的多个图层列表 */
Expand Down
2 changes: 1 addition & 1 deletion packages/tilelayer/wms/use/watch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { watch } from "vue";
import { watch } from "vue-demi";
import { Props } from "../types";

export function useWatch({ props, instance }: { props: Props; instance: Tianditu.TileLayer.WMS }) {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefineComponent, EmitsOptions, ExtractPropTypes } from "vue";
import { DefineComponent, EmitsOptions, ExtractPropTypes } from "vue-demi";

// export type DefineProps<P> = InstanceType<DefineComponent<P>>["$props"];
export type DefineProps<P> = ExtractPropTypes<P>;
Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default defineConfig({
"~": path.resolve(__dirname, "packages")
}
},
optimizeDeps: {
exclude: ["vue-demi"]
},
build: {
lib: {
entry: path.resolve(__dirname, "packages/index.ts"),
Expand Down
Loading

0 comments on commit 57d5eaa

Please sign in to comment.