@aws/mynah-ui 4.3.2 → 4.4.1

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.
@@ -92,3 +92,44 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
92
92
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
93
93
  THE SOFTWARE.
94
94
 
95
+ ------
96
+
97
+ ** sanitize-html; version 2.12.1 -- https://github.com/apostrophecms/sanitize-html
98
+
99
+ MIT LICENSE
100
+
101
+ Copyright (c) 2013, 2014, 2015 P'unk Avenue LLC
102
+
103
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
104
+
105
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
106
+
107
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
+
109
+
110
+
111
+ ------
112
+
113
+ ** just-clone; version 6.2.0 -- https://github.com/angus-c/just
114
+
115
+ The MIT License (MIT)
116
+
117
+ Copyright (c) 2016-2023 Angus Croll
118
+
119
+ Permission is hereby granted, free of charge, to any person obtaining a copy
120
+ of this software and associated documentation files (the "Software"), to deal
121
+ in the Software without restriction, including without limitation the rights
122
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
123
+ copies of the Software, and to permit persons to whom the Software is
124
+ furnished to do so, subject to the following conditions:
125
+
126
+ The above copyright notice and this permission notice shall be included in all
127
+ copies or substantial portions of the Software.
128
+
129
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
135
+ SOFTWARE.
@@ -17,11 +17,12 @@ export declare const highlightersWithTooltip: {
17
17
  export declare const PARTS_CLASS_NAME = "typewriter-part";
18
18
  export declare const PARTS_CLASS_NAME_VISIBLE = "typewriter";
19
19
  export interface CardBodyProps {
20
- body: string;
20
+ body?: string;
21
21
  children?: Array<ExtendedHTMLElement | HTMLElement | string | DomBuilderObject>;
22
22
  childLocation?: 'above-body' | 'below-body';
23
23
  highlightRangeWithTooltip?: ReferenceTrackerInformation[];
24
24
  useParts?: boolean;
25
+ processChildren?: boolean;
25
26
  onLinkClick?: (url: string, e: MouseEvent) => void;
26
27
  onCopiedToClipboard?: OnCopiedToClipboardFunction;
27
28
  onInsertToCursorPosition?: OnInsertToCursorPositionFunction;
@@ -19,6 +19,7 @@ export declare class ChatItemCard {
19
19
  chatAvatar: ExtendedHTMLElement;
20
20
  updateStack: Array<Partial<ChatItem>>;
21
21
  chatFormItems: ChatItemFormItemsWrapper | null;
22
+ customRendererWrapper: CardBody | null;
22
23
  chatButtons: ChatItemButtonsWrapper | null;
23
24
  fileTreeWrapper: ChatItemTreeViewWrapper | null;
24
25
  typewriterItemIndex: number;
@@ -3,17 +3,26 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { MynahPortalNames } from '../static';
6
+ import { AllowedTagsInCustomRenderer, AllowedAttributesInCustomRenderer } from './sanitize';
6
7
  export declare const DS: typeof document.querySelectorAll;
7
- type DomBuilderEventHandler = (event?: any) => any;
8
- interface DomBuilderEventHandlerWithOptions {
8
+ type GenericEvents = Extract<keyof GlobalEventHandlersEventMap, string>;
9
+ export type DomBuilderEventHandler = (event?: any) => any;
10
+ export interface DomBuilderEventHandlerWithOptions {
9
11
  handler: DomBuilderEventHandler;
10
12
  options?: AddEventListenerOptions;
11
13
  }
12
- export interface DomBuilderObject {
13
- type: string;
14
+ interface GenericDomBuilderAttributes {
14
15
  attributes?: Record<string, string> | undefined;
15
16
  classNames?: string[] | undefined;
16
- events?: Record<string, DomBuilderEventHandler | DomBuilderEventHandlerWithOptions> | undefined;
17
+ events?: Partial<Record<GenericEvents, DomBuilderEventHandler | DomBuilderEventHandlerWithOptions>> | undefined;
18
+ }
19
+ export interface ChatItemBodyRenderer extends GenericDomBuilderAttributes {
20
+ type: AllowedTagsInCustomRenderer;
21
+ children?: Array<string | ChatItemBodyRenderer> | undefined;
22
+ attributes?: Partial<Record<AllowedAttributesInCustomRenderer, string>> | undefined;
23
+ }
24
+ export interface DomBuilderObject extends GenericDomBuilderAttributes {
25
+ type: string;
17
26
  children?: Array<string | DomBuilderObject | HTMLElement | ExtendedHTMLElement> | undefined;
18
27
  innerHTML?: string | undefined;
19
28
  persistent?: boolean | undefined;
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export declare const AllowedTags: readonly ["a", "audio", "b", "blockquote", "br", "hr", "canvas", "code", "col", "colgroup", "data", "div", "em", "embed", "figcaption", "figure", "h1", "h2", "h3", "h4", "h5", "h6", "i", "iframe", "img", "li", "map", "mark", "object", "ol", "p", "pre", "q", "s", "small", "source", "span", "strong", "sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "track", "u", "ul", "video"];
6
+ export declare const AllowedAttributes: readonly ["accept", "accept-charset", "accesskey", "align", "allow", "allowfullscreen", "alt", "as", "async", "autocapitalize", "autoplay", "charset", "class", "cols", "colspan", "controls", "crossorigin", "data", "data-*", "datetime", "decoding", "default", "dir", "download", "headers", "hidden", "high", "href", "hreflang", "id", "ismap", "itemprop", "kind", "lang", "language", "loop", "low", "media", "muted", "optimum", "ping", "playsinline", "poster", "preload", "referrerpolicy", "rel", "reversed", "role", "rowspan", "sandbox", "scope", "shape", "size", "sizes", "slot", "span", "spellcheck", "src", "srcdoc", "srclang", "srcset", "start", "target", "title", "translate", "usemap", "wrap", "aspect-ratio"];
7
+ export type AllowedTagsInCustomRenderer = (typeof AllowedTags)[number];
8
+ export type AllowedAttributesInCustomRenderer = (typeof AllowedAttributes)[number];
9
+ export declare const cleanHtml: (dirty: string) => string;
package/dist/main.d.ts CHANGED
@@ -4,7 +4,9 @@
4
4
  */
5
5
  import { RelevancyVoteType, FeedbackPayload, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatPrompt, MynahUITabStoreModel, MynahUITabStoreTab, ConfigModel, ReferenceTrackerInformation, CodeSelectionType, Engagement, ChatItemFormItem, ChatItemButton } from './static';
6
6
  import './styles/styles.scss';
7
- export { FeedbackPayload, RelevancyVoteType, EngagementType, Engagement, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatItemType, ChatPrompt, SourceLink } from './static';
7
+ export { ChatItemBodyRenderer, } from './helper/dom';
8
+ export { AllowedAttributesInCustomRenderer, AllowedTagsInCustomRenderer } from './helper/sanitize';
9
+ export { FeedbackPayload, RelevancyVoteType, EngagementType, Engagement, MynahUIDataModel, NotificationType, ChatItem, ChatItemAction, ChatItemType, ChatPrompt, SourceLink, } from './static';
8
10
  export { ToggleOption } from './components/toggle';
9
11
  export { MynahIcons } from './components/icon';
10
12
  export interface MynahUIProps {