@summeruse/ol 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
1
+ import { defineComponent as d, ref as c, createBlock as f, openBlock as m, unref as v } from "vue";
2
+ import { NDropdown as x } from "naive-ui";
3
+ const _ = /* @__PURE__ */ d({
4
+ __name: "n-ol-contextmenu",
5
+ props: {
6
+ olMap: {},
7
+ createDropdownOptions: { type: Function }
8
+ },
9
+ setup(a) {
10
+ const s = a, { olMap: n } = s, o = c({
11
+ visible: !1,
12
+ x: 0,
13
+ y: 0
14
+ }), r = () => {
15
+ o.value.visible = !1;
16
+ }, l = c();
17
+ n.getViewport().oncontextmenu = (e) => {
18
+ e.preventDefault();
19
+ const t = n.getEventPixel(e), i = n.getEventCoordinate(e), u = n.getFeaturesAtPixel(t);
20
+ l.value = s.createDropdownOptions({ event: e, pixel: t, coordinate: i, features: u }), o.value = {
21
+ visible: !0,
22
+ x: e.clientX,
23
+ y: e.clientY
24
+ };
25
+ };
26
+ const p = (e, t) => {
27
+ const { onClick: i } = t;
28
+ i && i(), o.value.visible = !1;
29
+ };
30
+ return (e, t) => (m(), f(v(x), {
31
+ placement: "bottom-start",
32
+ trigger: "manual",
33
+ show: l.value && l.value.length > 0 && o.value.visible,
34
+ x: o.value.x,
35
+ y: o.value.y,
36
+ options: l.value,
37
+ "on-clickoutside": r,
38
+ onSelect: p
39
+ }, null, 8, ["show", "x", "y", "options"]));
40
+ }
41
+ });
42
+ export {
43
+ _ as NOlContextmenu
44
+ };
@@ -0,0 +1,3 @@
1
+ import { default as NOlContextmenu } from './ol-contextmenu/n-ol-contextmenu.vue';
2
+ export { NOlContextmenu };
3
+ export * from './ol-contextmenu/props';
@@ -0,0 +1,3 @@
1
+ import { Props } from './props';
2
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { defineComponent as d, ref as a, createBlock as f, openBlock as v, unref as m } from "vue";
2
+ import { NDropdown as x } from "naive-ui";
3
+ const _ = /* @__PURE__ */ d({
4
+ __name: "n-ol-contextmenu",
5
+ props: {
6
+ olMap: {},
7
+ createDropdownOptions: { type: Function }
8
+ },
9
+ setup(c) {
10
+ const s = c, { olMap: n } = s, o = a({
11
+ visible: !1,
12
+ x: 0,
13
+ y: 0
14
+ }), r = () => {
15
+ o.value.visible = !1;
16
+ }, l = a();
17
+ n.getViewport().oncontextmenu = (e) => {
18
+ e.preventDefault();
19
+ const t = n.getEventPixel(e), i = n.getEventCoordinate(e), u = n.getFeaturesAtPixel(t);
20
+ l.value = s.createDropdownOptions({ event: e, pixel: t, coordinate: i, features: u }), o.value = {
21
+ visible: !0,
22
+ x: e.clientX,
23
+ y: e.clientY
24
+ };
25
+ };
26
+ const p = (e, t) => {
27
+ const { onClick: i } = t;
28
+ i && i(), o.value.visible = !1;
29
+ };
30
+ return (e, t) => (v(), f(m(x), {
31
+ placement: "bottom-start",
32
+ trigger: "manual",
33
+ show: l.value && l.value.length > 0 && o.value.visible,
34
+ x: o.value.x,
35
+ y: o.value.y,
36
+ options: l.value,
37
+ "on-clickoutside": r,
38
+ onSelect: p
39
+ }, null, 8, ["show", "x", "y", "options"]));
40
+ }
41
+ });
42
+ export {
43
+ _ as default
44
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./n-ol-contextmenu.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,15 @@
1
+ import { Map as OLMap } from 'ol';
2
+ import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
3
+ import { Pixel } from 'ol/pixel';
4
+ import { Coordinate } from 'ol/coordinate';
5
+ import { FeatureLike } from 'ol/Feature';
6
+ export interface Options {
7
+ event: MouseEvent;
8
+ pixel: Pixel;
9
+ coordinate: Coordinate;
10
+ features: FeatureLike[];
11
+ }
12
+ export interface Props {
13
+ olMap: OLMap;
14
+ createDropdownOptions: (options: Options) => DropdownMixedOption[];
15
+ }
package/es/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
package/es/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { default as o } from "./components/ol-contextmenu/n-ol-contextmenu.vue.mjs";
2
+ export {
3
+ o as NOlContextmenu
4
+ };
@@ -0,0 +1,3 @@
1
+ import { default as NOlContextmenu } from './ol-contextmenu/n-ol-contextmenu.vue';
2
+ export { NOlContextmenu };
3
+ export * from './ol-contextmenu/props';
@@ -0,0 +1,3 @@
1
+ import { Props } from './props';
2
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),d=require("naive-ui"),v=t.defineComponent({__name:"n-ol-contextmenu",props:{olMap:{},createDropdownOptions:{type:Function}},setup(a){const c=a,{olMap:l}=c,o=t.ref({visible:!1,x:0,y:0}),r=()=>{o.value.visible=!1},i=t.ref();l.getViewport().oncontextmenu=e=>{e.preventDefault();const n=l.getEventPixel(e),s=l.getEventCoordinate(e),p=l.getFeaturesAtPixel(n);i.value=c.createDropdownOptions({event:e,pixel:n,coordinate:s,features:p}),o.value={visible:!0,x:e.clientX,y:e.clientY}};const u=(e,n)=>{const{onClick:s}=n;s&&s(),o.value.visible=!1};return(e,n)=>(t.openBlock(),t.createBlock(t.unref(d.NDropdown),{placement:"bottom-start",trigger:"manual",show:i.value&&i.value.length>0&&o.value.visible,x:o.value.x,y:o.value.y,options:i.value,"on-clickoutside":r,onSelect:u},null,8,["show","x","y","options"]))}});exports.default=v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./n-ol-contextmenu.vue.js");exports.default=e.default;
@@ -0,0 +1,15 @@
1
+ import { Map as OLMap } from 'ol';
2
+ import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
3
+ import { Pixel } from 'ol/pixel';
4
+ import { Coordinate } from 'ol/coordinate';
5
+ import { FeatureLike } from 'ol/Feature';
6
+ export interface Options {
7
+ event: MouseEvent;
8
+ pixel: Pixel;
9
+ coordinate: Coordinate;
10
+ features: FeatureLike[];
11
+ }
12
+ export interface Props {
13
+ olMap: OLMap;
14
+ createDropdownOptions: (options: Options) => DropdownMixedOption[];
15
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./components/ol-contextmenu/n-ol-contextmenu.vue.js");exports.NOlContextmenu=e.default;
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@summeruse/ol",
3
+ "version": "0.0.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "module": "es/index.mjs",
8
+ "unpkg": "dist/index.js",
9
+ "jsdelivr": "dist/index.js",
10
+ "types": "es/index.d.ts",
11
+ "files": [
12
+ "README.md",
13
+ "dist",
14
+ "es",
15
+ "lib"
16
+ ],
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "vue": "^3.5.13"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.13.14",
25
+ "@vitejs/plugin-vue": "^5.2.1",
26
+ "@vue/tsconfig": "^0.7.0",
27
+ "naive-ui": "^2.41.0",
28
+ "ol": "^10.4.0",
29
+ "typescript": "~5.7.2",
30
+ "vite": "^6.2.0",
31
+ "vite-plugin-dts": "^4.5.3",
32
+ "vue-tsc": "^2.2.4"
33
+ },
34
+ "peerDependencies": {
35
+ "naive-ui": "^2.41.0",
36
+ "ol": "^10.4.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "scripts": {
42
+ "build": "vue-tsc -b && vite build"
43
+ }
44
+ }