@raketa-builder/support 0.5.0 → 0.6.0
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @raketa-builder/support@0.
|
|
2
|
+
> @raketa-builder/support@0.6.0 build
|
|
3
3
|
> tsup src/index.js --format cjs --loader ".js=jsx"
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.js
|
|
@@ -7,5 +7,5 @@ CLI Using tsconfig: tsconfig.json
|
|
|
7
7
|
CLI tsup v6.5.0
|
|
8
8
|
CLI Target: es6
|
|
9
9
|
CJS Build start
|
|
10
|
-
CJS dist/index.js
|
|
11
|
-
CJS ⚡️ Build success in
|
|
10
|
+
CJS dist/index.js 19.97 KB
|
|
11
|
+
CJS ⚡️ Build success in 101ms
|
package/dist/index.js
CHANGED
|
@@ -428,9 +428,17 @@ var title = (widget) => {
|
|
|
428
428
|
var deprecated = (widget) => {
|
|
429
429
|
return widget.Config.deprecated;
|
|
430
430
|
};
|
|
431
|
-
var AdminWidgetMinimal = ({
|
|
431
|
+
var AdminWidgetMinimal = ({
|
|
432
|
+
library,
|
|
433
|
+
adminLibrary,
|
|
434
|
+
widget,
|
|
435
|
+
onCopy,
|
|
436
|
+
onSelectWidget,
|
|
437
|
+
selectedWidgets
|
|
438
|
+
}) => {
|
|
432
439
|
const currentWidget = library[widget.component];
|
|
433
440
|
const currentAdminWidget = adminLibrary[widget.component];
|
|
441
|
+
const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
|
|
434
442
|
if (!currentWidget || !currentAdminWidget) {
|
|
435
443
|
console.error(`Unknown widget: ${widget.component}`);
|
|
436
444
|
return null;
|
|
@@ -439,8 +447,24 @@ var AdminWidgetMinimal = ({ library, adminLibrary, widget, onCopy }) => {
|
|
|
439
447
|
const widgetsToCopy = [widget];
|
|
440
448
|
onCopy(widgetsToCopy);
|
|
441
449
|
};
|
|
450
|
+
const handleSelectWidget = () => onSelectWidget(widget.widgetId);
|
|
442
451
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AdminWidgetWrapper, { "data-widget": widget.component, children: [
|
|
443
|
-
|
|
452
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-selected-widget" }),
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AdminWidgetToolbar, { "data-toolbar": true, children: [
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
455
|
+
"input",
|
|
456
|
+
{
|
|
457
|
+
type: "checkbox",
|
|
458
|
+
style: {
|
|
459
|
+
width: "32px",
|
|
460
|
+
aspectRatio: 1
|
|
461
|
+
},
|
|
462
|
+
onChange: handleSelectWidget,
|
|
463
|
+
checked: isSelected
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
!isSelected && !deprecated(currentAdminWidget) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton_default, { onClick: handleCopyWidget })
|
|
467
|
+
] }),
|
|
444
468
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AdminWidgetLabel, { "data-widget-label": true, children: title(currentAdminWidget) }),
|
|
445
469
|
import_react5.default.createElement(currentWidget, widget.settings)
|
|
446
470
|
] });
|
|
@@ -450,25 +474,109 @@ AdminWidgetMinimal.defaultProps = {
|
|
|
450
474
|
};
|
|
451
475
|
var AdminWidgetMinimal_default = AdminWidgetMinimal;
|
|
452
476
|
|
|
453
|
-
// src/
|
|
477
|
+
// src/lib/SelectedWidgetsToolbar.js
|
|
454
478
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
479
|
+
var IconCopy = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
480
|
+
"svg",
|
|
481
|
+
{
|
|
482
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
483
|
+
width: "16",
|
|
484
|
+
height: "16",
|
|
485
|
+
viewBox: "0 0 16 16",
|
|
486
|
+
fill: "none",
|
|
487
|
+
children: [
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("g", { clipPath: "url(#clip0_2312_498)", children: [
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
490
|
+
"path",
|
|
491
|
+
{
|
|
492
|
+
d: "M13.3334 5.33331H6.66671C5.93033 5.33331 5.33337 5.93027 5.33337 6.66665V13.3333C5.33337 14.0697 5.93033 14.6666 6.66671 14.6666H13.3334C14.0698 14.6666 14.6667 14.0697 14.6667 13.3333V6.66665C14.6667 5.93027 14.0698 5.33331 13.3334 5.33331Z",
|
|
493
|
+
stroke: "white",
|
|
494
|
+
strokeWidth: "2",
|
|
495
|
+
strokeLinecap: "round",
|
|
496
|
+
strokeLinejoin: "round"
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
500
|
+
"path",
|
|
501
|
+
{
|
|
502
|
+
d: "M2.66671 10.6666C1.93337 10.6666 1.33337 10.0666 1.33337 9.33331V2.66665C1.33337 1.93331 1.93337 1.33331 2.66671 1.33331H9.33337C10.0667 1.33331 10.6667 1.93331 10.6667 2.66665",
|
|
503
|
+
stroke: "white",
|
|
504
|
+
strokeWidth: "2",
|
|
505
|
+
strokeLinecap: "round",
|
|
506
|
+
strokeLinejoin: "round"
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
] }),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("clipPath", { id: "clip0_2312_498", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
var SelectedWidgetsToolbar = ({ length, onCopy }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "r-selected-widgets-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "r-toolbar-inner", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
type: "button",
|
|
518
|
+
className: "r-button-reset r-toolbar-button",
|
|
519
|
+
onClick: onCopy,
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconCopy, {}),
|
|
522
|
+
"Copy selected (",
|
|
523
|
+
length,
|
|
524
|
+
")"
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
) }) });
|
|
528
|
+
var SelectedWidgetsToolbar_default = SelectedWidgetsToolbar;
|
|
529
|
+
|
|
530
|
+
// src/AdminPageRender/index.js
|
|
531
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
532
|
+
var saveToLocalStorage = (identifier, widgets) => window.localStorage.setItem(
|
|
533
|
+
`clipboard\u2013${identifier}`,
|
|
534
|
+
JSON.stringify(widgets)
|
|
535
|
+
);
|
|
455
536
|
var AdminPageRender = ({ page, library, adminLibrary, identifier }) => {
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
537
|
+
const [selectedWidgets, setSelectedWidgets] = import_react6.default.useState([]);
|
|
538
|
+
const handleSelectWidget = (newWidget) => {
|
|
539
|
+
setSelectedWidgets((oldList) => {
|
|
540
|
+
const isUnique = oldList.filter((w) => w === newWidget).length <= 0;
|
|
541
|
+
if (isUnique) {
|
|
542
|
+
return [...oldList, newWidget];
|
|
543
|
+
} else {
|
|
544
|
+
return oldList.filter((w) => w !== newWidget);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
};
|
|
548
|
+
const handleCopyWidgets = (widgets, copyType) => {
|
|
549
|
+
if (copyType === "multiple") {
|
|
550
|
+
const filterSelected = page.widgets.filter(
|
|
551
|
+
(w) => widgets.some((c) => w.widgetId === c)
|
|
552
|
+
);
|
|
553
|
+
saveToLocalStorage(identifier, filterSelected);
|
|
554
|
+
setSelectedWidgets([]);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
saveToLocalStorage(identifier, widgets);
|
|
461
558
|
};
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
widgetId
|
|
471
|
-
|
|
559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react6.default.Fragment, { children: [
|
|
560
|
+
selectedWidgets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
561
|
+
SelectedWidgetsToolbar_default,
|
|
562
|
+
{
|
|
563
|
+
length: selectedWidgets.length,
|
|
564
|
+
onCopy: () => handleCopyWidgets(selectedWidgets, "multiple")
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
page.widgets.map(({ widgetId, component, settings }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
568
|
+
AdminWidgetMinimal_default,
|
|
569
|
+
{
|
|
570
|
+
library,
|
|
571
|
+
adminLibrary,
|
|
572
|
+
widget: { widgetId, component, settings },
|
|
573
|
+
onCopy: handleCopyWidgets,
|
|
574
|
+
onSelectWidget: handleSelectWidget,
|
|
575
|
+
selectedWidgets
|
|
576
|
+
},
|
|
577
|
+
widgetId
|
|
578
|
+
))
|
|
579
|
+
] });
|
|
472
580
|
};
|
|
473
581
|
var AdminPageRender_default = AdminPageRender;
|
|
474
582
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -32,10 +32,20 @@ const deprecated = (widget) => {
|
|
|
32
32
|
return widget.Config.deprecated;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const AdminWidgetMinimal = ({
|
|
35
|
+
const AdminWidgetMinimal = ({
|
|
36
|
+
library,
|
|
37
|
+
adminLibrary,
|
|
38
|
+
widget,
|
|
39
|
+
onCopy,
|
|
40
|
+
onSelectWidget,
|
|
41
|
+
selectedWidgets,
|
|
42
|
+
}) => {
|
|
36
43
|
const currentWidget = library[widget.component];
|
|
37
44
|
const currentAdminWidget = adminLibrary[widget.component];
|
|
38
45
|
|
|
46
|
+
const isSelected =
|
|
47
|
+
selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
|
|
48
|
+
|
|
39
49
|
if (!currentWidget || !currentAdminWidget) {
|
|
40
50
|
console.error(`Unknown widget: ${widget.component}`);
|
|
41
51
|
return null;
|
|
@@ -46,10 +56,24 @@ const AdminWidgetMinimal = ({ library, adminLibrary, widget, onCopy }) => {
|
|
|
46
56
|
onCopy(widgetsToCopy);
|
|
47
57
|
};
|
|
48
58
|
|
|
59
|
+
const handleSelectWidget = () => onSelectWidget(widget.widgetId);
|
|
60
|
+
|
|
49
61
|
return (
|
|
50
62
|
<AdminWidgetWrapper data-widget={widget.component}>
|
|
63
|
+
{isSelected && <div className="r-selected-widget" />}
|
|
64
|
+
|
|
51
65
|
<AdminWidgetToolbar data-toolbar>
|
|
52
|
-
|
|
66
|
+
<input
|
|
67
|
+
type="checkbox"
|
|
68
|
+
style={{
|
|
69
|
+
width: "32px",
|
|
70
|
+
aspectRatio: 1,
|
|
71
|
+
}}
|
|
72
|
+
onChange={handleSelectWidget}
|
|
73
|
+
checked={isSelected}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
{!isSelected && !deprecated(currentAdminWidget) && (
|
|
53
77
|
<IconButton onClick={handleCopyWidget} />
|
|
54
78
|
)}
|
|
55
79
|
</AdminWidgetToolbar>
|
|
@@ -1,16 +1,51 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import AdminWidgetMinimal from "./AdminWidgetMinimal";
|
|
3
|
+
import SelectedWidgetsToolbar from "../lib/SelectedWidgetsToolbar";
|
|
4
|
+
|
|
5
|
+
const saveToLocalStorage = (identifier, widgets) =>
|
|
6
|
+
window.localStorage.setItem(
|
|
7
|
+
`clipboard–${identifier}`,
|
|
8
|
+
JSON.stringify(widgets)
|
|
9
|
+
);
|
|
3
10
|
|
|
4
11
|
const AdminPageRender = ({ page, library, adminLibrary, identifier }) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
const [selectedWidgets, setSelectedWidgets] = React.useState([]);
|
|
13
|
+
|
|
14
|
+
const handleSelectWidget = (newWidget) => {
|
|
15
|
+
setSelectedWidgets((oldList) => {
|
|
16
|
+
const isUnique = oldList.filter((w) => w === newWidget).length <= 0;
|
|
17
|
+
|
|
18
|
+
if (isUnique) {
|
|
19
|
+
return [...oldList, newWidget];
|
|
20
|
+
} else {
|
|
21
|
+
return oldList.filter((w) => w !== newWidget);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleCopyWidgets = (widgets, copyType) => {
|
|
27
|
+
if (copyType === "multiple") {
|
|
28
|
+
const filterSelected = page.widgets.filter((w) =>
|
|
29
|
+
widgets.some((c) => w.widgetId === c)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
saveToLocalStorage(identifier, filterSelected);
|
|
33
|
+
setSelectedWidgets([]);
|
|
34
|
+
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
saveToLocalStorage(identifier, widgets);
|
|
10
39
|
};
|
|
11
40
|
|
|
12
41
|
return (
|
|
13
42
|
<React.Fragment>
|
|
43
|
+
{selectedWidgets.length > 0 && (
|
|
44
|
+
<SelectedWidgetsToolbar
|
|
45
|
+
length={selectedWidgets.length}
|
|
46
|
+
onCopy={() => handleCopyWidgets(selectedWidgets, "multiple")}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
14
49
|
{page.widgets.map(({ widgetId, component, settings }) => (
|
|
15
50
|
<AdminWidgetMinimal
|
|
16
51
|
key={widgetId}
|
|
@@ -18,6 +53,8 @@ const AdminPageRender = ({ page, library, adminLibrary, identifier }) => {
|
|
|
18
53
|
adminLibrary={adminLibrary}
|
|
19
54
|
widget={{ widgetId, component, settings }}
|
|
20
55
|
onCopy={handleCopyWidgets}
|
|
56
|
+
onSelectWidget={handleSelectWidget}
|
|
57
|
+
selectedWidgets={selectedWidgets}
|
|
21
58
|
/>
|
|
22
59
|
))}
|
|
23
60
|
</React.Fragment>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const IconCopy = () => (
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
width="16"
|
|
5
|
+
height="16"
|
|
6
|
+
viewBox="0 0 16 16"
|
|
7
|
+
fill="none"
|
|
8
|
+
>
|
|
9
|
+
<g clipPath="url(#clip0_2312_498)">
|
|
10
|
+
<path
|
|
11
|
+
d="M13.3334 5.33331H6.66671C5.93033 5.33331 5.33337 5.93027 5.33337 6.66665V13.3333C5.33337 14.0697 5.93033 14.6666 6.66671 14.6666H13.3334C14.0698 14.6666 14.6667 14.0697 14.6667 13.3333V6.66665C14.6667 5.93027 14.0698 5.33331 13.3334 5.33331Z"
|
|
12
|
+
stroke="white"
|
|
13
|
+
strokeWidth="2"
|
|
14
|
+
strokeLinecap="round"
|
|
15
|
+
strokeLinejoin="round"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M2.66671 10.6666C1.93337 10.6666 1.33337 10.0666 1.33337 9.33331V2.66665C1.33337 1.93331 1.93337 1.33331 2.66671 1.33331H9.33337C10.0667 1.33331 10.6667 1.93331 10.6667 2.66665"
|
|
19
|
+
stroke="white"
|
|
20
|
+
strokeWidth="2"
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
/>
|
|
24
|
+
</g>
|
|
25
|
+
<defs>
|
|
26
|
+
<clipPath id="clip0_2312_498">
|
|
27
|
+
<rect width="16" height="16" fill="white" />
|
|
28
|
+
</clipPath>
|
|
29
|
+
</defs>
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const SelectedWidgetsToolbar = ({ length, onCopy }) => (
|
|
34
|
+
<div className="r-selected-widgets-toolbar">
|
|
35
|
+
<div className="r-toolbar-inner">
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
className="r-button-reset r-toolbar-button"
|
|
39
|
+
onClick={onCopy}
|
|
40
|
+
>
|
|
41
|
+
<IconCopy />
|
|
42
|
+
Copy selected ({length})
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export default SelectedWidgetsToolbar;
|