@raketa-builder/markdown-input 0.6.0 → 0.7.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 +3 -3
- package/dist/index.js +343 -36
- package/package.json +1 -1
- package/.turbo/turbo-format.log +0 -12
- package/.turbo/turbo-lint.log +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @raketa-builder/markdown-input@0.
|
|
2
|
+
> @raketa-builder/markdown-input@0.7.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 280.63 KB
|
|
11
|
+
CJS ⚡️ Build success in 72ms
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,7 @@ var require_dist = __commonJS({
|
|
|
111
111
|
var src_exports2 = {};
|
|
112
112
|
__export2(src_exports2, {
|
|
113
113
|
Button: () => Button_default,
|
|
114
|
+
CategoriesMenu: () => CategoriesMenu_default,
|
|
114
115
|
Col: () => Col,
|
|
115
116
|
Container: () => Container_default,
|
|
116
117
|
DataGrid: () => DataGrid_default,
|
|
@@ -216,11 +217,24 @@ var require_dist = __commonJS({
|
|
|
216
217
|
var import_react3 = __toESM2(require("react"));
|
|
217
218
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
218
219
|
var Button = (_a) => {
|
|
219
|
-
var _b = _a, {
|
|
220
|
+
var _b = _a, {
|
|
221
|
+
as = "button",
|
|
222
|
+
size = "md",
|
|
223
|
+
variant = "primary",
|
|
224
|
+
className,
|
|
225
|
+
type = "button"
|
|
226
|
+
} = _b, rest = __objRest2(_b, [
|
|
227
|
+
"as",
|
|
228
|
+
"size",
|
|
229
|
+
"variant",
|
|
230
|
+
"className",
|
|
231
|
+
"type"
|
|
232
|
+
]);
|
|
220
233
|
const Component = as;
|
|
221
234
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
222
235
|
Component,
|
|
223
236
|
__spreadValues2({
|
|
237
|
+
type,
|
|
224
238
|
className: cn2(
|
|
225
239
|
"r-reset",
|
|
226
240
|
"r-reset-button",
|
|
@@ -232,11 +246,6 @@ var require_dist = __commonJS({
|
|
|
232
246
|
}, rest)
|
|
233
247
|
);
|
|
234
248
|
};
|
|
235
|
-
Button.defaultProps = {
|
|
236
|
-
type: "button",
|
|
237
|
-
size: "md",
|
|
238
|
-
variant: "primary"
|
|
239
|
-
};
|
|
240
249
|
Button.variants = ["primary", "secondary", "success", "danger"];
|
|
241
250
|
Button.sizes = {
|
|
242
251
|
sm: "sm",
|
|
@@ -450,6 +459,7 @@ var require_dist = __commonJS({
|
|
|
450
459
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
451
460
|
"button",
|
|
452
461
|
__spreadValues2({
|
|
462
|
+
type: "button",
|
|
453
463
|
className: cn2("r-reset-button r-modal-close-btn", className)
|
|
454
464
|
}, props)
|
|
455
465
|
);
|
|
@@ -462,37 +472,47 @@ var require_dist = __commonJS({
|
|
|
462
472
|
var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
|
|
463
473
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn2("r-reset", "r-modal-content", className) }, props));
|
|
464
474
|
};
|
|
475
|
+
function checkForChanges(hasChanges, onClose) {
|
|
476
|
+
if (!hasChanges) {
|
|
477
|
+
onClose();
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (!confirm(
|
|
481
|
+
"You\u2019ve made changes to the widget. Are you sure you want to cancel?"
|
|
482
|
+
))
|
|
483
|
+
return;
|
|
484
|
+
onClose();
|
|
485
|
+
}
|
|
465
486
|
var Modal = (_a) => {
|
|
466
487
|
var _b = _a, {
|
|
467
488
|
title,
|
|
468
489
|
children,
|
|
469
490
|
customWrapper,
|
|
470
491
|
FooterContent,
|
|
471
|
-
onClose
|
|
492
|
+
onClose,
|
|
493
|
+
areChanges
|
|
472
494
|
} = _b, rest = __objRest2(_b, [
|
|
473
495
|
"title",
|
|
474
496
|
"children",
|
|
475
497
|
"customWrapper",
|
|
476
498
|
"FooterContent",
|
|
477
|
-
"onClose"
|
|
499
|
+
"onClose",
|
|
500
|
+
"areChanges"
|
|
478
501
|
]);
|
|
479
|
-
const handleKeyUp = ({ key }) => {
|
|
480
|
-
if (key === "Escape")
|
|
481
|
-
onClose();
|
|
482
|
-
};
|
|
483
|
-
import_react17.default.useEffect(() => {
|
|
484
|
-
document.addEventListener("keyup", handleKeyUp);
|
|
485
|
-
return () => {
|
|
486
|
-
document.removeEventListener("keyup", handleKeyUp);
|
|
487
|
-
};
|
|
488
|
-
});
|
|
489
502
|
const ModalWrapper = customWrapper ? customWrapper : Wrapper;
|
|
490
503
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
|
|
491
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {}),
|
|
492
505
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
|
|
493
506
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
|
|
494
507
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
|
|
495
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
509
|
+
CloseButton,
|
|
510
|
+
{
|
|
511
|
+
type: "button",
|
|
512
|
+
onClick: () => checkForChanges(areChanges, onClose),
|
|
513
|
+
children: "\xD7"
|
|
514
|
+
}
|
|
515
|
+
)
|
|
496
516
|
] }),
|
|
497
517
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
|
|
498
518
|
FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
|
|
@@ -727,7 +747,7 @@ var require_dist = __commonJS({
|
|
|
727
747
|
var import_react24 = __toESM2(require("react"));
|
|
728
748
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
729
749
|
var ImageAvatar = (_a) => {
|
|
730
|
-
var _b = _a, { size, className } = _b, props = __objRest2(_b, ["size", "className"]);
|
|
750
|
+
var _b = _a, { size = "24px", className } = _b, props = __objRest2(_b, ["size", "className"]);
|
|
731
751
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
732
752
|
"img",
|
|
733
753
|
__spreadValues2({
|
|
@@ -740,9 +760,6 @@ var require_dist = __commonJS({
|
|
|
740
760
|
}, props)
|
|
741
761
|
);
|
|
742
762
|
};
|
|
743
|
-
ImageAvatar.defaultProps = {
|
|
744
|
-
size: "24px"
|
|
745
|
-
};
|
|
746
763
|
var ImageAvatar_default = ImageAvatar;
|
|
747
764
|
var import_react25 = __toESM2(require("react"));
|
|
748
765
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
@@ -783,14 +800,53 @@ var require_dist = __commonJS({
|
|
|
783
800
|
);
|
|
784
801
|
};
|
|
785
802
|
var DefaultAvatar = (_a) => {
|
|
786
|
-
var _b = _a, { initials } = _b, props = __objRest2(_b, ["initials"]);
|
|
787
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps(__spreadValues2({ initials }, props), { children: initials }));
|
|
788
|
-
};
|
|
789
|
-
DefaultAvatar.defaultProps = {
|
|
790
|
-
size: "24px",
|
|
791
|
-
initials: "AA"
|
|
803
|
+
var _b = _a, { initials = "AA", size = "24px" } = _b, props = __objRest2(_b, ["initials", "size"]);
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps(__spreadValues2({ initials, size }, props), { children: initials }));
|
|
792
805
|
};
|
|
793
806
|
var DefaultAvatar_default = DefaultAvatar;
|
|
807
|
+
var import_react26 = __toESM2(require("react"));
|
|
808
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
809
|
+
var IconsWrapper = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "r-reset r-categories-icons-wrapper", children: [
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
811
|
+
"img",
|
|
812
|
+
{
|
|
813
|
+
style: {
|
|
814
|
+
color: "#fff",
|
|
815
|
+
width: "24px",
|
|
816
|
+
height: "24px",
|
|
817
|
+
filter: "invert(1)"
|
|
818
|
+
},
|
|
819
|
+
alt: "directions",
|
|
820
|
+
src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZ3JpZCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjciIGhlaWdodD0iNyI+PC9yZWN0PjxyZWN0IHg9IjE0IiB5PSIzIiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMTQiIHk9IjE0IiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMyIgeT0iMTQiIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjwvcmVjdD48L3N2Zz4="
|
|
821
|
+
}
|
|
822
|
+
),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
824
|
+
"img",
|
|
825
|
+
{
|
|
826
|
+
className: "r-reset r-category-chevron",
|
|
827
|
+
alt: "directions",
|
|
828
|
+
src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAyMiAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIxIDExLjVMMTEgMS41TDEgMTEuNSIgc3Ryb2tlPSIjMEMwQTA5IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg=="
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
] });
|
|
832
|
+
var Title2 = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-categories-title", children: "Categories" });
|
|
833
|
+
var CategoriesInner = (_a) => {
|
|
834
|
+
var props = __objRest2(_a, []);
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadProps(__spreadValues2({}, props), { className: "r-reset r-categories-inner" }));
|
|
836
|
+
};
|
|
837
|
+
var CategoriesHiddenMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-reset r-categories-hidden-menu", children: paths.map(({ title, link }, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: link, className: "r-reset r-category-link", children: title }, `${idx}-${link}`)) });
|
|
838
|
+
var CategoriesMenuWrapper = (_a) => {
|
|
839
|
+
var props = __objRest2(_a, []);
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadValues2({ className: "r-reset r-categories-menu" }, props));
|
|
841
|
+
};
|
|
842
|
+
var CategoriesMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesMenuWrapper, { children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesInner, { children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconsWrapper, {}),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Title2, {})
|
|
846
|
+
] }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CategoriesHiddenMenu, { paths })
|
|
848
|
+
] });
|
|
849
|
+
var CategoriesMenu_default = CategoriesMenu;
|
|
794
850
|
}
|
|
795
851
|
});
|
|
796
852
|
|
|
@@ -6351,11 +6407,14 @@ var require_dist2 = __commonJS({
|
|
|
6351
6407
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
6352
6408
|
var src_exports2 = {};
|
|
6353
6409
|
__export2(src_exports2, {
|
|
6410
|
+
AdminPageRender: () => AdminPageRender_default,
|
|
6354
6411
|
Container: () => Container_default,
|
|
6355
6412
|
EmbeddedVideo: () => EmbeddedVideo_default,
|
|
6356
6413
|
Image: () => Image_default,
|
|
6414
|
+
extractImageValue: () => extractImageValue_default,
|
|
6357
6415
|
imagePlaceholder: () => imagePlaceholder_default,
|
|
6358
6416
|
imageSrc: () => imageSrc_default,
|
|
6417
|
+
isImagePresent: () => isImagePresent_default,
|
|
6359
6418
|
toHTML: () => toHTML_default
|
|
6360
6419
|
});
|
|
6361
6420
|
module2.exports = __toCommonJS2(src_exports2);
|
|
@@ -6371,8 +6430,8 @@ var require_dist2 = __commonJS({
|
|
|
6371
6430
|
var getDimensions = (src, variant) => {
|
|
6372
6431
|
var _a, _b, _c;
|
|
6373
6432
|
if (typeof src === "object" && ((_a = src == null ? void 0 : src.name) == null ? void 0 : _a.includes(".svg"))) {
|
|
6374
|
-
const width = src.width;
|
|
6375
|
-
const height = src.height;
|
|
6433
|
+
const width = src.width || null;
|
|
6434
|
+
const height = src.height || null;
|
|
6376
6435
|
return [width, height];
|
|
6377
6436
|
}
|
|
6378
6437
|
if (typeof src === "object") {
|
|
@@ -6418,7 +6477,7 @@ var require_dist2 = __commonJS({
|
|
|
6418
6477
|
return value;
|
|
6419
6478
|
};
|
|
6420
6479
|
var Image = (_a) => {
|
|
6421
|
-
var _b = _a, { variant, src, alt, loading } = _b, props = __objRest2(_b, ["variant", "src", "alt", "loading"]);
|
|
6480
|
+
var _b = _a, { variant, src, alt, loading = "lazy" } = _b, props = __objRest2(_b, ["variant", "src", "alt", "loading"]);
|
|
6422
6481
|
if (!variant) {
|
|
6423
6482
|
console.error("Image with no variant", { variant, src, alt, props });
|
|
6424
6483
|
return null;
|
|
@@ -6450,9 +6509,6 @@ var require_dist2 = __commonJS({
|
|
|
6450
6509
|
)
|
|
6451
6510
|
] });
|
|
6452
6511
|
};
|
|
6453
|
-
Image.defaultProps = {
|
|
6454
|
-
loading: "lazy"
|
|
6455
|
-
};
|
|
6456
6512
|
var Image_default = Image;
|
|
6457
6513
|
var imageSrc = (src, variant) => {
|
|
6458
6514
|
if (typeof src === "object" && !("name" in src))
|
|
@@ -6628,6 +6684,257 @@ var require_dist2 = __commonJS({
|
|
|
6628
6684
|
return inline ? parser.renderInline(string) : parser.render(string);
|
|
6629
6685
|
};
|
|
6630
6686
|
var toHTML_default = toHTML2;
|
|
6687
|
+
function isImagePresent(value) {
|
|
6688
|
+
if (!value) {
|
|
6689
|
+
return false;
|
|
6690
|
+
}
|
|
6691
|
+
if (value.hasOwnProperty("image")) {
|
|
6692
|
+
return !!value.image;
|
|
6693
|
+
}
|
|
6694
|
+
if (typeof value === "string" && value) {
|
|
6695
|
+
return true;
|
|
6696
|
+
}
|
|
6697
|
+
return !!value;
|
|
6698
|
+
}
|
|
6699
|
+
var isImagePresent_default = isImagePresent;
|
|
6700
|
+
var import_react6 = __toESM2(require("react"));
|
|
6701
|
+
var import_react5 = __toESM2(require("react"));
|
|
6702
|
+
var import_react4 = __toESM2(require("react"));
|
|
6703
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
6704
|
+
var ICON_COPY = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY29weSI+PHJlY3QgeD0iOSIgeT0iOSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEzIiByeD0iMiIgcnk9IjIiPjwvcmVjdD48cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIj48L3BhdGg+PC9zdmc+";
|
|
6705
|
+
var IconButton2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6706
|
+
"button",
|
|
6707
|
+
__spreadValues2({
|
|
6708
|
+
type: "button",
|
|
6709
|
+
style: {
|
|
6710
|
+
display: "inline-block",
|
|
6711
|
+
width: "32px",
|
|
6712
|
+
height: "32px",
|
|
6713
|
+
marginRight: "4px",
|
|
6714
|
+
marginLeft: "0px",
|
|
6715
|
+
appearance: "none",
|
|
6716
|
+
outline: "0",
|
|
6717
|
+
border: "0",
|
|
6718
|
+
borderRadius: "3px",
|
|
6719
|
+
background: "transparent",
|
|
6720
|
+
backgroundColor: "#fff",
|
|
6721
|
+
backgroundRepeat: "no-repeat",
|
|
6722
|
+
backgroundPosition: "center",
|
|
6723
|
+
backgroundSize: "50%",
|
|
6724
|
+
backgroundImage: `url(${ICON_COPY})`,
|
|
6725
|
+
cursor: "pointer"
|
|
6726
|
+
}
|
|
6727
|
+
}, props)
|
|
6728
|
+
);
|
|
6729
|
+
var IconButton_default = IconButton2;
|
|
6730
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
6731
|
+
function cn2() {
|
|
6732
|
+
return Array.from(arguments).filter(Boolean).map(String).join(" ");
|
|
6733
|
+
}
|
|
6734
|
+
var AdminWidgetWrapper = (_a) => {
|
|
6735
|
+
var _b = _a, { className } = _b, rest = __objRest2(_b, ["className"]);
|
|
6736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", __spreadValues2({ className: cn2("r-admin-widget-wrapper", className) }, rest));
|
|
6737
|
+
};
|
|
6738
|
+
var AdminWidgetToolbar = (_a) => {
|
|
6739
|
+
var _b = _a, { className } = _b, rest = __objRest2(_b, ["className"]);
|
|
6740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6741
|
+
"div",
|
|
6742
|
+
__spreadValues2({
|
|
6743
|
+
className: cn2("r-reset", "r-admin-widget-toolbar", className)
|
|
6744
|
+
}, rest)
|
|
6745
|
+
);
|
|
6746
|
+
};
|
|
6747
|
+
var AdminWidgetLabel = (_a) => {
|
|
6748
|
+
var _b = _a, { className } = _b, rest = __objRest2(_b, ["className"]);
|
|
6749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6750
|
+
"div",
|
|
6751
|
+
__spreadValues2({
|
|
6752
|
+
className: cn2("r-reset", "r-fs-small", "r-admin-widget-label", className)
|
|
6753
|
+
}, rest)
|
|
6754
|
+
);
|
|
6755
|
+
};
|
|
6756
|
+
var title = (widget) => {
|
|
6757
|
+
return widget.Config.title;
|
|
6758
|
+
};
|
|
6759
|
+
var deprecated = (widget) => {
|
|
6760
|
+
return widget.Config.deprecated;
|
|
6761
|
+
};
|
|
6762
|
+
var AdminWidgetMinimal = ({
|
|
6763
|
+
library,
|
|
6764
|
+
adminLibrary,
|
|
6765
|
+
widget,
|
|
6766
|
+
onCopy,
|
|
6767
|
+
onSelectWidget,
|
|
6768
|
+
selectedWidgets
|
|
6769
|
+
}) => {
|
|
6770
|
+
var _a;
|
|
6771
|
+
const currentWidget = library[widget.component];
|
|
6772
|
+
const currentAdminWidget = adminLibrary[widget.component];
|
|
6773
|
+
const containerSettings = ((_a = widget == null ? void 0 : widget.settings) == null ? void 0 : _a.containerSettings) || {};
|
|
6774
|
+
const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
|
|
6775
|
+
if (!currentWidget || !currentAdminWidget) {
|
|
6776
|
+
console.error(`Unknown widget: ${widget.component}`);
|
|
6777
|
+
return null;
|
|
6778
|
+
}
|
|
6779
|
+
const handleCopyWidget = () => {
|
|
6780
|
+
const widgetsToCopy = [widget];
|
|
6781
|
+
onCopy(widgetsToCopy);
|
|
6782
|
+
};
|
|
6783
|
+
const handleSelectWidget = () => onSelectWidget(widget.widgetId);
|
|
6784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AdminWidgetWrapper, { "data-widget": widget.component, children: [
|
|
6785
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-selected-widget" }),
|
|
6786
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AdminWidgetToolbar, { "data-toolbar": true, children: [
|
|
6787
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6788
|
+
"input",
|
|
6789
|
+
{
|
|
6790
|
+
type: "checkbox",
|
|
6791
|
+
style: {
|
|
6792
|
+
width: "32px",
|
|
6793
|
+
height: "32px"
|
|
6794
|
+
},
|
|
6795
|
+
onChange: handleSelectWidget,
|
|
6796
|
+
checked: isSelected
|
|
6797
|
+
}
|
|
6798
|
+
),
|
|
6799
|
+
!isSelected && !deprecated(currentAdminWidget) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton_default, { onClick: handleCopyWidget })
|
|
6800
|
+
] }),
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AdminWidgetLabel, { "data-widget-label": true, children: title(currentAdminWidget) }),
|
|
6802
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container_default, { settings: containerSettings, children: import_react5.default.createElement(currentWidget, widget.settings) })
|
|
6803
|
+
] });
|
|
6804
|
+
};
|
|
6805
|
+
var AdminWidgetMinimal_default = AdminWidgetMinimal;
|
|
6806
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
6807
|
+
var IconCopy = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
6808
|
+
"svg",
|
|
6809
|
+
{
|
|
6810
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6811
|
+
width: "16",
|
|
6812
|
+
height: "16",
|
|
6813
|
+
viewBox: "0 0 16 16",
|
|
6814
|
+
fill: "none",
|
|
6815
|
+
children: [
|
|
6816
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("g", { clipPath: "url(#clip0_2312_498)", children: [
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6818
|
+
"path",
|
|
6819
|
+
{
|
|
6820
|
+
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",
|
|
6821
|
+
stroke: "white",
|
|
6822
|
+
strokeWidth: "2",
|
|
6823
|
+
strokeLinecap: "round",
|
|
6824
|
+
strokeLinejoin: "round"
|
|
6825
|
+
}
|
|
6826
|
+
),
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
6828
|
+
"path",
|
|
6829
|
+
{
|
|
6830
|
+
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",
|
|
6831
|
+
stroke: "white",
|
|
6832
|
+
strokeWidth: "2",
|
|
6833
|
+
strokeLinecap: "round",
|
|
6834
|
+
strokeLinejoin: "round"
|
|
6835
|
+
}
|
|
6836
|
+
)
|
|
6837
|
+
] }),
|
|
6838
|
+
/* @__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" }) }) })
|
|
6839
|
+
]
|
|
6840
|
+
}
|
|
6841
|
+
);
|
|
6842
|
+
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)(
|
|
6843
|
+
"button",
|
|
6844
|
+
{
|
|
6845
|
+
type: "button",
|
|
6846
|
+
className: "r-button-reset r-toolbar-button",
|
|
6847
|
+
onClick: onCopy,
|
|
6848
|
+
children: [
|
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconCopy, {}),
|
|
6850
|
+
"Copy selected (",
|
|
6851
|
+
length,
|
|
6852
|
+
")"
|
|
6853
|
+
]
|
|
6854
|
+
}
|
|
6855
|
+
) }) });
|
|
6856
|
+
var SelectedWidgetsToolbar_default = SelectedWidgetsToolbar;
|
|
6857
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6858
|
+
var saveToLocalStorage = (identifier, widgets) => window.localStorage.setItem(
|
|
6859
|
+
`clipboard\u2013${identifier}`,
|
|
6860
|
+
JSON.stringify(widgets)
|
|
6861
|
+
);
|
|
6862
|
+
var AdminPageRender = ({
|
|
6863
|
+
page,
|
|
6864
|
+
library,
|
|
6865
|
+
adminLibrary,
|
|
6866
|
+
identifier,
|
|
6867
|
+
detailPath,
|
|
6868
|
+
canvasClassName = ""
|
|
6869
|
+
}) => {
|
|
6870
|
+
const [selectedWidgets, setSelectedWidgets] = import_react6.default.useState([]);
|
|
6871
|
+
const areAllSelected = selectedWidgets.length === page.widgets.length;
|
|
6872
|
+
const handleSelectWidget = (newWidget) => {
|
|
6873
|
+
setSelectedWidgets((oldList) => {
|
|
6874
|
+
const isUnique = oldList.filter((w) => w === newWidget).length <= 0;
|
|
6875
|
+
if (isUnique) {
|
|
6876
|
+
return [...oldList, newWidget];
|
|
6877
|
+
} else {
|
|
6878
|
+
return oldList.filter((w) => w !== newWidget);
|
|
6879
|
+
}
|
|
6880
|
+
});
|
|
6881
|
+
};
|
|
6882
|
+
const handleCopyWidgets = (widgets, copyType) => {
|
|
6883
|
+
if (copyType === "multiple") {
|
|
6884
|
+
const filterSelected = page.widgets.filter(
|
|
6885
|
+
(w) => widgets.some((c) => w.widgetId === c)
|
|
6886
|
+
);
|
|
6887
|
+
saveToLocalStorage(identifier, filterSelected);
|
|
6888
|
+
setSelectedWidgets([]);
|
|
6889
|
+
return;
|
|
6890
|
+
}
|
|
6891
|
+
saveToLocalStorage(identifier, widgets);
|
|
6892
|
+
};
|
|
6893
|
+
const handleSelectAll = () => {
|
|
6894
|
+
if (areAllSelected)
|
|
6895
|
+
return setSelectedWidgets([]);
|
|
6896
|
+
setSelectedWidgets(page.widgets.map((w) => w.widgetId));
|
|
6897
|
+
};
|
|
6898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react6.default.Fragment, { children: [
|
|
6899
|
+
selectedWidgets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6900
|
+
SelectedWidgetsToolbar_default,
|
|
6901
|
+
{
|
|
6902
|
+
length: selectedWidgets.length,
|
|
6903
|
+
onCopy: () => handleCopyWidgets(selectedWidgets, "multiple")
|
|
6904
|
+
}
|
|
6905
|
+
),
|
|
6906
|
+
page.widgets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6907
|
+
"button",
|
|
6908
|
+
{
|
|
6909
|
+
className: `r-button-reset r-button-select-all ${areAllSelected ? "r-all-selected" : ""}`,
|
|
6910
|
+
type: "button",
|
|
6911
|
+
title: "Select all (or Deselect all)",
|
|
6912
|
+
onClick: () => handleSelectAll()
|
|
6913
|
+
}
|
|
6914
|
+
),
|
|
6915
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: detailPath, className: "r-reset r-details-link", title: "Details" }),
|
|
6916
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: canvasClassName, children: page.widgets.map(({ widgetId, component, settings }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6917
|
+
AdminWidgetMinimal_default,
|
|
6918
|
+
{
|
|
6919
|
+
library,
|
|
6920
|
+
adminLibrary,
|
|
6921
|
+
widget: { widgetId, component, settings },
|
|
6922
|
+
onCopy: handleCopyWidgets,
|
|
6923
|
+
onSelectWidget: handleSelectWidget,
|
|
6924
|
+
selectedWidgets
|
|
6925
|
+
},
|
|
6926
|
+
widgetId
|
|
6927
|
+
)) })
|
|
6928
|
+
] });
|
|
6929
|
+
};
|
|
6930
|
+
var AdminPageRender_default = AdminPageRender;
|
|
6931
|
+
function extractImageValue(value) {
|
|
6932
|
+
if (!value) {
|
|
6933
|
+
return null;
|
|
6934
|
+
}
|
|
6935
|
+
return value.hasOwnProperty("image") ? value.image : value;
|
|
6936
|
+
}
|
|
6937
|
+
var extractImageValue_default = extractImageValue;
|
|
6631
6938
|
}
|
|
6632
6939
|
});
|
|
6633
6940
|
|
package/package.json
CHANGED
package/.turbo/turbo-format.log
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @raketa-builder/markdown-input@0.4.0 format
|
|
3
|
-
> prettier --write .
|
|
4
|
-
|
|
5
|
-
biome.json 484ms (unchanged)
|
|
6
|
-
CHANGELOG.md 308ms (unchanged)
|
|
7
|
-
dist/index.js 3822ms
|
|
8
|
-
package.json 45ms (unchanged)
|
|
9
|
-
src/index.js 5ms (unchanged)
|
|
10
|
-
src/MarkdownInput.js 330ms (unchanged)
|
|
11
|
-
src/styles.css 418ms (unchanged)
|
|
12
|
-
tsconfig.json 3ms
|
package/.turbo/turbo-lint.log
DELETED