@wirabyte/ui 1.0.0-beta.0 → 1.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/esm2020/accordion/accordion.component.mjs +4 -4
- package/esm2020/alert/alert-dialog.component.mjs +3 -3
- package/esm2020/asidemenu/asidemenu.component.mjs +3 -3
- package/esm2020/avatar/avatar.component.mjs +10 -5
- package/esm2020/avatar/avatar.types.mjs +2 -2
- package/esm2020/breadcrumb/breadcrumb.component.mjs +5 -3
- package/esm2020/button/button.component.mjs +3 -3
- package/esm2020/button/button.styles.mjs +2 -2
- package/esm2020/card/card.component.mjs +8 -8
- package/esm2020/chat/chat.component.mjs +370 -0
- package/esm2020/chat/chat.module.mjs +17 -0
- package/esm2020/chat/chat.types.mjs +2 -0
- package/esm2020/chat/public-api.mjs +4 -0
- package/esm2020/chat/wirabyte-ui-chat.mjs +5 -0
- package/esm2020/config/options.mjs +1 -1
- package/esm2020/config/theme.service.mjs +35 -3
- package/esm2020/config/wu-config.service.mjs +22 -1
- package/esm2020/core/catalog.mjs +22 -2
- package/esm2020/core/families.mjs +43 -1
- package/esm2020/core/overrides.mjs +26 -1
- package/esm2020/core/thai/locale.mjs +67 -1
- package/esm2020/datepicker/datepicker.component.mjs +5 -4
- package/esm2020/descriptions/descriptions.component.mjs +112 -0
- package/esm2020/descriptions/descriptions.module.mjs +17 -0
- package/esm2020/descriptions/public-api.mjs +3 -0
- package/esm2020/descriptions/wirabyte-ui-descriptions.mjs +5 -0
- package/esm2020/dialog/dialog.component.mjs +3 -3
- package/esm2020/drawer/drawer.component.mjs +3 -3
- package/esm2020/emptystate/emptystate.component.mjs +3 -3
- package/esm2020/errorpage/errorpage.component.mjs +3 -3
- package/esm2020/fieldset/fieldset.component.mjs +4 -4
- package/esm2020/metergroup/metergroup.component.mjs +29 -5
- package/esm2020/metergroup/metergroup.types.mjs +1 -1
- package/esm2020/navbar/navbar.component.mjs +3 -3
- package/esm2020/panel/panel.component.mjs +6 -6
- package/esm2020/popover/popover.base.mjs +3 -3
- package/esm2020/result/result.component.mjs +3 -3
- package/esm2020/scheduler/public-api.mjs +4 -0
- package/esm2020/scheduler/scheduler.component.mjs +484 -0
- package/esm2020/scheduler/scheduler.module.mjs +17 -0
- package/esm2020/scheduler/scheduler.types.mjs +2 -0
- package/esm2020/scheduler/wirabyte-ui-scheduler.mjs +5 -0
- package/esm2020/selectbutton/selectbutton.component.mjs +23 -5
- package/esm2020/signaturepad/public-api.mjs +3 -0
- package/esm2020/signaturepad/signaturepad.component.mjs +289 -0
- package/esm2020/signaturepad/signaturepad.module.mjs +17 -0
- package/esm2020/signaturepad/wirabyte-ui-signaturepad.mjs +5 -0
- package/esm2020/sitefooter/sitefooter.component.mjs +2 -2
- package/esm2020/stat/public-api.mjs +3 -0
- package/esm2020/stat/stat.component.mjs +128 -0
- package/esm2020/stat/stat.module.mjs +17 -0
- package/esm2020/stat/wirabyte-ui-stat.mjs +5 -0
- package/esm2020/table/table.celleditor.mjs +4 -4
- package/esm2020/tabs/tabs.component.mjs +3 -3
- package/esm2020/tag/tag.component.mjs +3 -3
- package/esm2020/textarea/textarea.directive.mjs +33 -1
- package/esm2020/thai/thai.pipes.mjs +3 -3
- package/esm2020/toolbar/toolbar.component.mjs +7 -7
- package/fesm2015/wirabyte-ui-accordion.mjs +3 -3
- package/fesm2015/wirabyte-ui-accordion.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-alert.mjs +2 -2
- package/fesm2015/wirabyte-ui-alert.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-asidemenu.mjs +2 -2
- package/fesm2015/wirabyte-ui-asidemenu.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-avatar.mjs +11 -5
- package/fesm2015/wirabyte-ui-avatar.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-breadcrumb.mjs +4 -2
- package/fesm2015/wirabyte-ui-breadcrumb.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-button.mjs +3 -3
- package/fesm2015/wirabyte-ui-button.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-card.mjs +7 -7
- package/fesm2015/wirabyte-ui-card.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-chat.mjs +399 -0
- package/fesm2015/wirabyte-ui-chat.mjs.map +1 -0
- package/fesm2015/wirabyte-ui-config.mjs +55 -2
- package/fesm2015/wirabyte-ui-config.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-core.mjs +147 -2
- package/fesm2015/wirabyte-ui-core.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-datepicker.mjs +5 -4
- package/fesm2015/wirabyte-ui-datepicker.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-descriptions.mjs +133 -0
- package/fesm2015/wirabyte-ui-descriptions.mjs.map +1 -0
- package/fesm2015/wirabyte-ui-dialog.mjs +2 -2
- package/fesm2015/wirabyte-ui-dialog.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-drawer.mjs +2 -2
- package/fesm2015/wirabyte-ui-drawer.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-emptystate.mjs +2 -2
- package/fesm2015/wirabyte-ui-emptystate.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-errorpage.mjs +2 -2
- package/fesm2015/wirabyte-ui-errorpage.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-fieldset.mjs +3 -3
- package/fesm2015/wirabyte-ui-fieldset.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-metergroup.mjs +29 -4
- package/fesm2015/wirabyte-ui-metergroup.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-navbar.mjs +2 -2
- package/fesm2015/wirabyte-ui-navbar.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-panel.mjs +5 -5
- package/fesm2015/wirabyte-ui-panel.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-popover.mjs +2 -2
- package/fesm2015/wirabyte-ui-popover.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-result.mjs +2 -2
- package/fesm2015/wirabyte-ui-result.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-scheduler.mjs +515 -0
- package/fesm2015/wirabyte-ui-scheduler.mjs.map +1 -0
- package/fesm2015/wirabyte-ui-selectbutton.mjs +22 -4
- package/fesm2015/wirabyte-ui-selectbutton.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-signaturepad.mjs +313 -0
- package/fesm2015/wirabyte-ui-signaturepad.mjs.map +1 -0
- package/fesm2015/wirabyte-ui-sitefooter.mjs +1 -1
- package/fesm2015/wirabyte-ui-sitefooter.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-stat.mjs +151 -0
- package/fesm2015/wirabyte-ui-stat.mjs.map +1 -0
- package/fesm2015/wirabyte-ui-table.mjs +3 -3
- package/fesm2015/wirabyte-ui-table.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-tabs.mjs +2 -2
- package/fesm2015/wirabyte-ui-tabs.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-tag.mjs +2 -2
- package/fesm2015/wirabyte-ui-tag.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-textarea.mjs +32 -0
- package/fesm2015/wirabyte-ui-textarea.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-thai.mjs +2 -2
- package/fesm2015/wirabyte-ui-thai.mjs.map +1 -1
- package/fesm2015/wirabyte-ui-toolbar.mjs +6 -6
- package/fesm2015/wirabyte-ui-toolbar.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-accordion.mjs +3 -3
- package/fesm2020/wirabyte-ui-accordion.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-alert.mjs +2 -2
- package/fesm2020/wirabyte-ui-alert.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-asidemenu.mjs +2 -2
- package/fesm2020/wirabyte-ui-asidemenu.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-avatar.mjs +11 -5
- package/fesm2020/wirabyte-ui-avatar.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-breadcrumb.mjs +4 -2
- package/fesm2020/wirabyte-ui-breadcrumb.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-button.mjs +3 -3
- package/fesm2020/wirabyte-ui-button.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-card.mjs +7 -7
- package/fesm2020/wirabyte-ui-card.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-chat.mjs +391 -0
- package/fesm2020/wirabyte-ui-chat.mjs.map +1 -0
- package/fesm2020/wirabyte-ui-config.mjs +55 -2
- package/fesm2020/wirabyte-ui-config.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-core.mjs +155 -2
- package/fesm2020/wirabyte-ui-core.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-datepicker.mjs +5 -4
- package/fesm2020/wirabyte-ui-datepicker.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-descriptions.mjs +133 -0
- package/fesm2020/wirabyte-ui-descriptions.mjs.map +1 -0
- package/fesm2020/wirabyte-ui-dialog.mjs +2 -2
- package/fesm2020/wirabyte-ui-dialog.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-drawer.mjs +2 -2
- package/fesm2020/wirabyte-ui-drawer.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-emptystate.mjs +2 -2
- package/fesm2020/wirabyte-ui-emptystate.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-errorpage.mjs +2 -2
- package/fesm2020/wirabyte-ui-errorpage.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-fieldset.mjs +3 -3
- package/fesm2020/wirabyte-ui-fieldset.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-metergroup.mjs +28 -4
- package/fesm2020/wirabyte-ui-metergroup.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-navbar.mjs +2 -2
- package/fesm2020/wirabyte-ui-navbar.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-panel.mjs +5 -5
- package/fesm2020/wirabyte-ui-panel.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-popover.mjs +2 -2
- package/fesm2020/wirabyte-ui-popover.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-result.mjs +2 -2
- package/fesm2020/wirabyte-ui-result.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-scheduler.mjs +505 -0
- package/fesm2020/wirabyte-ui-scheduler.mjs.map +1 -0
- package/fesm2020/wirabyte-ui-selectbutton.mjs +22 -4
- package/fesm2020/wirabyte-ui-selectbutton.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-signaturepad.mjs +310 -0
- package/fesm2020/wirabyte-ui-signaturepad.mjs.map +1 -0
- package/fesm2020/wirabyte-ui-sitefooter.mjs +1 -1
- package/fesm2020/wirabyte-ui-sitefooter.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-stat.mjs +149 -0
- package/fesm2020/wirabyte-ui-stat.mjs.map +1 -0
- package/fesm2020/wirabyte-ui-table.mjs +3 -3
- package/fesm2020/wirabyte-ui-table.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-tabs.mjs +2 -2
- package/fesm2020/wirabyte-ui-tabs.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-tag.mjs +2 -2
- package/fesm2020/wirabyte-ui-tag.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-textarea.mjs +32 -0
- package/fesm2020/wirabyte-ui-textarea.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-thai.mjs +2 -2
- package/fesm2020/wirabyte-ui-thai.mjs.map +1 -1
- package/fesm2020/wirabyte-ui-toolbar.mjs +6 -6
- package/fesm2020/wirabyte-ui-toolbar.mjs.map +1 -1
- package/metergroup/metergroup.component.d.ts +16 -3
- package/metergroup/metergroup.types.d.ts +6 -0
- package/package.json +41 -1
- 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/arun-blue/theme.css +30 -1
- package/themes/arun-green/theme.css +30 -1
- package/themes/arun-orange/theme.css +30 -1
- package/themes/arun-purple/theme.css +30 -1
- package/themes/md-dark-deeppurple/theme.css +30 -1
- package/themes/md-dark-indigo/theme.css +30 -1
- package/themes/md-light-deeppurple/theme.css +30 -1
- package/themes/md-light-indigo/theme.css +30 -1
- package/themes/ratri-blue/theme.css +30 -1
- package/themes/ratri-green/theme.css +30 -1
- package/themes/ratri-orange/theme.css +30 -1
- package/themes/ratri-purple/theme.css +30 -1
- package/themes/sayan-blue/theme.css +30 -1
- package/themes/sayan-green/theme.css +30 -1
- package/themes/sayan-orange/theme.css +30 -1
- package/themes/sayan-purple/theme.css +30 -1
- package/themes/sila-dark-blue/theme.css +30 -1
- package/themes/sila-dark-indigo/theme.css +30 -1
- package/themes/sila-dark-purple/theme.css +30 -1
- package/themes/sila-dark-teal/theme.css +30 -1
- package/themes/sila-light-blue/theme.css +30 -1
- package/themes/sila-light-indigo/theme.css +30 -1
- package/themes/sila-light-purple/theme.css +30 -1
- package/themes/sila-light-teal/theme.css +30 -1
- package/themes/sila-light-wira/theme.css +30 -1
|
@@ -51,10 +51,10 @@ class WuCard {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
WuCard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WuCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
-
WuCard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: WuCard, isStandalone: true, selector: "wu-card", inputs: { styleClass: "styleClass", style: "style", header: "header", subheader: "subheader", variant: "variant", loading: "loading" }, queries: [{ propertyName: "headerRef", first: true, predicate: ["header"],
|
|
54
|
+
WuCard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: WuCard, isStandalone: true, selector: "wu-card", inputs: { styleClass: "styleClass", style: "style", header: "header", subheader: "subheader", variant: "variant", loading: "loading" }, queries: [{ propertyName: "headerRef", first: true, predicate: ["header"], read: TemplateRef }, { propertyName: "titleRef", first: true, predicate: ["title"], read: TemplateRef }, { propertyName: "subtitleRef", first: true, predicate: ["subtitle"], read: TemplateRef }, { propertyName: "contentRef", first: true, predicate: ["content"], read: TemplateRef }, { propertyName: "footerRef", first: true, predicate: ["footer"], read: TemplateRef }, { propertyName: "templates", predicate: WuTemplate }], ngImport: i0, template: "<div [class]=\"classes\" [style]=\"rootStyle\" [attr.aria-busy]=\"loading || null\">\n <div class=\"wu-card-header p-card-header\"><ng-content select=\"[wuCardHeader], wu-header\"></ng-content><ng-container *ngIf=\"headerTemplate\"><ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n <div *ngIf=\"header || subheader || titleTemplate || subtitleTemplate\" class=\"wu-card-titles p-card-caption\">\n <div *ngIf=\"header || titleTemplate\" class=\"wu-card-title p-card-title\">{{ header }}<ng-container *ngIf=\"titleTemplate\"><ng-container *ngTemplateOutlet=\"titleTemplate\"></ng-container></ng-container></div>\n <div *ngIf=\"subheader || subtitleTemplate\" class=\"wu-card-subtitle p-card-subtitle\">{{ subheader }}<ng-container *ngIf=\"subtitleTemplate\"><ng-container *ngTemplateOutlet=\"subtitleTemplate\"></ng-container></ng-container></div>\n </div>\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n <div *ngIf=\"loading\" class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading\"><ng-content></ng-content><ng-container *ngIf=\"contentTemplate\"><ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-footer p-card-footer\"><ng-content select=\"[wuCardFooter], wu-footer\"></ng-content><ng-container *ngIf=\"footerTemplate\"><ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container></ng-container></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);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);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: 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 });
|
|
55
55
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WuCard, decorators: [{
|
|
56
56
|
type: Component,
|
|
57
|
-
args: [{ selector: 'wu-card', standalone: true, imports: [NgIf, 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\"><ng-content select=\"[wuCardHeader], wu-header\"></ng-content><ng-container *ngIf=\"headerTemplate\"><ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n <div *ngIf=\"header || subheader || titleTemplate || subtitleTemplate\" class=\"wu-card-titles p-card-caption\">\n <div *ngIf=\"header || titleTemplate\" class=\"wu-card-title p-card-title\">{{ header }}<ng-container *ngIf=\"titleTemplate\"><ng-container *ngTemplateOutlet=\"titleTemplate\"></ng-container></ng-container></div>\n <div *ngIf=\"subheader || subtitleTemplate\" class=\"wu-card-subtitle p-card-subtitle\">{{ subheader }}<ng-container *ngIf=\"subtitleTemplate\"><ng-container *ngTemplateOutlet=\"subtitleTemplate\"></ng-container></ng-container></div>\n </div>\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n <div *ngIf=\"loading\" class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading\"><ng-content></ng-content><ng-container *ngIf=\"contentTemplate\"><ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-footer p-card-footer\"><ng-content select=\"[wuCardFooter], wu-footer\"></ng-content><ng-container *ngIf=\"footerTemplate\"><ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container></ng-container></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);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);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"] }]
|
|
57
|
+
args: [{ selector: 'wu-card', standalone: true, imports: [NgIf, 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\"><ng-content select=\"[wuCardHeader], wu-header\"></ng-content><ng-container *ngIf=\"headerTemplate\"><ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n <div *ngIf=\"header || subheader || titleTemplate || subtitleTemplate\" class=\"wu-card-titles p-card-caption\">\n <div *ngIf=\"header || titleTemplate\" class=\"wu-card-title p-card-title\">{{ header }}<ng-container *ngIf=\"titleTemplate\"><ng-container *ngTemplateOutlet=\"titleTemplate\"></ng-container></ng-container></div>\n <div *ngIf=\"subheader || subtitleTemplate\" class=\"wu-card-subtitle p-card-subtitle\">{{ subheader }}<ng-container *ngIf=\"subtitleTemplate\"><ng-container *ngTemplateOutlet=\"subtitleTemplate\"></ng-container></ng-container></div>\n </div>\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n <div *ngIf=\"loading\" class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading\"><ng-content></ng-content><ng-container *ngIf=\"contentTemplate\"><ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-footer p-card-footer\"><ng-content select=\"[wuCardFooter], wu-footer\"></ng-content><ng-container *ngIf=\"footerTemplate\"><ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container></ng-container></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);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);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"] }]
|
|
58
58
|
}], ctorParameters: function () { return []; }, propDecorators: { styleClass: [{
|
|
59
59
|
type: Input
|
|
60
60
|
}], style: [{
|
|
@@ -72,19 +72,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
72
72
|
args: [WuTemplate]
|
|
73
73
|
}], headerRef: [{
|
|
74
74
|
type: ContentChild,
|
|
75
|
-
args: ['header', { read: TemplateRef }]
|
|
75
|
+
args: ['header', { read: TemplateRef, descendants: false }]
|
|
76
76
|
}], titleRef: [{
|
|
77
77
|
type: ContentChild,
|
|
78
|
-
args: ['title', { read: TemplateRef }]
|
|
78
|
+
args: ['title', { read: TemplateRef, descendants: false }]
|
|
79
79
|
}], subtitleRef: [{
|
|
80
80
|
type: ContentChild,
|
|
81
|
-
args: ['subtitle', { read: TemplateRef }]
|
|
81
|
+
args: ['subtitle', { read: TemplateRef, descendants: false }]
|
|
82
82
|
}], contentRef: [{
|
|
83
83
|
type: ContentChild,
|
|
84
|
-
args: ['content', { read: TemplateRef }]
|
|
84
|
+
args: ['content', { read: TemplateRef, descendants: false }]
|
|
85
85
|
}], footerRef: [{
|
|
86
86
|
type: ContentChild,
|
|
87
|
-
args: ['footer', { read: TemplateRef }]
|
|
87
|
+
args: ['footer', { read: TemplateRef, descendants: false }]
|
|
88
88
|
}] } });
|
|
89
89
|
|
|
90
90
|
/** `<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 { NgIf, NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, inject, Input, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { ɵassertSupportedAngular, ɵfindTemplate, ɵtoBool, ɵWU_SKIP_VERSION_CHECK, 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 `loading` (skeleton lines instead of content). `glass` is a v3 look:\n * here it shows a plain card.\n */\n@Component({\n selector: 'wu-card',\n standalone: true,\n imports: [NgIf, NgTemplateOutlet],\n templateUrl: './card.component.html',\n styleUrls: ['./card.css'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WuCard {\n /** Classes for the root element, as before (`styleClass=\"w-full\"`). */\n @Input() styleClass?: string | null;\n /** Inline styles for the root element, as an object: `[style]=\"{ width: '20rem' }\"`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() style?: Record<string, any> | string | null;\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 get rootStyle(): Record<string, any> | null {\n return this.style && typeof this.style === 'object' ? this.style : null;\n }\n @Input() header?: string;\n @Input() subheader?: string;\n @Input() variant: WuCardVariant = 'default';\n @Input() set loading(v: unknown) { this._loading = ɵtoBool(v); }\n get loading(): boolean { return this._loading; }\n\n @ContentChildren(WuTemplate) protected templates?: QueryList<WuTemplate>;\n @ContentChild('header', { read: TemplateRef }) protected headerRef?: TemplateRef<unknown>;\n @ContentChild('title', { read: TemplateRef }) protected titleRef?: TemplateRef<unknown>;\n @ContentChild('subtitle', { read: TemplateRef }) protected subtitleRef?: TemplateRef<unknown>;\n @ContentChild('content', { read: TemplateRef }) protected contentRef?: TemplateRef<unknown>;\n @ContentChild('footer', { read: TemplateRef }) protected footerRef?: TemplateRef<unknown>;\n\n private _loading = false;\n\n get headerTemplate(): TemplateRef<unknown> | null {\n return this.headerRef || ɵfindTemplate(this.templates, 'header');\n }\n get titleTemplate(): TemplateRef<unknown> | null {\n return this.titleRef || ɵfindTemplate(this.templates, 'title');\n }\n get subtitleTemplate(): TemplateRef<unknown> | null {\n return this.subtitleRef || ɵfindTemplate(this.templates, 'subtitle');\n }\n get contentTemplate(): TemplateRef<unknown> | null {\n return this.contentRef || ɵfindTemplate(this.templates, 'content');\n }\n get footerTemplate(): TemplateRef<unknown> | null {\n return this.footerRef || ɵfindTemplate(this.templates, 'footer');\n }\n\n constructor() {\n ɵassertSupportedAngular(inject(ɵWU_SKIP_VERSION_CHECK, { optional: true }));\n }\n\n get classes(): string {\n const c = ['wu-card', 'p-card', 'p-component'];\n if (this.variant !== 'default' && this.variant !== 'glass') c.push('wu-card-' + this.variant);\n if (this._loading) c.push('wu-card-loading');\n if (this.styleClass) c.push(this.styleClass);\n return c.join(' ');\n }\n}\n","<div [class]=\"classes\" [style]=\"rootStyle\" [attr.aria-busy]=\"loading || null\">\n <div class=\"wu-card-header p-card-header\"><ng-content select=\"[wuCardHeader], wu-header\"></ng-content><ng-container *ngIf=\"headerTemplate\"><ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n <div *ngIf=\"header || subheader || titleTemplate || subtitleTemplate\" class=\"wu-card-titles p-card-caption\">\n <div *ngIf=\"header || titleTemplate\" class=\"wu-card-title p-card-title\">{{ header }}<ng-container *ngIf=\"titleTemplate\"><ng-container *ngTemplateOutlet=\"titleTemplate\"></ng-container></ng-container></div>\n <div *ngIf=\"subheader || subtitleTemplate\" class=\"wu-card-subtitle p-card-subtitle\">{{ subheader }}<ng-container *ngIf=\"subtitleTemplate\"><ng-container *ngTemplateOutlet=\"subtitleTemplate\"></ng-container></ng-container></div>\n </div>\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n <div *ngIf=\"loading\" class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading\"><ng-content></ng-content><ng-container *ngIf=\"contentTemplate\"><ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-footer p-card-footer\"><ng-content select=\"[wuCardFooter], wu-footer\"></ng-content><ng-container *ngIf=\"footerTemplate\"><ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container></ng-container></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":[],"mappings":";;;;;AAKA;;;;;;;AAOG;MAUU,MAAM,CAAA;;;AAQjB,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;KACzE;AAID,IAAA,IAAa,OAAO,CAAC,CAAU,EAAA,EAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IAChE,IAAI,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE;AAWhD,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KAClE;AACD,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,IAA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AAA;AAErC,YAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,YAHb,MAAM,CAAA,EAAA,CAAA,CAAA;4FAGL,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,CAAA;;;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 { NgIf, NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, inject, Input, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { ɵassertSupportedAngular, ɵfindTemplate, ɵtoBool, ɵWU_SKIP_VERSION_CHECK, 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 `loading` (skeleton lines instead of content). `glass` is a v3 look:\n * here it shows a plain card.\n */\n@Component({\n selector: 'wu-card',\n standalone: true,\n imports: [NgIf, NgTemplateOutlet],\n templateUrl: './card.component.html',\n styleUrls: ['./card.css'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WuCard {\n /** Classes for the root element, as before (`styleClass=\"w-full\"`). */\n @Input() styleClass?: string | null;\n /** Inline styles for the root element, as an object: `[style]=\"{ width: '20rem' }\"`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() style?: Record<string, any> | string | null;\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 get rootStyle(): Record<string, any> | null {\n return this.style && typeof this.style === 'object' ? this.style : null;\n }\n @Input() header?: string;\n @Input() subheader?: string;\n @Input() variant: WuCardVariant = 'default';\n @Input() set loading(v: unknown) { this._loading = ɵtoBool(v); }\n get loading(): boolean { return this._loading; }\n\n @ContentChildren(WuTemplate) protected templates?: QueryList<WuTemplate>;\n @ContentChild('header', { read: TemplateRef, descendants: false }) protected headerRef?: TemplateRef<unknown>;\n @ContentChild('title', { read: TemplateRef, descendants: false }) protected titleRef?: TemplateRef<unknown>;\n @ContentChild('subtitle', { read: TemplateRef, descendants: false }) protected subtitleRef?: TemplateRef<unknown>;\n @ContentChild('content', { read: TemplateRef, descendants: false }) protected contentRef?: TemplateRef<unknown>;\n @ContentChild('footer', { read: TemplateRef, descendants: false }) protected footerRef?: TemplateRef<unknown>;\n\n private _loading = false;\n\n get headerTemplate(): TemplateRef<unknown> | null {\n return this.headerRef || ɵfindTemplate(this.templates, 'header');\n }\n get titleTemplate(): TemplateRef<unknown> | null {\n return this.titleRef || ɵfindTemplate(this.templates, 'title');\n }\n get subtitleTemplate(): TemplateRef<unknown> | null {\n return this.subtitleRef || ɵfindTemplate(this.templates, 'subtitle');\n }\n get contentTemplate(): TemplateRef<unknown> | null {\n return this.contentRef || ɵfindTemplate(this.templates, 'content');\n }\n get footerTemplate(): TemplateRef<unknown> | null {\n return this.footerRef || ɵfindTemplate(this.templates, 'footer');\n }\n\n constructor() {\n ɵassertSupportedAngular(inject(ɵWU_SKIP_VERSION_CHECK, { optional: true }));\n }\n\n get classes(): string {\n const c = ['wu-card', 'p-card', 'p-component'];\n if (this.variant !== 'default' && this.variant !== 'glass') c.push('wu-card-' + this.variant);\n if (this._loading) c.push('wu-card-loading');\n if (this.styleClass) c.push(this.styleClass);\n return c.join(' ');\n }\n}\n","<div [class]=\"classes\" [style]=\"rootStyle\" [attr.aria-busy]=\"loading || null\">\n <div class=\"wu-card-header p-card-header\"><ng-content select=\"[wuCardHeader], wu-header\"></ng-content><ng-container *ngIf=\"headerTemplate\"><ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-body p-card-body\">\n <div class=\"wu-card-caption\">\n <div *ngIf=\"header || subheader || titleTemplate || subtitleTemplate\" class=\"wu-card-titles p-card-caption\">\n <div *ngIf=\"header || titleTemplate\" class=\"wu-card-title p-card-title\">{{ header }}<ng-container *ngIf=\"titleTemplate\"><ng-container *ngTemplateOutlet=\"titleTemplate\"></ng-container></ng-container></div>\n <div *ngIf=\"subheader || subtitleTemplate\" class=\"wu-card-subtitle p-card-subtitle\">{{ subheader }}<ng-container *ngIf=\"subtitleTemplate\"><ng-container *ngTemplateOutlet=\"subtitleTemplate\"></ng-container></ng-container></div>\n </div>\n <div class=\"wu-card-actions\"><ng-content select=\"[wuCardActions]\"></ng-content></div>\n </div>\n <div *ngIf=\"loading\" class=\"wu-card-skeleton\" aria-hidden=\"true\"><span></span><span></span><span></span></div>\n <div class=\"wu-card-content p-card-content\" [hidden]=\"loading\"><ng-content></ng-content><ng-container *ngIf=\"contentTemplate\"><ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container></ng-container></div>\n <div class=\"wu-card-footer p-card-footer\"><ng-content select=\"[wuCardFooter], wu-footer\"></ng-content><ng-container *ngIf=\"footerTemplate\"><ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container></ng-container></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":[],"mappings":";;;;;AAKA;;;;;;;AAOG;MAUU,MAAM,CAAA;;;AAQjB,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;KACzE;AAID,IAAA,IAAa,OAAO,CAAC,CAAU,EAAA,EAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IAChE,IAAI,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE;AAWhD,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KAClE;AACD,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;KAChE;AACD,IAAA,IAAI,gBAAgB,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,WAAW,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE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AAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;oBACjD,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;AAClD,iBAAA,CAAA;;;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, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ContentChildren, ContentChild, ViewChild, NgModule } from '@angular/core';
|
|
4
|
+
import { ɵtoBool, WuConfig, ɵrefreshOnTranslation, ɵassertSupportedAngular, ɵWU_SKIP_VERSION_CHECK, ɵ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
|
+
}
|
|
299
|
+
WuChat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WuChat, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
300
|
+
WuChat.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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 });
|
|
301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: function () { return []; }, 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
|
+
}
|
|
375
|
+
WuChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WuChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
376
|
+
WuChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: WuChatModule, imports: [WuChat], exports: [WuChat] });
|
|
377
|
+
WuChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WuChatModule, imports: [WuChat] });
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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
|