@kubex/zinc 1.1.2 → 1.1.4
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/custom-elements.json +254 -89
- package/dist/vscode.html-custom-data.json +43 -14
- package/dist/web-types.json +90 -29
- package/dist/zn.d.ts +39 -6
- package/dist/zn.min.js +282 -272
- package/docs/pages/components/chat-message.md +56 -2
- package/package.json +1 -1
- package/src/components/alert/alert.component.ts +1 -0
- package/src/components/alert/alert.scss +9 -1
- package/src/components/chat-message/chat-message.component.ts +155 -21
- package/src/components/chat-message/chat-message.scss +148 -2
- package/src/components/chat-message/clean-message.ts +46 -0
- package/src/components/editor/editor.scss +2 -2
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@kubex/zinc",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -15,6 +15,28 @@
|
|
|
15
15
|
"events": [],
|
|
16
16
|
"js": { "properties": [], "events": [] }
|
|
17
17
|
},
|
|
18
|
+
{
|
|
19
|
+
"name": "zn-action-bar",
|
|
20
|
+
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
21
|
+
"doc-url": "",
|
|
22
|
+
"attributes": [],
|
|
23
|
+
"slots": [
|
|
24
|
+
{ "name": "", "description": "The default slot." },
|
|
25
|
+
{ "name": "example", "description": "An example slot." }
|
|
26
|
+
],
|
|
27
|
+
"events": [
|
|
28
|
+
{ "name": "zn-event-name", "description": "Emitted as an example." }
|
|
29
|
+
],
|
|
30
|
+
"js": {
|
|
31
|
+
"properties": [],
|
|
32
|
+
"events": [
|
|
33
|
+
{
|
|
34
|
+
"name": "zn-event-name",
|
|
35
|
+
"description": "Emitted as an example."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
18
40
|
{
|
|
19
41
|
"name": "zn-alert",
|
|
20
42
|
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
@@ -29,6 +51,13 @@
|
|
|
29
51
|
"name": "collapse",
|
|
30
52
|
"value": { "type": "boolean", "default": "false" }
|
|
31
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "appearance",
|
|
56
|
+
"value": {
|
|
57
|
+
"type": "'transparent' | 'solid'",
|
|
58
|
+
"default": "'transparent'"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
32
61
|
{
|
|
33
62
|
"name": "level",
|
|
34
63
|
"value": {
|
|
@@ -56,6 +85,7 @@
|
|
|
56
85
|
{ "name": "icon", "type": "string" },
|
|
57
86
|
{ "name": "caption", "type": "string" },
|
|
58
87
|
{ "name": "collapse", "type": "boolean" },
|
|
88
|
+
{ "name": "appearance", "type": "'transparent' | 'solid'" },
|
|
59
89
|
{
|
|
60
90
|
"name": "level",
|
|
61
91
|
"type": "'primary' | 'error' | 'info' | 'success' | 'warning' | 'note' | 'cosmic'"
|
|
@@ -70,28 +100,6 @@
|
|
|
70
100
|
]
|
|
71
101
|
}
|
|
72
102
|
},
|
|
73
|
-
{
|
|
74
|
-
"name": "zn-action-bar",
|
|
75
|
-
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
76
|
-
"doc-url": "",
|
|
77
|
-
"attributes": [],
|
|
78
|
-
"slots": [
|
|
79
|
-
{ "name": "", "description": "The default slot." },
|
|
80
|
-
{ "name": "example", "description": "An example slot." }
|
|
81
|
-
],
|
|
82
|
-
"events": [
|
|
83
|
-
{ "name": "zn-event-name", "description": "Emitted as an example." }
|
|
84
|
-
],
|
|
85
|
-
"js": {
|
|
86
|
-
"properties": [],
|
|
87
|
-
"events": [
|
|
88
|
-
{
|
|
89
|
-
"name": "zn-event-name",
|
|
90
|
-
"description": "Emitted as an example."
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
103
|
{
|
|
96
104
|
"name": "zn-animated-button",
|
|
97
105
|
"description": "\n---\n\n\n### **Methods:**\n - **purchase(): _void_** - Programmatically trigger the purchase flow\n- **setSuccess(): _void_** - Set the button to success state manually\n- **setFailure(message): _void_** - Set the button to failure state manually with optional error message\n- **reset(): _void_** - Reset the button to idle state",
|
|
@@ -711,22 +719,50 @@
|
|
|
711
719
|
},
|
|
712
720
|
{
|
|
713
721
|
"name": "zn-chat-message",
|
|
714
|
-
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions.\n---\n\n\n### **Slots:**\n - _default_ - The message content.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.",
|
|
722
|
+
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions. Also renders\nsystem events (connections, transfers, etc.) as a centred card.\n---\n\n\n### **Slots:**\n - _default_ - The message content. Ignored when the `message` attribute is set.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.\n- **system-card** - The card rendered for system action types.",
|
|
715
723
|
"doc-url": "",
|
|
716
724
|
"attributes": [
|
|
717
725
|
{
|
|
718
726
|
"name": "sender",
|
|
719
|
-
"description": "The sender's name, also used for the avatar
|
|
727
|
+
"description": "The sender's name, also used for the avatar.",
|
|
728
|
+
"value": { "type": "string", "default": "''" }
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"name": "message",
|
|
732
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
720
733
|
"value": { "type": "string", "default": "''" }
|
|
721
734
|
},
|
|
722
735
|
{
|
|
723
736
|
"name": "time",
|
|
724
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
737
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
738
|
+
"value": { "type": "string", "default": "''" }
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"name": "avatar",
|
|
742
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
725
743
|
"value": { "type": "string", "default": "''" }
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "action-type",
|
|
747
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
748
|
+
"value": { "type": "ChatMessageActionType", "default": "''" }
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"name": "customer-initiated",
|
|
752
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
753
|
+
"value": { "type": "boolean", "default": "false" }
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"name": "agent-initiated",
|
|
757
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
758
|
+
"value": { "type": "boolean", "default": "false" }
|
|
726
759
|
}
|
|
727
760
|
],
|
|
728
761
|
"slots": [
|
|
729
|
-
{
|
|
762
|
+
{
|
|
763
|
+
"name": "",
|
|
764
|
+
"description": "The message content. Ignored when the `message` attribute is set."
|
|
765
|
+
},
|
|
730
766
|
{
|
|
731
767
|
"name": "badge",
|
|
732
768
|
"description": "Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip)."
|
|
@@ -745,13 +781,38 @@
|
|
|
745
781
|
"properties": [
|
|
746
782
|
{
|
|
747
783
|
"name": "sender",
|
|
748
|
-
"description": "The sender's name, also used for the avatar
|
|
784
|
+
"description": "The sender's name, also used for the avatar.",
|
|
785
|
+
"type": "string"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "message",
|
|
789
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
749
790
|
"type": "string"
|
|
750
791
|
},
|
|
751
792
|
{
|
|
752
793
|
"name": "time",
|
|
753
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
794
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
795
|
+
"type": "string"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"name": "avatar",
|
|
799
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
754
800
|
"type": "string"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"name": "actionType",
|
|
804
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
805
|
+
"type": "ChatMessageActionType"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "customerInitiated",
|
|
809
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
810
|
+
"type": "boolean"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"name": "agentInitiated",
|
|
814
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
815
|
+
"type": "boolean"
|
|
755
816
|
}
|
|
756
817
|
],
|
|
757
818
|
"events": []
|
package/dist/zn.d.ts
CHANGED
|
@@ -1435,6 +1435,7 @@ declare module "components/alert/alert.component" {
|
|
|
1435
1435
|
icon: string;
|
|
1436
1436
|
caption: string;
|
|
1437
1437
|
collapse: boolean;
|
|
1438
|
+
appearance: 'transparent' | 'solid';
|
|
1438
1439
|
level: 'primary' | 'error' | 'info' | 'success' | 'warning' | 'note' | 'cosmic';
|
|
1439
1440
|
size: 'small' | 'medium' | 'large';
|
|
1440
1441
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1493,20 +1494,26 @@ declare module "components/button-group/index" {
|
|
|
1493
1494
|
}
|
|
1494
1495
|
}
|
|
1495
1496
|
}
|
|
1497
|
+
declare module "components/chat-message/clean-message" {
|
|
1498
|
+
/** Strip scripts and event/handler attributes from an untrusted HTML string. */
|
|
1499
|
+
export function cleanHTML(message: string): string;
|
|
1500
|
+
}
|
|
1496
1501
|
declare module "components/chat-message/chat-message.component" {
|
|
1497
|
-
import { type CSSResultGroup } from 'lit';
|
|
1502
|
+
import { type CSSResultGroup, nothing } from 'lit';
|
|
1498
1503
|
import ZincElement from "internal/zinc-element";
|
|
1499
1504
|
import ZnIcon from "components/icon/index";
|
|
1505
|
+
export type ChatMessageActionType = '' | 'connected.agent' | 'attachment.added' | 'multi.answer' | 'transfer' | 'ended' | 'error' | 'message-sending' | 'customer.ended' | 'customer.connected' | 'customer.disconnected' | 'internal';
|
|
1500
1506
|
/**
|
|
1501
1507
|
* @summary A single message in a chat-style conversation: avatar, sender,
|
|
1502
|
-
* time, optional badge, and a message bubble with optional actions.
|
|
1508
|
+
* time, optional badge, and a message bubble with optional actions. Also renders
|
|
1509
|
+
* system events (connections, transfers, etc.) as a centred card.
|
|
1503
1510
|
* @documentation https://zinc.style/components/chat-message
|
|
1504
1511
|
* @status experimental
|
|
1505
1512
|
* @since 1.0
|
|
1506
1513
|
*
|
|
1507
1514
|
* @dependency zn-icon
|
|
1508
1515
|
*
|
|
1509
|
-
* @slot - The message content.
|
|
1516
|
+
* @slot - The message content. Ignored when the `message` attribute is set.
|
|
1510
1517
|
* @slot badge - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).
|
|
1511
1518
|
* @slot edit-dialog-trigger - Action rendered at the end of the bubble (e.g. a remove icon button).
|
|
1512
1519
|
* @slot edit-dialog - Pass-through for an associated dialog element.
|
|
@@ -1517,6 +1524,7 @@ declare module "components/chat-message/chat-message.component" {
|
|
|
1517
1524
|
* @csspart header - The sender/time/badge row.
|
|
1518
1525
|
* @csspart bubble - The message bubble.
|
|
1519
1526
|
* @csspart content - The message content within the bubble.
|
|
1527
|
+
* @csspart system-card - The card rendered for system action types.
|
|
1520
1528
|
*
|
|
1521
1529
|
* @cssproperty --message-background - The bubble's background colour.
|
|
1522
1530
|
*/
|
|
@@ -1525,12 +1533,37 @@ declare module "components/chat-message/chat-message.component" {
|
|
|
1525
1533
|
static dependencies: {
|
|
1526
1534
|
'zn-icon': typeof ZnIcon;
|
|
1527
1535
|
};
|
|
1528
|
-
|
|
1536
|
+
static readonly SYSTEM_ACTION_TYPES: readonly string[];
|
|
1537
|
+
private static readonly DISPLAYED_ACTION_TYPES;
|
|
1538
|
+
/** The sender's name, also used for the avatar. */
|
|
1529
1539
|
sender: string;
|
|
1530
|
-
/**
|
|
1540
|
+
/**
|
|
1541
|
+
* The message body as an HTML string. When set, it is sanitized (scripts and event
|
|
1542
|
+
* handlers stripped), newlines become line breaks and bare URLs become links. When
|
|
1543
|
+
* omitted the default slot is rendered instead.
|
|
1544
|
+
*/
|
|
1545
|
+
message: string;
|
|
1546
|
+
/** Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today). */
|
|
1531
1547
|
time: string;
|
|
1548
|
+
/** Overrides the avatar source. Defaults to `sender`. */
|
|
1549
|
+
avatar: string;
|
|
1550
|
+
/** The kind of message. Drives system-card rendering, the sending state and badges. */
|
|
1551
|
+
actionType: ChatMessageActionType;
|
|
1552
|
+
/** Marks the message as initiated by the customer (affects styling and grouping). */
|
|
1553
|
+
customerInitiated: boolean;
|
|
1554
|
+
/** Marks the message as initiated by an agent (affects styling and grouping). */
|
|
1555
|
+
agentInitiated: boolean;
|
|
1556
|
+
connectedCallback(): void;
|
|
1557
|
+
protected render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1558
|
+
private isSystemMessage;
|
|
1559
|
+
private renderSystemCard;
|
|
1560
|
+
private systemLabel;
|
|
1561
|
+
private renderHeader;
|
|
1562
|
+
private renderContent;
|
|
1563
|
+
/** HH:MM only — used on the system card. */
|
|
1532
1564
|
private getTime;
|
|
1533
|
-
|
|
1565
|
+
/** HH:MM, prefixed with the date when the message is not from today. */
|
|
1566
|
+
private getSentTime;
|
|
1534
1567
|
}
|
|
1535
1568
|
}
|
|
1536
1569
|
declare module "components/chat-message/index" {
|