@lls/vivi 24.1.7-d088161a → 24.1.7-e05728e4
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/lib/assets/vivi.css +185 -63
- package/lib/index.js +1396 -861
- package/package.json +6 -7
package/lib/index.js
CHANGED
|
@@ -58,7 +58,8 @@ var init_layoutTemplate = __esm({
|
|
|
58
58
|
|
|
59
59
|
// src/utils/template.ts
|
|
60
60
|
import _3 from "lodash/fp.js";
|
|
61
|
-
|
|
61
|
+
import { nanoid } from "nanoid";
|
|
62
|
+
var getDocumentByUuid, getDepth, parseErrorsInContentMd, getDocumentUniqueId, getMissingUuid, getMissingId, updateTemplate, addDocumentToTemplate, deleteDocumentFromTemplate;
|
|
62
63
|
var init_template = __esm({
|
|
63
64
|
"src/utils/template.ts"() {
|
|
64
65
|
"use strict";
|
|
@@ -91,6 +92,32 @@ var init_template = __esm({
|
|
|
91
92
|
return node;
|
|
92
93
|
});
|
|
93
94
|
};
|
|
95
|
+
addDocumentToTemplate = (template, partialDoc) => {
|
|
96
|
+
const uuid = nanoid();
|
|
97
|
+
const children = [
|
|
98
|
+
...template.children ?? [],
|
|
99
|
+
{
|
|
100
|
+
// id: newCardId(), //TODO vraisemblablement inutile. A supprimer si création de page côté BE ok sans
|
|
101
|
+
uuid,
|
|
102
|
+
contentMd: ""
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
const layouts = {
|
|
106
|
+
primary: [
|
|
107
|
+
...template?.layouts?.primary ?? [],
|
|
108
|
+
{
|
|
109
|
+
id: uuid,
|
|
110
|
+
...partialDoc
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
};
|
|
114
|
+
return { ...template, children, layouts };
|
|
115
|
+
};
|
|
116
|
+
deleteDocumentFromTemplate = (template, docUuid) => {
|
|
117
|
+
const children = template.children?.filter((child) => child.uuid !== docUuid) ?? [];
|
|
118
|
+
const layouts = { primary: template.layouts?.primary?.filter((doc) => doc.id !== docUuid) ?? [] };
|
|
119
|
+
return { ...template, children, layouts };
|
|
120
|
+
};
|
|
94
121
|
}
|
|
95
122
|
});
|
|
96
123
|
|
|
@@ -267,9 +294,9 @@ var init_mode = __esm({
|
|
|
267
294
|
}
|
|
268
295
|
});
|
|
269
296
|
|
|
270
|
-
// css-modules:css-modules://
|
|
271
|
-
var
|
|
272
|
-
"css-modules:css-modules://
|
|
297
|
+
// css-modules:css-modules://SiZlRV2YWb1jY5gExVMrYPMZB79ONPQM_B3jhc8NVMM.css
|
|
298
|
+
var init_SiZlRV2YWb1jY5gExVMrYPMZB79ONPQM_B3jhc8NVMM = __esm({
|
|
299
|
+
"css-modules:css-modules://SiZlRV2YWb1jY5gExVMrYPMZB79ONPQM_B3jhc8NVMM.css"() {
|
|
273
300
|
}
|
|
274
301
|
});
|
|
275
302
|
|
|
@@ -278,8 +305,8 @@ var src_components_core_DocumentToolbar_default;
|
|
|
278
305
|
var init_src_components_core_DocumentToolbar = __esm({
|
|
279
306
|
"tmp_esbuild/_src_components_core_DocumentToolbar.module.css"() {
|
|
280
307
|
"use strict";
|
|
281
|
-
|
|
282
|
-
src_components_core_DocumentToolbar_default = { "
|
|
308
|
+
init_SiZlRV2YWb1jY5gExVMrYPMZB79ONPQM_B3jhc8NVMM();
|
|
309
|
+
src_components_core_DocumentToolbar_default = { "toggleMenuButton": "vv-JySIna-toggleMenuButton", "parentToolbar": "vv-JySIna-parentToolbar", "toolbar": "vv-JySIna-toolbar" };
|
|
283
310
|
}
|
|
284
311
|
});
|
|
285
312
|
|
|
@@ -292,7 +319,7 @@ var init_DocumentToolbar = __esm({
|
|
|
292
319
|
});
|
|
293
320
|
|
|
294
321
|
// src/components/core/DocumentToolbar.tsx
|
|
295
|
-
import {
|
|
322
|
+
import { useCallback, useState } from "react";
|
|
296
323
|
import { Button, Tooltip, Z_DOCUMENT_TOOLBAR } from "@lls/lls-kit";
|
|
297
324
|
import { cx } from "@lls/utils";
|
|
298
325
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -359,50 +386,9 @@ var init_DocumentToolbar2 = __esm({
|
|
|
359
386
|
}
|
|
360
387
|
});
|
|
361
388
|
|
|
362
|
-
//
|
|
363
|
-
var
|
|
364
|
-
|
|
365
|
-
"src/constants/index.ts"() {
|
|
366
|
-
"use strict";
|
|
367
|
-
VIVI_CLASSNAME = "lls-vivi";
|
|
368
|
-
VIVI_COMPONENT_CLASSNAME_PREFIX = `${VIVI_CLASSNAME}-`;
|
|
369
|
-
DOCUMENT_CLASSNAME = `${VIVI_COMPONENT_CLASSNAME_PREFIX}document-root`;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// src/utils/string.ts
|
|
374
|
-
import _8 from "lodash/fp.js";
|
|
375
|
-
var OPENING_TAG_CHAR, ESCAPED_OPENING_TAG_CHAR, CLOSING_TAG_CHAR, removeTrailingNewLines, escapeTags, escapeTagContent;
|
|
376
|
-
var init_string = __esm({
|
|
377
|
-
"src/utils/string.ts"() {
|
|
378
|
-
"use strict";
|
|
379
|
-
OPENING_TAG_CHAR = "<";
|
|
380
|
-
ESCAPED_OPENING_TAG_CHAR = "_<_";
|
|
381
|
-
CLOSING_TAG_CHAR = "</";
|
|
382
|
-
removeTrailingNewLines = _8.replace(/(\r?\n|\r)+$/, "");
|
|
383
|
-
escapeTags = (content) => _8.isString(content) ? content.replace(new RegExp(OPENING_TAG_CHAR, "g"), ESCAPED_OPENING_TAG_CHAR) : content;
|
|
384
|
-
escapeTagContent = (tagName, str) => {
|
|
385
|
-
if (!_8.isString(tagName) || !_8.isString(str))
|
|
386
|
-
return str;
|
|
387
|
-
const tagRegex = /((?:<[^>]+>)|(?:[^<]+))/;
|
|
388
|
-
const tokens = _8.flow(_8.split(tagRegex), _8.compact)(str);
|
|
389
|
-
let out = "";
|
|
390
|
-
let tagDepth = 0;
|
|
391
|
-
for (const token of tokens) {
|
|
392
|
-
if (token.startsWith(`${CLOSING_TAG_CHAR}${tagName}`))
|
|
393
|
-
tagDepth--;
|
|
394
|
-
out += tagDepth > 0 ? escapeTags(token) : token;
|
|
395
|
-
if (token.startsWith(`${OPENING_TAG_CHAR}${tagName}`))
|
|
396
|
-
tagDepth++;
|
|
397
|
-
}
|
|
398
|
-
return out;
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
// css-modules:css-modules://4JkF5C825c4pv8Vosat9qIwv9j-m3hEXWHpgSlQTM8A.css
|
|
404
|
-
var init_JkF5C825c4pv8Vosat9qIwv9j_m3hEXWHpgSlQTM8A = __esm({
|
|
405
|
-
"css-modules:css-modules://4JkF5C825c4pv8Vosat9qIwv9j-m3hEXWHpgSlQTM8A.css"() {
|
|
389
|
+
// css-modules:css-modules://zZWuUZWdv3guaQJ1cvM0SwHTxY4fYPtYqwbv1rmUg_o.css
|
|
390
|
+
var init_zZWuUZWdv3guaQJ1cvM0SwHTxY4fYPtYqwbv1rmUg_o = __esm({
|
|
391
|
+
"css-modules:css-modules://zZWuUZWdv3guaQJ1cvM0SwHTxY4fYPtYqwbv1rmUg_o.css"() {
|
|
406
392
|
}
|
|
407
393
|
});
|
|
408
394
|
|
|
@@ -411,7 +397,7 @@ var src_components_core_ErrorBoundary_default;
|
|
|
411
397
|
var init_src_components_core_ErrorBoundary = __esm({
|
|
412
398
|
"tmp_esbuild/_src_components_core_ErrorBoundary.module.css"() {
|
|
413
399
|
"use strict";
|
|
414
|
-
|
|
400
|
+
init_zZWuUZWdv3guaQJ1cvM0SwHTxY4fYPtYqwbv1rmUg_o();
|
|
415
401
|
src_components_core_ErrorBoundary_default = { "errorBoundary": "vv-yYzCbG-errorBoundary" };
|
|
416
402
|
}
|
|
417
403
|
});
|
|
@@ -425,7 +411,7 @@ var init_ErrorBoundary = __esm({
|
|
|
425
411
|
});
|
|
426
412
|
|
|
427
413
|
// src/components/core/ErrorBoundary.tsx
|
|
428
|
-
import
|
|
414
|
+
import React from "react";
|
|
429
415
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
430
416
|
var ErrorBoundary, ErrorBoundary_default;
|
|
431
417
|
var init_ErrorBoundary2 = __esm({
|
|
@@ -433,7 +419,7 @@ var init_ErrorBoundary2 = __esm({
|
|
|
433
419
|
"use strict";
|
|
434
420
|
init_mode();
|
|
435
421
|
init_ErrorBoundary();
|
|
436
|
-
ErrorBoundary = class extends
|
|
422
|
+
ErrorBoundary = class extends React.Component {
|
|
437
423
|
constructor(props) {
|
|
438
424
|
super(props);
|
|
439
425
|
this.state = { hasError: false, message: "", componentStack: "" };
|
|
@@ -471,139 +457,659 @@ var init_ErrorBoundary2 = __esm({
|
|
|
471
457
|
}
|
|
472
458
|
});
|
|
473
459
|
|
|
474
|
-
//
|
|
475
|
-
var
|
|
476
|
-
|
|
460
|
+
// src/constants/index.ts
|
|
461
|
+
var VIVI_CLASSNAME, VIVI_COMPONENT_CLASSNAME_PREFIX, DOCUMENT_CLASSNAME;
|
|
462
|
+
var init_constants = __esm({
|
|
463
|
+
"src/constants/index.ts"() {
|
|
464
|
+
"use strict";
|
|
465
|
+
VIVI_CLASSNAME = "lls-vivi";
|
|
466
|
+
VIVI_COMPONENT_CLASSNAME_PREFIX = `${VIVI_CLASSNAME}-`;
|
|
467
|
+
DOCUMENT_CLASSNAME = `${VIVI_COMPONENT_CLASSNAME_PREFIX}document-root`;
|
|
477
468
|
}
|
|
478
469
|
});
|
|
479
470
|
|
|
480
|
-
//
|
|
481
|
-
|
|
482
|
-
var
|
|
483
|
-
|
|
471
|
+
// src/utils/string.ts
|
|
472
|
+
import _8 from "lodash/fp.js";
|
|
473
|
+
var OPENING_TAG_CHAR, ESCAPED_OPENING_TAG_CHAR, CLOSING_TAG_CHAR, removeTrailingNewLines, escapeTags, escapeTagContent;
|
|
474
|
+
var init_string = __esm({
|
|
475
|
+
"src/utils/string.ts"() {
|
|
484
476
|
"use strict";
|
|
485
|
-
|
|
486
|
-
|
|
477
|
+
OPENING_TAG_CHAR = "<";
|
|
478
|
+
ESCAPED_OPENING_TAG_CHAR = "_<_";
|
|
479
|
+
CLOSING_TAG_CHAR = "</";
|
|
480
|
+
removeTrailingNewLines = _8.replace(/(\r?\n|\r)+$/, "");
|
|
481
|
+
escapeTags = (content) => _8.isString(content) ? content.replace(new RegExp(OPENING_TAG_CHAR, "g"), ESCAPED_OPENING_TAG_CHAR) : content;
|
|
482
|
+
escapeTagContent = (tagName, str) => {
|
|
483
|
+
if (!_8.isString(tagName) || !_8.isString(str))
|
|
484
|
+
return str;
|
|
485
|
+
const tagRegex = /((?:<[^>]+>)|(?:[^<]+))/;
|
|
486
|
+
const tokens = _8.flow(_8.split(tagRegex), _8.compact)(str);
|
|
487
|
+
let out = "";
|
|
488
|
+
let tagDepth = 0;
|
|
489
|
+
for (const token of tokens) {
|
|
490
|
+
if (token.startsWith(`${CLOSING_TAG_CHAR}${tagName}`))
|
|
491
|
+
tagDepth--;
|
|
492
|
+
out += tagDepth > 0 ? escapeTags(token) : token;
|
|
493
|
+
if (token.startsWith(`${OPENING_TAG_CHAR}${tagName}`))
|
|
494
|
+
tagDepth++;
|
|
495
|
+
}
|
|
496
|
+
return out;
|
|
497
|
+
};
|
|
487
498
|
}
|
|
488
499
|
});
|
|
489
500
|
|
|
490
|
-
// src/
|
|
491
|
-
var
|
|
492
|
-
|
|
501
|
+
// src/constants/grid.ts
|
|
502
|
+
var GRID_ZONES_COLORS, ILLUSTRATION_ASPECT_RATIO;
|
|
503
|
+
var init_grid = __esm({
|
|
504
|
+
"src/constants/grid.ts"() {
|
|
505
|
+
"use strict";
|
|
506
|
+
GRID_ZONES_COLORS = [
|
|
507
|
+
"var(--primary-40-color)",
|
|
508
|
+
"var(--secondary-40-color)",
|
|
509
|
+
"var(--premium-40-color)",
|
|
510
|
+
"var(--green-40-color)",
|
|
511
|
+
"var(--purple-40-color)",
|
|
512
|
+
"var(--orange-40-color)",
|
|
513
|
+
"var(--gray-40-color)",
|
|
514
|
+
"var(--primary-70-color)",
|
|
515
|
+
"var(--secondary-70-color)",
|
|
516
|
+
"var(--premium-70-color)",
|
|
517
|
+
"var(--green-70-color)",
|
|
518
|
+
"var(--purple-70-color)",
|
|
519
|
+
"var(--orange-70-color)"
|
|
520
|
+
];
|
|
521
|
+
ILLUSTRATION_ASPECT_RATIO = 3149 / 2126;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// src/utils/url.ts
|
|
526
|
+
var asLlsWebp;
|
|
527
|
+
var init_url = __esm({
|
|
528
|
+
"src/utils/url.ts"() {
|
|
493
529
|
"use strict";
|
|
494
|
-
|
|
530
|
+
asLlsWebp = (url) => {
|
|
531
|
+
return /https:\/\/assets(-mid|-lite|-dev|-dev-mid|-dev-lite)?\.lls\.fr.*\.(png|jpe?g)$/.test(url) ? url.replace(/\.(png|jpe?g)$/, ".webp") : url;
|
|
532
|
+
};
|
|
495
533
|
}
|
|
496
534
|
});
|
|
497
535
|
|
|
498
|
-
// css-modules:css-modules://
|
|
499
|
-
var
|
|
500
|
-
"css-modules:css-modules://
|
|
536
|
+
// css-modules:css-modules://vFzhiihuB7Z8HMP8oT-qcw0NyCnSgKQtL5TqEfjnBaQ.css
|
|
537
|
+
var init_vFzhiihuB7Z8HMP8oT_qcw0NyCnSgKQtL5TqEfjnBaQ = __esm({
|
|
538
|
+
"css-modules:css-modules://vFzhiihuB7Z8HMP8oT-qcw0NyCnSgKQtL5TqEfjnBaQ.css"() {
|
|
501
539
|
}
|
|
502
540
|
});
|
|
503
541
|
|
|
504
|
-
// tmp_esbuild/
|
|
505
|
-
var
|
|
506
|
-
var
|
|
507
|
-
"tmp_esbuild/
|
|
542
|
+
// tmp_esbuild/_src_components_primarygrid_EditGrid.module.css
|
|
543
|
+
var src_components_primarygrid_EditGrid_default;
|
|
544
|
+
var init_src_components_primarygrid_EditGrid = __esm({
|
|
545
|
+
"tmp_esbuild/_src_components_primarygrid_EditGrid.module.css"() {
|
|
508
546
|
"use strict";
|
|
509
|
-
|
|
510
|
-
|
|
547
|
+
init_vFzhiihuB7Z8HMP8oT_qcw0NyCnSgKQtL5TqEfjnBaQ();
|
|
548
|
+
src_components_primarygrid_EditGrid_default = { "col": "vv-WWJSSq-col", "zonePicture": "vv-WWJSSq-zonePicture", "interface": "vv-WWJSSq-interface", "zone": "vv-WWJSSq-zone", "editGrid": "vv-WWJSSq-editGrid", "layout": "vv-WWJSSq-layout", "addZone": "vv-WWJSSq-addZone", "row": "vv-WWJSSq-row", "interfaceHeader": "vv-WWJSSq-interfaceHeader" };
|
|
511
549
|
}
|
|
512
550
|
});
|
|
513
551
|
|
|
514
|
-
// src/components/primarygrid/
|
|
515
|
-
var
|
|
516
|
-
"src/components/primarygrid/
|
|
552
|
+
// src/components/primarygrid/EditGrid.module.css
|
|
553
|
+
var init_EditGrid = __esm({
|
|
554
|
+
"src/components/primarygrid/EditGrid.module.css"() {
|
|
517
555
|
"use strict";
|
|
518
|
-
|
|
556
|
+
init_src_components_primarygrid_EditGrid();
|
|
519
557
|
}
|
|
520
558
|
});
|
|
521
559
|
|
|
522
|
-
// src/
|
|
523
|
-
var
|
|
524
|
-
var
|
|
525
|
-
"src/
|
|
560
|
+
// src/constants/zoneMaker.ts
|
|
561
|
+
var HANDLES, MAGNET_ATTRACTION_ZONE;
|
|
562
|
+
var init_zoneMaker = __esm({
|
|
563
|
+
"src/constants/zoneMaker.ts"() {
|
|
526
564
|
"use strict";
|
|
527
|
-
|
|
528
|
-
|
|
565
|
+
HANDLES = [
|
|
566
|
+
{
|
|
567
|
+
id: "NW",
|
|
568
|
+
left: 0,
|
|
569
|
+
top: 0
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
id: "N",
|
|
573
|
+
left: 50,
|
|
574
|
+
top: 0
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: "NE",
|
|
578
|
+
left: 100,
|
|
579
|
+
top: 0
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
id: "E",
|
|
583
|
+
left: 100,
|
|
584
|
+
top: 50
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "SE",
|
|
588
|
+
left: 100,
|
|
589
|
+
top: 100
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: "S",
|
|
593
|
+
left: 50,
|
|
594
|
+
top: 100
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
id: "SW",
|
|
598
|
+
left: 0,
|
|
599
|
+
top: 100
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
id: "W",
|
|
603
|
+
left: 0,
|
|
604
|
+
top: 50
|
|
605
|
+
}
|
|
606
|
+
];
|
|
607
|
+
MAGNET_ATTRACTION_ZONE = 10;
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// src/utils/zoneMaker.ts
|
|
612
|
+
import _9 from "lodash/fp.js";
|
|
613
|
+
var roundAndBound, getMagnets, dragZoneWithMagnets, dragZone, magnetCursorPosition, resizeZone;
|
|
614
|
+
var init_zoneMaker2 = __esm({
|
|
615
|
+
"src/utils/zoneMaker.ts"() {
|
|
616
|
+
"use strict";
|
|
617
|
+
init_zoneMaker();
|
|
618
|
+
roundAndBound = (val, min = 0, max = 100) => Math.max(min, Math.min(max, Math.round(val * 10) / 10));
|
|
619
|
+
getMagnets = ({
|
|
620
|
+
containerRect,
|
|
621
|
+
zones,
|
|
622
|
+
currentZoneId
|
|
623
|
+
}) => {
|
|
624
|
+
return _9.flow(
|
|
625
|
+
() => zones,
|
|
626
|
+
_9.filter((zone) => zone.id !== currentZoneId),
|
|
627
|
+
_9.flatMap((zone) => [
|
|
628
|
+
[containerRect.x + containerRect.width * zone.x / 100, containerRect.y + containerRect.height * zone.y / 100],
|
|
629
|
+
[containerRect.x + containerRect.width * (zone.x + zone.w) / 100, containerRect.y + containerRect.height * (zone.y + zone.h) / 100]
|
|
630
|
+
]),
|
|
631
|
+
_9.unzip,
|
|
632
|
+
(result) => ({ x: result[0] ?? [], y: result[1] ?? [] })
|
|
633
|
+
)();
|
|
634
|
+
};
|
|
635
|
+
dragZoneWithMagnets = ({ containerRect, zone, magnets }) => {
|
|
636
|
+
const zoneInPx = {
|
|
637
|
+
x: containerRect.x + zone.x * containerRect.width / 100,
|
|
638
|
+
w: zone.w * containerRect.width / 100,
|
|
639
|
+
y: containerRect.y + zone.y * containerRect.height / 100,
|
|
640
|
+
h: zone.h * containerRect.height / 100
|
|
641
|
+
};
|
|
642
|
+
const sortedMagnetWithX = _9.sortBy((coordinate) => Math.abs(coordinate - zoneInPx.x), magnets.x);
|
|
643
|
+
const sortedMagnetWithW = _9.sortBy((coordinate) => Math.abs(coordinate - (zoneInPx.x + zoneInPx.w)), magnets.x);
|
|
644
|
+
const sortedMagnetWithY = _9.sortBy((coordinate) => Math.abs(coordinate - zoneInPx.y), magnets.y);
|
|
645
|
+
const sortedMagnetWithH = _9.sortBy((coordinate) => Math.abs(coordinate - (zoneInPx.y + zoneInPx.h)), magnets.y);
|
|
646
|
+
const draggedX = Math.abs(sortedMagnetWithX[0] - zoneInPx.x) < Math.abs(sortedMagnetWithW[0] - (zoneInPx.x + zoneInPx.w)) && Math.abs(sortedMagnetWithX[0] - zoneInPx.x) <= MAGNET_ATTRACTION_ZONE ? (sortedMagnetWithX[0] - containerRect.x) / containerRect.width * 100 : Math.abs(sortedMagnetWithW[0] - (zoneInPx.x + zoneInPx.w)) <= MAGNET_ATTRACTION_ZONE ? (sortedMagnetWithW[0] - zoneInPx.w - containerRect.x) / containerRect.width * 100 : zone.x;
|
|
647
|
+
const draggedY = Math.abs(sortedMagnetWithY[0] - zoneInPx.y) < Math.abs(sortedMagnetWithH[0] - (zoneInPx.y + zoneInPx.h)) && Math.abs(sortedMagnetWithY[0] - zoneInPx.y) <= MAGNET_ATTRACTION_ZONE ? (sortedMagnetWithY[0] - containerRect.y) / containerRect.height * 100 : Math.abs(sortedMagnetWithH[0] - (zoneInPx.y + zoneInPx.h)) <= MAGNET_ATTRACTION_ZONE ? (sortedMagnetWithH[0] - zoneInPx.h - containerRect.y) / containerRect.height * 100 : zone.y;
|
|
648
|
+
return {
|
|
649
|
+
...zone,
|
|
650
|
+
x: draggedX,
|
|
651
|
+
y: draggedY
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
dragZone = ({
|
|
655
|
+
zone,
|
|
656
|
+
magnets,
|
|
657
|
+
startPosition,
|
|
658
|
+
cursorPosition,
|
|
659
|
+
containerRect
|
|
660
|
+
}) => {
|
|
661
|
+
const cursorMoveX = (cursorPosition.x - startPosition.x) / containerRect.width * 100;
|
|
662
|
+
const cursorMoveY = (cursorPosition.y - startPosition.y) / containerRect.height * 100;
|
|
663
|
+
const newX = roundAndBound(zone.x + cursorMoveX, 0, 100 - zone.w);
|
|
664
|
+
const newY = roundAndBound(zone.y + cursorMoveY, 0, 100 - zone.h);
|
|
665
|
+
const magnettedZone = dragZoneWithMagnets({
|
|
666
|
+
containerRect,
|
|
667
|
+
zone: {
|
|
668
|
+
...zone,
|
|
669
|
+
x: newX,
|
|
670
|
+
y: newY
|
|
671
|
+
},
|
|
672
|
+
magnets
|
|
673
|
+
});
|
|
674
|
+
return magnettedZone;
|
|
675
|
+
};
|
|
676
|
+
magnetCursorPosition = (cursorPosition, magnets) => {
|
|
677
|
+
const sortedMagnetX = _9.sortBy((coordinate) => Math.abs(coordinate - cursorPosition.x), magnets.x);
|
|
678
|
+
const sortedMagnetY = _9.sortBy((coordinate) => Math.abs(coordinate - cursorPosition.y), magnets.y);
|
|
679
|
+
const x = sortedMagnetX[0] !== void 0 && Math.abs(sortedMagnetX[0] - cursorPosition.x) <= MAGNET_ATTRACTION_ZONE ? sortedMagnetX[0] : cursorPosition.x;
|
|
680
|
+
const y = sortedMagnetY[0] !== void 0 && Math.abs(sortedMagnetY[0] - cursorPosition.y) <= MAGNET_ATTRACTION_ZONE ? sortedMagnetY[0] : cursorPosition.y;
|
|
681
|
+
return {
|
|
682
|
+
x,
|
|
683
|
+
y
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
resizeZone = ({
|
|
687
|
+
zone,
|
|
688
|
+
handleId,
|
|
689
|
+
magnets,
|
|
690
|
+
cursorPosition,
|
|
691
|
+
containerRect
|
|
692
|
+
}) => {
|
|
693
|
+
if (!handleId)
|
|
694
|
+
return zone;
|
|
695
|
+
const magnettedCursorPos = magnetCursorPosition(cursorPosition, magnets);
|
|
696
|
+
const cursorMoveX = (magnettedCursorPos.x - containerRect.x) / containerRect.width * 100;
|
|
697
|
+
const cursorMoveY = (magnettedCursorPos.y - containerRect.y) / containerRect.height * 100;
|
|
698
|
+
const newX = roundAndBound(
|
|
699
|
+
["NW", "W", "SW"].includes(handleId) ? cursorMoveX > zone.x + zone.w ? zone.x + zone.w : cursorMoveX : ["NE", "E", "SE"].includes(handleId) ? cursorMoveX < zone.x ? cursorMoveX : zone.x : zone.x
|
|
700
|
+
);
|
|
701
|
+
const newWidth = roundAndBound(
|
|
702
|
+
["NW", "W", "SW"].includes(handleId) ? cursorMoveX > zone.x + zone.w ? cursorMoveX - newX : zone.w + zone.x - newX : ["NE", "E", "SE"].includes(handleId) ? newX < zone.x ? zone.x - newX : cursorMoveX - zone.x : zone.w,
|
|
703
|
+
0,
|
|
704
|
+
100 - newX
|
|
705
|
+
);
|
|
706
|
+
const newY = roundAndBound(
|
|
707
|
+
["NW", "N", "NE"].includes(handleId) ? cursorMoveY > zone.y + zone.h ? zone.y + zone.h : cursorMoveY : ["SE", "S", "SW"].includes(handleId) ? cursorMoveY < zone.y ? cursorMoveY : zone.y : zone.y
|
|
708
|
+
);
|
|
709
|
+
const newHeight = roundAndBound(
|
|
710
|
+
["NW", "N", "NE"].includes(handleId) ? cursorMoveY > zone.y + zone.h ? cursorMoveY - newY : zone.h + zone.y - newY : ["SE", "S", "SW"].includes(handleId) ? newY < zone.y ? zone.y - newY : cursorMoveY - zone.y : zone.h,
|
|
711
|
+
0,
|
|
712
|
+
100 - newY
|
|
713
|
+
);
|
|
714
|
+
return {
|
|
715
|
+
...zone,
|
|
716
|
+
x: newX,
|
|
717
|
+
w: newWidth,
|
|
718
|
+
y: newY,
|
|
719
|
+
h: newHeight
|
|
720
|
+
};
|
|
529
721
|
};
|
|
530
722
|
}
|
|
531
723
|
});
|
|
532
724
|
|
|
533
|
-
//
|
|
534
|
-
|
|
535
|
-
|
|
725
|
+
// css-modules:css-modules://27imZi27_UCk5xmhRkGJbtYm5sGwf0_-1B99-Xe1fxg.css
|
|
726
|
+
var init_imZi27_UCk5xmhRkGJbtYm5sGwf0_1B99_Xe1fxg = __esm({
|
|
727
|
+
"css-modules:css-modules://27imZi27_UCk5xmhRkGJbtYm5sGwf0_-1B99-Xe1fxg.css"() {
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// tmp_esbuild/_src_components_primarygrid_ZonesMaker.module.css
|
|
732
|
+
var src_components_primarygrid_ZonesMaker_default;
|
|
733
|
+
var init_src_components_primarygrid_ZonesMaker = __esm({
|
|
734
|
+
"tmp_esbuild/_src_components_primarygrid_ZonesMaker.module.css"() {
|
|
735
|
+
"use strict";
|
|
736
|
+
init_imZi27_UCk5xmhRkGJbtYm5sGwf0_1B99_Xe1fxg();
|
|
737
|
+
src_components_primarygrid_ZonesMaker_default = { "handle": "vv-WzhmXa-handle", "zoneMaker": "vv-WzhmXa-zoneMaker", "pictureZone": "vv-WzhmXa-pictureZone" };
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// src/components/primarygrid/ZonesMaker.module.css
|
|
742
|
+
var init_ZonesMaker = __esm({
|
|
743
|
+
"src/components/primarygrid/ZonesMaker.module.css"() {
|
|
744
|
+
"use strict";
|
|
745
|
+
init_src_components_primarygrid_ZonesMaker();
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
// src/components/primarygrid/ZonesMaker.tsx
|
|
750
|
+
import { getClientPosition } from "@lls/utils";
|
|
751
|
+
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
536
752
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
537
|
-
var
|
|
538
|
-
var
|
|
539
|
-
"src/components/primarygrid/
|
|
753
|
+
var ZonesMaker, ZonesMaker_default;
|
|
754
|
+
var init_ZonesMaker2 = __esm({
|
|
755
|
+
"src/components/primarygrid/ZonesMaker.tsx"() {
|
|
756
|
+
"use strict";
|
|
757
|
+
init_grid();
|
|
758
|
+
init_zoneMaker();
|
|
759
|
+
init_zoneMaker2();
|
|
760
|
+
init_ZonesMaker();
|
|
761
|
+
ZonesMaker = ({ pictureUrl, zones, onChangeZone }) => {
|
|
762
|
+
const ref = useRef(null);
|
|
763
|
+
const [transformationData, setTransformationData] = useState2(void 0);
|
|
764
|
+
const onStartDragging = (e, zone) => {
|
|
765
|
+
if (!ref.current)
|
|
766
|
+
return;
|
|
767
|
+
const cursorPosition = getClientPosition(e);
|
|
768
|
+
const magnets = getMagnets({ containerRect: ref.current.getBoundingClientRect(), currentZoneId: zone.id, zones });
|
|
769
|
+
setTransformationData({ zone, mode: "drag", magnets, startPosition: cursorPosition });
|
|
770
|
+
};
|
|
771
|
+
const onStartResizing = (e, zone, handleId) => {
|
|
772
|
+
if (!ref.current)
|
|
773
|
+
return;
|
|
774
|
+
e.stopPropagation();
|
|
775
|
+
const cursorPosition = getClientPosition(e);
|
|
776
|
+
const magnets = getMagnets({ containerRect: ref.current.getBoundingClientRect(), currentZoneId: zone.id, zones });
|
|
777
|
+
setTransformationData({ zone, mode: "resize", magnets, handleId, startPosition: cursorPosition });
|
|
778
|
+
};
|
|
779
|
+
useEffect2(() => {
|
|
780
|
+
if (!transformationData)
|
|
781
|
+
return;
|
|
782
|
+
const onMove = (e) => {
|
|
783
|
+
if (!ref.current)
|
|
784
|
+
return;
|
|
785
|
+
const cursorPosition = getClientPosition(e);
|
|
786
|
+
const containerRect = ref.current.getBoundingClientRect();
|
|
787
|
+
const transformedZone = transformationData.mode === "resize" ? resizeZone({
|
|
788
|
+
zone: transformationData.zone,
|
|
789
|
+
handleId: transformationData.handleId,
|
|
790
|
+
magnets: transformationData.magnets,
|
|
791
|
+
cursorPosition,
|
|
792
|
+
containerRect
|
|
793
|
+
}) : dragZone({
|
|
794
|
+
zone: transformationData.zone,
|
|
795
|
+
startPosition: transformationData.startPosition,
|
|
796
|
+
magnets: transformationData.magnets,
|
|
797
|
+
cursorPosition,
|
|
798
|
+
containerRect
|
|
799
|
+
});
|
|
800
|
+
onChangeZone(transformedZone);
|
|
801
|
+
};
|
|
802
|
+
const onStopDragging = () => {
|
|
803
|
+
setTransformationData(void 0);
|
|
804
|
+
};
|
|
805
|
+
document.addEventListener("mousemove", onMove, { passive: true });
|
|
806
|
+
document.addEventListener("touchmove", onMove, { passive: true });
|
|
807
|
+
document.addEventListener("mouseup", onStopDragging, { passive: true });
|
|
808
|
+
document.addEventListener("touchend", onStopDragging, { passive: true });
|
|
809
|
+
return () => {
|
|
810
|
+
document.removeEventListener("mousemove", onMove);
|
|
811
|
+
document.removeEventListener("touchmove", onMove);
|
|
812
|
+
document.removeEventListener("mouseup", onStopDragging);
|
|
813
|
+
document.removeEventListener("touchend", onStopDragging);
|
|
814
|
+
};
|
|
815
|
+
}, [transformationData, onChangeZone]);
|
|
816
|
+
return /* @__PURE__ */ jsxs3("div", { className: src_components_primarygrid_ZonesMaker_default.zoneMaker, ref, children: [
|
|
817
|
+
/* @__PURE__ */ jsx3("img", { alt: "illustration", src: pictureUrl ?? "" }),
|
|
818
|
+
zones.map((zone, index) => {
|
|
819
|
+
return /* @__PURE__ */ jsx3(
|
|
820
|
+
"div",
|
|
821
|
+
{
|
|
822
|
+
"data-has-selection": +!!transformationData,
|
|
823
|
+
"data-selected": +(transformationData?.zone.id === zone.id),
|
|
824
|
+
className: src_components_primarygrid_ZonesMaker_default.pictureZone,
|
|
825
|
+
onMouseDown: (e) => onStartDragging(e, zone),
|
|
826
|
+
onTouchStart: (e) => onStartDragging(e, zone),
|
|
827
|
+
style: {
|
|
828
|
+
"--v-zonemaker-x": `${zone.x}%`,
|
|
829
|
+
"--v-zonemaker-y": `${zone.y}%`,
|
|
830
|
+
"--v-zonemaker-w": `${zone.w}%`,
|
|
831
|
+
"--v-zonemaker-h": `${zone.h}%`,
|
|
832
|
+
"--v-zonemaker-color": GRID_ZONES_COLORS[index % GRID_ZONES_COLORS.length]
|
|
833
|
+
},
|
|
834
|
+
children: HANDLES.map((handle) => /* @__PURE__ */ jsx3(
|
|
835
|
+
"div",
|
|
836
|
+
{
|
|
837
|
+
className: src_components_primarygrid_ZonesMaker_default.handle,
|
|
838
|
+
style: {
|
|
839
|
+
"--v-zonemaker-handle-left": `${handle.left}%`,
|
|
840
|
+
"--v-zonemaker-handle-top": `${handle.top}%`
|
|
841
|
+
},
|
|
842
|
+
onMouseDown: (e) => onStartResizing(e, zone, handle.id)
|
|
843
|
+
},
|
|
844
|
+
handle.id
|
|
845
|
+
))
|
|
846
|
+
},
|
|
847
|
+
zone.id
|
|
848
|
+
);
|
|
849
|
+
})
|
|
850
|
+
] });
|
|
851
|
+
};
|
|
852
|
+
ZonesMaker_default = ZonesMaker;
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
// src/components/primarygrid/EditGrid.tsx
|
|
857
|
+
import { Button as Button2, FlexibleGrid, TextField } from "@lls/lls-kit";
|
|
858
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
859
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
860
|
+
var EditGrid, EditGrid_default;
|
|
861
|
+
var init_EditGrid2 = __esm({
|
|
862
|
+
"src/components/primarygrid/EditGrid.tsx"() {
|
|
540
863
|
"use strict";
|
|
864
|
+
init_grid();
|
|
541
865
|
init_store();
|
|
542
|
-
init_mode();
|
|
543
|
-
init_Grid();
|
|
544
866
|
init_url();
|
|
867
|
+
init_EditGrid();
|
|
868
|
+
init_ZonesMaker2();
|
|
545
869
|
EditGrid = ({ children, picture }) => {
|
|
546
|
-
const
|
|
547
|
-
|
|
870
|
+
const { addPicture, addDocument, updateLayouts, deleteDocument, layouts } = useReadMdRendererProps([
|
|
871
|
+
"layouts",
|
|
872
|
+
"addPicture",
|
|
873
|
+
"addDocument",
|
|
874
|
+
"updateLayouts",
|
|
875
|
+
"deleteDocument"
|
|
876
|
+
]);
|
|
877
|
+
const [picValue, setPicValue] = useState3(picture);
|
|
878
|
+
const [layoutItems, setLayoutItems] = useState3({ items: layouts?.primary ?? [], draft: false });
|
|
879
|
+
const pictureUrl = picture ? asLlsWebp(picture) : void 0;
|
|
880
|
+
useEffect3(() => {
|
|
881
|
+
setLayoutItems({ items: layouts?.primary ?? [], draft: false });
|
|
882
|
+
}, [layouts?.primary]);
|
|
548
883
|
const onChangePicture = () => {
|
|
549
884
|
addPicture(picValue ?? "");
|
|
550
885
|
};
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
886
|
+
const onUpdateLayoutItemProp = (id, prop, value) => {
|
|
887
|
+
const parsedValue = Number.parseFloat(value);
|
|
888
|
+
setLayoutItems((prev) => ({
|
|
889
|
+
items: prev.items.map((item) => item.id === id ? { ...item, [prop]: Number.isNaN(parsedValue) ? 0 : parsedValue } : item),
|
|
890
|
+
draft: true
|
|
891
|
+
}));
|
|
892
|
+
};
|
|
893
|
+
const goToZone = () => {
|
|
894
|
+
};
|
|
895
|
+
const onRemoveDocument = (uuid) => {
|
|
896
|
+
if (confirm("Voulez-vous vraiment supprimer ce document ?")) {
|
|
897
|
+
deleteDocument(uuid);
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
const onUpdateLayoutItem = useCallback2((newLayoutItem) => {
|
|
901
|
+
setLayoutItems((prev) => ({ items: prev.items.map((item) => item.id === newLayoutItem.id ? newLayoutItem : item), draft: true }));
|
|
902
|
+
}, []);
|
|
903
|
+
useEffect3(() => {
|
|
904
|
+
if (!layoutItems.draft)
|
|
905
|
+
return;
|
|
906
|
+
const timeoutId = setTimeout(() => {
|
|
907
|
+
updateLayouts({ primary: layoutItems.items });
|
|
908
|
+
}, 1e3);
|
|
909
|
+
return () => {
|
|
910
|
+
clearTimeout(timeoutId);
|
|
911
|
+
};
|
|
912
|
+
}, [updateLayouts, layoutItems]);
|
|
913
|
+
return /* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.editGrid, style: { "--v-grid-picture-aspect-ratio": ILLUSTRATION_ASPECT_RATIO }, children: [
|
|
914
|
+
/* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.layout, children: [
|
|
915
|
+
/* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.interface, children: [
|
|
916
|
+
/* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.interfaceHeader, children: [
|
|
917
|
+
/* @__PURE__ */ jsx4("h2", { children: "Gestion des Zones" }),
|
|
918
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
919
|
+
/* @__PURE__ */ jsx4(TextField, { type: "text", label: "url de la double page", value: picValue, onChange: setPicValue }),
|
|
920
|
+
/* @__PURE__ */ jsx4(Button2, { onClick: onChangePicture, children: "Submit" })
|
|
921
|
+
] })
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ jsxs4(FlexibleGrid, { gap: 16, minColSize: 320, maxColCount: 6, children: [
|
|
924
|
+
layoutItems.items.map((layoutItem, index) => {
|
|
925
|
+
return /* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.zone, children: [
|
|
926
|
+
/* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.col, children: [
|
|
927
|
+
/* @__PURE__ */ jsxs4("div", { className: src_components_primarygrid_EditGrid_default.row, children: [
|
|
928
|
+
/* @__PURE__ */ jsx4("span", { children: /* @__PURE__ */ jsxs4("strong", { children: [
|
|
929
|
+
"Zone ",
|
|
930
|
+
index + 1
|
|
931
|
+
] }) }),
|
|
932
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
933
|
+
/* @__PURE__ */ jsx4(Button2, { theme: "gray", accent: "floating", icon: "arrowdown", onClick: goToZone }),
|
|
934
|
+
/* @__PURE__ */ jsx4(Button2, { theme: "error", accent: "floating", icon: "trash", onClick: () => onRemoveDocument(layoutItem.id) })
|
|
935
|
+
] })
|
|
936
|
+
] }),
|
|
937
|
+
/* @__PURE__ */ jsx4("div", { className: src_components_primarygrid_EditGrid_default.zonePicture, children: /* @__PURE__ */ jsx4(
|
|
938
|
+
"div",
|
|
939
|
+
{
|
|
940
|
+
style: {
|
|
941
|
+
"--v-grid-zone-picture-url": `url('${pictureUrl}')`,
|
|
942
|
+
"--v-grid-zone-picture-ratio": layoutItem.w / layoutItem.h * ILLUSTRATION_ASPECT_RATIO,
|
|
943
|
+
"--v-grid-zone-picture-size": `${1e4 / layoutItem.w}%`,
|
|
944
|
+
"--v-grid-zone-picture-left": `${-layoutItem.x}%`,
|
|
945
|
+
"--v-grid-zone-picture-top": `${-layoutItem.y}%`,
|
|
946
|
+
"--v-grid-zone-picture-color": GRID_ZONES_COLORS[index % GRID_ZONES_COLORS.length]
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
) })
|
|
950
|
+
] }),
|
|
951
|
+
/* @__PURE__ */ jsx4("div", { className: src_components_primarygrid_EditGrid_default.col, children: ["x", "y", "w", "h"].map((prop) => {
|
|
952
|
+
return /* @__PURE__ */ jsx4(
|
|
953
|
+
TextField,
|
|
954
|
+
{
|
|
955
|
+
type: "number",
|
|
956
|
+
label: prop,
|
|
957
|
+
value: layoutItem[prop],
|
|
958
|
+
width: "100px",
|
|
959
|
+
onChange: (value) => onUpdateLayoutItemProp(layoutItem.id, prop, value)
|
|
960
|
+
},
|
|
961
|
+
prop
|
|
962
|
+
);
|
|
963
|
+
}) })
|
|
964
|
+
] }, layoutItem.id);
|
|
965
|
+
}),
|
|
966
|
+
/* @__PURE__ */ jsx4("div", { className: src_components_primarygrid_EditGrid_default.addZone, children: /* @__PURE__ */ jsx4(Button2, { onClick: () => addDocument({ x: 0, y: 0, w: 25, h: 25 }), children: "Add document" }) })
|
|
967
|
+
] })
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ jsx4(ZonesMaker_default, { pictureUrl, zones: layoutItems.items, onChangeZone: onUpdateLayoutItem })
|
|
559
970
|
] }),
|
|
560
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ jsx4("div", { className: src_components_primarygrid_EditGrid_default.docs, children: /* @__PURE__ */ jsx4("b", { children }) })
|
|
561
972
|
] });
|
|
562
973
|
};
|
|
974
|
+
EditGrid_default = EditGrid;
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
// css-modules:css-modules://INxu5dk73JTxjtEzrQ83WOJDTfp5b5jZD8ZfkbKQHIA.css
|
|
979
|
+
var init_INxu5dk73JTxjtEzrQ83WOJDTfp5b5jZD8ZfkbKQHIA = __esm({
|
|
980
|
+
"css-modules:css-modules://INxu5dk73JTxjtEzrQ83WOJDTfp5b5jZD8ZfkbKQHIA.css"() {
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// tmp_esbuild/_src_components_primarygrid_ViewGrid.module.css
|
|
985
|
+
var src_components_primarygrid_ViewGrid_default;
|
|
986
|
+
var init_src_components_primarygrid_ViewGrid = __esm({
|
|
987
|
+
"tmp_esbuild/_src_components_primarygrid_ViewGrid.module.css"() {
|
|
988
|
+
"use strict";
|
|
989
|
+
init_INxu5dk73JTxjtEzrQ83WOJDTfp5b5jZD8ZfkbKQHIA();
|
|
990
|
+
src_components_primarygrid_ViewGrid_default = { "illu": "vv-TauroG-illu", "pictureZone": "vv-TauroG-pictureZone", "viewGrid": "vv-TauroG-viewGrid" };
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
// src/components/primarygrid/ViewGrid.module.css
|
|
995
|
+
var init_ViewGrid = __esm({
|
|
996
|
+
"src/components/primarygrid/ViewGrid.module.css"() {
|
|
997
|
+
"use strict";
|
|
998
|
+
init_src_components_primarygrid_ViewGrid();
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
// src/components/primarygrid/ViewGrid.tsx
|
|
1003
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1004
|
+
var ViewGrid, ViewGrid_default;
|
|
1005
|
+
var init_ViewGrid2 = __esm({
|
|
1006
|
+
"src/components/primarygrid/ViewGrid.tsx"() {
|
|
1007
|
+
"use strict";
|
|
1008
|
+
init_grid();
|
|
1009
|
+
init_store();
|
|
1010
|
+
init_url();
|
|
1011
|
+
init_ViewGrid();
|
|
563
1012
|
ViewGrid = ({ children, picture }) => {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
/* @__PURE__ */
|
|
1013
|
+
const { layouts } = useReadMdRendererProps(["layouts"]);
|
|
1014
|
+
return /* @__PURE__ */ jsxs5("div", { className: src_components_primarygrid_ViewGrid_default.viewGrid, style: { "--v-grid-picture-aspect-ratio": ILLUSTRATION_ASPECT_RATIO }, children: [
|
|
1015
|
+
/* @__PURE__ */ jsxs5("div", { className: src_components_primarygrid_ViewGrid_default.illu, children: [
|
|
1016
|
+
/* @__PURE__ */ jsx5("img", { alt: "illustration", src: asLlsWebp(picture ?? "") }),
|
|
1017
|
+
layouts?.primary?.map((layoutItem, index) => {
|
|
1018
|
+
return /* @__PURE__ */ jsx5(
|
|
1019
|
+
"div",
|
|
1020
|
+
{
|
|
1021
|
+
className: src_components_primarygrid_ViewGrid_default.pictureZone,
|
|
1022
|
+
style: {
|
|
1023
|
+
"--v-picturezone-x": `${layoutItem.x}%`,
|
|
1024
|
+
"--v-picturezone-y": `${layoutItem.y}%`,
|
|
1025
|
+
"--v-picturezone-w": `${layoutItem.w}%`,
|
|
1026
|
+
"--v-picturezone-h": `${layoutItem.h}%`,
|
|
1027
|
+
"--v-picturezone-color": GRID_ZONES_COLORS[index % GRID_ZONES_COLORS.length]
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
layoutItem.id
|
|
1031
|
+
);
|
|
1032
|
+
})
|
|
1033
|
+
] }),
|
|
1034
|
+
/* @__PURE__ */ jsx5("div", { className: src_components_primarygrid_ViewGrid_default.docs, children: /* @__PURE__ */ jsx5("b", { children }) })
|
|
567
1035
|
] });
|
|
568
1036
|
};
|
|
1037
|
+
ViewGrid_default = ViewGrid;
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// src/components/primarygrid/Grid.tsx
|
|
1042
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1043
|
+
var PrimaryGrid, Grid_default;
|
|
1044
|
+
var init_Grid = __esm({
|
|
1045
|
+
"src/components/primarygrid/Grid.tsx"() {
|
|
1046
|
+
"use strict";
|
|
1047
|
+
init_store();
|
|
1048
|
+
init_mode();
|
|
1049
|
+
init_EditGrid2();
|
|
1050
|
+
init_ViewGrid2();
|
|
569
1051
|
PrimaryGrid = (props) => {
|
|
570
1052
|
const { mode } = useReadMdRendererProps(["mode"]);
|
|
571
|
-
return isEditMode(mode) ? /* @__PURE__ */
|
|
1053
|
+
return isEditMode(mode) ? /* @__PURE__ */ jsx6(EditGrid_default, { ...props }) : /* @__PURE__ */ jsx6(ViewGrid_default, { ...props });
|
|
572
1054
|
};
|
|
573
1055
|
Grid_default = PrimaryGrid;
|
|
574
1056
|
}
|
|
575
1057
|
});
|
|
576
1058
|
|
|
1059
|
+
// css-modules:css-modules://8Bws6tfkpio6klj_RtRC_R7kDQ_jPBbqtQQfWJr6y_4.css
|
|
1060
|
+
var init_Bws6tfkpio6klj_RtRC_R7kDQ_jPBbqtQQfWJr6y_4 = __esm({
|
|
1061
|
+
"css-modules:css-modules://8Bws6tfkpio6klj_RtRC_R7kDQ_jPBbqtQQfWJr6y_4.css"() {
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
// tmp_esbuild/_src_components_core_DocumentHtml.module.css
|
|
1066
|
+
var src_components_core_DocumentHtml_default;
|
|
1067
|
+
var init_src_components_core_DocumentHtml = __esm({
|
|
1068
|
+
"tmp_esbuild/_src_components_core_DocumentHtml.module.css"() {
|
|
1069
|
+
"use strict";
|
|
1070
|
+
init_Bws6tfkpio6klj_RtRC_R7kDQ_jPBbqtQQfWJr6y_4();
|
|
1071
|
+
src_components_core_DocumentHtml_default = { "document": "vv-GTaOhq-document" };
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
// src/components/core/DocumentHtml.module.css
|
|
1076
|
+
var init_DocumentHtml = __esm({
|
|
1077
|
+
"src/components/core/DocumentHtml.module.css"() {
|
|
1078
|
+
"use strict";
|
|
1079
|
+
init_src_components_core_DocumentHtml();
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
|
|
577
1083
|
// src/components/core/DocumentHtml.tsx
|
|
578
|
-
import
|
|
1084
|
+
import React2, { memo, useRef as useRef2 } from "react";
|
|
579
1085
|
import HtmlToReact from "html-to-react";
|
|
580
|
-
import
|
|
1086
|
+
import _10 from "lodash/fp.js";
|
|
581
1087
|
import { cx as cx2 } from "@lls/utils";
|
|
582
|
-
import { jsx as
|
|
1088
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
583
1089
|
var htmlToReactParser, processNodeDefinitions, MemoToolbar, DocumentHtml, getProcessingInstructions, MdRenderer, DocumentHtml_default;
|
|
584
1090
|
var init_DocumentHtml2 = __esm({
|
|
585
1091
|
"src/components/core/DocumentHtml.tsx"() {
|
|
586
1092
|
"use strict";
|
|
587
1093
|
init_DocumentToolbar2();
|
|
1094
|
+
init_ErrorBoundary2();
|
|
588
1095
|
init_constants();
|
|
589
1096
|
init_store();
|
|
590
1097
|
init_dom();
|
|
591
1098
|
init_memo();
|
|
592
1099
|
init_string();
|
|
593
|
-
|
|
1100
|
+
init_Grid();
|
|
594
1101
|
init_DocumentHtml();
|
|
595
|
-
init_Grid2();
|
|
596
1102
|
htmlToReactParser = new HtmlToReact.Parser({
|
|
597
1103
|
recognizeSelfClosing: true
|
|
598
1104
|
});
|
|
599
|
-
processNodeDefinitions = new HtmlToReact.ProcessNodeDefinitions(
|
|
1105
|
+
processNodeDefinitions = new HtmlToReact.ProcessNodeDefinitions(React2);
|
|
600
1106
|
MemoToolbar = memo(({ toolbarProps: props, docJson }) => {
|
|
601
|
-
const compactMode =
|
|
602
|
-
const openEditor =
|
|
603
|
-
const openMetadataEditor =
|
|
604
|
-
const deleteCard =
|
|
605
|
-
const deleteRightResponses =
|
|
606
|
-
return /* @__PURE__ */
|
|
1107
|
+
const compactMode = _10.get("compactMode", props);
|
|
1108
|
+
const openEditor = _10.get("openEditor", props);
|
|
1109
|
+
const openMetadataEditor = _10.get("openMetadataEditor", props);
|
|
1110
|
+
const deleteCard = _10.get("deleteCard", props);
|
|
1111
|
+
const deleteRightResponses = _10.get("deleteRightResponses", props);
|
|
1112
|
+
return /* @__PURE__ */ jsx7(
|
|
607
1113
|
Toolbar,
|
|
608
1114
|
{
|
|
609
1115
|
compactMode,
|
|
@@ -617,8 +1123,8 @@ var init_DocumentHtml2 = __esm({
|
|
|
617
1123
|
}, areToolbarPropsEqual);
|
|
618
1124
|
DocumentHtml = ({ toolbarProps: props, mdRendererProps, docJson, children: docChildren }) => {
|
|
619
1125
|
const { mode } = useReadMdRendererProps(["mode"]);
|
|
620
|
-
const documentRef =
|
|
621
|
-
return /* @__PURE__ */
|
|
1126
|
+
const documentRef = useRef2(null);
|
|
1127
|
+
return /* @__PURE__ */ jsxs6(
|
|
622
1128
|
"div",
|
|
623
1129
|
{
|
|
624
1130
|
ref: documentRef,
|
|
@@ -627,25 +1133,25 @@ var init_DocumentHtml2 = __esm({
|
|
|
627
1133
|
"data-isprint": +isPrint(),
|
|
628
1134
|
className: cx2(DOCUMENT_CLASSNAME, src_components_core_DocumentHtml_default.document),
|
|
629
1135
|
children: [
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ jsx7(MemoToolbar, { toolbarProps: props, docJson }),
|
|
1137
|
+
/* @__PURE__ */ jsx7(ErrorBoundary_default, { docJson, mode, children: /* @__PURE__ */ jsx7(MdRenderer, { mdRendererProps, docJson, toolbarProps: props, docChildren }) })
|
|
632
1138
|
]
|
|
633
1139
|
}
|
|
634
1140
|
);
|
|
635
1141
|
};
|
|
636
1142
|
getProcessingInstructions = ({ docChildren }) => {
|
|
637
1143
|
const tag = (nodeName, handler) => ({
|
|
638
|
-
shouldProcessNode:
|
|
1144
|
+
shouldProcessNode: _10.matchesProperty("name", nodeName),
|
|
639
1145
|
processNode: handler
|
|
640
1146
|
});
|
|
641
|
-
const
|
|
642
|
-
return tag(name, (node, children, key) => /* @__PURE__ */
|
|
1147
|
+
const _shortTag = (name, Component, props = {}, mapAttributes = _10.identity) => {
|
|
1148
|
+
return tag(name, (node, children, key) => /* @__PURE__ */ jsx7(Component, { ...mapAttributes(node.attribs), children, ...props }, key));
|
|
643
1149
|
};
|
|
644
1150
|
return [
|
|
645
|
-
tag("primarygrid", (node) => /* @__PURE__ */
|
|
1151
|
+
tag("primarygrid", (node) => /* @__PURE__ */ jsx7(Grid_default, { ...node.attribs, children: docChildren }, "grid")),
|
|
646
1152
|
{
|
|
647
1153
|
shouldProcessNode: (node) => {
|
|
648
|
-
if (node.type === "text" &&
|
|
1154
|
+
if (node.type === "text" && _10.trim(node.data) === "") {
|
|
649
1155
|
return true;
|
|
650
1156
|
}
|
|
651
1157
|
},
|
|
@@ -663,7 +1169,7 @@ var init_DocumentHtml2 = __esm({
|
|
|
663
1169
|
...mdRendererProps,
|
|
664
1170
|
...documentProps
|
|
665
1171
|
});
|
|
666
|
-
const contentMd =
|
|
1172
|
+
const contentMd = _10.flow(_10.get("docJson.contentMd"), _10.partial(escapeTagContent, ["code"]), removeTrailingNewLines)(props);
|
|
667
1173
|
const reactElement = htmlToReactParser.parseWithInstructions(contentMd, isValidNode, instructions) || null;
|
|
668
1174
|
return reactElement;
|
|
669
1175
|
}, areDocumentHtmlPropsEqual);
|
|
@@ -671,9 +1177,9 @@ var init_DocumentHtml2 = __esm({
|
|
|
671
1177
|
}
|
|
672
1178
|
});
|
|
673
1179
|
|
|
674
|
-
// css-modules:css-modules://
|
|
675
|
-
var
|
|
676
|
-
"css-modules:css-modules://
|
|
1180
|
+
// css-modules:css-modules://kTdLFWdq92OvhQjGBgoqbpa-uWI0Nagw0W33VXQfA9A.css
|
|
1181
|
+
var init_kTdLFWdq92OvhQjGBgoqbpa_uWI0Nagw0W33VXQfA9A = __esm({
|
|
1182
|
+
"css-modules:css-modules://kTdLFWdq92OvhQjGBgoqbpa-uWI0Nagw0W33VXQfA9A.css"() {
|
|
677
1183
|
}
|
|
678
1184
|
});
|
|
679
1185
|
|
|
@@ -682,8 +1188,8 @@ var src_components_core_Document_default;
|
|
|
682
1188
|
var init_src_components_core_Document = __esm({
|
|
683
1189
|
"tmp_esbuild/_src_components_core_Document.module.css"() {
|
|
684
1190
|
"use strict";
|
|
685
|
-
|
|
686
|
-
src_components_core_Document_default = { "
|
|
1191
|
+
init_kTdLFWdq92OvhQjGBgoqbpa_uWI0Nagw0W33VXQfA9A();
|
|
1192
|
+
src_components_core_Document_default = { "rootDocument": "vv--ZTaFW-rootDocument", "divSearch": "vv--ZTaFW-divSearch" };
|
|
687
1193
|
}
|
|
688
1194
|
});
|
|
689
1195
|
|
|
@@ -696,9 +1202,9 @@ var init_Document = __esm({
|
|
|
696
1202
|
});
|
|
697
1203
|
|
|
698
1204
|
// src/components/core/Document.tsx
|
|
699
|
-
import
|
|
700
|
-
import
|
|
701
|
-
import { jsx as
|
|
1205
|
+
import _11 from "lodash/fp.js";
|
|
1206
|
+
import React3 from "react";
|
|
1207
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
702
1208
|
var Document, RootDocument, Document_default;
|
|
703
1209
|
var init_Document2 = __esm({
|
|
704
1210
|
"src/components/core/Document.tsx"() {
|
|
@@ -706,19 +1212,19 @@ var init_Document2 = __esm({
|
|
|
706
1212
|
init_DocumentHtml2();
|
|
707
1213
|
init_Document();
|
|
708
1214
|
Document = ({ docJson, toolbarProps = {}, mdRendererProps }) => {
|
|
709
|
-
return /* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ jsx8(DocumentHtml_default, { toolbarProps, mdRendererProps, docJson });
|
|
710
1216
|
};
|
|
711
1217
|
Document.displayName = "Document";
|
|
712
|
-
RootDocument =
|
|
713
|
-
const children =
|
|
714
|
-
return /* @__PURE__ */
|
|
1218
|
+
RootDocument = React3.forwardRef(({ docJson = {}, toolbarProps, mdRendererProps }, ref) => {
|
|
1219
|
+
const children = _11.getOr([], "children", docJson);
|
|
1220
|
+
return /* @__PURE__ */ jsx8("div", { className: src_components_core_Document_default.rootDocument, ref, children: /* @__PURE__ */ jsx8(
|
|
715
1221
|
DocumentHtml_default,
|
|
716
1222
|
{
|
|
717
1223
|
toolbarProps,
|
|
718
1224
|
mdRendererProps,
|
|
719
1225
|
docJson,
|
|
720
|
-
children:
|
|
721
|
-
return /* @__PURE__ */
|
|
1226
|
+
children: _11.map((child) => {
|
|
1227
|
+
return /* @__PURE__ */ jsx8(
|
|
722
1228
|
Document,
|
|
723
1229
|
{
|
|
724
1230
|
toolbarProps,
|
|
@@ -735,9 +1241,9 @@ var init_Document2 = __esm({
|
|
|
735
1241
|
}
|
|
736
1242
|
});
|
|
737
1243
|
|
|
738
|
-
// css-modules:css-modules://
|
|
739
|
-
var
|
|
740
|
-
"css-modules:css-modules://
|
|
1244
|
+
// css-modules:css-modules://Ef1FR8r0TZLJbQLu_YjOXfH5QGvXBuqIuVcDNrn2dlo.css
|
|
1245
|
+
var init_Ef1FR8r0TZLJbQLu_YjOXfH5QGvXBuqIuVcDNrn2dlo = __esm({
|
|
1246
|
+
"css-modules:css-modules://Ef1FR8r0TZLJbQLu_YjOXfH5QGvXBuqIuVcDNrn2dlo.css"() {
|
|
741
1247
|
}
|
|
742
1248
|
});
|
|
743
1249
|
|
|
@@ -745,7 +1251,7 @@ var init_qc8hHnFyo6Lr96_0ShIiN5V_2JCgy_z_WPzO51QaEM0 = __esm({
|
|
|
745
1251
|
var init_src_styles_Codemirror = __esm({
|
|
746
1252
|
"tmp_esbuild/_src_styles_Codemirror.module.css"() {
|
|
747
1253
|
"use strict";
|
|
748
|
-
|
|
1254
|
+
init_Ef1FR8r0TZLJbQLu_YjOXfH5QGvXBuqIuVcDNrn2dlo();
|
|
749
1255
|
}
|
|
750
1256
|
});
|
|
751
1257
|
|
|
@@ -757,9 +1263,9 @@ var init_Codemirror = __esm({
|
|
|
757
1263
|
}
|
|
758
1264
|
});
|
|
759
1265
|
|
|
760
|
-
// css-modules:css-modules
|
|
761
|
-
var
|
|
762
|
-
"css-modules:css-modules
|
|
1266
|
+
// css-modules:css-modules://-ADr1fQ65axwxa_akiSkLSAd8UytGnzX8BkDH_z6IJg.css
|
|
1267
|
+
var init_ADr1fQ65axwxa_akiSkLSAd8UytGnzX8BkDH_z6IJg = __esm({
|
|
1268
|
+
"css-modules:css-modules://-ADr1fQ65axwxa_akiSkLSAd8UytGnzX8BkDH_z6IJg.css"() {
|
|
763
1269
|
}
|
|
764
1270
|
});
|
|
765
1271
|
|
|
@@ -768,7 +1274,7 @@ var src_components_core_viewer_ViewerMd_default;
|
|
|
768
1274
|
var init_src_components_core_viewer_ViewerMd = __esm({
|
|
769
1275
|
"tmp_esbuild/_src_components_core_viewer_ViewerMd.module.css"() {
|
|
770
1276
|
"use strict";
|
|
771
|
-
|
|
1277
|
+
init_ADr1fQ65axwxa_akiSkLSAd8UytGnzX8BkDH_z6IJg();
|
|
772
1278
|
src_components_core_viewer_ViewerMd_default = { "viewer": "vv-j3jlxa-viewer kit-themecss", "viewerInner": "vv-j3jlxa-viewerInner" };
|
|
773
1279
|
}
|
|
774
1280
|
});
|
|
@@ -782,11 +1288,11 @@ var init_ViewerMd = __esm({
|
|
|
782
1288
|
});
|
|
783
1289
|
|
|
784
1290
|
// src/components/core/viewer/ViewerMd.tsx
|
|
785
|
-
import
|
|
786
|
-
import _11 from "lodash/fp.js";
|
|
1291
|
+
import React4, { useRef as useRef3, useCallback as useCallback3, useMemo } from "react";
|
|
787
1292
|
import { styleThemeProps } from "@lls/lls-kit";
|
|
1293
|
+
import _12 from "lodash/fp.js";
|
|
788
1294
|
import { cx as cx3 } from "@lls/utils";
|
|
789
|
-
import { jsx as
|
|
1295
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
790
1296
|
var getMdRendererProps, ViewerMd, ViewerMd_default;
|
|
791
1297
|
var init_ViewerMd2 = __esm({
|
|
792
1298
|
"src/components/core/viewer/ViewerMd.tsx"() {
|
|
@@ -796,17 +1302,29 @@ var init_ViewerMd2 = __esm({
|
|
|
796
1302
|
init_template();
|
|
797
1303
|
init_Document2();
|
|
798
1304
|
init_Codemirror();
|
|
799
|
-
init_ViewerMd();
|
|
800
1305
|
init_constants();
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1306
|
+
init_ViewerMd();
|
|
1307
|
+
getMdRendererProps = _12.pick(["isOffline", "isTouchable", "wasSsrRendered", "picture"]);
|
|
1308
|
+
ViewerMd = React4.forwardRef(
|
|
1309
|
+
({
|
|
1310
|
+
template = {},
|
|
1311
|
+
addPicture = _12.noop,
|
|
1312
|
+
addDocument = _12.noop,
|
|
1313
|
+
updateLayouts = _12.noop,
|
|
1314
|
+
deleteDocument = _12.noop,
|
|
1315
|
+
onChange = _12.noop,
|
|
1316
|
+
sizeIndex = 2,
|
|
1317
|
+
fontFamily = "LatoWeb",
|
|
1318
|
+
mode = "view",
|
|
1319
|
+
isDysMode = false,
|
|
1320
|
+
...props
|
|
1321
|
+
}, ref) => {
|
|
1322
|
+
const pageId = _12.get("id", template);
|
|
1323
|
+
const onChangeCallbackRef = useRef3(_12.noop);
|
|
1324
|
+
const innerViewerRef = useRef3(null);
|
|
1325
|
+
const hashMdRendererProps = _12.flow(
|
|
808
1326
|
getMdRendererProps,
|
|
809
|
-
|
|
1327
|
+
_12.assign({
|
|
810
1328
|
mode,
|
|
811
1329
|
pageId
|
|
812
1330
|
}),
|
|
@@ -815,23 +1333,24 @@ var init_ViewerMd2 = __esm({
|
|
|
815
1333
|
onChangeCallbackRef.current = (doc, ctx) => {
|
|
816
1334
|
onChange(updateTemplate(template, doc), ctx);
|
|
817
1335
|
};
|
|
818
|
-
const {
|
|
1336
|
+
const { deleteRightResponses, openEditor, openMetadataEditor } = props;
|
|
819
1337
|
const isPrint2 = isPrint();
|
|
820
1338
|
const mdRendererProps = useMemo(() => {
|
|
821
|
-
return
|
|
1339
|
+
return _12.flow(
|
|
822
1340
|
JSON.parse,
|
|
823
|
-
|
|
1341
|
+
_12.assign({
|
|
824
1342
|
// there should only be FUNCTIONS here
|
|
825
1343
|
addPicture,
|
|
826
1344
|
addDocument,
|
|
1345
|
+
updateLayouts,
|
|
827
1346
|
deleteDocument
|
|
828
1347
|
})
|
|
829
1348
|
)(hashMdRendererProps);
|
|
830
|
-
}, [hashMdRendererProps, addPicture, addDocument, deleteDocument]);
|
|
831
|
-
const onDocChange =
|
|
1349
|
+
}, [hashMdRendererProps, addPicture, addDocument, updateLayouts, deleteDocument]);
|
|
1350
|
+
const onDocChange = useCallback3((doc) => {
|
|
832
1351
|
onChangeCallbackRef.current(doc);
|
|
833
1352
|
}, []);
|
|
834
|
-
|
|
1353
|
+
_12.replace;
|
|
835
1354
|
useWriteStore({
|
|
836
1355
|
mdRendererProps: {
|
|
837
1356
|
...mdRendererProps,
|
|
@@ -850,71 +1369,375 @@ var init_ViewerMd2 = __esm({
|
|
|
850
1369
|
openEditor,
|
|
851
1370
|
openMetadataEditor
|
|
852
1371
|
};
|
|
853
|
-
}, [deleteDocument, deleteRightResponses, openEditor, openMetadataEditor]);
|
|
854
|
-
return /* @__PURE__ */
|
|
1372
|
+
}, [deleteDocument, deleteRightResponses, openEditor, openMetadataEditor]);
|
|
1373
|
+
return /* @__PURE__ */ jsx9(
|
|
1374
|
+
"div",
|
|
1375
|
+
{
|
|
1376
|
+
style: {
|
|
1377
|
+
...styleThemeProps({ isDysMode, sizeIndex, font: fontFamily })
|
|
1378
|
+
},
|
|
1379
|
+
"data-isdysmode": +isDysMode,
|
|
1380
|
+
"data-isprint": +isPrint2,
|
|
1381
|
+
className: cx3(VIVI_CLASSNAME, src_components_core_viewer_ViewerMd_default.viewer),
|
|
1382
|
+
ref,
|
|
1383
|
+
children: /* @__PURE__ */ jsx9("div", { className: src_components_core_viewer_ViewerMd_default.viewerInner, ref: innerViewerRef, "data-mode": mode, children: /* @__PURE__ */ jsx9(Document_default, { mdRendererProps, toolbarProps, docJson: template }) })
|
|
1384
|
+
}
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1387
|
+
);
|
|
1388
|
+
ViewerMd_default = ViewerMd;
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
// src/components/core/editor/EditViewerMd.tsx
|
|
1393
|
+
import React5, { useCallback as useCallback4 } from "react";
|
|
1394
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1395
|
+
var EditViewerMd, EditViewerMd_default;
|
|
1396
|
+
var init_EditViewerMd = __esm({
|
|
1397
|
+
"src/components/core/editor/EditViewerMd.tsx"() {
|
|
1398
|
+
"use strict";
|
|
1399
|
+
init_ViewerMd2();
|
|
1400
|
+
init_template();
|
|
1401
|
+
EditViewerMd = React5.forwardRef(({ template, onChange, ...props }, ref) => {
|
|
1402
|
+
const addDocument = useCallback4(
|
|
1403
|
+
(docInfos) => {
|
|
1404
|
+
onChange((template2) => addDocumentToTemplate(template2, docInfos));
|
|
1405
|
+
},
|
|
1406
|
+
[onChange]
|
|
1407
|
+
);
|
|
1408
|
+
const updateLayouts = useCallback4(
|
|
1409
|
+
(newLayouts) => {
|
|
1410
|
+
onChange((template2) => ({ ...template2, layouts: newLayouts }));
|
|
1411
|
+
},
|
|
1412
|
+
[onChange]
|
|
1413
|
+
);
|
|
1414
|
+
const deleteDocument = useCallback4(
|
|
1415
|
+
(uuid) => {
|
|
1416
|
+
onChange((template2) => deleteDocumentFromTemplate(template2, uuid));
|
|
1417
|
+
},
|
|
1418
|
+
[onChange]
|
|
1419
|
+
);
|
|
1420
|
+
const deleteRightResponses = useCallback4(() => {
|
|
1421
|
+
}, []);
|
|
1422
|
+
const addPicture = (picture) => {
|
|
1423
|
+
onChange((prev) => ({ ...prev, contentMd: `<primarygrid picture="${picture}" />` }));
|
|
1424
|
+
};
|
|
1425
|
+
return /* @__PURE__ */ jsx10(
|
|
1426
|
+
ViewerMd_default,
|
|
1427
|
+
{
|
|
1428
|
+
template,
|
|
1429
|
+
addDocument,
|
|
1430
|
+
updateLayouts,
|
|
1431
|
+
deleteDocument,
|
|
1432
|
+
deleteRightResponses,
|
|
1433
|
+
addPicture,
|
|
1434
|
+
mode: "edit",
|
|
1435
|
+
ref,
|
|
1436
|
+
...props
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1439
|
+
});
|
|
1440
|
+
EditViewerMd_default = EditViewerMd;
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
// css-modules:css-modules://muFZYOO33Vml22ha9RBNYCIyflFehN2jLe0x7J_g3tk.css
|
|
1445
|
+
var init_muFZYOO33Vml22ha9RBNYCIyflFehN2jLe0x7J_g3tk = __esm({
|
|
1446
|
+
"css-modules:css-modules://muFZYOO33Vml22ha9RBNYCIyflFehN2jLe0x7J_g3tk.css"() {
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
// tmp_esbuild/_home_ec2-user_actions-runner__work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize.module.css
|
|
1451
|
+
var home_ec2_user_actions_runner_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default;
|
|
1452
|
+
var init_home_ec2_user_actions_runner_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize = __esm({
|
|
1453
|
+
"tmp_esbuild/_home_ec2-user_actions-runner__work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize.module.css"() {
|
|
1454
|
+
"use strict";
|
|
1455
|
+
init_muFZYOO33Vml22ha9RBNYCIyflFehN2jLe0x7J_g3tk();
|
|
1456
|
+
home_ec2_user_actions_runner_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default = { "handle": "vv-o5bldq-handle" };
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
// ../viewer/src/hooks/useDragAndResize.module.css
|
|
1461
|
+
var init_useDragAndResize = __esm({
|
|
1462
|
+
"../viewer/src/hooks/useDragAndResize.module.css"() {
|
|
1463
|
+
"use strict";
|
|
1464
|
+
init_home_ec2_user_actions_runner_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize();
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
// ../viewer/src/hooks/useDragAndResize.tsx
|
|
1469
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
1470
|
+
import _13 from "lodash/fp.js";
|
|
1471
|
+
import { Fragment, jsx as jsx11 } from "react/jsx-runtime";
|
|
1472
|
+
var resizeHandlersProps, useDragAndResize, useDragAndResize_default;
|
|
1473
|
+
var init_useDragAndResize2 = __esm({
|
|
1474
|
+
"../viewer/src/hooks/useDragAndResize.tsx"() {
|
|
1475
|
+
"use strict";
|
|
1476
|
+
init_useDragAndResize();
|
|
1477
|
+
resizeHandlersProps = [
|
|
1478
|
+
{
|
|
1479
|
+
top: "-5px",
|
|
1480
|
+
right: "0",
|
|
1481
|
+
bottom: "calc(100% - 5px)",
|
|
1482
|
+
left: "0",
|
|
1483
|
+
cursor: "row-resize",
|
|
1484
|
+
resizingProps: {
|
|
1485
|
+
shouldSizeX: false,
|
|
1486
|
+
shouldSizeY: true,
|
|
1487
|
+
shouldMoveX: false,
|
|
1488
|
+
shouldMoveY: true
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
top: "0",
|
|
1493
|
+
right: "-5px",
|
|
1494
|
+
bottom: "0",
|
|
1495
|
+
left: "calc(100% - 5px)",
|
|
1496
|
+
cursor: "col-resize",
|
|
1497
|
+
resizingProps: {
|
|
1498
|
+
shouldSizeX: true,
|
|
1499
|
+
shouldSizeY: false,
|
|
1500
|
+
shouldMoveX: false,
|
|
1501
|
+
shouldMoveY: false
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
top: "calc(100% - 5px)",
|
|
1506
|
+
right: "0",
|
|
1507
|
+
bottom: "-5px",
|
|
1508
|
+
left: "0",
|
|
1509
|
+
cursor: "row-resize",
|
|
1510
|
+
resizingProps: {
|
|
1511
|
+
shouldSizeX: false,
|
|
1512
|
+
shouldSizeY: true,
|
|
1513
|
+
shouldMoveX: false,
|
|
1514
|
+
shouldMoveY: false
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
top: "0",
|
|
1519
|
+
right: "calc(100% - 5px)",
|
|
1520
|
+
bottom: "0",
|
|
1521
|
+
left: "-5px",
|
|
1522
|
+
cursor: "col-resize",
|
|
1523
|
+
resizingProps: {
|
|
1524
|
+
shouldSizeX: true,
|
|
1525
|
+
shouldSizeY: false,
|
|
1526
|
+
shouldMoveX: true,
|
|
1527
|
+
shouldMoveY: false
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
// corners
|
|
1531
|
+
{
|
|
1532
|
+
top: "-10px",
|
|
1533
|
+
right: "-10px",
|
|
1534
|
+
bottom: "calc(100% - 10px)",
|
|
1535
|
+
left: "calc(100% - 10px)",
|
|
1536
|
+
cursor: "ne-resize",
|
|
1537
|
+
resizingProps: {
|
|
1538
|
+
shouldSizeX: true,
|
|
1539
|
+
shouldSizeY: true,
|
|
1540
|
+
shouldMoveX: false,
|
|
1541
|
+
shouldMoveY: true
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
top: "calc(100% - 10px)",
|
|
1546
|
+
right: "-10px",
|
|
1547
|
+
bottom: "-10px",
|
|
1548
|
+
left: "calc(100% - 10px)",
|
|
1549
|
+
cursor: "se-resize",
|
|
1550
|
+
resizingProps: {
|
|
1551
|
+
shouldSizeX: true,
|
|
1552
|
+
shouldSizeY: true,
|
|
1553
|
+
shouldMoveX: false,
|
|
1554
|
+
shouldMoveY: false
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
top: "calc(100% - 10px)",
|
|
1559
|
+
right: "calc(100% - 10px)",
|
|
1560
|
+
bottom: "-10px",
|
|
1561
|
+
left: "-10px",
|
|
1562
|
+
cursor: "sw-resize",
|
|
1563
|
+
resizingProps: {
|
|
1564
|
+
shouldSizeX: true,
|
|
1565
|
+
shouldSizeY: true,
|
|
1566
|
+
shouldMoveX: true,
|
|
1567
|
+
shouldMoveY: false
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
top: "-10px",
|
|
1572
|
+
right: "calc(100% - 10px)",
|
|
1573
|
+
bottom: "calc(100% - 10px)",
|
|
1574
|
+
left: "-10px",
|
|
1575
|
+
cursor: "nw-resize",
|
|
1576
|
+
resizingProps: {
|
|
1577
|
+
shouldSizeX: true,
|
|
1578
|
+
shouldSizeY: true,
|
|
1579
|
+
shouldMoveX: true,
|
|
1580
|
+
shouldMoveY: true
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
];
|
|
1584
|
+
useDragAndResize = ({ defaultPositions, defaultSize = {}, onResize, canResize = true }) => {
|
|
1585
|
+
const rndRef = useRef4(null);
|
|
1586
|
+
const defaultWidth = defaultSize.width || 0;
|
|
1587
|
+
const defaultHeight = defaultSize.height || 0;
|
|
1588
|
+
const [size, setSize] = useState4({
|
|
1589
|
+
height: defaultHeight,
|
|
1590
|
+
width: defaultWidth
|
|
1591
|
+
});
|
|
1592
|
+
const [resizingData, setResizingData] = useState4({
|
|
1593
|
+
isActive: false,
|
|
1594
|
+
shouldSizeX: false,
|
|
1595
|
+
shouldSizeY: false,
|
|
1596
|
+
shouldMoveX: false,
|
|
1597
|
+
shouldMoveY: false
|
|
1598
|
+
});
|
|
1599
|
+
const positionX = _13.getOr(0, "x", defaultPositions);
|
|
1600
|
+
const bodyWidth = _13.getOr(0, "body.offsetWidth", document);
|
|
1601
|
+
const x = positionX + defaultWidth > bodyWidth ? positionX - defaultWidth : positionX;
|
|
1602
|
+
const [translateData, setTranslateData] = useState4({
|
|
1603
|
+
isActive: false,
|
|
1604
|
+
x,
|
|
1605
|
+
y: _13.getOr(0, "y", defaultPositions)
|
|
1606
|
+
});
|
|
1607
|
+
useEffect4(() => {
|
|
1608
|
+
if (translateData.isActive) {
|
|
1609
|
+
const onMouseUp = () => setTranslateData(_13.set("isActive", false));
|
|
1610
|
+
const onMouseMove = (e) => setTranslateData(({ x: x2, y, ...translateData2 }) => ({
|
|
1611
|
+
...translateData2,
|
|
1612
|
+
x: x2 + e.movementX,
|
|
1613
|
+
y: y + e.movementY
|
|
1614
|
+
}));
|
|
1615
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
1616
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
1617
|
+
return () => {
|
|
1618
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
1619
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
}, [translateData]);
|
|
1623
|
+
useEffect4(() => {
|
|
1624
|
+
if (resizingData.isActive) {
|
|
1625
|
+
if (rndRef.current && !(size.height !== 0 && size.width !== 0)) {
|
|
1626
|
+
const { height, width } = rndRef.current.getBoundingClientRect();
|
|
1627
|
+
setSize({
|
|
1628
|
+
height,
|
|
1629
|
+
width
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
const { shouldSizeX, shouldSizeY, shouldMoveX, shouldMoveY } = resizingData;
|
|
1633
|
+
const onMouseUp = () => {
|
|
1634
|
+
setResizingData(_13.set("isActive", false));
|
|
1635
|
+
};
|
|
1636
|
+
const getNewSizeValue = ({
|
|
1637
|
+
shouldMove,
|
|
1638
|
+
shouldSize,
|
|
1639
|
+
value,
|
|
1640
|
+
modifier
|
|
1641
|
+
}) => {
|
|
1642
|
+
switch (true) {
|
|
1643
|
+
case (shouldSize && !shouldMove):
|
|
1644
|
+
return value + modifier;
|
|
1645
|
+
case (shouldSize && shouldMove):
|
|
1646
|
+
return value - modifier;
|
|
1647
|
+
default:
|
|
1648
|
+
return value;
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
const onMouseMove = (e) => {
|
|
1652
|
+
setTranslateData(({ x: x2, y, ...translateData2 }) => {
|
|
1653
|
+
const newX = shouldMoveX ? x2 + e.movementX : x2;
|
|
1654
|
+
const newY = shouldMoveY ? y + e.movementY : y;
|
|
1655
|
+
return {
|
|
1656
|
+
...translateData2,
|
|
1657
|
+
x: newX,
|
|
1658
|
+
y: newY
|
|
1659
|
+
};
|
|
1660
|
+
});
|
|
1661
|
+
setSize(({ height, width }) => {
|
|
1662
|
+
const newSize = {
|
|
1663
|
+
height: getNewSizeValue({
|
|
1664
|
+
shouldMove: shouldMoveY,
|
|
1665
|
+
shouldSize: shouldSizeY,
|
|
1666
|
+
value: height,
|
|
1667
|
+
modifier: e.movementY
|
|
1668
|
+
}),
|
|
1669
|
+
width: getNewSizeValue({
|
|
1670
|
+
shouldMove: shouldMoveX,
|
|
1671
|
+
shouldSize: shouldSizeX,
|
|
1672
|
+
value: width,
|
|
1673
|
+
modifier: e.movementX
|
|
1674
|
+
})
|
|
1675
|
+
};
|
|
1676
|
+
onResize?.(newSize);
|
|
1677
|
+
return newSize;
|
|
1678
|
+
});
|
|
1679
|
+
};
|
|
1680
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
1681
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
1682
|
+
return () => {
|
|
1683
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
1684
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
}, [size, resizingData, onResize]);
|
|
1688
|
+
const launchTranslate = () => setTranslateData(_13.set("isActive", true));
|
|
1689
|
+
const handlersElement = canResize ? /* @__PURE__ */ jsx11("div", { children: resizeHandlersProps.map((handle, key) => {
|
|
1690
|
+
return /* @__PURE__ */ jsx11(
|
|
855
1691
|
"div",
|
|
856
1692
|
{
|
|
1693
|
+
className: home_ec2_user_actions_runner_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default.handle,
|
|
857
1694
|
style: {
|
|
858
|
-
|
|
1695
|
+
"--v-top": handle.top,
|
|
1696
|
+
"--v-right": handle.right,
|
|
1697
|
+
"--v-bottom": handle.bottom,
|
|
1698
|
+
"--v-left": handle.left,
|
|
1699
|
+
"--v-cursor": handle.cursor
|
|
859
1700
|
},
|
|
860
|
-
"
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
1701
|
+
..._13.omit("resizingProps", handle),
|
|
1702
|
+
onMouseDown: () => setResizingData({
|
|
1703
|
+
isActive: true,
|
|
1704
|
+
..._13.get("resizingProps", handle)
|
|
1705
|
+
})
|
|
1706
|
+
},
|
|
1707
|
+
key
|
|
866
1708
|
);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
const deleteDocument = useCallback3((uuid) => {
|
|
885
|
-
}, []);
|
|
886
|
-
const deleteRightResponses = useCallback3(() => {
|
|
887
|
-
}, []);
|
|
888
|
-
const addPicture = (picture) => {
|
|
889
|
-
onChange((prev) => ({ ...prev, contentMd: `<primarygrid picture="${picture}" />` }));
|
|
1709
|
+
}) }) : /* @__PURE__ */ jsx11(Fragment, {});
|
|
1710
|
+
const isActive = translateData.isActive || resizingData.isActive;
|
|
1711
|
+
useEffect4(() => {
|
|
1712
|
+
if (!rndRef.current)
|
|
1713
|
+
return;
|
|
1714
|
+
rndRef.current.style.userSelect = isActive ? "none" : "unset";
|
|
1715
|
+
rndRef.current.style.position = "fixed";
|
|
1716
|
+
rndRef.current.style.top = "0";
|
|
1717
|
+
rndRef.current.style.left = "0";
|
|
1718
|
+
rndRef.current.style.transform = `translate3d(${translateData.x}px, ${translateData.y}px, 0)`;
|
|
1719
|
+
rndRef.current.style.height = size.height ? `${size.height}px` : "auto";
|
|
1720
|
+
rndRef.current.style.width = size.width ? `${size.width}px` : "auto";
|
|
1721
|
+
}, [translateData, size, isActive]);
|
|
1722
|
+
return {
|
|
1723
|
+
launchTranslate,
|
|
1724
|
+
handlersElement,
|
|
1725
|
+
rndRef
|
|
890
1726
|
};
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
{
|
|
894
|
-
template,
|
|
895
|
-
addDocument,
|
|
896
|
-
deleteDocument,
|
|
897
|
-
deleteRightResponses,
|
|
898
|
-
addPicture,
|
|
899
|
-
mode: "edit",
|
|
900
|
-
ref,
|
|
901
|
-
...props
|
|
902
|
-
}
|
|
903
|
-
);
|
|
904
|
-
});
|
|
905
|
-
EditViewerMd_default = EditViewerMd;
|
|
1727
|
+
};
|
|
1728
|
+
useDragAndResize_default = useDragAndResize;
|
|
906
1729
|
}
|
|
907
1730
|
});
|
|
908
1731
|
|
|
909
1732
|
// src/hooks/useClientMounted.tsx
|
|
910
|
-
import { useEffect as
|
|
1733
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
911
1734
|
var useClientMounted, useClientMounted_default;
|
|
912
1735
|
var init_useClientMounted = __esm({
|
|
913
1736
|
"src/hooks/useClientMounted.tsx"() {
|
|
914
1737
|
"use strict";
|
|
915
1738
|
useClientMounted = () => {
|
|
916
|
-
const [mounted, setMounted] =
|
|
917
|
-
|
|
1739
|
+
const [mounted, setMounted] = useState5(false);
|
|
1740
|
+
useEffect5(() => {
|
|
918
1741
|
setMounted(true);
|
|
919
1742
|
}, []);
|
|
920
1743
|
return mounted;
|
|
@@ -937,9 +1760,9 @@ var init_lazy = __esm({
|
|
|
937
1760
|
}
|
|
938
1761
|
});
|
|
939
1762
|
|
|
940
|
-
// css-modules:css-modules://
|
|
941
|
-
var
|
|
942
|
-
"css-modules:css-modules://
|
|
1763
|
+
// css-modules:css-modules://ClwWsN3MG80fL5vx9ZgsHtKB5PCE9WSraTwa_GOO_kA.css
|
|
1764
|
+
var init_ClwWsN3MG80fL5vx9ZgsHtKB5PCE9WSraTwa_GOO_kA = __esm({
|
|
1765
|
+
"css-modules:css-modules://ClwWsN3MG80fL5vx9ZgsHtKB5PCE9WSraTwa_GOO_kA.css"() {
|
|
943
1766
|
}
|
|
944
1767
|
});
|
|
945
1768
|
|
|
@@ -948,7 +1771,7 @@ var src_components_lazy_CodemirrorEditor_browser_default;
|
|
|
948
1771
|
var init_src_components_lazy_CodemirrorEditor_browser = __esm({
|
|
949
1772
|
"tmp_esbuild/_src_components_lazy_CodemirrorEditor.browser.module.css"() {
|
|
950
1773
|
"use strict";
|
|
951
|
-
|
|
1774
|
+
init_ClwWsN3MG80fL5vx9ZgsHtKB5PCE9WSraTwa_GOO_kA();
|
|
952
1775
|
src_components_lazy_CodemirrorEditor_browser_default = { "codemirrorWrapper": "vv-E1cuPG-codemirrorWrapper" };
|
|
953
1776
|
}
|
|
954
1777
|
});
|
|
@@ -966,17 +1789,17 @@ var CodemirrorEditor_browser_exports = {};
|
|
|
966
1789
|
__export(CodemirrorEditor_browser_exports, {
|
|
967
1790
|
default: () => CodemirrorEditor_browser_default
|
|
968
1791
|
});
|
|
969
|
-
import
|
|
970
|
-
import { useEffect as
|
|
971
|
-
import { jsx as
|
|
1792
|
+
import _14 from "lodash/fp.js";
|
|
1793
|
+
import { useEffect as useEffect6, useRef as useRef5, useState as useState6 } from "react";
|
|
1794
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
972
1795
|
var TAGS, completeAfter, completeIfAfterLt, completeIfInTag, xmlValidator, CodemirrorEditor, CodemirrorEditor_browser_default;
|
|
973
1796
|
var init_CodemirrorEditor_browser2 = __esm({
|
|
974
1797
|
"src/components/lazy/CodemirrorEditor.browser.tsx"() {
|
|
975
1798
|
"use strict";
|
|
976
1799
|
init_constants();
|
|
1800
|
+
init_lazy();
|
|
977
1801
|
init_template();
|
|
978
1802
|
init_CodemirrorEditor_browser();
|
|
979
|
-
init_lazy();
|
|
980
1803
|
TAGS = {};
|
|
981
1804
|
completeAfter = (cm, pred) => {
|
|
982
1805
|
if (!pred || pred()) {
|
|
@@ -1024,15 +1847,15 @@ var init_CodemirrorEditor_browser2 = __esm({
|
|
|
1024
1847
|
};
|
|
1025
1848
|
CodemirrorEditor = ({
|
|
1026
1849
|
readOnly,
|
|
1027
|
-
onChange =
|
|
1850
|
+
onChange = _14.noop,
|
|
1028
1851
|
keyMap,
|
|
1029
|
-
componentDidMount =
|
|
1852
|
+
componentDidMount = _14.noop,
|
|
1030
1853
|
value = "",
|
|
1031
|
-
onError =
|
|
1854
|
+
onError = _14.noop
|
|
1032
1855
|
}) => {
|
|
1033
|
-
const textarea =
|
|
1034
|
-
const [editor, setEditor] =
|
|
1035
|
-
|
|
1856
|
+
const textarea = useRef5(null);
|
|
1857
|
+
const [editor, setEditor] = useState6(null);
|
|
1858
|
+
useEffect6(() => {
|
|
1036
1859
|
const fn = async () => {
|
|
1037
1860
|
const codemirror = (await import("codemirror").then(lazyInterop)).default;
|
|
1038
1861
|
codemirror.registerHelper("lint", "xml", (text) => xmlValidator(codemirror, text, onError));
|
|
@@ -1064,7 +1887,7 @@ var init_CodemirrorEditor_browser2 = __esm({
|
|
|
1064
1887
|
};
|
|
1065
1888
|
fn();
|
|
1066
1889
|
}, [readOnly, keyMap, componentDidMount, onError]);
|
|
1067
|
-
|
|
1890
|
+
useEffect6(() => {
|
|
1068
1891
|
if (!editor) {
|
|
1069
1892
|
return;
|
|
1070
1893
|
}
|
|
@@ -1074,22 +1897,22 @@ var init_CodemirrorEditor_browser2 = __esm({
|
|
|
1074
1897
|
editor.off("change", localChange);
|
|
1075
1898
|
};
|
|
1076
1899
|
}, [editor, onChange]);
|
|
1077
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ jsx12("div", { className: src_components_lazy_CodemirrorEditor_browser_default.codemirrorWrapper, children: /* @__PURE__ */ jsx12("textarea", { ref: textarea, value, onChange: _14.noop }) });
|
|
1078
1901
|
};
|
|
1079
1902
|
CodemirrorEditor_browser_default = CodemirrorEditor;
|
|
1080
1903
|
}
|
|
1081
1904
|
});
|
|
1082
1905
|
|
|
1083
1906
|
// src/components/core/editor/CodemirrorEditor.tsx
|
|
1084
|
-
import
|
|
1085
|
-
import { jsx as
|
|
1907
|
+
import React6, { Suspense } from "react";
|
|
1908
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1086
1909
|
var LazyEditor, CodemirrorEditor2, CodemirrorEditor_default;
|
|
1087
1910
|
var init_CodemirrorEditor = __esm({
|
|
1088
1911
|
"src/components/core/editor/CodemirrorEditor.tsx"() {
|
|
1089
1912
|
"use strict";
|
|
1090
1913
|
init_useClientMounted();
|
|
1091
1914
|
init_lazy();
|
|
1092
|
-
LazyEditor =
|
|
1915
|
+
LazyEditor = React6.lazy(
|
|
1093
1916
|
() => (
|
|
1094
1917
|
// @ts-ignore TODO fallback is causing type issue
|
|
1095
1918
|
typeof window === "undefined" ? { default: null } : Promise.resolve().then(() => (init_CodemirrorEditor_browser2(), CodemirrorEditor_browser_exports)).then(lazyInterop)
|
|
@@ -1097,15 +1920,15 @@ var init_CodemirrorEditor = __esm({
|
|
|
1097
1920
|
);
|
|
1098
1921
|
CodemirrorEditor2 = (props) => {
|
|
1099
1922
|
const clientMounted = useClientMounted_default();
|
|
1100
|
-
return clientMounted ? /* @__PURE__ */
|
|
1923
|
+
return clientMounted ? /* @__PURE__ */ jsx13(Suspense, { children: /* @__PURE__ */ jsx13(LazyEditor, { ...props }) }) : /* @__PURE__ */ jsx13("div", {});
|
|
1101
1924
|
};
|
|
1102
1925
|
CodemirrorEditor_default = CodemirrorEditor2;
|
|
1103
1926
|
}
|
|
1104
1927
|
});
|
|
1105
1928
|
|
|
1106
|
-
// css-modules:css-modules://
|
|
1107
|
-
var
|
|
1108
|
-
"css-modules:css-modules://
|
|
1929
|
+
// css-modules:css-modules://D1lYSSaRELK-xOpLHrAFrFm44xAz5JpuKh1hj285xI4.css
|
|
1930
|
+
var init_D1lYSSaRELK_xOpLHrAFrFm44xAz5JpuKh1hj285xI4 = __esm({
|
|
1931
|
+
"css-modules:css-modules://D1lYSSaRELK-xOpLHrAFrFm44xAz5JpuKh1hj285xI4.css"() {
|
|
1109
1932
|
}
|
|
1110
1933
|
});
|
|
1111
1934
|
|
|
@@ -1114,7 +1937,7 @@ var src_components_core_editor_EditorHeaderModal_default;
|
|
|
1114
1937
|
var init_src_components_core_editor_EditorHeaderModal = __esm({
|
|
1115
1938
|
"tmp_esbuild/_src_components_core_editor_EditorHeaderModal.module.css"() {
|
|
1116
1939
|
"use strict";
|
|
1117
|
-
|
|
1940
|
+
init_D1lYSSaRELK_xOpLHrAFrFm44xAz5JpuKh1hj285xI4();
|
|
1118
1941
|
src_components_core_editor_EditorHeaderModal_default = { "header": "vv-go3bmq-header" };
|
|
1119
1942
|
}
|
|
1120
1943
|
});
|
|
@@ -1128,14 +1951,14 @@ var init_EditorHeaderModal = __esm({
|
|
|
1128
1951
|
});
|
|
1129
1952
|
|
|
1130
1953
|
// src/components/core/editor/EditorHeaderModal.tsx
|
|
1131
|
-
import { jsx as
|
|
1954
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1132
1955
|
var EditorHeaderModal, EditorHeaderModal_default;
|
|
1133
1956
|
var init_EditorHeaderModal2 = __esm({
|
|
1134
1957
|
"src/components/core/editor/EditorHeaderModal.tsx"() {
|
|
1135
1958
|
"use strict";
|
|
1136
1959
|
init_EditorHeaderModal();
|
|
1137
|
-
EditorHeaderModal = ({ onClick }) => /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1960
|
+
EditorHeaderModal = ({ onClick }) => /* @__PURE__ */ jsxs7("div", { children: [
|
|
1961
|
+
/* @__PURE__ */ jsx14(
|
|
1139
1962
|
"div",
|
|
1140
1963
|
{
|
|
1141
1964
|
className: src_components_core_editor_EditorHeaderModal_default.header,
|
|
@@ -1154,7 +1977,7 @@ var init_EditorHeaderModal2 = __esm({
|
|
|
1154
1977
|
children: "Principale"
|
|
1155
1978
|
}
|
|
1156
1979
|
),
|
|
1157
|
-
/* @__PURE__ */
|
|
1980
|
+
/* @__PURE__ */ jsx14(
|
|
1158
1981
|
"div",
|
|
1159
1982
|
{
|
|
1160
1983
|
className: src_components_core_editor_EditorHeaderModal_default.header,
|
|
@@ -1171,7 +1994,7 @@ var init_EditorHeaderModal2 = __esm({
|
|
|
1171
1994
|
children: "Secondaire"
|
|
1172
1995
|
}
|
|
1173
1996
|
),
|
|
1174
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsxs7(
|
|
1175
1998
|
"div",
|
|
1176
1999
|
{
|
|
1177
2000
|
className: src_components_core_editor_EditorHeaderModal_default.header,
|
|
@@ -1190,7 +2013,7 @@ var init_EditorHeaderModal2 = __esm({
|
|
|
1190
2013
|
]
|
|
1191
2014
|
}
|
|
1192
2015
|
),
|
|
1193
|
-
/* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsx14(
|
|
1194
2017
|
"div",
|
|
1195
2018
|
{
|
|
1196
2019
|
className: src_components_core_editor_EditorHeaderModal_default.header,
|
|
@@ -1206,7 +2029,7 @@ var init_EditorHeaderModal2 = __esm({
|
|
|
1206
2029
|
children: "Compl\xE9mentaire 2"
|
|
1207
2030
|
}
|
|
1208
2031
|
),
|
|
1209
|
-
/* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ jsx14(
|
|
1210
2033
|
"div",
|
|
1211
2034
|
{
|
|
1212
2035
|
className: src_components_core_editor_EditorHeaderModal_default.header,
|
|
@@ -1227,9 +2050,9 @@ var init_EditorHeaderModal2 = __esm({
|
|
|
1227
2050
|
}
|
|
1228
2051
|
});
|
|
1229
2052
|
|
|
1230
|
-
// css-modules:css-modules://
|
|
1231
|
-
var
|
|
1232
|
-
"css-modules:css-modules://
|
|
2053
|
+
// css-modules:css-modules://FAXEjMKr_nbgBeI0HbQm4Hou8oDtA1fDSwLREXIxVJQ.css
|
|
2054
|
+
var init_FAXEjMKr_nbgBeI0HbQm4Hou8oDtA1fDSwLREXIxVJQ = __esm({
|
|
2055
|
+
"css-modules:css-modules://FAXEjMKr_nbgBeI0HbQm4Hou8oDtA1fDSwLREXIxVJQ.css"() {
|
|
1233
2056
|
}
|
|
1234
2057
|
});
|
|
1235
2058
|
|
|
@@ -1238,7 +2061,7 @@ var src_components_core_editor_EditorListModal_default;
|
|
|
1238
2061
|
var init_src_components_core_editor_EditorListModal = __esm({
|
|
1239
2062
|
"tmp_esbuild/_src_components_core_editor_EditorListModal.module.css"() {
|
|
1240
2063
|
"use strict";
|
|
1241
|
-
|
|
2064
|
+
init_FAXEjMKr_nbgBeI0HbQm4Hou8oDtA1fDSwLREXIxVJQ();
|
|
1242
2065
|
src_components_core_editor_EditorListModal_default = { "ul": "vv-CkF5Qq-ul" };
|
|
1243
2066
|
}
|
|
1244
2067
|
});
|
|
@@ -1252,7 +2075,7 @@ var init_EditorListModal = __esm({
|
|
|
1252
2075
|
});
|
|
1253
2076
|
|
|
1254
2077
|
// src/components/core/editor/EditorListModal.tsx
|
|
1255
|
-
import { jsx as
|
|
2078
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1256
2079
|
var generateList, EditorListModal, EditorListModal_default;
|
|
1257
2080
|
var init_EditorListModal2 = __esm({
|
|
1258
2081
|
"src/components/core/editor/EditorListModal.tsx"() {
|
|
@@ -1265,18 +2088,18 @@ var init_EditorListModal2 = __esm({
|
|
|
1265
2088
|
<li></li>
|
|
1266
2089
|
</ul>
|
|
1267
2090
|
`;
|
|
1268
|
-
EditorListModal = ({ onClick }) => /* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
2091
|
+
EditorListModal = ({ onClick }) => /* @__PURE__ */ jsxs8("div", { children: [
|
|
2092
|
+
/* @__PURE__ */ jsx15("ul", { className: src_components_core_editor_EditorListModal_default.ul, onClick: () => onClick(() => generateList("disc")), children: /* @__PURE__ */ jsx15("li", {}) }),
|
|
2093
|
+
/* @__PURE__ */ jsx15("ul", { className: src_components_core_editor_EditorListModal_default.ul, type: "circle", onClick: () => onClick(() => generateList("circle")), children: /* @__PURE__ */ jsx15("li", {}) }),
|
|
2094
|
+
/* @__PURE__ */ jsx15("ul", { className: src_components_core_editor_EditorListModal_default.ul, type: "square", onClick: () => onClick(() => generateList("square")), children: /* @__PURE__ */ jsx15("li", {}) })
|
|
1272
2095
|
] });
|
|
1273
2096
|
EditorListModal_default = EditorListModal;
|
|
1274
2097
|
}
|
|
1275
2098
|
});
|
|
1276
2099
|
|
|
1277
|
-
// css-modules:css-modules://
|
|
1278
|
-
var
|
|
1279
|
-
"css-modules:css-modules://
|
|
2100
|
+
// css-modules:css-modules://iTcvO_EuuRof0S3Q_EadEoweHD1OFDXkCVSSCGPHK5I.css
|
|
2101
|
+
var init_iTcvO_EuuRof0S3Q_EadEoweHD1OFDXkCVSSCGPHK5I = __esm({
|
|
2102
|
+
"css-modules:css-modules://iTcvO_EuuRof0S3Q_EadEoweHD1OFDXkCVSSCGPHK5I.css"() {
|
|
1280
2103
|
}
|
|
1281
2104
|
});
|
|
1282
2105
|
|
|
@@ -1285,7 +2108,7 @@ var src_components_core_editor_EditorMathsModal_default;
|
|
|
1285
2108
|
var init_src_components_core_editor_EditorMathsModal = __esm({
|
|
1286
2109
|
"tmp_esbuild/_src_components_core_editor_EditorMathsModal.module.css"() {
|
|
1287
2110
|
"use strict";
|
|
1288
|
-
|
|
2111
|
+
init_iTcvO_EuuRof0S3Q_EadEoweHD1OFDXkCVSSCGPHK5I();
|
|
1289
2112
|
src_components_core_editor_EditorMathsModal_default = { "mathsElement": "vv-XGJSGG-mathsElement" };
|
|
1290
2113
|
}
|
|
1291
2114
|
});
|
|
@@ -1299,25 +2122,25 @@ var init_EditorMathsModal = __esm({
|
|
|
1299
2122
|
});
|
|
1300
2123
|
|
|
1301
2124
|
// src/components/core/editor/EditorMathsModal.tsx
|
|
1302
|
-
import { jsx as
|
|
2125
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1303
2126
|
var EditorMathsModal, EditorMathsModal_default;
|
|
1304
2127
|
var init_EditorMathsModal2 = __esm({
|
|
1305
2128
|
"src/components/core/editor/EditorMathsModal.tsx"() {
|
|
1306
2129
|
"use strict";
|
|
1307
2130
|
init_EditorMathsModal();
|
|
1308
|
-
EditorMathsModal = ({ onClick }) => /* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
/* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
2131
|
+
EditorMathsModal = ({ onClick }) => /* @__PURE__ */ jsxs9("div", { children: [
|
|
2132
|
+
/* @__PURE__ */ jsx16("div", { className: src_components_core_editor_EditorMathsModal_default.mathsElement, onClick: () => onClick((selectedText) => `<math>${selectedText}</math>`), children: "KaTeX" }),
|
|
2133
|
+
/* @__PURE__ */ jsx16("div", { className: src_components_core_editor_EditorMathsModal_default.mathsElement, onClick: () => onClick((selectedText) => `\\text{${selectedText}}`), children: "\\text {...}" }),
|
|
2134
|
+
/* @__PURE__ */ jsx16("div", { className: src_components_core_editor_EditorMathsModal_default.mathsElement, onClick: () => onClick((selectedText) => `<python inline="true">${selectedText}</python>`), children: "python" }),
|
|
2135
|
+
/* @__PURE__ */ jsx16("div", { className: src_components_core_editor_EditorMathsModal_default.mathsElement, onClick: () => onClick((selectedText) => `<geogebra>${selectedText}</geogebra>`), children: "geogebra" })
|
|
1313
2136
|
] });
|
|
1314
2137
|
EditorMathsModal_default = EditorMathsModal;
|
|
1315
2138
|
}
|
|
1316
2139
|
});
|
|
1317
2140
|
|
|
1318
|
-
// css-modules:css-modules
|
|
1319
|
-
var
|
|
1320
|
-
"css-modules:css-modules
|
|
2141
|
+
// css-modules:css-modules://-Z7nD8VDTTbf2fdFuqZ2hX3q2ctyJaUVhprv-NQnySo.css
|
|
2142
|
+
var init_Z7nD8VDTTbf2fdFuqZ2hX3q2ctyJaUVhprv_NQnySo = __esm({
|
|
2143
|
+
"css-modules:css-modules://-Z7nD8VDTTbf2fdFuqZ2hX3q2ctyJaUVhprv-NQnySo.css"() {
|
|
1321
2144
|
}
|
|
1322
2145
|
});
|
|
1323
2146
|
|
|
@@ -1326,7 +2149,7 @@ var src_components_core_editor_EditorOrderedListModal_default;
|
|
|
1326
2149
|
var init_src_components_core_editor_EditorOrderedListModal = __esm({
|
|
1327
2150
|
"tmp_esbuild/_src_components_core_editor_EditorOrderedListModal.module.css"() {
|
|
1328
2151
|
"use strict";
|
|
1329
|
-
|
|
2152
|
+
init_Z7nD8VDTTbf2fdFuqZ2hX3q2ctyJaUVhprv_NQnySo();
|
|
1330
2153
|
src_components_core_editor_EditorOrderedListModal_default = { "ol": "vv-IbixEG-ol" };
|
|
1331
2154
|
}
|
|
1332
2155
|
});
|
|
@@ -1340,7 +2163,7 @@ var init_EditorOrderedListModal = __esm({
|
|
|
1340
2163
|
});
|
|
1341
2164
|
|
|
1342
2165
|
// src/components/core/editor/EditorOrderedListModal.tsx
|
|
1343
|
-
import { jsx as
|
|
2166
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1344
2167
|
var generateList2, EditorOrderedListModal, EditorOrderedListModal_default;
|
|
1345
2168
|
var init_EditorOrderedListModal2 = __esm({
|
|
1346
2169
|
"src/components/core/editor/EditorOrderedListModal.tsx"() {
|
|
@@ -1353,40 +2176,40 @@ var init_EditorOrderedListModal2 = __esm({
|
|
|
1353
2176
|
<li></li>
|
|
1354
2177
|
</ol>
|
|
1355
2178
|
`;
|
|
1356
|
-
EditorOrderedListModal = ({ onClick }) => /* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
2179
|
+
EditorOrderedListModal = ({ onClick }) => /* @__PURE__ */ jsxs10("div", { children: [
|
|
2180
|
+
/* @__PURE__ */ jsxs10("ol", { className: src_components_core_editor_EditorOrderedListModal_default.ol, type: "1", onClick: () => onClick(() => generateList2("1")), children: [
|
|
2181
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2182
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2183
|
+
/* @__PURE__ */ jsx17("li", {})
|
|
1361
2184
|
] }),
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsxs10("ol", { className: src_components_core_editor_EditorOrderedListModal_default.ol, type: "a", onClick: () => onClick(() => generateList2("a")), children: [
|
|
2186
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2187
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2188
|
+
/* @__PURE__ */ jsx17("li", {})
|
|
1366
2189
|
] }),
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ jsxs10("ol", { className: src_components_core_editor_EditorOrderedListModal_default.ol, type: "A", onClick: () => onClick(() => generateList2("A")), children: [
|
|
2191
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2192
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2193
|
+
/* @__PURE__ */ jsx17("li", {})
|
|
1371
2194
|
] }),
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
2195
|
+
/* @__PURE__ */ jsxs10("ol", { className: src_components_core_editor_EditorOrderedListModal_default.ol, type: "i", onClick: () => onClick(() => generateList2("i")), children: [
|
|
2196
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2197
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2198
|
+
/* @__PURE__ */ jsx17("li", {})
|
|
1376
2199
|
] }),
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ jsxs10("ol", { className: src_components_core_editor_EditorOrderedListModal_default.ol, type: "I", onClick: () => onClick(() => generateList2("I")), children: [
|
|
2201
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2202
|
+
/* @__PURE__ */ jsx17("li", {}),
|
|
2203
|
+
/* @__PURE__ */ jsx17("li", {})
|
|
1381
2204
|
] })
|
|
1382
2205
|
] });
|
|
1383
2206
|
EditorOrderedListModal_default = EditorOrderedListModal;
|
|
1384
2207
|
}
|
|
1385
2208
|
});
|
|
1386
2209
|
|
|
1387
|
-
// css-modules:css-modules://
|
|
1388
|
-
var
|
|
1389
|
-
"css-modules:css-modules://
|
|
2210
|
+
// css-modules:css-modules://gesVSQDjVmNzyeAM6C2g6PgbgdrauKrOml9XUyf0d1A.css
|
|
2211
|
+
var init_gesVSQDjVmNzyeAM6C2g6PgbgdrauKrOml9XUyf0d1A = __esm({
|
|
2212
|
+
"css-modules:css-modules://gesVSQDjVmNzyeAM6C2g6PgbgdrauKrOml9XUyf0d1A.css"() {
|
|
1390
2213
|
}
|
|
1391
2214
|
});
|
|
1392
2215
|
|
|
@@ -1395,7 +2218,7 @@ var src_components_core_editor_EditorQuestionModal_default;
|
|
|
1395
2218
|
var init_src_components_core_editor_EditorQuestionModal = __esm({
|
|
1396
2219
|
"tmp_esbuild/_src_components_core_editor_EditorQuestionModal.module.css"() {
|
|
1397
2220
|
"use strict";
|
|
1398
|
-
|
|
2221
|
+
init_gesVSQDjVmNzyeAM6C2g6PgbgdrauKrOml9XUyf0d1A();
|
|
1399
2222
|
src_components_core_editor_EditorQuestionModal_default = { "question": "vv-QBK0Ba-question" };
|
|
1400
2223
|
}
|
|
1401
2224
|
});
|
|
@@ -1409,19 +2232,19 @@ var init_EditorQuestionModal = __esm({
|
|
|
1409
2232
|
});
|
|
1410
2233
|
|
|
1411
2234
|
// src/components/core/editor/EditorQuestionModal.tsx
|
|
1412
|
-
import { jsx as
|
|
2235
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1413
2236
|
var EditorQuestionModal, EditorQuestionModal_default;
|
|
1414
2237
|
var init_EditorQuestionModal2 = __esm({
|
|
1415
2238
|
"src/components/core/editor/EditorQuestionModal.tsx"() {
|
|
1416
2239
|
"use strict";
|
|
1417
2240
|
init_EditorQuestionModal();
|
|
1418
|
-
EditorQuestionModal = ({ onClick }) => /* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
2241
|
+
EditorQuestionModal = ({ onClick }) => /* @__PURE__ */ jsxs11("div", { children: [
|
|
2242
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick(() => `<qtarea id="" width="90%" />`), children: "Question textarea" }),
|
|
2243
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick((selectedText) => `<qt id="">${selectedText}</qt>`), children: "Question ouverte" }),
|
|
2244
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick((selectedText) => `<qs id="">${selectedText}</qs>`), children: 'Question "select"' }),
|
|
2245
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick(() => '<qc id="" />'), children: "Question checkbox" }),
|
|
2246
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick(() => '<qr id="" value="" />'), children: "Question radio" }),
|
|
2247
|
+
/* @__PURE__ */ jsx18(
|
|
1425
2248
|
"div",
|
|
1426
2249
|
{
|
|
1427
2250
|
className: src_components_core_editor_EditorQuestionModal_default.question,
|
|
@@ -1442,8 +2265,8 @@ var init_EditorQuestionModal2 = __esm({
|
|
|
1442
2265
|
children: "Question DnD"
|
|
1443
2266
|
}
|
|
1444
2267
|
),
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick((selectedText) => `<qmath id="">${selectedText}</qmath>`), children: "Question maths" }),
|
|
2269
|
+
/* @__PURE__ */ jsx18(
|
|
1447
2270
|
"div",
|
|
1448
2271
|
{
|
|
1449
2272
|
className: src_components_core_editor_EditorQuestionModal_default.question,
|
|
@@ -1456,15 +2279,15 @@ var init_EditorQuestionModal2 = __esm({
|
|
|
1456
2279
|
children: "Question maths select"
|
|
1457
2280
|
}
|
|
1458
2281
|
),
|
|
1459
|
-
/* @__PURE__ */
|
|
2282
|
+
/* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorQuestionModal_default.question, onClick: () => onClick(() => `<qdraw2 id=""/>`), children: "Question draw" })
|
|
1460
2283
|
] });
|
|
1461
2284
|
EditorQuestionModal_default = EditorQuestionModal;
|
|
1462
2285
|
}
|
|
1463
2286
|
});
|
|
1464
2287
|
|
|
1465
|
-
// css-modules:css-modules://
|
|
1466
|
-
var
|
|
1467
|
-
"css-modules:css-modules://
|
|
2288
|
+
// css-modules:css-modules://aXP2yBEvDrqZAjdnvRWrB53787qw4y3ToSiBw04uiE8.css
|
|
2289
|
+
var init_aXP2yBEvDrqZAjdnvRWrB53787qw4y3ToSiBw04uiE8 = __esm({
|
|
2290
|
+
"css-modules:css-modules://aXP2yBEvDrqZAjdnvRWrB53787qw4y3ToSiBw04uiE8.css"() {
|
|
1468
2291
|
}
|
|
1469
2292
|
});
|
|
1470
2293
|
|
|
@@ -1473,7 +2296,7 @@ var src_components_core_editor_EditorStampModal_default;
|
|
|
1473
2296
|
var init_src_components_core_editor_EditorStampModal = __esm({
|
|
1474
2297
|
"tmp_esbuild/_src_components_core_editor_EditorStampModal.module.css"() {
|
|
1475
2298
|
"use strict";
|
|
1476
|
-
|
|
2299
|
+
init_aXP2yBEvDrqZAjdnvRWrB53787qw4y3ToSiBw04uiE8();
|
|
1477
2300
|
src_components_core_editor_EditorStampModal_default = { "stamp": "vv-pmaK1a-stamp" };
|
|
1478
2301
|
}
|
|
1479
2302
|
});
|
|
@@ -1487,37 +2310,37 @@ var init_EditorStampModal = __esm({
|
|
|
1487
2310
|
});
|
|
1488
2311
|
|
|
1489
2312
|
// src/components/core/editor/EditorStampModal.tsx
|
|
1490
|
-
import { jsx as
|
|
2313
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1491
2314
|
var EditorStampModal, EditorStampModal_default;
|
|
1492
2315
|
var init_EditorStampModal2 = __esm({
|
|
1493
2316
|
"src/components/core/editor/EditorStampModal.tsx"() {
|
|
1494
2317
|
"use strict";
|
|
1495
2318
|
init_EditorStampModal();
|
|
1496
|
-
EditorStampModal = ({ onClick }) => /* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
2319
|
+
EditorStampModal = ({ onClick }) => /* @__PURE__ */ jsxs12("div", { children: [
|
|
2320
|
+
/* @__PURE__ */ jsx19("div", { className: src_components_core_editor_EditorStampModal_default.stamp, onClick: () => onClick((selectedText) => `<stamp theme="" size="">${selectedText}</stamp>`), children: "Stamp classique" }),
|
|
2321
|
+
/* @__PURE__ */ jsx19("div", { className: src_components_core_editor_EditorStampModal_default.stamp, onClick: () => onClick(() => `<stamp theme="" icon="" size=""/>`), children: "Stamp avec icon" })
|
|
1499
2322
|
] });
|
|
1500
2323
|
EditorStampModal_default = EditorStampModal;
|
|
1501
2324
|
}
|
|
1502
2325
|
});
|
|
1503
2326
|
|
|
1504
2327
|
// src/utils/table.ts
|
|
1505
|
-
import
|
|
2328
|
+
import _15 from "lodash/fp.js";
|
|
1506
2329
|
var generateTable;
|
|
1507
2330
|
var init_table = __esm({
|
|
1508
2331
|
"src/utils/table.ts"() {
|
|
1509
2332
|
"use strict";
|
|
1510
2333
|
generateTable = ({ column, line }) => {
|
|
1511
|
-
const headLine =
|
|
1512
|
-
const bodyLine =
|
|
2334
|
+
const headLine = _15.times(_15.constant("<th></th>"), column);
|
|
2335
|
+
const bodyLine = _15.times(_15.constant("<td></td>"), column);
|
|
1513
2336
|
const head = `<thead>
|
|
1514
2337
|
<tr>
|
|
1515
|
-
${
|
|
2338
|
+
${_15.join("\n ", headLine)}
|
|
1516
2339
|
</tr>
|
|
1517
2340
|
</thead>`;
|
|
1518
2341
|
const body = `<tbody>
|
|
1519
|
-
${
|
|
1520
|
-
${
|
|
2342
|
+
${_15.times(_15.constant(`<tr>
|
|
2343
|
+
${_15.join("\n ", bodyLine)}
|
|
1521
2344
|
</tr>`), line - 1).join("\n ")}
|
|
1522
2345
|
</tbody>`;
|
|
1523
2346
|
return `<table>
|
|
@@ -1529,9 +2352,9 @@ var init_table = __esm({
|
|
|
1529
2352
|
}
|
|
1530
2353
|
});
|
|
1531
2354
|
|
|
1532
|
-
// css-modules:css-modules://
|
|
1533
|
-
var
|
|
1534
|
-
"css-modules:css-modules://
|
|
2355
|
+
// css-modules:css-modules://l9ewCrSeYzAUJUd9PfLHkZujTTXaJQ-auwa6d-qDY3s.css
|
|
2356
|
+
var init_l9ewCrSeYzAUJUd9PfLHkZujTTXaJQ_auwa6d_qDY3s = __esm({
|
|
2357
|
+
"css-modules:css-modules://l9ewCrSeYzAUJUd9PfLHkZujTTXaJQ-auwa6d-qDY3s.css"() {
|
|
1535
2358
|
}
|
|
1536
2359
|
});
|
|
1537
2360
|
|
|
@@ -1540,8 +2363,8 @@ var src_components_core_editor_EditorTableModal_default;
|
|
|
1540
2363
|
var init_src_components_core_editor_EditorTableModal = __esm({
|
|
1541
2364
|
"tmp_esbuild/_src_components_core_editor_EditorTableModal.module.css"() {
|
|
1542
2365
|
"use strict";
|
|
1543
|
-
|
|
1544
|
-
src_components_core_editor_EditorTableModal_default = { "
|
|
2366
|
+
init_l9ewCrSeYzAUJUd9PfLHkZujTTXaJQ_auwa6d_qDY3s();
|
|
2367
|
+
src_components_core_editor_EditorTableModal_default = { "line": "vv-VbIHYG-line", "cell": "vv-VbIHYG-cell", "grid": "vv-VbIHYG-grid", "header": "vv-VbIHYG-header" };
|
|
1545
2368
|
}
|
|
1546
2369
|
});
|
|
1547
2370
|
|
|
@@ -1554,9 +2377,9 @@ var init_EditorTableModal = __esm({
|
|
|
1554
2377
|
});
|
|
1555
2378
|
|
|
1556
2379
|
// src/components/core/editor/EditorTableModal.tsx
|
|
1557
|
-
import { useCallback as
|
|
1558
|
-
import
|
|
1559
|
-
import { jsx as
|
|
2380
|
+
import { useCallback as useCallback5, useState as useState7 } from "react";
|
|
2381
|
+
import _16 from "lodash/fp.js";
|
|
2382
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1560
2383
|
var LINE_COUNT, COLUMN_COUNT, CELL_WIDTH, CELL_HEIGHT, CELL_MARGIN, LINE_WIDTH, Cell, EditorTableModal, EditorTableModal_default;
|
|
1561
2384
|
var init_EditorTableModal2 = __esm({
|
|
1562
2385
|
"src/components/core/editor/EditorTableModal.tsx"() {
|
|
@@ -1570,13 +2393,13 @@ var init_EditorTableModal2 = __esm({
|
|
|
1570
2393
|
CELL_MARGIN = 1;
|
|
1571
2394
|
LINE_WIDTH = LINE_COUNT * CELL_WIDTH + (LINE_COUNT - 1) * CELL_MARGIN;
|
|
1572
2395
|
Cell = ({ isSelected = false, onMouseEnter, onClick, column, line }) => {
|
|
1573
|
-
const onMouseEnterCallback =
|
|
2396
|
+
const onMouseEnterCallback = useCallback5(() => {
|
|
1574
2397
|
onMouseEnter({ column, line });
|
|
1575
2398
|
}, [column, line, onMouseEnter]);
|
|
1576
|
-
const onClickCallback =
|
|
2399
|
+
const onClickCallback = useCallback5(() => {
|
|
1577
2400
|
onClick({ column, line });
|
|
1578
2401
|
}, [column, line, onClick]);
|
|
1579
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsx20(
|
|
1580
2403
|
"div",
|
|
1581
2404
|
{
|
|
1582
2405
|
className: src_components_core_editor_EditorTableModal_default.cell,
|
|
@@ -1588,27 +2411,27 @@ var init_EditorTableModal2 = __esm({
|
|
|
1588
2411
|
);
|
|
1589
2412
|
};
|
|
1590
2413
|
EditorTableModal = ({ onClick }) => {
|
|
1591
|
-
const [selected, setSelected] =
|
|
1592
|
-
const onMouseEnter =
|
|
2414
|
+
const [selected, setSelected] = useState7({ line: 0, column: 0 });
|
|
2415
|
+
const onMouseEnter = useCallback5(({ column, line }) => {
|
|
1593
2416
|
setSelected({ line, column });
|
|
1594
2417
|
}, []);
|
|
1595
|
-
const createTable =
|
|
2418
|
+
const createTable = useCallback5(
|
|
1596
2419
|
({ column, line }) => {
|
|
1597
2420
|
onClick(() => generateTable({ column, line }));
|
|
1598
2421
|
},
|
|
1599
2422
|
[onClick]
|
|
1600
2423
|
);
|
|
1601
|
-
const selectedLine =
|
|
1602
|
-
const selectedColumn =
|
|
1603
|
-
return /* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
2424
|
+
const selectedLine = _16.getOr(0, "line", selected);
|
|
2425
|
+
const selectedColumn = _16.getOr(0, "column", selected);
|
|
2426
|
+
return /* @__PURE__ */ jsxs13("div", { children: [
|
|
2427
|
+
/* @__PURE__ */ jsx20("div", { className: src_components_core_editor_EditorTableModal_default.header, children: `${selectedLine} x ${selectedColumn}` }),
|
|
2428
|
+
/* @__PURE__ */ jsx20("div", { className: src_components_core_editor_EditorTableModal_default.grid, style: { "--v-line-width": `${LINE_WIDTH}px` }, children: _16.flow(
|
|
2429
|
+
_16.range(1),
|
|
2430
|
+
_16.map((line) => /* @__PURE__ */ jsx20("div", { className: src_components_core_editor_EditorTableModal_default.line, style: { "--v-cell-margin": `${CELL_MARGIN}px` }, children: _16.flow(
|
|
2431
|
+
_16.range(1),
|
|
2432
|
+
_16.map((column) => {
|
|
1610
2433
|
const isselected = line <= selectedLine && column <= selectedColumn;
|
|
1611
|
-
return /* @__PURE__ */
|
|
2434
|
+
return /* @__PURE__ */ jsx20(Cell, { isSelected: isselected, onMouseEnter, onClick: createTable, column, line }, column);
|
|
1612
2435
|
})
|
|
1613
2436
|
)(COLUMN_COUNT) }, line))
|
|
1614
2437
|
)(LINE_COUNT) })
|
|
@@ -1618,9 +2441,9 @@ var init_EditorTableModal2 = __esm({
|
|
|
1618
2441
|
}
|
|
1619
2442
|
});
|
|
1620
2443
|
|
|
1621
|
-
// css-modules:css-modules://
|
|
1622
|
-
var
|
|
1623
|
-
"css-modules:css-modules://
|
|
2444
|
+
// css-modules:css-modules://V9YMxBzxg_bf_yrJnoKZc7V_grOZr8Z66I81mib-oQ4.css
|
|
2445
|
+
var init_V9YMxBzxg_bf_yrJnoKZc7V_grOZr8Z66I81mib_oQ4 = __esm({
|
|
2446
|
+
"css-modules:css-modules://V9YMxBzxg_bf_yrJnoKZc7V_grOZr8Z66I81mib-oQ4.css"() {
|
|
1624
2447
|
}
|
|
1625
2448
|
});
|
|
1626
2449
|
|
|
@@ -1629,8 +2452,8 @@ var src_components_core_editor_EditorTitleModal_default;
|
|
|
1629
2452
|
var init_src_components_core_editor_EditorTitleModal = __esm({
|
|
1630
2453
|
"tmp_esbuild/_src_components_core_editor_EditorTitleModal.module.css"() {
|
|
1631
2454
|
"use strict";
|
|
1632
|
-
|
|
1633
|
-
src_components_core_editor_EditorTitleModal_default = { "
|
|
2455
|
+
init_V9YMxBzxg_bf_yrJnoKZc7V_grOZr8Z66I81mib_oQ4();
|
|
2456
|
+
src_components_core_editor_EditorTitleModal_default = { "body3": "vv-_Pgo7W-body3", "title": "vv-_Pgo7W-title", "h2": "vv-_Pgo7W-h2", "h4": "vv-_Pgo7W-h4", "body1": "vv-_Pgo7W-body1", "body2": "vv-_Pgo7W-body2", "h1": "vv-_Pgo7W-h1", "h3": "vv-_Pgo7W-h3" };
|
|
1634
2457
|
}
|
|
1635
2458
|
});
|
|
1636
2459
|
|
|
@@ -1644,28 +2467,28 @@ var init_EditorTitleModal = __esm({
|
|
|
1644
2467
|
|
|
1645
2468
|
// src/components/core/editor/EditorTitleModal.tsx
|
|
1646
2469
|
import { cx as cx4 } from "@lls/utils";
|
|
1647
|
-
import { jsx as
|
|
2470
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1648
2471
|
var EditorTitlesModal, EditorTitleModal_default;
|
|
1649
2472
|
var init_EditorTitleModal2 = __esm({
|
|
1650
2473
|
"src/components/core/editor/EditorTitleModal.tsx"() {
|
|
1651
2474
|
"use strict";
|
|
1652
2475
|
init_EditorTitleModal();
|
|
1653
|
-
EditorTitlesModal = ({ onClick }) => /* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
2476
|
+
EditorTitlesModal = ({ onClick }) => /* @__PURE__ */ jsxs14("div", { children: [
|
|
2477
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.h1, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<h1>${selectedText}</h1>`), children: "h1" }),
|
|
2478
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.h2, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<h2>${selectedText}</h2>`), children: "h2" }),
|
|
2479
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.h3, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<h3>${selectedText}</h3>`), children: "h3" }),
|
|
2480
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.h4, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<h4>${selectedText}</h4>`), children: "h4" }),
|
|
2481
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.body1, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<body1>${selectedText}</body1>`), children: "body1" }),
|
|
2482
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.body2, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<body2>${selectedText}</body2>`), children: "body2" }),
|
|
2483
|
+
/* @__PURE__ */ jsx21("div", { className: cx4(src_components_core_editor_EditorTitleModal_default.body3, src_components_core_editor_EditorTitleModal_default.title), onClick: () => onClick((selectedText) => `<body3>${selectedText}</body3>`), children: "body3" })
|
|
1661
2484
|
] });
|
|
1662
2485
|
EditorTitleModal_default = EditorTitlesModal;
|
|
1663
2486
|
}
|
|
1664
2487
|
});
|
|
1665
2488
|
|
|
1666
|
-
// css-modules:css-modules://
|
|
1667
|
-
var
|
|
1668
|
-
"css-modules:css-modules://
|
|
2489
|
+
// css-modules:css-modules://lMZNEEJTvWcOpUEI82Y2e_I9O1ERlgdLVk01D1TDHyU.css
|
|
2490
|
+
var init_lMZNEEJTvWcOpUEI82Y2e_I9O1ERlgdLVk01D1TDHyU = __esm({
|
|
2491
|
+
"css-modules:css-modules://lMZNEEJTvWcOpUEI82Y2e_I9O1ERlgdLVk01D1TDHyU.css"() {
|
|
1669
2492
|
}
|
|
1670
2493
|
});
|
|
1671
2494
|
|
|
@@ -1674,8 +2497,8 @@ var src_components_core_editor_EditorToolbar_default;
|
|
|
1674
2497
|
var init_src_components_core_editor_EditorToolbar = __esm({
|
|
1675
2498
|
"tmp_esbuild/_src_components_core_editor_EditorToolbar.module.css"() {
|
|
1676
2499
|
"use strict";
|
|
1677
|
-
|
|
1678
|
-
src_components_core_editor_EditorToolbar_default = { "
|
|
2500
|
+
init_lMZNEEJTvWcOpUEI82Y2e_I9O1ERlgdLVk01D1TDHyU();
|
|
2501
|
+
src_components_core_editor_EditorToolbar_default = { "editorToolbar": "vv-LGQOTG-editorToolbar", "span": "vv-LGQOTG-span" };
|
|
1679
2502
|
}
|
|
1680
2503
|
});
|
|
1681
2504
|
|
|
@@ -1688,10 +2511,10 @@ var init_EditorToolbar = __esm({
|
|
|
1688
2511
|
});
|
|
1689
2512
|
|
|
1690
2513
|
// src/components/core/editor/EditorToolbar.tsx
|
|
1691
|
-
import { forwardRef, useCallback as
|
|
2514
|
+
import { forwardRef, useCallback as useCallback6, useState as useState8 } from "react";
|
|
1692
2515
|
import xmlFormat from "xml-formatter";
|
|
1693
2516
|
import { Button as Button3, ButtonsList, Tooltip as Tooltip2 } from "@lls/lls-kit";
|
|
1694
|
-
import { jsx as
|
|
2517
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1695
2518
|
import { createElement } from "react";
|
|
1696
2519
|
var EDITOR_BUTTONS, Dropdown, EditorToolbar, EditorToolbar_default;
|
|
1697
2520
|
var init_EditorToolbar2 = __esm({
|
|
@@ -1850,360 +2673,72 @@ ${selectedText}
|
|
|
1850
2673
|
title: "Question"
|
|
1851
2674
|
},
|
|
1852
2675
|
{
|
|
1853
|
-
icon: "functions",
|
|
1854
|
-
dropdown: EditorMathsModal_default,
|
|
1855
|
-
action: (maths) => maths,
|
|
1856
|
-
title: "Maths"
|
|
1857
|
-
},
|
|
1858
|
-
{
|
|
1859
|
-
icon: "view_compact",
|
|
1860
|
-
action: (selectedText = "") => `<genially id="${selectedText}" />`,
|
|
1861
|
-
title: "Genially"
|
|
1862
|
-
},
|
|
1863
|
-
{
|
|
1864
|
-
icon: "superscript",
|
|
1865
|
-
action: (selectedText = "") => `<sup>${selectedText}</sup>`,
|
|
1866
|
-
title: "Superscript"
|
|
1867
|
-
},
|
|
1868
|
-
{
|
|
1869
|
-
icon: "subscript",
|
|
1870
|
-
action: (selectedText = "") => `<sub>${selectedText}</sub>`,
|
|
1871
|
-
title: "Subscript"
|
|
1872
|
-
},
|
|
1873
|
-
{
|
|
1874
|
-
icon: "mic",
|
|
1875
|
-
action: () => "<recorder />",
|
|
1876
|
-
title: "Recorder"
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
icon: "format_indent_increase",
|
|
1880
|
-
action: (selectedText = "") => xmlFormat(selectedText),
|
|
1881
|
-
title: "Prettify"
|
|
1882
|
-
}
|
|
1883
|
-
];
|
|
1884
|
-
Dropdown = ({ icon, title, dropdown: Overlay, action }) => {
|
|
1885
|
-
const [visible, setVisible] = useState6(false);
|
|
1886
|
-
const toggleVisible = () => {
|
|
1887
|
-
setVisible((isVisible) => !isVisible);
|
|
1888
|
-
};
|
|
1889
|
-
const onClickOverlay = useCallback5(
|
|
1890
|
-
(params) => {
|
|
1891
|
-
action(params);
|
|
1892
|
-
setVisible(false);
|
|
1893
|
-
},
|
|
1894
|
-
[action]
|
|
1895
|
-
);
|
|
1896
|
-
const listItems = [
|
|
1897
|
-
{
|
|
1898
|
-
type: "component",
|
|
1899
|
-
content: /* @__PURE__ */ jsx18(Overlay, { onClick: onClickOverlay })
|
|
1900
|
-
}
|
|
1901
|
-
];
|
|
1902
|
-
return /* @__PURE__ */ jsxs13("span", { className: src_components_core_editor_EditorToolbar_default.span, onClick: toggleVisible, children: [
|
|
1903
|
-
/* @__PURE__ */ jsx18(Tooltip2, { content: title, children: /* @__PURE__ */ jsx18(Button3, { theme: "gray", icon, children: " " }) }),
|
|
1904
|
-
visible && /* @__PURE__ */ jsx18(ButtonsList, { listItems, className: src_components_core_editor_EditorToolbar_default.absoluteMenuButton, zIndex: 1, withMask: false })
|
|
1905
|
-
] });
|
|
1906
|
-
};
|
|
1907
|
-
EditorToolbar = forwardRef(({ replace }, menuRef) => /* @__PURE__ */ jsx18("div", { className: src_components_core_editor_EditorToolbar_default.editorToolbar, ref: menuRef, children: EDITOR_BUTTONS.map((button, i) => {
|
|
1908
|
-
const { icon, action, title, dropdown } = button;
|
|
1909
|
-
return dropdown ? /* @__PURE__ */ createElement(Dropdown, { ...button, action: (callback) => replace(callback), key: i }) : /* @__PURE__ */ jsx18(Tooltip2, { content: title, children: /* @__PURE__ */ jsx18(Button3, { theme: "gray", onClick: () => replace(action, title), icon, children: " " }, i) });
|
|
1910
|
-
}) }));
|
|
1911
|
-
EditorToolbar.displayName = "EditorToolbar";
|
|
1912
|
-
EditorToolbar_default = EditorToolbar;
|
|
1913
|
-
}
|
|
1914
|
-
});
|
|
1915
|
-
|
|
1916
|
-
// css-modules:css-modules://gqbJUDvYRnw2EEqRHbuvHhtAP_p2lL0u8k92bx4wMAU.css
|
|
1917
|
-
var init_gqbJUDvYRnw2EEqRHbuvHhtAP_p2lL0u8k92bx4wMAU = __esm({
|
|
1918
|
-
"css-modules:css-modules://gqbJUDvYRnw2EEqRHbuvHhtAP_p2lL0u8k92bx4wMAU.css"() {
|
|
1919
|
-
}
|
|
1920
|
-
});
|
|
1921
|
-
|
|
1922
|
-
// tmp_esbuild/_home_ec2-user_github__work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize.module.css
|
|
1923
|
-
var home_ec2_user_github_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default;
|
|
1924
|
-
var init_home_ec2_user_github_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize = __esm({
|
|
1925
|
-
"tmp_esbuild/_home_ec2-user_github__work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize.module.css"() {
|
|
1926
|
-
"use strict";
|
|
1927
|
-
init_gqbJUDvYRnw2EEqRHbuvHhtAP_p2lL0u8k92bx4wMAU();
|
|
1928
|
-
home_ec2_user_github_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default = { "handle": "vv-gepzXq-handle" };
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
|
|
1932
|
-
// ../viewer/src/hooks/useDragAndResize.module.css
|
|
1933
|
-
var init_useDragAndResize = __esm({
|
|
1934
|
-
"../viewer/src/hooks/useDragAndResize.module.css"() {
|
|
1935
|
-
"use strict";
|
|
1936
|
-
init_home_ec2_user_github_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize();
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
|
|
1940
|
-
// ../viewer/src/hooks/useDragAndResize.tsx
|
|
1941
|
-
import { useEffect as useEffect4, useRef as useRef4, useState as useState7 } from "react";
|
|
1942
|
-
import _15 from "lodash/fp.js";
|
|
1943
|
-
import { Fragment, jsx as jsx19 } from "react/jsx-runtime";
|
|
1944
|
-
var resizeHandlersProps, useDragAndResize, useDragAndResize_default;
|
|
1945
|
-
var init_useDragAndResize2 = __esm({
|
|
1946
|
-
"../viewer/src/hooks/useDragAndResize.tsx"() {
|
|
1947
|
-
"use strict";
|
|
1948
|
-
init_useDragAndResize();
|
|
1949
|
-
resizeHandlersProps = [
|
|
1950
|
-
{
|
|
1951
|
-
top: "-5px",
|
|
1952
|
-
right: "0",
|
|
1953
|
-
bottom: "calc(100% - 5px)",
|
|
1954
|
-
left: "0",
|
|
1955
|
-
cursor: "row-resize",
|
|
1956
|
-
resizingProps: {
|
|
1957
|
-
shouldSizeX: false,
|
|
1958
|
-
shouldSizeY: true,
|
|
1959
|
-
shouldMoveX: false,
|
|
1960
|
-
shouldMoveY: true
|
|
1961
|
-
}
|
|
1962
|
-
},
|
|
1963
|
-
{
|
|
1964
|
-
top: "0",
|
|
1965
|
-
right: "-5px",
|
|
1966
|
-
bottom: "0",
|
|
1967
|
-
left: "calc(100% - 5px)",
|
|
1968
|
-
cursor: "col-resize",
|
|
1969
|
-
resizingProps: {
|
|
1970
|
-
shouldSizeX: true,
|
|
1971
|
-
shouldSizeY: false,
|
|
1972
|
-
shouldMoveX: false,
|
|
1973
|
-
shouldMoveY: false
|
|
1974
|
-
}
|
|
1975
|
-
},
|
|
1976
|
-
{
|
|
1977
|
-
top: "calc(100% - 5px)",
|
|
1978
|
-
right: "0",
|
|
1979
|
-
bottom: "-5px",
|
|
1980
|
-
left: "0",
|
|
1981
|
-
cursor: "row-resize",
|
|
1982
|
-
resizingProps: {
|
|
1983
|
-
shouldSizeX: false,
|
|
1984
|
-
shouldSizeY: true,
|
|
1985
|
-
shouldMoveX: false,
|
|
1986
|
-
shouldMoveY: false
|
|
1987
|
-
}
|
|
1988
|
-
},
|
|
1989
|
-
{
|
|
1990
|
-
top: "0",
|
|
1991
|
-
right: "calc(100% - 5px)",
|
|
1992
|
-
bottom: "0",
|
|
1993
|
-
left: "-5px",
|
|
1994
|
-
cursor: "col-resize",
|
|
1995
|
-
resizingProps: {
|
|
1996
|
-
shouldSizeX: true,
|
|
1997
|
-
shouldSizeY: false,
|
|
1998
|
-
shouldMoveX: true,
|
|
1999
|
-
shouldMoveY: false
|
|
2000
|
-
}
|
|
2676
|
+
icon: "functions",
|
|
2677
|
+
dropdown: EditorMathsModal_default,
|
|
2678
|
+
action: (maths) => maths,
|
|
2679
|
+
title: "Maths"
|
|
2001
2680
|
},
|
|
2002
|
-
// corners
|
|
2003
2681
|
{
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
left: "calc(100% - 10px)",
|
|
2008
|
-
cursor: "ne-resize",
|
|
2009
|
-
resizingProps: {
|
|
2010
|
-
shouldSizeX: true,
|
|
2011
|
-
shouldSizeY: true,
|
|
2012
|
-
shouldMoveX: false,
|
|
2013
|
-
shouldMoveY: true
|
|
2014
|
-
}
|
|
2682
|
+
icon: "view_compact",
|
|
2683
|
+
action: (selectedText = "") => `<genially id="${selectedText}" />`,
|
|
2684
|
+
title: "Genially"
|
|
2015
2685
|
},
|
|
2016
2686
|
{
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
left: "calc(100% - 10px)",
|
|
2021
|
-
cursor: "se-resize",
|
|
2022
|
-
resizingProps: {
|
|
2023
|
-
shouldSizeX: true,
|
|
2024
|
-
shouldSizeY: true,
|
|
2025
|
-
shouldMoveX: false,
|
|
2026
|
-
shouldMoveY: false
|
|
2027
|
-
}
|
|
2687
|
+
icon: "superscript",
|
|
2688
|
+
action: (selectedText = "") => `<sup>${selectedText}</sup>`,
|
|
2689
|
+
title: "Superscript"
|
|
2028
2690
|
},
|
|
2029
2691
|
{
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
left: "-10px",
|
|
2034
|
-
cursor: "sw-resize",
|
|
2035
|
-
resizingProps: {
|
|
2036
|
-
shouldSizeX: true,
|
|
2037
|
-
shouldSizeY: true,
|
|
2038
|
-
shouldMoveX: true,
|
|
2039
|
-
shouldMoveY: false
|
|
2040
|
-
}
|
|
2692
|
+
icon: "subscript",
|
|
2693
|
+
action: (selectedText = "") => `<sub>${selectedText}</sub>`,
|
|
2694
|
+
title: "Subscript"
|
|
2041
2695
|
},
|
|
2042
2696
|
{
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
shouldMoveX: true,
|
|
2052
|
-
shouldMoveY: true
|
|
2053
|
-
}
|
|
2697
|
+
icon: "mic",
|
|
2698
|
+
action: () => "<recorder />",
|
|
2699
|
+
title: "Recorder"
|
|
2700
|
+
},
|
|
2701
|
+
{
|
|
2702
|
+
icon: "format_indent_increase",
|
|
2703
|
+
action: (selectedText = "") => xmlFormat(selectedText),
|
|
2704
|
+
title: "Prettify"
|
|
2054
2705
|
}
|
|
2055
2706
|
];
|
|
2056
|
-
|
|
2057
|
-
const
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2060
|
-
const [size, setSize] = useState7({
|
|
2061
|
-
height: defaultHeight,
|
|
2062
|
-
width: defaultWidth
|
|
2063
|
-
});
|
|
2064
|
-
const [resizingData, setResizingData] = useState7({
|
|
2065
|
-
isActive: false,
|
|
2066
|
-
shouldSizeX: false,
|
|
2067
|
-
shouldSizeY: false,
|
|
2068
|
-
shouldMoveX: false,
|
|
2069
|
-
shouldMoveY: false
|
|
2070
|
-
});
|
|
2071
|
-
const positionX = _15.getOr(0, "x", defaultPositions);
|
|
2072
|
-
const bodyWidth = _15.getOr(0, "body.offsetWidth", document);
|
|
2073
|
-
const x = positionX + defaultWidth > bodyWidth ? positionX - defaultWidth : positionX;
|
|
2074
|
-
const [translateData, setTranslateData] = useState7({
|
|
2075
|
-
isActive: false,
|
|
2076
|
-
x,
|
|
2077
|
-
y: _15.getOr(0, "y", defaultPositions)
|
|
2078
|
-
});
|
|
2079
|
-
useEffect4(() => {
|
|
2080
|
-
if (translateData.isActive) {
|
|
2081
|
-
const onMouseUp = () => setTranslateData(_15.set("isActive", false));
|
|
2082
|
-
const onMouseMove = (e) => setTranslateData(({ x: x2, y, ...translateData2 }) => ({
|
|
2083
|
-
...translateData2,
|
|
2084
|
-
x: x2 + e.movementX,
|
|
2085
|
-
y: y + e.movementY
|
|
2086
|
-
}));
|
|
2087
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
2088
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
2089
|
-
return () => {
|
|
2090
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
2091
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
2092
|
-
};
|
|
2093
|
-
}
|
|
2094
|
-
}, [translateData]);
|
|
2095
|
-
useEffect4(() => {
|
|
2096
|
-
if (resizingData.isActive) {
|
|
2097
|
-
if (rndRef.current && !(size.height !== 0 && size.width !== 0)) {
|
|
2098
|
-
const { height, width } = rndRef.current.getBoundingClientRect();
|
|
2099
|
-
setSize({
|
|
2100
|
-
height,
|
|
2101
|
-
width
|
|
2102
|
-
});
|
|
2103
|
-
}
|
|
2104
|
-
const { shouldSizeX, shouldSizeY, shouldMoveX, shouldMoveY } = resizingData;
|
|
2105
|
-
const onMouseUp = () => {
|
|
2106
|
-
setResizingData(_15.set("isActive", false));
|
|
2107
|
-
};
|
|
2108
|
-
const getNewSizeValue = ({
|
|
2109
|
-
shouldMove,
|
|
2110
|
-
shouldSize,
|
|
2111
|
-
value,
|
|
2112
|
-
modifier
|
|
2113
|
-
}) => {
|
|
2114
|
-
switch (true) {
|
|
2115
|
-
case (shouldSize && !shouldMove):
|
|
2116
|
-
return value + modifier;
|
|
2117
|
-
case (shouldSize && shouldMove):
|
|
2118
|
-
return value - modifier;
|
|
2119
|
-
default:
|
|
2120
|
-
return value;
|
|
2121
|
-
}
|
|
2122
|
-
};
|
|
2123
|
-
const onMouseMove = (e) => {
|
|
2124
|
-
setTranslateData(({ x: x2, y, ...translateData2 }) => {
|
|
2125
|
-
const newX = shouldMoveX ? x2 + e.movementX : x2;
|
|
2126
|
-
const newY = shouldMoveY ? y + e.movementY : y;
|
|
2127
|
-
return {
|
|
2128
|
-
...translateData2,
|
|
2129
|
-
x: newX,
|
|
2130
|
-
y: newY
|
|
2131
|
-
};
|
|
2132
|
-
});
|
|
2133
|
-
setSize(({ height, width }) => {
|
|
2134
|
-
const newSize = {
|
|
2135
|
-
height: getNewSizeValue({
|
|
2136
|
-
shouldMove: shouldMoveY,
|
|
2137
|
-
shouldSize: shouldSizeY,
|
|
2138
|
-
value: height,
|
|
2139
|
-
modifier: e.movementY
|
|
2140
|
-
}),
|
|
2141
|
-
width: getNewSizeValue({
|
|
2142
|
-
shouldMove: shouldMoveX,
|
|
2143
|
-
shouldSize: shouldSizeX,
|
|
2144
|
-
value: width,
|
|
2145
|
-
modifier: e.movementX
|
|
2146
|
-
})
|
|
2147
|
-
};
|
|
2148
|
-
onResize?.(newSize);
|
|
2149
|
-
return newSize;
|
|
2150
|
-
});
|
|
2151
|
-
};
|
|
2152
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
2153
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
2154
|
-
return () => {
|
|
2155
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
2156
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
2157
|
-
};
|
|
2158
|
-
}
|
|
2159
|
-
}, [size, resizingData, onResize]);
|
|
2160
|
-
const launchTranslate = () => setTranslateData(_15.set("isActive", true));
|
|
2161
|
-
const handlersElement = canResize ? /* @__PURE__ */ jsx19("div", { children: resizeHandlersProps.map((handle, key) => {
|
|
2162
|
-
return /* @__PURE__ */ jsx19(
|
|
2163
|
-
"div",
|
|
2164
|
-
{
|
|
2165
|
-
className: home_ec2_user_github_work_monorepo_monorepo_libs_viewer_src_hooks_useDragAndResize_default.handle,
|
|
2166
|
-
style: {
|
|
2167
|
-
"--v-top": handle.top,
|
|
2168
|
-
"--v-right": handle.right,
|
|
2169
|
-
"--v-bottom": handle.bottom,
|
|
2170
|
-
"--v-left": handle.left,
|
|
2171
|
-
"--v-cursor": handle.cursor
|
|
2172
|
-
},
|
|
2173
|
-
..._15.omit("resizingProps", handle),
|
|
2174
|
-
onMouseDown: () => setResizingData({
|
|
2175
|
-
isActive: true,
|
|
2176
|
-
..._15.get("resizingProps", handle)
|
|
2177
|
-
})
|
|
2178
|
-
},
|
|
2179
|
-
key
|
|
2180
|
-
);
|
|
2181
|
-
}) }) : /* @__PURE__ */ jsx19(Fragment, {});
|
|
2182
|
-
const isActive = translateData.isActive || resizingData.isActive;
|
|
2183
|
-
useEffect4(() => {
|
|
2184
|
-
if (!rndRef.current)
|
|
2185
|
-
return;
|
|
2186
|
-
rndRef.current.style.userSelect = isActive ? "none" : "unset";
|
|
2187
|
-
rndRef.current.style.position = "fixed";
|
|
2188
|
-
rndRef.current.style.top = "0";
|
|
2189
|
-
rndRef.current.style.left = "0";
|
|
2190
|
-
rndRef.current.style.transform = `translate3d(${translateData.x}px, ${translateData.y}px, 0)`;
|
|
2191
|
-
rndRef.current.style.height = size.height ? `${size.height}px` : "auto";
|
|
2192
|
-
rndRef.current.style.width = size.width ? `${size.width}px` : "auto";
|
|
2193
|
-
}, [translateData, size, isActive]);
|
|
2194
|
-
return {
|
|
2195
|
-
launchTranslate,
|
|
2196
|
-
handlersElement,
|
|
2197
|
-
rndRef
|
|
2707
|
+
Dropdown = ({ icon, title, dropdown: Overlay, action }) => {
|
|
2708
|
+
const [visible, setVisible] = useState8(false);
|
|
2709
|
+
const toggleVisible = () => {
|
|
2710
|
+
setVisible((isVisible) => !isVisible);
|
|
2198
2711
|
};
|
|
2712
|
+
const onClickOverlay = useCallback6(
|
|
2713
|
+
(params) => {
|
|
2714
|
+
action(params);
|
|
2715
|
+
setVisible(false);
|
|
2716
|
+
},
|
|
2717
|
+
[action]
|
|
2718
|
+
);
|
|
2719
|
+
const listItems = [
|
|
2720
|
+
{
|
|
2721
|
+
type: "component",
|
|
2722
|
+
content: /* @__PURE__ */ jsx22(Overlay, { onClick: onClickOverlay })
|
|
2723
|
+
}
|
|
2724
|
+
];
|
|
2725
|
+
return /* @__PURE__ */ jsxs15("span", { className: src_components_core_editor_EditorToolbar_default.span, onClick: toggleVisible, children: [
|
|
2726
|
+
/* @__PURE__ */ jsx22(Tooltip2, { content: title, children: /* @__PURE__ */ jsx22(Button3, { theme: "gray", icon, children: " " }) }),
|
|
2727
|
+
visible && /* @__PURE__ */ jsx22(ButtonsList, { listItems, className: src_components_core_editor_EditorToolbar_default.absoluteMenuButton, zIndex: 1, withMask: false })
|
|
2728
|
+
] });
|
|
2199
2729
|
};
|
|
2200
|
-
|
|
2730
|
+
EditorToolbar = forwardRef(({ replace }, menuRef) => /* @__PURE__ */ jsx22("div", { className: src_components_core_editor_EditorToolbar_default.editorToolbar, ref: menuRef, children: EDITOR_BUTTONS.map((button, i) => {
|
|
2731
|
+
const { icon, action, title, dropdown } = button;
|
|
2732
|
+
return dropdown ? /* @__PURE__ */ createElement(Dropdown, { ...button, action: (callback) => replace(callback), key: i }) : /* @__PURE__ */ jsx22(Tooltip2, { content: title, children: /* @__PURE__ */ jsx22(Button3, { theme: "gray", onClick: () => replace(action, title), icon, children: " " }, i) });
|
|
2733
|
+
}) }));
|
|
2734
|
+
EditorToolbar.displayName = "EditorToolbar";
|
|
2735
|
+
EditorToolbar_default = EditorToolbar;
|
|
2201
2736
|
}
|
|
2202
2737
|
});
|
|
2203
2738
|
|
|
2204
|
-
// css-modules:css-modules://
|
|
2205
|
-
var
|
|
2206
|
-
"css-modules:css-modules://
|
|
2739
|
+
// css-modules:css-modules://9NNguA--8WOGh41wmBCm8AF1DJWa35r2rfRhLOxgn68.css
|
|
2740
|
+
var init_NNguA_8WOGh41wmBCm8AF1DJWa35r2rfRhLOxgn68 = __esm({
|
|
2741
|
+
"css-modules:css-modules://9NNguA--8WOGh41wmBCm8AF1DJWa35r2rfRhLOxgn68.css"() {
|
|
2207
2742
|
}
|
|
2208
2743
|
});
|
|
2209
2744
|
|
|
@@ -2212,8 +2747,8 @@ var src_components_core_editor_Editor_default;
|
|
|
2212
2747
|
var init_src_components_core_editor_Editor = __esm({
|
|
2213
2748
|
"tmp_esbuild/_src_components_core_editor_Editor.module.css"() {
|
|
2214
2749
|
"use strict";
|
|
2215
|
-
|
|
2216
|
-
src_components_core_editor_Editor_default = { "wrapper": "vv-cGAezq-wrapper", "
|
|
2750
|
+
init_NNguA_8WOGh41wmBCm8AF1DJWa35r2rfRhLOxgn68();
|
|
2751
|
+
src_components_core_editor_Editor_default = { "wrapper": "vv-cGAezq-wrapper", "errorBanner": "vv-cGAezq-errorBanner", "rnd": "vv-cGAezq-rnd", "header": "vv-cGAezq-header" };
|
|
2217
2752
|
}
|
|
2218
2753
|
});
|
|
2219
2754
|
|
|
@@ -2226,26 +2761,26 @@ var init_Editor = __esm({
|
|
|
2226
2761
|
});
|
|
2227
2762
|
|
|
2228
2763
|
// src/components/core/editor/Editor.tsx
|
|
2229
|
-
import { useCallback as
|
|
2230
|
-
import
|
|
2764
|
+
import { useCallback as useCallback7, useMemo as useMemo2, useRef as useRef6 } from "react";
|
|
2765
|
+
import _17 from "lodash/fp.js";
|
|
2231
2766
|
import { Button as Button4 } from "@lls/lls-kit";
|
|
2232
|
-
import { jsx as
|
|
2767
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2233
2768
|
var DEFAULT_WIDTH, DEFAULT_HEIGHT, Editor, Editor_default;
|
|
2234
2769
|
var init_Editor2 = __esm({
|
|
2235
2770
|
"src/components/core/editor/Editor.tsx"() {
|
|
2236
2771
|
"use strict";
|
|
2772
|
+
init_useDragAndResize2();
|
|
2237
2773
|
init_CodemirrorEditor();
|
|
2238
2774
|
init_EditorToolbar2();
|
|
2239
|
-
init_useDragAndResize2();
|
|
2240
2775
|
init_Editor();
|
|
2241
2776
|
DEFAULT_WIDTH = 800;
|
|
2242
2777
|
DEFAULT_HEIGHT = 500;
|
|
2243
2778
|
Editor = ({ error, onError, onClose, doc, onDocChange, positions }) => {
|
|
2244
|
-
const editor =
|
|
2245
|
-
const setEditor =
|
|
2779
|
+
const editor = useRef6(null);
|
|
2780
|
+
const setEditor = useCallback7((codeMirrorEditor) => {
|
|
2246
2781
|
editor.current = codeMirrorEditor;
|
|
2247
2782
|
}, []);
|
|
2248
|
-
const replace =
|
|
2783
|
+
const replace = useCallback7((callback, title) => {
|
|
2249
2784
|
if (!editor.current)
|
|
2250
2785
|
return;
|
|
2251
2786
|
const selection = editor.current.getSelection();
|
|
@@ -2259,7 +2794,7 @@ var init_Editor2 = __esm({
|
|
|
2259
2794
|
editor.current.focus();
|
|
2260
2795
|
}, []);
|
|
2261
2796
|
const onChange = useMemo2(() => {
|
|
2262
|
-
return
|
|
2797
|
+
return _17.debounce(500, (contentMd) => onDocChange(_17.set("contentMd", contentMd, doc)));
|
|
2263
2798
|
}, [doc, onDocChange]);
|
|
2264
2799
|
const keyMap = useMemo2(() => {
|
|
2265
2800
|
return {
|
|
@@ -2277,11 +2812,11 @@ var init_Editor2 = __esm({
|
|
|
2277
2812
|
height: DEFAULT_HEIGHT
|
|
2278
2813
|
}
|
|
2279
2814
|
});
|
|
2280
|
-
return /* @__PURE__ */
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
error && /* @__PURE__ */
|
|
2815
|
+
return /* @__PURE__ */ jsxs16("div", { className: src_components_core_editor_Editor_default.rnd, ref: rndRef, children: [
|
|
2816
|
+
/* @__PURE__ */ jsx23("div", { className: src_components_core_editor_Editor_default.header, onMouseDown: launchTranslate, children: /* @__PURE__ */ jsx23(Button4, { onClick: onClose, theme: "gray", children: "cancel" }) }),
|
|
2817
|
+
/* @__PURE__ */ jsx23(EditorToolbar_default, { replace }),
|
|
2818
|
+
/* @__PURE__ */ jsx23("div", { className: src_components_core_editor_Editor_default.wrapper, children: /* @__PURE__ */ jsx23(CodemirrorEditor_default, { componentDidMount: setEditor, value: _17.get("contentMd", doc), onChange, keyMap, onError }) }),
|
|
2819
|
+
error && /* @__PURE__ */ jsx23("div", { className: src_components_core_editor_Editor_default.errorBanner, children: error }),
|
|
2285
2820
|
handlersElement
|
|
2286
2821
|
] });
|
|
2287
2822
|
};
|
|
@@ -2290,19 +2825,19 @@ var init_Editor2 = __esm({
|
|
|
2290
2825
|
});
|
|
2291
2826
|
|
|
2292
2827
|
// src/components/core/editor/EditorSsr.tsx
|
|
2293
|
-
import { jsx as
|
|
2828
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2294
2829
|
var EditorSsr, EditorSsr_default;
|
|
2295
2830
|
var init_EditorSsr = __esm({
|
|
2296
2831
|
"src/components/core/editor/EditorSsr.tsx"() {
|
|
2297
2832
|
"use strict";
|
|
2298
|
-
EditorSsr = () => /* @__PURE__ */
|
|
2833
|
+
EditorSsr = () => /* @__PURE__ */ jsx24("div", {});
|
|
2299
2834
|
EditorSsr_default = EditorSsr;
|
|
2300
2835
|
}
|
|
2301
2836
|
});
|
|
2302
2837
|
|
|
2303
|
-
// css-modules:css-modules://
|
|
2304
|
-
var
|
|
2305
|
-
"css-modules:css-modules://
|
|
2838
|
+
// css-modules:css-modules://1MKBW8PG8GbZe8tC6V4ud90v1VdZx3mRrwXlGya-pMc.css
|
|
2839
|
+
var init_MKBW8PG8GbZe8tC6V4ud90v1VdZx3mRrwXlGya_pMc = __esm({
|
|
2840
|
+
"css-modules:css-modules://1MKBW8PG8GbZe8tC6V4ud90v1VdZx3mRrwXlGya-pMc.css"() {
|
|
2306
2841
|
}
|
|
2307
2842
|
});
|
|
2308
2843
|
|
|
@@ -2311,7 +2846,7 @@ var src_hooks_useDragAndResize_default;
|
|
|
2311
2846
|
var init_src_hooks_useDragAndResize = __esm({
|
|
2312
2847
|
"tmp_esbuild/_src_hooks_useDragAndResize.module.css"() {
|
|
2313
2848
|
"use strict";
|
|
2314
|
-
|
|
2849
|
+
init_MKBW8PG8GbZe8tC6V4ud90v1VdZx3mRrwXlGya_pMc();
|
|
2315
2850
|
src_hooks_useDragAndResize_default = { "handle": "vv-Uv6i-a-handle" };
|
|
2316
2851
|
}
|
|
2317
2852
|
});
|
|
@@ -2325,9 +2860,9 @@ var init_useDragAndResize3 = __esm({
|
|
|
2325
2860
|
});
|
|
2326
2861
|
|
|
2327
2862
|
// src/hooks/useDragAndResize.tsx
|
|
2328
|
-
import { useEffect as
|
|
2329
|
-
import
|
|
2330
|
-
import { Fragment as Fragment2, jsx as
|
|
2863
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
|
|
2864
|
+
import _18 from "lodash/fp.js";
|
|
2865
|
+
import { Fragment as Fragment2, jsx as jsx25 } from "react/jsx-runtime";
|
|
2331
2866
|
var resizeHandlersProps2, useDragAndResize2, useDragAndResize_default2;
|
|
2332
2867
|
var init_useDragAndResize4 = __esm({
|
|
2333
2868
|
"src/hooks/useDragAndResize.tsx"() {
|
|
@@ -2441,31 +2976,31 @@ var init_useDragAndResize4 = __esm({
|
|
|
2441
2976
|
}
|
|
2442
2977
|
];
|
|
2443
2978
|
useDragAndResize2 = ({ defaultPositions, defaultSize = {}, onResize, canResize = true }) => {
|
|
2444
|
-
const rndRef =
|
|
2979
|
+
const rndRef = useRef7(null);
|
|
2445
2980
|
const defaultWidth = defaultSize.width || 0;
|
|
2446
2981
|
const defaultHeight = defaultSize.height || 0;
|
|
2447
|
-
const [size, setSize] =
|
|
2982
|
+
const [size, setSize] = useState9({
|
|
2448
2983
|
height: defaultHeight,
|
|
2449
2984
|
width: defaultWidth
|
|
2450
2985
|
});
|
|
2451
|
-
const [resizingData, setResizingData] =
|
|
2986
|
+
const [resizingData, setResizingData] = useState9({
|
|
2452
2987
|
isActive: false,
|
|
2453
2988
|
shouldSizeX: false,
|
|
2454
2989
|
shouldSizeY: false,
|
|
2455
2990
|
shouldMoveX: false,
|
|
2456
2991
|
shouldMoveY: false
|
|
2457
2992
|
});
|
|
2458
|
-
const positionX =
|
|
2459
|
-
const bodyWidth =
|
|
2993
|
+
const positionX = _18.getOr(0, "x", defaultPositions);
|
|
2994
|
+
const bodyWidth = _18.getOr(0, "body.offsetWidth", document);
|
|
2460
2995
|
const x = positionX + defaultWidth > bodyWidth ? positionX - defaultWidth : positionX;
|
|
2461
|
-
const [translateData, setTranslateData] =
|
|
2996
|
+
const [translateData, setTranslateData] = useState9({
|
|
2462
2997
|
isActive: false,
|
|
2463
2998
|
x,
|
|
2464
|
-
y:
|
|
2999
|
+
y: _18.getOr(0, "y", defaultPositions)
|
|
2465
3000
|
});
|
|
2466
|
-
|
|
3001
|
+
useEffect7(() => {
|
|
2467
3002
|
if (translateData.isActive) {
|
|
2468
|
-
const onMouseUp = () => setTranslateData(
|
|
3003
|
+
const onMouseUp = () => setTranslateData(_18.set("isActive", false));
|
|
2469
3004
|
const onMouseMove = (e) => setTranslateData(({ x: x2, y, ...translateData2 }) => ({
|
|
2470
3005
|
...translateData2,
|
|
2471
3006
|
x: x2 + e.movementX,
|
|
@@ -2479,7 +3014,7 @@ var init_useDragAndResize4 = __esm({
|
|
|
2479
3014
|
};
|
|
2480
3015
|
}
|
|
2481
3016
|
}, [translateData]);
|
|
2482
|
-
|
|
3017
|
+
useEffect7(() => {
|
|
2483
3018
|
if (resizingData.isActive) {
|
|
2484
3019
|
if (rndRef.current && !(size.height !== 0 && size.width !== 0)) {
|
|
2485
3020
|
const { height, width } = rndRef.current.getBoundingClientRect();
|
|
@@ -2490,7 +3025,7 @@ var init_useDragAndResize4 = __esm({
|
|
|
2490
3025
|
}
|
|
2491
3026
|
const { shouldSizeX, shouldSizeY, shouldMoveX, shouldMoveY } = resizingData;
|
|
2492
3027
|
const onMouseUp = () => {
|
|
2493
|
-
setResizingData(
|
|
3028
|
+
setResizingData(_18.set("isActive", false));
|
|
2494
3029
|
};
|
|
2495
3030
|
const getNewSizeValue = ({
|
|
2496
3031
|
shouldMove,
|
|
@@ -2544,9 +3079,9 @@ var init_useDragAndResize4 = __esm({
|
|
|
2544
3079
|
};
|
|
2545
3080
|
}
|
|
2546
3081
|
}, [size, resizingData, onResize]);
|
|
2547
|
-
const launchTranslate = () => setTranslateData(
|
|
2548
|
-
const handlersElement = canResize ? /* @__PURE__ */
|
|
2549
|
-
return /* @__PURE__ */
|
|
3082
|
+
const launchTranslate = () => setTranslateData(_18.set("isActive", true));
|
|
3083
|
+
const handlersElement = canResize ? /* @__PURE__ */ jsx25("div", { children: resizeHandlersProps2.map((handle, key) => {
|
|
3084
|
+
return /* @__PURE__ */ jsx25(
|
|
2550
3085
|
"div",
|
|
2551
3086
|
{
|
|
2552
3087
|
className: src_hooks_useDragAndResize_default.handle,
|
|
@@ -2557,17 +3092,17 @@ var init_useDragAndResize4 = __esm({
|
|
|
2557
3092
|
"--v-left": handle.left,
|
|
2558
3093
|
"--v-cursor": handle.cursor
|
|
2559
3094
|
},
|
|
2560
|
-
...
|
|
3095
|
+
..._18.omit("resizingProps", handle),
|
|
2561
3096
|
onMouseDown: () => setResizingData({
|
|
2562
3097
|
isActive: true,
|
|
2563
|
-
...
|
|
3098
|
+
..._18.get("resizingProps", handle)
|
|
2564
3099
|
})
|
|
2565
3100
|
},
|
|
2566
3101
|
key
|
|
2567
3102
|
);
|
|
2568
|
-
}) }) : /* @__PURE__ */
|
|
3103
|
+
}) }) : /* @__PURE__ */ jsx25(Fragment2, {});
|
|
2569
3104
|
const isActive = translateData.isActive || resizingData.isActive;
|
|
2570
|
-
|
|
3105
|
+
useEffect7(() => {
|
|
2571
3106
|
if (!rndRef.current)
|
|
2572
3107
|
return;
|
|
2573
3108
|
rndRef.current.style.userSelect = isActive ? "none" : "unset";
|
|
@@ -2588,9 +3123,9 @@ var init_useDragAndResize4 = __esm({
|
|
|
2588
3123
|
}
|
|
2589
3124
|
});
|
|
2590
3125
|
|
|
2591
|
-
// css-modules:css-modules://
|
|
2592
|
-
var
|
|
2593
|
-
"css-modules:css-modules://
|
|
3126
|
+
// css-modules:css-modules://Zb1cEYNT4eNwW8io0xWL7zXkOH8P26-7eImYlmla2wA.css
|
|
3127
|
+
var init_Zb1cEYNT4eNwW8io0xWL7zXkOH8P26_7eImYlmla2wA = __esm({
|
|
3128
|
+
"css-modules:css-modules://Zb1cEYNT4eNwW8io0xWL7zXkOH8P26-7eImYlmla2wA.css"() {
|
|
2594
3129
|
}
|
|
2595
3130
|
});
|
|
2596
3131
|
|
|
@@ -2599,8 +3134,8 @@ var src_components_core_editor_MetadataEditor_default;
|
|
|
2599
3134
|
var init_src_components_core_editor_MetadataEditor = __esm({
|
|
2600
3135
|
"tmp_esbuild/_src_components_core_editor_MetadataEditor.module.css"() {
|
|
2601
3136
|
"use strict";
|
|
2602
|
-
|
|
2603
|
-
src_components_core_editor_MetadataEditor_default = { "
|
|
3137
|
+
init_Zb1cEYNT4eNwW8io0xWL7zXkOH8P26_7eImYlmla2wA();
|
|
3138
|
+
src_components_core_editor_MetadataEditor_default = { "field": "vv-ftXTRa-field", "select": "vv-ftXTRa-select", "rnd": "vv-ftXTRa-rnd", "body": "vv-ftXTRa-body", "uuid": "vv-ftXTRa-uuid", "header": "vv-ftXTRa-header", "fieldWrapper": "vv-ftXTRa-fieldWrapper" };
|
|
2604
3139
|
}
|
|
2605
3140
|
});
|
|
2606
3141
|
|
|
@@ -2613,10 +3148,10 @@ var init_MetadataEditor = __esm({
|
|
|
2613
3148
|
});
|
|
2614
3149
|
|
|
2615
3150
|
// src/components/core/editor/MetadataEditor.tsx
|
|
2616
|
-
import
|
|
2617
|
-
import Select from "react-select";
|
|
3151
|
+
import _19 from "lodash/fp.js";
|
|
2618
3152
|
import { Button as Button5 } from "@lls/lls-kit";
|
|
2619
|
-
import
|
|
3153
|
+
import Select from "react-select";
|
|
3154
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2620
3155
|
var MetadataEditor, MetadataEditor_default;
|
|
2621
3156
|
var init_MetadataEditor2 = __esm({
|
|
2622
3157
|
"src/components/core/editor/MetadataEditor.tsx"() {
|
|
@@ -2624,79 +3159,79 @@ var init_MetadataEditor2 = __esm({
|
|
|
2624
3159
|
init_useDragAndResize4();
|
|
2625
3160
|
init_MetadataEditor();
|
|
2626
3161
|
MetadataEditor = ({ doc, onDocChange, onClose, positions, notions }) => {
|
|
2627
|
-
const metadata =
|
|
2628
|
-
const setValue = (subName, e) => onDocChange(
|
|
2629
|
-
const setMultipleValue = (subName, values) => onDocChange(
|
|
3162
|
+
const metadata = _19.get("metadata", doc);
|
|
3163
|
+
const setValue = (subName, e) => onDocChange(_19.set(["metadata", subName], _19.get("target.value", e), doc));
|
|
3164
|
+
const setMultipleValue = (subName, values) => onDocChange(_19.set(["metadata", subName], _19.map("value", values), doc));
|
|
2630
3165
|
const { handlersElement, launchTranslate, rndRef } = useDragAndResize_default2({
|
|
2631
3166
|
defaultPositions: positions
|
|
2632
3167
|
});
|
|
2633
|
-
return /* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
3168
|
+
return /* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.rnd, ref: rndRef, children: [
|
|
3169
|
+
/* @__PURE__ */ jsx26("div", { className: src_components_core_editor_MetadataEditor_default.header, onMouseDown: launchTranslate, children: /* @__PURE__ */ jsx26(Button5, { onClick: onClose, theme: "gray", children: "cancel" }) }),
|
|
3170
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.body, children: [
|
|
3171
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2637
3172
|
"Uuid:",
|
|
2638
3173
|
" ",
|
|
2639
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ jsx26("span", { className: src_components_core_editor_MetadataEditor_default.uuid, style: { "--data-font": "monospace" }, children: doc.uuid })
|
|
2640
3175
|
] }),
|
|
2641
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2642
3177
|
"Title",
|
|
2643
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ jsx26(
|
|
2644
3179
|
"input",
|
|
2645
3180
|
{
|
|
2646
3181
|
className: src_components_core_editor_MetadataEditor_default.field,
|
|
2647
|
-
value:
|
|
3182
|
+
value: _19.getOr("", "title", metadata),
|
|
2648
3183
|
onChange: (e) => setValue("title", e),
|
|
2649
3184
|
onBlur: (e) => setValue("title", e)
|
|
2650
3185
|
}
|
|
2651
3186
|
)
|
|
2652
3187
|
] }),
|
|
2653
|
-
/* @__PURE__ */
|
|
3188
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2654
3189
|
"Description",
|
|
2655
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx26(
|
|
2656
3191
|
"input",
|
|
2657
3192
|
{
|
|
2658
3193
|
className: src_components_core_editor_MetadataEditor_default.field,
|
|
2659
|
-
value:
|
|
3194
|
+
value: _19.getOr("", "description", metadata),
|
|
2660
3195
|
onChange: (e) => setValue("description", e),
|
|
2661
3196
|
onBlur: (e) => setValue("description", e)
|
|
2662
3197
|
}
|
|
2663
3198
|
)
|
|
2664
3199
|
] }),
|
|
2665
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2666
3201
|
"Image",
|
|
2667
|
-
/* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ jsx26(
|
|
2668
3203
|
"input",
|
|
2669
3204
|
{
|
|
2670
3205
|
className: src_components_core_editor_MetadataEditor_default.field,
|
|
2671
|
-
value:
|
|
3206
|
+
value: _19.getOr("", "image", metadata),
|
|
2672
3207
|
onChange: (e) => setValue("image", e),
|
|
2673
3208
|
onBlur: (e) => setValue("image", e)
|
|
2674
3209
|
}
|
|
2675
3210
|
)
|
|
2676
3211
|
] }),
|
|
2677
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2678
3213
|
"Keywords",
|
|
2679
|
-
/* @__PURE__ */
|
|
3214
|
+
/* @__PURE__ */ jsx26(
|
|
2680
3215
|
"input",
|
|
2681
3216
|
{
|
|
2682
3217
|
className: src_components_core_editor_MetadataEditor_default.field,
|
|
2683
|
-
value:
|
|
3218
|
+
value: _19.getOr("", "keywords", metadata),
|
|
2684
3219
|
onChange: (e) => setValue("keywords", e),
|
|
2685
3220
|
onBlur: (e) => setValue("keywords", e)
|
|
2686
3221
|
}
|
|
2687
3222
|
)
|
|
2688
3223
|
] }),
|
|
2689
|
-
!
|
|
3224
|
+
!_19.isEmpty(notions) && /* @__PURE__ */ jsxs17("div", { className: src_components_core_editor_MetadataEditor_default.fieldWrapper, children: [
|
|
2690
3225
|
"Notion",
|
|
2691
|
-
/* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ jsx26(
|
|
2692
3227
|
Select,
|
|
2693
3228
|
{
|
|
2694
3229
|
className: src_components_core_editor_MetadataEditor_default.select,
|
|
2695
|
-
value:
|
|
2696
|
-
|
|
2697
|
-
|
|
3230
|
+
value: _19.flow(
|
|
3231
|
+
_19.get("notions"),
|
|
3232
|
+
_19.map((notion) => ({ label: notion, value: notion }))
|
|
2698
3233
|
)(metadata),
|
|
2699
|
-
options:
|
|
3234
|
+
options: _19.map((notion) => ({ label: notion, value: notion }), notions),
|
|
2700
3235
|
isMulti: true,
|
|
2701
3236
|
onChange: (values) => setMultipleValue("notions", values)
|
|
2702
3237
|
}
|
|
@@ -2711,8 +3246,8 @@ var init_MetadataEditor2 = __esm({
|
|
|
2711
3246
|
});
|
|
2712
3247
|
|
|
2713
3248
|
// src/hooks/useEditor.tsx
|
|
2714
|
-
import
|
|
2715
|
-
import { useCallback as
|
|
3249
|
+
import _20 from "lodash/fp.js";
|
|
3250
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useState as useState10 } from "react";
|
|
2716
3251
|
var EDITOR_MARGIN, useEditor, useEditor_default;
|
|
2717
3252
|
var init_useEditor = __esm({
|
|
2718
3253
|
"src/hooks/useEditor.tsx"() {
|
|
@@ -2721,13 +3256,13 @@ var init_useEditor = __esm({
|
|
|
2721
3256
|
useEditor = ({
|
|
2722
3257
|
id
|
|
2723
3258
|
}) => {
|
|
2724
|
-
const [path, setPath] =
|
|
2725
|
-
const [positions, setPositions] =
|
|
2726
|
-
|
|
2727
|
-
|
|
3259
|
+
const [path, setPath] = useState10(void 0);
|
|
3260
|
+
const [positions, setPositions] = useState10({ x: 0, y: 0 });
|
|
3261
|
+
useEffect8(() => {
|
|
3262
|
+
_20.noop(id);
|
|
2728
3263
|
setPath(void 0);
|
|
2729
3264
|
}, [id]);
|
|
2730
|
-
const open =
|
|
3265
|
+
const open = useCallback8((editPath, e) => {
|
|
2731
3266
|
const elementPositions = (e?.target instanceof Element ? e.target.getBoundingClientRect() : void 0) ?? { left: 0, top: 0 };
|
|
2732
3267
|
setPath(editPath);
|
|
2733
3268
|
setPositions({
|
|
@@ -2735,13 +3270,22 @@ var init_useEditor = __esm({
|
|
|
2735
3270
|
y: elementPositions.top + EDITOR_MARGIN
|
|
2736
3271
|
});
|
|
2737
3272
|
}, []);
|
|
2738
|
-
const close =
|
|
3273
|
+
const close = useCallback8(() => setPath(void 0), []);
|
|
2739
3274
|
return { positions, path, open, close };
|
|
2740
3275
|
};
|
|
2741
3276
|
useEditor_default = useEditor;
|
|
2742
3277
|
}
|
|
2743
3278
|
});
|
|
2744
3279
|
|
|
3280
|
+
// src/constants/config.ts
|
|
3281
|
+
var IS_PROD;
|
|
3282
|
+
var init_config = __esm({
|
|
3283
|
+
"src/constants/config.ts"() {
|
|
3284
|
+
"use strict";
|
|
3285
|
+
IS_PROD = process.env.CONF_ENV === "prod";
|
|
3286
|
+
}
|
|
3287
|
+
});
|
|
3288
|
+
|
|
2745
3289
|
// src/hooks/useScroll.tsx
|
|
2746
3290
|
import { useMemo as useMemo3 } from "react";
|
|
2747
3291
|
var useScroll, useScroll_default;
|
|
@@ -2765,18 +3309,9 @@ var init_useScroll = __esm({
|
|
|
2765
3309
|
}
|
|
2766
3310
|
});
|
|
2767
3311
|
|
|
2768
|
-
//
|
|
2769
|
-
var
|
|
2770
|
-
|
|
2771
|
-
"src/constants/config.ts"() {
|
|
2772
|
-
"use strict";
|
|
2773
|
-
IS_PROD = process.env.CONF_ENV === "prod";
|
|
2774
|
-
}
|
|
2775
|
-
});
|
|
2776
|
-
|
|
2777
|
-
// css-modules:css-modules://5vBHtYTubWLIkQ7cwq88_cqGbPrRZDxVu51b9VQwno0.css
|
|
2778
|
-
var init_vBHtYTubWLIkQ7cwq88_cqGbPrRZDxVu51b9VQwno0 = __esm({
|
|
2779
|
-
"css-modules:css-modules://5vBHtYTubWLIkQ7cwq88_cqGbPrRZDxVu51b9VQwno0.css"() {
|
|
3312
|
+
// css-modules:css-modules://N7qE5xz-356BL8FwluXb9SO0Q6g8pmP18e18R9y8bEU.css
|
|
3313
|
+
var init_N7qE5xz_356BL8FwluXb9SO0Q6g8pmP18e18R9y8bEU = __esm({
|
|
3314
|
+
"css-modules:css-modules://N7qE5xz-356BL8FwluXb9SO0Q6g8pmP18e18R9y8bEU.css"() {
|
|
2780
3315
|
}
|
|
2781
3316
|
});
|
|
2782
3317
|
|
|
@@ -2785,8 +3320,8 @@ var src_components_lazy_index_editor_default;
|
|
|
2785
3320
|
var init_src_components_lazy_index_editor = __esm({
|
|
2786
3321
|
"tmp_esbuild/_src_components_lazy_index.editor.module.css"() {
|
|
2787
3322
|
"use strict";
|
|
2788
|
-
|
|
2789
|
-
src_components_lazy_index_editor_default = { "
|
|
3323
|
+
init_N7qE5xz_356BL8FwluXb9SO0Q6g8pmP18e18R9y8bEU();
|
|
3324
|
+
src_components_lazy_index_editor_default = { "submit": "vv-RUXZgW-submit", "pageContainer": "vv-RUXZgW-pageContainer", "screen": "vv-RUXZgW-screen", "alert": "vv-RUXZgW-alert", "alertOpenedAnimation": "vv-RUXZgW-alertOpenedAnimation", "exitButton": "vv-RUXZgW-exitButton", "stickyBar": "vv-RUXZgW-stickyBar", "button": "vv-RUXZgW-button" };
|
|
2790
3325
|
}
|
|
2791
3326
|
});
|
|
2792
3327
|
|
|
@@ -2803,11 +3338,11 @@ var index_editor_exports = {};
|
|
|
2803
3338
|
__export(index_editor_exports, {
|
|
2804
3339
|
default: () => index_editor_default
|
|
2805
3340
|
});
|
|
2806
|
-
import
|
|
2807
|
-
import
|
|
3341
|
+
import React7, { useCallback as useCallback9, useEffect as useEffect9, useState as useState11 } from "react";
|
|
3342
|
+
import _21 from "lodash/fp.js";
|
|
2808
3343
|
import { Button as Button6, RadioButton, Snackbar } from "@lls/lls-kit";
|
|
2809
3344
|
import { copyToClipboard } from "@lls/utils";
|
|
2810
|
-
import { Fragment as Fragment3, jsx as
|
|
3345
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2811
3346
|
var Editor2, CompactModeButton, CopyButton, EditorStickyBar, EditorNext, index_editor_default;
|
|
2812
3347
|
var init_index_editor2 = __esm({
|
|
2813
3348
|
"src/components/lazy/index.editor.tsx"() {
|
|
@@ -2821,48 +3356,48 @@ var init_index_editor2 = __esm({
|
|
|
2821
3356
|
init_MetadataEditor2();
|
|
2822
3357
|
init_ViewerMd2();
|
|
2823
3358
|
init_useEditor();
|
|
2824
|
-
init_useScroll();
|
|
2825
3359
|
init_config();
|
|
3360
|
+
init_useScroll();
|
|
2826
3361
|
init_mode();
|
|
2827
3362
|
init_index_editor();
|
|
2828
3363
|
Editor2 = isSsr() ? EditorSsr_default : Editor_default;
|
|
2829
3364
|
CompactModeButton = ({ isCompactMode = false, theme, setIsCompactMode }) => {
|
|
2830
|
-
const onClick =
|
|
3365
|
+
const onClick = useCallback9(() => {
|
|
2831
3366
|
setIsCompactMode(!isCompactMode);
|
|
2832
3367
|
}, [setIsCompactMode, isCompactMode]);
|
|
2833
|
-
return /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsx27(Button6, { theme, accent: "alt", "data-isactive": +isCompactMode, onClick, children: "cm" });
|
|
2834
3369
|
};
|
|
2835
|
-
CopyButton = ({ template, theme, setCopied =
|
|
2836
|
-
const onClick =
|
|
3370
|
+
CopyButton = ({ template, theme, setCopied = _21.noop }) => {
|
|
3371
|
+
const onClick = useCallback9(() => {
|
|
2837
3372
|
copyToClipboard(JSON.stringify(template, null, 2));
|
|
2838
3373
|
setCopied(true);
|
|
2839
3374
|
setTimeout(() => {
|
|
2840
3375
|
setCopied(false);
|
|
2841
3376
|
}, 3500);
|
|
2842
3377
|
}, [template, setCopied]);
|
|
2843
|
-
return /* @__PURE__ */
|
|
3378
|
+
return /* @__PURE__ */ jsx27(Button6, { className: src_components_lazy_index_editor_default.button, theme, accent: "alt", type: "button", onClick, children: "Copier le JSON" });
|
|
2844
3379
|
};
|
|
2845
3380
|
EditorStickyBar = ({ mode, setMode, handleSubmit, template, isCompactMode, setIsCompactMode, setCopied }) => {
|
|
2846
3381
|
const stickyBarTheme = IS_PROD ? "premium" : "primary";
|
|
2847
|
-
return /* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
/* @__PURE__ */
|
|
2852
|
-
/* @__PURE__ */
|
|
3382
|
+
return /* @__PURE__ */ jsxs18("div", { className: src_components_lazy_index_editor_default.stickyBar, children: [
|
|
3383
|
+
/* @__PURE__ */ jsx27(RadioButton, { isChecked: mode === "edit", onChange: setMode, label: "Edit", name: "Mode", value: "edit" }),
|
|
3384
|
+
/* @__PURE__ */ jsx27(RadioButton, { isChecked: mode === "view", onChange: setMode, label: "View", name: "Mode", value: "view" }),
|
|
3385
|
+
/* @__PURE__ */ jsx27(Button6, { theme: stickyBarTheme, onClick: handleSubmit, children: "Submit" }),
|
|
3386
|
+
/* @__PURE__ */ jsx27(CompactModeButton, { theme: stickyBarTheme, isCompactMode, setIsCompactMode }),
|
|
3387
|
+
/* @__PURE__ */ jsx27(CopyButton, { theme: stickyBarTheme, template, setCopied })
|
|
2853
3388
|
] });
|
|
2854
3389
|
};
|
|
2855
|
-
EditorNext =
|
|
2856
|
-
const [isCompactMode, setIsCompactMode] =
|
|
2857
|
-
const [mode, setMode] =
|
|
2858
|
-
const [copied, setCopied] =
|
|
3390
|
+
EditorNext = React7.forwardRef(({ template, onChange = _21.noop, onSubmit = _21.noop, notions, ...props }, ref) => {
|
|
3391
|
+
const [isCompactMode, setIsCompactMode] = useState11(false);
|
|
3392
|
+
const [mode, setMode] = useState11("edit");
|
|
3393
|
+
const [copied, setCopied] = useState11(false);
|
|
2859
3394
|
const id = template?.id;
|
|
2860
3395
|
const editEditor = useEditor_default({ id });
|
|
2861
3396
|
const metadataEditor = useEditor_default({ id });
|
|
2862
|
-
const [docLintErrors, setDocLintErrors] =
|
|
2863
|
-
const firstFoundErrorUuid =
|
|
2864
|
-
const [showWarningSnackbar, setShowWarningSnackbar] =
|
|
2865
|
-
|
|
3397
|
+
const [docLintErrors, setDocLintErrors] = useState11({});
|
|
3398
|
+
const firstFoundErrorUuid = _21.findKey.convert({ cap: false })(Boolean, docLintErrors);
|
|
3399
|
+
const [showWarningSnackbar, setShowWarningSnackbar] = useState11(false);
|
|
3400
|
+
useEffect9(() => {
|
|
2866
3401
|
if (showWarningSnackbar) {
|
|
2867
3402
|
const timeoutId = setTimeout(setShowWarningSnackbar, 1e4, false);
|
|
2868
3403
|
return () => {
|
|
@@ -2870,18 +3405,18 @@ var init_index_editor2 = __esm({
|
|
|
2870
3405
|
};
|
|
2871
3406
|
}
|
|
2872
3407
|
}, [showWarningSnackbar]);
|
|
2873
|
-
|
|
3408
|
+
useEffect9(() => {
|
|
2874
3409
|
setDocLintErrors(
|
|
2875
|
-
|
|
2876
|
-
|
|
3410
|
+
_21.flow(
|
|
3411
|
+
_21.get("children"),
|
|
2877
3412
|
(children) => [...children, { uuid: "root", contentMd: template?.contentMd }],
|
|
2878
|
-
|
|
2879
|
-
|
|
3413
|
+
_21.map((child) => [child.uuid, parseErrorsInContentMd(child.contentMd)]),
|
|
3414
|
+
_21.fromPairs
|
|
2880
3415
|
)(template)
|
|
2881
3416
|
);
|
|
2882
3417
|
}, [template]);
|
|
2883
3418
|
const { scrollTo } = useScroll_default({ scrollOffset: -150 });
|
|
2884
|
-
const handleSubmit =
|
|
3419
|
+
const handleSubmit = useCallback9(() => {
|
|
2885
3420
|
if (!isEditMode(mode)) {
|
|
2886
3421
|
return;
|
|
2887
3422
|
}
|
|
@@ -2899,7 +3434,7 @@ ${JSON.stringify(
|
|
|
2899
3434
|
return;
|
|
2900
3435
|
}
|
|
2901
3436
|
const invalidIdCard = getMissingId(template);
|
|
2902
|
-
if (!
|
|
3437
|
+
if (!_21.isEmpty(invalidIdCard)) {
|
|
2903
3438
|
alert(
|
|
2904
3439
|
`L'une des cartes du template n'a pas un id valide. Par mesure de securit\xE9 la sauvegarde \xE0 \xE9t\xE9 bloqu\xE9e.
|
|
2905
3440
|
|
|
@@ -2914,9 +3449,9 @@ ${JSON.stringify(
|
|
|
2914
3449
|
setShowWarningSnackbar(true);
|
|
2915
3450
|
onSubmit(template);
|
|
2916
3451
|
}, [mode, template, onSubmit]);
|
|
2917
|
-
const onKeyDown =
|
|
3452
|
+
const onKeyDown = useCallback9(
|
|
2918
3453
|
(e) => {
|
|
2919
|
-
const sKey =
|
|
3454
|
+
const sKey = _21.flow(_21.invoke("key.toLowerCase"), _21.isEqual("s"))(e);
|
|
2920
3455
|
if (sKey && isMetaControlKeyPressed(e)) {
|
|
2921
3456
|
e.preventDefault();
|
|
2922
3457
|
return handleSubmit();
|
|
@@ -2924,15 +3459,15 @@ ${JSON.stringify(
|
|
|
2924
3459
|
},
|
|
2925
3460
|
[handleSubmit]
|
|
2926
3461
|
);
|
|
2927
|
-
|
|
3462
|
+
useEffect9(() => {
|
|
2928
3463
|
window.addEventListener("keydown", onKeyDown);
|
|
2929
3464
|
return () => {
|
|
2930
3465
|
window.removeEventListener("keydown", onKeyDown);
|
|
2931
3466
|
};
|
|
2932
3467
|
}, [onKeyDown]);
|
|
2933
|
-
const onError =
|
|
3468
|
+
const onError = useCallback9(
|
|
2934
3469
|
(error) => {
|
|
2935
|
-
setDocLintErrors(
|
|
3470
|
+
setDocLintErrors(_21.set(editEditor.path, error));
|
|
2936
3471
|
},
|
|
2937
3472
|
[editEditor.path]
|
|
2938
3473
|
);
|
|
@@ -2942,15 +3477,15 @@ ${JSON.stringify(
|
|
|
2942
3477
|
scrollTo(firstFoundErrorUuid);
|
|
2943
3478
|
editEditor.open(firstFoundErrorUuid);
|
|
2944
3479
|
};
|
|
2945
|
-
const onDocChange =
|
|
3480
|
+
const onDocChange = useCallback9(
|
|
2946
3481
|
(doc) => {
|
|
2947
|
-
const uuid =
|
|
3482
|
+
const uuid = _21.get("uuid", doc);
|
|
2948
3483
|
if (!uuid) {
|
|
2949
3484
|
onChange(doc);
|
|
2950
3485
|
} else {
|
|
2951
3486
|
onChange(({ children, ...template2 } = {}) => ({
|
|
2952
3487
|
...template2,
|
|
2953
|
-
children:
|
|
3488
|
+
children: React7.Children.map(children, (child) => typeof child === "object" && child !== null && _21.matches({ uuid }, child) ? doc : child)
|
|
2954
3489
|
}));
|
|
2955
3490
|
}
|
|
2956
3491
|
},
|
|
@@ -2966,11 +3501,11 @@ ${JSON.stringify(
|
|
|
2966
3501
|
setIsCompactMode,
|
|
2967
3502
|
setCopied
|
|
2968
3503
|
};
|
|
2969
|
-
return /* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2972
|
-
copied && /* @__PURE__ */
|
|
2973
|
-
isEditMode(mode) ? /* @__PURE__ */
|
|
3504
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
3505
|
+
/* @__PURE__ */ jsx27(EditorStickyBar, { ...toolbarProps }),
|
|
3506
|
+
/* @__PURE__ */ jsx27("div", { className: src_components_lazy_index_editor_default.pageContainer, children: /* @__PURE__ */ jsxs18("div", { className: src_components_lazy_index_editor_default.screen, children: [
|
|
3507
|
+
copied && /* @__PURE__ */ jsx27("div", { className: src_components_lazy_index_editor_default.alert, children: "JSON copi\xE9 dans le presse-papier" }),
|
|
3508
|
+
isEditMode(mode) ? /* @__PURE__ */ jsx27(
|
|
2974
3509
|
EditViewerMd_default,
|
|
2975
3510
|
{
|
|
2976
3511
|
...props,
|
|
@@ -2982,8 +3517,8 @@ ${JSON.stringify(
|
|
|
2982
3517
|
compactMode: isCompactMode,
|
|
2983
3518
|
template
|
|
2984
3519
|
}
|
|
2985
|
-
) : /* @__PURE__ */
|
|
2986
|
-
metadataEditor.path && /* @__PURE__ */
|
|
3520
|
+
) : /* @__PURE__ */ jsx27(ViewerMd_default, { ...props, ref, mode, template, onChange }),
|
|
3521
|
+
metadataEditor.path && /* @__PURE__ */ jsx27(
|
|
2987
3522
|
MetadataEditor_default,
|
|
2988
3523
|
{
|
|
2989
3524
|
doc: getDocumentByUuid(metadataEditor.path, template),
|
|
@@ -2994,7 +3529,7 @@ ${JSON.stringify(
|
|
|
2994
3529
|
},
|
|
2995
3530
|
`metadata_${metadataEditor.path}`
|
|
2996
3531
|
),
|
|
2997
|
-
editEditor.path && /* @__PURE__ */
|
|
3532
|
+
editEditor.path && /* @__PURE__ */ jsx27(
|
|
2998
3533
|
Editor2,
|
|
2999
3534
|
{
|
|
3000
3535
|
error: docLintErrors[editEditor.path],
|
|
@@ -3007,7 +3542,7 @@ ${JSON.stringify(
|
|
|
3007
3542
|
`edit_${editEditor.path}`
|
|
3008
3543
|
)
|
|
3009
3544
|
] }) }),
|
|
3010
|
-
showWarningSnackbar && !!firstFoundErrorUuid && /* @__PURE__ */
|
|
3545
|
+
showWarningSnackbar && !!firstFoundErrorUuid && /* @__PURE__ */ jsx27(
|
|
3011
3546
|
Snackbar,
|
|
3012
3547
|
{
|
|
3013
3548
|
open: true,
|
|
@@ -3028,19 +3563,19 @@ ${JSON.stringify(
|
|
|
3028
3563
|
});
|
|
3029
3564
|
|
|
3030
3565
|
// src/index.editor.tsx
|
|
3031
|
-
import
|
|
3032
|
-
import { jsx as
|
|
3033
|
-
var LazyEditor2 =
|
|
3566
|
+
import React8, { Suspense as Suspense2 } from "react";
|
|
3567
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3568
|
+
var LazyEditor2 = React8.lazy(() => Promise.resolve().then(() => (init_index_editor2(), index_editor_exports)));
|
|
3034
3569
|
var ViewerEditor = (props) => {
|
|
3035
|
-
return /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ jsx28(Suspense2, { children: /* @__PURE__ */ jsx28(LazyEditor2, { ...props }) });
|
|
3036
3571
|
};
|
|
3037
3572
|
var index_editor_default2 = ViewerEditor;
|
|
3038
3573
|
|
|
3039
3574
|
// src/index.viewer.tsx
|
|
3040
3575
|
init_ViewerMd2();
|
|
3041
|
-
import { jsx as
|
|
3576
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3042
3577
|
var Viewer = (props) => {
|
|
3043
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsx29(ViewerMd_default, { ...props });
|
|
3044
3579
|
};
|
|
3045
3580
|
var index_viewer_default = Viewer;
|
|
3046
3581
|
export {
|