@glennjong/pixel-window 0.1.1
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.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +246 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +215 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +25 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function getFrame({ size, stroke, frame, background }: {
|
|
2
|
+
size: number;
|
|
3
|
+
stroke: string;
|
|
4
|
+
frame: string;
|
|
5
|
+
background: string;
|
|
6
|
+
}): string;
|
|
7
|
+
declare const frame: string;
|
|
8
|
+
declare const checkbox: string;
|
|
9
|
+
declare const checkboxLight: string;
|
|
10
|
+
|
|
11
|
+
export { checkbox, checkboxLight, frame, getFrame };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function getFrame({ size, stroke, frame, background }: {
|
|
2
|
+
size: number;
|
|
3
|
+
stroke: string;
|
|
4
|
+
frame: string;
|
|
5
|
+
background: string;
|
|
6
|
+
}): string;
|
|
7
|
+
declare const frame: string;
|
|
8
|
+
declare const checkbox: string;
|
|
9
|
+
declare const checkboxLight: string;
|
|
10
|
+
|
|
11
|
+
export { checkbox, checkboxLight, frame, getFrame };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
FreePixelWindow: () => FreePixelWindow,
|
|
23
|
+
PixelWindow: () => PixelWindow,
|
|
24
|
+
checkbox: () => checkbox,
|
|
25
|
+
checkboxLight: () => checkboxLight,
|
|
26
|
+
frame: () => frame,
|
|
27
|
+
getFrame: () => getFrame
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
|
|
31
|
+
// src/frame.ts
|
|
32
|
+
function getFrame({ size, stroke, frame: frame2, background }) {
|
|
33
|
+
const height = size;
|
|
34
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="{{size}}" height="{{height}}" viewBox="0 0 12 12"><path fill="{{stroke}}" d="M2 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zM1 1h1v1H1z"/><path fill="{{frame}}" d="M2 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{stroke}}" d="M10 1h1v1h-1zM0 2h1v1H0z"/><path fill="{{frame}}" d="M1 2h1v1H1zm1 0h1v1H2z"/><path fill="{{stroke}}" d="M3 2h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{frame}}" d="M9 2h1v1H9zm1 0h1v1h-1z"/><path fill="{{stroke}}" d="M11 2h1v1h-1zM0 3h1v1H0z"/><path fill="{{frame}}" d="M1 3h1v1H1z"/><path fill="{{stroke}}" d="M2 3h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{frame}}" d="M10 3h1v1h-1z"/><path fill="{{stroke}}" d="M11 3h1v1h-1zM0 4h1v1H0z"/><path fill="{{frame}}" d="M1 4h1v1H1z"/><path fill="{{stroke}}" d="M2 4h1v1H2zm1 0h1v1H3z"/><path fill="{{background}}" d="M4 4h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"/><path fill="{{stroke}}" d="M8 4h1v1H8zm1 0h1v1H9z"/><path fill="{{frame}}" d="M10 4h1v1h-1z"/><path fill="{{stroke}}" d="M11 4h1v1h-1zM0 5h1v1H0z"/><path fill="{{frame}}" d="M1 5h1v1H1z"/><path fill="{{stroke}}" d="M2 5h1v1H2z"/><path fill="{{background}}" d="M3 5h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 5h1v1H9z"/><path fill="{{frame}}" d="M10 5h1v1h-1z"/><path fill="{{stroke}}" d="M11 5h1v1h-1zM0 6h1v1H0z"/><path fill="{{frame}}" d="M1 6h1v1H1z"/><path fill="{{stroke}}" d="M2 6h1v1H2z"/><path fill="{{background}}" d="M3 6h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 6h1v1H9z"/><path fill="{{frame}}" d="M10 6h1v1h-1z"/><path fill="{{stroke}}" d="M11 6h1v1h-1zM0 7h1v1H0z"/><path fill="{{frame}}" d="M1 7h1v1H1z"/><path fill="{{stroke}}" d="M2 7h1v1H2z"/><path fill="{{background}}" d="M3 7h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 7h1v1H9z"/><path fill="{{frame}}" d="M10 7h1v1h-1z"/><path fill="{{stroke}}" d="M11 7h1v1h-1zM0 8h1v1H0z"/><path fill="{{frame}}" d="M1 8h1v1H1zm1 0h1v1H2z"/><path fill="{{stroke}}" d="M3 8h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{frame}}" d="M9 8h1v1H9zm1 0h1v1h-1z"/><path fill="{{stroke}}" d="M11 8h1v1h-1zM0 9h1v1H0zm1 0h1v1H1z"/><path fill="{{frame}}" d="M2 9h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{stroke}}" d="M10 9h1v1h-1zm-9 1h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zm1 0h1v1h-1zm-8 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/></svg>'.replace(/\{\{size\}\}/g, size.toString()).replace(/\{\{height\}\}/g, height.toString()).replace(/\{\{stroke\}\}/g, stroke).replace(/\{\{frame\}\}/g, frame2).replace(/\{\{background\}\}/g, background);
|
|
35
|
+
const encodedSvg = encodeURIComponent(svg).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));
|
|
36
|
+
return `data:image/svg+xml;base64,${btoa(encodedSvg)}`;
|
|
37
|
+
}
|
|
38
|
+
function getCheckbox({ size, color }) {
|
|
39
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="{{width}}" height="{{height}}" viewBox="0 0 12 6"><rect width="1" height="1" x="1" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="4" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="7" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="8" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="9" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="10" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="1" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="4" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="7" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="8" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="9" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="10" y="5" fill="{{color}}"></rect></svg>'.replace(/\{\{width\}\}/g, (size * 2).toString()).replace(/\{\{height\}\}/g, size.toString()).replace(/\{\{color\}\}/g, color);
|
|
40
|
+
const encodedSvg = encodeURIComponent(svg).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16))).replace(/#/g, "%23");
|
|
41
|
+
return `data:image/svg+xml;base64,${btoa(encodedSvg)}`;
|
|
42
|
+
}
|
|
43
|
+
var frame = getFrame({
|
|
44
|
+
size: 160,
|
|
45
|
+
stroke: "#000",
|
|
46
|
+
frame: "#333",
|
|
47
|
+
background: "#DDD"
|
|
48
|
+
});
|
|
49
|
+
var checkbox = getCheckbox({
|
|
50
|
+
size: 12,
|
|
51
|
+
color: "#000"
|
|
52
|
+
});
|
|
53
|
+
var checkboxLight = getCheckbox({
|
|
54
|
+
size: 12,
|
|
55
|
+
color: "#000"
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/index.tsx
|
|
59
|
+
var import_react = require("react");
|
|
60
|
+
var import_react_dom = require("react-dom");
|
|
61
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
|
+
var PixelWindow = ({
|
|
63
|
+
style = {},
|
|
64
|
+
stroke = "#000",
|
|
65
|
+
frame: frame2 = "#333",
|
|
66
|
+
background = "#DDD",
|
|
67
|
+
pixel = 160,
|
|
68
|
+
children
|
|
69
|
+
}) => {
|
|
70
|
+
const pixelFrame = getFrame({
|
|
71
|
+
size: pixel,
|
|
72
|
+
stroke,
|
|
73
|
+
frame: frame2,
|
|
74
|
+
background
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: "window",
|
|
80
|
+
style: {
|
|
81
|
+
width: "100%",
|
|
82
|
+
height: "100%",
|
|
83
|
+
borderImage: `url(${pixelFrame})`,
|
|
84
|
+
borderImageSlice: "49% 49% fill",
|
|
85
|
+
borderImageWidth: `${pixel}px`
|
|
86
|
+
},
|
|
87
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: `${pixel}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
style: { boxSizing: "border-box", ...style },
|
|
91
|
+
children
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
var FreePixelWindow = ({
|
|
98
|
+
name,
|
|
99
|
+
children,
|
|
100
|
+
pixel = 16,
|
|
101
|
+
stroke = "#000",
|
|
102
|
+
frame: frame2 = "#333",
|
|
103
|
+
background = "#DDD",
|
|
104
|
+
position: initialPosition = { x: 100, y: 100 },
|
|
105
|
+
style,
|
|
106
|
+
minWidth = 120,
|
|
107
|
+
minHeight = 100
|
|
108
|
+
}) => {
|
|
109
|
+
const [position, setPosition] = (0, import_react.useState)(() => {
|
|
110
|
+
if (name) {
|
|
111
|
+
const savedPosition = localStorage.getItem(`${name}-position`);
|
|
112
|
+
return savedPosition ? JSON.parse(savedPosition) : initialPosition;
|
|
113
|
+
}
|
|
114
|
+
return initialPosition;
|
|
115
|
+
});
|
|
116
|
+
const [size, setSize] = (0, import_react.useState)(() => {
|
|
117
|
+
const savedSize = localStorage.getItem(`${name}-size`);
|
|
118
|
+
return savedSize ? JSON.parse(savedSize) : { width: 300, height: 200 };
|
|
119
|
+
});
|
|
120
|
+
const [isDragging, setIsDragging] = (0, import_react.useState)(false);
|
|
121
|
+
const [isResizing, setIsResizing] = (0, import_react.useState)(false);
|
|
122
|
+
const [dragStart, setDragStart] = (0, import_react.useState)({ x: 0, y: 0 });
|
|
123
|
+
const [resizeStart, setResizeStart] = (0, import_react.useState)({ width: 0, height: 0, mouseX: 0, mouseY: 0 });
|
|
124
|
+
(0, import_react.useEffect)(() => {
|
|
125
|
+
if (name) {
|
|
126
|
+
localStorage.setItem(`${name}-position`, JSON.stringify(position));
|
|
127
|
+
localStorage.setItem(`${name}-size`, JSON.stringify(size));
|
|
128
|
+
}
|
|
129
|
+
}, [name, position, size]);
|
|
130
|
+
const handleMouseMove = (0, import_react.useCallback)((e) => {
|
|
131
|
+
if (isDragging) {
|
|
132
|
+
setPosition({
|
|
133
|
+
x: e.clientX - dragStart.x,
|
|
134
|
+
y: e.clientY - dragStart.y
|
|
135
|
+
});
|
|
136
|
+
} else if (isResizing) {
|
|
137
|
+
const deltaX = e.clientX - resizeStart.mouseX;
|
|
138
|
+
const deltaY = e.clientY - resizeStart.mouseY;
|
|
139
|
+
setSize({
|
|
140
|
+
width: Math.max(resizeStart.width + deltaX, minWidth),
|
|
141
|
+
height: Math.max(resizeStart.height + deltaY, minHeight)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, [isDragging, isResizing, dragStart, resizeStart, minWidth, minHeight]);
|
|
145
|
+
const handleMouseUp = (0, import_react.useCallback)(() => {
|
|
146
|
+
setIsDragging(false);
|
|
147
|
+
setIsResizing(false);
|
|
148
|
+
}, []);
|
|
149
|
+
(0, import_react.useEffect)(() => {
|
|
150
|
+
if (isDragging || isResizing) {
|
|
151
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
152
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
153
|
+
} else {
|
|
154
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
155
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
156
|
+
}
|
|
157
|
+
return () => {
|
|
158
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
159
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
160
|
+
};
|
|
161
|
+
}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);
|
|
162
|
+
const handleMouseDown = (e) => {
|
|
163
|
+
setIsDragging(true);
|
|
164
|
+
setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });
|
|
165
|
+
};
|
|
166
|
+
const handleResizeStart = (e) => {
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
setIsResizing(true);
|
|
169
|
+
setResizeStart({
|
|
170
|
+
width: size.width,
|
|
171
|
+
height: size.height,
|
|
172
|
+
mouseX: e.clientX,
|
|
173
|
+
mouseY: e.clientY
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
const pixelFrame = getFrame({
|
|
177
|
+
size: pixel,
|
|
178
|
+
stroke,
|
|
179
|
+
frame: frame2,
|
|
180
|
+
background
|
|
181
|
+
});
|
|
182
|
+
return (0, import_react_dom.createPortal)(
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
style: {
|
|
187
|
+
position: "absolute",
|
|
188
|
+
overflow: "hidden",
|
|
189
|
+
resize: "none",
|
|
190
|
+
top: position.y,
|
|
191
|
+
left: position.x,
|
|
192
|
+
width: size.width,
|
|
193
|
+
height: size.height,
|
|
194
|
+
borderImage: `url(${pixelFrame})`,
|
|
195
|
+
borderImageSlice: "49% 49% fill",
|
|
196
|
+
borderImageWidth: `${pixel}px`
|
|
197
|
+
},
|
|
198
|
+
onMouseUp: handleMouseUp,
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
onMouseDown: handleMouseDown,
|
|
204
|
+
onMouseUp: handleMouseUp,
|
|
205
|
+
style: {
|
|
206
|
+
height: `${pixel}px`,
|
|
207
|
+
cursor: "grab",
|
|
208
|
+
userSelect: "none"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
|
|
213
|
+
padding: `${pixel}px`,
|
|
214
|
+
paddingTop: 0,
|
|
215
|
+
...style
|
|
216
|
+
}, children }),
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
218
|
+
"div",
|
|
219
|
+
{
|
|
220
|
+
onMouseDown: handleResizeStart,
|
|
221
|
+
style: {
|
|
222
|
+
position: "absolute",
|
|
223
|
+
width: `${pixel}px`,
|
|
224
|
+
height: `${pixel}px`,
|
|
225
|
+
cursor: "se-resize",
|
|
226
|
+
bottom: 0,
|
|
227
|
+
right: 0
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
document.body
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
238
|
+
0 && (module.exports = {
|
|
239
|
+
FreePixelWindow,
|
|
240
|
+
PixelWindow,
|
|
241
|
+
checkbox,
|
|
242
|
+
checkboxLight,
|
|
243
|
+
frame,
|
|
244
|
+
getFrame
|
|
245
|
+
});
|
|
246
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/frame.ts","../src/index.tsx"],"sourcesContent":["export * from './index';\nexport * from './frame';\n","export function getFrame({ size, stroke, frame, background }: { size: number; stroke: string; frame: string; background: string }): string {\n\tconst height = size; // Assuming square frames\n\tconst svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{{size}}\" height=\"{{height}}\" viewBox=\"0 0 12 12\"><path fill=\"{{stroke}}\" d=\"M2 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zM1 1h1v1H1z\"/><path fill=\"{{frame}}\" d=\"M2 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{stroke}}\" d=\"M10 1h1v1h-1zM0 2h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 2h1v1H1zm1 0h1v1H2z\"/><path fill=\"{{stroke}}\" d=\"M3 2h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{frame}}\" d=\"M9 2h1v1H9zm1 0h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 2h1v1h-1zM0 3h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 3h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 3h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 3h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 3h1v1h-1zM0 4h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 4h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 4h1v1H2zm1 0h1v1H3z\"/><path fill=\"{{background}}\" d=\"M4 4h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z\"/><path fill=\"{{stroke}}\" d=\"M8 4h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 4h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 4h1v1h-1zM0 5h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 5h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 5h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 5h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 5h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 5h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 5h1v1h-1zM0 6h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 6h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 6h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 6h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 6h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 6h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 6h1v1h-1zM0 7h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 7h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 7h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 7h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 7h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 7h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 7h1v1h-1zM0 8h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 8h1v1H1zm1 0h1v1H2z\"/><path fill=\"{{stroke}}\" d=\"M3 8h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{frame}}\" d=\"M9 8h1v1H9zm1 0h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 8h1v1h-1zM0 9h1v1H0zm1 0h1v1H1z\"/><path fill=\"{{frame}}\" d=\"M2 9h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{stroke}}\" d=\"M10 9h1v1h-1zm-9 1h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zm1 0h1v1h-1zm-8 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/></svg>'\n\t\t.replace(/\\{\\{size\\}\\}/g, size.toString())\n\t\t.replace(/\\{\\{height\\}\\}/g, height.toString())\n\t\t.replace(/\\{\\{stroke\\}\\}/g, stroke)\n\t\t.replace(/\\{\\{frame\\}\\}/g, frame)\n\t\t.replace(/\\{\\{background\\}\\}/g, background);\n\n\t// Encode SVG to Base64 safely\n\tconst encodedSvg = encodeURIComponent(svg)\n\t\t.replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));\n\n\treturn `data:image/svg+xml;base64,${btoa(encodedSvg)}`;\n}\n\nfunction getCheckbox({ size, color }: { size: number; color: string }) {\n\tconst svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{{width}}\" height=\"{{height}}\" viewBox=\"0 0 12 6\"><rect width=\"1\" height=\"1\" x=\"1\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"4\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"7\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"8\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"9\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"10\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"1\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"4\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"7\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"8\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"9\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"10\" y=\"5\" fill=\"{{color}}\"></rect></svg>'\n\t\t.replace(/\\{\\{width\\}\\}/g, (size*2).toString())\n\t\t.replace(/\\{\\{height\\}\\}/g, size.toString())\n\t\t.replace(/\\{\\{color\\}\\}/g, color)\n \n\tconst encodedSvg = encodeURIComponent(svg)\n\t\t.replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)))\n\t\t.replace(/#/g, '%23');\n\n\treturn `data:image/svg+xml;base64,${btoa(encodedSvg)}`;\n\n}\n\nexport const frame = getFrame({\n\tsize: 160,\n\tstroke: '#000',\n\tframe: '#333',\n\tbackground: '#DDD',\n});\n\nexport const checkbox = getCheckbox({\n\tsize: 12,\n\tcolor: '#000',\n});\nexport const checkboxLight = getCheckbox({\n\tsize: 12,\n\tcolor: '#000',\n});\n","import { getFrame } from './frame';\nimport { useCallback, useEffect, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\n\nexport const PixelWindow = ({\n\tstyle = {},\n\tstroke = '#000',\n\tframe = '#333',\n\tbackground = '#DDD',\n\tpixel = 160,\n\tchildren,\n}: {\n\tstyle?: React.CSSProperties,\n\tpixel?: number,\n\tstroke?: string\n\tframe?: string\n\tbackground?: string\n\tchildren: ReactNode;\n}) => {\n\n\tconst pixelFrame = getFrame({\n\t\tsize: pixel,\n\t\tstroke,\n\t\tframe,\n\t\tbackground,\n\t});\n\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"window\"\n\t\t\tstyle={{\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tborderImage: `url(${pixelFrame})`,\n\t\t\t\tborderImageSlice: '49% 49% fill',\n\t\t\t\tborderImageWidth: `${pixel}px`,\n\t\t\t}}\n\t\t>\n\t\t\t<div style={{ padding: `${pixel}px`}}>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{ boxSizing: 'border-box', ...style }}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport const FreePixelWindow = ({\n\tname,\n\tchildren,\n\tpixel = 16,\n\tstroke = '#000',\n\tframe = '#333',\n\tbackground = '#DDD',\n\tposition: initialPosition = { x: 100, y: 100 },\n\tstyle,\n\tminWidth = 120,\n\tminHeight = 100,\n}: {\n\tname?: string;\n\tchildren: ReactNode;\n\tpixel?: number;\n\tstroke?: string;\n\tframe?: string;\n\tbackground?: string;\n\tposition?: { x: number; y: number };\n\tstyle?: React.CSSProperties;\n\tminWidth?: number;\n\tminHeight?: number;\n}) => {\n\n\tconst [position, setPosition] = useState(() => {\n\t\tif (name) {\n\t\t\tconst savedPosition = localStorage.getItem(`${name}-position`);\n\t\t\treturn savedPosition ? JSON.parse(savedPosition) : initialPosition;\n\t\t}\n\t\treturn initialPosition;\n\t});\n\n\tconst [size, setSize] = useState(() => {\n\t\tconst savedSize = localStorage.getItem(`${name}-size`);\n\t\treturn savedSize ? JSON.parse(savedSize) : { width: 300, height: 200 };\n\t});\n\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [dragStart, setDragStart] = useState({ x: 0, y: 0 });\n\tconst [resizeStart, setResizeStart] = useState({ width: 0, height: 0, mouseX: 0, mouseY: 0 });\n\n\tuseEffect(() => {\n\t\tif (name) {\n\t\t\tlocalStorage.setItem(`${name}-position`, JSON.stringify(position));\n\t\t\tlocalStorage.setItem(`${name}-size`, JSON.stringify(size));\n\n\t\t}\n\t}, [name, position, size]);\n\n\tconst handleMouseMove = useCallback((e: MouseEvent) => {\n\t\tif (isDragging) {\n\t\t\tsetPosition({\n\t\t\t\tx: e.clientX - dragStart.x,\n\t\t\t\ty: e.clientY - dragStart.y,\n\t\t\t});\n\t\t} else if (isResizing) {\n\t\t\tconst deltaX = e.clientX - resizeStart.mouseX;\n\t\t\tconst deltaY = e.clientY - resizeStart.mouseY;\n\n\t\t\tsetSize({\n\t\t\t\twidth: Math.max(resizeStart.width + deltaX, minWidth),\n\t\t\t\theight: Math.max(resizeStart.height + deltaY, minHeight),\n\t\t\t});\n\t\t}\n\t}, [isDragging, isResizing, dragStart, resizeStart, minWidth, minHeight]);\n\n\tconst handleMouseUp = useCallback(() => {\n\t\tsetIsDragging(false);\n\t\tsetIsResizing(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isDragging || isResizing) {\n\t\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\t} else {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);\n\n\tconst handleMouseDown = (e: React.MouseEvent) => {\n\t\tsetIsDragging(true);\n\t\tsetDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n\t};\n\n\tconst handleResizeStart = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tsetIsResizing(true);\n\t\tsetResizeStart({\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t\tmouseX: e.clientX,\n\t\t\tmouseY: e.clientY,\n\t\t});\n\t};\n\n\tconst pixelFrame = getFrame({\n\t\tsize: pixel,\n\t\tstroke,\n\t\tframe,\n\t\tbackground,\n\t});\n\n\treturn createPortal(\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tresize: 'none',\n\t\t\t\ttop: position.y,\n\t\t\t\tleft: position.x,\n\t\t\t\twidth: size.width,\n\t\t\t\theight: size.height,\n\t\t\t\tborderImage: `url(${pixelFrame})`,\n\t\t\t\tborderImageSlice: '49% 49% fill',\n\t\t\t\tborderImageWidth: `${pixel}px`,\n\t\t\t}}\n\t\t\tonMouseUp={handleMouseUp}\n\t\t>\n\t\t\t<div \n\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\tonMouseUp={handleMouseUp}\n\t\t\t\tstyle={{\n\t\t\t\t\theight: `${pixel}px`,\n\t\t\t\t\tcursor: \"grab\",\n\t\t\t\t\tuserSelect: \"none\"\n\t\t\t\t}}\n\t\t\t></div>\n\t\t\t<div style={{\n\t\t\t\tpadding: `${pixel}px`,\n\t\t\t\tpaddingTop: 0,\n\t\t\t\t...style\n\t\t\t}}>{children}</div>\n\t\t\t<div\n\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: `${pixel}px`,\n\t\t\t\t\theight: `${pixel}px`,\n\t\t\t\t\tcursor: 'se-resize',\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tright: 0,\n\t\t\t\t}}\n\t\t\t></div>\n\t\t</div>,\n\t\tdocument.body\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,SAAS,EAAE,MAAM,QAAQ,OAAAA,QAAO,WAAW,GAAgF;AAC1I,QAAM,SAAS;AACf,QAAM,MAAM,0vFACV,QAAQ,iBAAiB,KAAK,SAAS,CAAC,EACxC,QAAQ,mBAAmB,OAAO,SAAS,CAAC,EAC5C,QAAQ,mBAAmB,MAAM,EACjC,QAAQ,kBAAkBA,MAAK,EAC/B,QAAQ,uBAAuB,UAAU;AAG3C,QAAM,aAAa,mBAAmB,GAAG,EACvC,QAAQ,mBAAmB,CAAC,GAAG,OAAO,OAAO,aAAa,SAAS,IAAI,EAAE,CAAC,CAAC;AAE7E,SAAO,6BAA6B,KAAK,UAAU,CAAC;AACrD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AAA,IACX,CAAC;AAAA,EACF;AAEA,QAAM,aAAa,SAAS;AAAA,IAC3B,MAAM;AAAA,IACN;AAAA,IACA,OAAAA;AAAA,IACA;AAAA,EACD,CAAC;AAED,aAAO;AAAA,IACN;AAAA,MAAC;AAAA;AAAA,QACA,OAAO;AAAA,UACN,UAAU;AAAA,UACV,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,KAAK,SAAS;AAAA,UACd,MAAM,SAAS;AAAA,UACf,OAAO,KAAK;AAAA,UACZ,QAAQ,KAAK;AAAA,UACb,aAAa,OAAO,UAAU;AAAA,UAC9B,kBAAkB;AAAA,UAClB,kBAAkB,GAAG,KAAK;AAAA,QAC3B;AAAA,QACA,WAAW;AAAA,QAEX;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,aAAa;AAAA,cACb,WAAW;AAAA,cACX,OAAO;AAAA,gBACN,QAAQ,GAAG,KAAK;AAAA,gBAChB,QAAQ;AAAA,gBACR,YAAY;AAAA,cACb;AAAA;AAAA,UACA;AAAA,UACD,4CAAC,SAAI,OAAO;AAAA,YACX,SAAS,GAAG,KAAK;AAAA,YACjB,YAAY;AAAA,YACZ,GAAG;AAAA,UACJ,GAAI,UAAS;AAAA,UACb;AAAA,YAAC;AAAA;AAAA,cACA,aAAa;AAAA,cACb,OAAO;AAAA,gBACN,UAAU;AAAA,gBACV,OAAO,GAAG,KAAK;AAAA,gBACf,QAAQ,GAAG,KAAK;AAAA,gBAChB,QAAQ;AAAA,gBACR,QAAQ;AAAA,gBACR,OAAO;AAAA,cACR;AAAA;AAAA,UACA;AAAA;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":["frame","frame"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// src/frame.ts
|
|
2
|
+
function getFrame({ size, stroke, frame: frame2, background }) {
|
|
3
|
+
const height = size;
|
|
4
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="{{size}}" height="{{height}}" viewBox="0 0 12 12"><path fill="{{stroke}}" d="M2 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zM1 1h1v1H1z"/><path fill="{{frame}}" d="M2 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{stroke}}" d="M10 1h1v1h-1zM0 2h1v1H0z"/><path fill="{{frame}}" d="M1 2h1v1H1zm1 0h1v1H2z"/><path fill="{{stroke}}" d="M3 2h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{frame}}" d="M9 2h1v1H9zm1 0h1v1h-1z"/><path fill="{{stroke}}" d="M11 2h1v1h-1zM0 3h1v1H0z"/><path fill="{{frame}}" d="M1 3h1v1H1z"/><path fill="{{stroke}}" d="M2 3h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{frame}}" d="M10 3h1v1h-1z"/><path fill="{{stroke}}" d="M11 3h1v1h-1zM0 4h1v1H0z"/><path fill="{{frame}}" d="M1 4h1v1H1z"/><path fill="{{stroke}}" d="M2 4h1v1H2zm1 0h1v1H3z"/><path fill="{{background}}" d="M4 4h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z"/><path fill="{{stroke}}" d="M8 4h1v1H8zm1 0h1v1H9z"/><path fill="{{frame}}" d="M10 4h1v1h-1z"/><path fill="{{stroke}}" d="M11 4h1v1h-1zM0 5h1v1H0z"/><path fill="{{frame}}" d="M1 5h1v1H1z"/><path fill="{{stroke}}" d="M2 5h1v1H2z"/><path fill="{{background}}" d="M3 5h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 5h1v1H9z"/><path fill="{{frame}}" d="M10 5h1v1h-1z"/><path fill="{{stroke}}" d="M11 5h1v1h-1zM0 6h1v1H0z"/><path fill="{{frame}}" d="M1 6h1v1H1z"/><path fill="{{stroke}}" d="M2 6h1v1H2z"/><path fill="{{background}}" d="M3 6h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 6h1v1H9z"/><path fill="{{frame}}" d="M10 6h1v1h-1z"/><path fill="{{stroke}}" d="M11 6h1v1h-1zM0 7h1v1H0z"/><path fill="{{frame}}" d="M1 7h1v1H1z"/><path fill="{{stroke}}" d="M2 7h1v1H2z"/><path fill="{{background}}" d="M3 7h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{stroke}}" d="M9 7h1v1H9z"/><path fill="{{frame}}" d="M10 7h1v1h-1z"/><path fill="{{stroke}}" d="M11 7h1v1h-1zM0 8h1v1H0z"/><path fill="{{frame}}" d="M1 8h1v1H1zm1 0h1v1H2z"/><path fill="{{stroke}}" d="M3 8h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z"/><path fill="{{frame}}" d="M9 8h1v1H9zm1 0h1v1h-1z"/><path fill="{{stroke}}" d="M11 8h1v1h-1zM0 9h1v1H0zm1 0h1v1H1z"/><path fill="{{frame}}" d="M2 9h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/><path fill="{{stroke}}" d="M10 9h1v1h-1zm-9 1h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zm1 0h1v1h-1zm-8 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z"/></svg>'.replace(/\{\{size\}\}/g, size.toString()).replace(/\{\{height\}\}/g, height.toString()).replace(/\{\{stroke\}\}/g, stroke).replace(/\{\{frame\}\}/g, frame2).replace(/\{\{background\}\}/g, background);
|
|
5
|
+
const encodedSvg = encodeURIComponent(svg).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));
|
|
6
|
+
return `data:image/svg+xml;base64,${btoa(encodedSvg)}`;
|
|
7
|
+
}
|
|
8
|
+
function getCheckbox({ size, color }) {
|
|
9
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="{{width}}" height="{{height}}" viewBox="0 0 12 6"><rect width="1" height="1" x="1" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="4" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="7" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="8" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="9" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="10" y="0" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="1" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="2" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="3" fill="{{color}}"></rect><rect width="1" height="1" x="0" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="5" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="6" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="11" y="4" fill="{{color}}"></rect><rect width="1" height="1" x="1" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="2" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="3" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="4" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="7" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="8" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="9" y="5" fill="{{color}}"></rect><rect width="1" height="1" x="10" y="5" fill="{{color}}"></rect></svg>'.replace(/\{\{width\}\}/g, (size * 2).toString()).replace(/\{\{height\}\}/g, size.toString()).replace(/\{\{color\}\}/g, color);
|
|
10
|
+
const encodedSvg = encodeURIComponent(svg).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16))).replace(/#/g, "%23");
|
|
11
|
+
return `data:image/svg+xml;base64,${btoa(encodedSvg)}`;
|
|
12
|
+
}
|
|
13
|
+
var frame = getFrame({
|
|
14
|
+
size: 160,
|
|
15
|
+
stroke: "#000",
|
|
16
|
+
frame: "#333",
|
|
17
|
+
background: "#DDD"
|
|
18
|
+
});
|
|
19
|
+
var checkbox = getCheckbox({
|
|
20
|
+
size: 12,
|
|
21
|
+
color: "#000"
|
|
22
|
+
});
|
|
23
|
+
var checkboxLight = getCheckbox({
|
|
24
|
+
size: 12,
|
|
25
|
+
color: "#000"
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/index.tsx
|
|
29
|
+
import { useCallback, useEffect, useState } from "react";
|
|
30
|
+
import { createPortal } from "react-dom";
|
|
31
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
+
var PixelWindow = ({
|
|
33
|
+
style = {},
|
|
34
|
+
stroke = "#000",
|
|
35
|
+
frame: frame2 = "#333",
|
|
36
|
+
background = "#DDD",
|
|
37
|
+
pixel = 160,
|
|
38
|
+
children
|
|
39
|
+
}) => {
|
|
40
|
+
const pixelFrame = getFrame({
|
|
41
|
+
size: pixel,
|
|
42
|
+
stroke,
|
|
43
|
+
frame: frame2,
|
|
44
|
+
background
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: "window",
|
|
50
|
+
style: {
|
|
51
|
+
width: "100%",
|
|
52
|
+
height: "100%",
|
|
53
|
+
borderImage: `url(${pixelFrame})`,
|
|
54
|
+
borderImageSlice: "49% 49% fill",
|
|
55
|
+
borderImageWidth: `${pixel}px`
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ jsx("div", { style: { padding: `${pixel}px` }, children: /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
style: { boxSizing: "border-box", ...style },
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
) })
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
var FreePixelWindow = ({
|
|
68
|
+
name,
|
|
69
|
+
children,
|
|
70
|
+
pixel = 16,
|
|
71
|
+
stroke = "#000",
|
|
72
|
+
frame: frame2 = "#333",
|
|
73
|
+
background = "#DDD",
|
|
74
|
+
position: initialPosition = { x: 100, y: 100 },
|
|
75
|
+
style,
|
|
76
|
+
minWidth = 120,
|
|
77
|
+
minHeight = 100
|
|
78
|
+
}) => {
|
|
79
|
+
const [position, setPosition] = useState(() => {
|
|
80
|
+
if (name) {
|
|
81
|
+
const savedPosition = localStorage.getItem(`${name}-position`);
|
|
82
|
+
return savedPosition ? JSON.parse(savedPosition) : initialPosition;
|
|
83
|
+
}
|
|
84
|
+
return initialPosition;
|
|
85
|
+
});
|
|
86
|
+
const [size, setSize] = useState(() => {
|
|
87
|
+
const savedSize = localStorage.getItem(`${name}-size`);
|
|
88
|
+
return savedSize ? JSON.parse(savedSize) : { width: 300, height: 200 };
|
|
89
|
+
});
|
|
90
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
91
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
92
|
+
const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
|
|
93
|
+
const [resizeStart, setResizeStart] = useState({ width: 0, height: 0, mouseX: 0, mouseY: 0 });
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (name) {
|
|
96
|
+
localStorage.setItem(`${name}-position`, JSON.stringify(position));
|
|
97
|
+
localStorage.setItem(`${name}-size`, JSON.stringify(size));
|
|
98
|
+
}
|
|
99
|
+
}, [name, position, size]);
|
|
100
|
+
const handleMouseMove = useCallback((e) => {
|
|
101
|
+
if (isDragging) {
|
|
102
|
+
setPosition({
|
|
103
|
+
x: e.clientX - dragStart.x,
|
|
104
|
+
y: e.clientY - dragStart.y
|
|
105
|
+
});
|
|
106
|
+
} else if (isResizing) {
|
|
107
|
+
const deltaX = e.clientX - resizeStart.mouseX;
|
|
108
|
+
const deltaY = e.clientY - resizeStart.mouseY;
|
|
109
|
+
setSize({
|
|
110
|
+
width: Math.max(resizeStart.width + deltaX, minWidth),
|
|
111
|
+
height: Math.max(resizeStart.height + deltaY, minHeight)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, [isDragging, isResizing, dragStart, resizeStart, minWidth, minHeight]);
|
|
115
|
+
const handleMouseUp = useCallback(() => {
|
|
116
|
+
setIsDragging(false);
|
|
117
|
+
setIsResizing(false);
|
|
118
|
+
}, []);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (isDragging || isResizing) {
|
|
121
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
122
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
123
|
+
} else {
|
|
124
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
125
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
126
|
+
}
|
|
127
|
+
return () => {
|
|
128
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
129
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
130
|
+
};
|
|
131
|
+
}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);
|
|
132
|
+
const handleMouseDown = (e) => {
|
|
133
|
+
setIsDragging(true);
|
|
134
|
+
setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });
|
|
135
|
+
};
|
|
136
|
+
const handleResizeStart = (e) => {
|
|
137
|
+
e.stopPropagation();
|
|
138
|
+
setIsResizing(true);
|
|
139
|
+
setResizeStart({
|
|
140
|
+
width: size.width,
|
|
141
|
+
height: size.height,
|
|
142
|
+
mouseX: e.clientX,
|
|
143
|
+
mouseY: e.clientY
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const pixelFrame = getFrame({
|
|
147
|
+
size: pixel,
|
|
148
|
+
stroke,
|
|
149
|
+
frame: frame2,
|
|
150
|
+
background
|
|
151
|
+
});
|
|
152
|
+
return createPortal(
|
|
153
|
+
/* @__PURE__ */ jsxs(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
style: {
|
|
157
|
+
position: "absolute",
|
|
158
|
+
overflow: "hidden",
|
|
159
|
+
resize: "none",
|
|
160
|
+
top: position.y,
|
|
161
|
+
left: position.x,
|
|
162
|
+
width: size.width,
|
|
163
|
+
height: size.height,
|
|
164
|
+
borderImage: `url(${pixelFrame})`,
|
|
165
|
+
borderImageSlice: "49% 49% fill",
|
|
166
|
+
borderImageWidth: `${pixel}px`
|
|
167
|
+
},
|
|
168
|
+
onMouseUp: handleMouseUp,
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
onMouseDown: handleMouseDown,
|
|
174
|
+
onMouseUp: handleMouseUp,
|
|
175
|
+
style: {
|
|
176
|
+
height: `${pixel}px`,
|
|
177
|
+
cursor: "grab",
|
|
178
|
+
userSelect: "none"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
183
|
+
padding: `${pixel}px`,
|
|
184
|
+
paddingTop: 0,
|
|
185
|
+
...style
|
|
186
|
+
}, children }),
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
onMouseDown: handleResizeStart,
|
|
191
|
+
style: {
|
|
192
|
+
position: "absolute",
|
|
193
|
+
width: `${pixel}px`,
|
|
194
|
+
height: `${pixel}px`,
|
|
195
|
+
cursor: "se-resize",
|
|
196
|
+
bottom: 0,
|
|
197
|
+
right: 0
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
document.body
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
export {
|
|
208
|
+
FreePixelWindow,
|
|
209
|
+
PixelWindow,
|
|
210
|
+
checkbox,
|
|
211
|
+
checkboxLight,
|
|
212
|
+
frame,
|
|
213
|
+
getFrame
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/frame.ts","../src/index.tsx"],"sourcesContent":["export function getFrame({ size, stroke, frame, background }: { size: number; stroke: string; frame: string; background: string }): string {\n\tconst height = size; // Assuming square frames\n\tconst svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{{size}}\" height=\"{{height}}\" viewBox=\"0 0 12 12\"><path fill=\"{{stroke}}\" d=\"M2 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zM1 1h1v1H1z\"/><path fill=\"{{frame}}\" d=\"M2 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{stroke}}\" d=\"M10 1h1v1h-1zM0 2h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 2h1v1H1zm1 0h1v1H2z\"/><path fill=\"{{stroke}}\" d=\"M3 2h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{frame}}\" d=\"M9 2h1v1H9zm1 0h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 2h1v1h-1zM0 3h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 3h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 3h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 3h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 3h1v1h-1zM0 4h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 4h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 4h1v1H2zm1 0h1v1H3z\"/><path fill=\"{{background}}\" d=\"M4 4h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7z\"/><path fill=\"{{stroke}}\" d=\"M8 4h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 4h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 4h1v1h-1zM0 5h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 5h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 5h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 5h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 5h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 5h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 5h1v1h-1zM0 6h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 6h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 6h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 6h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 6h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 6h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 6h1v1h-1zM0 7h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 7h1v1H1z\"/><path fill=\"{{stroke}}\" d=\"M2 7h1v1H2z\"/><path fill=\"{{background}}\" d=\"M3 7h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{stroke}}\" d=\"M9 7h1v1H9z\"/><path fill=\"{{frame}}\" d=\"M10 7h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 7h1v1h-1zM0 8h1v1H0z\"/><path fill=\"{{frame}}\" d=\"M1 8h1v1H1zm1 0h1v1H2z\"/><path fill=\"{{stroke}}\" d=\"M3 8h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8z\"/><path fill=\"{{frame}}\" d=\"M9 8h1v1H9zm1 0h1v1h-1z\"/><path fill=\"{{stroke}}\" d=\"M11 8h1v1h-1zM0 9h1v1H0zm1 0h1v1H1z\"/><path fill=\"{{frame}}\" d=\"M2 9h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/><path fill=\"{{stroke}}\" d=\"M10 9h1v1h-1zm-9 1h1v1H1zm1 0h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9zm1 0h1v1h-1zm-8 1h1v1H2zm1 0h1v1H3zm1 0h1v1H4zm1 0h1v1H5zm1 0h1v1H6zm1 0h1v1H7zm1 0h1v1H8zm1 0h1v1H9z\"/></svg>'\n\t\t.replace(/\\{\\{size\\}\\}/g, size.toString())\n\t\t.replace(/\\{\\{height\\}\\}/g, height.toString())\n\t\t.replace(/\\{\\{stroke\\}\\}/g, stroke)\n\t\t.replace(/\\{\\{frame\\}\\}/g, frame)\n\t\t.replace(/\\{\\{background\\}\\}/g, background);\n\n\t// Encode SVG to Base64 safely\n\tconst encodedSvg = encodeURIComponent(svg)\n\t\t.replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)));\n\n\treturn `data:image/svg+xml;base64,${btoa(encodedSvg)}`;\n}\n\nfunction getCheckbox({ size, color }: { size: number; color: string }) {\n\tconst svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{{width}}\" height=\"{{height}}\" viewBox=\"0 0 12 6\"><rect width=\"1\" height=\"1\" x=\"1\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"4\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"7\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"8\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"9\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"10\" y=\"0\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"1\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"2\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"3\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"0\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"5\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"6\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"11\" y=\"4\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"1\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"2\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"3\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"4\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"7\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"8\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"9\" y=\"5\" fill=\"{{color}}\"></rect><rect width=\"1\" height=\"1\" x=\"10\" y=\"5\" fill=\"{{color}}\"></rect></svg>'\n\t\t.replace(/\\{\\{width\\}\\}/g, (size*2).toString())\n\t\t.replace(/\\{\\{height\\}\\}/g, size.toString())\n\t\t.replace(/\\{\\{color\\}\\}/g, color)\n \n\tconst encodedSvg = encodeURIComponent(svg)\n\t\t.replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16)))\n\t\t.replace(/#/g, '%23');\n\n\treturn `data:image/svg+xml;base64,${btoa(encodedSvg)}`;\n\n}\n\nexport const frame = getFrame({\n\tsize: 160,\n\tstroke: '#000',\n\tframe: '#333',\n\tbackground: '#DDD',\n});\n\nexport const checkbox = getCheckbox({\n\tsize: 12,\n\tcolor: '#000',\n});\nexport const checkboxLight = getCheckbox({\n\tsize: 12,\n\tcolor: '#000',\n});\n","import { getFrame } from './frame';\nimport { useCallback, useEffect, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\n\nexport const PixelWindow = ({\n\tstyle = {},\n\tstroke = '#000',\n\tframe = '#333',\n\tbackground = '#DDD',\n\tpixel = 160,\n\tchildren,\n}: {\n\tstyle?: React.CSSProperties,\n\tpixel?: number,\n\tstroke?: string\n\tframe?: string\n\tbackground?: string\n\tchildren: ReactNode;\n}) => {\n\n\tconst pixelFrame = getFrame({\n\t\tsize: pixel,\n\t\tstroke,\n\t\tframe,\n\t\tbackground,\n\t});\n\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"window\"\n\t\t\tstyle={{\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tborderImage: `url(${pixelFrame})`,\n\t\t\t\tborderImageSlice: '49% 49% fill',\n\t\t\t\tborderImageWidth: `${pixel}px`,\n\t\t\t}}\n\t\t>\n\t\t\t<div style={{ padding: `${pixel}px`}}>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{ boxSizing: 'border-box', ...style }}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport const FreePixelWindow = ({\n\tname,\n\tchildren,\n\tpixel = 16,\n\tstroke = '#000',\n\tframe = '#333',\n\tbackground = '#DDD',\n\tposition: initialPosition = { x: 100, y: 100 },\n\tstyle,\n\tminWidth = 120,\n\tminHeight = 100,\n}: {\n\tname?: string;\n\tchildren: ReactNode;\n\tpixel?: number;\n\tstroke?: string;\n\tframe?: string;\n\tbackground?: string;\n\tposition?: { x: number; y: number };\n\tstyle?: React.CSSProperties;\n\tminWidth?: number;\n\tminHeight?: number;\n}) => {\n\n\tconst [position, setPosition] = useState(() => {\n\t\tif (name) {\n\t\t\tconst savedPosition = localStorage.getItem(`${name}-position`);\n\t\t\treturn savedPosition ? JSON.parse(savedPosition) : initialPosition;\n\t\t}\n\t\treturn initialPosition;\n\t});\n\n\tconst [size, setSize] = useState(() => {\n\t\tconst savedSize = localStorage.getItem(`${name}-size`);\n\t\treturn savedSize ? JSON.parse(savedSize) : { width: 300, height: 200 };\n\t});\n\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [dragStart, setDragStart] = useState({ x: 0, y: 0 });\n\tconst [resizeStart, setResizeStart] = useState({ width: 0, height: 0, mouseX: 0, mouseY: 0 });\n\n\tuseEffect(() => {\n\t\tif (name) {\n\t\t\tlocalStorage.setItem(`${name}-position`, JSON.stringify(position));\n\t\t\tlocalStorage.setItem(`${name}-size`, JSON.stringify(size));\n\n\t\t}\n\t}, [name, position, size]);\n\n\tconst handleMouseMove = useCallback((e: MouseEvent) => {\n\t\tif (isDragging) {\n\t\t\tsetPosition({\n\t\t\t\tx: e.clientX - dragStart.x,\n\t\t\t\ty: e.clientY - dragStart.y,\n\t\t\t});\n\t\t} else if (isResizing) {\n\t\t\tconst deltaX = e.clientX - resizeStart.mouseX;\n\t\t\tconst deltaY = e.clientY - resizeStart.mouseY;\n\n\t\t\tsetSize({\n\t\t\t\twidth: Math.max(resizeStart.width + deltaX, minWidth),\n\t\t\t\theight: Math.max(resizeStart.height + deltaY, minHeight),\n\t\t\t});\n\t\t}\n\t}, [isDragging, isResizing, dragStart, resizeStart, minWidth, minHeight]);\n\n\tconst handleMouseUp = useCallback(() => {\n\t\tsetIsDragging(false);\n\t\tsetIsResizing(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isDragging || isResizing) {\n\t\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\t} else {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);\n\n\tconst handleMouseDown = (e: React.MouseEvent) => {\n\t\tsetIsDragging(true);\n\t\tsetDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n\t};\n\n\tconst handleResizeStart = (e: React.MouseEvent) => {\n\t\te.stopPropagation();\n\t\tsetIsResizing(true);\n\t\tsetResizeStart({\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t\tmouseX: e.clientX,\n\t\t\tmouseY: e.clientY,\n\t\t});\n\t};\n\n\tconst pixelFrame = getFrame({\n\t\tsize: pixel,\n\t\tstroke,\n\t\tframe,\n\t\tbackground,\n\t});\n\n\treturn createPortal(\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tresize: 'none',\n\t\t\t\ttop: position.y,\n\t\t\t\tleft: position.x,\n\t\t\t\twidth: size.width,\n\t\t\t\theight: size.height,\n\t\t\t\tborderImage: `url(${pixelFrame})`,\n\t\t\t\tborderImageSlice: '49% 49% fill',\n\t\t\t\tborderImageWidth: `${pixel}px`,\n\t\t\t}}\n\t\t\tonMouseUp={handleMouseUp}\n\t\t>\n\t\t\t<div \n\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\tonMouseUp={handleMouseUp}\n\t\t\t\tstyle={{\n\t\t\t\t\theight: `${pixel}px`,\n\t\t\t\t\tcursor: \"grab\",\n\t\t\t\t\tuserSelect: \"none\"\n\t\t\t\t}}\n\t\t\t></div>\n\t\t\t<div style={{\n\t\t\t\tpadding: `${pixel}px`,\n\t\t\t\tpaddingTop: 0,\n\t\t\t\t...style\n\t\t\t}}>{children}</div>\n\t\t\t<div\n\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: `${pixel}px`,\n\t\t\t\t\theight: `${pixel}px`,\n\t\t\t\t\tcursor: 'se-resize',\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tright: 0,\n\t\t\t\t}}\n\t\t\t></div>\n\t\t</div>,\n\t\tdocument.body\n\t);\n};\n"],"mappings":";AAAO,SAAS,SAAS,EAAE,MAAM,QAAQ,OAAAA,QAAO,WAAW,GAAgF;AAC1I,QAAM,SAAS;AACf,QAAM,MAAM,0vFACV,QAAQ,iBAAiB,KAAK,SAAS,CAAC,EACxC,QAAQ,mBAAmB,OAAO,SAAS,CAAC,EAC5C,QAAQ,mBAAmB,MAAM,EACjC,QAAQ,kBAAkBA,MAAK,EAC/B,QAAQ,uBAAuB,UAAU;AAG3C,QAAM,aAAa,mBAAmB,GAAG,EACvC,QAAQ,mB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{
|
|
2
|
+
"name": "@glennjong/pixel-window",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"main": "dist/index.cjs.js",
|
|
5
|
+
"module": "dist/index.esm.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.esm.js",
|
|
11
|
+
"require": "./dist/index.cjs.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": ">=17.0.0",
|
|
19
|
+
"react-dom": ">=17.0.0"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
}
|
|
25
|
+
}
|