@apia/components 4.0.40 → 4.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +22 -9
- package/dist/index.js +87 -122
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -237,6 +237,7 @@ declare class ApiaUtilModalHandler {
|
|
|
237
237
|
declare class ApiaUtilModals {
|
|
238
238
|
#private;
|
|
239
239
|
private overlays;
|
|
240
|
+
private modals;
|
|
240
241
|
constructor();
|
|
241
242
|
close(id: string): void;
|
|
242
243
|
open(props: TOpenModal): ApiaUtilModalHandler;
|
|
@@ -482,20 +483,33 @@ interface IConfirm {
|
|
|
482
483
|
onConfirm?: () => unknown;
|
|
483
484
|
onCancel?: () => unknown;
|
|
484
485
|
title?: string;
|
|
486
|
+
size?: TModalSize;
|
|
485
487
|
variant?: string;
|
|
486
488
|
}
|
|
487
|
-
declare const ConfirmModal: ({ onConfirm, onCancel, title, ...props }: IConfirm) => JSX.Element;
|
|
489
|
+
declare const ConfirmModal: ({ onConfirm, onCancel, title, size, ...props }: IConfirm) => JSX.Element;
|
|
488
490
|
|
|
489
|
-
type TApiaUtilConfirm = Pick<IConfirm, 'additionalButtons' | 'additionalButtonsOnRight' | 'cancelButtonText' | 'children' | 'className' | 'confirmButtonText' | 'confirmButtonVariant' | 'contentRef' | 'hideCancelButton' | 'hideConfirmButton' | 'title' | 'variant'>;
|
|
491
|
+
type TApiaUtilConfirm = Pick<IConfirm, 'additionalButtons' | 'additionalButtonsOnRight' | 'cancelButtonText' | 'children' | 'className' | 'confirmButtonText' | 'confirmButtonVariant' | 'contentRef' | 'hideCancelButton' | 'hideConfirmButton' | 'title' | 'size' | 'variant'>;
|
|
492
|
+
type TApiaUtilInnerConfirm = TApiaUtilConfirm & {
|
|
493
|
+
id: string;
|
|
494
|
+
} & Pick<IConfirm, 'onCancel' | 'onConfirm'>;
|
|
490
495
|
type TAlert = {
|
|
491
496
|
children: ReactNode;
|
|
492
497
|
title: string;
|
|
493
498
|
};
|
|
499
|
+
type TApiaUtilInnerAlert = TAlert & {
|
|
500
|
+
onClose: () => unknown;
|
|
501
|
+
id: string;
|
|
502
|
+
};
|
|
494
503
|
declare class ApiaUtilDialogs {
|
|
495
504
|
#private;
|
|
505
|
+
alerts: TApiaUtilInnerAlert[];
|
|
506
|
+
dialogs: TApiaUtilInnerConfirm[];
|
|
507
|
+
constructor();
|
|
496
508
|
alert(props: TAlert): Promise<void>;
|
|
497
509
|
confirm(props: TApiaUtilConfirm): Promise<boolean>;
|
|
498
|
-
Component: () => React$1.JSX.Element
|
|
510
|
+
Component: (() => React$1.JSX.Element) & {
|
|
511
|
+
displayName: string;
|
|
512
|
+
};
|
|
499
513
|
}
|
|
500
514
|
|
|
501
515
|
declare class ApiaUtilParsers {
|
|
@@ -1327,6 +1341,10 @@ interface MessageCallbackProps {
|
|
|
1327
1341
|
message: ChatMessage;
|
|
1328
1342
|
}
|
|
1329
1343
|
type MessageSubmitCallback = (props: MessageCallbackProps) => unknown;
|
|
1344
|
+
type TComponentRender = {
|
|
1345
|
+
path: string;
|
|
1346
|
+
args: Record<any, any>;
|
|
1347
|
+
};
|
|
1330
1348
|
|
|
1331
1349
|
declare class ChatMessage {
|
|
1332
1350
|
message: ReactNode;
|
|
@@ -2136,14 +2154,9 @@ interface IPagination {
|
|
|
2136
2154
|
}
|
|
2137
2155
|
declare const Pagination: React__default.MemoExoticComponent<({ appliedFilters, areAllFiltersApplied, className, currentPage, disabled, disableReduced, hasMore, hideInfo, hideMaximizeButton, hideRefreshButton, isLoading, isPerforming, onDeleteFilters, onPageChange, onRefresh, pageCount, recordsCount: outerRecordsCount, reachedMax, showMaximizeOnSmallBreakpoints, variant, isMaximized, onMaximize, labels, }: IPagination) => React__default.JSX.Element>;
|
|
2138
2156
|
|
|
2139
|
-
type TComponentRender = {
|
|
2140
|
-
path: string;
|
|
2141
|
-
args: Record<any, any>;
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
2157
|
declare const _default: React$1.MemoExoticComponent<({ str }: {
|
|
2145
2158
|
str: string;
|
|
2146
|
-
}) => React$1.JSX.Element
|
|
2159
|
+
}) => React$1.JSX.Element>;
|
|
2147
2160
|
|
|
2148
2161
|
interface IAsidePanel {
|
|
2149
2162
|
title?: string;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { uniqueId as uniqueId$3, cloneDeep, isFunction } from 'lodash-es';
|
|
|
7
7
|
import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Progress, Label as Label$1, Paragraph, Container, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
|
|
8
8
|
import { BarLoader } from 'react-spinners';
|
|
9
9
|
import uniqueId$2 from 'lodash-es/uniqueId';
|
|
10
|
-
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious,
|
|
10
|
+
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, getLabel, isChild, EventEmitter, useUnmount, useMount, StatefulEmitter, shallowEqual as shallowEqual$1, getSpecificParent, getDateFormat, customEvents, uniqueId as uniqueId$4, decodeBase64ToUtf8, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, useMatchScrollDirection, arrayOrArray } from '@apia/util';
|
|
11
11
|
import usePortal from 'react-cool-portal';
|
|
12
12
|
import { CSSTransition } from 'react-transition-group';
|
|
13
13
|
import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
|
|
@@ -425,7 +425,9 @@ function useModal(configuration) {
|
|
|
425
425
|
});
|
|
426
426
|
const hide = React__default.useCallback(() => {
|
|
427
427
|
setIsOpen(false);
|
|
428
|
-
|
|
428
|
+
if (configuration?.onClose)
|
|
429
|
+
configuration.onClose();
|
|
430
|
+
}, [configuration]);
|
|
429
431
|
const show = React__default.useCallback(() => {
|
|
430
432
|
if (configuration?.preFetcher) {
|
|
431
433
|
setIsLoading(true);
|
|
@@ -457,8 +459,7 @@ function useModal(configuration) {
|
|
|
457
459
|
if (configuration?.onOpen)
|
|
458
460
|
configuration.onOpen();
|
|
459
461
|
showPortal();
|
|
460
|
-
}
|
|
461
|
-
onClose?.();
|
|
462
|
+
}
|
|
462
463
|
}, [isOpen]);
|
|
463
464
|
return {
|
|
464
465
|
hide,
|
|
@@ -1443,7 +1444,7 @@ var __privateWrapper$2 = (obj, member, setter, getter) => ({
|
|
|
1443
1444
|
return __privateGet$9(obj, member, getter);
|
|
1444
1445
|
}
|
|
1445
1446
|
});
|
|
1446
|
-
var
|
|
1447
|
+
var _maxId$1, _maxOverlay;
|
|
1447
1448
|
class ApiaUtilModalHandler {
|
|
1448
1449
|
constructor(close) {
|
|
1449
1450
|
this.close = close;
|
|
@@ -1452,54 +1453,12 @@ class ApiaUtilModalHandler {
|
|
|
1452
1453
|
class ApiaUtilModals {
|
|
1453
1454
|
constructor() {
|
|
1454
1455
|
__publicField$q(this, "overlays", []);
|
|
1455
|
-
|
|
1456
|
+
__publicField$q(this, "modals", []);
|
|
1456
1457
|
__privateAdd$c(this, _maxId$1, 0);
|
|
1457
1458
|
__privateAdd$c(this, _maxOverlay, 0);
|
|
1458
|
-
__privateAdd$c(this, _useModalsList, () => {
|
|
1459
|
-
const [modals, setModals] = useState(
|
|
1460
|
-
[]
|
|
1461
|
-
);
|
|
1462
|
-
useMount(() => {
|
|
1463
|
-
const u1 = __privateGet$9(this, _emitter$4).on("open", (ev) => {
|
|
1464
|
-
setModals((current) => [
|
|
1465
|
-
...current,
|
|
1466
|
-
{
|
|
1467
|
-
...ev,
|
|
1468
|
-
isOpen: true,
|
|
1469
|
-
onClose: ev.onClose,
|
|
1470
|
-
onExited: () => {
|
|
1471
|
-
ev.onExited?.();
|
|
1472
|
-
setModals(
|
|
1473
|
-
(current2) => current2.filter((modal) => modal.id !== ev.id)
|
|
1474
|
-
);
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
]);
|
|
1478
|
-
});
|
|
1479
|
-
const u2 = __privateGet$9(this, _emitter$4).on("closeAll", () => {
|
|
1480
|
-
setModals(
|
|
1481
|
-
(current) => current.map((modal) => ({ ...modal, isOpen: false }))
|
|
1482
|
-
);
|
|
1483
|
-
});
|
|
1484
|
-
const u3 = __privateGet$9(this, _emitter$4).on("close", (modalId) => {
|
|
1485
|
-
setModals(
|
|
1486
|
-
(current) => current.map(
|
|
1487
|
-
(modal) => modal.id === modalId ? { ...modal, isOpen: false } : modal
|
|
1488
|
-
)
|
|
1489
|
-
);
|
|
1490
|
-
});
|
|
1491
|
-
return () => {
|
|
1492
|
-
u1();
|
|
1493
|
-
u2();
|
|
1494
|
-
u3();
|
|
1495
|
-
};
|
|
1496
|
-
});
|
|
1497
|
-
return modals;
|
|
1498
|
-
});
|
|
1499
1459
|
__publicField$q(this, "Component", observer(() => {
|
|
1500
|
-
const modals = __privateGet$9(this, _useModalsList).call(this);
|
|
1501
1460
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1502
|
-
modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)),
|
|
1461
|
+
this.modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)),
|
|
1503
1462
|
this.overlays.map((c) => c.render)
|
|
1504
1463
|
] });
|
|
1505
1464
|
}));
|
|
@@ -1508,17 +1467,27 @@ class ApiaUtilModals {
|
|
|
1508
1467
|
this.open(cevent.detail);
|
|
1509
1468
|
});
|
|
1510
1469
|
makeObservable(this, {
|
|
1511
|
-
overlays: observable
|
|
1470
|
+
overlays: observable,
|
|
1471
|
+
modals: observable
|
|
1512
1472
|
});
|
|
1513
1473
|
}
|
|
1514
1474
|
close(id) {
|
|
1515
|
-
|
|
1475
|
+
this.modals = this.modals.filter((s) => s.id !== id);
|
|
1516
1476
|
}
|
|
1517
1477
|
open(props) {
|
|
1518
1478
|
const id = props.id ?? `modal_${__privateWrapper$2(this, _maxId$1)._++}`;
|
|
1519
|
-
|
|
1479
|
+
this.modals.push({
|
|
1480
|
+
...props,
|
|
1481
|
+
id,
|
|
1482
|
+
isOpen: true,
|
|
1483
|
+
onClose: props.onClose,
|
|
1484
|
+
onExited: () => {
|
|
1485
|
+
props.onExited?.();
|
|
1486
|
+
this.close(id);
|
|
1487
|
+
}
|
|
1488
|
+
});
|
|
1520
1489
|
return new ApiaUtilModalHandler(() => {
|
|
1521
|
-
|
|
1490
|
+
this.close(id);
|
|
1522
1491
|
});
|
|
1523
1492
|
}
|
|
1524
1493
|
/**
|
|
@@ -1560,10 +1529,8 @@ class ApiaUtilModals {
|
|
|
1560
1529
|
};
|
|
1561
1530
|
}
|
|
1562
1531
|
}
|
|
1563
|
-
_emitter$4 = new WeakMap();
|
|
1564
1532
|
_maxId$1 = new WeakMap();
|
|
1565
1533
|
_maxOverlay = new WeakMap();
|
|
1566
|
-
_useModalsList = new WeakMap();
|
|
1567
1534
|
|
|
1568
1535
|
var __defProp$p = Object.defineProperty;
|
|
1569
1536
|
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -1933,6 +1900,7 @@ const ConfirmModal = ({
|
|
|
1933
1900
|
onConfirm,
|
|
1934
1901
|
onCancel,
|
|
1935
1902
|
title,
|
|
1903
|
+
size,
|
|
1936
1904
|
...props
|
|
1937
1905
|
}) => {
|
|
1938
1906
|
const hasConfirmed = useRef(false);
|
|
@@ -1961,6 +1929,7 @@ const ConfirmModal = ({
|
|
|
1961
1929
|
[]
|
|
1962
1930
|
),
|
|
1963
1931
|
title,
|
|
1932
|
+
size,
|
|
1964
1933
|
children: /* @__PURE__ */ jsx(Confirm, { ...props, onCancel: handleCancel, onConfirm: handleConfirm })
|
|
1965
1934
|
}
|
|
1966
1935
|
);
|
|
@@ -2003,7 +1972,7 @@ const AlertModal = ({ children, onClose, title }) => {
|
|
|
2003
1972
|
var __defProp$o = Object.defineProperty;
|
|
2004
1973
|
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2005
1974
|
var __publicField$o = (obj, key, value) => {
|
|
2006
|
-
__defNormalProp$o(obj, key + "" , value);
|
|
1975
|
+
__defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2007
1976
|
return value;
|
|
2008
1977
|
};
|
|
2009
1978
|
var __accessCheck$b = (obj, member, msg) => {
|
|
@@ -2032,40 +2001,23 @@ var __privateWrapper$1 = (obj, member, setter, getter) => ({
|
|
|
2032
2001
|
return __privateGet$8(obj, member, getter);
|
|
2033
2002
|
}
|
|
2034
2003
|
});
|
|
2035
|
-
var
|
|
2004
|
+
var _maxIdAlert, _maxIdConfirm;
|
|
2036
2005
|
class ApiaUtilDialogs {
|
|
2037
2006
|
constructor() {
|
|
2038
|
-
__privateAdd$b(this, _emitter$3, new EventEmitter());
|
|
2039
2007
|
__privateAdd$b(this, _maxIdAlert, 0);
|
|
2040
2008
|
__privateAdd$b(this, _maxIdConfirm, 0);
|
|
2041
|
-
__publicField$o(this, "
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
[]
|
|
2045
|
-
);
|
|
2046
|
-
useMount(() => {
|
|
2047
|
-
const unsuscribe1 = __privateGet$8(this, _emitter$3).on("alert", (ev) => {
|
|
2048
|
-
setAlertsDialogs((current) => [...current, ev]);
|
|
2049
|
-
});
|
|
2050
|
-
const unsuscribe2 = __privateGet$8(this, _emitter$3).on("confirm", (ev) => {
|
|
2051
|
-
setConfirmDialogs((current) => [...current, ev]);
|
|
2052
|
-
});
|
|
2053
|
-
return () => {
|
|
2054
|
-
unsuscribe1();
|
|
2055
|
-
unsuscribe2();
|
|
2056
|
-
};
|
|
2057
|
-
});
|
|
2009
|
+
__publicField$o(this, "alerts", []);
|
|
2010
|
+
__publicField$o(this, "dialogs", []);
|
|
2011
|
+
__publicField$o(this, "Component", observer(() => {
|
|
2058
2012
|
const removeModal = useCallback(
|
|
2059
2013
|
(which) => {
|
|
2060
|
-
|
|
2061
|
-
(current) => current.filter((search) => search !== which)
|
|
2062
|
-
);
|
|
2014
|
+
this.dialogs = this.dialogs.filter((search) => search !== which);
|
|
2063
2015
|
},
|
|
2064
2016
|
[]
|
|
2065
2017
|
);
|
|
2066
2018
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2067
|
-
|
|
2068
|
-
|
|
2019
|
+
this.alerts.map((current) => /* @__PURE__ */ createElement(AlertModal, { ...current, key: current.id })),
|
|
2020
|
+
this.dialogs.map((current) => /* @__PURE__ */ createElement(
|
|
2069
2021
|
ConfirmModal,
|
|
2070
2022
|
{
|
|
2071
2023
|
...current,
|
|
@@ -2081,11 +2033,12 @@ class ApiaUtilDialogs {
|
|
|
2081
2033
|
}
|
|
2082
2034
|
))
|
|
2083
2035
|
] });
|
|
2084
|
-
});
|
|
2036
|
+
}));
|
|
2037
|
+
makeAutoObservable(this);
|
|
2085
2038
|
}
|
|
2086
2039
|
alert(props) {
|
|
2087
2040
|
return new Promise((resolve) => {
|
|
2088
|
-
|
|
2041
|
+
this.alerts.push({
|
|
2089
2042
|
...props,
|
|
2090
2043
|
onClose: () => resolve(),
|
|
2091
2044
|
id: `confirm${__privateWrapper$1(this, _maxIdAlert)._++}`
|
|
@@ -2094,7 +2047,7 @@ class ApiaUtilDialogs {
|
|
|
2094
2047
|
}
|
|
2095
2048
|
confirm(props) {
|
|
2096
2049
|
return new Promise((resolve) => {
|
|
2097
|
-
|
|
2050
|
+
this.dialogs.push({
|
|
2098
2051
|
...props,
|
|
2099
2052
|
id: `confirm${__privateWrapper$1(this, _maxIdConfirm)._++}`,
|
|
2100
2053
|
onCancel: () => resolve(false),
|
|
@@ -2103,7 +2056,6 @@ class ApiaUtilDialogs {
|
|
|
2103
2056
|
});
|
|
2104
2057
|
}
|
|
2105
2058
|
}
|
|
2106
|
-
_emitter$3 = new WeakMap();
|
|
2107
2059
|
_maxIdAlert = new WeakMap();
|
|
2108
2060
|
_maxIdConfirm = new WeakMap();
|
|
2109
2061
|
|
|
@@ -5682,7 +5634,8 @@ const FileAttachment = observer(
|
|
|
5682
5634
|
onAddDescription(attachment, ev.desc);
|
|
5683
5635
|
}
|
|
5684
5636
|
return true;
|
|
5685
|
-
}
|
|
5637
|
+
},
|
|
5638
|
+
title: getLabel("btnAddComment").text
|
|
5686
5639
|
});
|
|
5687
5640
|
},
|
|
5688
5641
|
variant: "icon-only"
|
|
@@ -5721,33 +5674,6 @@ const Attachments = observer(
|
|
|
5721
5674
|
}
|
|
5722
5675
|
);
|
|
5723
5676
|
|
|
5724
|
-
function importComponent(path) {
|
|
5725
|
-
return lazy(() => {
|
|
5726
|
-
return new Promise((resolve) => {
|
|
5727
|
-
import(
|
|
5728
|
-
/* webpackInclude: /\.tsx?$/ */
|
|
5729
|
-
`/customComponents/${path}`
|
|
5730
|
-
).then((result) => {
|
|
5731
|
-
if (result?.default?.default)
|
|
5732
|
-
resolve(result.default);
|
|
5733
|
-
else if (result?.default)
|
|
5734
|
-
resolve(result);
|
|
5735
|
-
else
|
|
5736
|
-
resolve({
|
|
5737
|
-
default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
|
|
5738
|
-
});
|
|
5739
|
-
}).catch((error) => {
|
|
5740
|
-
resolve({
|
|
5741
|
-
default: () => {
|
|
5742
|
-
console.error(error);
|
|
5743
|
-
return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
|
|
5744
|
-
}
|
|
5745
|
-
});
|
|
5746
|
-
});
|
|
5747
|
-
});
|
|
5748
|
-
});
|
|
5749
|
-
}
|
|
5750
|
-
|
|
5751
5677
|
const AttributeParsers = [
|
|
5752
5678
|
/**
|
|
5753
5679
|
* Allows to pass javascript event handlers through the format
|
|
@@ -6406,6 +6332,51 @@ __publicField$d(_Templater, "_instance", null);
|
|
|
6406
6332
|
let Templater = _Templater;
|
|
6407
6333
|
|
|
6408
6334
|
const MDRenderer = ({ str }) => {
|
|
6335
|
+
return /* @__PURE__ */ jsx(Box, { ...getVariant("layout.common.markdown"), children: Templater.instance.parseString(
|
|
6336
|
+
new Remarkable({ linkTarget: "_blank" }).render(str)
|
|
6337
|
+
) });
|
|
6338
|
+
};
|
|
6339
|
+
var MDRenderer$1 = memo(MDRenderer);
|
|
6340
|
+
|
|
6341
|
+
function importComponent(path) {
|
|
6342
|
+
return lazy(() => {
|
|
6343
|
+
return new Promise((resolve) => {
|
|
6344
|
+
import(
|
|
6345
|
+
/* webpackInclude: /\.tsx?$/ */
|
|
6346
|
+
`/customComponents/${path}`
|
|
6347
|
+
).then((result) => {
|
|
6348
|
+
if (result?.default?.default)
|
|
6349
|
+
resolve(result.default);
|
|
6350
|
+
else if (result?.default)
|
|
6351
|
+
resolve(result);
|
|
6352
|
+
else
|
|
6353
|
+
resolve({
|
|
6354
|
+
default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
|
|
6355
|
+
});
|
|
6356
|
+
}).catch((error) => {
|
|
6357
|
+
resolve({
|
|
6358
|
+
default: () => {
|
|
6359
|
+
console.error(error);
|
|
6360
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
|
|
6361
|
+
}
|
|
6362
|
+
});
|
|
6363
|
+
});
|
|
6364
|
+
});
|
|
6365
|
+
});
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
const MessageBlock = ({
|
|
6369
|
+
componentData
|
|
6370
|
+
}) => {
|
|
6371
|
+
if (typeof componentData.args === "string") {
|
|
6372
|
+
componentData.args = JSON.parse(componentData.args);
|
|
6373
|
+
}
|
|
6374
|
+
const Component = importComponent(componentData.path);
|
|
6375
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...componentData.args }) });
|
|
6376
|
+
};
|
|
6377
|
+
var MessageBlock$1 = memo(MessageBlock);
|
|
6378
|
+
|
|
6379
|
+
const MessageBlocks = ({ str }) => {
|
|
6409
6380
|
const parts = str.split(/(!!\[[^]+])/g).map((c, i) => {
|
|
6410
6381
|
if (c.match(/^!!\[[^]+]$/)) {
|
|
6411
6382
|
const definition = JSON.parse(
|
|
@@ -6413,20 +6384,14 @@ const MDRenderer = ({ str }) => {
|
|
|
6413
6384
|
(c.match(/^!!\[([^]+)]$/) ?? [void 0, void 0])[1] ?? ""
|
|
6414
6385
|
)
|
|
6415
6386
|
);
|
|
6416
|
-
|
|
6417
|
-
definition.args = JSON.parse(definition.args);
|
|
6418
|
-
}
|
|
6419
|
-
const Component = importComponent(definition.path);
|
|
6420
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...definition.args }) }, i);
|
|
6387
|
+
return /* @__PURE__ */ jsx(MessageBlock$1, { componentData: definition }, i);
|
|
6421
6388
|
} else {
|
|
6422
|
-
return /* @__PURE__ */ jsx(
|
|
6423
|
-
new Remarkable({ linkTarget: "_blank" }).render(c)
|
|
6424
|
-
) }, i);
|
|
6389
|
+
return /* @__PURE__ */ jsx(MDRenderer$1, { str: c }, i);
|
|
6425
6390
|
}
|
|
6426
6391
|
});
|
|
6427
6392
|
return parts;
|
|
6428
6393
|
};
|
|
6429
|
-
var
|
|
6394
|
+
var MessageBlocks$1 = memo(MessageBlocks);
|
|
6430
6395
|
|
|
6431
6396
|
const Message = observer(
|
|
6432
6397
|
({
|
|
@@ -6448,7 +6413,7 @@ const Message = observer(
|
|
|
6448
6413
|
{
|
|
6449
6414
|
className: "history_message__content",
|
|
6450
6415
|
...typeof message === "string" ? {
|
|
6451
|
-
children: /* @__PURE__ */ jsx(
|
|
6416
|
+
children: /* @__PURE__ */ jsx(MessageBlocks$1, { str: message })
|
|
6452
6417
|
} : { children: message }
|
|
6453
6418
|
}
|
|
6454
6419
|
),
|