@tatamicks/core 0.3.1 → 1.0.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/README.md +518 -81
- package/dist/PalettePanel-CtXsH6Cb.js +5137 -0
- package/dist/PalettePanel-CtXsH6Cb.js.map +1 -0
- package/dist/PalettePanel-Dipvtj7D.cjs +9 -0
- package/dist/PalettePanel-Dipvtj7D.cjs.map +1 -0
- package/dist/PalettePanel.css +1 -0
- package/dist/canvas.cjs +1 -0
- package/dist/canvas.cjs.map +1 -0
- package/dist/canvas.mjs +354 -0
- package/dist/canvas.mjs.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +3 -1
- package/dist/index.css.d.ts +2 -0
- package/dist/index.mjs +1424 -6889
- package/dist/index.mjs.map +1 -1
- package/dist/paperSettingsWidget-DgDoBA0P.js +5137 -0
- package/dist/paperSettingsWidget-DgDoBA0P.js.map +1 -0
- package/dist/paperSettingsWidget-sLJsIUxS.cjs +2 -0
- package/dist/paperSettingsWidget-sLJsIUxS.cjs.map +1 -0
- package/dist/paperSettingsWidget.css +1 -0
- package/dist/shell.cjs +1 -0
- package/dist/shell.cjs.map +1 -0
- package/dist/shell.mjs +65 -0
- package/dist/shell.mjs.map +1 -0
- package/dist/sidebarPortal-C06y4JSP.js +723 -0
- package/dist/sidebarPortal-C06y4JSP.js.map +1 -0
- package/dist/sidebarPortal-C3HszQyp.cjs +1 -0
- package/dist/sidebarPortal-C3HszQyp.cjs.map +1 -0
- package/dist/src/canvas.d.ts +2523 -0
- package/dist/src/index.d.ts +1801 -2880
- package/dist/src/shell.d.ts +1982 -0
- package/package.json +21 -8
- package/dist/index.js +0 -70
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
import { jsxs as z, jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as k, useCallback as y } from "react";
|
|
3
|
+
var J = /* @__PURE__ */ ((t) => (t.left = "left", t.center = "center", t.right = "right", t))(J || {}), Y = /* @__PURE__ */ ((t) => (t.top = "top", t.center = "center", t.bottom = "bottom", t))(Y || {});
|
|
4
|
+
const xt = {
|
|
5
|
+
kind: "alignment",
|
|
6
|
+
defaultProps: {
|
|
7
|
+
horizontal: "left",
|
|
8
|
+
vertical: "center"
|
|
9
|
+
/* center */
|
|
10
|
+
}
|
|
11
|
+
}, kt = {
|
|
12
|
+
kind: "checkboxStyle",
|
|
13
|
+
defaultProps: {
|
|
14
|
+
styleConfig: {
|
|
15
|
+
checkboxSize: { value: 16, unit: "px" },
|
|
16
|
+
borderWidth: { value: 1, unit: "px" },
|
|
17
|
+
borderColor: "#000000",
|
|
18
|
+
checkWidth: { value: 3.5, unit: "px" },
|
|
19
|
+
checkColor: "#000000",
|
|
20
|
+
backgroundColor: "#ffffff",
|
|
21
|
+
checkedBackgroundColor: "#ffffff"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, U = "application/x-tatamicks-block", N = "application/x-tatamicks-block-kind-";
|
|
25
|
+
function Tt(t, r, n) {
|
|
26
|
+
if (!t.dataTransfer) return;
|
|
27
|
+
const e = { kind: r, defaultSize: n };
|
|
28
|
+
t.dataTransfer.setData(U, JSON.stringify(e)), t.dataTransfer.setData(`${N}${r}`, ""), t.dataTransfer.effectAllowed = "copy";
|
|
29
|
+
}
|
|
30
|
+
function It(t) {
|
|
31
|
+
if (!t.dataTransfer) return null;
|
|
32
|
+
const r = t.dataTransfer.getData(U);
|
|
33
|
+
if (!r) return null;
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(r);
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function At(t) {
|
|
41
|
+
if (!t.dataTransfer) return null;
|
|
42
|
+
const r = Array.from(t.dataTransfer.types).find(
|
|
43
|
+
(n) => n.startsWith(N)
|
|
44
|
+
);
|
|
45
|
+
return r ? r.slice(N.length) : null;
|
|
46
|
+
}
|
|
47
|
+
const Ot = {
|
|
48
|
+
colCount: 20,
|
|
49
|
+
rowCount: 28
|
|
50
|
+
};
|
|
51
|
+
var q = /* @__PURE__ */ ((t) => (t.A4 = "A4", t.B5 = "B5", t.A3 = "A3", t.LETTER = "Letter", t.LEGAL = "Legal", t.CUSTOM = "Custom", t))(q || {});
|
|
52
|
+
const Z = {
|
|
53
|
+
A4: {
|
|
54
|
+
preset: "A4",
|
|
55
|
+
width: { value: 210, unit: "mm" },
|
|
56
|
+
height: { value: 297, unit: "mm" }
|
|
57
|
+
},
|
|
58
|
+
A3: {
|
|
59
|
+
preset: "A3",
|
|
60
|
+
width: { value: 297, unit: "mm" },
|
|
61
|
+
height: { value: 420, unit: "mm" }
|
|
62
|
+
},
|
|
63
|
+
B5: {
|
|
64
|
+
preset: "B5",
|
|
65
|
+
width: { value: 182, unit: "mm" },
|
|
66
|
+
height: { value: 257, unit: "mm" }
|
|
67
|
+
},
|
|
68
|
+
Letter: {
|
|
69
|
+
preset: "Letter",
|
|
70
|
+
width: { value: 8.5, unit: "inch" },
|
|
71
|
+
height: { value: 11, unit: "inch" }
|
|
72
|
+
},
|
|
73
|
+
Legal: {
|
|
74
|
+
preset: "Legal",
|
|
75
|
+
width: { value: 8.5, unit: "inch" },
|
|
76
|
+
height: { value: 14, unit: "inch" }
|
|
77
|
+
},
|
|
78
|
+
Custom: {
|
|
79
|
+
preset: "Custom",
|
|
80
|
+
width: { value: 210, unit: "mm" },
|
|
81
|
+
height: { value: 297, unit: "mm" }
|
|
82
|
+
}
|
|
83
|
+
}, Q = {
|
|
84
|
+
top: { value: 10, unit: "mm" },
|
|
85
|
+
right: { value: 10, unit: "mm" },
|
|
86
|
+
bottom: { value: 10, unit: "mm" },
|
|
87
|
+
left: { value: 10, unit: "mm" }
|
|
88
|
+
}, yt = {
|
|
89
|
+
size: Z.A4,
|
|
90
|
+
margin: Q
|
|
91
|
+
}, Rt = {
|
|
92
|
+
// ==================== GridLayer (10-90) ====================
|
|
93
|
+
GRID_CANVAS: 10,
|
|
94
|
+
MARGIN_OVERLAY: 20,
|
|
95
|
+
GRID_OVERLAY: 30,
|
|
96
|
+
BORDER_OVERLAY: 40,
|
|
97
|
+
// ==================== BlockLayer (100-999,999) ====================
|
|
98
|
+
BLOCK_LAYER_MIN: 100,
|
|
99
|
+
BLOCK_LAYER_MAX: 999999,
|
|
100
|
+
BLOCK_LAYER_STEP: 100,
|
|
101
|
+
// ==================== InteractionLayer (2,000,000+) ====================
|
|
102
|
+
SELECT_BLOCK: 2e6,
|
|
103
|
+
INTERACTION_LAYER_BASE: 21e5,
|
|
104
|
+
BLOCK_GHOST: 22e5,
|
|
105
|
+
HOVER_OUTLINE: 23e5,
|
|
106
|
+
EDIT_BLOCK: 24e5,
|
|
107
|
+
BLOCK_SELECT_BORDER: 25e5,
|
|
108
|
+
BLOCK_HANDLES: 26e5,
|
|
109
|
+
SELECTION_ACTION_BAR: 265e4,
|
|
110
|
+
GRID_GHOST: 27e5,
|
|
111
|
+
DROPDOWN: 34e5
|
|
112
|
+
}, Nt = {
|
|
113
|
+
BG: 10,
|
|
114
|
+
CONTENT: 50,
|
|
115
|
+
GUIDE: 70,
|
|
116
|
+
BORDER: 80,
|
|
117
|
+
VALIDATION: 90
|
|
118
|
+
};
|
|
119
|
+
function St(t, r) {
|
|
120
|
+
const n = t.match(/^(\d+(?:\.\d+)?)([a-zA-Z%]+)$/);
|
|
121
|
+
if (!n)
|
|
122
|
+
throw new Error(`Invalid dimension string: ${t}`);
|
|
123
|
+
const e = Number(n[1]), o = n[2];
|
|
124
|
+
if (!r.includes(o))
|
|
125
|
+
throw new Error(`Invalid unit: ${o}`);
|
|
126
|
+
return { value: e, unit: o };
|
|
127
|
+
}
|
|
128
|
+
function Lt(t) {
|
|
129
|
+
return `${t.value}${t.unit}`;
|
|
130
|
+
}
|
|
131
|
+
const g = 96, tt = 10, H = 25.4, rt = 0.352778, nt = H / g, h = {
|
|
132
|
+
fromCm: (t) => t * tt,
|
|
133
|
+
fromInch: (t) => t * H,
|
|
134
|
+
fromPt: (t) => t * rt,
|
|
135
|
+
fromPx: (t) => t * nt,
|
|
136
|
+
fromDim(t) {
|
|
137
|
+
switch (t.unit) {
|
|
138
|
+
case "mm":
|
|
139
|
+
return t.value;
|
|
140
|
+
case "cm":
|
|
141
|
+
return h.fromCm(t.value);
|
|
142
|
+
case "inch":
|
|
143
|
+
return h.fromInch(t.value);
|
|
144
|
+
case "pt":
|
|
145
|
+
return h.fromPt(t.value);
|
|
146
|
+
case "px":
|
|
147
|
+
return h.fromPx(t.value);
|
|
148
|
+
case "fr":
|
|
149
|
+
case "%":
|
|
150
|
+
throw new Error(
|
|
151
|
+
`Cannot convert ${t.unit} to mm. Use physical units only.`
|
|
152
|
+
);
|
|
153
|
+
default: {
|
|
154
|
+
const r = t.unit;
|
|
155
|
+
throw new Error(`Unsupported unit: ${r}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, et = 25.4, ot = 2.54, at = 72, l = {
|
|
160
|
+
fromMm: (t, r = g) => t * r / et,
|
|
161
|
+
fromCm: (t, r = g) => t * r / ot,
|
|
162
|
+
fromInch: (t, r = g) => t * r,
|
|
163
|
+
fromPt: (t, r = g) => t * r / at,
|
|
164
|
+
// CSS px(96dpi 基準)を指定 DPI のスクリーン物理 px に変換
|
|
165
|
+
fromPx: (t, r = g) => t * r / g,
|
|
166
|
+
fromDim(t, r = g, n) {
|
|
167
|
+
switch (t.unit) {
|
|
168
|
+
case "mm":
|
|
169
|
+
return l.fromMm(t.value, r);
|
|
170
|
+
case "cm":
|
|
171
|
+
return l.fromCm(t.value, r);
|
|
172
|
+
case "inch":
|
|
173
|
+
return l.fromInch(t.value, r);
|
|
174
|
+
case "pt":
|
|
175
|
+
return l.fromPt(t.value, r);
|
|
176
|
+
case "px":
|
|
177
|
+
return l.fromPx(t.value, r);
|
|
178
|
+
case "%":
|
|
179
|
+
if (n === void 0)
|
|
180
|
+
throw new Error("Base size must be defined for percentage values.");
|
|
181
|
+
return t.value / 100 * n;
|
|
182
|
+
case "fr":
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Cannot convert ${t.unit} to px. Use physical units only.`
|
|
185
|
+
);
|
|
186
|
+
default: {
|
|
187
|
+
const e = t.unit;
|
|
188
|
+
throw new Error(`Unsupported unit: ${e}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
function A(t) {
|
|
194
|
+
if (t === null) return !0;
|
|
195
|
+
switch (typeof t) {
|
|
196
|
+
case "string":
|
|
197
|
+
case "number":
|
|
198
|
+
case "boolean":
|
|
199
|
+
return !0;
|
|
200
|
+
case "object":
|
|
201
|
+
return Array.isArray(t) ? t.every(A) : Object.getPrototypeOf(t) === Object.prototype ? Object.values(t).every(A) : !1;
|
|
202
|
+
default:
|
|
203
|
+
return !1;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function O(t) {
|
|
207
|
+
if (t === null || typeof t != "object" || Array.isArray(t) || Object.getPrototypeOf(t) !== Object.prototype)
|
|
208
|
+
throw new Error("values must be a plain object");
|
|
209
|
+
const r = t;
|
|
210
|
+
for (const [n, e] of Object.entries(r))
|
|
211
|
+
if (!A(e))
|
|
212
|
+
throw new Error(`values["${n}"] contains an invalid value`);
|
|
213
|
+
return r;
|
|
214
|
+
}
|
|
215
|
+
function Ct(t) {
|
|
216
|
+
let r;
|
|
217
|
+
try {
|
|
218
|
+
r = JSON.parse(t);
|
|
219
|
+
} catch {
|
|
220
|
+
throw new SyntaxError("invalid JSON for values");
|
|
221
|
+
}
|
|
222
|
+
return O(r);
|
|
223
|
+
}
|
|
224
|
+
function it(t) {
|
|
225
|
+
if (typeof t != "object" || t === null) return !1;
|
|
226
|
+
const r = t;
|
|
227
|
+
return !(typeof r.colCount != "number" || r.colCount < 1 || typeof r.rowCount != "number" || r.rowCount < 1);
|
|
228
|
+
}
|
|
229
|
+
function st(t) {
|
|
230
|
+
if (typeof t == "string") return !0;
|
|
231
|
+
if (typeof t != "object" || t === null) return !1;
|
|
232
|
+
const r = t;
|
|
233
|
+
if (typeof r.path != "string") return !1;
|
|
234
|
+
const n = (e) => e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
235
|
+
return "eq" in r ? n(r.eq) : "neq" in r ? n(r.neq) : !1;
|
|
236
|
+
}
|
|
237
|
+
function ct(t) {
|
|
238
|
+
if (typeof t != "object" || t === null) return !1;
|
|
239
|
+
const r = t;
|
|
240
|
+
if (typeof r.id != "string" || typeof r.kind != "string" || typeof r.layout != "object" || r.layout === null) return !1;
|
|
241
|
+
const n = r.layout;
|
|
242
|
+
if (typeof n.x != "number" || typeof n.y != "number" || typeof n.w != "number" || typeof n.h != "number" || typeof r.props != "object" || r.props === null || Array.isArray(r.props))
|
|
243
|
+
return !1;
|
|
244
|
+
try {
|
|
245
|
+
O(r.props);
|
|
246
|
+
} catch {
|
|
247
|
+
return !1;
|
|
248
|
+
}
|
|
249
|
+
return !("initValue" in r && !A(r.initValue) || "hiddenBinding" in r && !st(r.hiddenBinding));
|
|
250
|
+
}
|
|
251
|
+
function W(t) {
|
|
252
|
+
if (typeof t != "object" || t === null)
|
|
253
|
+
throw new Error("Page must be an object");
|
|
254
|
+
const r = t;
|
|
255
|
+
if (r.id !== void 0 && typeof r.id != "string")
|
|
256
|
+
throw new Error("Page.id must be a string if provided");
|
|
257
|
+
if (!it(r.grid))
|
|
258
|
+
throw new Error("Invalid grid definition");
|
|
259
|
+
if (!Array.isArray(r.blocks))
|
|
260
|
+
throw new Error("blocks must be an array");
|
|
261
|
+
if (!r.blocks.every(ct))
|
|
262
|
+
throw new Error("Invalid block definition in blocks array");
|
|
263
|
+
if (r.metaData !== void 0) {
|
|
264
|
+
if (typeof r.metaData != "object" || r.metaData === null)
|
|
265
|
+
throw new Error("metaData must be an object if provided");
|
|
266
|
+
try {
|
|
267
|
+
O(r.metaData);
|
|
268
|
+
} catch (n) {
|
|
269
|
+
throw new Error(
|
|
270
|
+
`Invalid metaData: ${n instanceof Error ? n.message : String(n)}`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (r.blockDefaults !== void 0) {
|
|
275
|
+
if (typeof r.blockDefaults != "object" || r.blockDefaults === null || Array.isArray(r.blockDefaults))
|
|
276
|
+
throw new Error("blockDefaults must be a plain object if provided");
|
|
277
|
+
const n = r.blockDefaults;
|
|
278
|
+
for (const [e, o] of Object.entries(n))
|
|
279
|
+
try {
|
|
280
|
+
O(o);
|
|
281
|
+
} catch (i) {
|
|
282
|
+
throw new Error(
|
|
283
|
+
`Invalid blockDefaults["${e}"]: ${i instanceof Error ? i.message : String(i)}`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return t;
|
|
288
|
+
}
|
|
289
|
+
function ut(t) {
|
|
290
|
+
if (typeof t != "object" || t === null)
|
|
291
|
+
throw new Error("Book must be an object");
|
|
292
|
+
const r = t;
|
|
293
|
+
if (!Array.isArray(r.pages) || r.pages.length === 0)
|
|
294
|
+
throw new Error("Book must have at least one page in pages");
|
|
295
|
+
if (r.pages.forEach((n, e) => {
|
|
296
|
+
try {
|
|
297
|
+
W(n);
|
|
298
|
+
} catch (o) {
|
|
299
|
+
throw new Error(
|
|
300
|
+
`Invalid Page at pages[${e}]: ${o instanceof Error ? o.message : String(o)}`
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
}), !r.paper || typeof r.paper != "object")
|
|
304
|
+
throw new Error("Book.paper is required and must be an object");
|
|
305
|
+
return t;
|
|
306
|
+
}
|
|
307
|
+
function Bt(t) {
|
|
308
|
+
return JSON.stringify(t);
|
|
309
|
+
}
|
|
310
|
+
function jt(t) {
|
|
311
|
+
return JSON.stringify(t);
|
|
312
|
+
}
|
|
313
|
+
function $t(t) {
|
|
314
|
+
let r;
|
|
315
|
+
try {
|
|
316
|
+
r = JSON.parse(t);
|
|
317
|
+
} catch {
|
|
318
|
+
throw new SyntaxError("invalid JSON for Page");
|
|
319
|
+
}
|
|
320
|
+
return W(r);
|
|
321
|
+
}
|
|
322
|
+
function Ut(t) {
|
|
323
|
+
let r;
|
|
324
|
+
try {
|
|
325
|
+
r = JSON.parse(t);
|
|
326
|
+
} catch {
|
|
327
|
+
throw new SyntaxError("invalid JSON for Book");
|
|
328
|
+
}
|
|
329
|
+
return ut(r);
|
|
330
|
+
}
|
|
331
|
+
function Ht({
|
|
332
|
+
checked: t,
|
|
333
|
+
styleConfig: r
|
|
334
|
+
}) {
|
|
335
|
+
const n = (r == null ? void 0 : r.borderColor) ?? "#000000", e = (r == null ? void 0 : r.checkColor) ?? "#000000", o = t ? (r == null ? void 0 : r.checkedBackgroundColor) ?? "#ffffff" : (r == null ? void 0 : r.backgroundColor) ?? "#ffffff", i = r != null && r.borderWidth ? l.fromDim(r.borderWidth) : 1, s = r != null && r.checkWidth ? l.fromDim(r.checkWidth) : 3.5;
|
|
336
|
+
return /* @__PURE__ */ z(
|
|
337
|
+
"svg",
|
|
338
|
+
{
|
|
339
|
+
viewBox: "0 0 20 20",
|
|
340
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
341
|
+
style: { width: "100%", height: "100%", display: "block" },
|
|
342
|
+
"aria-hidden": "true",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ S(
|
|
345
|
+
"rect",
|
|
346
|
+
{
|
|
347
|
+
x: "2",
|
|
348
|
+
y: "2",
|
|
349
|
+
width: "16",
|
|
350
|
+
height: "16",
|
|
351
|
+
rx: "2",
|
|
352
|
+
ry: "2",
|
|
353
|
+
fill: o,
|
|
354
|
+
stroke: n,
|
|
355
|
+
strokeWidth: i
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
t && /* @__PURE__ */ S(
|
|
359
|
+
"path",
|
|
360
|
+
{
|
|
361
|
+
d: "M3 11l4 4L17 4",
|
|
362
|
+
fill: "none",
|
|
363
|
+
stroke: e,
|
|
364
|
+
strokeWidth: s,
|
|
365
|
+
strokeLinecap: "round",
|
|
366
|
+
strokeLinejoin: "round"
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
var lt = /* @__PURE__ */ ((t) => (t.SOLID = "solid", t.DASHED = "dashed", t.DOTTED = "dotted", t))(lt || {}), ft = /* @__PURE__ */ ((t) => (t.FORM = "Form", t.EDIT = "Edit", t.VIEW = "View", t))(ft || {});
|
|
374
|
+
const a = {
|
|
375
|
+
MM: "mm",
|
|
376
|
+
CM: "cm",
|
|
377
|
+
FR: "fr",
|
|
378
|
+
INCH: "inch",
|
|
379
|
+
PT: "pt",
|
|
380
|
+
PX: "px",
|
|
381
|
+
PERCENT: "%"
|
|
382
|
+
}, Wt = [
|
|
383
|
+
a.MM,
|
|
384
|
+
a.CM,
|
|
385
|
+
a.FR,
|
|
386
|
+
a.INCH,
|
|
387
|
+
a.PT,
|
|
388
|
+
a.PX,
|
|
389
|
+
a.PERCENT
|
|
390
|
+
], Gt = [
|
|
391
|
+
a.MM,
|
|
392
|
+
a.CM,
|
|
393
|
+
a.INCH,
|
|
394
|
+
a.PT,
|
|
395
|
+
a.PX
|
|
396
|
+
], Kt = [a.MM, a.CM, a.INCH], Vt = [
|
|
397
|
+
a.MM,
|
|
398
|
+
a.CM,
|
|
399
|
+
a.FR,
|
|
400
|
+
a.INCH,
|
|
401
|
+
a.PT,
|
|
402
|
+
a.PX
|
|
403
|
+
], Ft = [a.PX, a.PT, a.MM], Xt = [a.PT, a.PX, a.MM], zt = [
|
|
404
|
+
a.MM,
|
|
405
|
+
a.PT,
|
|
406
|
+
a.PX,
|
|
407
|
+
a.PERCENT
|
|
408
|
+
], Jt = [
|
|
409
|
+
a.MM,
|
|
410
|
+
a.CM,
|
|
411
|
+
a.INCH,
|
|
412
|
+
a.PT,
|
|
413
|
+
a.PX,
|
|
414
|
+
a.PERCENT
|
|
415
|
+
];
|
|
416
|
+
var mt = /* @__PURE__ */ ((t) => (t.normal = "normal", t.breakWord = "break-word", t.breakAll = "break-all", t))(mt || {}), ht = /* @__PURE__ */ ((t) => (t.normal = "normal", t.nowrap = "nowrap", t.pre = "pre", t.preWrap = "pre-wrap", t.preLine = "pre-line", t))(ht || {}), dt = /* @__PURE__ */ ((t) => (t.text = "text", t.number = "number", t.email = "email", t.tel = "tel", t.url = "url", t.date = "date", t.password = "password", t))(dt || {});
|
|
417
|
+
const Yt = {
|
|
418
|
+
kind: "textBehavior",
|
|
419
|
+
defaultProps: {
|
|
420
|
+
lineHeight: 1.2,
|
|
421
|
+
multiline: !0,
|
|
422
|
+
wordWrap: "normal",
|
|
423
|
+
whiteSpace: "normal"
|
|
424
|
+
/* normal */
|
|
425
|
+
}
|
|
426
|
+
}, qt = {
|
|
427
|
+
kind: "textValidation",
|
|
428
|
+
defaultProps: {
|
|
429
|
+
inputType: "text"
|
|
430
|
+
/* text */
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
function Zt(t) {
|
|
434
|
+
return `move-arrow-session-${t}`;
|
|
435
|
+
}
|
|
436
|
+
function Qt(t, r) {
|
|
437
|
+
return `layout-${t}-${[...r].sort().join(",")}`;
|
|
438
|
+
}
|
|
439
|
+
function tr(t) {
|
|
440
|
+
return `binding-${t}`;
|
|
441
|
+
}
|
|
442
|
+
function rr(t) {
|
|
443
|
+
return `initValue-${t}`;
|
|
444
|
+
}
|
|
445
|
+
function nr(t) {
|
|
446
|
+
return `grid-size-${t}`;
|
|
447
|
+
}
|
|
448
|
+
function er(t) {
|
|
449
|
+
return `resize-arrow-session-${t}`;
|
|
450
|
+
}
|
|
451
|
+
const G = { value: 1, unit: "fr" };
|
|
452
|
+
function wt(t) {
|
|
453
|
+
return Array.from(
|
|
454
|
+
{ length: t.colCount },
|
|
455
|
+
(r, n) => {
|
|
456
|
+
var e;
|
|
457
|
+
return ((e = t.cols) == null ? void 0 : e[n]) ?? G;
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
function gt(t) {
|
|
462
|
+
return Array.from(
|
|
463
|
+
{ length: t.rowCount },
|
|
464
|
+
(r, n) => {
|
|
465
|
+
var e;
|
|
466
|
+
return ((e = t.rows) == null ? void 0 : e[n]) ?? G;
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
function or(t) {
|
|
471
|
+
const r = {};
|
|
472
|
+
for (let n = 0; n < t.length; n++) {
|
|
473
|
+
const e = t[n];
|
|
474
|
+
e !== void 0 && !(e.value === 1 && e.unit === "fr") && (r[n] = e);
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
colCount: t.length,
|
|
478
|
+
cols: Object.keys(r).length > 0 ? r : void 0
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function ar(t) {
|
|
482
|
+
const r = {};
|
|
483
|
+
for (let n = 0; n < t.length; n++) {
|
|
484
|
+
const e = t[n];
|
|
485
|
+
e !== void 0 && !(e.value === 1 && e.unit === "fr") && (r[n] = e);
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
rowCount: t.length,
|
|
489
|
+
rows: Object.keys(r).length > 0 ? r : void 0
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function bt(t) {
|
|
493
|
+
const r = k(() => wt(t), [t]), n = k(() => gt(t), [t]);
|
|
494
|
+
return { expandedCols: r, expandedRows: n };
|
|
495
|
+
}
|
|
496
|
+
function Mt(t) {
|
|
497
|
+
if (t.length === 0) return [];
|
|
498
|
+
const r = [];
|
|
499
|
+
let n = 0;
|
|
500
|
+
for (const e of t) {
|
|
501
|
+
const o = e + n, i = Math.round(o);
|
|
502
|
+
r.push(i), n = o - i;
|
|
503
|
+
}
|
|
504
|
+
return r;
|
|
505
|
+
}
|
|
506
|
+
const Et = 8, pt = 32, vt = 64, Pt = 512, L = (t, r, n) => Math.min(Math.max(t, r), n);
|
|
507
|
+
function C(t) {
|
|
508
|
+
const r = t.length - 1, n = r >= 1 ? t[r] ?? 0 : 0, e = t.length >= 1 ? n / r : 0, o = L(Math.ceil(Math.log2(r + 1)), Et, pt), i = L(e * 2, vt, Pt);
|
|
509
|
+
return { step: o, windowPx: i };
|
|
510
|
+
}
|
|
511
|
+
function R(t, r) {
|
|
512
|
+
const n = r.length - 1;
|
|
513
|
+
if (n <= 0 || r[0] === void 0 || t < r[0] || r[n] === void 0) return -1;
|
|
514
|
+
if (t >= r[n]) return n - 1;
|
|
515
|
+
let e = 1, o = n;
|
|
516
|
+
for (; e <= o; ) {
|
|
517
|
+
const i = e + o >>> 1, s = r[i];
|
|
518
|
+
if (s === void 0) {
|
|
519
|
+
o = i - 1;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
s <= t ? e = i + 1 : o = i - 1;
|
|
523
|
+
}
|
|
524
|
+
return e - 1;
|
|
525
|
+
}
|
|
526
|
+
function B(t, r, n) {
|
|
527
|
+
const e = t.length - 1;
|
|
528
|
+
let o = 0;
|
|
529
|
+
return (i) => {
|
|
530
|
+
if (e <= 0 || t[0] === void 0 || i < t[0] || t[e] === void 0) return -1;
|
|
531
|
+
if (i >= t[e]) return e - 1;
|
|
532
|
+
const s = t[o], u = t[o + 1];
|
|
533
|
+
if (s === void 0 || u === void 0) return -1;
|
|
534
|
+
if (s <= i && i < u) return o;
|
|
535
|
+
const w = s - n, v = u + n;
|
|
536
|
+
if (i < w || i >= v)
|
|
537
|
+
return o = R(i, t), o;
|
|
538
|
+
let T = 0;
|
|
539
|
+
const I = t[o + 1];
|
|
540
|
+
if (I !== void 0 && i >= I)
|
|
541
|
+
for (; o + 1 < e; ) {
|
|
542
|
+
const P = t[o + 1];
|
|
543
|
+
if (P === void 0 || i < P) break;
|
|
544
|
+
if (o++, ++T > r)
|
|
545
|
+
return o = R(i, t), o;
|
|
546
|
+
}
|
|
547
|
+
else
|
|
548
|
+
for (; o > 0; ) {
|
|
549
|
+
const P = t[o];
|
|
550
|
+
if (P === void 0 || i >= P) break;
|
|
551
|
+
if (o--, ++T > r)
|
|
552
|
+
return o = R(i, t), o;
|
|
553
|
+
}
|
|
554
|
+
return o;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function j(t, r) {
|
|
558
|
+
if (t.length === 0) return [];
|
|
559
|
+
let n = 0, e = 0;
|
|
560
|
+
const o = t.map((u) => {
|
|
561
|
+
if (u.unit === "fr")
|
|
562
|
+
return n += u.value, null;
|
|
563
|
+
const w = h.fromDim(u);
|
|
564
|
+
return e += w, w;
|
|
565
|
+
});
|
|
566
|
+
if (n === 0)
|
|
567
|
+
return o;
|
|
568
|
+
const s = Math.max(0, r - e) / n;
|
|
569
|
+
return o.map((u, w) => {
|
|
570
|
+
if (u != null) return u;
|
|
571
|
+
const v = t[w];
|
|
572
|
+
if (!v) throw new Error(`dims[${w}] is undefined`);
|
|
573
|
+
return v.value * s;
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
function $(t, r = g) {
|
|
577
|
+
const n = t.map((e) => l.fromMm(e, r));
|
|
578
|
+
return Mt(n);
|
|
579
|
+
}
|
|
580
|
+
function ir(t, r, n = g) {
|
|
581
|
+
const { expandedCols: e, expandedRows: o } = bt(r), i = k(() => {
|
|
582
|
+
var _;
|
|
583
|
+
const d = t.orientation ? t.size.height : t.size.width, E = t.orientation ? t.size.width : t.size.height, b = h.fromDim(d), p = h.fromDim(E), f = t.margin.bulk && ((_ = t.margin.all) != null && _.unit) ? h.fromDim(t.margin.all) : void 0, c = f ?? h.fromDim(t.margin.top), m = f ?? h.fromDim(t.margin.bottom), M = f ?? h.fromDim(t.margin.left), D = f ?? h.fromDim(t.margin.right);
|
|
584
|
+
return {
|
|
585
|
+
canvasWidthMm: b,
|
|
586
|
+
canvasHeightMm: p,
|
|
587
|
+
marginTopMm: c,
|
|
588
|
+
marginBottomMm: m,
|
|
589
|
+
marginLeftMm: M,
|
|
590
|
+
marginRightMm: D,
|
|
591
|
+
contentWidthMm: Math.max(0, b - M - D),
|
|
592
|
+
contentHeightMm: Math.max(
|
|
593
|
+
0,
|
|
594
|
+
p - c - m
|
|
595
|
+
)
|
|
596
|
+
};
|
|
597
|
+
}, [t]), s = k(() => {
|
|
598
|
+
const {
|
|
599
|
+
canvasWidthMm: d,
|
|
600
|
+
canvasHeightMm: E,
|
|
601
|
+
marginTopMm: b,
|
|
602
|
+
marginBottomMm: p,
|
|
603
|
+
marginLeftMm: f,
|
|
604
|
+
marginRightMm: c,
|
|
605
|
+
contentWidthMm: m,
|
|
606
|
+
contentHeightMm: M
|
|
607
|
+
} = i;
|
|
608
|
+
return {
|
|
609
|
+
canvas: {
|
|
610
|
+
width: l.fromMm(d, n),
|
|
611
|
+
height: l.fromMm(E, n)
|
|
612
|
+
},
|
|
613
|
+
margin: {
|
|
614
|
+
top: l.fromMm(b, n),
|
|
615
|
+
bottom: l.fromMm(p, n),
|
|
616
|
+
left: l.fromMm(f, n),
|
|
617
|
+
right: l.fromMm(c, n)
|
|
618
|
+
},
|
|
619
|
+
content: {
|
|
620
|
+
width: l.fromMm(m, n),
|
|
621
|
+
height: l.fromMm(M, n)
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
}, [i, n]), { gridPosPx: u, colIndexer: w, rowIndexer: v } = k(() => {
|
|
625
|
+
const { contentWidthMm: d, contentHeightMm: E } = i, b = $(j(e, d), n), p = $(j(o, E), n), f = [0];
|
|
626
|
+
for (const x of b)
|
|
627
|
+
f.push((f[f.length - 1] ?? 0) + x);
|
|
628
|
+
const c = [0];
|
|
629
|
+
for (const x of p)
|
|
630
|
+
c.push((c[c.length - 1] ?? 0) + x);
|
|
631
|
+
const { step: m, windowPx: M } = C(f), { step: D, windowPx: _ } = C(c);
|
|
632
|
+
return {
|
|
633
|
+
gridPosPx: { cols: f, rows: c },
|
|
634
|
+
colIndexer: B(f, m, M),
|
|
635
|
+
rowIndexer: B(c, D, _)
|
|
636
|
+
};
|
|
637
|
+
}, [i, e, o, n]), T = y(
|
|
638
|
+
(d) => w(d - s.margin.left),
|
|
639
|
+
[w, s]
|
|
640
|
+
), I = y(
|
|
641
|
+
(d) => v(d - s.margin.top),
|
|
642
|
+
[v, s]
|
|
643
|
+
), P = y(
|
|
644
|
+
(d) => {
|
|
645
|
+
const { x: E, y: b, w: p, h: f } = d.layout, c = u.cols, m = u.rows;
|
|
646
|
+
if (!c.length || !m.length)
|
|
647
|
+
return { left: 0, top: 0, width: 0, height: 0 };
|
|
648
|
+
const M = Math.min(Math.max(0, E), c.length - 1), D = Math.min(Math.max(0, E + p), c.length - 1), _ = Math.min(Math.max(0, b), m.length - 1), x = Math.min(Math.max(0, b + f), m.length - 1), K = (c[M] ?? 0) + s.margin.left, V = (m[_] ?? 0) + s.margin.top, F = (c[D] ?? 0) - (c[M] ?? 0), X = (m[x] ?? 0) - (m[_] ?? 0);
|
|
649
|
+
return { left: K, top: V, width: F, height: X };
|
|
650
|
+
},
|
|
651
|
+
[u, s]
|
|
652
|
+
);
|
|
653
|
+
return {
|
|
654
|
+
paperPx: s,
|
|
655
|
+
gridPosPx: u,
|
|
656
|
+
getColIndex: T,
|
|
657
|
+
getRowIndex: I,
|
|
658
|
+
getBlockRectPx: P
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
const sr = '[data-sidebar="true"]', cr = { "data-sidebar": "true" };
|
|
662
|
+
export {
|
|
663
|
+
or as $,
|
|
664
|
+
Gt as A,
|
|
665
|
+
Ft as B,
|
|
666
|
+
W as C,
|
|
667
|
+
g as D,
|
|
668
|
+
O as E,
|
|
669
|
+
Xt as F,
|
|
670
|
+
Vt as G,
|
|
671
|
+
J as H,
|
|
672
|
+
dt as I,
|
|
673
|
+
Ht as J,
|
|
674
|
+
tr as K,
|
|
675
|
+
lt as L,
|
|
676
|
+
Nt as M,
|
|
677
|
+
ft as N,
|
|
678
|
+
er as O,
|
|
679
|
+
q as P,
|
|
680
|
+
Zt as Q,
|
|
681
|
+
rr as R,
|
|
682
|
+
cr as S,
|
|
683
|
+
bt as T,
|
|
684
|
+
a as U,
|
|
685
|
+
Y as V,
|
|
686
|
+
ht as W,
|
|
687
|
+
At as X,
|
|
688
|
+
U as Y,
|
|
689
|
+
Rt as Z,
|
|
690
|
+
It as _,
|
|
691
|
+
Ot as a,
|
|
692
|
+
ar as a0,
|
|
693
|
+
sr as a1,
|
|
694
|
+
wt as a2,
|
|
695
|
+
gt as a3,
|
|
696
|
+
Qt as a4,
|
|
697
|
+
nr as a5,
|
|
698
|
+
yt as b,
|
|
699
|
+
Q as c,
|
|
700
|
+
Z as d,
|
|
701
|
+
Ut as e,
|
|
702
|
+
$t as f,
|
|
703
|
+
Ct as g,
|
|
704
|
+
Bt as h,
|
|
705
|
+
Wt as i,
|
|
706
|
+
zt as j,
|
|
707
|
+
Kt as k,
|
|
708
|
+
Jt as l,
|
|
709
|
+
mt as m,
|
|
710
|
+
xt as n,
|
|
711
|
+
kt as o,
|
|
712
|
+
ut as p,
|
|
713
|
+
Lt as q,
|
|
714
|
+
A as r,
|
|
715
|
+
jt as s,
|
|
716
|
+
Tt as t,
|
|
717
|
+
ir as u,
|
|
718
|
+
St as v,
|
|
719
|
+
Yt as w,
|
|
720
|
+
qt as x,
|
|
721
|
+
h as y,
|
|
722
|
+
l as z
|
|
723
|
+
};
|