@wirabyte/ui 2.0.0-beta.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +6 -6
- package/avatar/avatar.component.d.ts +4 -2
- package/avatar/avatar.types.d.ts +3 -0
- package/breadcrumb/breadcrumb.component.d.ts +3 -1
- package/button/button.styles.d.ts +1 -1
- package/chat/chat.component.d.ts +118 -0
- package/chat/chat.module.d.ts +8 -0
- package/chat/chat.types.d.ts +64 -0
- package/chat/index.d.ts +5 -0
- package/chat/public-api.d.ts +3 -0
- package/config/options.d.ts +13 -0
- package/config/theme.service.d.ts +5 -0
- package/config/wu-config.service.d.ts +16 -0
- package/core/catalog.d.ts +6 -1
- package/core/overrides.d.ts +7 -0
- package/core/thai/locale.d.ts +47 -0
- package/datepicker/datepicker.component.d.ts +3 -2
- package/descriptions/descriptions.component.d.ts +56 -0
- package/descriptions/descriptions.module.d.ts +8 -0
- package/descriptions/index.d.ts +5 -0
- package/descriptions/public-api.d.ts +2 -0
- package/esm2022/accordion/accordion.component.mjs +4 -4
- package/esm2022/alert/alert-dialog.component.mjs +3 -3
- package/esm2022/asidemenu/asidemenu.component.mjs +3 -3
- package/esm2022/avatar/avatar.component.mjs +11 -5
- package/esm2022/avatar/avatar.types.mjs +2 -2
- package/esm2022/breadcrumb/breadcrumb.component.mjs +5 -3
- package/esm2022/button/button.component.mjs +2 -2
- package/esm2022/button/button.styles.mjs +2 -2
- package/esm2022/card/card.component.mjs +8 -8
- package/esm2022/chat/chat.component.mjs +370 -0
- package/esm2022/chat/chat.module.mjs +17 -0
- package/esm2022/chat/chat.types.mjs +2 -0
- package/esm2022/chat/public-api.mjs +4 -0
- package/esm2022/chat/wirabyte-ui-chat.mjs +5 -0
- package/esm2022/config/options.mjs +1 -1
- package/esm2022/config/theme.service.mjs +35 -3
- package/esm2022/config/wu-config.service.mjs +22 -1
- package/esm2022/core/catalog.mjs +22 -2
- package/esm2022/core/families.mjs +43 -1
- package/esm2022/core/overrides.mjs +26 -1
- package/esm2022/core/thai/locale.mjs +67 -1
- package/esm2022/datepicker/datepicker.component.mjs +6 -5
- package/esm2022/descriptions/descriptions.component.mjs +112 -0
- package/esm2022/descriptions/descriptions.module.mjs +17 -0
- package/esm2022/descriptions/public-api.mjs +3 -0
- package/esm2022/descriptions/wirabyte-ui-descriptions.mjs +5 -0
- package/esm2022/dialog/dialog.component.mjs +3 -3
- package/esm2022/drawer/drawer.component.mjs +3 -3
- package/esm2022/emptystate/emptystate.component.mjs +3 -3
- package/esm2022/errorpage/errorpage.component.mjs +3 -3
- package/esm2022/fieldset/fieldset.component.mjs +4 -4
- package/esm2022/metergroup/metergroup.component.mjs +19 -5
- package/esm2022/metergroup/metergroup.types.mjs +1 -1
- package/esm2022/navbar/navbar.component.mjs +3 -3
- package/esm2022/panel/panel.component.mjs +6 -6
- package/esm2022/popover/popover.base.mjs +3 -3
- package/esm2022/result/result.component.mjs +3 -3
- package/esm2022/scheduler/public-api.mjs +4 -0
- package/esm2022/scheduler/scheduler.component.mjs +484 -0
- package/esm2022/scheduler/scheduler.module.mjs +17 -0
- package/esm2022/scheduler/scheduler.types.mjs +2 -0
- package/esm2022/scheduler/wirabyte-ui-scheduler.mjs +5 -0
- package/esm2022/selectbutton/selectbutton.component.mjs +25 -4
- package/esm2022/signaturepad/public-api.mjs +3 -0
- package/esm2022/signaturepad/signaturepad.component.mjs +289 -0
- package/esm2022/signaturepad/signaturepad.module.mjs +17 -0
- package/esm2022/signaturepad/wirabyte-ui-signaturepad.mjs +5 -0
- package/esm2022/sitefooter/sitefooter.component.mjs +2 -2
- package/esm2022/stat/public-api.mjs +3 -0
- package/esm2022/stat/stat.component.mjs +128 -0
- package/esm2022/stat/stat.module.mjs +17 -0
- package/esm2022/stat/wirabyte-ui-stat.mjs +5 -0
- package/esm2022/table/table.celleditor.mjs +4 -4
- package/esm2022/tabs/tabs.component.mjs +3 -3
- package/esm2022/tag/tag.component.mjs +2 -2
- package/esm2022/textarea/textarea.directive.mjs +33 -1
- package/esm2022/thai/thai.pipes.mjs +3 -3
- package/esm2022/toolbar/toolbar.component.mjs +7 -7
- package/fesm2022/wirabyte-ui-accordion.mjs +3 -3
- package/fesm2022/wirabyte-ui-accordion.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-alert.mjs +2 -2
- package/fesm2022/wirabyte-ui-alert.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-asidemenu.mjs +2 -2
- package/fesm2022/wirabyte-ui-asidemenu.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-avatar.mjs +12 -5
- package/fesm2022/wirabyte-ui-avatar.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-breadcrumb.mjs +4 -2
- package/fesm2022/wirabyte-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-button.mjs +3 -3
- package/fesm2022/wirabyte-ui-button.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-card.mjs +7 -7
- package/fesm2022/wirabyte-ui-card.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-chat.mjs +391 -0
- package/fesm2022/wirabyte-ui-chat.mjs.map +1 -0
- package/fesm2022/wirabyte-ui-config.mjs +55 -2
- package/fesm2022/wirabyte-ui-config.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-core.mjs +155 -2
- package/fesm2022/wirabyte-ui-core.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-datepicker.mjs +6 -5
- package/fesm2022/wirabyte-ui-datepicker.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-descriptions.mjs +133 -0
- package/fesm2022/wirabyte-ui-descriptions.mjs.map +1 -0
- package/fesm2022/wirabyte-ui-dialog.mjs +2 -2
- package/fesm2022/wirabyte-ui-dialog.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-drawer.mjs +2 -2
- package/fesm2022/wirabyte-ui-drawer.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-emptystate.mjs +2 -2
- package/fesm2022/wirabyte-ui-emptystate.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-errorpage.mjs +2 -2
- package/fesm2022/wirabyte-ui-errorpage.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-fieldset.mjs +3 -3
- package/fesm2022/wirabyte-ui-fieldset.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-metergroup.mjs +18 -4
- package/fesm2022/wirabyte-ui-metergroup.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-navbar.mjs +2 -2
- package/fesm2022/wirabyte-ui-navbar.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-panel.mjs +5 -5
- package/fesm2022/wirabyte-ui-panel.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-popover.mjs +2 -2
- package/fesm2022/wirabyte-ui-popover.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-result.mjs +2 -2
- package/fesm2022/wirabyte-ui-result.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-scheduler.mjs +505 -0
- package/fesm2022/wirabyte-ui-scheduler.mjs.map +1 -0
- package/fesm2022/wirabyte-ui-selectbutton.mjs +24 -3
- package/fesm2022/wirabyte-ui-selectbutton.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-signaturepad.mjs +310 -0
- package/fesm2022/wirabyte-ui-signaturepad.mjs.map +1 -0
- package/fesm2022/wirabyte-ui-sitefooter.mjs +1 -1
- package/fesm2022/wirabyte-ui-sitefooter.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-stat.mjs +149 -0
- package/fesm2022/wirabyte-ui-stat.mjs.map +1 -0
- package/fesm2022/wirabyte-ui-table.mjs +3 -3
- package/fesm2022/wirabyte-ui-table.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-tabs.mjs +2 -2
- package/fesm2022/wirabyte-ui-tabs.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-tag.mjs +2 -2
- package/fesm2022/wirabyte-ui-tag.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-textarea.mjs +32 -0
- package/fesm2022/wirabyte-ui-textarea.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-thai.mjs +2 -2
- package/fesm2022/wirabyte-ui-thai.mjs.map +1 -1
- package/fesm2022/wirabyte-ui-toolbar.mjs +6 -6
- package/fesm2022/wirabyte-ui-toolbar.mjs.map +1 -1
- package/metergroup/metergroup.component.d.ts +11 -2
- package/metergroup/metergroup.types.d.ts +6 -0
- package/package.json +77 -47
- package/scheduler/index.d.ts +5 -0
- package/scheduler/public-api.d.ts +3 -0
- package/scheduler/scheduler.component.d.ts +143 -0
- package/scheduler/scheduler.module.d.ts +8 -0
- package/scheduler/scheduler.types.d.ts +46 -0
- package/schematics/core/catalog.cjs +22 -1
- package/schematics/core/families.cjs +42 -0
- package/schematics/core/overrides.cjs +25 -0
- package/schematics/core/thai/locale.cjs +66 -0
- package/schematics/ng-add/index.cjs +3 -1
- package/selectbutton/selectbutton.component.d.ts +12 -1
- package/signaturepad/index.d.ts +5 -0
- package/signaturepad/public-api.d.ts +2 -0
- package/signaturepad/signaturepad.component.d.ts +98 -0
- package/signaturepad/signaturepad.module.d.ts +8 -0
- package/stat/index.d.ts +5 -0
- package/stat/public-api.d.ts +2 -0
- package/stat/stat.component.d.ts +61 -0
- package/stat/stat.module.d.ts +8 -0
- package/textarea/textarea.directive.d.ts +3 -0
- package/theme/_data.scss +239 -7
- package/theme/_index.scss +29 -0
- package/themes/mali/amber.css +30 -1
- package/themes/mali/blue.css +30 -1
- package/themes/mali/cyan.css +30 -1
- package/themes/mali/emerald.css +30 -1
- package/themes/mali/fuchsia.css +30 -1
- package/themes/mali/green.css +30 -1
- package/themes/mali/indigo.css +30 -1
- package/themes/mali/lime.css +30 -1
- package/themes/mali/orange.css +30 -1
- package/themes/mali/pink.css +30 -1
- package/themes/mali/purple.css +30 -1
- package/themes/mali/red.css +30 -1
- package/themes/mali/rose.css +30 -1
- package/themes/mali/sky.css +30 -1
- package/themes/mali/teal.css +30 -1
- package/themes/mali/theme.css +30 -1
- package/themes/mali/violet.css +30 -1
- package/themes/mali/wira.css +30 -1
- package/themes/mali/yellow.css +30 -1
- package/themes/material/amber.css +30 -1
- package/themes/material/blue.css +30 -1
- package/themes/material/cyan.css +30 -1
- package/themes/material/emerald.css +30 -1
- package/themes/material/fuchsia.css +30 -1
- package/themes/material/green.css +30 -1
- package/themes/material/indigo.css +30 -1
- package/themes/material/lime.css +30 -1
- package/themes/material/orange.css +30 -1
- package/themes/material/pink.css +30 -1
- package/themes/material/purple.css +30 -1
- package/themes/material/red.css +30 -1
- package/themes/material/rose.css +30 -1
- package/themes/material/sky.css +30 -1
- package/themes/material/teal.css +30 -1
- package/themes/material/theme.css +30 -1
- package/themes/material/violet.css +30 -1
- package/themes/material/wira.css +30 -1
- package/themes/material/yellow.css +30 -1
- package/themes/phet/amber.css +30 -1
- package/themes/phet/blue.css +30 -1
- package/themes/phet/cyan.css +30 -1
- package/themes/phet/emerald.css +30 -1
- package/themes/phet/fuchsia.css +30 -1
- package/themes/phet/green.css +30 -1
- package/themes/phet/indigo.css +30 -1
- package/themes/phet/lime.css +30 -1
- package/themes/phet/orange.css +30 -1
- package/themes/phet/pink.css +30 -1
- package/themes/phet/purple.css +30 -1
- package/themes/phet/red.css +30 -1
- package/themes/phet/rose.css +30 -1
- package/themes/phet/sky.css +30 -1
- package/themes/phet/teal.css +30 -1
- package/themes/phet/theme.css +30 -1
- package/themes/phet/violet.css +30 -1
- package/themes/phet/wira.css +30 -1
- package/themes/phet/yellow.css +30 -1
- package/themes/sila/amber.css +30 -1
- package/themes/sila/blue.css +30 -1
- package/themes/sila/cyan.css +30 -1
- package/themes/sila/emerald.css +30 -1
- package/themes/sila/fuchsia.css +30 -1
- package/themes/sila/green.css +30 -1
- package/themes/sila/indigo.css +30 -1
- package/themes/sila/lime.css +30 -1
- package/themes/sila/orange.css +30 -1
- package/themes/sila/pink.css +30 -1
- package/themes/sila/purple.css +30 -1
- package/themes/sila/red.css +30 -1
- package/themes/sila/rose.css +30 -1
- package/themes/sila/sky.css +30 -1
- package/themes/sila/teal.css +30 -1
- package/themes/sila/theme.css +30 -1
- package/themes/sila/violet.css +30 -1
- package/themes/sila/wira.css +30 -1
- package/themes/sila/yellow.css +30 -1
|
@@ -17,11 +17,11 @@ class WuCard {
|
|
|
17
17
|
this.variant = input('default');
|
|
18
18
|
this.loading = input(false, { transform: booleanAttribute });
|
|
19
19
|
this.templates = contentChildren(WuTemplate);
|
|
20
|
-
this.headerRef = contentChild('header', { read: TemplateRef });
|
|
21
|
-
this.titleRef = contentChild('title', { read: TemplateRef });
|
|
22
|
-
this.subtitleRef = contentChild('subtitle', { read: TemplateRef });
|
|
23
|
-
this.contentRef = contentChild('content', { read: TemplateRef });
|
|
24
|
-
this.footerRef = contentChild('footer', { read: TemplateRef });
|
|
20
|
+
this.headerRef = contentChild('header', { read: TemplateRef, descendants: false });
|
|
21
|
+
this.titleRef = contentChild('title', { read: TemplateRef, descendants: false });
|
|
22
|
+
this.subtitleRef = contentChild('subtitle', { read: TemplateRef, descendants: false });
|
|
23
|
+
this.contentRef = contentChild('content', { read: TemplateRef, descendants: false });
|
|
24
|
+
this.footerRef = contentChild('footer', { read: TemplateRef, descendants: false });
|
|
25
25
|
this.headerTemplate = computed(() => this.headerRef() || this.named('header'));
|
|
26
26
|
this.titleTemplate = computed(() => this.titleRef() || this.named('title'));
|
|
27
27
|
this.subtitleTemplate = computed(() => this.subtitleRef() || this.named('subtitle'));
|
|
@@ -57,11 +57,11 @@ class WuCard {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuCard, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
60
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WuCard, isStandalone: true, selector: "wu-card", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: WuTemplate, isSignal: true }, { propertyName: "headerRef", first: true, predicate: ["header"],
|
|
60
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WuCard, isStandalone: true, selector: "wu-card", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: WuTemplate, isSignal: true }, { propertyName: "headerRef", first: true, predicate: ["header"], read: TemplateRef, isSignal: true }, { propertyName: "titleRef", first: true, predicate: ["title"], read: TemplateRef, isSignal: true }, { propertyName: "subtitleRef", first: true, predicate: ["subtitle"], read: TemplateRef, isSignal: true }, { propertyName: "contentRef", first: true, predicate: ["content"], read: TemplateRef, isSignal: true }, { propertyName: "footerRef", first: true, predicate: ["footer"], read: TemplateRef, isSignal: true }], ngImport: i0, template: "<div [class]=\"classes()\" [style]=\"rootStyle()\" [attr.aria-busy]=\"loading() || null\">\n <div class=\"wu-card-header p-card-header\">\n <ng-content select=\"[wuCardHeader], wu-header\"></ng-content>\n @if (headerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n @if (header() || subheader() || titleTemplate() || subtitleTemplate()) {\n <div class=\"wu-card-titles p-card-caption\">\n @if (header() || titleTemplate()) {\n <div class=\"wu-card-title p-card-title\">\n {{ header() }}\n @if (titleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n @if (subheader() || subtitleTemplate()) {\n <div class=\"wu-card-subtitle p-card-subtitle\">\n {{ subheader() }}\n @if (subtitleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n </div>\n }\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n @if (loading()) {\n <div class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n }\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading()\">\n <ng-content></ng-content>\n @if (contentTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-footer p-card-footer\">\n <ng-content select=\"[wuCardFooter], wu-footer\"></ng-content>\n @if (footerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n </div>\n</div>\n", styles: ["@layer wiraui.components{wu-card{display:block}.wu-card{background:var(--wu-card-bg);color:var(--wu-text);border:var(--wu-card-border-width) solid var(--wu-border);border-radius:var(--wu-card-radius);box-shadow:var(--wu-card-shadow);-webkit-backdrop-filter:var(--wu-card-backdrop);backdrop-filter:var(--wu-card-backdrop);overflow:hidden;font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-card-outlined{border-width:1px;box-shadow:none}.wu-card-elevated{border-width:0;box-shadow:var(--wu-shadow-md)}.wu-card-glass{background:var(--wu-card-bg);border:1px solid var(--wu-glass-border);box-shadow:var(--wu-glass-highlight),var(--wu-glass-shadow)}@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){.wu-card-glass{background:var(--wu-glass-bg);-webkit-backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate));backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate))}}.wu-card-header:empty,.wu-card-actions:empty,.wu-card-footer:empty,.wu-card-content:empty,.wu-card-content[hidden],.wu-card-caption:not(:has(>:not(:empty))){display:none}.wu-card-header img{display:block;width:100%}.wu-card-body{display:flex;flex-direction:column;gap:var(--wu-card-body-gap);padding:var(--wu-card-padding)}.wu-card-caption{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;margin-bottom:var(--wu-card-caption-gap)}.wu-card-titles{display:flex;flex-direction:column;gap:var(--wu-card-title-gap);min-width:0}.wu-card-title{font-family:var(--wu-heading-font-family);font-size:var(--wu-card-title-size);font-weight:var(--wu-card-title-weight);line-height:1.35}.wu-card-subtitle{color:var(--wu-text-muted)}.wu-card-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.wu-card-content{padding:var(--wu-card-content-padding-y) 0}.wu-card-footer{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding-top:var(--wu-card-footer-padding-top)}.wu-card-footer>:only-child:not(wu-button,button,a,.wu-btn,.p-button){flex:1 1 100%;min-width:0}.wu-card-footer>[wuCardFooter]:has(>wu-button,>button,>a,>.wu-btn),.wu-card-actions>[wuCardActions]:has(>wu-button,>button,>a,>.wu-btn){display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.wu-card-skeleton{display:flex;flex-direction:column;gap:10px;padding:var(--wu-card-content-padding-y) 0}.wu-card-skeleton span{display:block;height:.9em;border-radius:var(--wu-radius-sm);background:linear-gradient(90deg,var(--wu-hover-bg) 25%,var(--wu-border) 50%,var(--wu-hover-bg) 75%);background-size:300% 100%;animation:wu-card-shine 1.4s ease infinite}.wu-card-skeleton span:nth-child(2){width:85%}.wu-card-skeleton span:nth-child(3){width:60%}@keyframes wu-card-shine{0%{background-position:100% 0}to{background-position:0 0}}@media (prefers-reduced-motion: reduce){.wu-card-skeleton span{animation:none}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
61
61
|
}
|
|
62
62
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuCard, decorators: [{
|
|
63
63
|
type: Component,
|
|
64
|
-
args: [{ selector: 'wu-card', standalone: true, imports: [NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"classes()\" [style]=\"rootStyle()\" [attr.aria-busy]=\"loading() || null\">\n <div class=\"wu-card-header p-card-header\">\n <ng-content select=\"[wuCardHeader], wu-header\"></ng-content>\n @if (headerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n @if (header() || subheader() || titleTemplate() || subtitleTemplate()) {\n <div class=\"wu-card-titles p-card-caption\">\n @if (header() || titleTemplate()) {\n <div class=\"wu-card-title p-card-title\">\n {{ header() }}\n @if (titleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n @if (subheader() || subtitleTemplate()) {\n <div class=\"wu-card-subtitle p-card-subtitle\">\n {{ subheader() }}\n @if (subtitleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n </div>\n }\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n @if (loading()) {\n <div class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n }\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading()\">\n <ng-content></ng-content>\n @if (contentTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-footer p-card-footer\">\n <ng-content select=\"[wuCardFooter], wu-footer\"></ng-content>\n @if (footerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n </div>\n</div>\n", styles: ["@layer wiraui.components{wu-card{display:block}.wu-card{background:var(--wu-card-bg);color:var(--wu-text);border:var(--wu-card-border-width) solid var(--wu-border);border-radius:var(--wu-card-radius);box-shadow:var(--wu-card-shadow);-webkit-backdrop-filter:var(--wu-card-backdrop);backdrop-filter:var(--wu-card-backdrop);overflow:hidden;font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-card-outlined{border-width:1px;box-shadow:none}.wu-card-elevated{border-width:0;box-shadow:var(--wu-shadow-md)}.wu-card-glass{background:var(--wu-card-bg);border:1px solid var(--wu-glass-border);box-shadow:var(--wu-glass-highlight),var(--wu-glass-shadow)}@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){.wu-card-glass{background:var(--wu-glass-bg);-webkit-backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate));backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate))}}.wu-card-header:empty,.wu-card-actions:empty,.wu-card-footer:empty,.wu-card-content:empty,.wu-card-content[hidden],.wu-card-caption:not(:has(>:not(:empty))){display:none}.wu-card-header img{display:block;width:100%}.wu-card-body{display:flex;flex-direction:column;gap:var(--wu-card-body-gap);padding:var(--wu-card-padding)}.wu-card-caption{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;margin-bottom:var(--wu-card-caption-gap)}.wu-card-titles{display:flex;flex-direction:column;gap:var(--wu-card-title-gap);min-width:0}.wu-card-title{font-size:var(--wu-card-title-size);font-weight:var(--wu-card-title-weight);line-height:1.35}.wu-card-subtitle{color:var(--wu-text-muted)}.wu-card-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.wu-card-content{padding:var(--wu-card-content-padding-y) 0}.wu-card-footer{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding-top:var(--wu-card-footer-padding-top)}.wu-card-footer>[wuCardFooter]:has(>wu-button,>button,>a,>.wu-btn),.wu-card-actions>[wuCardActions]:has(>wu-button,>button,>a,>.wu-btn){display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.wu-card-skeleton{display:flex;flex-direction:column;gap:10px;padding:var(--wu-card-content-padding-y) 0}.wu-card-skeleton span{display:block;height:.9em;border-radius:var(--wu-radius-sm);background:linear-gradient(90deg,var(--wu-hover-bg) 25%,var(--wu-border) 50%,var(--wu-hover-bg) 75%);background-size:300% 100%;animation:wu-card-shine 1.4s ease infinite}.wu-card-skeleton span:nth-child(2){width:85%}.wu-card-skeleton span:nth-child(3){width:60%}@keyframes wu-card-shine{0%{background-position:100% 0}to{background-position:0 0}}@media (prefers-reduced-motion: reduce){.wu-card-skeleton span{animation:none}}}\n"] }]
|
|
64
|
+
args: [{ selector: 'wu-card', standalone: true, imports: [NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"classes()\" [style]=\"rootStyle()\" [attr.aria-busy]=\"loading() || null\">\n <div class=\"wu-card-header p-card-header\">\n <ng-content select=\"[wuCardHeader], wu-header\"></ng-content>\n @if (headerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n @if (header() || subheader() || titleTemplate() || subtitleTemplate()) {\n <div class=\"wu-card-titles p-card-caption\">\n @if (header() || titleTemplate()) {\n <div class=\"wu-card-title p-card-title\">\n {{ header() }}\n @if (titleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n @if (subheader() || subtitleTemplate()) {\n <div class=\"wu-card-subtitle p-card-subtitle\">\n {{ subheader() }}\n @if (subtitleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n </div>\n }\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n @if (loading()) {\n <div class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n }\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading()\">\n <ng-content></ng-content>\n @if (contentTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-footer p-card-footer\">\n <ng-content select=\"[wuCardFooter], wu-footer\"></ng-content>\n @if (footerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n </div>\n</div>\n", styles: ["@layer wiraui.components{wu-card{display:block}.wu-card{background:var(--wu-card-bg);color:var(--wu-text);border:var(--wu-card-border-width) solid var(--wu-border);border-radius:var(--wu-card-radius);box-shadow:var(--wu-card-shadow);-webkit-backdrop-filter:var(--wu-card-backdrop);backdrop-filter:var(--wu-card-backdrop);overflow:hidden;font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-card-outlined{border-width:1px;box-shadow:none}.wu-card-elevated{border-width:0;box-shadow:var(--wu-shadow-md)}.wu-card-glass{background:var(--wu-card-bg);border:1px solid var(--wu-glass-border);box-shadow:var(--wu-glass-highlight),var(--wu-glass-shadow)}@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){.wu-card-glass{background:var(--wu-glass-bg);-webkit-backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate));backdrop-filter:blur(var(--wu-glass-blur)) saturate(var(--wu-glass-saturate))}}.wu-card-header:empty,.wu-card-actions:empty,.wu-card-footer:empty,.wu-card-content:empty,.wu-card-content[hidden],.wu-card-caption:not(:has(>:not(:empty))){display:none}.wu-card-header img{display:block;width:100%}.wu-card-body{display:flex;flex-direction:column;gap:var(--wu-card-body-gap);padding:var(--wu-card-padding)}.wu-card-caption{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;margin-bottom:var(--wu-card-caption-gap)}.wu-card-titles{display:flex;flex-direction:column;gap:var(--wu-card-title-gap);min-width:0}.wu-card-title{font-family:var(--wu-heading-font-family);font-size:var(--wu-card-title-size);font-weight:var(--wu-card-title-weight);line-height:1.35}.wu-card-subtitle{color:var(--wu-text-muted)}.wu-card-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.wu-card-content{padding:var(--wu-card-content-padding-y) 0}.wu-card-footer{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding-top:var(--wu-card-footer-padding-top)}.wu-card-footer>:only-child:not(wu-button,button,a,.wu-btn,.p-button){flex:1 1 100%;min-width:0}.wu-card-footer>[wuCardFooter]:has(>wu-button,>button,>a,>.wu-btn),.wu-card-actions>[wuCardActions]:has(>wu-button,>button,>a,>.wu-btn){display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.wu-card-skeleton{display:flex;flex-direction:column;gap:10px;padding:var(--wu-card-content-padding-y) 0}.wu-card-skeleton span{display:block;height:.9em;border-radius:var(--wu-radius-sm);background:linear-gradient(90deg,var(--wu-hover-bg) 25%,var(--wu-border) 50%,var(--wu-hover-bg) 75%);background-size:300% 100%;animation:wu-card-shine 1.4s ease infinite}.wu-card-skeleton span:nth-child(2){width:85%}.wu-card-skeleton span:nth-child(3){width:60%}@keyframes wu-card-shine{0%{background-position:100% 0}to{background-position:0 0}}@media (prefers-reduced-motion: reduce){.wu-card-skeleton span{animation:none}}}\n"] }]
|
|
65
65
|
}], ctorParameters: () => [] });
|
|
66
66
|
|
|
67
67
|
/** `<wu-header>` inside a card: projected into the card's top area, as before. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wirabyte-ui-card.mjs","sources":["../../lib/card/card.component.ts","../../lib/card/card.component.html","../../lib/card/card-slots.ts","../../lib/card/card.module.ts","../../lib/card/wirabyte-ui-card.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n contentChildren,\n inject,\n input,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ɵassertSupportedAngular, ɵWU_SKIP_VERSION_CHECK, WU_VERSION_INFO, WuTemplate } from '@wirabyte/ui/config';\nimport { WuCardVariant } from './card.types';\n\n/**\n * Card with `header` / `subheader` inputs and projected slots:\n * `[wuCardHeader]` (top media), `[wuCardActions]` (right of the title), default content, `[wuCardFooter]`.\n * The templates apps already use work too: `header`, `title`, `subtitle`, `content`, `footer`\n * (`pTemplate=\"footer\"`, `wuTemplate=\"footer\"` or `#footer`), and `<wu-header>` / `<wu-footer>` elements.\n * Extras: `variant` (outlined, elevated, and glass from v3 on) and `loading` (skeleton lines instead of content).\n */\n@Component({\n selector: 'wu-card',\n standalone: true,\n imports: [NgTemplateOutlet],\n templateUrl: './card.component.html',\n styleUrl: './card.css',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WuCard {\n readonly header = input<string>();\n readonly subheader = input<string>();\n readonly variant = input<WuCardVariant>('default');\n readonly loading = input(false, { transform: booleanAttribute });\n\n private readonly templates = contentChildren(WuTemplate);\n private readonly headerRef = contentChild('header', { read: TemplateRef });\n private readonly titleRef = contentChild('title', { read: TemplateRef });\n private readonly subtitleRef = contentChild('subtitle', { read: TemplateRef });\n private readonly contentRef = contentChild('content', { read: TemplateRef });\n private readonly footerRef = contentChild('footer', { read: TemplateRef });\n readonly headerTemplate = computed(() => this.headerRef() || this.named('header'));\n readonly titleTemplate = computed(() => this.titleRef() || this.named('title'));\n readonly subtitleTemplate = computed(() => this.subtitleRef() || this.named('subtitle'));\n readonly contentTemplate = computed(() => this.contentRef() || this.named('content'));\n readonly footerTemplate = computed(() => this.footerRef() || this.named('footer'));\n\n /** Classes for the root element, as before (`styleClass=\"w-full\"`). */\n readonly styleClass = input<string | null | undefined>();\n /** Inline styles for the root element, as an object: `[style]=\"{ width: '20rem' }\"`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly style = input<Record<string, any> | string | null | undefined>();\n /** The `style` object for the root (a plain style attribute already styles the host). */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rootStyle = computed(() => { const s = this.style(); return s && typeof s === 'object' ? (s as Record<string, any>) : null; });\n readonly classes = computed(() => {\n const c = ['wu-card', 'p-card', 'p-component'];\n const variant = this.variant();\n // Glass is a v3 look; v2 shows a plain card.\n if (variant !== 'default' && (variant !== 'glass' || WU_VERSION_INFO.major >= 3)) c.push('wu-card-' + variant);\n if (this.loading()) c.push('wu-card-loading');\n const extra = this.styleClass();\n if (extra) c.push(extra);\n return c.join(' ');\n });\n\n constructor() {\n ɵassertSupportedAngular(inject(ɵWU_SKIP_VERSION_CHECK, { optional: true }));\n }\n\n private named(name: string): TemplateRef<unknown> | null {\n for (const t of this.templates()) if (t.name === name) return t.template;\n return null;\n }\n}\n","<div [class]=\"classes()\" [style]=\"rootStyle()\" [attr.aria-busy]=\"loading() || null\">\n <div class=\"wu-card-header p-card-header\">\n <ng-content select=\"[wuCardHeader], wu-header\"></ng-content>\n @if (headerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n @if (header() || subheader() || titleTemplate() || subtitleTemplate()) {\n <div class=\"wu-card-titles p-card-caption\">\n @if (header() || titleTemplate()) {\n <div class=\"wu-card-title p-card-title\">\n {{ header() }}\n @if (titleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n @if (subheader() || subtitleTemplate()) {\n <div class=\"wu-card-subtitle p-card-subtitle\">\n {{ subheader() }}\n @if (subtitleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n </div>\n }\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n @if (loading()) {\n <div class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n }\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading()\">\n <ng-content></ng-content>\n @if (contentTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-footer p-card-footer\">\n <ng-content select=\"[wuCardFooter], wu-footer\"></ng-content>\n @if (footerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n </div>\n</div>\n","import { Directive } from '@angular/core';\n\n/** `<wu-header>` inside a card: projected into the card's top area, as before. */\n@Directive({\n selector: 'wu-header',\n standalone: true,\n})\nexport class WuHeader {}\n\n/** `<wu-footer>` inside a card: projected into the card's footer, as before. (Dialogs read it too.) */\n@Directive({\n selector: 'wu-footer',\n standalone: true,\n})\nexport class WuFooter {}\n","import { NgModule } from '@angular/core';\nimport { WuTemplate } from '@wirabyte/ui/config';\nimport { WuHeader, WuFooter } from './card-slots';\nimport { WuCard } from './card.component';\n\n/** For NgModule apps: the card, `<wu-header>` / `<wu-footer>` and `wuTemplate` (`pTemplate`). */\n@NgModule({\n imports: [WuCard, WuHeader, WuFooter, WuTemplate],\n exports: [WuCard, WuHeader, WuFooter, WuTemplate],\n})\nexport class WuCardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ɵassertSupportedAngular","ɵWU_SKIP_VERSION_CHECK"],"mappings":";;;;;AAgBA;;;;;;AAMG;MAUU,MAAM,CAAA;AAqCjB,IAAA,WAAA,GAAA;QApCS,IAAA,CAAA,MAAM,GAAG,KAAK,EAAU;QACxB,IAAA,CAAA,SAAS,GAAG,KAAK,EAAU;AAC3B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A,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,EAAA,OAAA,EAAA,CAHb,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAA,EAAA,OAAA,EAAA,CACtC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAA,EAAA,CAAA,CAAA;gHAErC,YAAY,EAAA,CAAA,CAAA;;4FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;oBACjD,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;AAClD,iBAAA;;;ACTD;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"wirabyte-ui-card.mjs","sources":["../../lib/card/card.component.ts","../../lib/card/card.component.html","../../lib/card/card-slots.ts","../../lib/card/card.module.ts","../../lib/card/wirabyte-ui-card.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n contentChildren,\n inject,\n input,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ɵassertSupportedAngular, ɵWU_SKIP_VERSION_CHECK, WU_VERSION_INFO, WuTemplate } from '@wirabyte/ui/config';\nimport { WuCardVariant } from './card.types';\n\n/**\n * Card with `header` / `subheader` inputs and projected slots:\n * `[wuCardHeader]` (top media), `[wuCardActions]` (right of the title), default content, `[wuCardFooter]`.\n * The templates apps already use work too: `header`, `title`, `subtitle`, `content`, `footer`\n * (`pTemplate=\"footer\"`, `wuTemplate=\"footer\"` or `#footer`), and `<wu-header>` / `<wu-footer>` elements.\n * Extras: `variant` (outlined, elevated, and glass from v3 on) and `loading` (skeleton lines instead of content).\n */\n@Component({\n selector: 'wu-card',\n standalone: true,\n imports: [NgTemplateOutlet],\n templateUrl: './card.component.html',\n styleUrl: './card.css',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WuCard {\n readonly header = input<string>();\n readonly subheader = input<string>();\n readonly variant = input<WuCardVariant>('default');\n readonly loading = input(false, { transform: booleanAttribute });\n\n private readonly templates = contentChildren(WuTemplate);\n private readonly headerRef = contentChild('header', { read: TemplateRef, descendants: false });\n private readonly titleRef = contentChild('title', { read: TemplateRef, descendants: false });\n private readonly subtitleRef = contentChild('subtitle', { read: TemplateRef, descendants: false });\n private readonly contentRef = contentChild('content', { read: TemplateRef, descendants: false });\n private readonly footerRef = contentChild('footer', { read: TemplateRef, descendants: false });\n readonly headerTemplate = computed(() => this.headerRef() || this.named('header'));\n readonly titleTemplate = computed(() => this.titleRef() || this.named('title'));\n readonly subtitleTemplate = computed(() => this.subtitleRef() || this.named('subtitle'));\n readonly contentTemplate = computed(() => this.contentRef() || this.named('content'));\n readonly footerTemplate = computed(() => this.footerRef() || this.named('footer'));\n\n /** Classes for the root element, as before (`styleClass=\"w-full\"`). */\n readonly styleClass = input<string | null | undefined>();\n /** Inline styles for the root element, as an object: `[style]=\"{ width: '20rem' }\"`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly style = input<Record<string, any> | string | null | undefined>();\n /** The `style` object for the root (a plain style attribute already styles the host). */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly rootStyle = computed(() => { const s = this.style(); return s && typeof s === 'object' ? (s as Record<string, any>) : null; });\n readonly classes = computed(() => {\n const c = ['wu-card', 'p-card', 'p-component'];\n const variant = this.variant();\n // Glass is a v3 look; v2 shows a plain card.\n if (variant !== 'default' && (variant !== 'glass' || WU_VERSION_INFO.major >= 3)) c.push('wu-card-' + variant);\n if (this.loading()) c.push('wu-card-loading');\n const extra = this.styleClass();\n if (extra) c.push(extra);\n return c.join(' ');\n });\n\n constructor() {\n ɵassertSupportedAngular(inject(ɵWU_SKIP_VERSION_CHECK, { optional: true }));\n }\n\n private named(name: string): TemplateRef<unknown> | null {\n for (const t of this.templates()) if (t.name === name) return t.template;\n return null;\n }\n}\n","<div [class]=\"classes()\" [style]=\"rootStyle()\" [attr.aria-busy]=\"loading() || null\">\n <div class=\"wu-card-header p-card-header\">\n <ng-content select=\"[wuCardHeader], wu-header\"></ng-content>\n @if (headerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n @if (header() || subheader() || titleTemplate() || subtitleTemplate()) {\n <div class=\"wu-card-titles p-card-caption\">\n @if (header() || titleTemplate()) {\n <div class=\"wu-card-title p-card-title\">\n {{ header() }}\n @if (titleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n @if (subheader() || subtitleTemplate()) {\n <div class=\"wu-card-subtitle p-card-subtitle\">\n {{ subheader() }}\n @if (subtitleTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n }\n </div>\n }\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n @if (loading()) {\n <div class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n }\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading()\">\n <ng-content></ng-content>\n @if (contentTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n <div class=\"wu-card-footer p-card-footer\">\n <ng-content select=\"[wuCardFooter], wu-footer\"></ng-content>\n @if (footerTemplate(); as t) {\n <ng-container *ngTemplateOutlet=\"t\"></ng-container>\n }\n </div>\n </div>\n</div>\n","import { Directive } from '@angular/core';\n\n/** `<wu-header>` inside a card: projected into the card's top area, as before. */\n@Directive({\n selector: 'wu-header',\n standalone: true,\n})\nexport class WuHeader {}\n\n/** `<wu-footer>` inside a card: projected into the card's footer, as before. (Dialogs read it too.) */\n@Directive({\n selector: 'wu-footer',\n standalone: true,\n})\nexport class WuFooter {}\n","import { NgModule } from '@angular/core';\nimport { WuTemplate } from '@wirabyte/ui/config';\nimport { WuHeader, WuFooter } from './card-slots';\nimport { WuCard } from './card.component';\n\n/** For NgModule apps: the card, `<wu-header>` / `<wu-footer>` and `wuTemplate` (`pTemplate`). */\n@NgModule({\n imports: [WuCard, WuHeader, WuFooter, WuTemplate],\n exports: [WuCard, WuHeader, WuFooter, WuTemplate],\n})\nexport class WuCardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ɵassertSupportedAngular","ɵWU_SKIP_VERSION_CHECK"],"mappings":";;;;;AAgBA;;;;;;AAMG;MAUU,MAAM,CAAA;AAqCjB,IAAA,WAAA,GAAA;QApCS,IAAA,CAAA,MAAM,GAAG,KAAK,EAAU;QACxB,IAAA,CAAA,SAAS,GAAG,KAAK,EAAU;AAC3B,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAgB,SAAS,CAAC;QACzC,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAE/C,QAAA,IAAA,CAAA,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC;AACvC,QAAA,IAAA,CAAA,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC7E,QAAA,IAAA,CAAA,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC3E,QAAA,IAAA,CAAA,WAAW,GAAG,YAAY,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACjF,QAAA,IAAA,CA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;;ACTD;;AAEG;;"}
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { TemplateRef, EventEmitter, inject, ChangeDetectorRef, ViewChild, ContentChild, ContentChildren, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
4
|
+
import { ɵtoBool as _toBool, WuConfig, ɵrefreshOnTranslation as _refreshOnTranslation, ɵassertSupportedAngular as _assertSupportedAngular, ɵWU_SKIP_VERSION_CHECK as _WU_SKIP_VERSION_CHECK, ɵfindTemplate as _findTemplate, WuTemplate } from '@wirabyte/ui/config';
|
|
5
|
+
import { formatDate, datePattern, toDateValue } from '@wirabyte/ui/core';
|
|
6
|
+
|
|
7
|
+
const IMAGE = /\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i;
|
|
8
|
+
const NEAR_BOTTOM = 80;
|
|
9
|
+
/** Thai vowels written before their consonant: an initial is the consonant, not these. */
|
|
10
|
+
const LEADING_VOWEL = /[\u0E40-\u0E44]/;
|
|
11
|
+
const TYPING_EVERY = 2000;
|
|
12
|
+
const asTemplate = (v) => (v instanceof TemplateRef ? v : null);
|
|
13
|
+
/**
|
|
14
|
+
* A conversation: `<wu-chat [messages]="messages" [currentUserId]="me.id" (onSend)="send($event)">`. Bubbles on the
|
|
15
|
+
* left for others and on the right for you, grouped by sender and time, day separators (วันนี้, เมื่อวาน, then the date
|
|
16
|
+
* in the app's calendar), pictures and file cards, read marks, who is typing, and a message box that grows with the
|
|
17
|
+
* text: Enter sends, Shift+Enter starts a new line, pasted pictures are attached. New messages scroll into view unless
|
|
18
|
+
* the reader has scrolled up to read older ones. The component only shows and emits; sending is the app's job.
|
|
19
|
+
*/
|
|
20
|
+
class WuChat {
|
|
21
|
+
set messages(v) {
|
|
22
|
+
const list = Array.isArray(v) ? v : [];
|
|
23
|
+
const grew = list.length > this._messages.length;
|
|
24
|
+
const last = list[list.length - 1];
|
|
25
|
+
// Follow new messages while the reader is at the bottom, and always after sending one yourself.
|
|
26
|
+
if (grew && (this.atBottom || (last && this.isMine(last))))
|
|
27
|
+
this.scrollPending = true;
|
|
28
|
+
this._messages = list;
|
|
29
|
+
this.rows = null;
|
|
30
|
+
}
|
|
31
|
+
get messages() {
|
|
32
|
+
return this._messages;
|
|
33
|
+
}
|
|
34
|
+
/** No message box: a closed conversation. `readonlyMessage` replaces the default line. */
|
|
35
|
+
set readonly(v) { this._readonly = _toBool(v); }
|
|
36
|
+
get readonly() { return this._readonly; }
|
|
37
|
+
/** A spinner instead of the messages while they load. */
|
|
38
|
+
set loading(v) { this._loading = _toBool(v); }
|
|
39
|
+
get loading() { return this._loading; }
|
|
40
|
+
/** The send button shows a spinner and the box waits. */
|
|
41
|
+
set sending(v) { this._sending = _toBool(v); }
|
|
42
|
+
get sending() { return this._sending; }
|
|
43
|
+
/** `false` hides the attach button (pasting files then does nothing either). */
|
|
44
|
+
set attach(v) { this._attach = v === undefined ? true : _toBool(v); }
|
|
45
|
+
get attach() { return this._attach; }
|
|
46
|
+
/** A button above the oldest message that emits `(onLoadMore)`. */
|
|
47
|
+
set hasMore(v) { this._hasMore = _toBool(v); }
|
|
48
|
+
get hasMore() { return this._hasMore; }
|
|
49
|
+
/** `false` leaves out the avatars beside other people's messages. */
|
|
50
|
+
set showAvatars(v) { this._avatars = v === undefined ? true : _toBool(v); }
|
|
51
|
+
get showAvatars() { return this._avatars; }
|
|
52
|
+
constructor() {
|
|
53
|
+
/** Messages from the same sender within this many minutes join one group (one name, one avatar). Default 5. */
|
|
54
|
+
this.groupMinutes = 5;
|
|
55
|
+
this.onSend = new EventEmitter();
|
|
56
|
+
/** While the reader types, at most every 2 seconds: send "is typing" to the others. */
|
|
57
|
+
this.onTyping = new EventEmitter();
|
|
58
|
+
this.onAttachmentClick = new EventEmitter();
|
|
59
|
+
this.onRetry = new EventEmitter();
|
|
60
|
+
this.onLoadMore = new EventEmitter();
|
|
61
|
+
this.onFileRejected = new EventEmitter();
|
|
62
|
+
this.draft = '';
|
|
63
|
+
this.pending = [];
|
|
64
|
+
this._messages = [];
|
|
65
|
+
this.rows = null;
|
|
66
|
+
this._readonly = false;
|
|
67
|
+
this._loading = false;
|
|
68
|
+
this._sending = false;
|
|
69
|
+
this._attach = true;
|
|
70
|
+
this._hasMore = false;
|
|
71
|
+
this._avatars = true;
|
|
72
|
+
this.atBottom = true;
|
|
73
|
+
this.scrollPending = true;
|
|
74
|
+
this.lastTyping = 0;
|
|
75
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
76
|
+
this.config = inject(WuConfig);
|
|
77
|
+
this.i18n = _refreshOnTranslation();
|
|
78
|
+
this.translated = this.config.translationChange.subscribe(() => (this.rows = null));
|
|
79
|
+
_assertSupportedAngular(inject(_WU_SKIP_VERSION_CHECK, { optional: true }));
|
|
80
|
+
}
|
|
81
|
+
ngAfterViewChecked() {
|
|
82
|
+
if (!this.scrollPending || !this.scroller)
|
|
83
|
+
return;
|
|
84
|
+
this.scrollPending = false;
|
|
85
|
+
const el = this.scroller.nativeElement;
|
|
86
|
+
el.scrollTop = el.scrollHeight;
|
|
87
|
+
this.atBottom = true;
|
|
88
|
+
}
|
|
89
|
+
ngOnDestroy() {
|
|
90
|
+
this.i18n.unsubscribe();
|
|
91
|
+
this.translated.unsubscribe();
|
|
92
|
+
for (const p of this.pending)
|
|
93
|
+
if (p.preview)
|
|
94
|
+
URL.revokeObjectURL(p.preview);
|
|
95
|
+
}
|
|
96
|
+
// ---------- what the template reads ----------
|
|
97
|
+
get t() {
|
|
98
|
+
return this.config.translation.chat;
|
|
99
|
+
}
|
|
100
|
+
/** `<ng-template #message let-message>`: the inside of a bubble. */
|
|
101
|
+
get messageTemplate() {
|
|
102
|
+
return asTemplate(this.messageRef) || _findTemplate(this.templates, 'message');
|
|
103
|
+
}
|
|
104
|
+
get rootClass() {
|
|
105
|
+
return ['wu-chat', this.styleClass || ''].filter(Boolean).join(' ');
|
|
106
|
+
}
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
get rootStyle() {
|
|
109
|
+
const own = this.style && typeof this.style === 'object' ? this.style : {};
|
|
110
|
+
const h = this.height;
|
|
111
|
+
const height = h === null || h === undefined || h === '' ? undefined : typeof h === 'number' || /^\d+(\.\d+)?$/.test(String(h)) ? `${h}px` : String(h);
|
|
112
|
+
return height ? { ...own, '--wu-chat-height': height } : own;
|
|
113
|
+
}
|
|
114
|
+
get view() {
|
|
115
|
+
if (!this.rows)
|
|
116
|
+
this.rows = this.build();
|
|
117
|
+
return this.rows;
|
|
118
|
+
}
|
|
119
|
+
get typingText() {
|
|
120
|
+
const names = (Array.isArray(this.typing) ? this.typing : this.typing ? [this.typing] : []).filter(Boolean);
|
|
121
|
+
if (!names.length)
|
|
122
|
+
return '';
|
|
123
|
+
const t = this.t;
|
|
124
|
+
if (names.length === 1)
|
|
125
|
+
return (t?.typing ?? '{name} is typing').replace('{name}', names[0]);
|
|
126
|
+
return (t?.typingMany ?? '{count} people are typing').replace('{count}', String(names.length));
|
|
127
|
+
}
|
|
128
|
+
get canSend() {
|
|
129
|
+
return !this._sending && (!!this.draft.trim() || this.pending.length > 0);
|
|
130
|
+
}
|
|
131
|
+
trackRow(_, row) {
|
|
132
|
+
return row.key;
|
|
133
|
+
}
|
|
134
|
+
initials(name) {
|
|
135
|
+
const words = (name || '').trim().split(/\s+/).filter(Boolean);
|
|
136
|
+
if (!words.length)
|
|
137
|
+
return '?';
|
|
138
|
+
const first = (word) => Array.from(word).find((ch) => !LEADING_VOWEL.test(ch)) || word[0];
|
|
139
|
+
return first(words[0]) + (words.length > 1 ? first(words[words.length - 1]) : '');
|
|
140
|
+
}
|
|
141
|
+
isImage(a) {
|
|
142
|
+
return a.type ? a.type === 'image' : IMAGE.test(a.name) || IMAGE.test(a.url || '');
|
|
143
|
+
}
|
|
144
|
+
sizeText(bytes) {
|
|
145
|
+
if (bytes === undefined || bytes === null || !Number.isFinite(bytes))
|
|
146
|
+
return '';
|
|
147
|
+
if (bytes < 1024)
|
|
148
|
+
return `${bytes} B`;
|
|
149
|
+
if (bytes < 1024 * 1024)
|
|
150
|
+
return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} kB`;
|
|
151
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
152
|
+
}
|
|
153
|
+
readText(m) {
|
|
154
|
+
if (!m.read)
|
|
155
|
+
return '';
|
|
156
|
+
if (typeof m.read === 'number' && m.read > 1)
|
|
157
|
+
return (this.t?.readBy ?? 'Read by {count}').replace('{count}', String(m.read));
|
|
158
|
+
return this.t?.read ?? 'Read';
|
|
159
|
+
}
|
|
160
|
+
// ---------- events ----------
|
|
161
|
+
onScroll() {
|
|
162
|
+
const el = this.scroller?.nativeElement;
|
|
163
|
+
if (el)
|
|
164
|
+
this.atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < NEAR_BOTTOM;
|
|
165
|
+
}
|
|
166
|
+
onKeydown(event) {
|
|
167
|
+
if (event.key !== 'Enter' || event.shiftKey || event.isComposing)
|
|
168
|
+
return;
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
this.send();
|
|
171
|
+
}
|
|
172
|
+
onInput() {
|
|
173
|
+
this.grow();
|
|
174
|
+
const now = Date.now();
|
|
175
|
+
if (this.draft && now - this.lastTyping > TYPING_EVERY) {
|
|
176
|
+
this.lastTyping = now;
|
|
177
|
+
this.onTyping.emit();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
onPaste(event) {
|
|
181
|
+
if (!this._attach)
|
|
182
|
+
return;
|
|
183
|
+
const files = Array.from(event.clipboardData?.files || []);
|
|
184
|
+
if (!files.length)
|
|
185
|
+
return;
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
this.add(files);
|
|
188
|
+
}
|
|
189
|
+
openFiles() {
|
|
190
|
+
this.fileInput?.nativeElement.click();
|
|
191
|
+
}
|
|
192
|
+
onFilesChosen(event) {
|
|
193
|
+
const input = event.target;
|
|
194
|
+
this.add(Array.from(input.files || []));
|
|
195
|
+
input.value = '';
|
|
196
|
+
}
|
|
197
|
+
removePending(index) {
|
|
198
|
+
const [p] = this.pending.splice(index, 1);
|
|
199
|
+
if (p?.preview)
|
|
200
|
+
URL.revokeObjectURL(p.preview);
|
|
201
|
+
this.pending = [...this.pending];
|
|
202
|
+
}
|
|
203
|
+
send() {
|
|
204
|
+
if (!this.canSend || this._readonly)
|
|
205
|
+
return;
|
|
206
|
+
const files = this.pending.map((p) => p.file);
|
|
207
|
+
for (const p of this.pending)
|
|
208
|
+
if (p.preview)
|
|
209
|
+
URL.revokeObjectURL(p.preview);
|
|
210
|
+
this.onSend.emit({ text: this.draft.trim(), files });
|
|
211
|
+
this.draft = '';
|
|
212
|
+
this.pending = [];
|
|
213
|
+
this.scrollPending = true;
|
|
214
|
+
setTimeout(() => this.grow());
|
|
215
|
+
this.cdr.markForCheck();
|
|
216
|
+
}
|
|
217
|
+
attachmentClick(event, attachment, message) {
|
|
218
|
+
this.onAttachmentClick.emit({ originalEvent: event, attachment, message });
|
|
219
|
+
}
|
|
220
|
+
// ---------- internals ----------
|
|
221
|
+
isMine(m) {
|
|
222
|
+
if (m.mine !== undefined)
|
|
223
|
+
return m.mine;
|
|
224
|
+
return this.currentUserId !== null && this.currentUserId !== undefined && m.sender?.id === this.currentUserId;
|
|
225
|
+
}
|
|
226
|
+
add(files) {
|
|
227
|
+
const max = this.maxFileSize;
|
|
228
|
+
const kept = [];
|
|
229
|
+
for (const file of files) {
|
|
230
|
+
if (max && file.size > max) {
|
|
231
|
+
this.onFileRejected.emit(file);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
kept.push({ file, preview: file.type.startsWith('image/') && typeof URL !== 'undefined' ? URL.createObjectURL(file) : null });
|
|
235
|
+
}
|
|
236
|
+
this.pending = [...this.pending, ...kept];
|
|
237
|
+
this.cdr.markForCheck();
|
|
238
|
+
}
|
|
239
|
+
/** The box grows with its text up to a few lines, then scrolls. */
|
|
240
|
+
grow() {
|
|
241
|
+
const t = this.box?.nativeElement;
|
|
242
|
+
if (!t || !t.getClientRects().length)
|
|
243
|
+
return;
|
|
244
|
+
t.style.height = 'auto';
|
|
245
|
+
t.style.height = Math.min(t.scrollHeight, 160) + 'px';
|
|
246
|
+
}
|
|
247
|
+
build() {
|
|
248
|
+
const rows = [];
|
|
249
|
+
const lang = this.config.translation.code || 'th';
|
|
250
|
+
const calendar = this.config.calendarFor(lang);
|
|
251
|
+
const locale = this.config.translation;
|
|
252
|
+
const timeOf = (d) => formatDate(d, datePattern('time', lang, calendar), { locale, calendar });
|
|
253
|
+
const today = startOfDay(this.config.now());
|
|
254
|
+
let day = '';
|
|
255
|
+
let prev = null;
|
|
256
|
+
this._messages.forEach((m, i) => {
|
|
257
|
+
const at = toDateValue(m.time) || new Date(NaN);
|
|
258
|
+
const dayKey = Number.isNaN(at.getTime()) ? '' : `${at.getFullYear()}-${at.getMonth()}-${at.getDate()}`;
|
|
259
|
+
if (dayKey && dayKey !== day) {
|
|
260
|
+
day = dayKey;
|
|
261
|
+
const diff = Math.round((today - startOfDay(at)) / 86400000);
|
|
262
|
+
const label = diff === 0
|
|
263
|
+
? this.t?.today ?? 'Today'
|
|
264
|
+
: diff === 1
|
|
265
|
+
? this.t?.yesterday ?? 'Yesterday'
|
|
266
|
+
: formatDate(at, datePattern('long', lang, calendar), { locale, calendar });
|
|
267
|
+
rows.push({ kind: 'day', key: 'd' + dayKey, label });
|
|
268
|
+
prev = null;
|
|
269
|
+
}
|
|
270
|
+
const key = 'm' + (m.id ?? i);
|
|
271
|
+
const time = Number.isNaN(at.getTime()) ? '' : timeOf(at);
|
|
272
|
+
if (m.system) {
|
|
273
|
+
rows.push({ kind: 'system', key, message: m, time });
|
|
274
|
+
prev = null;
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const mine = this.isMine(m);
|
|
278
|
+
const sender = m.sender?.id ?? m.sender?.name ?? null;
|
|
279
|
+
const first = !prev || prev.mine !== mine || prev.sender !== sender || at.getTime() - prev.at > Math.max(0, this.groupMinutes) * 60000;
|
|
280
|
+
if (first && rows.length) {
|
|
281
|
+
const before = rows[rows.length - 1];
|
|
282
|
+
if (before.kind === 'message')
|
|
283
|
+
before.last = true;
|
|
284
|
+
}
|
|
285
|
+
rows.push({ kind: 'message', key, message: m, mine, first, last: false, time });
|
|
286
|
+
prev = { mine, sender, at: at.getTime() };
|
|
287
|
+
});
|
|
288
|
+
const tail = rows[rows.length - 1];
|
|
289
|
+
if (tail && tail.kind === 'message')
|
|
290
|
+
tail.last = true;
|
|
291
|
+
for (let i = 0; i < rows.length - 1; i++) {
|
|
292
|
+
const r = rows[i];
|
|
293
|
+
if (r.kind === 'message' && rows[i + 1].kind !== 'message')
|
|
294
|
+
r.last = true;
|
|
295
|
+
}
|
|
296
|
+
return rows;
|
|
297
|
+
}
|
|
298
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuChat, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
299
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WuChat, isStandalone: true, selector: "wu-chat", inputs: { messages: "messages", currentUserId: "currentUserId", typing: "typing", readonly: "readonly", readonlyMessage: "readonlyMessage", placeholder: "placeholder", loading: "loading", sending: "sending", attach: "attach", accept: "accept", maxFileSize: "maxFileSize", groupMinutes: "groupMinutes", hasMore: "hasMore", showAvatars: "showAvatars", height: "height", ariaLabel: "ariaLabel", styleClass: "styleClass", style: "style" }, outputs: { onSend: "onSend", onTyping: "onTyping", onAttachmentClick: "onAttachmentClick", onRetry: "onRetry", onLoadMore: "onLoadMore", onFileRejected: "onFileRejected" }, host: { classAttribute: "wu-chat-host" }, queries: [{ propertyName: "messageRef", first: true, predicate: ["message"] }, { propertyName: "templates", predicate: WuTemplate }], viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true }, { propertyName: "box", first: true, predicate: ["box"], descendants: true }, { propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<section [class]=\"rootClass\" [style]=\"rootStyle\" [attr.aria-label]=\"ariaLabel || t?.messages || null\">\n <div #scroller class=\"wu-chat-scroll\" role=\"log\" aria-live=\"polite\" (scroll)=\"onScroll()\">\n <div *ngIf=\"hasMore && !loading\" class=\"wu-chat-more\">\n <button type=\"button\" class=\"wu-chat-more-button\" (click)=\"onLoadMore.emit()\">{{ t?.loadMore || 'Earlier messages' }}</button>\n </div>\n\n <div *ngIf=\"loading\" class=\"wu-chat-loading\" aria-busy=\"true\"><span class=\"wu-chat-spinner\" aria-hidden=\"true\"></span></div>\n\n <div *ngIf=\"!loading && !messages.length\" class=\"wu-chat-empty\">\n <svg class=\"wu-chat-empty-art\" viewBox=\"0 0 64 48\" aria-hidden=\"true\">\n <path d=\"M8 6h34a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H22l-9 8v-8H8a6 6 0 0 1-6-6V12a6 6 0 0 1 6-6z\" />\n <path d=\"M54 18h2a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6h-2v6l-8-6H34a6 6 0 0 1-6-6v-2\" />\n </svg>\n <strong>{{ t?.emptyTitle || 'No messages yet' }}</strong>\n <span *ngIf=\"!readonly\">{{ t?.emptyDescription || 'Start typing below' }}</span>\n </div>\n\n <ng-container *ngIf=\"!loading\">\n <ng-container *ngFor=\"let row of view; trackBy: trackRow\">\n <div *ngIf=\"row.kind === 'day'\" class=\"wu-chat-day\"><span>{{ row.label }}</span></div>\n\n <div *ngIf=\"row.kind === 'system'\" class=\"wu-chat-system\">\n <span>{{ row.message.text }}<ng-container *ngIf=\"row.time\"> \u00B7 {{ row.time }}</ng-container></span>\n </div>\n\n <div\n *ngIf=\"row.kind === 'message'\"\n class=\"wu-chat-line\"\n [class.wu-chat-mine]=\"row.mine\"\n [class.wu-chat-first]=\"row.first\"\n [class.wu-chat-last]=\"row.last\"\n [class.wu-chat-sending]=\"row.message.status === 'sending'\"\n [class.wu-chat-failed]=\"row.message.status === 'failed'\"\n >\n <div *ngIf=\"!row.mine && showAvatars\" class=\"wu-chat-avatar\" aria-hidden=\"true\">\n <ng-container *ngIf=\"row.first\">\n <img *ngIf=\"row.message.sender?.avatar; else letters\" [src]=\"row.message.sender?.avatar\" alt=\"\" />\n <ng-template #letters><span>{{ initials(row.message.sender?.name) }}</span></ng-template>\n </ng-container>\n </div>\n <div class=\"wu-chat-stack\">\n <span *ngIf=\"!row.mine && row.first && row.message.sender?.name\" class=\"wu-chat-name\">\n {{ row.message.sender?.name }}\n <span *ngIf=\"row.message.sender?.badge\" class=\"wu-chat-badge\">{{ row.message.sender?.badge }}</span>\n </span>\n <div class=\"wu-chat-bubble-row\">\n <div class=\"wu-chat-bubble\">\n <ng-container *ngIf=\"messageTemplate; else plain\">\n <ng-container *ngTemplateOutlet=\"messageTemplate; context: { $implicit: row.message, mine: row.mine }\"></ng-container>\n </ng-container>\n <ng-template #plain>\n <ng-container *ngFor=\"let a of row.message.attachments || []\">\n <a\n *ngIf=\"isImage(a); else fileCard\"\n class=\"wu-chat-image\"\n [attr.href]=\"a.url || null\"\n [attr.target]=\"a.url ? '_blank' : null\"\n [attr.rel]=\"a.url ? 'noopener' : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <img [src]=\"a.thumbnail || a.url\" [alt]=\"a.name\" loading=\"lazy\" />\n </a>\n <ng-template #fileCard>\n <a\n class=\"wu-chat-file\"\n [attr.href]=\"a.url || null\"\n [attr.download]=\"a.url ? a.name : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n <span class=\"wu-chat-file-name\">{{ a.name }}</span>\n <span *ngIf=\"a.size !== undefined\" class=\"wu-chat-file-size\">{{ sizeText(a.size) }}</span>\n </a>\n </ng-template>\n </ng-container>\n <span *ngIf=\"row.message.text\" class=\"wu-chat-text\">{{ row.message.text }}</span>\n </ng-template>\n </div>\n <div class=\"wu-chat-meta\">\n <ng-container *ngIf=\"row.message.status === 'failed'; else normal\">\n <span class=\"wu-chat-error\">{{ t?.failed || 'Not sent' }}</span>\n <button type=\"button\" class=\"wu-chat-retry\" (click)=\"onRetry.emit(row.message)\">{{ t?.retry || 'Send again' }}</button>\n </ng-container>\n <ng-template #normal>\n <span *ngIf=\"row.mine && row.message.read\">{{ readText(row.message) }}</span>\n <span>{{ row.time }}</span>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <div *ngIf=\"typingText\" class=\"wu-chat-typing\">\n <span class=\"wu-chat-dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>\n {{ typingText }}\n </div>\n </div>\n\n <div *ngIf=\"readonly; else composer\" class=\"wu-chat-closed\">{{ readonlyMessage || t?.closed || 'This conversation is closed' }}</div>\n <ng-template #composer>\n <div *ngIf=\"pending.length\" class=\"wu-chat-pending\">\n <span *ngFor=\"let p of pending; let i = index\" class=\"wu-chat-pending-item\">\n <img *ngIf=\"p.preview; else pendingIcon\" [src]=\"p.preview\" alt=\"\" />\n <ng-template #pendingIcon>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n </ng-template>\n <span class=\"wu-chat-pending-name\">{{ p.file.name || 'clipboard.png' }}</span>\n <button type=\"button\" class=\"wu-chat-pending-remove\" [attr.aria-label]=\"(t?.removeFile || 'Remove file') + ' ' + (p.file.name || '')\" (click)=\"removePending(i)\">\u00D7</button>\n </span>\n </div>\n <div class=\"wu-chat-composer\">\n <input #fileInput type=\"file\" multiple hidden [attr.accept]=\"accept || null\" (change)=\"onFilesChosen($event)\" />\n <button\n *ngIf=\"attach\"\n type=\"button\"\n class=\"wu-chat-icon-button\"\n [attr.aria-label]=\"t?.attach || 'Attach files'\"\n [attr.title]=\"t?.attach || 'Attach files'\"\n (click)=\"openFiles()\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M13.5 7.5 8 13a3.5 3.5 0 0 1-5-5l6-6a2.3 2.3 0 0 1 3.3 3.3L6.5 11a1.2 1.2 0 0 1-1.7-1.7L10 4.2\" /></svg>\n </button>\n <textarea\n #box\n class=\"wu-chat-input\"\n rows=\"1\"\n [value]=\"draft\"\n [attr.placeholder]=\"placeholder || t?.placeholder || 'Type a message'\"\n [attr.aria-label]=\"placeholder || t?.placeholder || 'Type a message'\"\n (input)=\"draft = box.value; onInput()\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n ></textarea>\n <button\n type=\"button\"\n class=\"wu-chat-send\"\n [disabled]=\"!canSend\"\n [attr.aria-label]=\"t?.send || 'Send'\"\n [attr.title]=\"t?.send || 'Send'\"\n [attr.aria-busy]=\"sending || null\"\n (click)=\"send()\"\n >\n <span *ngIf=\"sending; else plane\" class=\"wu-chat-spinner\" aria-hidden=\"true\"></span>\n <ng-template #plane>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M14.5 1.5 7 9M14.5 1.5 10 14.5 7 9 1.5 6z\" /></svg>\n </ng-template>\n </button>\n </div>\n </ng-template>\n</section>\n", styles: ["@layer wiraui.components{wu-chat{display:block;min-width:0}.wu-chat{display:flex;flex-direction:column;box-sizing:border-box;height:var(--wu-chat-height);min-height:0;overflow:hidden;border:1px solid var(--wu-border);border-radius:var(--wu-card-radius);background:var(--wu-card-bg);color:var(--wu-text);font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-chat-scroll{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--wu-chat-gap);min-height:0;padding:1rem;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.wu-chat-more{display:flex;justify-content:center;padding-bottom:.5rem}.wu-chat-more-button,.wu-chat-retry{margin:0;padding:.25rem .75rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-full);background:var(--wu-card-bg);color:var(--wu-text-muted);font:inherit;font-size:.8125rem;cursor:pointer}.wu-chat-more-button:hover,.wu-chat-retry:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-loading,.wu-chat-empty{display:flex;flex:1 1 auto;flex-direction:column;align-items:center;justify-content:center;gap:.25rem;color:var(--wu-text-muted);text-align:center}.wu-chat-empty strong{color:var(--wu-text);font-family:var(--wu-heading-font-family);font-weight:600}.wu-chat-empty-art{width:4rem;margin-bottom:.5rem;fill:color-mix(in srgb,var(--wu-primary-color) 12%,transparent);stroke:var(--wu-primary-color);stroke-width:1.5;stroke-linejoin:round}.wu-chat-day,.wu-chat-system{display:flex;justify-content:center;margin:.75rem 0 .5rem}.wu-chat-day>span,.wu-chat-system>span{padding:.125rem .75rem;border-radius:var(--wu-radius-full);background:var(--wu-hover-bg);color:var(--wu-text-muted);font-size:.75rem;text-align:center}.wu-chat-line{display:flex;align-items:flex-end;gap:.5rem;max-width:100%}.wu-chat-line.wu-chat-first{margin-top:.5rem}.wu-chat-mine{flex-direction:row-reverse}.wu-chat-avatar{display:inline-flex;flex:none;align-self:flex-start;align-items:center;justify-content:center;width:2rem;height:2rem;overflow:hidden;border-radius:50%}.wu-chat-first .wu-chat-avatar{background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.75rem;font-weight:600}.wu-chat-avatar img{width:100%;height:100%;object-fit:cover}.wu-chat-stack{display:flex;flex-direction:column;align-items:flex-start;gap:.125rem;min-width:0;max-width:min(75%,36rem)}.wu-chat-mine .wu-chat-stack{align-items:flex-end}.wu-chat-name{display:inline-flex;align-items:center;gap:.375rem;padding:0 .5rem;color:var(--wu-text-muted);font-size:.75rem}.wu-chat-badge{padding:0 .375rem;border-radius:var(--wu-radius-full);background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.6875rem;font-weight:600}.wu-chat-bubble-row{display:flex;align-items:flex-end;gap:.375rem;min-width:0}.wu-chat-mine .wu-chat-bubble-row{flex-direction:row-reverse}.wu-chat-bubble{display:flex;flex-direction:column;gap:.375rem;min-width:0;padding:.5rem .875rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg);color:var(--wu-chat-bubble-color);overflow-wrap:anywhere}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-last) .wu-chat-bubble{border-end-start-radius:.375rem}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-first) .wu-chat-bubble{border-start-start-radius:.375rem}.wu-chat-mine .wu-chat-bubble{background:var(--wu-chat-mine-bg);color:var(--wu-chat-mine-color)}.wu-chat-mine:not(.wu-chat-last) .wu-chat-bubble{border-end-end-radius:.375rem}.wu-chat-mine:not(.wu-chat-first) .wu-chat-bubble{border-start-end-radius:.375rem}.wu-chat-sending .wu-chat-bubble{opacity:.6}.wu-chat-failed .wu-chat-bubble{outline:1px solid var(--wu-danger-color)}.wu-chat-text{white-space:pre-wrap}.wu-chat-meta{display:flex;flex:none;flex-direction:column;align-items:flex-end;color:var(--wu-chat-meta-color);font-size:.6875rem;line-height:1.3;white-space:nowrap}.wu-chat-line:not(.wu-chat-mine) .wu-chat-meta{align-items:flex-start}.wu-chat-error{color:var(--wu-danger-text);font-weight:600}.wu-chat-retry{margin-top:.125rem;padding:0 .5rem;font-size:.6875rem}.wu-chat-image{display:block;overflow:hidden;border-radius:calc(var(--wu-chat-bubble-radius) - .25rem);cursor:pointer}.wu-chat-image img{display:block;max-width:min(16rem,100%);max-height:16rem;object-fit:cover}.wu-chat-file{display:inline-flex;align-items:center;gap:.5rem;min-width:0;padding:.5rem .75rem;border-radius:var(--wu-radius-md);background:color-mix(in srgb,currentColor 10%,transparent);color:inherit;text-decoration:none;cursor:pointer}.wu-chat-file svg,.wu-chat-icon-button svg,.wu-chat-send svg,.wu-chat-pending-item svg{flex:none;width:1.125rem;height:1.125rem;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.wu-chat-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-file-size{flex:none;opacity:.7;font-size:.75rem}.wu-chat-typing{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;color:var(--wu-text-muted);font-size:.8125rem}.wu-chat-dots{display:inline-flex;gap:3px;padding:.5rem .625rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg)}.wu-chat-dots i{width:6px;height:6px;border-radius:50%;background:currentColor;animation:wu-chat-dot 1.2s infinite ease-in-out}.wu-chat-dots i:nth-child(2){animation-delay:.15s}.wu-chat-dots i:nth-child(3){animation-delay:.3s}@keyframes wu-chat-dot{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}.wu-chat-closed{padding:.875rem 1rem;border-top:1px solid var(--wu-border);color:var(--wu-text-muted);font-size:.875rem;text-align:center}.wu-chat-pending{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem .75rem 0;border-top:1px solid var(--wu-border)}.wu-chat-pending-item{display:inline-flex;align-items:center;gap:.375rem;max-width:14rem;padding:.25rem .25rem .25rem .375rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-md);font-size:.8125rem}.wu-chat-pending-item img{width:1.75rem;height:1.75rem;border-radius:var(--wu-radius-sm);object-fit:cover}.wu-chat-pending-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-pending-remove{width:1.5rem;height:1.5rem;margin:0;padding:0;border:0;border-radius:var(--wu-radius-sm);background:transparent;color:var(--wu-text-muted);font-size:1rem;line-height:1;cursor:pointer}.wu-chat-pending-remove:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-composer{display:flex;align-items:flex-end;gap:.5rem;padding:.625rem .75rem;border-top:1px solid var(--wu-border)}.wu-chat-pending+.wu-chat-composer{border-top:0}.wu-chat-input{flex:1 1 auto;box-sizing:border-box;min-width:0;max-height:10rem;margin:0;padding:.5rem .875rem;border:var(--wu-field-border-width) solid var(--wu-field-border);border-radius:var(--wu-radius-xl);background:var(--wu-field-bg);color:var(--wu-field-color);font:inherit;line-height:1.5;resize:none;outline:none}.wu-chat-input::placeholder{color:var(--wu-field-placeholder)}.wu-chat-input:focus{border-color:var(--wu-primary-color);box-shadow:var(--wu-control-focus-shadow)}.wu-chat-icon-button,.wu-chat-send{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2.375rem;height:2.375rem;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wu-text-muted);cursor:pointer}.wu-chat-icon-button:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-send{background:var(--wu-primary-color);color:var(--wu-primary-contrast)}.wu-chat-send:hover:not(:disabled){background:var(--wu-primary-hover)}.wu-chat-send:disabled{opacity:var(--wu-disabled-opacity);cursor:default}:is(.wu-chat-icon-button,.wu-chat-send,.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove,.wu-chat-image,.wu-chat-file):focus-visible{outline:var(--wu-control-focus-outline);outline-offset:var(--wu-control-focus-offset)}.wu-chat-spinner{width:1rem;height:1rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:wu-chat-spin .8s linear infinite}.wu-chat-loading .wu-chat-spinner{width:1.75rem;height:1.75rem;color:var(--wu-primary-color)}@keyframes wu-chat-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.wu-chat-dots i,.wu-chat-spinner{animation-duration:.01ms;animation-iteration-count:1}}@media (pointer: coarse){.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove{min-width:24px;min-height:24px}}@media (max-width: 480px){.wu-chat-stack{max-width:85%}.wu-chat-scroll{padding:.75rem}}}\n"], dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
300
|
+
}
|
|
301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuChat, decorators: [{
|
|
302
|
+
type: Component,
|
|
303
|
+
args: [{ selector: 'wu-chat', standalone: true, imports: [NgFor, NgIf, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'wu-chat-host' }, template: "<section [class]=\"rootClass\" [style]=\"rootStyle\" [attr.aria-label]=\"ariaLabel || t?.messages || null\">\n <div #scroller class=\"wu-chat-scroll\" role=\"log\" aria-live=\"polite\" (scroll)=\"onScroll()\">\n <div *ngIf=\"hasMore && !loading\" class=\"wu-chat-more\">\n <button type=\"button\" class=\"wu-chat-more-button\" (click)=\"onLoadMore.emit()\">{{ t?.loadMore || 'Earlier messages' }}</button>\n </div>\n\n <div *ngIf=\"loading\" class=\"wu-chat-loading\" aria-busy=\"true\"><span class=\"wu-chat-spinner\" aria-hidden=\"true\"></span></div>\n\n <div *ngIf=\"!loading && !messages.length\" class=\"wu-chat-empty\">\n <svg class=\"wu-chat-empty-art\" viewBox=\"0 0 64 48\" aria-hidden=\"true\">\n <path d=\"M8 6h34a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H22l-9 8v-8H8a6 6 0 0 1-6-6V12a6 6 0 0 1 6-6z\" />\n <path d=\"M54 18h2a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6h-2v6l-8-6H34a6 6 0 0 1-6-6v-2\" />\n </svg>\n <strong>{{ t?.emptyTitle || 'No messages yet' }}</strong>\n <span *ngIf=\"!readonly\">{{ t?.emptyDescription || 'Start typing below' }}</span>\n </div>\n\n <ng-container *ngIf=\"!loading\">\n <ng-container *ngFor=\"let row of view; trackBy: trackRow\">\n <div *ngIf=\"row.kind === 'day'\" class=\"wu-chat-day\"><span>{{ row.label }}</span></div>\n\n <div *ngIf=\"row.kind === 'system'\" class=\"wu-chat-system\">\n <span>{{ row.message.text }}<ng-container *ngIf=\"row.time\"> \u00B7 {{ row.time }}</ng-container></span>\n </div>\n\n <div\n *ngIf=\"row.kind === 'message'\"\n class=\"wu-chat-line\"\n [class.wu-chat-mine]=\"row.mine\"\n [class.wu-chat-first]=\"row.first\"\n [class.wu-chat-last]=\"row.last\"\n [class.wu-chat-sending]=\"row.message.status === 'sending'\"\n [class.wu-chat-failed]=\"row.message.status === 'failed'\"\n >\n <div *ngIf=\"!row.mine && showAvatars\" class=\"wu-chat-avatar\" aria-hidden=\"true\">\n <ng-container *ngIf=\"row.first\">\n <img *ngIf=\"row.message.sender?.avatar; else letters\" [src]=\"row.message.sender?.avatar\" alt=\"\" />\n <ng-template #letters><span>{{ initials(row.message.sender?.name) }}</span></ng-template>\n </ng-container>\n </div>\n <div class=\"wu-chat-stack\">\n <span *ngIf=\"!row.mine && row.first && row.message.sender?.name\" class=\"wu-chat-name\">\n {{ row.message.sender?.name }}\n <span *ngIf=\"row.message.sender?.badge\" class=\"wu-chat-badge\">{{ row.message.sender?.badge }}</span>\n </span>\n <div class=\"wu-chat-bubble-row\">\n <div class=\"wu-chat-bubble\">\n <ng-container *ngIf=\"messageTemplate; else plain\">\n <ng-container *ngTemplateOutlet=\"messageTemplate; context: { $implicit: row.message, mine: row.mine }\"></ng-container>\n </ng-container>\n <ng-template #plain>\n <ng-container *ngFor=\"let a of row.message.attachments || []\">\n <a\n *ngIf=\"isImage(a); else fileCard\"\n class=\"wu-chat-image\"\n [attr.href]=\"a.url || null\"\n [attr.target]=\"a.url ? '_blank' : null\"\n [attr.rel]=\"a.url ? 'noopener' : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <img [src]=\"a.thumbnail || a.url\" [alt]=\"a.name\" loading=\"lazy\" />\n </a>\n <ng-template #fileCard>\n <a\n class=\"wu-chat-file\"\n [attr.href]=\"a.url || null\"\n [attr.download]=\"a.url ? a.name : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n <span class=\"wu-chat-file-name\">{{ a.name }}</span>\n <span *ngIf=\"a.size !== undefined\" class=\"wu-chat-file-size\">{{ sizeText(a.size) }}</span>\n </a>\n </ng-template>\n </ng-container>\n <span *ngIf=\"row.message.text\" class=\"wu-chat-text\">{{ row.message.text }}</span>\n </ng-template>\n </div>\n <div class=\"wu-chat-meta\">\n <ng-container *ngIf=\"row.message.status === 'failed'; else normal\">\n <span class=\"wu-chat-error\">{{ t?.failed || 'Not sent' }}</span>\n <button type=\"button\" class=\"wu-chat-retry\" (click)=\"onRetry.emit(row.message)\">{{ t?.retry || 'Send again' }}</button>\n </ng-container>\n <ng-template #normal>\n <span *ngIf=\"row.mine && row.message.read\">{{ readText(row.message) }}</span>\n <span>{{ row.time }}</span>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <div *ngIf=\"typingText\" class=\"wu-chat-typing\">\n <span class=\"wu-chat-dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>\n {{ typingText }}\n </div>\n </div>\n\n <div *ngIf=\"readonly; else composer\" class=\"wu-chat-closed\">{{ readonlyMessage || t?.closed || 'This conversation is closed' }}</div>\n <ng-template #composer>\n <div *ngIf=\"pending.length\" class=\"wu-chat-pending\">\n <span *ngFor=\"let p of pending; let i = index\" class=\"wu-chat-pending-item\">\n <img *ngIf=\"p.preview; else pendingIcon\" [src]=\"p.preview\" alt=\"\" />\n <ng-template #pendingIcon>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n </ng-template>\n <span class=\"wu-chat-pending-name\">{{ p.file.name || 'clipboard.png' }}</span>\n <button type=\"button\" class=\"wu-chat-pending-remove\" [attr.aria-label]=\"(t?.removeFile || 'Remove file') + ' ' + (p.file.name || '')\" (click)=\"removePending(i)\">\u00D7</button>\n </span>\n </div>\n <div class=\"wu-chat-composer\">\n <input #fileInput type=\"file\" multiple hidden [attr.accept]=\"accept || null\" (change)=\"onFilesChosen($event)\" />\n <button\n *ngIf=\"attach\"\n type=\"button\"\n class=\"wu-chat-icon-button\"\n [attr.aria-label]=\"t?.attach || 'Attach files'\"\n [attr.title]=\"t?.attach || 'Attach files'\"\n (click)=\"openFiles()\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M13.5 7.5 8 13a3.5 3.5 0 0 1-5-5l6-6a2.3 2.3 0 0 1 3.3 3.3L6.5 11a1.2 1.2 0 0 1-1.7-1.7L10 4.2\" /></svg>\n </button>\n <textarea\n #box\n class=\"wu-chat-input\"\n rows=\"1\"\n [value]=\"draft\"\n [attr.placeholder]=\"placeholder || t?.placeholder || 'Type a message'\"\n [attr.aria-label]=\"placeholder || t?.placeholder || 'Type a message'\"\n (input)=\"draft = box.value; onInput()\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n ></textarea>\n <button\n type=\"button\"\n class=\"wu-chat-send\"\n [disabled]=\"!canSend\"\n [attr.aria-label]=\"t?.send || 'Send'\"\n [attr.title]=\"t?.send || 'Send'\"\n [attr.aria-busy]=\"sending || null\"\n (click)=\"send()\"\n >\n <span *ngIf=\"sending; else plane\" class=\"wu-chat-spinner\" aria-hidden=\"true\"></span>\n <ng-template #plane>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M14.5 1.5 7 9M14.5 1.5 10 14.5 7 9 1.5 6z\" /></svg>\n </ng-template>\n </button>\n </div>\n </ng-template>\n</section>\n", styles: ["@layer wiraui.components{wu-chat{display:block;min-width:0}.wu-chat{display:flex;flex-direction:column;box-sizing:border-box;height:var(--wu-chat-height);min-height:0;overflow:hidden;border:1px solid var(--wu-border);border-radius:var(--wu-card-radius);background:var(--wu-card-bg);color:var(--wu-text);font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-chat-scroll{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--wu-chat-gap);min-height:0;padding:1rem;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.wu-chat-more{display:flex;justify-content:center;padding-bottom:.5rem}.wu-chat-more-button,.wu-chat-retry{margin:0;padding:.25rem .75rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-full);background:var(--wu-card-bg);color:var(--wu-text-muted);font:inherit;font-size:.8125rem;cursor:pointer}.wu-chat-more-button:hover,.wu-chat-retry:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-loading,.wu-chat-empty{display:flex;flex:1 1 auto;flex-direction:column;align-items:center;justify-content:center;gap:.25rem;color:var(--wu-text-muted);text-align:center}.wu-chat-empty strong{color:var(--wu-text);font-family:var(--wu-heading-font-family);font-weight:600}.wu-chat-empty-art{width:4rem;margin-bottom:.5rem;fill:color-mix(in srgb,var(--wu-primary-color) 12%,transparent);stroke:var(--wu-primary-color);stroke-width:1.5;stroke-linejoin:round}.wu-chat-day,.wu-chat-system{display:flex;justify-content:center;margin:.75rem 0 .5rem}.wu-chat-day>span,.wu-chat-system>span{padding:.125rem .75rem;border-radius:var(--wu-radius-full);background:var(--wu-hover-bg);color:var(--wu-text-muted);font-size:.75rem;text-align:center}.wu-chat-line{display:flex;align-items:flex-end;gap:.5rem;max-width:100%}.wu-chat-line.wu-chat-first{margin-top:.5rem}.wu-chat-mine{flex-direction:row-reverse}.wu-chat-avatar{display:inline-flex;flex:none;align-self:flex-start;align-items:center;justify-content:center;width:2rem;height:2rem;overflow:hidden;border-radius:50%}.wu-chat-first .wu-chat-avatar{background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.75rem;font-weight:600}.wu-chat-avatar img{width:100%;height:100%;object-fit:cover}.wu-chat-stack{display:flex;flex-direction:column;align-items:flex-start;gap:.125rem;min-width:0;max-width:min(75%,36rem)}.wu-chat-mine .wu-chat-stack{align-items:flex-end}.wu-chat-name{display:inline-flex;align-items:center;gap:.375rem;padding:0 .5rem;color:var(--wu-text-muted);font-size:.75rem}.wu-chat-badge{padding:0 .375rem;border-radius:var(--wu-radius-full);background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.6875rem;font-weight:600}.wu-chat-bubble-row{display:flex;align-items:flex-end;gap:.375rem;min-width:0}.wu-chat-mine .wu-chat-bubble-row{flex-direction:row-reverse}.wu-chat-bubble{display:flex;flex-direction:column;gap:.375rem;min-width:0;padding:.5rem .875rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg);color:var(--wu-chat-bubble-color);overflow-wrap:anywhere}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-last) .wu-chat-bubble{border-end-start-radius:.375rem}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-first) .wu-chat-bubble{border-start-start-radius:.375rem}.wu-chat-mine .wu-chat-bubble{background:var(--wu-chat-mine-bg);color:var(--wu-chat-mine-color)}.wu-chat-mine:not(.wu-chat-last) .wu-chat-bubble{border-end-end-radius:.375rem}.wu-chat-mine:not(.wu-chat-first) .wu-chat-bubble{border-start-end-radius:.375rem}.wu-chat-sending .wu-chat-bubble{opacity:.6}.wu-chat-failed .wu-chat-bubble{outline:1px solid var(--wu-danger-color)}.wu-chat-text{white-space:pre-wrap}.wu-chat-meta{display:flex;flex:none;flex-direction:column;align-items:flex-end;color:var(--wu-chat-meta-color);font-size:.6875rem;line-height:1.3;white-space:nowrap}.wu-chat-line:not(.wu-chat-mine) .wu-chat-meta{align-items:flex-start}.wu-chat-error{color:var(--wu-danger-text);font-weight:600}.wu-chat-retry{margin-top:.125rem;padding:0 .5rem;font-size:.6875rem}.wu-chat-image{display:block;overflow:hidden;border-radius:calc(var(--wu-chat-bubble-radius) - .25rem);cursor:pointer}.wu-chat-image img{display:block;max-width:min(16rem,100%);max-height:16rem;object-fit:cover}.wu-chat-file{display:inline-flex;align-items:center;gap:.5rem;min-width:0;padding:.5rem .75rem;border-radius:var(--wu-radius-md);background:color-mix(in srgb,currentColor 10%,transparent);color:inherit;text-decoration:none;cursor:pointer}.wu-chat-file svg,.wu-chat-icon-button svg,.wu-chat-send svg,.wu-chat-pending-item svg{flex:none;width:1.125rem;height:1.125rem;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.wu-chat-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-file-size{flex:none;opacity:.7;font-size:.75rem}.wu-chat-typing{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;color:var(--wu-text-muted);font-size:.8125rem}.wu-chat-dots{display:inline-flex;gap:3px;padding:.5rem .625rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg)}.wu-chat-dots i{width:6px;height:6px;border-radius:50%;background:currentColor;animation:wu-chat-dot 1.2s infinite ease-in-out}.wu-chat-dots i:nth-child(2){animation-delay:.15s}.wu-chat-dots i:nth-child(3){animation-delay:.3s}@keyframes wu-chat-dot{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}.wu-chat-closed{padding:.875rem 1rem;border-top:1px solid var(--wu-border);color:var(--wu-text-muted);font-size:.875rem;text-align:center}.wu-chat-pending{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem .75rem 0;border-top:1px solid var(--wu-border)}.wu-chat-pending-item{display:inline-flex;align-items:center;gap:.375rem;max-width:14rem;padding:.25rem .25rem .25rem .375rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-md);font-size:.8125rem}.wu-chat-pending-item img{width:1.75rem;height:1.75rem;border-radius:var(--wu-radius-sm);object-fit:cover}.wu-chat-pending-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-pending-remove{width:1.5rem;height:1.5rem;margin:0;padding:0;border:0;border-radius:var(--wu-radius-sm);background:transparent;color:var(--wu-text-muted);font-size:1rem;line-height:1;cursor:pointer}.wu-chat-pending-remove:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-composer{display:flex;align-items:flex-end;gap:.5rem;padding:.625rem .75rem;border-top:1px solid var(--wu-border)}.wu-chat-pending+.wu-chat-composer{border-top:0}.wu-chat-input{flex:1 1 auto;box-sizing:border-box;min-width:0;max-height:10rem;margin:0;padding:.5rem .875rem;border:var(--wu-field-border-width) solid var(--wu-field-border);border-radius:var(--wu-radius-xl);background:var(--wu-field-bg);color:var(--wu-field-color);font:inherit;line-height:1.5;resize:none;outline:none}.wu-chat-input::placeholder{color:var(--wu-field-placeholder)}.wu-chat-input:focus{border-color:var(--wu-primary-color);box-shadow:var(--wu-control-focus-shadow)}.wu-chat-icon-button,.wu-chat-send{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2.375rem;height:2.375rem;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wu-text-muted);cursor:pointer}.wu-chat-icon-button:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-send{background:var(--wu-primary-color);color:var(--wu-primary-contrast)}.wu-chat-send:hover:not(:disabled){background:var(--wu-primary-hover)}.wu-chat-send:disabled{opacity:var(--wu-disabled-opacity);cursor:default}:is(.wu-chat-icon-button,.wu-chat-send,.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove,.wu-chat-image,.wu-chat-file):focus-visible{outline:var(--wu-control-focus-outline);outline-offset:var(--wu-control-focus-offset)}.wu-chat-spinner{width:1rem;height:1rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:wu-chat-spin .8s linear infinite}.wu-chat-loading .wu-chat-spinner{width:1.75rem;height:1.75rem;color:var(--wu-primary-color)}@keyframes wu-chat-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.wu-chat-dots i,.wu-chat-spinner{animation-duration:.01ms;animation-iteration-count:1}}@media (pointer: coarse){.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove{min-width:24px;min-height:24px}}@media (max-width: 480px){.wu-chat-stack{max-width:85%}.wu-chat-scroll{padding:.75rem}}}\n"] }]
|
|
304
|
+
}], ctorParameters: () => [], propDecorators: { messages: [{
|
|
305
|
+
type: Input
|
|
306
|
+
}], currentUserId: [{
|
|
307
|
+
type: Input
|
|
308
|
+
}], typing: [{
|
|
309
|
+
type: Input
|
|
310
|
+
}], readonly: [{
|
|
311
|
+
type: Input
|
|
312
|
+
}], readonlyMessage: [{
|
|
313
|
+
type: Input
|
|
314
|
+
}], placeholder: [{
|
|
315
|
+
type: Input
|
|
316
|
+
}], loading: [{
|
|
317
|
+
type: Input
|
|
318
|
+
}], sending: [{
|
|
319
|
+
type: Input
|
|
320
|
+
}], attach: [{
|
|
321
|
+
type: Input
|
|
322
|
+
}], accept: [{
|
|
323
|
+
type: Input
|
|
324
|
+
}], maxFileSize: [{
|
|
325
|
+
type: Input
|
|
326
|
+
}], groupMinutes: [{
|
|
327
|
+
type: Input
|
|
328
|
+
}], hasMore: [{
|
|
329
|
+
type: Input
|
|
330
|
+
}], showAvatars: [{
|
|
331
|
+
type: Input
|
|
332
|
+
}], height: [{
|
|
333
|
+
type: Input
|
|
334
|
+
}], ariaLabel: [{
|
|
335
|
+
type: Input
|
|
336
|
+
}], styleClass: [{
|
|
337
|
+
type: Input
|
|
338
|
+
}], style: [{
|
|
339
|
+
type: Input
|
|
340
|
+
}], onSend: [{
|
|
341
|
+
type: Output
|
|
342
|
+
}], onTyping: [{
|
|
343
|
+
type: Output
|
|
344
|
+
}], onAttachmentClick: [{
|
|
345
|
+
type: Output
|
|
346
|
+
}], onRetry: [{
|
|
347
|
+
type: Output
|
|
348
|
+
}], onLoadMore: [{
|
|
349
|
+
type: Output
|
|
350
|
+
}], onFileRejected: [{
|
|
351
|
+
type: Output
|
|
352
|
+
}], templates: [{
|
|
353
|
+
type: ContentChildren,
|
|
354
|
+
args: [WuTemplate]
|
|
355
|
+
}], messageRef: [{
|
|
356
|
+
type: ContentChild,
|
|
357
|
+
args: ['message', { descendants: false }]
|
|
358
|
+
}], scroller: [{
|
|
359
|
+
type: ViewChild,
|
|
360
|
+
args: ['scroller']
|
|
361
|
+
}], box: [{
|
|
362
|
+
type: ViewChild,
|
|
363
|
+
args: ['box']
|
|
364
|
+
}], fileInput: [{
|
|
365
|
+
type: ViewChild,
|
|
366
|
+
args: ['fileInput']
|
|
367
|
+
}] } });
|
|
368
|
+
function startOfDay(d) {
|
|
369
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** For NgModule apps. Standalone apps can import `WuChat` directly. */
|
|
373
|
+
class WuChatModule {
|
|
374
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
375
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: WuChatModule, imports: [WuChat], exports: [WuChat] }); }
|
|
376
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuChatModule }); }
|
|
377
|
+
}
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WuChatModule, decorators: [{
|
|
379
|
+
type: NgModule,
|
|
380
|
+
args: [{
|
|
381
|
+
imports: [WuChat],
|
|
382
|
+
exports: [WuChat],
|
|
383
|
+
}]
|
|
384
|
+
}] });
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Generated bundle index. Do not edit.
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
export { WuChat, WuChatModule };
|
|
391
|
+
//# sourceMappingURL=wirabyte-ui-chat.mjs.map
|