@nice2dev/icons-cursor 1.0.10
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/README.md +241 -0
- package/dist/createCursorIcon-CCO9eeBk.mjs +170 -0
- package/dist/createCursorIcon-CCO9eeBk.mjs.map +1 -0
- package/dist/createCursorIcon-Crwdo_Qk.js +169 -0
- package/dist/createCursorIcon-Crwdo_Qk.js.map +1 -0
- package/dist/createCursorIcon.d.ts +11 -0
- package/dist/createCursorIcon.d.ts.map +1 -0
- package/dist/cursorBuilder.d.ts +242 -0
- package/dist/cursorBuilder.d.ts.map +1 -0
- package/dist/index.cjs +288 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +292 -0
- package/dist/index.mjs.map +1 -0
- package/dist/pointers-DW_cbtGT.mjs +90 -0
- package/dist/pointers-DW_cbtGT.mjs.map +1 -0
- package/dist/pointers-DxPqgPxN.js +89 -0
- package/dist/pointers-DxPqgPxN.js.map +1 -0
- package/dist/pointers.cjs +21 -0
- package/dist/pointers.cjs.map +1 -0
- package/dist/pointers.d.ts +36 -0
- package/dist/pointers.d.ts.map +1 -0
- package/dist/pointers.mjs +21 -0
- package/dist/pointers.mjs.map +1 -0
- package/dist/selection-CINU3bsI.js +101 -0
- package/dist/selection-CINU3bsI.js.map +1 -0
- package/dist/selection-W-1ZhqSv.mjs +102 -0
- package/dist/selection-W-1ZhqSv.mjs.map +1 -0
- package/dist/selection.cjs +21 -0
- package/dist/selection.cjs.map +1 -0
- package/dist/selection.d.ts +36 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.mjs +21 -0
- package/dist/selection.mjs.map +1 -0
- package/dist/status-BBrDqBw_.mjs +111 -0
- package/dist/status-BBrDqBw_.mjs.map +1 -0
- package/dist/status-L6N47QMq.js +110 -0
- package/dist/status-L6N47QMq.js.map +1 -0
- package/dist/status.cjs +21 -0
- package/dist/status.cjs.map +1 -0
- package/dist/status.d.ts +36 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.mjs +21 -0
- package/dist/status.mjs.map +1 -0
- package/dist/tools-DbPCbk54.mjs +108 -0
- package/dist/tools-DbPCbk54.mjs.map +1 -0
- package/dist/tools-ttgDzC_5.js +107 -0
- package/dist/tools-ttgDzC_5.js.map +1 -0
- package/dist/tools.cjs +21 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.ts +36 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.mjs +21 -0
- package/dist/tools.mjs.map +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nice2dev/icons-cursor
|
|
3
|
+
* Cursor and pointer icons for NiceToDev UI
|
|
4
|
+
*
|
|
5
|
+
* Provides 60 cursor-related icons organized into 4 categories:
|
|
6
|
+
* - Pointers: Basic cursor shapes and resize handles (15 icons)
|
|
7
|
+
* - Selection: Text/cell selection and drag cursors (15 icons)
|
|
8
|
+
* - Tools: Drawing and editing tool cursors (15 icons)
|
|
9
|
+
* - Status: System state indicators (15 icons)
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export type { CursorIconProps, CursorIconAnimation, CursorIconVariant, CursorIcon, CursorIconName, PointerIconName, SelectionIconName, ToolIconName, StatusIconName, } from './types';
|
|
14
|
+
export { createCursorIcon, getCursorAnimation } from './createCursorIcon';
|
|
15
|
+
export { buildCursor, buildCursors, createCursorBuilder, generateCursorCSS, useCursor, useCursors, createCursorTheme, applyCursorTheme, getDefaultHotspot, DEFAULT_HOTSPOTS, } from './cursorBuilder';
|
|
16
|
+
export type { CursorHotspot, CursorBuilderOptions, CursorBuilderResult, CursorTheme, } from './cursorBuilder';
|
|
17
|
+
import * as pointers from './pointers';
|
|
18
|
+
import * as selection from './selection';
|
|
19
|
+
import * as status from './status';
|
|
20
|
+
import * as tools from './tools';
|
|
21
|
+
export { pointers, selection, tools, status };
|
|
22
|
+
export { Pointer, PointerFinger, Crosshair, Move, ResizeN, ResizeS, ResizeE, ResizeW, ResizeNE, ResizeNW, ResizeSE, ResizeSW, ResizeHorizontal, ResizeVertical, ResizeAll, pointerIcons, } from './pointers';
|
|
23
|
+
export { TextCursor, TextSelect, CellSelection, ColumnSelect, RowSelect, RangeSelect, Grab, Grabbing, Drag, DragHandle, Lasso, MagicWand, SelectAll, Deselect, InvertSelection, selectionIcons, } from './selection';
|
|
24
|
+
export { ZoomIn, ZoomOut, Rotate, Pan, Draw, Brush, Eraser, Eyedropper, Bucket, Pen, Line, Rectangle, Ellipse, Polygon, Crop, toolIcons, } from './tools';
|
|
25
|
+
export { Wait, Progress, Forbidden, NotAllowed, Help, ContextMenu, Alias, Copy, NoDrop, Loading, Busy, Default, Auto, None, Inherit, statusIcons, } from './status';
|
|
26
|
+
/**
|
|
27
|
+
* All cursor icons in a single object
|
|
28
|
+
*/
|
|
29
|
+
export declare const allCursorIcons: {
|
|
30
|
+
readonly Wait: import('./types').CursorIcon;
|
|
31
|
+
readonly Progress: import('./types').CursorIcon;
|
|
32
|
+
readonly Forbidden: import('./types').CursorIcon;
|
|
33
|
+
readonly NotAllowed: import('./types').CursorIcon;
|
|
34
|
+
readonly Help: import('./types').CursorIcon;
|
|
35
|
+
readonly ContextMenu: import('./types').CursorIcon;
|
|
36
|
+
readonly Alias: import('./types').CursorIcon;
|
|
37
|
+
readonly Copy: import('./types').CursorIcon;
|
|
38
|
+
readonly NoDrop: import('./types').CursorIcon;
|
|
39
|
+
readonly Loading: import('./types').CursorIcon;
|
|
40
|
+
readonly Busy: import('./types').CursorIcon;
|
|
41
|
+
readonly Default: import('./types').CursorIcon;
|
|
42
|
+
readonly Auto: import('./types').CursorIcon;
|
|
43
|
+
readonly None: import('./types').CursorIcon;
|
|
44
|
+
readonly Inherit: import('./types').CursorIcon;
|
|
45
|
+
readonly ZoomIn: import('./types').CursorIcon;
|
|
46
|
+
readonly ZoomOut: import('./types').CursorIcon;
|
|
47
|
+
readonly Rotate: import('./types').CursorIcon;
|
|
48
|
+
readonly Pan: import('./types').CursorIcon;
|
|
49
|
+
readonly Draw: import('./types').CursorIcon;
|
|
50
|
+
readonly Brush: import('./types').CursorIcon;
|
|
51
|
+
readonly Eraser: import('./types').CursorIcon;
|
|
52
|
+
readonly Eyedropper: import('./types').CursorIcon;
|
|
53
|
+
readonly Bucket: import('./types').CursorIcon;
|
|
54
|
+
readonly Pen: import('./types').CursorIcon;
|
|
55
|
+
readonly Line: import('./types').CursorIcon;
|
|
56
|
+
readonly Rectangle: import('./types').CursorIcon;
|
|
57
|
+
readonly Ellipse: import('./types').CursorIcon;
|
|
58
|
+
readonly Polygon: import('./types').CursorIcon;
|
|
59
|
+
readonly Crop: import('./types').CursorIcon;
|
|
60
|
+
readonly TextCursor: import('./types').CursorIcon;
|
|
61
|
+
readonly TextSelect: import('./types').CursorIcon;
|
|
62
|
+
readonly CellSelection: import('./types').CursorIcon;
|
|
63
|
+
readonly ColumnSelect: import('./types').CursorIcon;
|
|
64
|
+
readonly RowSelect: import('./types').CursorIcon;
|
|
65
|
+
readonly RangeSelect: import('./types').CursorIcon;
|
|
66
|
+
readonly Grab: import('./types').CursorIcon;
|
|
67
|
+
readonly Grabbing: import('./types').CursorIcon;
|
|
68
|
+
readonly Drag: import('./types').CursorIcon;
|
|
69
|
+
readonly DragHandle: import('./types').CursorIcon;
|
|
70
|
+
readonly Lasso: import('./types').CursorIcon;
|
|
71
|
+
readonly MagicWand: import('./types').CursorIcon;
|
|
72
|
+
readonly SelectAll: import('./types').CursorIcon;
|
|
73
|
+
readonly Deselect: import('./types').CursorIcon;
|
|
74
|
+
readonly InvertSelection: import('./types').CursorIcon;
|
|
75
|
+
readonly Pointer: import('./types').CursorIcon;
|
|
76
|
+
readonly PointerFinger: import('./types').CursorIcon;
|
|
77
|
+
readonly Crosshair: import('./types').CursorIcon;
|
|
78
|
+
readonly Move: import('./types').CursorIcon;
|
|
79
|
+
readonly ResizeN: import('./types').CursorIcon;
|
|
80
|
+
readonly ResizeS: import('./types').CursorIcon;
|
|
81
|
+
readonly ResizeE: import('./types').CursorIcon;
|
|
82
|
+
readonly ResizeW: import('./types').CursorIcon;
|
|
83
|
+
readonly ResizeNE: import('./types').CursorIcon;
|
|
84
|
+
readonly ResizeNW: import('./types').CursorIcon;
|
|
85
|
+
readonly ResizeSE: import('./types').CursorIcon;
|
|
86
|
+
readonly ResizeSW: import('./types').CursorIcon;
|
|
87
|
+
readonly ResizeHorizontal: import('./types').CursorIcon;
|
|
88
|
+
readonly ResizeVertical: import('./types').CursorIcon;
|
|
89
|
+
readonly ResizeAll: import('./types').CursorIcon;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Icon count by category
|
|
93
|
+
*/
|
|
94
|
+
export declare const CURSOR_ICON_COUNTS: {
|
|
95
|
+
readonly pointers: 15;
|
|
96
|
+
readonly selection: 15;
|
|
97
|
+
readonly tools: 15;
|
|
98
|
+
readonly status: 15;
|
|
99
|
+
readonly total: 60;
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG1E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,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MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { c, g } from "./createCursorIcon-CCO9eeBk.mjs";
|
|
2
|
+
import { createElement, useMemo, useState } from "react";
|
|
3
|
+
import { p as pointerIcons } from "./pointers-DW_cbtGT.mjs";
|
|
4
|
+
import { C, M, P, a, R, b, c as c2, d, e, f, g as g2, h, i, j, k, l } from "./pointers-DW_cbtGT.mjs";
|
|
5
|
+
import { s as selectionIcons } from "./selection-W-1ZhqSv.mjs";
|
|
6
|
+
import { C as C2, a as a2, D, b as b2, c as c3, G, d as d2, I, L, M as M2, R as R2, e as e2, S, T, f as f2, g as g3 } from "./selection-W-1ZhqSv.mjs";
|
|
7
|
+
import { s as statusIcons } from "./status-BBrDqBw_.mjs";
|
|
8
|
+
import { A, a as a3, B, C as C3, b as b3, D as D2, F, H, I as I2, L as L2, N, c as c4, d as d3, P as P2, W, e as e3 } from "./status-BBrDqBw_.mjs";
|
|
9
|
+
import { t as toolIcons } from "./tools-DbPCbk54.mjs";
|
|
10
|
+
import { B as B2, a as a4, C as C4, D as D3, E, b as b4, c as c5, L as L3, P as P3, d as d4, e as e4, R as R3, f as f3, Z, g as g4, h as h2 } from "./tools-DbPCbk54.mjs";
|
|
11
|
+
let cachedRenderer = null;
|
|
12
|
+
function getRenderer() {
|
|
13
|
+
if (cachedRenderer) {
|
|
14
|
+
return cachedRenderer;
|
|
15
|
+
}
|
|
16
|
+
const reactDomServer = require("react-dom/server");
|
|
17
|
+
cachedRenderer = reactDomServer.renderToStaticMarkup;
|
|
18
|
+
return cachedRenderer;
|
|
19
|
+
}
|
|
20
|
+
const DEFAULT_HOTSPOTS = {
|
|
21
|
+
// Pointer at tip (top-left)
|
|
22
|
+
pointer: { x: 0, y: 0 },
|
|
23
|
+
pointerFinger: { x: 0.35, y: 0 },
|
|
24
|
+
// Crosshair at center
|
|
25
|
+
crosshair: { x: 0.5, y: 0.5 },
|
|
26
|
+
// Move cursor at center
|
|
27
|
+
move: { x: 0.5, y: 0.5 },
|
|
28
|
+
// Resize cursors at center
|
|
29
|
+
resize: { x: 0.5, y: 0.5 },
|
|
30
|
+
// Text cursor at center-bottom
|
|
31
|
+
text: { x: 0.5, y: 0.9 },
|
|
32
|
+
// Grab/grabbing at palm center
|
|
33
|
+
grab: { x: 0.5, y: 0.4 },
|
|
34
|
+
// Drawing tools at tool tip
|
|
35
|
+
pen: { x: 0.1, y: 0.9 },
|
|
36
|
+
brush: { x: 0.15, y: 0.85 },
|
|
37
|
+
eraser: { x: 0.15, y: 0.85 },
|
|
38
|
+
eyedropper: { x: 0.05, y: 0.95 },
|
|
39
|
+
bucket: { x: 0.1, y: 0.85 },
|
|
40
|
+
// Zoom at center of glass
|
|
41
|
+
zoom: { x: 0.35, y: 0.35 },
|
|
42
|
+
// Pan at center
|
|
43
|
+
pan: { x: 0.5, y: 0.5 },
|
|
44
|
+
// Default fallback
|
|
45
|
+
default: { x: 0, y: 0 }
|
|
46
|
+
};
|
|
47
|
+
function getDefaultHotspot(iconName) {
|
|
48
|
+
const name = iconName.toLowerCase();
|
|
49
|
+
if (name.includes("pointer") || name.includes("finger")) {
|
|
50
|
+
return name.includes("finger") ? DEFAULT_HOTSPOTS.pointerFinger : DEFAULT_HOTSPOTS.pointer;
|
|
51
|
+
}
|
|
52
|
+
if (name.includes("crosshair")) {
|
|
53
|
+
return DEFAULT_HOTSPOTS.crosshair;
|
|
54
|
+
}
|
|
55
|
+
if (name.includes("move")) {
|
|
56
|
+
return DEFAULT_HOTSPOTS.move;
|
|
57
|
+
}
|
|
58
|
+
if (name.includes("resize")) {
|
|
59
|
+
return DEFAULT_HOTSPOTS.resize;
|
|
60
|
+
}
|
|
61
|
+
if (name.includes("text") || name.includes("cursor")) {
|
|
62
|
+
return DEFAULT_HOTSPOTS.text;
|
|
63
|
+
}
|
|
64
|
+
if (name.includes("grab")) {
|
|
65
|
+
return DEFAULT_HOTSPOTS.grab;
|
|
66
|
+
}
|
|
67
|
+
if (name.includes("pen") || name.includes("line")) {
|
|
68
|
+
return DEFAULT_HOTSPOTS.pen;
|
|
69
|
+
}
|
|
70
|
+
if (name.includes("brush") || name.includes("draw")) {
|
|
71
|
+
return DEFAULT_HOTSPOTS.brush;
|
|
72
|
+
}
|
|
73
|
+
if (name.includes("eraser")) {
|
|
74
|
+
return DEFAULT_HOTSPOTS.eraser;
|
|
75
|
+
}
|
|
76
|
+
if (name.includes("eyedropper") || name.includes("picker")) {
|
|
77
|
+
return DEFAULT_HOTSPOTS.eyedropper;
|
|
78
|
+
}
|
|
79
|
+
if (name.includes("bucket") || name.includes("fill")) {
|
|
80
|
+
return DEFAULT_HOTSPOTS.bucket;
|
|
81
|
+
}
|
|
82
|
+
if (name.includes("zoom")) {
|
|
83
|
+
return DEFAULT_HOTSPOTS.zoom;
|
|
84
|
+
}
|
|
85
|
+
if (name.includes("pan")) {
|
|
86
|
+
return DEFAULT_HOTSPOTS.pan;
|
|
87
|
+
}
|
|
88
|
+
return DEFAULT_HOTSPOTS.default;
|
|
89
|
+
}
|
|
90
|
+
function buildCursor(IconComponent, options = {}) {
|
|
91
|
+
const {
|
|
92
|
+
size = 32,
|
|
93
|
+
color = "#000",
|
|
94
|
+
secondaryColor,
|
|
95
|
+
hotspot,
|
|
96
|
+
fallback = "auto",
|
|
97
|
+
variant = "filled"
|
|
98
|
+
} = options;
|
|
99
|
+
const renderToMarkup = getRenderer();
|
|
100
|
+
const element = createElement(IconComponent, {
|
|
101
|
+
size,
|
|
102
|
+
color,
|
|
103
|
+
secondaryColor,
|
|
104
|
+
variant
|
|
105
|
+
});
|
|
106
|
+
const svgMarkup = renderToMarkup(element);
|
|
107
|
+
const base64 = typeof btoa === "function" ? btoa(unescape(encodeURIComponent(svgMarkup))) : Buffer.from(svgMarkup, "utf8").toString("base64");
|
|
108
|
+
const dataUri = `data:image/svg+xml;base64,${base64}`;
|
|
109
|
+
const componentName = IconComponent.displayName || IconComponent.name || "default";
|
|
110
|
+
const normalizedHotspot = hotspot || getDefaultHotspot(componentName);
|
|
111
|
+
const actualHotspot = {
|
|
112
|
+
x: Math.round(normalizedHotspot.x * size),
|
|
113
|
+
y: Math.round(normalizedHotspot.y * size)
|
|
114
|
+
};
|
|
115
|
+
if (hotspot && (hotspot.x > 1 || hotspot.y > 1)) {
|
|
116
|
+
actualHotspot.x = Math.round(hotspot.x);
|
|
117
|
+
actualHotspot.y = Math.round(hotspot.y);
|
|
118
|
+
}
|
|
119
|
+
const cursor = `url(${dataUri}) ${actualHotspot.x} ${actualHotspot.y}, ${fallback}`;
|
|
120
|
+
return {
|
|
121
|
+
cursor,
|
|
122
|
+
dataUri,
|
|
123
|
+
hotspot: actualHotspot,
|
|
124
|
+
size
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function createCursorBuilder(IconComponent) {
|
|
128
|
+
return (options) => buildCursor(IconComponent, options);
|
|
129
|
+
}
|
|
130
|
+
function buildCursors(icons, sharedOptions = {}) {
|
|
131
|
+
const result = {};
|
|
132
|
+
for (const [name, IconComponent] of Object.entries(icons)) {
|
|
133
|
+
result[name] = buildCursor(IconComponent, sharedOptions).cursor;
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
function generateCursorCSS(icons, options = {}, prefix = "--cursor") {
|
|
138
|
+
const cursors = buildCursors(icons, options);
|
|
139
|
+
const properties = Object.entries(cursors).map(([name, value]) => ` ${prefix}-${name}: ${value};`).join("\n");
|
|
140
|
+
return `:root {
|
|
141
|
+
${properties}
|
|
142
|
+
}`;
|
|
143
|
+
}
|
|
144
|
+
function useCursor(IconComponent, options = {}) {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const cursor = useMemo(() => {
|
|
147
|
+
if (!IconComponent) {
|
|
148
|
+
return "auto";
|
|
149
|
+
}
|
|
150
|
+
return buildCursor(IconComponent, options).cursor;
|
|
151
|
+
}, [
|
|
152
|
+
IconComponent,
|
|
153
|
+
options.size,
|
|
154
|
+
options.color,
|
|
155
|
+
(_a = options.hotspot) == null ? void 0 : _a.x,
|
|
156
|
+
(_b = options.hotspot) == null ? void 0 : _b.y,
|
|
157
|
+
options.fallback,
|
|
158
|
+
options.variant,
|
|
159
|
+
options.secondaryColor
|
|
160
|
+
]);
|
|
161
|
+
return { cursor };
|
|
162
|
+
}
|
|
163
|
+
function useCursors(cursors, options = {}) {
|
|
164
|
+
const cursorMap = useMemo(
|
|
165
|
+
() => buildCursors(cursors, options),
|
|
166
|
+
[cursors, options.size, options.color, options.variant]
|
|
167
|
+
);
|
|
168
|
+
const [activeCursor, setActiveCursor] = useState(null);
|
|
169
|
+
const style = useMemo(
|
|
170
|
+
() => ({
|
|
171
|
+
cursor: activeCursor ? cursorMap[activeCursor] : "auto"
|
|
172
|
+
}),
|
|
173
|
+
[activeCursor, cursorMap]
|
|
174
|
+
);
|
|
175
|
+
return [style, setActiveCursor, cursorMap];
|
|
176
|
+
}
|
|
177
|
+
function createCursorTheme(theme, options = {}) {
|
|
178
|
+
const result = {};
|
|
179
|
+
for (const [key, IconComponent] of Object.entries(theme)) {
|
|
180
|
+
if (IconComponent) {
|
|
181
|
+
result[key] = buildCursor(IconComponent, options).cursor;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
function applyCursorTheme(theme, prefix = "--cursor") {
|
|
187
|
+
if (typeof document === "undefined") {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const root = document.documentElement;
|
|
191
|
+
for (const [name, value] of Object.entries(theme)) {
|
|
192
|
+
root.style.setProperty(`${prefix}-${name}`, value);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const allCursorIcons = {
|
|
196
|
+
...pointerIcons,
|
|
197
|
+
...selectionIcons,
|
|
198
|
+
...toolIcons,
|
|
199
|
+
...statusIcons
|
|
200
|
+
};
|
|
201
|
+
const CURSOR_ICON_COUNTS = {
|
|
202
|
+
pointers: 15,
|
|
203
|
+
selection: 15,
|
|
204
|
+
tools: 15,
|
|
205
|
+
status: 15,
|
|
206
|
+
total: 60
|
|
207
|
+
};
|
|
208
|
+
export {
|
|
209
|
+
A as Alias,
|
|
210
|
+
a3 as Auto,
|
|
211
|
+
B2 as Brush,
|
|
212
|
+
a4 as Bucket,
|
|
213
|
+
B as Busy,
|
|
214
|
+
CURSOR_ICON_COUNTS,
|
|
215
|
+
C2 as CellSelection,
|
|
216
|
+
a2 as ColumnSelect,
|
|
217
|
+
C3 as ContextMenu,
|
|
218
|
+
b3 as Copy,
|
|
219
|
+
C4 as Crop,
|
|
220
|
+
C as Crosshair,
|
|
221
|
+
DEFAULT_HOTSPOTS,
|
|
222
|
+
D2 as Default,
|
|
223
|
+
D as Deselect,
|
|
224
|
+
b2 as Drag,
|
|
225
|
+
c3 as DragHandle,
|
|
226
|
+
D3 as Draw,
|
|
227
|
+
E as Ellipse,
|
|
228
|
+
b4 as Eraser,
|
|
229
|
+
c5 as Eyedropper,
|
|
230
|
+
F as Forbidden,
|
|
231
|
+
G as Grab,
|
|
232
|
+
d2 as Grabbing,
|
|
233
|
+
H as Help,
|
|
234
|
+
I2 as Inherit,
|
|
235
|
+
I as InvertSelection,
|
|
236
|
+
L as Lasso,
|
|
237
|
+
L3 as Line,
|
|
238
|
+
L2 as Loading,
|
|
239
|
+
M2 as MagicWand,
|
|
240
|
+
M as Move,
|
|
241
|
+
N as NoDrop,
|
|
242
|
+
c4 as None,
|
|
243
|
+
d3 as NotAllowed,
|
|
244
|
+
P3 as Pan,
|
|
245
|
+
d4 as Pen,
|
|
246
|
+
P as Pointer,
|
|
247
|
+
a as PointerFinger,
|
|
248
|
+
e4 as Polygon,
|
|
249
|
+
P2 as Progress,
|
|
250
|
+
R2 as RangeSelect,
|
|
251
|
+
R3 as Rectangle,
|
|
252
|
+
R as ResizeAll,
|
|
253
|
+
b as ResizeE,
|
|
254
|
+
c2 as ResizeHorizontal,
|
|
255
|
+
d as ResizeN,
|
|
256
|
+
e as ResizeNE,
|
|
257
|
+
f as ResizeNW,
|
|
258
|
+
g2 as ResizeS,
|
|
259
|
+
h as ResizeSE,
|
|
260
|
+
i as ResizeSW,
|
|
261
|
+
j as ResizeVertical,
|
|
262
|
+
k as ResizeW,
|
|
263
|
+
f3 as Rotate,
|
|
264
|
+
e2 as RowSelect,
|
|
265
|
+
S as SelectAll,
|
|
266
|
+
T as TextCursor,
|
|
267
|
+
f2 as TextSelect,
|
|
268
|
+
W as Wait,
|
|
269
|
+
Z as ZoomIn,
|
|
270
|
+
g4 as ZoomOut,
|
|
271
|
+
allCursorIcons,
|
|
272
|
+
applyCursorTheme,
|
|
273
|
+
buildCursor,
|
|
274
|
+
buildCursors,
|
|
275
|
+
createCursorBuilder,
|
|
276
|
+
c as createCursorIcon,
|
|
277
|
+
createCursorTheme,
|
|
278
|
+
generateCursorCSS,
|
|
279
|
+
g as getCursorAnimation,
|
|
280
|
+
getDefaultHotspot,
|
|
281
|
+
pointerIcons,
|
|
282
|
+
l as pointers,
|
|
283
|
+
g3 as selection,
|
|
284
|
+
selectionIcons,
|
|
285
|
+
e3 as status,
|
|
286
|
+
statusIcons,
|
|
287
|
+
toolIcons,
|
|
288
|
+
h2 as tools,
|
|
289
|
+
useCursor,
|
|
290
|
+
useCursors
|
|
291
|
+
};
|
|
292
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/cursorBuilder.tsx","../src/index.ts"],"sourcesContent":["/**\r\n * @file cursorBuilder.tsx\r\n * @description Utilities to convert cursor icons to CSS cursor values\r\n *\r\n * This module provides functions to transform SVG cursor icons into\r\n * usable CSS cursor definitions with customizable hotspots.\r\n */\r\n\r\nimport { createElement, useMemo, useState } from 'react';\r\nimport type { CSSProperties, FC, ReactNode } from 'react';\r\n\r\nimport type { CursorIcon, CursorIconProps } from './types';\r\n\r\n// Type for renderToStaticMarkup function\r\ntype RenderFn = (element: ReactNode) => string;\r\n\r\n// Lazy loaded renderer\r\nlet cachedRenderer: RenderFn | null = null;\r\n\r\n/**\r\n * Get the react-dom/server renderer.\r\n * Uses dynamic require for compatibility with bundlers.\r\n */\r\nfunction getRenderer(): RenderFn {\r\n if (cachedRenderer) {\r\n return cachedRenderer;\r\n }\r\n\r\n // Dynamic import at runtime\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const reactDomServer = require('react-dom/server') as { renderToStaticMarkup: RenderFn };\r\n cachedRenderer = reactDomServer.renderToStaticMarkup;\r\n return cachedRenderer;\r\n}\r\n\r\n/* ─── Types ─── */\r\n\r\n/**\r\n * Cursor hotspot position (where the click is registered)\r\n */\r\nexport interface CursorHotspot {\r\n /** X coordinate of hotspot (0-based, measured from left) */\r\n x: number;\r\n /** Y coordinate of hotspot (0-based, measured from top) */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Options for building a CSS cursor\r\n */\r\nexport interface CursorBuilderOptions {\r\n /** Icon size in pixels (default: 32) */\r\n size?: number;\r\n /** Icon color (default: #000) */\r\n color?: string;\r\n /** Secondary color for duotone variant */\r\n secondaryColor?: string;\r\n /** Hotspot position (default: { x: 0, y: 0 }) */\r\n hotspot?: CursorHotspot;\r\n /** Fallback CSS cursor value (default: 'auto') */\r\n fallback?: string;\r\n /** Icon variant */\r\n variant?: CursorIconProps['variant'];\r\n}\r\n\r\n/**\r\n * Result from building a cursor\r\n */\r\nexport interface CursorBuilderResult {\r\n /** The CSS cursor value (data URI + fallback) */\r\n cursor: string;\r\n /** The data URI only */\r\n dataUri: string;\r\n /** The hotspot used */\r\n hotspot: CursorHotspot;\r\n /** The size used */\r\n size: number;\r\n}\r\n\r\n/* ─── Default Hotspots ─── */\r\n\r\n/**\r\n * Default hotspot positions for common cursor types.\r\n * Values are normalized (0-1), will be multiplied by size.\r\n */\r\nexport const DEFAULT_HOTSPOTS: Record<string, CursorHotspot> = {\r\n // Pointer at tip (top-left)\r\n pointer: { x: 0, y: 0 },\r\n pointerFinger: { x: 0.35, y: 0 },\r\n\r\n // Crosshair at center\r\n crosshair: { x: 0.5, y: 0.5 },\r\n\r\n // Move cursor at center\r\n move: { x: 0.5, y: 0.5 },\r\n\r\n // Resize cursors at center\r\n resize: { x: 0.5, y: 0.5 },\r\n\r\n // Text cursor at center-bottom\r\n text: { x: 0.5, y: 0.9 },\r\n\r\n // Grab/grabbing at palm center\r\n grab: { x: 0.5, y: 0.4 },\r\n\r\n // Drawing tools at tool tip\r\n pen: { x: 0.1, y: 0.9 },\r\n brush: { x: 0.15, y: 0.85 },\r\n eraser: { x: 0.15, y: 0.85 },\r\n eyedropper: { x: 0.05, y: 0.95 },\r\n bucket: { x: 0.1, y: 0.85 },\r\n\r\n // Zoom at center of glass\r\n zoom: { x: 0.35, y: 0.35 },\r\n\r\n // Pan at center\r\n pan: { x: 0.5, y: 0.5 },\r\n\r\n // Default fallback\r\n default: { x: 0, y: 0 },\r\n};\r\n\r\n/**\r\n * Get normalized hotspot for an icon by name\r\n */\r\nexport function getDefaultHotspot(iconName: string): CursorHotspot {\r\n const name = iconName.toLowerCase();\r\n\r\n if (name.includes('pointer') || name.includes('finger')) {\r\n return name.includes('finger') ? DEFAULT_HOTSPOTS.pointerFinger : DEFAULT_HOTSPOTS.pointer;\r\n }\r\n if (name.includes('crosshair')) {\r\n return DEFAULT_HOTSPOTS.crosshair;\r\n }\r\n if (name.includes('move')) {\r\n return DEFAULT_HOTSPOTS.move;\r\n }\r\n if (name.includes('resize')) {\r\n return DEFAULT_HOTSPOTS.resize;\r\n }\r\n if (name.includes('text') || name.includes('cursor')) {\r\n return DEFAULT_HOTSPOTS.text;\r\n }\r\n if (name.includes('grab')) {\r\n return DEFAULT_HOTSPOTS.grab;\r\n }\r\n if (name.includes('pen') || name.includes('line')) {\r\n return DEFAULT_HOTSPOTS.pen;\r\n }\r\n if (name.includes('brush') || name.includes('draw')) {\r\n return DEFAULT_HOTSPOTS.brush;\r\n }\r\n if (name.includes('eraser')) {\r\n return DEFAULT_HOTSPOTS.eraser;\r\n }\r\n if (name.includes('eyedropper') || name.includes('picker')) {\r\n return DEFAULT_HOTSPOTS.eyedropper;\r\n }\r\n if (name.includes('bucket') || name.includes('fill')) {\r\n return DEFAULT_HOTSPOTS.bucket;\r\n }\r\n if (name.includes('zoom')) {\r\n return DEFAULT_HOTSPOTS.zoom;\r\n }\r\n if (name.includes('pan')) {\r\n return DEFAULT_HOTSPOTS.pan;\r\n }\r\n\r\n return DEFAULT_HOTSPOTS.default;\r\n}\r\n\r\n/* ─── Core Builder Function ─── */\r\n\r\n/**\r\n * Convert an SVG cursor icon to a CSS cursor value.\r\n *\r\n * @param IconComponent - The cursor icon React component\r\n * @param options - Cursor building options\r\n * @returns CSS cursor value with data URI and fallback\r\n *\r\n * @example\r\n * ```tsx\r\n * import { Pointer, buildCursor } from '@nice2dev/icons-cursor';\r\n *\r\n * const { cursor } = buildCursor(Pointer, {\r\n * size: 32,\r\n * color: '#333',\r\n * hotspot: { x: 0, y: 0 }\r\n * });\r\n *\r\n * // Use in styles\r\n * <div style={{ cursor }} />\r\n * ```\r\n */\r\nexport function buildCursor(\r\n IconComponent: CursorIcon,\r\n options: CursorBuilderOptions = {},\r\n): CursorBuilderResult {\r\n const {\r\n size = 32,\r\n color = '#000',\r\n secondaryColor,\r\n hotspot,\r\n fallback = 'auto',\r\n variant = 'filled',\r\n } = options;\r\n\r\n // Render the icon to static SVG markup\r\n const renderToMarkup = getRenderer();\r\n const element = createElement(IconComponent, {\r\n size,\r\n color,\r\n secondaryColor,\r\n variant,\r\n });\r\n const svgMarkup = renderToMarkup(element);\r\n\r\n // Convert to data URI (use base64 for better compatibility)\r\n const base64 =\r\n typeof btoa === 'function'\r\n ? btoa(unescape(encodeURIComponent(svgMarkup)))\r\n : Buffer.from(svgMarkup, 'utf8').toString('base64');\r\n\r\n const dataUri = `data:image/svg+xml;base64,${base64}`;\r\n\r\n // Calculate hotspot (use default based on component name if not provided)\r\n const componentName =\r\n (IconComponent as FC & { displayName?: string }).displayName || IconComponent.name || 'default';\r\n const normalizedHotspot = hotspot || getDefaultHotspot(componentName);\r\n const actualHotspot: CursorHotspot = {\r\n x: Math.round(normalizedHotspot.x * size),\r\n y: Math.round(normalizedHotspot.y * size),\r\n };\r\n\r\n // If hotspot was provided without normalization (values > 1), use as-is\r\n if (hotspot && (hotspot.x > 1 || hotspot.y > 1)) {\r\n actualHotspot.x = Math.round(hotspot.x);\r\n actualHotspot.y = Math.round(hotspot.y);\r\n }\r\n\r\n // Build the CSS cursor value\r\n const cursor = `url(${dataUri}) ${actualHotspot.x} ${actualHotspot.y}, ${fallback}`;\r\n\r\n return {\r\n cursor,\r\n dataUri,\r\n hotspot: actualHotspot,\r\n size,\r\n };\r\n}\r\n\r\n/**\r\n * Create a pre-configured cursor builder for a specific icon.\r\n *\r\n * @param IconComponent - The cursor icon React component\r\n * @returns Function that takes options and returns cursor CSS\r\n *\r\n * @example\r\n * ```tsx\r\n * const penCursor = createCursorBuilder(Pen);\r\n *\r\n * // Later use with different options\r\n * const cursor1 = penCursor({ color: 'red' });\r\n * const cursor2 = penCursor({ color: 'blue', size: 48 });\r\n * ```\r\n */\r\nexport function createCursorBuilder(\r\n IconComponent: CursorIcon,\r\n): (options?: CursorBuilderOptions) => CursorBuilderResult {\r\n return (options?: CursorBuilderOptions) => buildCursor(IconComponent, options);\r\n}\r\n\r\n/* ─── Batch Builder ─── */\r\n\r\n/**\r\n * Build multiple cursors at once with shared options.\r\n *\r\n * @param icons - Map of cursor names to icon components\r\n * @param sharedOptions - Options applied to all cursors\r\n * @returns Map of cursor names to their CSS values\r\n *\r\n * @example\r\n * ```tsx\r\n * const cursors = buildCursors({\r\n * pointer: Pointer,\r\n * pen: Pen,\r\n * eraser: Eraser,\r\n * }, { size: 24, color: '#333' });\r\n *\r\n * // cursors.pointer => \"url(data:...) 0 0, auto\"\r\n * // cursors.pen => \"url(data:...) 2 22, auto\"\r\n * ```\r\n */\r\nexport function buildCursors<T extends Record<string, CursorIcon>>(\r\n icons: T,\r\n sharedOptions: CursorBuilderOptions = {},\r\n): Record<keyof T, string> {\r\n const result = {} as Record<keyof T, string>;\r\n\r\n for (const [name, IconComponent] of Object.entries(icons)) {\r\n result[name as keyof T] = buildCursor(IconComponent, sharedOptions).cursor;\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/* ─── CSS Custom Property Generator ─── */\r\n\r\n/**\r\n * Generate CSS custom properties for cursor icons.\r\n * Useful for defining cursors once and using them via CSS variables.\r\n *\r\n * @param icons - Map of cursor names to icon components\r\n * @param options - Cursor building options\r\n * @param prefix - CSS variable prefix (default: '--cursor')\r\n * @returns CSS string with custom property definitions\r\n *\r\n * @example\r\n * ```tsx\r\n * const css = generateCursorCSS({\r\n * pointer: Pointer,\r\n * pen: Pen,\r\n * });\r\n *\r\n * // Returns:\r\n * // :root {\r\n * // --cursor-pointer: url(data:...) 0 0, auto;\r\n * // --cursor-pen: url(data:...) 2 22, auto;\r\n * // }\r\n * ```\r\n */\r\nexport function generateCursorCSS<T extends Record<string, CursorIcon>>(\r\n icons: T,\r\n options: CursorBuilderOptions = {},\r\n prefix = '--cursor',\r\n): string {\r\n const cursors = buildCursors(icons, options);\r\n const properties = Object.entries(cursors)\r\n .map(([name, value]) => ` ${prefix}-${name}: ${value};`)\r\n .join('\\n');\r\n\r\n return `:root {\\n${properties}\\n}`;\r\n}\r\n\r\n/* ─── React Hook ─── */\r\n\r\n/**\r\n * Hook to apply a custom cursor to an element.\r\n * Returns style object and handlers for dynamic cursor changes.\r\n *\r\n * @param IconComponent - The cursor icon component\r\n * @param options - Cursor building options\r\n * @returns Style object with cursor property\r\n *\r\n * @example\r\n * ```tsx\r\n * function Canvas() {\r\n * const cursorStyle = useCursor(Pen, { color: 'blue' });\r\n *\r\n * return <div style={cursorStyle}>Draw here</div>;\r\n * }\r\n * ```\r\n */\r\nexport function useCursor(\r\n IconComponent: CursorIcon | null,\r\n options: CursorBuilderOptions = {},\r\n): CSSProperties {\r\n const cursor = useMemo(() => {\r\n if (!IconComponent) {\r\n return 'auto';\r\n }\r\n return buildCursor(IconComponent, options).cursor;\r\n }, [\r\n IconComponent,\r\n options.size,\r\n options.color,\r\n options.hotspot?.x,\r\n options.hotspot?.y,\r\n options.fallback,\r\n options.variant,\r\n options.secondaryColor,\r\n ]);\r\n\r\n return { cursor };\r\n}\r\n\r\n/**\r\n * Hook to manage multiple cursors with easy switching.\r\n *\r\n * @param cursors - Map of cursor names to icon components\r\n * @param options - Shared cursor building options\r\n * @returns Tuple of [currentStyle, setCursor, cursorMap]\r\n *\r\n * @example\r\n * ```tsx\r\n * function Editor() {\r\n * const [style, setCursor, cursors] = useCursors({\r\n * pointer: Pointer,\r\n * pen: Pen,\r\n * eraser: Eraser,\r\n * });\r\n *\r\n * return (\r\n * <div style={style}>\r\n * <button onClick={() => setCursor('pen')}>Pen</button>\r\n * <button onClick={() => setCursor('eraser')}>Eraser</button>\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n */\r\nexport function useCursors<T extends Record<string, CursorIcon>>(\r\n cursors: T,\r\n options: CursorBuilderOptions = {},\r\n): [CSSProperties, (name: keyof T | null) => void, Record<keyof T, string>] {\r\n const cursorMap = useMemo(\r\n () => buildCursors(cursors, options),\r\n [cursors, options.size, options.color, options.variant],\r\n );\r\n\r\n const [activeCursor, setActiveCursor] = useState<keyof T | null>(null);\r\n\r\n const style = useMemo(\r\n (): CSSProperties => ({\r\n cursor: activeCursor ? cursorMap[activeCursor] : 'auto',\r\n }),\r\n [activeCursor, cursorMap],\r\n );\r\n\r\n return [style, setActiveCursor, cursorMap];\r\n}\r\n\r\n/* ─── Prebuilt Cursor Sets ─── */\r\n\r\n/**\r\n * Configuration for a complete cursor theme\r\n */\r\nexport interface CursorTheme {\r\n default: string;\r\n pointer: string;\r\n text: string;\r\n wait: string;\r\n help: string;\r\n notAllowed: string;\r\n grab: string;\r\n grabbing: string;\r\n crosshair: string;\r\n move: string;\r\n resizeN: string;\r\n resizeS: string;\r\n resizeE: string;\r\n resizeW: string;\r\n resizeNE: string;\r\n resizeNW: string;\r\n resizeSE: string;\r\n resizeSW: string;\r\n resizeHorizontal: string;\r\n resizeVertical: string;\r\n}\r\n\r\n/**\r\n * Create a complete cursor theme from cursor icons.\r\n *\r\n * @param theme - Map of cursor type to icon component\r\n * @param options - Shared building options\r\n * @returns Complete cursor theme object\r\n *\r\n * @example\r\n * ```tsx\r\n * import * as cursors from '@nice2dev/icons-cursor';\r\n *\r\n * const theme = createCursorTheme({\r\n * default: cursors.Pointer,\r\n * pointer: cursors.PointerFinger,\r\n * text: cursors.TextCursor,\r\n * // ...\r\n * }, { size: 24 });\r\n *\r\n * // Apply to CSS\r\n * document.body.style.cursor = theme.default;\r\n * ```\r\n */\r\nexport function createCursorTheme(\r\n theme: Partial<Record<keyof CursorTheme, CursorIcon>>,\r\n options: CursorBuilderOptions = {},\r\n): Partial<CursorTheme> {\r\n const result: Partial<CursorTheme> = {};\r\n\r\n for (const [key, IconComponent] of Object.entries(theme)) {\r\n if (IconComponent) {\r\n result[key as keyof CursorTheme] = buildCursor(IconComponent, options).cursor;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/* ─── Utility: Apply Theme to Document ─── */\r\n\r\n/**\r\n * Apply a cursor theme to the document's CSS custom properties.\r\n * This allows using the cursors via CSS: `cursor: var(--cursor-pointer)`\r\n *\r\n * @param theme - Cursor theme to apply\r\n * @param prefix - CSS variable prefix (default: '--cursor')\r\n *\r\n * @example\r\n * ```tsx\r\n * const theme = createCursorTheme({ ... });\r\n * applyCursorTheme(theme);\r\n *\r\n * // In CSS:\r\n * // .button:hover { cursor: var(--cursor-pointer); }\r\n * ```\r\n */\r\nexport function applyCursorTheme(theme: Partial<CursorTheme>, prefix = '--cursor'): void {\r\n if (typeof document === 'undefined') {\r\n return;\r\n }\r\n\r\n const root = document.documentElement;\r\n\r\n for (const [name, value] of Object.entries(theme)) {\r\n root.style.setProperty(`${prefix}-${name}`, value);\r\n }\r\n}\r\n","/**\r\n * @nice2dev/icons-cursor\r\n * Cursor and pointer icons for NiceToDev UI\r\n *\r\n * Provides 60 cursor-related icons organized into 4 categories:\r\n * - Pointers: Basic cursor shapes and resize handles (15 icons)\r\n * - Selection: Text/cell selection and drag cursors (15 icons)\r\n * - Tools: Drawing and editing tool cursors (15 icons)\r\n * - Status: System state indicators (15 icons)\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n// Export types\r\nexport type {\r\n CursorIconProps,\r\n CursorIconAnimation,\r\n CursorIconVariant,\r\n CursorIcon,\r\n CursorIconName,\r\n PointerIconName,\r\n SelectionIconName,\r\n ToolIconName,\r\n StatusIconName,\r\n} from './types';\r\n\r\n// Export factory and utilities\r\nexport { createCursorIcon, getCursorAnimation } from './createCursorIcon';\r\n\r\n// Export cursor builder utilities\r\nexport {\r\n buildCursor,\r\n buildCursors,\r\n createCursorBuilder,\r\n generateCursorCSS,\r\n useCursor,\r\n useCursors,\r\n createCursorTheme,\r\n applyCursorTheme,\r\n getDefaultHotspot,\r\n DEFAULT_HOTSPOTS,\r\n} from './cursorBuilder';\r\n\r\nexport type {\r\n CursorHotspot,\r\n CursorBuilderOptions,\r\n CursorBuilderResult,\r\n CursorTheme,\r\n} from './cursorBuilder';\r\n\r\n// Export all icons by category with namespaces\r\nimport * as pointers from './pointers';\r\nimport * as selection from './selection';\r\nimport * as status from './status';\r\nimport * as tools from './tools';\r\n\r\nexport { pointers, selection, tools, status };\r\n\r\n// Re-export individual icons from each category\r\nexport {\r\n Pointer,\r\n PointerFinger,\r\n Crosshair,\r\n Move,\r\n ResizeN,\r\n ResizeS,\r\n ResizeE,\r\n ResizeW,\r\n ResizeNE,\r\n ResizeNW,\r\n ResizeSE,\r\n ResizeSW,\r\n ResizeHorizontal,\r\n ResizeVertical,\r\n ResizeAll,\r\n pointerIcons,\r\n} from './pointers';\r\n\r\nexport {\r\n TextCursor,\r\n TextSelect,\r\n CellSelection,\r\n ColumnSelect,\r\n RowSelect,\r\n RangeSelect,\r\n Grab,\r\n Grabbing,\r\n Drag,\r\n DragHandle,\r\n Lasso,\r\n MagicWand,\r\n SelectAll,\r\n Deselect,\r\n InvertSelection,\r\n selectionIcons,\r\n} from './selection';\r\n\r\nexport {\r\n ZoomIn,\r\n ZoomOut,\r\n Rotate,\r\n Pan,\r\n Draw,\r\n Brush,\r\n Eraser,\r\n Eyedropper,\r\n Bucket,\r\n Pen,\r\n Line,\r\n Rectangle,\r\n Ellipse,\r\n Polygon,\r\n Crop,\r\n toolIcons,\r\n} from './tools';\r\n\r\nexport {\r\n Wait,\r\n Progress,\r\n Forbidden,\r\n NotAllowed,\r\n Help,\r\n ContextMenu,\r\n Alias,\r\n Copy,\r\n NoDrop,\r\n Loading,\r\n Busy,\r\n Default,\r\n Auto,\r\n None,\r\n Inherit,\r\n statusIcons,\r\n} from './status';\r\n\r\n/**\r\n * All cursor icons in a single object\r\n */\r\nexport const allCursorIcons = {\r\n ...pointers.pointerIcons,\r\n ...selection.selectionIcons,\r\n ...tools.toolIcons,\r\n ...status.statusIcons,\r\n} as const;\r\n\r\n/**\r\n * Icon count by category\r\n */\r\nexport const CURSOR_ICON_COUNTS = {\r\n pointers: 15,\r\n selection: 15,\r\n tools: 15,\r\n status: 15,\r\n total: 60,\r\n} as const;\r\n"],"names":["pointers.pointerIcons","selection.selectionIcons","tools.toolIcons","status.statusIcons"],"mappings":";;;;;;;;;;AAiBA,IAAI,iBAAkC;AAMtC,SAAS,cAAwB;AAC/B,MAAI,gBAAgB;AAClB,WAAO;AAAA,EACT;AAIA,QAAM,iBAAiB,QAAQ,kBAAkB;AACjD,mBAAiB,eAAe;AAChC,SAAO;AACT;AAoDO,MAAM,mBAAkD;AAAA;AAAA,EAE7D,SAAS,EAAE,GAA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;AAAA,EACX,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { c as createCursorIcon } from "./createCursorIcon-CCO9eeBk.mjs";
|
|
2
|
+
const Pointer = createCursorIcon("Pointer", "M5.5 3.21V20.8l5.25-5.25h6.56L5.5 3.21z");
|
|
3
|
+
const PointerFinger = createCursorIcon(
|
|
4
|
+
"PointerFinger",
|
|
5
|
+
"M10 7V4a2 2 0 1 1 4 0v3m-4 0h4m-4 0v4m4-4v4m-4 4v-4m4 0v4m-4 0h4m-4 0H8a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-4m-4 4H6"
|
|
6
|
+
);
|
|
7
|
+
const Crosshair = createCursorIcon(
|
|
8
|
+
"Crosshair",
|
|
9
|
+
"M12 2v4m0 12v4m10-10h-4M6 12H2m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"
|
|
10
|
+
);
|
|
11
|
+
const Move = createCursorIcon(
|
|
12
|
+
"Move",
|
|
13
|
+
"M12 2v20m10-10H2m10-8l-3 3m3-3l3 3m-3 17l-3-3m3 3l3-3m5-7l-3-3m3 3l-3 3M5 12l3-3m-3 3l3 3"
|
|
14
|
+
);
|
|
15
|
+
const ResizeN = createCursorIcon("ResizeN", "M12 4v16m-4-12l4-4 4 4");
|
|
16
|
+
const ResizeS = createCursorIcon("ResizeS", "M12 4v16m-4-4l4 4 4-4");
|
|
17
|
+
const ResizeE = createCursorIcon("ResizeE", "M4 12h16m-4-4l4 4-4 4");
|
|
18
|
+
const ResizeW = createCursorIcon("ResizeW", "M4 12h16M8 8l-4 4 4 4");
|
|
19
|
+
const ResizeNE = createCursorIcon("ResizeNE", "M7 17L17 7m0 0h-7m7 0v7");
|
|
20
|
+
const ResizeNW = createCursorIcon("ResizeNW", "M17 17L7 7m0 0h7M7 7v7");
|
|
21
|
+
const ResizeSE = createCursorIcon("ResizeSE", "M7 7l10 10m0 0h-7m7 0v-7");
|
|
22
|
+
const ResizeSW = createCursorIcon("ResizeSW", "M17 7L7 17m0 0h7M7 17v-7");
|
|
23
|
+
const ResizeHorizontal = createCursorIcon(
|
|
24
|
+
"ResizeHorizontal",
|
|
25
|
+
"M4 12h16M8 8l-4 4 4 4m8-8l4 4-4 4"
|
|
26
|
+
);
|
|
27
|
+
const ResizeVertical = createCursorIcon(
|
|
28
|
+
"ResizeVertical",
|
|
29
|
+
"M12 4v16m-4-12l4-4 4 4m-8 8l4 4 4-4"
|
|
30
|
+
);
|
|
31
|
+
const ResizeAll = createCursorIcon(
|
|
32
|
+
"ResizeAll",
|
|
33
|
+
"M12 2v20m10-10H2m10-8l-3 3m6 0l-3-3m0 16l3-3m-6 0l3 3m5-7l-3-3m0 6l3-3M5 9l3 3m-3 0l3-3"
|
|
34
|
+
);
|
|
35
|
+
const pointerIcons = {
|
|
36
|
+
Pointer,
|
|
37
|
+
PointerFinger,
|
|
38
|
+
Crosshair,
|
|
39
|
+
Move,
|
|
40
|
+
ResizeN,
|
|
41
|
+
ResizeS,
|
|
42
|
+
ResizeE,
|
|
43
|
+
ResizeW,
|
|
44
|
+
ResizeNE,
|
|
45
|
+
ResizeNW,
|
|
46
|
+
ResizeSE,
|
|
47
|
+
ResizeSW,
|
|
48
|
+
ResizeHorizontal,
|
|
49
|
+
ResizeVertical,
|
|
50
|
+
ResizeAll
|
|
51
|
+
};
|
|
52
|
+
const pointers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
53
|
+
__proto__: null,
|
|
54
|
+
Crosshair,
|
|
55
|
+
Move,
|
|
56
|
+
Pointer,
|
|
57
|
+
PointerFinger,
|
|
58
|
+
ResizeAll,
|
|
59
|
+
ResizeE,
|
|
60
|
+
ResizeHorizontal,
|
|
61
|
+
ResizeN,
|
|
62
|
+
ResizeNE,
|
|
63
|
+
ResizeNW,
|
|
64
|
+
ResizeS,
|
|
65
|
+
ResizeSE,
|
|
66
|
+
ResizeSW,
|
|
67
|
+
ResizeVertical,
|
|
68
|
+
ResizeW,
|
|
69
|
+
pointerIcons
|
|
70
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
71
|
+
export {
|
|
72
|
+
Crosshair as C,
|
|
73
|
+
Move as M,
|
|
74
|
+
Pointer as P,
|
|
75
|
+
ResizeAll as R,
|
|
76
|
+
PointerFinger as a,
|
|
77
|
+
ResizeE as b,
|
|
78
|
+
ResizeHorizontal as c,
|
|
79
|
+
ResizeN as d,
|
|
80
|
+
ResizeNE as e,
|
|
81
|
+
ResizeNW as f,
|
|
82
|
+
ResizeS as g,
|
|
83
|
+
ResizeSE as h,
|
|
84
|
+
ResizeSW as i,
|
|
85
|
+
ResizeVertical as j,
|
|
86
|
+
ResizeW as k,
|
|
87
|
+
pointers as l,
|
|
88
|
+
pointerIcons as p
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=pointers-DW_cbtGT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointers-DW_cbtGT.mjs","sources":["../src/pointers.tsx"],"sourcesContent":["/**\r\n * Pointer and basic cursor icons\r\n * @packageDocumentation\r\n */\r\nimport { createCursorIcon } from './createCursorIcon';\r\n\r\n// Standard pointer cursor (arrow)\r\nexport const Pointer = createCursorIcon('Pointer', 'M5.5 3.21V20.8l5.25-5.25h6.56L5.5 3.21z');\r\n\r\n// Pointing finger / hand cursor\r\nexport const PointerFinger = createCursorIcon(\r\n 'PointerFinger',\r\n 'M10 7V4a2 2 0 1 1 4 0v3m-4 0h4m-4 0v4m4-4v4m-4 4v-4m4 0v4m-4 0h4m-4 0H8a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-4m-4 4H6',\r\n);\r\n\r\n// Crosshair / precision cursor\r\nexport const Crosshair = createCursorIcon(\r\n 'Crosshair',\r\n 'M12 2v4m0 12v4m10-10h-4M6 12H2m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z',\r\n);\r\n\r\n// Move cursor (4-directional)\r\nexport const Move = createCursorIcon(\r\n 'Move',\r\n 'M12 2v20m10-10H2m10-8l-3 3m3-3l3 3m-3 17l-3-3m3 3l3-3m5-7l-3-3m3 3l-3 3M5 12l3-3m-3 3l3 3',\r\n);\r\n\r\n// Resize North\r\nexport const ResizeN = createCursorIcon('ResizeN', 'M12 4v16m-4-12l4-4 4 4');\r\n\r\n// Resize South\r\nexport const ResizeS = createCursorIcon('ResizeS', 'M12 4v16m-4-4l4 4 4-4');\r\n\r\n// Resize East\r\nexport const ResizeE = createCursorIcon('ResizeE', 'M4 12h16m-4-4l4 4-4 4');\r\n\r\n// Resize West\r\nexport const ResizeW = createCursorIcon('ResizeW', 'M4 12h16M8 8l-4 4 4 4');\r\n\r\n// Resize Northeast\r\nexport const ResizeNE = createCursorIcon('ResizeNE', 'M7 17L17 7m0 0h-7m7 0v7');\r\n\r\n// Resize Northwest\r\nexport const ResizeNW = createCursorIcon('ResizeNW', 'M17 17L7 7m0 0h7M7 7v7');\r\n\r\n// Resize Southeast\r\nexport const ResizeSE = createCursorIcon('ResizeSE', 'M7 7l10 10m0 0h-7m7 0v-7');\r\n\r\n// Resize Southwest\r\nexport const ResizeSW = createCursorIcon('ResizeSW', 'M17 7L7 17m0 0h7M7 17v-7');\r\n\r\n// Resize Horizontal (East-West)\r\nexport const ResizeHorizontal = createCursorIcon(\r\n 'ResizeHorizontal',\r\n 'M4 12h16M8 8l-4 4 4 4m8-8l4 4-4 4',\r\n);\r\n\r\n// Resize Vertical (North-South)\r\nexport const ResizeVertical = createCursorIcon(\r\n 'ResizeVertical',\r\n 'M12 4v16m-4-12l4-4 4 4m-8 8l4 4 4-4',\r\n);\r\n\r\n// Resize All (omnidirectional)\r\nexport const ResizeAll = createCursorIcon(\r\n 'ResizeAll',\r\n 'M12 2v20m10-10H2m10-8l-3 3m6 0l-3-3m0 16l3-3m-6 0l3 3m5-7l-3-3m0 6l3-3M5 9l3 3m-3 0l3-3',\r\n);\r\n\r\n/**\r\n * All pointer icons grouped for export\r\n */\r\nexport const pointerIcons = {\r\n Pointer,\r\n PointerFinger,\r\n Crosshair,\r\n Move,\r\n ResizeN,\r\n ResizeS,\r\n ResizeE,\r\n ResizeW,\r\n ResizeNE,\r\n ResizeNW,\r\n ResizeSE,\r\n ResizeSW,\r\n ResizeHorizontal,\r\n ResizeVertical,\r\n ResizeAll,\r\n} as const;\r\n"],"names":[],"mappings":";AAOO,MAAM,UAAU,iBAAiB,WAAW,yCAAyC;AAGrF,MAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AACF;AAGO,MAAM,YAAY;AAAA,EACvB;AAAA,EACA;AACF;AAGO,MAAM,OAAO;AAAA,EAClB;AAAA,EACA;AACF;AAGO,MAAM,UAAU,iBAAiB,WAAW,wBAAwB;AAGpE,MAAM,UAAU,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,UAAU,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,UAAU,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,WAAW,iBAAiB,YAAY,yBAAyB;AAGvE,MAAM,WAAW,iBAAiB,YAAY,wBAAwB;AAGtE,MAAM,WAAW,iBAAiB,YAAY,0BAA0B;AAGxE,MAAM,WAAW,iBAAiB,YAAY,0BAA0B;AAGxE,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AACF;AAGO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AACF;AAGO,MAAM,YAAY;AAAA,EACvB;AAAA,EACA;AACF;AAKO,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const createCursorIcon = require("./createCursorIcon-Crwdo_Qk.js");
|
|
3
|
+
const Pointer = createCursorIcon.createCursorIcon("Pointer", "M5.5 3.21V20.8l5.25-5.25h6.56L5.5 3.21z");
|
|
4
|
+
const PointerFinger = createCursorIcon.createCursorIcon(
|
|
5
|
+
"PointerFinger",
|
|
6
|
+
"M10 7V4a2 2 0 1 1 4 0v3m-4 0h4m-4 0v4m4-4v4m-4 4v-4m4 0v4m-4 0h4m-4 0H8a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-4m-4 4H6"
|
|
7
|
+
);
|
|
8
|
+
const Crosshair = createCursorIcon.createCursorIcon(
|
|
9
|
+
"Crosshair",
|
|
10
|
+
"M12 2v4m0 12v4m10-10h-4M6 12H2m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"
|
|
11
|
+
);
|
|
12
|
+
const Move = createCursorIcon.createCursorIcon(
|
|
13
|
+
"Move",
|
|
14
|
+
"M12 2v20m10-10H2m10-8l-3 3m3-3l3 3m-3 17l-3-3m3 3l3-3m5-7l-3-3m3 3l-3 3M5 12l3-3m-3 3l3 3"
|
|
15
|
+
);
|
|
16
|
+
const ResizeN = createCursorIcon.createCursorIcon("ResizeN", "M12 4v16m-4-12l4-4 4 4");
|
|
17
|
+
const ResizeS = createCursorIcon.createCursorIcon("ResizeS", "M12 4v16m-4-4l4 4 4-4");
|
|
18
|
+
const ResizeE = createCursorIcon.createCursorIcon("ResizeE", "M4 12h16m-4-4l4 4-4 4");
|
|
19
|
+
const ResizeW = createCursorIcon.createCursorIcon("ResizeW", "M4 12h16M8 8l-4 4 4 4");
|
|
20
|
+
const ResizeNE = createCursorIcon.createCursorIcon("ResizeNE", "M7 17L17 7m0 0h-7m7 0v7");
|
|
21
|
+
const ResizeNW = createCursorIcon.createCursorIcon("ResizeNW", "M17 17L7 7m0 0h7M7 7v7");
|
|
22
|
+
const ResizeSE = createCursorIcon.createCursorIcon("ResizeSE", "M7 7l10 10m0 0h-7m7 0v-7");
|
|
23
|
+
const ResizeSW = createCursorIcon.createCursorIcon("ResizeSW", "M17 7L7 17m0 0h7M7 17v-7");
|
|
24
|
+
const ResizeHorizontal = createCursorIcon.createCursorIcon(
|
|
25
|
+
"ResizeHorizontal",
|
|
26
|
+
"M4 12h16M8 8l-4 4 4 4m8-8l4 4-4 4"
|
|
27
|
+
);
|
|
28
|
+
const ResizeVertical = createCursorIcon.createCursorIcon(
|
|
29
|
+
"ResizeVertical",
|
|
30
|
+
"M12 4v16m-4-12l4-4 4 4m-8 8l4 4 4-4"
|
|
31
|
+
);
|
|
32
|
+
const ResizeAll = createCursorIcon.createCursorIcon(
|
|
33
|
+
"ResizeAll",
|
|
34
|
+
"M12 2v20m10-10H2m10-8l-3 3m6 0l-3-3m0 16l3-3m-6 0l3 3m5-7l-3-3m0 6l3-3M5 9l3 3m-3 0l3-3"
|
|
35
|
+
);
|
|
36
|
+
const pointerIcons = {
|
|
37
|
+
Pointer,
|
|
38
|
+
PointerFinger,
|
|
39
|
+
Crosshair,
|
|
40
|
+
Move,
|
|
41
|
+
ResizeN,
|
|
42
|
+
ResizeS,
|
|
43
|
+
ResizeE,
|
|
44
|
+
ResizeW,
|
|
45
|
+
ResizeNE,
|
|
46
|
+
ResizeNW,
|
|
47
|
+
ResizeSE,
|
|
48
|
+
ResizeSW,
|
|
49
|
+
ResizeHorizontal,
|
|
50
|
+
ResizeVertical,
|
|
51
|
+
ResizeAll
|
|
52
|
+
};
|
|
53
|
+
const pointers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
54
|
+
__proto__: null,
|
|
55
|
+
Crosshair,
|
|
56
|
+
Move,
|
|
57
|
+
Pointer,
|
|
58
|
+
PointerFinger,
|
|
59
|
+
ResizeAll,
|
|
60
|
+
ResizeE,
|
|
61
|
+
ResizeHorizontal,
|
|
62
|
+
ResizeN,
|
|
63
|
+
ResizeNE,
|
|
64
|
+
ResizeNW,
|
|
65
|
+
ResizeS,
|
|
66
|
+
ResizeSE,
|
|
67
|
+
ResizeSW,
|
|
68
|
+
ResizeVertical,
|
|
69
|
+
ResizeW,
|
|
70
|
+
pointerIcons
|
|
71
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
72
|
+
exports.Crosshair = Crosshair;
|
|
73
|
+
exports.Move = Move;
|
|
74
|
+
exports.Pointer = Pointer;
|
|
75
|
+
exports.PointerFinger = PointerFinger;
|
|
76
|
+
exports.ResizeAll = ResizeAll;
|
|
77
|
+
exports.ResizeE = ResizeE;
|
|
78
|
+
exports.ResizeHorizontal = ResizeHorizontal;
|
|
79
|
+
exports.ResizeN = ResizeN;
|
|
80
|
+
exports.ResizeNE = ResizeNE;
|
|
81
|
+
exports.ResizeNW = ResizeNW;
|
|
82
|
+
exports.ResizeS = ResizeS;
|
|
83
|
+
exports.ResizeSE = ResizeSE;
|
|
84
|
+
exports.ResizeSW = ResizeSW;
|
|
85
|
+
exports.ResizeVertical = ResizeVertical;
|
|
86
|
+
exports.ResizeW = ResizeW;
|
|
87
|
+
exports.pointerIcons = pointerIcons;
|
|
88
|
+
exports.pointers = pointers;
|
|
89
|
+
//# sourceMappingURL=pointers-DxPqgPxN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointers-DxPqgPxN.js","sources":["../src/pointers.tsx"],"sourcesContent":["/**\r\n * Pointer and basic cursor icons\r\n * @packageDocumentation\r\n */\r\nimport { createCursorIcon } from './createCursorIcon';\r\n\r\n// Standard pointer cursor (arrow)\r\nexport const Pointer = createCursorIcon('Pointer', 'M5.5 3.21V20.8l5.25-5.25h6.56L5.5 3.21z');\r\n\r\n// Pointing finger / hand cursor\r\nexport const PointerFinger = createCursorIcon(\r\n 'PointerFinger',\r\n 'M10 7V4a2 2 0 1 1 4 0v3m-4 0h4m-4 0v4m4-4v4m-4 4v-4m4 0v4m-4 0h4m-4 0H8a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-4m-4 4H6',\r\n);\r\n\r\n// Crosshair / precision cursor\r\nexport const Crosshair = createCursorIcon(\r\n 'Crosshair',\r\n 'M12 2v4m0 12v4m10-10h-4M6 12H2m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z',\r\n);\r\n\r\n// Move cursor (4-directional)\r\nexport const Move = createCursorIcon(\r\n 'Move',\r\n 'M12 2v20m10-10H2m10-8l-3 3m3-3l3 3m-3 17l-3-3m3 3l3-3m5-7l-3-3m3 3l-3 3M5 12l3-3m-3 3l3 3',\r\n);\r\n\r\n// Resize North\r\nexport const ResizeN = createCursorIcon('ResizeN', 'M12 4v16m-4-12l4-4 4 4');\r\n\r\n// Resize South\r\nexport const ResizeS = createCursorIcon('ResizeS', 'M12 4v16m-4-4l4 4 4-4');\r\n\r\n// Resize East\r\nexport const ResizeE = createCursorIcon('ResizeE', 'M4 12h16m-4-4l4 4-4 4');\r\n\r\n// Resize West\r\nexport const ResizeW = createCursorIcon('ResizeW', 'M4 12h16M8 8l-4 4 4 4');\r\n\r\n// Resize Northeast\r\nexport const ResizeNE = createCursorIcon('ResizeNE', 'M7 17L17 7m0 0h-7m7 0v7');\r\n\r\n// Resize Northwest\r\nexport const ResizeNW = createCursorIcon('ResizeNW', 'M17 17L7 7m0 0h7M7 7v7');\r\n\r\n// Resize Southeast\r\nexport const ResizeSE = createCursorIcon('ResizeSE', 'M7 7l10 10m0 0h-7m7 0v-7');\r\n\r\n// Resize Southwest\r\nexport const ResizeSW = createCursorIcon('ResizeSW', 'M17 7L7 17m0 0h7M7 17v-7');\r\n\r\n// Resize Horizontal (East-West)\r\nexport const ResizeHorizontal = createCursorIcon(\r\n 'ResizeHorizontal',\r\n 'M4 12h16M8 8l-4 4 4 4m8-8l4 4-4 4',\r\n);\r\n\r\n// Resize Vertical (North-South)\r\nexport const ResizeVertical = createCursorIcon(\r\n 'ResizeVertical',\r\n 'M12 4v16m-4-12l4-4 4 4m-8 8l4 4 4-4',\r\n);\r\n\r\n// Resize All (omnidirectional)\r\nexport const ResizeAll = createCursorIcon(\r\n 'ResizeAll',\r\n 'M12 2v20m10-10H2m10-8l-3 3m6 0l-3-3m0 16l3-3m-6 0l3 3m5-7l-3-3m0 6l3-3M5 9l3 3m-3 0l3-3',\r\n);\r\n\r\n/**\r\n * All pointer icons grouped for export\r\n */\r\nexport const pointerIcons = {\r\n Pointer,\r\n PointerFinger,\r\n Crosshair,\r\n Move,\r\n ResizeN,\r\n ResizeS,\r\n ResizeE,\r\n ResizeW,\r\n ResizeNE,\r\n ResizeNW,\r\n ResizeSE,\r\n ResizeSW,\r\n ResizeHorizontal,\r\n ResizeVertical,\r\n ResizeAll,\r\n} as const;\r\n"],"names":["createCursorIcon"],"mappings":";;AAOO,MAAM,UAAUA,iBAAAA,iBAAiB,WAAW,yCAAyC;AAGrF,MAAM,gBAAgBA,iBAAAA;AAAAA,EAC3B;AAAA,EACA;AACF;AAGO,MAAM,YAAYA,iBAAAA;AAAAA,EACvB;AAAA,EACA;AACF;AAGO,MAAM,OAAOA,iBAAAA;AAAAA,EAClB;AAAA,EACA;AACF;AAGO,MAAM,UAAUA,iBAAAA,iBAAiB,WAAW,wBAAwB;AAGpE,MAAM,UAAUA,iBAAAA,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,UAAUA,iBAAAA,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,UAAUA,iBAAAA,iBAAiB,WAAW,uBAAuB;AAGnE,MAAM,WAAWA,iBAAAA,iBAAiB,YAAY,yBAAyB;AAGvE,MAAM,WAAWA,iBAAAA,iBAAiB,YAAY,wBAAwB;AAGtE,MAAM,WAAWA,iBAAAA,iBAAiB,YAAY,0BAA0B;AAGxE,MAAM,WAAWA,iBAAAA,iBAAiB,YAAY,0BAA0B;AAGxE,MAAM,mBAAmBA,iBAAAA;AAAAA,EAC9B;AAAA,EACA;AACF;AAGO,MAAM,iBAAiBA,iBAAAA;AAAAA,EAC5B;AAAA,EACA;AACF;AAGO,MAAM,YAAYA,iBAAAA;AAAAA,EACvB;AAAA,EACA;AACF;AAKO,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|