@octostar/map-component 0.3.5 → 0.3.7
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.cjs +67 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +69 -22
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -0
- package/dist/types/components/map-context-menu.d.ts +16 -0
- package/dist/types/components/map-context-menu.d.ts.map +1 -0
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/lib/context-menu-placement.d.ts +33 -0
- package/dist/types/lib/context-menu-placement.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -333,6 +333,7 @@ body{--tw-bg-opacity:1;background-color:hsl(var(--background) / var(--tw-bg-opac
|
|
|
333
333
|
.max-h-96{max-height:24rem}
|
|
334
334
|
.max-h-\[80vh\]{max-height:80vh}
|
|
335
335
|
.max-h-\[calc\(100\%-5\.5rem\)\]{max-height:calc(100% - 5.5rem)}
|
|
336
|
+
.max-h-full{max-height:100%}
|
|
336
337
|
.min-h-0{min-height:0px}
|
|
337
338
|
.min-h-screen{min-height:100vh}
|
|
338
339
|
.\!w-10{width:2.5rem !important}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ContextMenuItem } from '@/lib/map-editor-api';
|
|
2
|
+
interface MapContextMenuProps {
|
|
3
|
+
/** Viewport point the menu opens at (the event's `clientX`/`clientY`). */
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
items: ContextMenuItem[];
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Absolutely positioned in the map container rather than `fixed`: a host
|
|
11
|
+
* ancestor with a transform, filter or containment re-bases `fixed`, which
|
|
12
|
+
* opened the menu away from the cursor.
|
|
13
|
+
*/
|
|
14
|
+
export declare function MapContextMenu({ x, y, items, onClose }: MapContextMenuProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=map-context-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-context-menu.d.ts","sourceRoot":"","sources":["../../../client/src/components/map-context-menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,UAAU,mBAAmB;IAC3B,0EAA0E;IAC1E,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mBAAmB,+BAoD3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-editor-canvas.d.ts","sourceRoot":"","sources":["../../../client/src/components/map-editor-canvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"map-editor-canvas.d.ts","sourceRoot":"","sources":["../../../client/src/components/map-editor-canvas.tsx"],"names":[],"mappings":"AA4HA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gDAAgD,CAAC;AAgSxD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA2D5E,eAAO,MAAM,eAAe,4GAszS1B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface MenuParentMetrics {
|
|
2
|
+
/** `getBoundingClientRect()` of the menu's offset parent, in viewport pixels. */
|
|
3
|
+
rect: {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
offsetWidth: number;
|
|
10
|
+
offsetHeight: number;
|
|
11
|
+
clientLeft: number;
|
|
12
|
+
clientTop: number;
|
|
13
|
+
clientWidth: number;
|
|
14
|
+
clientHeight: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Converts a viewport point (a mouse event's `clientX`/`clientY`) into
|
|
18
|
+
* `left`/`top` for a menu absolutely positioned in `parent`. The parent's
|
|
19
|
+
* rect-to-layout ratio undoes any CSS zoom or scale transform above it. Where
|
|
20
|
+
* the menu would overflow the parent's padding box it opens on the other side
|
|
21
|
+
* of the point, like a native context menu, and it never leaves that box.
|
|
22
|
+
*/
|
|
23
|
+
export declare function placeContextMenu(point: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}, parent: MenuParentMetrics, menu: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}): {
|
|
30
|
+
left: number;
|
|
31
|
+
top: number;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=context-menu-placement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu-placement.d.ts","sourceRoot":"","sources":["../../../client/src/lib/context-menu-placement.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAC/B,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAS/B"}
|