@codee-sh/medusa-plugin-notification-emails 1.0.1 → 1.0.2
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.
|
@@ -7,6 +7,7 @@ const reactQuery = require("@tanstack/react-query");
|
|
|
7
7
|
const Medusa = require("@medusajs/js-sdk");
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const icons = require("@medusajs/icons");
|
|
10
|
+
const reactRouterDom = require("react-router-dom");
|
|
10
11
|
const LexicalExtensionComposer = require("@lexical/react/LexicalExtensionComposer");
|
|
11
12
|
const LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
12
13
|
const lexical = require("lexical");
|
|
@@ -14,7 +15,6 @@ const richText = require("@lexical/rich-text");
|
|
|
14
15
|
const history = require("@lexical/history");
|
|
15
16
|
const LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
16
17
|
const LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
17
|
-
const reactRouterDom = require("react-router-dom");
|
|
18
18
|
require("@react-email/components");
|
|
19
19
|
require("@react-email/render");
|
|
20
20
|
const core = require("@dnd-kit/core");
|
|
@@ -446,1252 +446,563 @@ const OrderNotificationActivityWidget = ({
|
|
|
446
446
|
adminSdk.defineWidgetConfig({
|
|
447
447
|
zone: "order.details.after"
|
|
448
448
|
});
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return new VariableNode(node.__variableName, node.__key);
|
|
455
|
-
}
|
|
456
|
-
constructor(variableName, key) {
|
|
457
|
-
super(key);
|
|
458
|
-
this.__variableName = variableName;
|
|
459
|
-
}
|
|
460
|
-
createDOM() {
|
|
461
|
-
const span = document.createElement("span");
|
|
462
|
-
span.className = "variable-node";
|
|
463
|
-
return span;
|
|
464
|
-
}
|
|
465
|
-
updateDOM() {
|
|
466
|
-
return false;
|
|
467
|
-
}
|
|
468
|
-
exportDOM() {
|
|
469
|
-
const element = document.createElement("span");
|
|
470
|
-
element.textContent = `{{${this.__variableName}}}`;
|
|
471
|
-
element.className = "variable";
|
|
472
|
-
return { element };
|
|
473
|
-
}
|
|
474
|
-
static importJSON(serializedNode) {
|
|
475
|
-
return $createVariableNode(serializedNode.variableName);
|
|
476
|
-
}
|
|
477
|
-
exportJSON() {
|
|
478
|
-
return {
|
|
479
|
-
type: "variable",
|
|
480
|
-
version: 1,
|
|
481
|
-
variableName: this.__variableName
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
isInline() {
|
|
485
|
-
return true;
|
|
486
|
-
}
|
|
487
|
-
getVariableName() {
|
|
488
|
-
return this.__variableName;
|
|
489
|
-
}
|
|
490
|
-
getTextContent() {
|
|
491
|
-
return `{{${this.__variableName}}}`;
|
|
492
|
-
}
|
|
493
|
-
decorate() {
|
|
494
|
-
return /* @__PURE__ */ jsxRuntime.jsx(VariableComponent, { variableName: this.__variableName });
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
function $createVariableNode(variableName) {
|
|
498
|
-
return new VariableNode(variableName);
|
|
499
|
-
}
|
|
500
|
-
function VariableComponent({ variableName }) {
|
|
501
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
502
|
-
"span",
|
|
503
|
-
{
|
|
504
|
-
className: "inline-flex items-center px-1.5 py-0.5 mx-0.5 rounded text-xs font-mono bg-violet-100 text-violet-700 border border-violet-200",
|
|
505
|
-
contentEditable: false,
|
|
506
|
-
children: `{{${variableName}}}`
|
|
449
|
+
function _extends() {
|
|
450
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
451
|
+
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
452
|
+
var t2 = arguments[e2];
|
|
453
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n2[r] = t2[r]);
|
|
507
454
|
}
|
|
508
|
-
|
|
455
|
+
return n2;
|
|
456
|
+
}, _extends.apply(null, arguments);
|
|
509
457
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
constructor(key) {
|
|
518
|
-
super(key);
|
|
519
|
-
}
|
|
520
|
-
createDOM() {
|
|
521
|
-
const div = document.createElement("div");
|
|
522
|
-
div.className = "editor-divider";
|
|
523
|
-
div.setAttribute("data-lexical-decorator", "true");
|
|
524
|
-
div.setAttribute("contenteditable", "false");
|
|
525
|
-
return div;
|
|
526
|
-
}
|
|
527
|
-
updateDOM() {
|
|
528
|
-
return false;
|
|
529
|
-
}
|
|
530
|
-
exportDOM() {
|
|
531
|
-
const element = document.createElement("hr");
|
|
532
|
-
return { element };
|
|
533
|
-
}
|
|
534
|
-
static importJSON() {
|
|
535
|
-
return $createDividerBlockNode();
|
|
536
|
-
}
|
|
537
|
-
exportJSON() {
|
|
538
|
-
return {
|
|
539
|
-
type: "divider-block",
|
|
540
|
-
version: 1
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
isInline() {
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
|
-
decorate() {
|
|
547
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DividerBlockComponent, { nodeKey: this.__key });
|
|
458
|
+
function _objectWithoutPropertiesLoose(r, e2) {
|
|
459
|
+
if (null == r) return {};
|
|
460
|
+
var t2 = {};
|
|
461
|
+
for (var n2 in r) if ({}.hasOwnProperty.call(r, n2)) {
|
|
462
|
+
if (-1 !== e2.indexOf(n2)) continue;
|
|
463
|
+
t2[n2] = r[n2];
|
|
548
464
|
}
|
|
465
|
+
return t2;
|
|
549
466
|
}
|
|
550
|
-
|
|
551
|
-
|
|
467
|
+
var initialState$5 = {};
|
|
468
|
+
var Context$6 = /* @__PURE__ */ React.createContext(initialState$5);
|
|
469
|
+
var reducer$5 = (state, action) => _extends({}, state, action);
|
|
470
|
+
var useShowToolsStore = () => {
|
|
471
|
+
return React.useContext(Context$6);
|
|
472
|
+
};
|
|
473
|
+
var DispatchShowTools = /* @__PURE__ */ React.createContext(() => {
|
|
474
|
+
});
|
|
475
|
+
DispatchShowTools.displayName = "JVR.DispatchShowTools";
|
|
476
|
+
function useShowTools() {
|
|
477
|
+
return React.useReducer(reducer$5, initialState$5);
|
|
552
478
|
}
|
|
553
|
-
function
|
|
554
|
-
return
|
|
555
|
-
"div",
|
|
556
|
-
{
|
|
557
|
-
className: "editor-block py-4 cursor-pointer",
|
|
558
|
-
"data-block-key": nodeKey,
|
|
559
|
-
"data-block-type": "divider",
|
|
560
|
-
children: [
|
|
561
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-muted mb-1 uppercase tracking-wide", children: "Divider" }),
|
|
562
|
-
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-t-2 border-ui-border-base" })
|
|
563
|
-
]
|
|
564
|
-
}
|
|
565
|
-
);
|
|
479
|
+
function useShowToolsDispatch() {
|
|
480
|
+
return React.useContext(DispatchShowTools);
|
|
566
481
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
element.className = "button";
|
|
594
|
-
return { element };
|
|
595
|
-
}
|
|
596
|
-
static importJSON(serializedNode) {
|
|
597
|
-
return $createButtonBlockNode(serializedNode.text, serializedNode.url);
|
|
598
|
-
}
|
|
599
|
-
exportJSON() {
|
|
600
|
-
return {
|
|
601
|
-
type: "button-block",
|
|
602
|
-
version: 1,
|
|
603
|
-
text: this.__text,
|
|
604
|
-
url: this.__url
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
isInline() {
|
|
608
|
-
return false;
|
|
609
|
-
}
|
|
610
|
-
getText() {
|
|
611
|
-
return this.__text;
|
|
612
|
-
}
|
|
613
|
-
getUrl() {
|
|
614
|
-
return this.__url;
|
|
615
|
-
}
|
|
616
|
-
setText(text) {
|
|
617
|
-
const writable = this.getWritable();
|
|
618
|
-
writable.__text = text;
|
|
619
|
-
}
|
|
620
|
-
setUrl(url) {
|
|
621
|
-
const writable = this.getWritable();
|
|
622
|
-
writable.__url = url;
|
|
623
|
-
}
|
|
624
|
-
decorate() {
|
|
625
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ButtonBlockComponent, { nodeKey: this.__key, text: this.__text, url: this.__url });
|
|
626
|
-
}
|
|
482
|
+
var ShowTools = (_ref) => {
|
|
483
|
+
var {
|
|
484
|
+
initial,
|
|
485
|
+
dispatch,
|
|
486
|
+
children
|
|
487
|
+
} = _ref;
|
|
488
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$6.Provider, {
|
|
489
|
+
value: initial,
|
|
490
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchShowTools.Provider, {
|
|
491
|
+
value: dispatch,
|
|
492
|
+
children
|
|
493
|
+
})
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
ShowTools.displayName = "JVR.ShowTools";
|
|
497
|
+
var initialState$4 = {};
|
|
498
|
+
var Context$5 = /* @__PURE__ */ React.createContext(initialState$4);
|
|
499
|
+
var reducer$4 = (state, action) => _extends({}, state, action);
|
|
500
|
+
var useExpandsStore = () => {
|
|
501
|
+
return React.useContext(Context$5);
|
|
502
|
+
};
|
|
503
|
+
var DispatchExpands = /* @__PURE__ */ React.createContext(() => {
|
|
504
|
+
});
|
|
505
|
+
DispatchExpands.displayName = "JVR.DispatchExpands";
|
|
506
|
+
function useExpands() {
|
|
507
|
+
return React.useReducer(reducer$4, initialState$4);
|
|
627
508
|
}
|
|
628
|
-
function
|
|
629
|
-
return
|
|
509
|
+
function useExpandsDispatch() {
|
|
510
|
+
return React.useContext(DispatchExpands);
|
|
630
511
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
512
|
+
var Expands = (_ref) => {
|
|
513
|
+
var {
|
|
514
|
+
initial,
|
|
515
|
+
dispatch,
|
|
516
|
+
children
|
|
517
|
+
} = _ref;
|
|
518
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$5.Provider, {
|
|
519
|
+
value: initial,
|
|
520
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchExpands.Provider, {
|
|
521
|
+
value: dispatch,
|
|
522
|
+
children
|
|
523
|
+
})
|
|
524
|
+
});
|
|
525
|
+
};
|
|
526
|
+
Expands.displayName = "JVR.Expands";
|
|
527
|
+
var initialState$3 = {
|
|
528
|
+
Str: {
|
|
529
|
+
as: "span",
|
|
530
|
+
"data-type": "string",
|
|
531
|
+
style: {
|
|
532
|
+
color: "var(--w-rjv-type-string-color, #cb4b16)"
|
|
533
|
+
},
|
|
534
|
+
className: "w-rjv-type",
|
|
535
|
+
children: "string"
|
|
536
|
+
},
|
|
537
|
+
Url: {
|
|
538
|
+
as: "a",
|
|
539
|
+
style: {
|
|
540
|
+
color: "var(--w-rjv-type-url-color, #0969da)"
|
|
541
|
+
},
|
|
542
|
+
"data-type": "url",
|
|
543
|
+
className: "w-rjv-type",
|
|
544
|
+
children: "url"
|
|
545
|
+
},
|
|
546
|
+
Undefined: {
|
|
547
|
+
style: {
|
|
548
|
+
color: "var(--w-rjv-type-undefined-color, #586e75)"
|
|
549
|
+
},
|
|
550
|
+
as: "span",
|
|
551
|
+
"data-type": "undefined",
|
|
552
|
+
className: "w-rjv-type",
|
|
553
|
+
children: "undefined"
|
|
554
|
+
},
|
|
555
|
+
Null: {
|
|
556
|
+
style: {
|
|
557
|
+
color: "var(--w-rjv-type-null-color, #d33682)"
|
|
558
|
+
},
|
|
559
|
+
as: "span",
|
|
560
|
+
"data-type": "null",
|
|
561
|
+
className: "w-rjv-type",
|
|
562
|
+
children: "null"
|
|
563
|
+
},
|
|
564
|
+
Map: {
|
|
565
|
+
style: {
|
|
566
|
+
color: "var(--w-rjv-type-map-color, #268bd2)",
|
|
567
|
+
marginRight: 3
|
|
568
|
+
},
|
|
569
|
+
as: "span",
|
|
570
|
+
"data-type": "map",
|
|
571
|
+
className: "w-rjv-type",
|
|
572
|
+
children: "Map"
|
|
573
|
+
},
|
|
574
|
+
Nan: {
|
|
575
|
+
style: {
|
|
576
|
+
color: "var(--w-rjv-type-nan-color, #859900)"
|
|
577
|
+
},
|
|
578
|
+
as: "span",
|
|
579
|
+
"data-type": "nan",
|
|
580
|
+
className: "w-rjv-type",
|
|
581
|
+
children: "NaN"
|
|
582
|
+
},
|
|
583
|
+
Bigint: {
|
|
584
|
+
style: {
|
|
585
|
+
color: "var(--w-rjv-type-bigint-color, #268bd2)"
|
|
586
|
+
},
|
|
587
|
+
as: "span",
|
|
588
|
+
"data-type": "bigint",
|
|
589
|
+
className: "w-rjv-type",
|
|
590
|
+
children: "bigint"
|
|
591
|
+
},
|
|
592
|
+
Int: {
|
|
593
|
+
style: {
|
|
594
|
+
color: "var(--w-rjv-type-int-color, #268bd2)"
|
|
595
|
+
},
|
|
596
|
+
as: "span",
|
|
597
|
+
"data-type": "int",
|
|
598
|
+
className: "w-rjv-type",
|
|
599
|
+
children: "int"
|
|
600
|
+
},
|
|
601
|
+
Set: {
|
|
602
|
+
style: {
|
|
603
|
+
color: "var(--w-rjv-type-set-color, #268bd2)",
|
|
604
|
+
marginRight: 3
|
|
605
|
+
},
|
|
606
|
+
as: "span",
|
|
607
|
+
"data-type": "set",
|
|
608
|
+
className: "w-rjv-type",
|
|
609
|
+
children: "Set"
|
|
610
|
+
},
|
|
611
|
+
Float: {
|
|
612
|
+
style: {
|
|
613
|
+
color: "var(--w-rjv-type-float-color, #859900)"
|
|
614
|
+
},
|
|
615
|
+
as: "span",
|
|
616
|
+
"data-type": "float",
|
|
617
|
+
className: "w-rjv-type",
|
|
618
|
+
children: "float"
|
|
619
|
+
},
|
|
620
|
+
True: {
|
|
621
|
+
style: {
|
|
622
|
+
color: "var(--w-rjv-type-boolean-color, #2aa198)"
|
|
623
|
+
},
|
|
624
|
+
as: "span",
|
|
625
|
+
"data-type": "bool",
|
|
626
|
+
className: "w-rjv-type",
|
|
627
|
+
children: "bool"
|
|
628
|
+
},
|
|
629
|
+
False: {
|
|
630
|
+
style: {
|
|
631
|
+
color: "var(--w-rjv-type-boolean-color, #2aa198)"
|
|
632
|
+
},
|
|
633
|
+
as: "span",
|
|
634
|
+
"data-type": "bool",
|
|
635
|
+
className: "w-rjv-type",
|
|
636
|
+
children: "bool"
|
|
637
|
+
},
|
|
638
|
+
Date: {
|
|
639
|
+
style: {
|
|
640
|
+
color: "var(--w-rjv-type-date-color, #268bd2)"
|
|
641
|
+
},
|
|
642
|
+
as: "span",
|
|
643
|
+
"data-type": "date",
|
|
644
|
+
className: "w-rjv-type",
|
|
645
|
+
children: "date"
|
|
690
646
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
] });
|
|
647
|
+
};
|
|
648
|
+
var Context$4 = /* @__PURE__ */ React.createContext(initialState$3);
|
|
649
|
+
var reducer$3 = (state, action) => _extends({}, state, action);
|
|
650
|
+
var useTypesStore = () => {
|
|
651
|
+
return React.useContext(Context$4);
|
|
652
|
+
};
|
|
653
|
+
var DispatchTypes = /* @__PURE__ */ React.createContext(() => {
|
|
654
|
+
});
|
|
655
|
+
DispatchTypes.displayName = "JVR.DispatchTypes";
|
|
656
|
+
function useTypes() {
|
|
657
|
+
return React.useReducer(reducer$3, initialState$3);
|
|
703
658
|
}
|
|
704
|
-
function
|
|
705
|
-
|
|
706
|
-
const handleMoveUp = () => {
|
|
707
|
-
if (!hoveredBlock) return;
|
|
708
|
-
editor.update(() => {
|
|
709
|
-
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
710
|
-
if (node) {
|
|
711
|
-
const prevSibling = node.getPreviousSibling();
|
|
712
|
-
if (prevSibling) {
|
|
713
|
-
prevSibling.insertBefore(node);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
};
|
|
718
|
-
const handleMoveDown = () => {
|
|
719
|
-
if (!hoveredBlock) return;
|
|
720
|
-
editor.update(() => {
|
|
721
|
-
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
722
|
-
if (node) {
|
|
723
|
-
const nextSibling = node.getNextSibling();
|
|
724
|
-
if (nextSibling) {
|
|
725
|
-
nextSibling.insertAfter(node);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
};
|
|
730
|
-
const handleDelete = () => {
|
|
731
|
-
if (!hoveredBlock) return;
|
|
732
|
-
editor.update(() => {
|
|
733
|
-
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
734
|
-
if (node) {
|
|
735
|
-
node.remove();
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
};
|
|
739
|
-
const isVisible = hoveredBlock && hoveredBlock.type !== "variable";
|
|
740
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
-
"div",
|
|
742
|
-
{
|
|
743
|
-
className: `pointer-events-auto absolute z-[100] transition-opacity duration-150 ${isVisible ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
744
|
-
style: {
|
|
745
|
-
top: (hoveredBlock == null ? void 0 : hoveredBlock.top) ?? 0,
|
|
746
|
-
left: 8
|
|
747
|
-
},
|
|
748
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
750
|
-
"button",
|
|
751
|
-
{
|
|
752
|
-
onClick: handleMoveUp,
|
|
753
|
-
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted border border-ui-border-base text-xs",
|
|
754
|
-
title: "Przesuń w górę",
|
|
755
|
-
children: "↑"
|
|
756
|
-
}
|
|
757
|
-
),
|
|
758
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
759
|
-
"button",
|
|
760
|
-
{
|
|
761
|
-
onClick: handleMoveDown,
|
|
762
|
-
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted border border-ui-border-base text-xs",
|
|
763
|
-
title: "Przesuń w dół",
|
|
764
|
-
children: "↓"
|
|
765
|
-
}
|
|
766
|
-
),
|
|
767
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
-
"button",
|
|
769
|
-
{
|
|
770
|
-
onClick: handleDelete,
|
|
771
|
-
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted hover:text-ui-fg-error border border-ui-border-base text-xs",
|
|
772
|
-
title: "Usuń",
|
|
773
|
-
children: "✕"
|
|
774
|
-
}
|
|
775
|
-
)
|
|
776
|
-
] })
|
|
777
|
-
}
|
|
778
|
-
);
|
|
659
|
+
function useTypesDispatch() {
|
|
660
|
+
return React.useContext(DispatchTypes);
|
|
779
661
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (customBlock) {
|
|
794
|
-
blockElement = customBlock;
|
|
795
|
-
nodeKey = customBlock.dataset.blockKey || null;
|
|
796
|
-
blockType = customBlock.dataset.blockType || null;
|
|
797
|
-
}
|
|
798
|
-
if (!blockElement) {
|
|
799
|
-
const paragraph = target.closest("p.editor-paragraph");
|
|
800
|
-
if (paragraph) {
|
|
801
|
-
blockElement = paragraph;
|
|
802
|
-
blockType = "paragraph";
|
|
803
|
-
editor.getEditorState().read(() => {
|
|
804
|
-
const root = lexical.$getRoot();
|
|
805
|
-
const children2 = root.getChildren();
|
|
806
|
-
for (const child of children2) {
|
|
807
|
-
const childElement = editor.getElementByKey(child.getKey());
|
|
808
|
-
if (childElement === paragraph) {
|
|
809
|
-
nodeKey = child.getKey();
|
|
810
|
-
break;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
if (blockElement && nodeKey) {
|
|
817
|
-
const containerRect = container.getBoundingClientRect();
|
|
818
|
-
const blockRect = blockElement.getBoundingClientRect();
|
|
819
|
-
setHoveredBlock({
|
|
820
|
-
key: nodeKey,
|
|
821
|
-
top: blockRect.top - containerRect.top,
|
|
822
|
-
type: blockType || "unknown"
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
const handleMouseLeave = () => {
|
|
827
|
-
setHoveredBlock(null);
|
|
828
|
-
};
|
|
829
|
-
container.addEventListener("mousemove", handleMouseMove, { capture: true });
|
|
830
|
-
container.addEventListener("mouseleave", handleMouseLeave);
|
|
831
|
-
return () => {
|
|
832
|
-
container.removeEventListener("mousemove", handleMouseMove, { capture: true });
|
|
833
|
-
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
834
|
-
};
|
|
835
|
-
}, [editor]);
|
|
836
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
837
|
-
"div",
|
|
838
|
-
{
|
|
839
|
-
ref: containerRef,
|
|
840
|
-
className: "editor-inner relative pl-12 py-4 pr-4",
|
|
841
|
-
children: [
|
|
842
|
-
/* @__PURE__ */ jsxRuntime.jsx(FloatingBlockToolbar, { hoveredBlock }),
|
|
843
|
-
children
|
|
844
|
-
]
|
|
845
|
-
}
|
|
846
|
-
);
|
|
662
|
+
function Types(_ref) {
|
|
663
|
+
var {
|
|
664
|
+
initial,
|
|
665
|
+
dispatch,
|
|
666
|
+
children
|
|
667
|
+
} = _ref;
|
|
668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$4.Provider, {
|
|
669
|
+
value: initial,
|
|
670
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchTypes.Provider, {
|
|
671
|
+
value: dispatch,
|
|
672
|
+
children
|
|
673
|
+
})
|
|
674
|
+
});
|
|
847
675
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
676
|
+
Types.displayName = "JVR.Types";
|
|
677
|
+
var _excluded$a = ["style"];
|
|
678
|
+
function TriangleArrow(props) {
|
|
679
|
+
var {
|
|
680
|
+
style
|
|
681
|
+
} = props, reset = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
682
|
+
var defaultStyle = _extends({
|
|
683
|
+
cursor: "pointer",
|
|
684
|
+
height: "1em",
|
|
685
|
+
width: "1em",
|
|
686
|
+
userSelect: "none",
|
|
687
|
+
display: "inline-flex"
|
|
688
|
+
}, style);
|
|
689
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", _extends({
|
|
690
|
+
viewBox: "0 0 24 24",
|
|
691
|
+
fill: "var(--w-rjv-arrow-color, currentColor)",
|
|
692
|
+
style: defaultStyle
|
|
693
|
+
}, reset, {
|
|
694
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
695
|
+
d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
|
696
|
+
})
|
|
697
|
+
}));
|
|
698
|
+
}
|
|
699
|
+
TriangleArrow.displayName = "JVR.TriangleArrow";
|
|
700
|
+
var initialState$2 = {
|
|
701
|
+
Arrow: {
|
|
702
|
+
as: "span",
|
|
703
|
+
className: "w-rjv-arrow",
|
|
704
|
+
style: {
|
|
705
|
+
transform: "rotate(0deg)",
|
|
706
|
+
transition: "all 0.3s"
|
|
707
|
+
},
|
|
708
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TriangleArrow, {})
|
|
709
|
+
},
|
|
710
|
+
Colon: {
|
|
711
|
+
as: "span",
|
|
712
|
+
style: {
|
|
713
|
+
color: "var(--w-rjv-colon-color, var(--w-rjv-color))",
|
|
714
|
+
marginLeft: 0,
|
|
715
|
+
marginRight: 2
|
|
716
|
+
},
|
|
717
|
+
className: "w-rjv-colon",
|
|
718
|
+
children: ":"
|
|
719
|
+
},
|
|
720
|
+
Quote: {
|
|
721
|
+
as: "span",
|
|
722
|
+
style: {
|
|
723
|
+
color: "var(--w-rjv-quotes-color, #236a7c)"
|
|
724
|
+
},
|
|
725
|
+
className: "w-rjv-quotes",
|
|
726
|
+
children: '"'
|
|
727
|
+
},
|
|
728
|
+
ValueQuote: {
|
|
729
|
+
as: "span",
|
|
730
|
+
style: {
|
|
731
|
+
color: "var(--w-rjv-quotes-string-color, #cb4b16)"
|
|
732
|
+
},
|
|
733
|
+
className: "w-rjv-quotes",
|
|
734
|
+
children: '"'
|
|
735
|
+
},
|
|
736
|
+
BracketsLeft: {
|
|
737
|
+
as: "span",
|
|
738
|
+
style: {
|
|
739
|
+
color: "var(--w-rjv-brackets-color, #236a7c)"
|
|
740
|
+
},
|
|
741
|
+
className: "w-rjv-brackets-start",
|
|
742
|
+
children: "["
|
|
743
|
+
},
|
|
744
|
+
BracketsRight: {
|
|
745
|
+
as: "span",
|
|
746
|
+
style: {
|
|
747
|
+
color: "var(--w-rjv-brackets-color, #236a7c)"
|
|
748
|
+
},
|
|
749
|
+
className: "w-rjv-brackets-end",
|
|
750
|
+
children: "]"
|
|
751
|
+
},
|
|
752
|
+
BraceLeft: {
|
|
753
|
+
as: "span",
|
|
754
|
+
style: {
|
|
755
|
+
color: "var(--w-rjv-curlybraces-color, #236a7c)"
|
|
756
|
+
},
|
|
757
|
+
className: "w-rjv-curlybraces-start",
|
|
758
|
+
children: "{"
|
|
759
|
+
},
|
|
760
|
+
BraceRight: {
|
|
761
|
+
as: "span",
|
|
762
|
+
style: {
|
|
763
|
+
color: "var(--w-rjv-curlybraces-color, #236a7c)"
|
|
764
|
+
},
|
|
765
|
+
className: "w-rjv-curlybraces-end",
|
|
766
|
+
children: "}"
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
var Context$3 = /* @__PURE__ */ React.createContext(initialState$2);
|
|
770
|
+
var reducer$2 = (state, action) => _extends({}, state, action);
|
|
771
|
+
var useSymbolsStore = () => {
|
|
772
|
+
return React.useContext(Context$3);
|
|
773
|
+
};
|
|
774
|
+
var DispatchSymbols = /* @__PURE__ */ React.createContext(() => {
|
|
775
|
+
});
|
|
776
|
+
DispatchSymbols.displayName = "JVR.DispatchSymbols";
|
|
777
|
+
function useSymbols() {
|
|
778
|
+
return React.useReducer(reducer$2, initialState$2);
|
|
779
|
+
}
|
|
780
|
+
function useSymbolsDispatch() {
|
|
781
|
+
return React.useContext(DispatchSymbols);
|
|
782
|
+
}
|
|
783
|
+
var Symbols = (_ref) => {
|
|
784
|
+
var {
|
|
785
|
+
initial,
|
|
786
|
+
dispatch,
|
|
787
|
+
children
|
|
788
|
+
} = _ref;
|
|
789
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$3.Provider, {
|
|
790
|
+
value: initial,
|
|
791
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchSymbols.Provider, {
|
|
792
|
+
value: dispatch,
|
|
793
|
+
children
|
|
794
|
+
})
|
|
795
|
+
});
|
|
796
|
+
};
|
|
797
|
+
Symbols.displayName = "JVR.Symbols";
|
|
798
|
+
var initialState$1 = {
|
|
799
|
+
Copied: {
|
|
800
|
+
className: "w-rjv-copied",
|
|
801
|
+
style: {
|
|
802
|
+
height: "1em",
|
|
803
|
+
width: "1em",
|
|
804
|
+
cursor: "pointer",
|
|
805
|
+
verticalAlign: "middle",
|
|
806
|
+
marginLeft: 5
|
|
880
807
|
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const newValue = currentValue.slice(0, selectionStart) + text + currentValue.slice(selectionEnd);
|
|
890
|
-
const nativeInputValueSetter = (_a = Object.getOwnPropertyDescriptor(
|
|
891
|
-
element instanceof HTMLTextAreaElement ? window.HTMLTextAreaElement.prototype : window.HTMLInputElement.prototype,
|
|
892
|
-
"value"
|
|
893
|
-
)) == null ? void 0 : _a.set;
|
|
894
|
-
nativeInputValueSetter == null ? void 0 : nativeInputValueSetter.call(element, newValue);
|
|
895
|
-
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
896
|
-
setTimeout(() => {
|
|
897
|
-
element.focus();
|
|
898
|
-
element.setSelectionRange(selectionStart + text.length, selectionStart + text.length);
|
|
899
|
-
}, 0);
|
|
900
|
-
lastActiveFieldRef.current = null;
|
|
901
|
-
} else {
|
|
902
|
-
editor.dispatchCommand(INSERT_VARIABLE_COMMAND2, variable);
|
|
808
|
+
},
|
|
809
|
+
CountInfo: {
|
|
810
|
+
as: "span",
|
|
811
|
+
className: "w-rjv-object-size",
|
|
812
|
+
style: {
|
|
813
|
+
color: "var(--w-rjv-info-color, #0000004d)",
|
|
814
|
+
paddingLeft: 8,
|
|
815
|
+
fontStyle: "italic"
|
|
903
816
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 p-2 border-b border-ui-border-base bg-ui-bg-subtle sticky top-0 z-10", children: [
|
|
919
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
920
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
921
|
-
"button",
|
|
922
|
-
{
|
|
923
|
-
type: "button",
|
|
924
|
-
onClick: () => setShowBlockMenu(!showBlockMenu),
|
|
925
|
-
className: "flex items-center gap-1 px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm",
|
|
926
|
-
children: [
|
|
927
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Plus, { className: "w-4 h-4" }),
|
|
928
|
-
"Blok"
|
|
929
|
-
]
|
|
930
|
-
}
|
|
931
|
-
),
|
|
932
|
-
showBlockMenu && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-0 mt-1 bg-ui-bg-base border border-ui-border-base rounded shadow-lg z-20 min-w-[150px]", children: [
|
|
933
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
934
|
-
"button",
|
|
935
|
-
{
|
|
936
|
-
type: "button",
|
|
937
|
-
onClick: insertParagraph,
|
|
938
|
-
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
939
|
-
children: [
|
|
940
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "¶" }),
|
|
941
|
-
"Paragraph"
|
|
942
|
-
]
|
|
943
|
-
}
|
|
944
|
-
),
|
|
945
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
946
|
-
"button",
|
|
947
|
-
{
|
|
948
|
-
type: "button",
|
|
949
|
-
onClick: insertDivider,
|
|
950
|
-
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
951
|
-
children: [
|
|
952
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "―" }),
|
|
953
|
-
"Divider"
|
|
954
|
-
]
|
|
955
|
-
}
|
|
956
|
-
),
|
|
957
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
958
|
-
"button",
|
|
959
|
-
{
|
|
960
|
-
type: "button",
|
|
961
|
-
onClick: insertButton,
|
|
962
|
-
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
963
|
-
children: [
|
|
964
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "▢" }),
|
|
965
|
-
"Button"
|
|
966
|
-
]
|
|
967
|
-
}
|
|
968
|
-
)
|
|
969
|
-
] })
|
|
970
|
-
] }),
|
|
971
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px bg-ui-border-base mx-1" }),
|
|
972
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
973
|
-
"button",
|
|
974
|
-
{
|
|
975
|
-
type: "button",
|
|
976
|
-
onClick: formatBold,
|
|
977
|
-
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm font-bold",
|
|
978
|
-
title: "Pogrubienie",
|
|
979
|
-
children: "B"
|
|
980
|
-
}
|
|
981
|
-
),
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
983
|
-
"button",
|
|
984
|
-
{
|
|
985
|
-
type: "button",
|
|
986
|
-
onClick: formatItalic,
|
|
987
|
-
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm italic",
|
|
988
|
-
title: "Kursywa",
|
|
989
|
-
children: "I"
|
|
990
|
-
}
|
|
991
|
-
),
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px bg-ui-border-base mx-1" }),
|
|
993
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
994
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
995
|
-
"button",
|
|
996
|
-
{
|
|
997
|
-
type: "button",
|
|
998
|
-
onMouseDown: captureActiveField,
|
|
999
|
-
onClick: () => setShowVariables(!showVariables),
|
|
1000
|
-
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm font-mono",
|
|
1001
|
-
title: "Wstaw zmienną",
|
|
1002
|
-
children: "{{ }}"
|
|
1003
|
-
}
|
|
1004
|
-
),
|
|
1005
|
-
showVariables && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-0 mt-1 bg-ui-bg-base border border-ui-border-base rounded shadow-lg z-20 min-w-[220px] max-h-48 overflow-auto", children: [
|
|
1006
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1 text-xs text-ui-fg-muted border-b border-ui-border-base", children: "Dostępne zmienne" }),
|
|
1007
|
-
AVAILABLE_VARIABLES.map((v) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1008
|
-
"button",
|
|
1009
|
-
{
|
|
1010
|
-
type: "button",
|
|
1011
|
-
onClick: () => insertVariable(v),
|
|
1012
|
-
className: "block w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm font-mono",
|
|
1013
|
-
children: `{{${v}}}`
|
|
1014
|
-
},
|
|
1015
|
-
v
|
|
1016
|
-
))
|
|
1017
|
-
] })
|
|
1018
|
-
] })
|
|
1019
|
-
] });
|
|
1020
|
-
}
|
|
1021
|
-
const INSERT_PARAGRAPH_BLOCK_COMMAND = lexical.createCommand("INSERT_PARAGRAPH_BLOCK");
|
|
1022
|
-
const INSERT_DIVIDER_COMMAND = lexical.createCommand("INSERT_DIVIDER");
|
|
1023
|
-
const INSERT_BUTTON_COMMAND = lexical.createCommand("INSERT_BUTTON");
|
|
1024
|
-
const INSERT_VARIABLE_COMMAND = lexical.createCommand("INSERT_VARIABLE");
|
|
1025
|
-
function registerBlockCommands(editor) {
|
|
1026
|
-
const unregisterParagraph = editor.registerCommand(
|
|
1027
|
-
INSERT_PARAGRAPH_BLOCK_COMMAND,
|
|
1028
|
-
() => {
|
|
1029
|
-
const paragraphNode = lexical.$createParagraphNode();
|
|
1030
|
-
lexical.$insertNodes([paragraphNode]);
|
|
1031
|
-
paragraphNode.select();
|
|
1032
|
-
return true;
|
|
1033
|
-
},
|
|
1034
|
-
lexical.COMMAND_PRIORITY_LOW
|
|
1035
|
-
);
|
|
1036
|
-
const unregisterDivider = editor.registerCommand(
|
|
1037
|
-
INSERT_DIVIDER_COMMAND,
|
|
1038
|
-
() => {
|
|
1039
|
-
const dividerNode = $createDividerBlockNode();
|
|
1040
|
-
lexical.$insertNodes([dividerNode]);
|
|
1041
|
-
return true;
|
|
1042
|
-
},
|
|
1043
|
-
lexical.COMMAND_PRIORITY_LOW
|
|
1044
|
-
);
|
|
1045
|
-
const unregisterButton = editor.registerCommand(
|
|
1046
|
-
INSERT_BUTTON_COMMAND,
|
|
1047
|
-
() => {
|
|
1048
|
-
const buttonNode = $createButtonBlockNode();
|
|
1049
|
-
lexical.$insertNodes([buttonNode]);
|
|
1050
|
-
return true;
|
|
1051
|
-
},
|
|
1052
|
-
lexical.COMMAND_PRIORITY_LOW
|
|
1053
|
-
);
|
|
1054
|
-
const unregisterVariable = editor.registerCommand(
|
|
1055
|
-
INSERT_VARIABLE_COMMAND,
|
|
1056
|
-
(variableName) => {
|
|
1057
|
-
const variableNode = $createVariableNode(variableName);
|
|
1058
|
-
lexical.$insertNodes([variableNode]);
|
|
1059
|
-
return true;
|
|
817
|
+
},
|
|
818
|
+
CountInfoExtra: {
|
|
819
|
+
as: "span",
|
|
820
|
+
className: "w-rjv-object-extra",
|
|
821
|
+
style: {
|
|
822
|
+
paddingLeft: 8
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
Ellipsis: {
|
|
826
|
+
as: "span",
|
|
827
|
+
style: {
|
|
828
|
+
cursor: "pointer",
|
|
829
|
+
color: "var(--w-rjv-ellipsis-color, #cb4b16)",
|
|
830
|
+
userSelect: "none"
|
|
1060
831
|
},
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
name: "@codee/builder-blocks",
|
|
1072
|
-
nodes: () => [VariableNode, DividerBlockNode, ButtonBlockNode],
|
|
1073
|
-
register: registerBlockCommands
|
|
1074
|
-
});
|
|
1075
|
-
const editorTheme = {
|
|
1076
|
-
paragraph: "editor-paragraph mb-1",
|
|
1077
|
-
text: {
|
|
1078
|
-
bold: "font-bold",
|
|
1079
|
-
italic: "italic",
|
|
1080
|
-
underline: "underline"
|
|
832
|
+
className: "w-rjv-ellipsis",
|
|
833
|
+
children: "..."
|
|
834
|
+
},
|
|
835
|
+
Row: {
|
|
836
|
+
as: "div",
|
|
837
|
+
className: "w-rjv-line"
|
|
838
|
+
},
|
|
839
|
+
KeyName: {
|
|
840
|
+
as: "span",
|
|
841
|
+
className: "w-rjv-object-key"
|
|
1081
842
|
}
|
|
1082
843
|
};
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
history.HistoryExtension,
|
|
1090
|
-
BuilderBlocksExtension
|
|
1091
|
-
]
|
|
844
|
+
var Context$2 = /* @__PURE__ */ React.createContext(initialState$1);
|
|
845
|
+
var reducer$1 = (state, action) => _extends({}, state, action);
|
|
846
|
+
var useSectionStore = () => {
|
|
847
|
+
return React.useContext(Context$2);
|
|
848
|
+
};
|
|
849
|
+
var DispatchSection = /* @__PURE__ */ React.createContext(() => {
|
|
1092
850
|
});
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
editorState.read(() => {
|
|
1097
|
-
const json = editorState.toJSON();
|
|
1098
|
-
setOutput(JSON.stringify(json, null, 2));
|
|
1099
|
-
});
|
|
1100
|
-
}, []);
|
|
1101
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-8", children: [
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", className: "mb-6", children: "Builder - Template Editor (Extensions API)" }),
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
|
|
1104
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1105
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-ui-fg-subtle", children: "Edytor" }),
|
|
1106
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
-
LexicalExtensionComposer.LexicalExtensionComposer,
|
|
1108
|
-
{
|
|
1109
|
-
extension: BuilderEditorExtension,
|
|
1110
|
-
contentEditable: null,
|
|
1111
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-ui-border-base rounded-lg bg-white", children: [
|
|
1112
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
-
ToolbarPlugin,
|
|
1114
|
-
{
|
|
1115
|
-
INSERT_PARAGRAPH_BLOCK_COMMAND,
|
|
1116
|
-
INSERT_DIVIDER_COMMAND,
|
|
1117
|
-
INSERT_BUTTON_COMMAND,
|
|
1118
|
-
INSERT_VARIABLE_COMMAND
|
|
1119
|
-
}
|
|
1120
|
-
),
|
|
1121
|
-
/* @__PURE__ */ jsxRuntime.jsx(EditorInner, { children: /* @__PURE__ */ jsxRuntime.jsx(LexicalContentEditable.ContentEditable, { className: "min-h-[400px] outline-none" }) }),
|
|
1122
|
-
/* @__PURE__ */ jsxRuntime.jsx(LexicalOnChangePlugin.OnChangePlugin, { onChange: handleChange })
|
|
1123
|
-
] })
|
|
1124
|
-
}
|
|
1125
|
-
)
|
|
1126
|
-
] }),
|
|
1127
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1128
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-ui-fg-subtle", children: "Output (Lexical State)" }),
|
|
1129
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle min-h-[400px] max-h-[600px] overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs font-mono whitespace-pre-wrap", children: output || "..." }) })
|
|
1130
|
-
] })
|
|
1131
|
-
] })
|
|
1132
|
-
] });
|
|
1133
|
-
};
|
|
1134
|
-
const config$6 = adminSdk.defineRouteConfig({
|
|
1135
|
-
label: "Builder - Lexical",
|
|
1136
|
-
icon: icons.PuzzleSolid
|
|
1137
|
-
});
|
|
1138
|
-
function _extends() {
|
|
1139
|
-
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
1140
|
-
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
1141
|
-
var t2 = arguments[e2];
|
|
1142
|
-
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n2[r] = t2[r]);
|
|
1143
|
-
}
|
|
1144
|
-
return n2;
|
|
1145
|
-
}, _extends.apply(null, arguments);
|
|
1146
|
-
}
|
|
1147
|
-
function _objectWithoutPropertiesLoose(r, e2) {
|
|
1148
|
-
if (null == r) return {};
|
|
1149
|
-
var t2 = {};
|
|
1150
|
-
for (var n2 in r) if ({}.hasOwnProperty.call(r, n2)) {
|
|
1151
|
-
if (-1 !== e2.indexOf(n2)) continue;
|
|
1152
|
-
t2[n2] = r[n2];
|
|
1153
|
-
}
|
|
1154
|
-
return t2;
|
|
1155
|
-
}
|
|
1156
|
-
var initialState$5 = {};
|
|
1157
|
-
var Context$6 = /* @__PURE__ */ React.createContext(initialState$5);
|
|
1158
|
-
var reducer$5 = (state, action) => _extends({}, state, action);
|
|
1159
|
-
var useShowToolsStore = () => {
|
|
1160
|
-
return React.useContext(Context$6);
|
|
1161
|
-
};
|
|
1162
|
-
var DispatchShowTools = /* @__PURE__ */ React.createContext(() => {
|
|
1163
|
-
});
|
|
1164
|
-
DispatchShowTools.displayName = "JVR.DispatchShowTools";
|
|
1165
|
-
function useShowTools() {
|
|
1166
|
-
return React.useReducer(reducer$5, initialState$5);
|
|
851
|
+
DispatchSection.displayName = "JVR.DispatchSection";
|
|
852
|
+
function useSection() {
|
|
853
|
+
return React.useReducer(reducer$1, initialState$1);
|
|
1167
854
|
}
|
|
1168
|
-
function
|
|
1169
|
-
return React.useContext(
|
|
855
|
+
function useSectionDispatch() {
|
|
856
|
+
return React.useContext(DispatchSection);
|
|
1170
857
|
}
|
|
1171
|
-
var
|
|
858
|
+
var Section = (_ref) => {
|
|
1172
859
|
var {
|
|
1173
860
|
initial,
|
|
1174
861
|
dispatch,
|
|
1175
862
|
children
|
|
1176
863
|
} = _ref;
|
|
1177
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context$
|
|
864
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$2.Provider, {
|
|
1178
865
|
value: initial,
|
|
1179
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchSection.Provider, {
|
|
1180
867
|
value: dispatch,
|
|
1181
868
|
children
|
|
1182
869
|
})
|
|
1183
870
|
});
|
|
1184
871
|
};
|
|
1185
|
-
|
|
1186
|
-
var initialState
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
var useExpandsStore = () => {
|
|
1190
|
-
return React.useContext(Context$5);
|
|
872
|
+
Section.displayName = "JVR.Section";
|
|
873
|
+
var initialState = {
|
|
874
|
+
objectSortKeys: false,
|
|
875
|
+
indentWidth: 15
|
|
1191
876
|
};
|
|
1192
|
-
var
|
|
877
|
+
var Context$1 = /* @__PURE__ */ React.createContext(initialState);
|
|
878
|
+
Context$1.displayName = "JVR.Context";
|
|
879
|
+
var DispatchContext = /* @__PURE__ */ React.createContext(() => {
|
|
1193
880
|
});
|
|
1194
|
-
|
|
1195
|
-
function
|
|
1196
|
-
return
|
|
1197
|
-
}
|
|
1198
|
-
function useExpandsDispatch() {
|
|
1199
|
-
return React.useContext(DispatchExpands);
|
|
881
|
+
DispatchContext.displayName = "JVR.DispatchContext";
|
|
882
|
+
function reducer(state, action) {
|
|
883
|
+
return _extends({}, state, action);
|
|
1200
884
|
}
|
|
1201
|
-
var
|
|
885
|
+
var useStore = () => {
|
|
886
|
+
return React.useContext(Context$1);
|
|
887
|
+
};
|
|
888
|
+
var Provider = (_ref) => {
|
|
1202
889
|
var {
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
890
|
+
children,
|
|
891
|
+
initialState: init,
|
|
892
|
+
initialTypes
|
|
1206
893
|
} = _ref;
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
894
|
+
var [state, dispatch] = React.useReducer(reducer, Object.assign({}, initialState, init));
|
|
895
|
+
var [showTools, showToolsDispatch] = useShowTools();
|
|
896
|
+
var [expands, expandsDispatch] = useExpands();
|
|
897
|
+
var [types, typesDispatch] = useTypes();
|
|
898
|
+
var [symbols, symbolsDispatch] = useSymbols();
|
|
899
|
+
var [section, sectionDispatch] = useSection();
|
|
900
|
+
React.useEffect(() => dispatch(_extends({}, init)), [init]);
|
|
901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$1.Provider, {
|
|
902
|
+
value: state,
|
|
903
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchContext.Provider, {
|
|
1210
904
|
value: dispatch,
|
|
1211
|
-
children
|
|
905
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ShowTools, {
|
|
906
|
+
initial: showTools,
|
|
907
|
+
dispatch: showToolsDispatch,
|
|
908
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Expands, {
|
|
909
|
+
initial: expands,
|
|
910
|
+
dispatch: expandsDispatch,
|
|
911
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Types, {
|
|
912
|
+
initial: _extends({}, types, initialTypes),
|
|
913
|
+
dispatch: typesDispatch,
|
|
914
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Symbols, {
|
|
915
|
+
initial: symbols,
|
|
916
|
+
dispatch: symbolsDispatch,
|
|
917
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Section, {
|
|
918
|
+
initial: section,
|
|
919
|
+
dispatch: sectionDispatch,
|
|
920
|
+
children
|
|
921
|
+
})
|
|
922
|
+
})
|
|
923
|
+
})
|
|
924
|
+
})
|
|
925
|
+
})
|
|
1212
926
|
})
|
|
1213
927
|
});
|
|
1214
928
|
};
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
as: "span",
|
|
1219
|
-
"data-type": "string",
|
|
1220
|
-
style: {
|
|
1221
|
-
color: "var(--w-rjv-type-string-color, #cb4b16)"
|
|
1222
|
-
},
|
|
1223
|
-
className: "w-rjv-type",
|
|
1224
|
-
children: "string"
|
|
1225
|
-
},
|
|
1226
|
-
Url: {
|
|
1227
|
-
as: "a",
|
|
1228
|
-
style: {
|
|
1229
|
-
color: "var(--w-rjv-type-url-color, #0969da)"
|
|
1230
|
-
},
|
|
1231
|
-
"data-type": "url",
|
|
1232
|
-
className: "w-rjv-type",
|
|
1233
|
-
children: "url"
|
|
1234
|
-
},
|
|
1235
|
-
Undefined: {
|
|
1236
|
-
style: {
|
|
1237
|
-
color: "var(--w-rjv-type-undefined-color, #586e75)"
|
|
1238
|
-
},
|
|
1239
|
-
as: "span",
|
|
1240
|
-
"data-type": "undefined",
|
|
1241
|
-
className: "w-rjv-type",
|
|
1242
|
-
children: "undefined"
|
|
1243
|
-
},
|
|
1244
|
-
Null: {
|
|
1245
|
-
style: {
|
|
1246
|
-
color: "var(--w-rjv-type-null-color, #d33682)"
|
|
1247
|
-
},
|
|
1248
|
-
as: "span",
|
|
1249
|
-
"data-type": "null",
|
|
1250
|
-
className: "w-rjv-type",
|
|
1251
|
-
children: "null"
|
|
1252
|
-
},
|
|
1253
|
-
Map: {
|
|
1254
|
-
style: {
|
|
1255
|
-
color: "var(--w-rjv-type-map-color, #268bd2)",
|
|
1256
|
-
marginRight: 3
|
|
1257
|
-
},
|
|
1258
|
-
as: "span",
|
|
1259
|
-
"data-type": "map",
|
|
1260
|
-
className: "w-rjv-type",
|
|
1261
|
-
children: "Map"
|
|
1262
|
-
},
|
|
1263
|
-
Nan: {
|
|
1264
|
-
style: {
|
|
1265
|
-
color: "var(--w-rjv-type-nan-color, #859900)"
|
|
1266
|
-
},
|
|
1267
|
-
as: "span",
|
|
1268
|
-
"data-type": "nan",
|
|
1269
|
-
className: "w-rjv-type",
|
|
1270
|
-
children: "NaN"
|
|
1271
|
-
},
|
|
1272
|
-
Bigint: {
|
|
1273
|
-
style: {
|
|
1274
|
-
color: "var(--w-rjv-type-bigint-color, #268bd2)"
|
|
1275
|
-
},
|
|
1276
|
-
as: "span",
|
|
1277
|
-
"data-type": "bigint",
|
|
1278
|
-
className: "w-rjv-type",
|
|
1279
|
-
children: "bigint"
|
|
1280
|
-
},
|
|
1281
|
-
Int: {
|
|
1282
|
-
style: {
|
|
1283
|
-
color: "var(--w-rjv-type-int-color, #268bd2)"
|
|
1284
|
-
},
|
|
1285
|
-
as: "span",
|
|
1286
|
-
"data-type": "int",
|
|
1287
|
-
className: "w-rjv-type",
|
|
1288
|
-
children: "int"
|
|
1289
|
-
},
|
|
1290
|
-
Set: {
|
|
1291
|
-
style: {
|
|
1292
|
-
color: "var(--w-rjv-type-set-color, #268bd2)",
|
|
1293
|
-
marginRight: 3
|
|
1294
|
-
},
|
|
1295
|
-
as: "span",
|
|
1296
|
-
"data-type": "set",
|
|
1297
|
-
className: "w-rjv-type",
|
|
1298
|
-
children: "Set"
|
|
1299
|
-
},
|
|
1300
|
-
Float: {
|
|
1301
|
-
style: {
|
|
1302
|
-
color: "var(--w-rjv-type-float-color, #859900)"
|
|
1303
|
-
},
|
|
1304
|
-
as: "span",
|
|
1305
|
-
"data-type": "float",
|
|
1306
|
-
className: "w-rjv-type",
|
|
1307
|
-
children: "float"
|
|
1308
|
-
},
|
|
1309
|
-
True: {
|
|
1310
|
-
style: {
|
|
1311
|
-
color: "var(--w-rjv-type-boolean-color, #2aa198)"
|
|
1312
|
-
},
|
|
1313
|
-
as: "span",
|
|
1314
|
-
"data-type": "bool",
|
|
1315
|
-
className: "w-rjv-type",
|
|
1316
|
-
children: "bool"
|
|
1317
|
-
},
|
|
1318
|
-
False: {
|
|
1319
|
-
style: {
|
|
1320
|
-
color: "var(--w-rjv-type-boolean-color, #2aa198)"
|
|
1321
|
-
},
|
|
1322
|
-
as: "span",
|
|
1323
|
-
"data-type": "bool",
|
|
1324
|
-
className: "w-rjv-type",
|
|
1325
|
-
children: "bool"
|
|
1326
|
-
},
|
|
1327
|
-
Date: {
|
|
1328
|
-
style: {
|
|
1329
|
-
color: "var(--w-rjv-type-date-color, #268bd2)"
|
|
1330
|
-
},
|
|
1331
|
-
as: "span",
|
|
1332
|
-
"data-type": "date",
|
|
1333
|
-
className: "w-rjv-type",
|
|
1334
|
-
children: "date"
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
var Context$4 = /* @__PURE__ */ React.createContext(initialState$3);
|
|
1338
|
-
var reducer$3 = (state, action) => _extends({}, state, action);
|
|
1339
|
-
var useTypesStore = () => {
|
|
1340
|
-
return React.useContext(Context$4);
|
|
1341
|
-
};
|
|
1342
|
-
var DispatchTypes = /* @__PURE__ */ React.createContext(() => {
|
|
1343
|
-
});
|
|
1344
|
-
DispatchTypes.displayName = "JVR.DispatchTypes";
|
|
1345
|
-
function useTypes() {
|
|
1346
|
-
return React.useReducer(reducer$3, initialState$3);
|
|
1347
|
-
}
|
|
1348
|
-
function useTypesDispatch() {
|
|
1349
|
-
return React.useContext(DispatchTypes);
|
|
929
|
+
Provider.displayName = "JVR.Provider";
|
|
930
|
+
function _objectDestructuringEmpty(t2) {
|
|
931
|
+
if (null == t2) throw new TypeError("Cannot destructure " + t2);
|
|
1350
932
|
}
|
|
1351
|
-
|
|
933
|
+
var _excluded$9 = ["isNumber", "value", "parentValue", "keyName", "keys"], _excluded2$5 = ["as", "render"], _excluded3$1 = ["as", "render"], _excluded4$1 = ["as", "render"], _excluded5$1 = ["as", "style", "render"], _excluded6$1 = ["as", "render"], _excluded7$1 = ["as", "render"], _excluded8$1 = ["as", "render"], _excluded9$1 = ["as", "render"];
|
|
934
|
+
var Quote$1 = (props) => {
|
|
1352
935
|
var {
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
children
|
|
1356
|
-
} = _ref;
|
|
1357
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context$4.Provider, {
|
|
1358
|
-
value: initial,
|
|
1359
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchTypes.Provider, {
|
|
1360
|
-
value: dispatch,
|
|
1361
|
-
children
|
|
1362
|
-
})
|
|
1363
|
-
});
|
|
1364
|
-
}
|
|
1365
|
-
Types.displayName = "JVR.Types";
|
|
1366
|
-
var _excluded$a = ["style"];
|
|
1367
|
-
function TriangleArrow(props) {
|
|
936
|
+
Quote: Comp = {}
|
|
937
|
+
} = useSymbolsStore();
|
|
1368
938
|
var {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
})
|
|
1386
|
-
}));
|
|
1387
|
-
}
|
|
1388
|
-
TriangleArrow.displayName = "JVR.TriangleArrow";
|
|
1389
|
-
var initialState$2 = {
|
|
1390
|
-
Arrow: {
|
|
1391
|
-
as: "span",
|
|
1392
|
-
className: "w-rjv-arrow",
|
|
1393
|
-
style: {
|
|
1394
|
-
transform: "rotate(0deg)",
|
|
1395
|
-
transition: "all 0.3s"
|
|
1396
|
-
},
|
|
1397
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TriangleArrow, {})
|
|
1398
|
-
},
|
|
1399
|
-
Colon: {
|
|
1400
|
-
as: "span",
|
|
1401
|
-
style: {
|
|
1402
|
-
color: "var(--w-rjv-colon-color, var(--w-rjv-color))",
|
|
1403
|
-
marginLeft: 0,
|
|
1404
|
-
marginRight: 2
|
|
1405
|
-
},
|
|
1406
|
-
className: "w-rjv-colon",
|
|
1407
|
-
children: ":"
|
|
1408
|
-
},
|
|
1409
|
-
Quote: {
|
|
1410
|
-
as: "span",
|
|
1411
|
-
style: {
|
|
1412
|
-
color: "var(--w-rjv-quotes-color, #236a7c)"
|
|
1413
|
-
},
|
|
1414
|
-
className: "w-rjv-quotes",
|
|
1415
|
-
children: '"'
|
|
1416
|
-
},
|
|
1417
|
-
ValueQuote: {
|
|
1418
|
-
as: "span",
|
|
1419
|
-
style: {
|
|
1420
|
-
color: "var(--w-rjv-quotes-string-color, #cb4b16)"
|
|
1421
|
-
},
|
|
1422
|
-
className: "w-rjv-quotes",
|
|
1423
|
-
children: '"'
|
|
1424
|
-
},
|
|
1425
|
-
BracketsLeft: {
|
|
1426
|
-
as: "span",
|
|
1427
|
-
style: {
|
|
1428
|
-
color: "var(--w-rjv-brackets-color, #236a7c)"
|
|
1429
|
-
},
|
|
1430
|
-
className: "w-rjv-brackets-start",
|
|
1431
|
-
children: "["
|
|
1432
|
-
},
|
|
1433
|
-
BracketsRight: {
|
|
1434
|
-
as: "span",
|
|
1435
|
-
style: {
|
|
1436
|
-
color: "var(--w-rjv-brackets-color, #236a7c)"
|
|
1437
|
-
},
|
|
1438
|
-
className: "w-rjv-brackets-end",
|
|
1439
|
-
children: "]"
|
|
1440
|
-
},
|
|
1441
|
-
BraceLeft: {
|
|
1442
|
-
as: "span",
|
|
1443
|
-
style: {
|
|
1444
|
-
color: "var(--w-rjv-curlybraces-color, #236a7c)"
|
|
1445
|
-
},
|
|
1446
|
-
className: "w-rjv-curlybraces-start",
|
|
1447
|
-
children: "{"
|
|
1448
|
-
},
|
|
1449
|
-
BraceRight: {
|
|
1450
|
-
as: "span",
|
|
1451
|
-
style: {
|
|
1452
|
-
color: "var(--w-rjv-curlybraces-color, #236a7c)"
|
|
1453
|
-
},
|
|
1454
|
-
className: "w-rjv-curlybraces-end",
|
|
1455
|
-
children: "}"
|
|
939
|
+
isNumber,
|
|
940
|
+
value,
|
|
941
|
+
parentValue,
|
|
942
|
+
keyName,
|
|
943
|
+
keys
|
|
944
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
945
|
+
if (isNumber) return null;
|
|
946
|
+
var {
|
|
947
|
+
as,
|
|
948
|
+
render
|
|
949
|
+
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded2$5);
|
|
950
|
+
var Elm = as || "span";
|
|
951
|
+
var elmProps = _extends({}, other, reset);
|
|
952
|
+
if (typeof elmProps.children === "string") {
|
|
953
|
+
var trimmed = elmProps.children.trim();
|
|
954
|
+
elmProps.children = trimmed || void 0;
|
|
1456
955
|
}
|
|
956
|
+
var result = {
|
|
957
|
+
value,
|
|
958
|
+
parentValue,
|
|
959
|
+
keyName,
|
|
960
|
+
keys: keys || (keyName ? [keyName] : [])
|
|
961
|
+
};
|
|
962
|
+
var child = render && typeof render === "function" && render(elmProps, result);
|
|
963
|
+
if (child) return child;
|
|
964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, elmProps));
|
|
1457
965
|
};
|
|
1458
|
-
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1461
|
-
|
|
966
|
+
Quote$1.displayName = "JVR.Quote";
|
|
967
|
+
var ValueQuote$1 = (props) => {
|
|
968
|
+
var {
|
|
969
|
+
ValueQuote: Comp = {}
|
|
970
|
+
} = useSymbolsStore();
|
|
971
|
+
var other = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
972
|
+
var {
|
|
973
|
+
as,
|
|
974
|
+
render
|
|
975
|
+
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded3$1);
|
|
976
|
+
var Elm = as || "span";
|
|
977
|
+
var elmProps = _extends({}, other, reset);
|
|
978
|
+
var child = render && typeof render === "function" && render(elmProps, {});
|
|
979
|
+
if (child) return child;
|
|
980
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, elmProps));
|
|
1462
981
|
};
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
DispatchSymbols.displayName = "JVR.DispatchSymbols";
|
|
1466
|
-
function useSymbols() {
|
|
1467
|
-
return React.useReducer(reducer$2, initialState$2);
|
|
1468
|
-
}
|
|
1469
|
-
function useSymbolsDispatch() {
|
|
1470
|
-
return React.useContext(DispatchSymbols);
|
|
1471
|
-
}
|
|
1472
|
-
var Symbols = (_ref) => {
|
|
982
|
+
ValueQuote$1.displayName = "JVR.ValueQuote";
|
|
983
|
+
var Colon$1 = (props) => {
|
|
1473
984
|
var {
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
985
|
+
value,
|
|
986
|
+
parentValue,
|
|
987
|
+
keyName,
|
|
988
|
+
keys
|
|
989
|
+
} = props;
|
|
990
|
+
var {
|
|
991
|
+
Colon: Comp = {}
|
|
992
|
+
} = useSymbolsStore();
|
|
993
|
+
var {
|
|
994
|
+
as,
|
|
995
|
+
render
|
|
996
|
+
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded4$1);
|
|
997
|
+
var Elm = as || "span";
|
|
998
|
+
var child = render && typeof render === "function" && render(reset, {
|
|
999
|
+
value,
|
|
1000
|
+
parentValue,
|
|
1001
|
+
keyName,
|
|
1002
|
+
keys: keys || (keyName ? [keyName] : [])
|
|
1484
1003
|
});
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
var initialState$1 = {
|
|
1488
|
-
Copied: {
|
|
1489
|
-
className: "w-rjv-copied",
|
|
1490
|
-
style: {
|
|
1491
|
-
height: "1em",
|
|
1492
|
-
width: "1em",
|
|
1493
|
-
cursor: "pointer",
|
|
1494
|
-
verticalAlign: "middle",
|
|
1495
|
-
marginLeft: 5
|
|
1496
|
-
}
|
|
1497
|
-
},
|
|
1498
|
-
CountInfo: {
|
|
1499
|
-
as: "span",
|
|
1500
|
-
className: "w-rjv-object-size",
|
|
1501
|
-
style: {
|
|
1502
|
-
color: "var(--w-rjv-info-color, #0000004d)",
|
|
1503
|
-
paddingLeft: 8,
|
|
1504
|
-
fontStyle: "italic"
|
|
1505
|
-
}
|
|
1506
|
-
},
|
|
1507
|
-
CountInfoExtra: {
|
|
1508
|
-
as: "span",
|
|
1509
|
-
className: "w-rjv-object-extra",
|
|
1510
|
-
style: {
|
|
1511
|
-
paddingLeft: 8
|
|
1512
|
-
}
|
|
1513
|
-
},
|
|
1514
|
-
Ellipsis: {
|
|
1515
|
-
as: "span",
|
|
1516
|
-
style: {
|
|
1517
|
-
cursor: "pointer",
|
|
1518
|
-
color: "var(--w-rjv-ellipsis-color, #cb4b16)",
|
|
1519
|
-
userSelect: "none"
|
|
1520
|
-
},
|
|
1521
|
-
className: "w-rjv-ellipsis",
|
|
1522
|
-
children: "..."
|
|
1523
|
-
},
|
|
1524
|
-
Row: {
|
|
1525
|
-
as: "div",
|
|
1526
|
-
className: "w-rjv-line"
|
|
1527
|
-
},
|
|
1528
|
-
KeyName: {
|
|
1529
|
-
as: "span",
|
|
1530
|
-
className: "w-rjv-object-key"
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
var Context$2 = /* @__PURE__ */ React.createContext(initialState$1);
|
|
1534
|
-
var reducer$1 = (state, action) => _extends({}, state, action);
|
|
1535
|
-
var useSectionStore = () => {
|
|
1536
|
-
return React.useContext(Context$2);
|
|
1537
|
-
};
|
|
1538
|
-
var DispatchSection = /* @__PURE__ */ React.createContext(() => {
|
|
1539
|
-
});
|
|
1540
|
-
DispatchSection.displayName = "JVR.DispatchSection";
|
|
1541
|
-
function useSection() {
|
|
1542
|
-
return React.useReducer(reducer$1, initialState$1);
|
|
1543
|
-
}
|
|
1544
|
-
function useSectionDispatch() {
|
|
1545
|
-
return React.useContext(DispatchSection);
|
|
1546
|
-
}
|
|
1547
|
-
var Section = (_ref) => {
|
|
1548
|
-
var {
|
|
1549
|
-
initial,
|
|
1550
|
-
dispatch,
|
|
1551
|
-
children
|
|
1552
|
-
} = _ref;
|
|
1553
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context$2.Provider, {
|
|
1554
|
-
value: initial,
|
|
1555
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchSection.Provider, {
|
|
1556
|
-
value: dispatch,
|
|
1557
|
-
children
|
|
1558
|
-
})
|
|
1559
|
-
});
|
|
1560
|
-
};
|
|
1561
|
-
Section.displayName = "JVR.Section";
|
|
1562
|
-
var initialState = {
|
|
1563
|
-
objectSortKeys: false,
|
|
1564
|
-
indentWidth: 15
|
|
1565
|
-
};
|
|
1566
|
-
var Context$1 = /* @__PURE__ */ React.createContext(initialState);
|
|
1567
|
-
Context$1.displayName = "JVR.Context";
|
|
1568
|
-
var DispatchContext = /* @__PURE__ */ React.createContext(() => {
|
|
1569
|
-
});
|
|
1570
|
-
DispatchContext.displayName = "JVR.DispatchContext";
|
|
1571
|
-
function reducer(state, action) {
|
|
1572
|
-
return _extends({}, state, action);
|
|
1573
|
-
}
|
|
1574
|
-
var useStore = () => {
|
|
1575
|
-
return React.useContext(Context$1);
|
|
1576
|
-
};
|
|
1577
|
-
var Provider = (_ref) => {
|
|
1578
|
-
var {
|
|
1579
|
-
children,
|
|
1580
|
-
initialState: init,
|
|
1581
|
-
initialTypes
|
|
1582
|
-
} = _ref;
|
|
1583
|
-
var [state, dispatch] = React.useReducer(reducer, Object.assign({}, initialState, init));
|
|
1584
|
-
var [showTools, showToolsDispatch] = useShowTools();
|
|
1585
|
-
var [expands, expandsDispatch] = useExpands();
|
|
1586
|
-
var [types, typesDispatch] = useTypes();
|
|
1587
|
-
var [symbols, symbolsDispatch] = useSymbols();
|
|
1588
|
-
var [section, sectionDispatch] = useSection();
|
|
1589
|
-
React.useEffect(() => dispatch(_extends({}, init)), [init]);
|
|
1590
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context$1.Provider, {
|
|
1591
|
-
value: state,
|
|
1592
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DispatchContext.Provider, {
|
|
1593
|
-
value: dispatch,
|
|
1594
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ShowTools, {
|
|
1595
|
-
initial: showTools,
|
|
1596
|
-
dispatch: showToolsDispatch,
|
|
1597
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Expands, {
|
|
1598
|
-
initial: expands,
|
|
1599
|
-
dispatch: expandsDispatch,
|
|
1600
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Types, {
|
|
1601
|
-
initial: _extends({}, types, initialTypes),
|
|
1602
|
-
dispatch: typesDispatch,
|
|
1603
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Symbols, {
|
|
1604
|
-
initial: symbols,
|
|
1605
|
-
dispatch: symbolsDispatch,
|
|
1606
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Section, {
|
|
1607
|
-
initial: section,
|
|
1608
|
-
dispatch: sectionDispatch,
|
|
1609
|
-
children
|
|
1610
|
-
})
|
|
1611
|
-
})
|
|
1612
|
-
})
|
|
1613
|
-
})
|
|
1614
|
-
})
|
|
1615
|
-
})
|
|
1616
|
-
});
|
|
1617
|
-
};
|
|
1618
|
-
Provider.displayName = "JVR.Provider";
|
|
1619
|
-
function _objectDestructuringEmpty(t2) {
|
|
1620
|
-
if (null == t2) throw new TypeError("Cannot destructure " + t2);
|
|
1621
|
-
}
|
|
1622
|
-
var _excluded$9 = ["isNumber", "value", "parentValue", "keyName", "keys"], _excluded2$5 = ["as", "render"], _excluded3$1 = ["as", "render"], _excluded4$1 = ["as", "render"], _excluded5$1 = ["as", "style", "render"], _excluded6$1 = ["as", "render"], _excluded7$1 = ["as", "render"], _excluded8$1 = ["as", "render"], _excluded9$1 = ["as", "render"];
|
|
1623
|
-
var Quote$1 = (props) => {
|
|
1624
|
-
var {
|
|
1625
|
-
Quote: Comp = {}
|
|
1626
|
-
} = useSymbolsStore();
|
|
1627
|
-
var {
|
|
1628
|
-
isNumber,
|
|
1629
|
-
value,
|
|
1630
|
-
parentValue,
|
|
1631
|
-
keyName,
|
|
1632
|
-
keys
|
|
1633
|
-
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
1634
|
-
if (isNumber) return null;
|
|
1635
|
-
var {
|
|
1636
|
-
as,
|
|
1637
|
-
render
|
|
1638
|
-
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded2$5);
|
|
1639
|
-
var Elm = as || "span";
|
|
1640
|
-
var elmProps = _extends({}, other, reset);
|
|
1641
|
-
if (typeof elmProps.children === "string") {
|
|
1642
|
-
var trimmed = elmProps.children.trim();
|
|
1643
|
-
elmProps.children = trimmed || void 0;
|
|
1644
|
-
}
|
|
1645
|
-
var result = {
|
|
1646
|
-
value,
|
|
1647
|
-
parentValue,
|
|
1648
|
-
keyName,
|
|
1649
|
-
keys: keys || (keyName ? [keyName] : [])
|
|
1650
|
-
};
|
|
1651
|
-
var child = render && typeof render === "function" && render(elmProps, result);
|
|
1652
|
-
if (child) return child;
|
|
1653
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, elmProps));
|
|
1654
|
-
};
|
|
1655
|
-
Quote$1.displayName = "JVR.Quote";
|
|
1656
|
-
var ValueQuote$1 = (props) => {
|
|
1657
|
-
var {
|
|
1658
|
-
ValueQuote: Comp = {}
|
|
1659
|
-
} = useSymbolsStore();
|
|
1660
|
-
var other = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
1661
|
-
var {
|
|
1662
|
-
as,
|
|
1663
|
-
render
|
|
1664
|
-
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded3$1);
|
|
1665
|
-
var Elm = as || "span";
|
|
1666
|
-
var elmProps = _extends({}, other, reset);
|
|
1667
|
-
var child = render && typeof render === "function" && render(elmProps, {});
|
|
1668
|
-
if (child) return child;
|
|
1669
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, elmProps));
|
|
1670
|
-
};
|
|
1671
|
-
ValueQuote$1.displayName = "JVR.ValueQuote";
|
|
1672
|
-
var Colon$1 = (props) => {
|
|
1673
|
-
var {
|
|
1674
|
-
value,
|
|
1675
|
-
parentValue,
|
|
1676
|
-
keyName,
|
|
1677
|
-
keys
|
|
1678
|
-
} = props;
|
|
1679
|
-
var {
|
|
1680
|
-
Colon: Comp = {}
|
|
1681
|
-
} = useSymbolsStore();
|
|
1682
|
-
var {
|
|
1683
|
-
as,
|
|
1684
|
-
render
|
|
1685
|
-
} = Comp, reset = _objectWithoutPropertiesLoose(Comp, _excluded4$1);
|
|
1686
|
-
var Elm = as || "span";
|
|
1687
|
-
var child = render && typeof render === "function" && render(reset, {
|
|
1688
|
-
value,
|
|
1689
|
-
parentValue,
|
|
1690
|
-
keyName,
|
|
1691
|
-
keys: keys || (keyName ? [keyName] : [])
|
|
1692
|
-
});
|
|
1693
|
-
if (child) return child;
|
|
1694
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, reset));
|
|
1004
|
+
if (child) return child;
|
|
1005
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Elm, _extends({}, reset));
|
|
1695
1006
|
};
|
|
1696
1007
|
Colon$1.displayName = "JVR.Colon";
|
|
1697
1008
|
var Arrow$1 = (props) => {
|
|
@@ -3500,249 +2811,938 @@ const JsonViewSection = ({
|
|
|
3500
2811
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3501
2812
|
ui.IconButton,
|
|
3502
2813
|
{
|
|
3503
|
-
size: "small",
|
|
3504
|
-
variant: "transparent",
|
|
3505
|
-
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
3506
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpRightOnBox, {})
|
|
2814
|
+
size: "small",
|
|
2815
|
+
variant: "transparent",
|
|
2816
|
+
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
2817
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpRightOnBox, {})
|
|
2818
|
+
}
|
|
2819
|
+
) }),
|
|
2820
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Drawer.Content, { className: "bg-ui-contrast-bg-base text-ui-code-fg-subtle !shadow-elevation-commandbar overflow-hidden border border-none max-md:inset-x-2 max-md:max-w-[calc(100%-16px)]", children: [
|
|
2821
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-code-bg-base flex items-center justify-between px-6 py-4", children: [
|
|
2822
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4", children: [
|
|
2823
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { className: "text-ui-contrast-fg-primary", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2824
|
+
reactI18next.Trans,
|
|
2825
|
+
{
|
|
2826
|
+
i18nKey: "json.drawer.header",
|
|
2827
|
+
count: numberOfKeys,
|
|
2828
|
+
components: [
|
|
2829
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2830
|
+
"span",
|
|
2831
|
+
{
|
|
2832
|
+
className: "text-ui-fg-subtle"
|
|
2833
|
+
},
|
|
2834
|
+
"count-span"
|
|
2835
|
+
)
|
|
2836
|
+
]
|
|
2837
|
+
}
|
|
2838
|
+
) }) }),
|
|
2839
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Description, { className: "sr-only", children: t2("json.drawer.description") })
|
|
2840
|
+
] }),
|
|
2841
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
2842
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Kbd, { className: "bg-ui-contrast-bg-subtle border-ui-contrast-border-base text-ui-contrast-fg-secondary", children: "esc" }),
|
|
2843
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2844
|
+
ui.IconButton,
|
|
2845
|
+
{
|
|
2846
|
+
size: "small",
|
|
2847
|
+
variant: "transparent",
|
|
2848
|
+
className: "text-ui-contrast-fg-secondary hover:text-ui-contrast-fg-primary hover:bg-ui-contrast-bg-base-hover active:bg-ui-contrast-bg-base-pressed focus-visible:bg-ui-contrast-bg-base-hover focus-visible:shadow-borders-interactive-with-active",
|
|
2849
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMarkMini, {})
|
|
2850
|
+
}
|
|
2851
|
+
) })
|
|
2852
|
+
] })
|
|
2853
|
+
] }),
|
|
2854
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Body, { className: "flex flex-1 flex-col overflow-hidden px-[5px] py-0 pb-[5px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-contrast-bg-subtle flex-1 overflow-auto rounded-b-[4px] rounded-t-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2855
|
+
React.Suspense,
|
|
2856
|
+
{
|
|
2857
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col" }),
|
|
2858
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2859
|
+
JsonView,
|
|
2860
|
+
{
|
|
2861
|
+
value: data,
|
|
2862
|
+
displayDataTypes: false,
|
|
2863
|
+
style: {
|
|
2864
|
+
"--w-rjv-font-family": "Roboto Mono, monospace",
|
|
2865
|
+
"--w-rjv-line-color": "var(--contrast-border-base)",
|
|
2866
|
+
"--w-rjv-curlybraces-color": "var(--contrast-fg-secondary)",
|
|
2867
|
+
"--w-rjv-brackets-color": "var(--contrast-fg-secondary)",
|
|
2868
|
+
"--w-rjv-key-string": "var(--contrast-fg-primary)",
|
|
2869
|
+
"--w-rjv-info-color": "var(--contrast-fg-secondary)",
|
|
2870
|
+
"--w-rjv-type-string-color": "var(--tag-green-icon)",
|
|
2871
|
+
"--w-rjv-quotes-string-color": "var(--tag-green-icon)",
|
|
2872
|
+
"--w-rjv-type-boolean-color": "var(--tag-orange-icon)",
|
|
2873
|
+
"--w-rjv-type-int-color": "var(--tag-orange-icon)",
|
|
2874
|
+
"--w-rjv-type-float-color": "var(--tag-orange-icon)",
|
|
2875
|
+
"--w-rjv-type-bigint-color": "var(--tag-orange-icon)",
|
|
2876
|
+
"--w-rjv-key-number": "var(--contrast-fg-secondary)",
|
|
2877
|
+
"--w-rjv-arrow-color": "var(--contrast-fg-secondary)",
|
|
2878
|
+
"--w-rjv-copied-color": "var(--contrast-fg-secondary)",
|
|
2879
|
+
"--w-rjv-copied-success-color": "var(--contrast-fg-primary)",
|
|
2880
|
+
"--w-rjv-colon-color": "var(--contrast-fg-primary)",
|
|
2881
|
+
"--w-rjv-ellipsis-color": "var(--contrast-fg-secondary)"
|
|
2882
|
+
},
|
|
2883
|
+
collapsed: 1,
|
|
2884
|
+
children: [
|
|
2885
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2886
|
+
JsonView.Quote,
|
|
2887
|
+
{
|
|
2888
|
+
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", {})
|
|
2889
|
+
}
|
|
2890
|
+
),
|
|
2891
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2892
|
+
JsonView.Null,
|
|
2893
|
+
{
|
|
2894
|
+
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-tag-red-icon", children: "null" })
|
|
2895
|
+
}
|
|
2896
|
+
),
|
|
2897
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2898
|
+
JsonView.Undefined,
|
|
2899
|
+
{
|
|
2900
|
+
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-tag-blue-icon", children: "undefined" })
|
|
2901
|
+
}
|
|
2902
|
+
),
|
|
2903
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2904
|
+
JsonView.CountInfo,
|
|
2905
|
+
{
|
|
2906
|
+
render: (_props, { value }) => {
|
|
2907
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-contrast-fg-secondary ml-2", children: t2("general.items", {
|
|
2908
|
+
count: Object.keys(
|
|
2909
|
+
value
|
|
2910
|
+
).length
|
|
2911
|
+
}) });
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
),
|
|
2915
|
+
/* @__PURE__ */ jsxRuntime.jsx(JsonView.Arrow, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.TriangleDownMini, { className: "text-ui-contrast-fg-secondary -ml-[0.5px]" }) }),
|
|
2916
|
+
/* @__PURE__ */ jsxRuntime.jsx(JsonView.Colon, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1", children: ":" }) }),
|
|
2917
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2918
|
+
JsonView.Copied,
|
|
2919
|
+
{
|
|
2920
|
+
render: ({ style }, { value }) => {
|
|
2921
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2922
|
+
Copied,
|
|
2923
|
+
{
|
|
2924
|
+
style,
|
|
2925
|
+
value
|
|
2926
|
+
}
|
|
2927
|
+
);
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
)
|
|
2931
|
+
]
|
|
2932
|
+
}
|
|
2933
|
+
)
|
|
2934
|
+
}
|
|
2935
|
+
) }) })
|
|
2936
|
+
] })
|
|
2937
|
+
] })
|
|
2938
|
+
] });
|
|
2939
|
+
};
|
|
2940
|
+
const Copied = ({ style, value }) => {
|
|
2941
|
+
const [copied, setCopied] = React.useState(false);
|
|
2942
|
+
const handler = (e2) => {
|
|
2943
|
+
e2.stopPropagation();
|
|
2944
|
+
setCopied(true);
|
|
2945
|
+
if (typeof value === "string") {
|
|
2946
|
+
navigator.clipboard.writeText(value);
|
|
2947
|
+
} else {
|
|
2948
|
+
const json = JSON.stringify(value, null, 2);
|
|
2949
|
+
navigator.clipboard.writeText(json);
|
|
2950
|
+
}
|
|
2951
|
+
setTimeout(() => {
|
|
2952
|
+
setCopied(false);
|
|
2953
|
+
}, 2e3);
|
|
2954
|
+
};
|
|
2955
|
+
const styl = { whiteSpace: "nowrap", width: "20px" };
|
|
2956
|
+
if (copied) {
|
|
2957
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...style, ...styl }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { className: "text-ui-contrast-fg-primary" }) });
|
|
2958
|
+
}
|
|
2959
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...style, ...styl }, onClick: handler, children: /* @__PURE__ */ jsxRuntime.jsx(icons.SquareTwoStack, { className: "text-ui-contrast-fg-secondary" }) });
|
|
2960
|
+
};
|
|
2961
|
+
const MetadataSection = ({
|
|
2962
|
+
data,
|
|
2963
|
+
onOpen
|
|
2964
|
+
}) => {
|
|
2965
|
+
const { t: t2 } = reactI18next.useTranslation();
|
|
2966
|
+
if (!data) {
|
|
2967
|
+
return null;
|
|
2968
|
+
}
|
|
2969
|
+
if (!("metadata" in data)) {
|
|
2970
|
+
return null;
|
|
2971
|
+
}
|
|
2972
|
+
const numberOfKeys = data.metadata ? Object.keys(data.metadata).length : 0;
|
|
2973
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex items-center justify-between", children: [
|
|
2974
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
2975
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: t2("metadata.header") }),
|
|
2976
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", rounded: "full", children: t2("metadata.numberOfKeys", {
|
|
2977
|
+
count: numberOfKeys
|
|
2978
|
+
}) })
|
|
2979
|
+
] }),
|
|
2980
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2981
|
+
ui.IconButton,
|
|
2982
|
+
{
|
|
2983
|
+
size: "small",
|
|
2984
|
+
variant: "transparent",
|
|
2985
|
+
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
2986
|
+
onClick: onOpen,
|
|
2987
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpRightOnBox, {})
|
|
2988
|
+
}
|
|
2989
|
+
)
|
|
2990
|
+
] });
|
|
2991
|
+
};
|
|
2992
|
+
const SingleColumnPage = ({
|
|
2993
|
+
children,
|
|
2994
|
+
widgets,
|
|
2995
|
+
/**
|
|
2996
|
+
* Data of the page which is passed to Widgets, JSON view, and Metadata view.
|
|
2997
|
+
*/
|
|
2998
|
+
data,
|
|
2999
|
+
/**
|
|
3000
|
+
* Whether the page should render an outlet for children routes. Defaults to true.
|
|
3001
|
+
*/
|
|
3002
|
+
hasOutlet = true,
|
|
3003
|
+
/**
|
|
3004
|
+
* Whether to show JSON view of the data. Defaults to false.
|
|
3005
|
+
*/
|
|
3006
|
+
showJSON,
|
|
3007
|
+
/**
|
|
3008
|
+
* Whether to show metadata view of the data. Defaults to false.
|
|
3009
|
+
*/
|
|
3010
|
+
showMetadata
|
|
3011
|
+
}) => {
|
|
3012
|
+
const { before, after } = widgets;
|
|
3013
|
+
const widgetProps = { data };
|
|
3014
|
+
if (showJSON && !data) {
|
|
3015
|
+
if (process.env.NODE_ENV === "development") {
|
|
3016
|
+
console.warn(
|
|
3017
|
+
"`showJSON` is true but no data is provided. To display JSON, provide data prop."
|
|
3018
|
+
);
|
|
3019
|
+
}
|
|
3020
|
+
showJSON = false;
|
|
3021
|
+
}
|
|
3022
|
+
if (showMetadata && !data) {
|
|
3023
|
+
if (process.env.NODE_ENV === "development") {
|
|
3024
|
+
console.warn(
|
|
3025
|
+
"`showMetadata` is true but no data is provided. To display metadata, provide data prop."
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
showMetadata = false;
|
|
3029
|
+
}
|
|
3030
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
3031
|
+
before.map((Component, i2) => {
|
|
3032
|
+
return /* @__PURE__ */ React.createElement(Component, { ...widgetProps, key: i2 });
|
|
3033
|
+
}),
|
|
3034
|
+
children,
|
|
3035
|
+
after.map((Component, i2) => {
|
|
3036
|
+
return /* @__PURE__ */ React.createElement(Component, { ...widgetProps, key: i2 });
|
|
3037
|
+
}),
|
|
3038
|
+
showMetadata && /* @__PURE__ */ jsxRuntime.jsx(MetadataSection, { data }),
|
|
3039
|
+
showJSON && /* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data }),
|
|
3040
|
+
hasOutlet && /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
3041
|
+
] });
|
|
3042
|
+
};
|
|
3043
|
+
const ListPage$4 = () => {
|
|
3044
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3045
|
+
SingleColumnPage,
|
|
3046
|
+
{
|
|
3047
|
+
widgets: {
|
|
3048
|
+
before: [],
|
|
3049
|
+
after: []
|
|
3050
|
+
},
|
|
3051
|
+
children: "Notifications"
|
|
3052
|
+
}
|
|
3053
|
+
);
|
|
3054
|
+
};
|
|
3055
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
3056
|
+
label: "Notifications"
|
|
3057
|
+
});
|
|
3058
|
+
class VariableNode extends lexical.DecoratorNode {
|
|
3059
|
+
static getType() {
|
|
3060
|
+
return "variable";
|
|
3061
|
+
}
|
|
3062
|
+
static clone(node) {
|
|
3063
|
+
return new VariableNode(node.__variableName, node.__key);
|
|
3064
|
+
}
|
|
3065
|
+
constructor(variableName, key) {
|
|
3066
|
+
super(key);
|
|
3067
|
+
this.__variableName = variableName;
|
|
3068
|
+
}
|
|
3069
|
+
createDOM() {
|
|
3070
|
+
const span = document.createElement("span");
|
|
3071
|
+
span.className = "variable-node";
|
|
3072
|
+
return span;
|
|
3073
|
+
}
|
|
3074
|
+
updateDOM() {
|
|
3075
|
+
return false;
|
|
3076
|
+
}
|
|
3077
|
+
exportDOM() {
|
|
3078
|
+
const element = document.createElement("span");
|
|
3079
|
+
element.textContent = `{{${this.__variableName}}}`;
|
|
3080
|
+
element.className = "variable";
|
|
3081
|
+
return { element };
|
|
3082
|
+
}
|
|
3083
|
+
static importJSON(serializedNode) {
|
|
3084
|
+
return $createVariableNode(serializedNode.variableName);
|
|
3085
|
+
}
|
|
3086
|
+
exportJSON() {
|
|
3087
|
+
return {
|
|
3088
|
+
type: "variable",
|
|
3089
|
+
version: 1,
|
|
3090
|
+
variableName: this.__variableName
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
isInline() {
|
|
3094
|
+
return true;
|
|
3095
|
+
}
|
|
3096
|
+
getVariableName() {
|
|
3097
|
+
return this.__variableName;
|
|
3098
|
+
}
|
|
3099
|
+
getTextContent() {
|
|
3100
|
+
return `{{${this.__variableName}}}`;
|
|
3101
|
+
}
|
|
3102
|
+
decorate() {
|
|
3103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VariableComponent, { variableName: this.__variableName });
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
function $createVariableNode(variableName) {
|
|
3107
|
+
return new VariableNode(variableName);
|
|
3108
|
+
}
|
|
3109
|
+
function VariableComponent({ variableName }) {
|
|
3110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3111
|
+
"span",
|
|
3112
|
+
{
|
|
3113
|
+
className: "inline-flex items-center px-1.5 py-0.5 mx-0.5 rounded text-xs font-mono bg-violet-100 text-violet-700 border border-violet-200",
|
|
3114
|
+
contentEditable: false,
|
|
3115
|
+
children: `{{${variableName}}}`
|
|
3116
|
+
}
|
|
3117
|
+
);
|
|
3118
|
+
}
|
|
3119
|
+
class DividerBlockNode extends lexical.DecoratorNode {
|
|
3120
|
+
static getType() {
|
|
3121
|
+
return "divider-block";
|
|
3122
|
+
}
|
|
3123
|
+
static clone(node) {
|
|
3124
|
+
return new DividerBlockNode(node.__key);
|
|
3125
|
+
}
|
|
3126
|
+
constructor(key) {
|
|
3127
|
+
super(key);
|
|
3128
|
+
}
|
|
3129
|
+
createDOM() {
|
|
3130
|
+
const div = document.createElement("div");
|
|
3131
|
+
div.className = "editor-divider";
|
|
3132
|
+
div.setAttribute("data-lexical-decorator", "true");
|
|
3133
|
+
div.setAttribute("contenteditable", "false");
|
|
3134
|
+
return div;
|
|
3135
|
+
}
|
|
3136
|
+
updateDOM() {
|
|
3137
|
+
return false;
|
|
3138
|
+
}
|
|
3139
|
+
exportDOM() {
|
|
3140
|
+
const element = document.createElement("hr");
|
|
3141
|
+
return { element };
|
|
3142
|
+
}
|
|
3143
|
+
static importJSON() {
|
|
3144
|
+
return $createDividerBlockNode();
|
|
3145
|
+
}
|
|
3146
|
+
exportJSON() {
|
|
3147
|
+
return {
|
|
3148
|
+
type: "divider-block",
|
|
3149
|
+
version: 1
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3152
|
+
isInline() {
|
|
3153
|
+
return false;
|
|
3154
|
+
}
|
|
3155
|
+
decorate() {
|
|
3156
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DividerBlockComponent, { nodeKey: this.__key });
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
function $createDividerBlockNode() {
|
|
3160
|
+
return new DividerBlockNode();
|
|
3161
|
+
}
|
|
3162
|
+
function DividerBlockComponent({ nodeKey }) {
|
|
3163
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3164
|
+
"div",
|
|
3165
|
+
{
|
|
3166
|
+
className: "editor-block py-4 cursor-pointer",
|
|
3167
|
+
"data-block-key": nodeKey,
|
|
3168
|
+
"data-block-type": "divider",
|
|
3169
|
+
children: [
|
|
3170
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-muted mb-1 uppercase tracking-wide", children: "Divider" }),
|
|
3171
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-t-2 border-ui-border-base" })
|
|
3172
|
+
]
|
|
3173
|
+
}
|
|
3174
|
+
);
|
|
3175
|
+
}
|
|
3176
|
+
class ButtonBlockNode extends lexical.DecoratorNode {
|
|
3177
|
+
static getType() {
|
|
3178
|
+
return "button-block";
|
|
3179
|
+
}
|
|
3180
|
+
static clone(node) {
|
|
3181
|
+
return new ButtonBlockNode(node.__text, node.__url, node.__key);
|
|
3182
|
+
}
|
|
3183
|
+
constructor(text = "Kliknij", url = "#", key) {
|
|
3184
|
+
super(key);
|
|
3185
|
+
this.__text = text;
|
|
3186
|
+
this.__url = url;
|
|
3187
|
+
}
|
|
3188
|
+
createDOM() {
|
|
3189
|
+
const div = document.createElement("div");
|
|
3190
|
+
div.className = "editor-button";
|
|
3191
|
+
div.setAttribute("data-lexical-decorator", "true");
|
|
3192
|
+
div.setAttribute("contenteditable", "false");
|
|
3193
|
+
return div;
|
|
3194
|
+
}
|
|
3195
|
+
updateDOM() {
|
|
3196
|
+
return false;
|
|
3197
|
+
}
|
|
3198
|
+
exportDOM() {
|
|
3199
|
+
const element = document.createElement("a");
|
|
3200
|
+
element.href = this.__url;
|
|
3201
|
+
element.textContent = this.__text;
|
|
3202
|
+
element.className = "button";
|
|
3203
|
+
return { element };
|
|
3204
|
+
}
|
|
3205
|
+
static importJSON(serializedNode) {
|
|
3206
|
+
return $createButtonBlockNode(serializedNode.text, serializedNode.url);
|
|
3207
|
+
}
|
|
3208
|
+
exportJSON() {
|
|
3209
|
+
return {
|
|
3210
|
+
type: "button-block",
|
|
3211
|
+
version: 1,
|
|
3212
|
+
text: this.__text,
|
|
3213
|
+
url: this.__url
|
|
3214
|
+
};
|
|
3215
|
+
}
|
|
3216
|
+
isInline() {
|
|
3217
|
+
return false;
|
|
3218
|
+
}
|
|
3219
|
+
getText() {
|
|
3220
|
+
return this.__text;
|
|
3221
|
+
}
|
|
3222
|
+
getUrl() {
|
|
3223
|
+
return this.__url;
|
|
3224
|
+
}
|
|
3225
|
+
setText(text) {
|
|
3226
|
+
const writable = this.getWritable();
|
|
3227
|
+
writable.__text = text;
|
|
3228
|
+
}
|
|
3229
|
+
setUrl(url) {
|
|
3230
|
+
const writable = this.getWritable();
|
|
3231
|
+
writable.__url = url;
|
|
3232
|
+
}
|
|
3233
|
+
decorate() {
|
|
3234
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ButtonBlockComponent, { nodeKey: this.__key, text: this.__text, url: this.__url });
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
function $createButtonBlockNode(text, url) {
|
|
3238
|
+
return new ButtonBlockNode(text, url);
|
|
3239
|
+
}
|
|
3240
|
+
function ButtonBlockComponent({ nodeKey, text, url }) {
|
|
3241
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
3242
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
3243
|
+
const [editText, setEditText] = React.useState(text);
|
|
3244
|
+
const [editUrl, setEditUrl] = React.useState(url);
|
|
3245
|
+
const handleSave = () => {
|
|
3246
|
+
editor.update(() => {
|
|
3247
|
+
const node = lexical.$getNodeByKey(nodeKey);
|
|
3248
|
+
if (node) {
|
|
3249
|
+
node.setText(editText);
|
|
3250
|
+
node.setUrl(editUrl);
|
|
3251
|
+
}
|
|
3252
|
+
});
|
|
3253
|
+
setIsEditing(false);
|
|
3254
|
+
};
|
|
3255
|
+
if (isEditing) {
|
|
3256
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "editor-block py-2", "data-block-key": nodeKey, "data-block-type": "button", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 border border-ui-border-interactive rounded-lg bg-ui-bg-subtle", children: [
|
|
3257
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-muted mb-2 uppercase tracking-wide", children: "Button" }),
|
|
3258
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3260
|
+
"input",
|
|
3261
|
+
{
|
|
3262
|
+
type: "text",
|
|
3263
|
+
value: editText,
|
|
3264
|
+
onChange: (e2) => setEditText(e2.target.value),
|
|
3265
|
+
placeholder: "Tekst przycisku",
|
|
3266
|
+
className: "w-full px-3 py-2 text-sm border border-ui-border-base rounded-lg"
|
|
3267
|
+
}
|
|
3268
|
+
),
|
|
3269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3270
|
+
"input",
|
|
3271
|
+
{
|
|
3272
|
+
type: "text",
|
|
3273
|
+
value: editUrl,
|
|
3274
|
+
onChange: (e2) => setEditUrl(e2.target.value),
|
|
3275
|
+
placeholder: "URL (np. {{data.order.url}})",
|
|
3276
|
+
className: "w-full px-3 py-2 text-sm border border-ui-border-base rounded-lg font-mono"
|
|
3277
|
+
}
|
|
3278
|
+
),
|
|
3279
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
3280
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3281
|
+
"button",
|
|
3282
|
+
{
|
|
3283
|
+
onClick: handleSave,
|
|
3284
|
+
className: "px-4 py-2 text-sm bg-ui-button-neutral text-ui-fg-on-color rounded-lg hover:bg-ui-button-neutral-hover",
|
|
3285
|
+
children: "Zapisz"
|
|
3286
|
+
}
|
|
3287
|
+
),
|
|
3288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3289
|
+
"button",
|
|
3290
|
+
{
|
|
3291
|
+
onClick: () => setIsEditing(false),
|
|
3292
|
+
className: "px-4 py-2 text-sm border border-ui-border-base rounded-lg hover:bg-ui-bg-base-hover",
|
|
3293
|
+
children: "Anuluj"
|
|
3294
|
+
}
|
|
3295
|
+
)
|
|
3296
|
+
] })
|
|
3297
|
+
] })
|
|
3298
|
+
] }) });
|
|
3299
|
+
}
|
|
3300
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "editor-block py-2 cursor-pointer", "data-block-key": nodeKey, "data-block-type": "button", children: [
|
|
3301
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-muted mb-1 uppercase tracking-wide", children: "Button" }),
|
|
3302
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
|
+
"button",
|
|
3304
|
+
{
|
|
3305
|
+
onDoubleClick: () => setIsEditing(true),
|
|
3306
|
+
className: "px-6 py-2 bg-violet-600 text-white rounded-lg font-medium hover:bg-violet-700 transition-colors cursor-pointer",
|
|
3307
|
+
title: "Kliknij dwukrotnie aby edytować",
|
|
3308
|
+
children: text
|
|
3309
|
+
}
|
|
3310
|
+
) })
|
|
3311
|
+
] });
|
|
3312
|
+
}
|
|
3313
|
+
function FloatingBlockToolbar({ hoveredBlock }) {
|
|
3314
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
3315
|
+
const handleMoveUp = () => {
|
|
3316
|
+
if (!hoveredBlock) return;
|
|
3317
|
+
editor.update(() => {
|
|
3318
|
+
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
3319
|
+
if (node) {
|
|
3320
|
+
const prevSibling = node.getPreviousSibling();
|
|
3321
|
+
if (prevSibling) {
|
|
3322
|
+
prevSibling.insertBefore(node);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
});
|
|
3326
|
+
};
|
|
3327
|
+
const handleMoveDown = () => {
|
|
3328
|
+
if (!hoveredBlock) return;
|
|
3329
|
+
editor.update(() => {
|
|
3330
|
+
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
3331
|
+
if (node) {
|
|
3332
|
+
const nextSibling = node.getNextSibling();
|
|
3333
|
+
if (nextSibling) {
|
|
3334
|
+
nextSibling.insertAfter(node);
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
};
|
|
3339
|
+
const handleDelete = () => {
|
|
3340
|
+
if (!hoveredBlock) return;
|
|
3341
|
+
editor.update(() => {
|
|
3342
|
+
const node = lexical.$getNodeByKey(hoveredBlock.key);
|
|
3343
|
+
if (node) {
|
|
3344
|
+
node.remove();
|
|
3345
|
+
}
|
|
3346
|
+
});
|
|
3347
|
+
};
|
|
3348
|
+
const isVisible = hoveredBlock && hoveredBlock.type !== "variable";
|
|
3349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3350
|
+
"div",
|
|
3351
|
+
{
|
|
3352
|
+
className: `pointer-events-auto absolute z-[100] transition-opacity duration-150 ${isVisible ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
3353
|
+
style: {
|
|
3354
|
+
top: (hoveredBlock == null ? void 0 : hoveredBlock.top) ?? 0,
|
|
3355
|
+
left: 8
|
|
3356
|
+
},
|
|
3357
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
3358
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3359
|
+
"button",
|
|
3360
|
+
{
|
|
3361
|
+
onClick: handleMoveUp,
|
|
3362
|
+
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted border border-ui-border-base text-xs",
|
|
3363
|
+
title: "Przesuń w górę",
|
|
3364
|
+
children: "↑"
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3368
|
+
"button",
|
|
3369
|
+
{
|
|
3370
|
+
onClick: handleMoveDown,
|
|
3371
|
+
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted border border-ui-border-base text-xs",
|
|
3372
|
+
title: "Przesuń w dół",
|
|
3373
|
+
children: "↓"
|
|
3374
|
+
}
|
|
3375
|
+
),
|
|
3376
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3377
|
+
"button",
|
|
3378
|
+
{
|
|
3379
|
+
onClick: handleDelete,
|
|
3380
|
+
className: "w-6 h-6 flex items-center justify-center bg-ui-bg-base hover:bg-ui-bg-base-hover rounded text-ui-fg-muted hover:text-ui-fg-error border border-ui-border-base text-xs",
|
|
3381
|
+
title: "Usuń",
|
|
3382
|
+
children: "✕"
|
|
3383
|
+
}
|
|
3384
|
+
)
|
|
3385
|
+
] })
|
|
3386
|
+
}
|
|
3387
|
+
);
|
|
3388
|
+
}
|
|
3389
|
+
function EditorInner({ children }) {
|
|
3390
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
3391
|
+
const [hoveredBlock, setHoveredBlock] = React.useState(null);
|
|
3392
|
+
const containerRef = React.useRef(null);
|
|
3393
|
+
React.useEffect(() => {
|
|
3394
|
+
const container = containerRef.current;
|
|
3395
|
+
if (!container) return;
|
|
3396
|
+
const handleMouseMove = (e2) => {
|
|
3397
|
+
const target = e2.target;
|
|
3398
|
+
let blockElement = null;
|
|
3399
|
+
let nodeKey = null;
|
|
3400
|
+
let blockType = null;
|
|
3401
|
+
const customBlock = target.closest(".editor-block");
|
|
3402
|
+
if (customBlock) {
|
|
3403
|
+
blockElement = customBlock;
|
|
3404
|
+
nodeKey = customBlock.dataset.blockKey || null;
|
|
3405
|
+
blockType = customBlock.dataset.blockType || null;
|
|
3406
|
+
}
|
|
3407
|
+
if (!blockElement) {
|
|
3408
|
+
const paragraph = target.closest("p.editor-paragraph");
|
|
3409
|
+
if (paragraph) {
|
|
3410
|
+
blockElement = paragraph;
|
|
3411
|
+
blockType = "paragraph";
|
|
3412
|
+
editor.getEditorState().read(() => {
|
|
3413
|
+
const root = lexical.$getRoot();
|
|
3414
|
+
const children2 = root.getChildren();
|
|
3415
|
+
for (const child of children2) {
|
|
3416
|
+
const childElement = editor.getElementByKey(child.getKey());
|
|
3417
|
+
if (childElement === paragraph) {
|
|
3418
|
+
nodeKey = child.getKey();
|
|
3419
|
+
break;
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
if (blockElement && nodeKey) {
|
|
3426
|
+
const containerRect = container.getBoundingClientRect();
|
|
3427
|
+
const blockRect = blockElement.getBoundingClientRect();
|
|
3428
|
+
setHoveredBlock({
|
|
3429
|
+
key: nodeKey,
|
|
3430
|
+
top: blockRect.top - containerRect.top,
|
|
3431
|
+
type: blockType || "unknown"
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
};
|
|
3435
|
+
const handleMouseLeave = () => {
|
|
3436
|
+
setHoveredBlock(null);
|
|
3437
|
+
};
|
|
3438
|
+
container.addEventListener("mousemove", handleMouseMove, { capture: true });
|
|
3439
|
+
container.addEventListener("mouseleave", handleMouseLeave);
|
|
3440
|
+
return () => {
|
|
3441
|
+
container.removeEventListener("mousemove", handleMouseMove, { capture: true });
|
|
3442
|
+
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
3443
|
+
};
|
|
3444
|
+
}, [editor]);
|
|
3445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3446
|
+
"div",
|
|
3447
|
+
{
|
|
3448
|
+
ref: containerRef,
|
|
3449
|
+
className: "editor-inner relative pl-12 py-4 pr-4",
|
|
3450
|
+
children: [
|
|
3451
|
+
/* @__PURE__ */ jsxRuntime.jsx(FloatingBlockToolbar, { hoveredBlock }),
|
|
3452
|
+
children
|
|
3453
|
+
]
|
|
3454
|
+
}
|
|
3455
|
+
);
|
|
3456
|
+
}
|
|
3457
|
+
const AVAILABLE_VARIABLES = [
|
|
3458
|
+
"data.order.id",
|
|
3459
|
+
"data.order.display_id",
|
|
3460
|
+
"data.order.email",
|
|
3461
|
+
"data.order.total",
|
|
3462
|
+
"data.customer.first_name",
|
|
3463
|
+
"data.customer.last_name"
|
|
3464
|
+
];
|
|
3465
|
+
function ToolbarPlugin({
|
|
3466
|
+
INSERT_PARAGRAPH_BLOCK_COMMAND: INSERT_PARAGRAPH_BLOCK_COMMAND2,
|
|
3467
|
+
INSERT_DIVIDER_COMMAND: INSERT_DIVIDER_COMMAND2,
|
|
3468
|
+
INSERT_BUTTON_COMMAND: INSERT_BUTTON_COMMAND2,
|
|
3469
|
+
INSERT_VARIABLE_COMMAND: INSERT_VARIABLE_COMMAND2
|
|
3470
|
+
}) {
|
|
3471
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
3472
|
+
const [showVariables, setShowVariables] = React.useState(false);
|
|
3473
|
+
const [showBlockMenu, setShowBlockMenu] = React.useState(false);
|
|
3474
|
+
const lastActiveFieldRef = React.useRef(null);
|
|
3475
|
+
const formatBold = () => {
|
|
3476
|
+
editor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "bold");
|
|
3477
|
+
};
|
|
3478
|
+
const formatItalic = () => {
|
|
3479
|
+
editor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, "italic");
|
|
3480
|
+
};
|
|
3481
|
+
const captureActiveField = () => {
|
|
3482
|
+
const activeElement = document.activeElement;
|
|
3483
|
+
if (activeElement instanceof HTMLTextAreaElement || activeElement instanceof HTMLInputElement) {
|
|
3484
|
+
lastActiveFieldRef.current = {
|
|
3485
|
+
element: activeElement,
|
|
3486
|
+
selectionStart: activeElement.selectionStart || 0,
|
|
3487
|
+
selectionEnd: activeElement.selectionEnd || 0
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
const insertVariable = (variable) => {
|
|
3492
|
+
var _a;
|
|
3493
|
+
const text = `{{${variable}}}`;
|
|
3494
|
+
const lastField = lastActiveFieldRef.current;
|
|
3495
|
+
if (lastField && document.body.contains(lastField.element)) {
|
|
3496
|
+
const { element, selectionStart, selectionEnd } = lastField;
|
|
3497
|
+
const currentValue = element.value;
|
|
3498
|
+
const newValue = currentValue.slice(0, selectionStart) + text + currentValue.slice(selectionEnd);
|
|
3499
|
+
const nativeInputValueSetter = (_a = Object.getOwnPropertyDescriptor(
|
|
3500
|
+
element instanceof HTMLTextAreaElement ? window.HTMLTextAreaElement.prototype : window.HTMLInputElement.prototype,
|
|
3501
|
+
"value"
|
|
3502
|
+
)) == null ? void 0 : _a.set;
|
|
3503
|
+
nativeInputValueSetter == null ? void 0 : nativeInputValueSetter.call(element, newValue);
|
|
3504
|
+
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3505
|
+
setTimeout(() => {
|
|
3506
|
+
element.focus();
|
|
3507
|
+
element.setSelectionRange(selectionStart + text.length, selectionStart + text.length);
|
|
3508
|
+
}, 0);
|
|
3509
|
+
lastActiveFieldRef.current = null;
|
|
3510
|
+
} else {
|
|
3511
|
+
editor.dispatchCommand(INSERT_VARIABLE_COMMAND2, variable);
|
|
3512
|
+
}
|
|
3513
|
+
setShowVariables(false);
|
|
3514
|
+
};
|
|
3515
|
+
const insertParagraph = () => {
|
|
3516
|
+
editor.dispatchCommand(INSERT_PARAGRAPH_BLOCK_COMMAND2, void 0);
|
|
3517
|
+
setShowBlockMenu(false);
|
|
3518
|
+
};
|
|
3519
|
+
const insertDivider = () => {
|
|
3520
|
+
editor.dispatchCommand(INSERT_DIVIDER_COMMAND2, void 0);
|
|
3521
|
+
setShowBlockMenu(false);
|
|
3522
|
+
};
|
|
3523
|
+
const insertButton = () => {
|
|
3524
|
+
editor.dispatchCommand(INSERT_BUTTON_COMMAND2, void 0);
|
|
3525
|
+
setShowBlockMenu(false);
|
|
3526
|
+
};
|
|
3527
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 p-2 border-b border-ui-border-base bg-ui-bg-subtle sticky top-0 z-10", children: [
|
|
3528
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3529
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3530
|
+
"button",
|
|
3531
|
+
{
|
|
3532
|
+
type: "button",
|
|
3533
|
+
onClick: () => setShowBlockMenu(!showBlockMenu),
|
|
3534
|
+
className: "flex items-center gap-1 px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm",
|
|
3535
|
+
children: [
|
|
3536
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Plus, { className: "w-4 h-4" }),
|
|
3537
|
+
"Blok"
|
|
3538
|
+
]
|
|
3507
3539
|
}
|
|
3508
|
-
)
|
|
3509
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3510
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3511
|
-
|
|
3512
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { className: "text-ui-contrast-fg-primary", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3513
|
-
reactI18next.Trans,
|
|
3514
|
-
{
|
|
3515
|
-
i18nKey: "json.drawer.header",
|
|
3516
|
-
count: numberOfKeys,
|
|
3517
|
-
components: [
|
|
3518
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3519
|
-
"span",
|
|
3520
|
-
{
|
|
3521
|
-
className: "text-ui-fg-subtle"
|
|
3522
|
-
},
|
|
3523
|
-
"count-span"
|
|
3524
|
-
)
|
|
3525
|
-
]
|
|
3526
|
-
}
|
|
3527
|
-
) }) }),
|
|
3528
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Description, { className: "sr-only", children: t2("json.drawer.description") })
|
|
3529
|
-
] }),
|
|
3530
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
3531
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Kbd, { className: "bg-ui-contrast-bg-subtle border-ui-contrast-border-base text-ui-contrast-fg-secondary", children: "esc" }),
|
|
3532
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3533
|
-
ui.IconButton,
|
|
3534
|
-
{
|
|
3535
|
-
size: "small",
|
|
3536
|
-
variant: "transparent",
|
|
3537
|
-
className: "text-ui-contrast-fg-secondary hover:text-ui-contrast-fg-primary hover:bg-ui-contrast-bg-base-hover active:bg-ui-contrast-bg-base-pressed focus-visible:bg-ui-contrast-bg-base-hover focus-visible:shadow-borders-interactive-with-active",
|
|
3538
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMarkMini, {})
|
|
3539
|
-
}
|
|
3540
|
-
) })
|
|
3541
|
-
] })
|
|
3542
|
-
] }),
|
|
3543
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Body, { className: "flex flex-1 flex-col overflow-hidden px-[5px] py-0 pb-[5px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-contrast-bg-subtle flex-1 overflow-auto rounded-b-[4px] rounded-t-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3544
|
-
React.Suspense,
|
|
3540
|
+
),
|
|
3541
|
+
showBlockMenu && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-0 mt-1 bg-ui-bg-base border border-ui-border-base rounded shadow-lg z-20 min-w-[150px]", children: [
|
|
3542
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3543
|
+
"button",
|
|
3545
3544
|
{
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
"--w-rjv-font-family": "Roboto Mono, monospace",
|
|
3554
|
-
"--w-rjv-line-color": "var(--contrast-border-base)",
|
|
3555
|
-
"--w-rjv-curlybraces-color": "var(--contrast-fg-secondary)",
|
|
3556
|
-
"--w-rjv-brackets-color": "var(--contrast-fg-secondary)",
|
|
3557
|
-
"--w-rjv-key-string": "var(--contrast-fg-primary)",
|
|
3558
|
-
"--w-rjv-info-color": "var(--contrast-fg-secondary)",
|
|
3559
|
-
"--w-rjv-type-string-color": "var(--tag-green-icon)",
|
|
3560
|
-
"--w-rjv-quotes-string-color": "var(--tag-green-icon)",
|
|
3561
|
-
"--w-rjv-type-boolean-color": "var(--tag-orange-icon)",
|
|
3562
|
-
"--w-rjv-type-int-color": "var(--tag-orange-icon)",
|
|
3563
|
-
"--w-rjv-type-float-color": "var(--tag-orange-icon)",
|
|
3564
|
-
"--w-rjv-type-bigint-color": "var(--tag-orange-icon)",
|
|
3565
|
-
"--w-rjv-key-number": "var(--contrast-fg-secondary)",
|
|
3566
|
-
"--w-rjv-arrow-color": "var(--contrast-fg-secondary)",
|
|
3567
|
-
"--w-rjv-copied-color": "var(--contrast-fg-secondary)",
|
|
3568
|
-
"--w-rjv-copied-success-color": "var(--contrast-fg-primary)",
|
|
3569
|
-
"--w-rjv-colon-color": "var(--contrast-fg-primary)",
|
|
3570
|
-
"--w-rjv-ellipsis-color": "var(--contrast-fg-secondary)"
|
|
3571
|
-
},
|
|
3572
|
-
collapsed: 1,
|
|
3573
|
-
children: [
|
|
3574
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3575
|
-
JsonView.Quote,
|
|
3576
|
-
{
|
|
3577
|
-
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", {})
|
|
3578
|
-
}
|
|
3579
|
-
),
|
|
3580
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3581
|
-
JsonView.Null,
|
|
3582
|
-
{
|
|
3583
|
-
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-tag-red-icon", children: "null" })
|
|
3584
|
-
}
|
|
3585
|
-
),
|
|
3586
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3587
|
-
JsonView.Undefined,
|
|
3588
|
-
{
|
|
3589
|
-
render: () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-tag-blue-icon", children: "undefined" })
|
|
3590
|
-
}
|
|
3591
|
-
),
|
|
3592
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3593
|
-
JsonView.CountInfo,
|
|
3594
|
-
{
|
|
3595
|
-
render: (_props, { value }) => {
|
|
3596
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-contrast-fg-secondary ml-2", children: t2("general.items", {
|
|
3597
|
-
count: Object.keys(
|
|
3598
|
-
value
|
|
3599
|
-
).length
|
|
3600
|
-
}) });
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
),
|
|
3604
|
-
/* @__PURE__ */ jsxRuntime.jsx(JsonView.Arrow, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.TriangleDownMini, { className: "text-ui-contrast-fg-secondary -ml-[0.5px]" }) }),
|
|
3605
|
-
/* @__PURE__ */ jsxRuntime.jsx(JsonView.Colon, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1", children: ":" }) }),
|
|
3606
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3607
|
-
JsonView.Copied,
|
|
3608
|
-
{
|
|
3609
|
-
render: ({ style }, { value }) => {
|
|
3610
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3611
|
-
Copied,
|
|
3612
|
-
{
|
|
3613
|
-
style,
|
|
3614
|
-
value
|
|
3615
|
-
}
|
|
3616
|
-
);
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
)
|
|
3620
|
-
]
|
|
3621
|
-
}
|
|
3622
|
-
)
|
|
3545
|
+
type: "button",
|
|
3546
|
+
onClick: insertParagraph,
|
|
3547
|
+
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
3548
|
+
children: [
|
|
3549
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "¶" }),
|
|
3550
|
+
"Paragraph"
|
|
3551
|
+
]
|
|
3623
3552
|
}
|
|
3624
|
-
)
|
|
3553
|
+
),
|
|
3554
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3555
|
+
"button",
|
|
3556
|
+
{
|
|
3557
|
+
type: "button",
|
|
3558
|
+
onClick: insertDivider,
|
|
3559
|
+
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
3560
|
+
children: [
|
|
3561
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "―" }),
|
|
3562
|
+
"Divider"
|
|
3563
|
+
]
|
|
3564
|
+
}
|
|
3565
|
+
),
|
|
3566
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3567
|
+
"button",
|
|
3568
|
+
{
|
|
3569
|
+
type: "button",
|
|
3570
|
+
onClick: insertButton,
|
|
3571
|
+
className: "flex items-center gap-2 w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm",
|
|
3572
|
+
children: [
|
|
3573
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted", children: "▢" }),
|
|
3574
|
+
"Button"
|
|
3575
|
+
]
|
|
3576
|
+
}
|
|
3577
|
+
)
|
|
3578
|
+
] })
|
|
3579
|
+
] }),
|
|
3580
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px bg-ui-border-base mx-1" }),
|
|
3581
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3582
|
+
"button",
|
|
3583
|
+
{
|
|
3584
|
+
type: "button",
|
|
3585
|
+
onClick: formatBold,
|
|
3586
|
+
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm font-bold",
|
|
3587
|
+
title: "Pogrubienie",
|
|
3588
|
+
children: "B"
|
|
3589
|
+
}
|
|
3590
|
+
),
|
|
3591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3592
|
+
"button",
|
|
3593
|
+
{
|
|
3594
|
+
type: "button",
|
|
3595
|
+
onClick: formatItalic,
|
|
3596
|
+
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm italic",
|
|
3597
|
+
title: "Kursywa",
|
|
3598
|
+
children: "I"
|
|
3599
|
+
}
|
|
3600
|
+
),
|
|
3601
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px bg-ui-border-base mx-1" }),
|
|
3602
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3603
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3604
|
+
"button",
|
|
3605
|
+
{
|
|
3606
|
+
type: "button",
|
|
3607
|
+
onMouseDown: captureActiveField,
|
|
3608
|
+
onClick: () => setShowVariables(!showVariables),
|
|
3609
|
+
className: "px-2 py-1 hover:bg-ui-bg-base-hover rounded text-sm font-mono",
|
|
3610
|
+
title: "Wstaw zmienną",
|
|
3611
|
+
children: "{{ }}"
|
|
3612
|
+
}
|
|
3613
|
+
),
|
|
3614
|
+
showVariables && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-0 mt-1 bg-ui-bg-base border border-ui-border-base rounded shadow-lg z-20 min-w-[220px] max-h-48 overflow-auto", children: [
|
|
3615
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1 text-xs text-ui-fg-muted border-b border-ui-border-base", children: "Dostępne zmienne" }),
|
|
3616
|
+
AVAILABLE_VARIABLES.map((v) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3617
|
+
"button",
|
|
3618
|
+
{
|
|
3619
|
+
type: "button",
|
|
3620
|
+
onClick: () => insertVariable(v),
|
|
3621
|
+
className: "block w-full text-left px-3 py-2 hover:bg-ui-bg-base-hover text-sm font-mono",
|
|
3622
|
+
children: `{{${v}}}`
|
|
3623
|
+
},
|
|
3624
|
+
v
|
|
3625
|
+
))
|
|
3625
3626
|
] })
|
|
3626
3627
|
] })
|
|
3627
3628
|
] });
|
|
3628
|
-
}
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
const
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3629
|
+
}
|
|
3630
|
+
const INSERT_PARAGRAPH_BLOCK_COMMAND = lexical.createCommand("INSERT_PARAGRAPH_BLOCK");
|
|
3631
|
+
const INSERT_DIVIDER_COMMAND = lexical.createCommand("INSERT_DIVIDER");
|
|
3632
|
+
const INSERT_BUTTON_COMMAND = lexical.createCommand("INSERT_BUTTON");
|
|
3633
|
+
const INSERT_VARIABLE_COMMAND = lexical.createCommand("INSERT_VARIABLE");
|
|
3634
|
+
function registerBlockCommands(editor) {
|
|
3635
|
+
const unregisterParagraph = editor.registerCommand(
|
|
3636
|
+
INSERT_PARAGRAPH_BLOCK_COMMAND,
|
|
3637
|
+
() => {
|
|
3638
|
+
const paragraphNode = lexical.$createParagraphNode();
|
|
3639
|
+
lexical.$insertNodes([paragraphNode]);
|
|
3640
|
+
paragraphNode.select();
|
|
3641
|
+
return true;
|
|
3642
|
+
},
|
|
3643
|
+
lexical.COMMAND_PRIORITY_LOW
|
|
3644
|
+
);
|
|
3645
|
+
const unregisterDivider = editor.registerCommand(
|
|
3646
|
+
INSERT_DIVIDER_COMMAND,
|
|
3647
|
+
() => {
|
|
3648
|
+
const dividerNode = $createDividerBlockNode();
|
|
3649
|
+
lexical.$insertNodes([dividerNode]);
|
|
3650
|
+
return true;
|
|
3651
|
+
},
|
|
3652
|
+
lexical.COMMAND_PRIORITY_LOW
|
|
3653
|
+
);
|
|
3654
|
+
const unregisterButton = editor.registerCommand(
|
|
3655
|
+
INSERT_BUTTON_COMMAND,
|
|
3656
|
+
() => {
|
|
3657
|
+
const buttonNode = $createButtonBlockNode();
|
|
3658
|
+
lexical.$insertNodes([buttonNode]);
|
|
3659
|
+
return true;
|
|
3660
|
+
},
|
|
3661
|
+
lexical.COMMAND_PRIORITY_LOW
|
|
3662
|
+
);
|
|
3663
|
+
const unregisterVariable = editor.registerCommand(
|
|
3664
|
+
INSERT_VARIABLE_COMMAND,
|
|
3665
|
+
(variableName) => {
|
|
3666
|
+
const variableNode = $createVariableNode(variableName);
|
|
3667
|
+
lexical.$insertNodes([variableNode]);
|
|
3668
|
+
return true;
|
|
3669
|
+
},
|
|
3670
|
+
lexical.COMMAND_PRIORITY_LOW
|
|
3671
|
+
);
|
|
3672
|
+
return () => {
|
|
3673
|
+
unregisterParagraph();
|
|
3674
|
+
unregisterDivider();
|
|
3675
|
+
unregisterButton();
|
|
3676
|
+
unregisterVariable();
|
|
3643
3677
|
};
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
};
|
|
3650
|
-
const
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
return null;
|
|
3657
|
-
}
|
|
3658
|
-
if (!("metadata" in data)) {
|
|
3659
|
-
return null;
|
|
3678
|
+
}
|
|
3679
|
+
const BuilderBlocksExtension = lexical.defineExtension({
|
|
3680
|
+
name: "@codee/builder-blocks",
|
|
3681
|
+
nodes: () => [VariableNode, DividerBlockNode, ButtonBlockNode],
|
|
3682
|
+
register: registerBlockCommands
|
|
3683
|
+
});
|
|
3684
|
+
const editorTheme = {
|
|
3685
|
+
paragraph: "editor-paragraph mb-1",
|
|
3686
|
+
text: {
|
|
3687
|
+
bold: "font-bold",
|
|
3688
|
+
italic: "italic",
|
|
3689
|
+
underline: "underline"
|
|
3660
3690
|
}
|
|
3661
|
-
const numberOfKeys = data.metadata ? Object.keys(data.metadata).length : 0;
|
|
3662
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex items-center justify-between", children: [
|
|
3663
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
3664
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: t2("metadata.header") }),
|
|
3665
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", rounded: "full", children: t2("metadata.numberOfKeys", {
|
|
3666
|
-
count: numberOfKeys
|
|
3667
|
-
}) })
|
|
3668
|
-
] }),
|
|
3669
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3670
|
-
ui.IconButton,
|
|
3671
|
-
{
|
|
3672
|
-
size: "small",
|
|
3673
|
-
variant: "transparent",
|
|
3674
|
-
className: "text-ui-fg-muted hover:text-ui-fg-subtle",
|
|
3675
|
-
onClick: onOpen,
|
|
3676
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpRightOnBox, {})
|
|
3677
|
-
}
|
|
3678
|
-
)
|
|
3679
|
-
] });
|
|
3680
3691
|
};
|
|
3681
|
-
const
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3692
|
+
const BuilderEditorExtension = lexical.defineExtension({
|
|
3693
|
+
name: "@codee/builder-editor",
|
|
3694
|
+
namespace: "BuilderEditor",
|
|
3695
|
+
theme: editorTheme,
|
|
3696
|
+
dependencies: [
|
|
3697
|
+
richText.RichTextExtension,
|
|
3698
|
+
history.HistoryExtension,
|
|
3699
|
+
BuilderBlocksExtension
|
|
3700
|
+
]
|
|
3701
|
+
});
|
|
3702
|
+
const BuilderPage = () => {
|
|
3703
|
+
const [output, setOutput] = React.useState("");
|
|
3704
|
+
const handleChange = React.useCallback((editorState) => {
|
|
3705
|
+
editorState.read(() => {
|
|
3706
|
+
const json = editorState.toJSON();
|
|
3707
|
+
setOutput(JSON.stringify(json, null, 2));
|
|
3708
|
+
});
|
|
3709
|
+
}, []);
|
|
3710
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-8", children: [
|
|
3711
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", className: "mb-6", children: "Builder - Template Editor (Extensions API)" }),
|
|
3712
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8", children: [
|
|
3713
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3714
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-ui-fg-subtle", children: "Edytor" }),
|
|
3715
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3716
|
+
LexicalExtensionComposer.LexicalExtensionComposer,
|
|
3717
|
+
{
|
|
3718
|
+
extension: BuilderEditorExtension,
|
|
3719
|
+
contentEditable: null,
|
|
3720
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-ui-border-base rounded-lg bg-white", children: [
|
|
3721
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3722
|
+
ToolbarPlugin,
|
|
3723
|
+
{
|
|
3724
|
+
INSERT_PARAGRAPH_BLOCK_COMMAND,
|
|
3725
|
+
INSERT_DIVIDER_COMMAND,
|
|
3726
|
+
INSERT_BUTTON_COMMAND,
|
|
3727
|
+
INSERT_VARIABLE_COMMAND
|
|
3728
|
+
}
|
|
3729
|
+
),
|
|
3730
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorInner, { children: /* @__PURE__ */ jsxRuntime.jsx(LexicalContentEditable.ContentEditable, { className: "min-h-[400px] outline-none" }) }),
|
|
3731
|
+
/* @__PURE__ */ jsxRuntime.jsx(LexicalOnChangePlugin.OnChangePlugin, { onChange: handleChange })
|
|
3732
|
+
] })
|
|
3733
|
+
}
|
|
3734
|
+
)
|
|
3735
|
+
] }),
|
|
3736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3737
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-ui-fg-subtle", children: "Output (Lexical State)" }),
|
|
3738
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle min-h-[400px] max-h-[600px] overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs font-mono whitespace-pre-wrap", children: output || "..." }) })
|
|
3739
|
+
] })
|
|
3740
|
+
] })
|
|
3730
3741
|
] });
|
|
3731
3742
|
};
|
|
3732
|
-
const ListPage$4 = () => {
|
|
3733
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3734
|
-
SingleColumnPage,
|
|
3735
|
-
{
|
|
3736
|
-
widgets: {
|
|
3737
|
-
before: [],
|
|
3738
|
-
after: []
|
|
3739
|
-
},
|
|
3740
|
-
children: "Notifications"
|
|
3741
|
-
}
|
|
3742
|
-
);
|
|
3743
|
-
};
|
|
3744
3743
|
const config$5 = adminSdk.defineRouteConfig({
|
|
3745
|
-
label: "
|
|
3744
|
+
label: "Builder - Lexical",
|
|
3745
|
+
icon: icons.PuzzleSolid
|
|
3746
3746
|
});
|
|
3747
3747
|
const NotificationsFullList = () => {
|
|
3748
3748
|
const [pagination, setPagination] = React.useState({
|
|
@@ -10313,22 +10313,6 @@ const ListPage$2 = () => {
|
|
|
10313
10313
|
const config$3 = adminSdk.defineRouteConfig({
|
|
10314
10314
|
label: "Templates"
|
|
10315
10315
|
});
|
|
10316
|
-
const ListPage$1 = () => {
|
|
10317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10318
|
-
SingleColumnPage,
|
|
10319
|
-
{
|
|
10320
|
-
widgets: {
|
|
10321
|
-
before: [],
|
|
10322
|
-
after: []
|
|
10323
|
-
},
|
|
10324
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(NotificationsFullList, {})
|
|
10325
|
-
}
|
|
10326
|
-
);
|
|
10327
|
-
};
|
|
10328
|
-
const config$2 = adminSdk.defineRouteConfig({
|
|
10329
|
-
label: "List",
|
|
10330
|
-
icon: icons.ListBullet
|
|
10331
|
-
});
|
|
10332
10316
|
const useOrders = (params = {}, options) => {
|
|
10333
10317
|
const {
|
|
10334
10318
|
limit = 100,
|
|
@@ -11033,10 +11017,26 @@ const PreviewTemplatePage = () => {
|
|
|
11033
11017
|
}
|
|
11034
11018
|
);
|
|
11035
11019
|
};
|
|
11036
|
-
const config$
|
|
11020
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
11037
11021
|
label: "Preview Template",
|
|
11038
11022
|
icon: icons.ChatBubbleLeftRight
|
|
11039
11023
|
});
|
|
11024
|
+
const ListPage$1 = () => {
|
|
11025
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11026
|
+
SingleColumnPage,
|
|
11027
|
+
{
|
|
11028
|
+
widgets: {
|
|
11029
|
+
before: [],
|
|
11030
|
+
after: []
|
|
11031
|
+
},
|
|
11032
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(NotificationsFullList, {})
|
|
11033
|
+
}
|
|
11034
|
+
);
|
|
11035
|
+
};
|
|
11036
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
11037
|
+
label: "List",
|
|
11038
|
+
icon: icons.ListBullet
|
|
11039
|
+
});
|
|
11040
11040
|
const useAvailableTemplates = (params, options) => {
|
|
11041
11041
|
const {
|
|
11042
11042
|
limit = 100,
|
|
@@ -20258,14 +20258,14 @@ const widgetModule = { widgets: [
|
|
|
20258
20258
|
] };
|
|
20259
20259
|
const routeModule = {
|
|
20260
20260
|
routes: [
|
|
20261
|
-
{
|
|
20262
|
-
Component: BuilderPage,
|
|
20263
|
-
path: "/builder-lexical"
|
|
20264
|
-
},
|
|
20265
20261
|
{
|
|
20266
20262
|
Component: ListPage$4,
|
|
20267
20263
|
path: "/mpn"
|
|
20268
20264
|
},
|
|
20265
|
+
{
|
|
20266
|
+
Component: BuilderPage,
|
|
20267
|
+
path: "/builder-lexical"
|
|
20268
|
+
},
|
|
20269
20269
|
{
|
|
20270
20270
|
Component: ListPage$3,
|
|
20271
20271
|
path: "/mpn/notifications"
|
|
@@ -20274,14 +20274,14 @@ const routeModule = {
|
|
|
20274
20274
|
Component: ListPage$2,
|
|
20275
20275
|
path: "/mpn/templates"
|
|
20276
20276
|
},
|
|
20277
|
-
{
|
|
20278
|
-
Component: ListPage$1,
|
|
20279
|
-
path: "/mpn/notifications/list"
|
|
20280
|
-
},
|
|
20281
20277
|
{
|
|
20282
20278
|
Component: PreviewTemplatePage,
|
|
20283
20279
|
path: "/mpn/notifications/render"
|
|
20284
20280
|
},
|
|
20281
|
+
{
|
|
20282
|
+
Component: ListPage$1,
|
|
20283
|
+
path: "/mpn/notifications/list"
|
|
20284
|
+
},
|
|
20285
20285
|
{
|
|
20286
20286
|
Component: ListPage,
|
|
20287
20287
|
path: "/mpn/templates/:id/blocks"
|
|
@@ -20291,13 +20291,13 @@ const routeModule = {
|
|
|
20291
20291
|
const menuItemModule = {
|
|
20292
20292
|
menuItems: [
|
|
20293
20293
|
{
|
|
20294
|
-
label: config$
|
|
20295
|
-
icon: config$
|
|
20294
|
+
label: config$5.label,
|
|
20295
|
+
icon: config$5.icon,
|
|
20296
20296
|
path: "/builder-lexical",
|
|
20297
20297
|
nested: void 0
|
|
20298
20298
|
},
|
|
20299
20299
|
{
|
|
20300
|
-
label: config$
|
|
20300
|
+
label: config$6.label,
|
|
20301
20301
|
icon: void 0,
|
|
20302
20302
|
path: "/mpn",
|
|
20303
20303
|
nested: void 0
|
|
@@ -20308,12 +20308,6 @@ const menuItemModule = {
|
|
|
20308
20308
|
path: "/mpn/notifications",
|
|
20309
20309
|
nested: void 0
|
|
20310
20310
|
},
|
|
20311
|
-
{
|
|
20312
|
-
label: config$2.label,
|
|
20313
|
-
icon: config$2.icon,
|
|
20314
|
-
path: "/mpn/notifications/list",
|
|
20315
|
-
nested: void 0
|
|
20316
|
-
},
|
|
20317
20311
|
{
|
|
20318
20312
|
label: config$3.label,
|
|
20319
20313
|
icon: void 0,
|
|
@@ -20323,6 +20317,12 @@ const menuItemModule = {
|
|
|
20323
20317
|
{
|
|
20324
20318
|
label: config$1.label,
|
|
20325
20319
|
icon: config$1.icon,
|
|
20320
|
+
path: "/mpn/notifications/list",
|
|
20321
|
+
nested: void 0
|
|
20322
|
+
},
|
|
20323
|
+
{
|
|
20324
|
+
label: config$2.label,
|
|
20325
|
+
icon: config$2.icon,
|
|
20326
20326
|
path: "/mpn/notifications/render",
|
|
20327
20327
|
nested: void 0
|
|
20328
20328
|
},
|