@forgeroute/ui 0.5.30 → 0.5.32
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/fesm2022/forgeroute-ui-address-input.mjs +10 -2
- package/fesm2022/forgeroute-ui-address-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-core.mjs +4 -4
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +21 -7
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-form-row.mjs +54 -18
- package/fesm2022/forgeroute-ui-form-row.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-form-section.mjs +32 -4
- package/fesm2022/forgeroute-ui-form-section.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-kpi-card.mjs +20 -4
- package/fesm2022/forgeroute-ui-kpi-card.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-list-item.mjs +2 -2
- package/fesm2022/forgeroute-ui-list-item.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-map.mjs +10 -2
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +30 -6
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +26 -5
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs +11 -2
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-share-menu.mjs +46 -15
- package/fesm2022/forgeroute-ui-share-menu.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs +1 -0
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +21 -4
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-core.d.ts +8 -7
- package/types/forgeroute-ui-data-table-core.d.ts +5 -0
- package/types/forgeroute-ui-form-row.d.ts +14 -0
- package/types/forgeroute-ui-form-section.d.ts +8 -1
- package/types/forgeroute-ui-kpi-card.d.ts +7 -0
- package/types/forgeroute-ui-list-item.d.ts +1 -1
- package/types/forgeroute-ui-share-menu.d.ts +20 -11
- package/types/forgeroute-ui-table-types.d.ts +7 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, ElementRef, Injector, afterNextRender, computed, inject, input, signal, viewChild } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, Injector, afterNextRender, computed, inject, input, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { DOCUMENT } from "@angular/common";
|
|
4
4
|
import { ToastComponent } from "@forgeroute/ui/toast";
|
|
5
5
|
import { ToastService, UiLabelsService } from "@forgeroute/ui/core";
|
|
@@ -14,6 +14,8 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this.labels = inject(UiLabelsService);
|
|
16
16
|
this.url = input.required(...ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []);
|
|
17
|
+
this.urlFor = input(null, ...ngDevMode ? [{ debugName: "urlFor" }] : /* istanbul ignore next */ []);
|
|
18
|
+
this.shared = output();
|
|
17
19
|
this.title = input.required(...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
18
20
|
this.labelInput = input(null, {
|
|
19
21
|
...ngDevMode ? { debugName: "labelInput" } : /* istanbul ignore next */ {},
|
|
@@ -71,14 +73,6 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
71
73
|
background: "#57534e"
|
|
72
74
|
}] : []
|
|
73
75
|
], ...ngDevMode ? [{ debugName: "tiles" }] : /* istanbul ignore next */ []);
|
|
74
|
-
this.links = computed(() => ({
|
|
75
|
-
facebook: facebookShareUrl(this.url()),
|
|
76
|
-
x: xShareUrl(this.url(), this.title()),
|
|
77
|
-
linkedin: linkedInShareUrl(this.url()),
|
|
78
|
-
email: emailShareUrl(this.url(), this.title()),
|
|
79
|
-
gmail: gmailShareUrl(this.url(), this.title()),
|
|
80
|
-
outlook: outlookShareUrl(this.url(), this.title())
|
|
81
|
-
}), ...ngDevMode ? [{ debugName: "links" }] : /* istanbul ignore next */ []);
|
|
82
76
|
}
|
|
83
77
|
toggle(event) {
|
|
84
78
|
event.stopPropagation();
|
|
@@ -124,7 +118,24 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
124
118
|
event.preventDefault();
|
|
125
119
|
options[to].focus();
|
|
126
120
|
}
|
|
121
|
+
urlOf(option) {
|
|
122
|
+
const make = this.urlFor();
|
|
123
|
+
return make ? make(option) : this.url();
|
|
124
|
+
}
|
|
125
|
+
linkFor(option) {
|
|
126
|
+
const url = this.urlOf(option);
|
|
127
|
+
const title = this.title();
|
|
128
|
+
switch (option) {
|
|
129
|
+
case "facebook": return facebookShareUrl(url);
|
|
130
|
+
case "x": return xShareUrl(url, title);
|
|
131
|
+
case "linkedin": return linkedInShareUrl(url);
|
|
132
|
+
case "email": return emailShareUrl(url, title);
|
|
133
|
+
case "gmail": return gmailShareUrl(url, title);
|
|
134
|
+
case "outlook": return outlookShareUrl(url, title);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
127
137
|
choose(option) {
|
|
138
|
+
this.shared.emit(option);
|
|
128
139
|
switch (option) {
|
|
129
140
|
case "native":
|
|
130
141
|
this.nativeShare();
|
|
@@ -134,7 +145,7 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
134
145
|
case "linkedin":
|
|
135
146
|
case "gmail":
|
|
136
147
|
case "outlook":
|
|
137
|
-
this.doc.defaultView?.open(this.
|
|
148
|
+
this.doc.defaultView?.open(this.linkFor(option), "_blank", "noopener,noreferrer");
|
|
138
149
|
break;
|
|
139
150
|
case "email":
|
|
140
151
|
this.email();
|
|
@@ -147,7 +158,7 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
147
158
|
try {
|
|
148
159
|
await this.doc.defaultView.navigator.share({
|
|
149
160
|
title: this.title(),
|
|
150
|
-
url: this.
|
|
161
|
+
url: this.urlOf("native")
|
|
151
162
|
});
|
|
152
163
|
} catch (err) {
|
|
153
164
|
if (err?.name !== "AbortError") this.toast.error(this.labels.t("shareMenu.unavailable"));
|
|
@@ -155,12 +166,12 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
155
166
|
}
|
|
156
167
|
email() {
|
|
157
168
|
const link = this.doc.createElement("a");
|
|
158
|
-
link.href = this.
|
|
169
|
+
link.href = this.linkFor("email");
|
|
159
170
|
link.rel = "noopener noreferrer";
|
|
160
171
|
link.click();
|
|
161
172
|
}
|
|
162
173
|
async copy() {
|
|
163
|
-
const url = this.
|
|
174
|
+
const url = this.urlOf("copy");
|
|
164
175
|
try {
|
|
165
176
|
await this.doc.defaultView.navigator.clipboard.writeText(url);
|
|
166
177
|
this.toast.show(this.labels.t("shareMenu.linkCopied"));
|
|
@@ -214,6 +225,13 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
214
225
|
isRequired: true,
|
|
215
226
|
transformFunction: null
|
|
216
227
|
},
|
|
228
|
+
urlFor: {
|
|
229
|
+
classPropertyName: "urlFor",
|
|
230
|
+
publicName: "urlFor",
|
|
231
|
+
isSignal: true,
|
|
232
|
+
isRequired: false,
|
|
233
|
+
transformFunction: null
|
|
234
|
+
},
|
|
217
235
|
title: {
|
|
218
236
|
classPropertyName: "title",
|
|
219
237
|
publicName: "title",
|
|
@@ -229,6 +247,7 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
229
247
|
transformFunction: null
|
|
230
248
|
}
|
|
231
249
|
},
|
|
250
|
+
outputs: { shared: "shared" },
|
|
232
251
|
host: { listeners: {
|
|
233
252
|
"document:keydown.escape": "onEscape()",
|
|
234
253
|
"document:click": "onDocumentClick($event)",
|
|
@@ -315,7 +334,7 @@ var ShareMenuComponent = class ShareMenuComponent {
|
|
|
315
334
|
<ui-toast />
|
|
316
335
|
`,
|
|
317
336
|
isInline: true,
|
|
318
|
-
styles: [":host{display:inline-block}.share-wrap{position:relative}.share-trigger{display:inline-flex;align-items:center;gap:.4rem;min-height:2.25rem;padding:.35rem .95rem;border:1px solid #d6d3d1;border-radius:9999px;background:#fff;color:#44403c;font-size:.875rem;font-weight:600;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-trigger:hover{border-color:#a8a29e;background:#fafaf9}.share-trigger[aria-expanded=true]{border-color:#78716c;background:#f5f5f4}.share-trigger:focus-visible,.share-tile:focus-visible{outline:2px solid var(--ui-share-accent, var(--primary, #2563eb));outline-offset:2px}@media(pointer:coarse){.share-trigger{min-height:2.75rem}}.share-panel{position:absolute;top:calc(100% + 8px);left:0;z-index:50;display:flex;align-items:flex-start;gap:4px;padding:14px 12px 10px;width:max-content;max-width:calc(100vw - 16px);overflow-x:auto;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid #e7e5e4;border-radius:16px;box-shadow:0 10px 30px #1c19172e}.share-tile{display:flex;flex-direction:column;align-items:center;gap:6px;flex:none;width:64px;padding:2px 0;border:0;background:none;border-radius:10px;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-icon{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:9999px;color:#fff;transition:transform .12s ease,box-shadow .12s ease}.share-tile:hover .share-icon{transform:translateY(-2px);box-shadow:0 4px 10px #1c191740}.share-name{font-size:.75rem;line-height:1.1;font-weight:500;color:#57534e;text-align:center}@media(max-width:480px){.share-panel{padding:12px 8px 8px;gap:2px}.share-tile{width:auto;min-width:48px;padding:2px 1px}.share-icon{width:44px;height:44px}.share-name{white-space:nowrap;font-size:.8125rem}}@media(prefers-reduced-motion:reduce){.share-icon{transition:none}.share-tile:hover .share-icon{transform:none}}\n"],
|
|
337
|
+
styles: [":host{display:inline-block}.share-wrap{position:relative}.share-trigger{display:inline-flex;align-items:center;gap:.4rem;min-height:2.25rem;padding:.35rem .95rem;border:1px solid #d6d3d1;border-radius:9999px;background:#fff;color:#44403c;font-size:.875rem;font-weight:600;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-trigger:hover{border-color:#a8a29e;background:#fafaf9}.share-trigger[aria-expanded=true]{border-color:#78716c;background:#f5f5f4}.share-trigger:focus-visible,.share-tile:focus-visible{outline:2px solid var(--ui-share-accent, var(--primary, #2563eb));outline-offset:2px}@media(pointer:coarse){.share-trigger{min-height:2.75rem}}.share-panel{position:absolute;top:calc(100% + 8px);left:0;z-index:50;display:flex;align-items:flex-start;gap:4px;padding:14px 12px 10px;flex-wrap:wrap;row-gap:8px;width:max-content;max-width:calc(100vw - 16px);overflow-x:auto;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid #e7e5e4;border-radius:16px;box-shadow:0 10px 30px #1c19172e}.share-tile{display:flex;flex-direction:column;align-items:center;gap:6px;flex:none;width:64px;padding:2px 0;border:0;background:none;border-radius:10px;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-icon{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:9999px;color:#fff;transition:transform .12s ease,box-shadow .12s ease}.share-tile:hover .share-icon{transform:translateY(-2px);box-shadow:0 4px 10px #1c191740}.share-name{font-size:.75rem;line-height:1.1;font-weight:500;color:#57534e;text-align:center}@media(max-width:480px){.share-panel{padding:12px 8px 8px;gap:2px}.share-tile{width:auto;min-width:48px;padding:2px 1px}.share-icon{width:44px;height:44px}.share-name{white-space:nowrap;font-size:.8125rem}}@media(max-width:360px){.share-panel{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 2px;width:calc(100vw - 16px)}.share-tile{min-width:0}}@media(prefers-reduced-motion:reduce){.share-icon{transition:none}.share-tile:hover .share-icon{transform:none}}\n"],
|
|
319
338
|
dependencies: [{
|
|
320
339
|
kind: "component",
|
|
321
340
|
type: ToastComponent,
|
|
@@ -418,7 +437,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
418
437
|
</div>
|
|
419
438
|
<ui-toast />
|
|
420
439
|
`,
|
|
421
|
-
styles: [":host{display:inline-block}.share-wrap{position:relative}.share-trigger{display:inline-flex;align-items:center;gap:.4rem;min-height:2.25rem;padding:.35rem .95rem;border:1px solid #d6d3d1;border-radius:9999px;background:#fff;color:#44403c;font-size:.875rem;font-weight:600;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-trigger:hover{border-color:#a8a29e;background:#fafaf9}.share-trigger[aria-expanded=true]{border-color:#78716c;background:#f5f5f4}.share-trigger:focus-visible,.share-tile:focus-visible{outline:2px solid var(--ui-share-accent, var(--primary, #2563eb));outline-offset:2px}@media(pointer:coarse){.share-trigger{min-height:2.75rem}}.share-panel{position:absolute;top:calc(100% + 8px);left:0;z-index:50;display:flex;align-items:flex-start;gap:4px;padding:14px 12px 10px;width:max-content;max-width:calc(100vw - 16px);overflow-x:auto;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid #e7e5e4;border-radius:16px;box-shadow:0 10px 30px #1c19172e}.share-tile{display:flex;flex-direction:column;align-items:center;gap:6px;flex:none;width:64px;padding:2px 0;border:0;background:none;border-radius:10px;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-icon{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:9999px;color:#fff;transition:transform .12s ease,box-shadow .12s ease}.share-tile:hover .share-icon{transform:translateY(-2px);box-shadow:0 4px 10px #1c191740}.share-name{font-size:.75rem;line-height:1.1;font-weight:500;color:#57534e;text-align:center}@media(max-width:480px){.share-panel{padding:12px 8px 8px;gap:2px}.share-tile{width:auto;min-width:48px;padding:2px 1px}.share-icon{width:44px;height:44px}.share-name{white-space:nowrap;font-size:.8125rem}}@media(prefers-reduced-motion:reduce){.share-icon{transition:none}.share-tile:hover .share-icon{transform:none}}\n"]
|
|
440
|
+
styles: [":host{display:inline-block}.share-wrap{position:relative}.share-trigger{display:inline-flex;align-items:center;gap:.4rem;min-height:2.25rem;padding:.35rem .95rem;border:1px solid #d6d3d1;border-radius:9999px;background:#fff;color:#44403c;font-size:.875rem;font-weight:600;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-trigger:hover{border-color:#a8a29e;background:#fafaf9}.share-trigger[aria-expanded=true]{border-color:#78716c;background:#f5f5f4}.share-trigger:focus-visible,.share-tile:focus-visible{outline:2px solid var(--ui-share-accent, var(--primary, #2563eb));outline-offset:2px}@media(pointer:coarse){.share-trigger{min-height:2.75rem}}.share-panel{position:absolute;top:calc(100% + 8px);left:0;z-index:50;display:flex;align-items:flex-start;gap:4px;padding:14px 12px 10px;flex-wrap:wrap;row-gap:8px;width:max-content;max-width:calc(100vw - 16px);overflow-x:auto;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid #e7e5e4;border-radius:16px;box-shadow:0 10px 30px #1c19172e}.share-tile{display:flex;flex-direction:column;align-items:center;gap:6px;flex:none;width:64px;padding:2px 0;border:0;background:none;border-radius:10px;font-family:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.share-icon{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:9999px;color:#fff;transition:transform .12s ease,box-shadow .12s ease}.share-tile:hover .share-icon{transform:translateY(-2px);box-shadow:0 4px 10px #1c191740}.share-name{font-size:.75rem;line-height:1.1;font-weight:500;color:#57534e;text-align:center}@media(max-width:480px){.share-panel{padding:12px 8px 8px;gap:2px}.share-tile{width:auto;min-width:48px;padding:2px 1px}.share-icon{width:44px;height:44px}.share-name{white-space:nowrap;font-size:.8125rem}}@media(max-width:360px){.share-panel{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 2px;width:calc(100vw - 16px)}.share-tile{min-width:0}}@media(prefers-reduced-motion:reduce){.share-icon{transition:none}.share-tile:hover .share-icon{transform:none}}\n"]
|
|
422
441
|
}]
|
|
423
442
|
}],
|
|
424
443
|
propDecorators: {
|
|
@@ -430,6 +449,18 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
430
449
|
required: true
|
|
431
450
|
}]
|
|
432
451
|
}],
|
|
452
|
+
urlFor: [{
|
|
453
|
+
type: i0.Input,
|
|
454
|
+
args: [{
|
|
455
|
+
isSignal: true,
|
|
456
|
+
alias: "urlFor",
|
|
457
|
+
required: false
|
|
458
|
+
}]
|
|
459
|
+
}],
|
|
460
|
+
shared: [{
|
|
461
|
+
type: i0.Output,
|
|
462
|
+
args: ["shared"]
|
|
463
|
+
}],
|
|
433
464
|
title: [{
|
|
434
465
|
type: i0.Input,
|
|
435
466
|
args: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-share-menu.mjs","names":[],"sources":["../../../projects/forgeroute-ui/share-menu/src/lib/share-menu/share-links.ts","../../../projects/forgeroute-ui/share-menu/src/lib/share-menu/share-menu.component.ts"],"sourcesContent":["/**\n * The links the public Share control builds. Pure functions so the component and its spec produce the exact same text.\n * Every value is URL-encoded, so a title holding `&`, `#`, quotes or non-ASCII text can never break out of its query parameter.\n */\nexport const facebookShareUrl = (url: string): string =>\n `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`;\n\nexport const xShareUrl = (url: string, text: string): string =>\n `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`;\n\nexport const linkedInShareUrl = (url: string): string =>\n `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`;\n\n/** Gmail's compose window (a new tab) with the subject and body filled in: for desktop visitors, who often have no mail app for `mailto:`. */\nexport const gmailShareUrl = (url: string, title: string): string =>\n `https://mail.google.com/mail/?view=cm&fs=1&su=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n\n/** Outlook.com's compose window (a new tab) with the subject and body filled in. */\nexport const outlookShareUrl = (url: string, title: string): string =>\n `https://outlook.live.com/mail/0/deeplink/compose?subject=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n\n/** `mailto:` with the title as the subject and the title plus the link as the body (encodeURIComponent, never `+` for spaces). */\nexport const emailShareUrl = (url: string, title: string): string =>\n `mailto:?subject=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n","import { ChangeDetectionStrategy, Component, ElementRef, Injector, afterNextRender, computed, inject, input, signal, viewChild } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ToastComponent as UiToastComponent } from '@forgeroute/ui/toast';\nimport { ToastService } from '@forgeroute/ui/core';\nimport { emailShareUrl, facebookShareUrl, gmailShareUrl, linkedInShareUrl, outlookShareUrl, xShareUrl } from './share-links';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nlet nextShareMenuId = 0;\n\nexport type ShareOption = 'native' | 'facebook' | 'x' | 'linkedin' | 'email' | 'gmail' | 'outlook' | 'copy';\n\ninterface ShareTile { value: ShareOption; label: string; background: string }\n\n/**\n * \"Share\" control for a public page (an obituary, a blog post, any shareable item). The button opens a floating panel (over the page, so nothing moves)\n * with one round icon per option and its name underneath, in a row like a phone's share sheet. Phones and tablets get Facebook, X,\n * LinkedIn, Email (their mail app), Copy link and \"More\" (the device's own share sheet). Desktops get Gmail and Outlook instead of Email:\n * a `mailto:` link does nothing on a computer without a mail app, while the webmail compose windows always open. \"Link copied\" is the library toast. The link is the public page\n * of the item (never an `?embed=true` widget URL). Theming: `--ui-share-accent` (focus ring and the Copy link tile; default the library `--primary`).\n *\n * <ui-share-menu [url]=\"pageUrl\" [title]=\"post.title\" label=\"blog post\" />\n */\n@Component({\n selector: 'ui-share-menu',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [UiToastComponent],\n // Escape closes from anywhere (Safari does not focus a button on click); a click or Tab outside closes too\n host: { '(document:keydown.escape)': 'onEscape()', '(document:click)': 'onDocumentClick($event)', '(focusout)': 'onFocusOut($event)' },\n template: `\n <div class=\"share-wrap\">\n <button\n #trigger\n type=\"button\"\n class=\"share-trigger\"\n data-testid=\"share-trigger\"\n [attr.aria-label]=\"labels.t('shareMenu.shareNamed', { name: label() })\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n (click)=\"toggle($event)\"\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"18\" cy=\"5\" r=\"3\"/><circle cx=\"6\" cy=\"12\" r=\"3\"/><circle cx=\"18\" cy=\"19\" r=\"3\"/>\n <line x1=\"8.59\" y1=\"13.51\" x2=\"15.42\" y2=\"17.49\"/><line x1=\"15.41\" y1=\"6.51\" x2=\"8.59\" y2=\"10.49\"/>\n </svg>{{ labels.t('common.share') }}</button>\n\n @if (open()) {\n <div\n #panel\n [id]=\"panelId\"\n class=\"share-panel\"\n role=\"group\"\n [attr.aria-label]=\"labels.t('shareMenu.shareOptions')\"\n data-testid=\"share-panel\"\n [style.transform]=\"'translateX(' + shiftX() + 'px)'\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n @for (tile of tiles(); track tile.value) {\n <button type=\"button\" class=\"share-tile\" [attr.data-testid]=\"'share-' + tile.value\" (click)=\"choose(tile.value)\">\n <span class=\"share-icon\" [style.background]=\"tile.background\" aria-hidden=\"true\">\n @switch (tile.value) {\n @case ('facebook') {\n <svg width=\"26\" height=\"26\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M13.5 21v-7.5h2.6l.4-3h-3V8.6c0-.9.3-1.5 1.6-1.5h1.5V4.4c-.3 0-1.2-.1-2.3-.1-2.3 0-3.8 1.4-3.8 3.9v2.3H8v3h2.5V21h3z\"/></svg>\n }\n @case ('x') {\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M17.8 3h3.1l-6.8 7.7L22 21h-6.2l-4.9-6.4L5.3 21H2.2l7.3-8.3L2 3h6.4l4.4 5.8L17.8 3zm-1.1 16.2h1.7L7.3 4.7H5.5l11.2 14.5z\"/></svg>\n }\n @case ('linkedin') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M6.9 8.9H3.6V20h3.3V8.9zM5.2 3.5a1.9 1.9 0 100 3.8 1.9 1.9 0 000-3.8zM20.4 13.4c0-3-1.6-4.7-4.1-4.7-1.2 0-2.2.6-2.7 1.4V8.9h-3.2V20h3.3v-6c0-1.4.7-2.4 1.9-2.4s1.5 1 1.5 2.4V20h3.3v-6.6z\"/></svg>\n }\n @case ('email') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('gmail') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('outlook') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('copy') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 007.1 0l3-3a5 5 0 00-7.1-7.1l-1.7 1.7\"/><path d=\"M14 11a5 5 0 00-7.1 0l-3 3A5 5 0 0011 21l1.7-1.7\"/></svg>\n }\n @case ('native') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><circle cx=\"5\" cy=\"12\" r=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><circle cx=\"19\" cy=\"12\" r=\"2\"/></svg>\n }\n }\n </span>\n <span class=\"share-name\">{{ tile.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n <ui-toast />\n `,\n styles: [`\n :host { display: inline-block; }\n .share-wrap { position: relative; }\n .share-trigger {\n display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0.35rem 0.95rem;\n border: 1px solid #d6d3d1; border-radius: 9999px; background: #fff; color: #44403c; font-size: 0.875rem; font-weight: 600;\n font-family: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;\n }\n .share-trigger:hover { border-color: #a8a29e; background: #fafaf9; }\n .share-trigger[aria-expanded='true'] { border-color: #78716c; background: #f5f5f4; }\n .share-trigger:focus-visible, .share-tile:focus-visible { outline: 2px solid var(--ui-share-accent, var(--primary, #2563eb)); outline-offset: 2px; }\n @media (pointer: coarse) { .share-trigger { min-height: 2.75rem; } }\n\n .share-panel {\n position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;\n display: flex; align-items: flex-start; gap: 4px; padding: 14px 12px 10px;\n width: max-content; max-width: calc(100vw - 16px); overflow-x: auto; -webkit-overflow-scrolling: touch;\n background: #fff; border: 1px solid #e7e5e4; border-radius: 16px; box-shadow: 0 10px 30px rgba(28, 25, 23, 0.18);\n }\n .share-tile {\n display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 64px; padding: 2px 0;\n border: 0; background: none; border-radius: 10px; font-family: inherit; cursor: pointer;\n touch-action: manipulation; -webkit-tap-highlight-color: transparent;\n }\n .share-icon {\n display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 9999px; color: #fff;\n transition: transform 120ms ease, box-shadow 120ms ease;\n }\n .share-tile:hover .share-icon { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(28, 25, 23, 0.25); }\n .share-name { font-size: 0.75rem; line-height: 1.1; font-weight: 500; color: #57534e; text-align: center; }\n @media (max-width: 480px) {\n /* A phone, or a narrow embedded frame: slightly smaller icons so all the options fit without scrolling the panel */\n .share-panel { padding: 12px 8px 8px; gap: 2px; }\n .share-tile { width: auto; min-width: 48px; padding: 2px 1px; }\n .share-icon { width: 44px; height: 44px; }\n .share-name { white-space: nowrap; font-size: 0.8125rem; }\n }\n @media (prefers-reduced-motion: reduce) { .share-icon { transition: none; } .share-tile:hover .share-icon { transform: none; } }\n `],\n})\nexport class ShareMenuComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The public page link to share. */\n readonly url = input.required<string>();\n /** The headline: the item's name or title (the X text, the email subject and the share-sheet title). */\n readonly title = input.required<string>();\n /** Used in the accessible name, e.g. \"obituary\" or \"blog post\" (→ \"Share obituary\"). */\n readonly labelInput = input<string | null>(null, { alias: 'label' });\n readonly label = computed(() => this.labelInput() ?? this.labels.t('shareMenu.label'));\n\n /** Unique id of the floating panel (several menus can be on one page). */\n protected readonly panelId = `ui-share-panel-${nextShareMenuId++}`;\n\n private readonly doc = inject(DOCUMENT);\n private readonly toast = inject(ToastService);\n private readonly injector = inject(Injector);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly trigger = viewChild<ElementRef<HTMLButtonElement>>('trigger');\n private readonly panel = viewChild<ElementRef<HTMLElement>>('panel');\n\n readonly open = signal(false);\n /** Pixels the panel is moved sideways so it never runs off either edge of the screen (or of the embedding frame). */\n readonly shiftX = signal(0);\n\n /**\n * \"More\" opens the device's own share sheet (Messages, AirDrop, Mail, WhatsApp…). It is offered on touch devices only: a desktop\n * browser has the other options already, and its share sheet is limited (or absent), so \"More\" there would look broken.\n */\n private readonly isTouchDevice = computed(() => this.doc.defaultView?.matchMedia?.('(pointer: coarse)').matches === true);\n private readonly canNativeShare = computed(() => typeof this.doc.defaultView?.navigator?.share === 'function' && this.isTouchDevice());\n\n readonly tiles = computed((): ShareTile[] => [\n { value: 'facebook', label: 'Facebook', background: '#1877f2' },\n { value: 'x', label: 'X', background: '#000000' },\n { value: 'linkedin', label: 'LinkedIn', background: '#0a66c2' },\n ...(this.isTouchDevice()\n ? [{ value: 'email' as const, label: this.labels.t('common.email'), background: '#78716c' }]\n : [{ value: 'gmail' as const, label: 'Gmail', background: '#ea4335' }, { value: 'outlook' as const, label: 'Outlook', background: '#0078d4' }]),\n { value: 'copy', label: this.labels.t('shareMenu.copyLink'), background: 'var(--ui-share-accent, var(--primary, #2563eb))' },\n ...(this.canNativeShare() ? [{ value: 'native' as const, label: this.labels.t('common.more'), background: '#57534e' }] : []),\n ]);\n\n /** The link each option opens (social sites in a new tab; the mail app in this window). */\n readonly links = computed(() => ({\n facebook: facebookShareUrl(this.url()),\n x: xShareUrl(this.url(), this.title()),\n linkedin: linkedInShareUrl(this.url()),\n email: emailShareUrl(this.url(), this.title()),\n gmail: gmailShareUrl(this.url(), this.title()),\n outlook: outlookShareUrl(this.url(), this.title()),\n }));\n\n toggle(event: Event) {\n event.stopPropagation();\n if (this.open()) this.close(); else this.show();\n }\n\n private show() {\n this.shiftX.set(0);\n this.open.set(true);\n // After the panel renders: keep it on screen, and put focus on the first option for keyboard users\n afterNextRender(() => {\n const panel = this.panel()?.nativeElement;\n if (!panel) return;\n const view = this.doc.documentElement.clientWidth;\n const rect = panel.getBoundingClientRect();\n const margin = 8;\n if (rect.right > view - margin) this.shiftX.set(Math.round(view - margin - rect.right));\n else if (rect.left < margin) this.shiftX.set(Math.round(margin - rect.left));\n if (this.doc.activeElement === this.trigger()?.nativeElement) panel.querySelector<HTMLElement>('button')?.focus();\n }, { injector: this.injector });\n }\n\n close(returnFocus = false) {\n if (!this.open()) return;\n this.open.set(false);\n if (returnFocus) this.trigger()?.nativeElement.focus();\n }\n\n onEscape() {\n if (!this.open()) return;\n const focusInside = this.host.nativeElement.contains(this.doc.activeElement);\n this.close(focusInside);\n }\n\n onDocumentClick(event: Event) {\n if (this.open() && !this.host.nativeElement.contains(event.target as Node)) this.close();\n }\n\n onFocusOut(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n if (this.open() && next && !this.host.nativeElement.contains(next)) this.close();\n }\n\n /** Left / Right / Home / End move between the options. */\n onPanelKeydown(event: KeyboardEvent) {\n const options = Array.from(this.panel()!.nativeElement.querySelectorAll<HTMLElement>('button'));\n const i = options.indexOf(this.doc.activeElement as HTMLElement);\n const to = event.key === 'ArrowRight' ? (i + 1) % options.length\n : event.key === 'ArrowLeft' ? (i - 1 + options.length) % options.length\n : event.key === 'Home' ? 0\n : event.key === 'End' ? options.length - 1\n : -1;\n if (to < 0) return;\n event.preventDefault();\n options[to].focus();\n }\n\n choose(option: ShareOption) {\n switch (option) {\n case 'native': void this.nativeShare(); break;\n case 'facebook': case 'x': case 'linkedin': case 'gmail': case 'outlook':\n this.doc.defaultView?.open(this.links()[option], '_blank', 'noopener,noreferrer');\n break;\n case 'email': this.email(); break;\n case 'copy': void this.copy(); break;\n }\n this.close(true);\n }\n\n private async nativeShare() {\n try {\n await this.doc.defaultView!.navigator.share({ title: this.title(), url: this.url() });\n } catch (err) {\n // The user closing the sheet is not an error; a browser that blocks it (an iframe without `allow=\"web-share\"`) leaves the other options.\n if ((err as DOMException)?.name !== 'AbortError') this.toast.error(this.labels.t('shareMenu.unavailable'));\n }\n }\n\n /** Phones and tablets: opens the device's mail app with the subject and body filled in. */\n private email() {\n const link = this.doc.createElement('a');\n link.href = this.links().email;\n link.rel = 'noopener noreferrer';\n link.click();\n }\n\n private async copy() {\n const url = this.url();\n try {\n await this.doc.defaultView!.navigator.clipboard.writeText(url);\n this.toast.show(this.labels.t('shareMenu.linkCopied'));\n return;\n } catch { /* blocked (insecure context, or an iframe without clipboard-write): try the legacy path */ }\n if (this.legacyCopy(url)) { this.toast.show(this.labels.t('shareMenu.linkCopied')); return; }\n // Nothing can copy: show the link in the browser's own dialog, selected, so it can still be copied by hand.\n this.doc.defaultView?.prompt(this.labels.t('shareMenu.copyThisLink'), url);\n }\n\n private legacyCopy(text: string): boolean {\n const textarea = this.doc.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n this.doc.body.appendChild(textarea);\n try {\n textarea.select();\n textarea.setSelectionRange(0, text.length);\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n textarea.remove();\n }\n }\n}\n"],"mappings":";;;;;AAIA,MAAa,oBAAoB,QAC/B,gDAAgD,mBAAmB,GAAG;AAExE,MAAa,aAAa,KAAa,SACrC,wCAAwC,mBAAmB,GAAG,EAAC,QAAS,mBAAmB,IAAI;AAEjG,MAAa,oBAAoB,QAC/B,uDAAuD,mBAAmB,GAAG;AAG/E,MAAa,iBAAiB,KAAa,UACzC,iDAAiD,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AAG5H,MAAa,mBAAmB,KAAa,UAC3C,4DAA4D,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AAGvI,MAAa,iBAAiB,KAAa,UACzC,mBAAmB,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AChB9F,IAAI,kBAAkB;AAgItB,IAAa,qBAAb,MAAa,mBAAkB;CAjH/B,cAAA;EAkHqB,KAAA,SAAS,OAAO,eAAe;EAEzC,KAAA,MAAM,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;EAE9B,KAAA,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAA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],"sources":["../../../projects/forgeroute-ui/share-menu/src/lib/share-menu/share-links.ts","../../../projects/forgeroute-ui/share-menu/src/lib/share-menu/share-menu.component.ts"],"sourcesContent":["/**\n * The links the public Share control builds. Pure functions so the component and its spec produce the exact same text.\n * Every value is URL-encoded, so a title holding `&`, `#`, quotes or non-ASCII text can never break out of its query parameter.\n */\nexport const facebookShareUrl = (url: string): string =>\n `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`;\n\nexport const xShareUrl = (url: string, text: string): string =>\n `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`;\n\nexport const linkedInShareUrl = (url: string): string =>\n `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`;\n\n/** Gmail's compose window (a new tab) with the subject and body filled in: for desktop visitors, who often have no mail app for `mailto:`. */\nexport const gmailShareUrl = (url: string, title: string): string =>\n `https://mail.google.com/mail/?view=cm&fs=1&su=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n\n/** Outlook.com's compose window (a new tab) with the subject and body filled in. */\nexport const outlookShareUrl = (url: string, title: string): string =>\n `https://outlook.live.com/mail/0/deeplink/compose?subject=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n\n/** `mailto:` with the title as the subject and the title plus the link as the body (encodeURIComponent, never `+` for spaces). */\nexport const emailShareUrl = (url: string, title: string): string =>\n `mailto:?subject=${encodeURIComponent(title)}&body=${encodeURIComponent(`${title}\\n\\n${url}`)}`;\n","import { ChangeDetectionStrategy, Component, ElementRef, Injector, afterNextRender, computed, inject, input, output, signal, viewChild } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ToastComponent as UiToastComponent } from '@forgeroute/ui/toast';\nimport { ToastService } from '@forgeroute/ui/core';\nimport { emailShareUrl, facebookShareUrl, gmailShareUrl, linkedInShareUrl, outlookShareUrl, xShareUrl } from './share-links';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nlet nextShareMenuId = 0;\n\nexport type ShareOption = 'native' | 'facebook' | 'x' | 'linkedin' | 'email' | 'gmail' | 'outlook' | 'copy';\n\ninterface ShareTile { value: ShareOption; label: string; background: string }\n\n/**\n * \"Share\" control for a public page (an obituary, a blog post, any shareable item). The button opens a floating panel (over the page, so nothing moves)\n * with one round icon per option and its name underneath, in a row like a phone's share sheet (on a screen narrower than the row the tiles wrap onto a second row; at 360px and below they are two even rows of three, always inside the screen). Phones and tablets get Facebook, X,\n * LinkedIn, Email (their mail app), Copy link and \"More\" (the device's own share sheet). Desktops get Gmail and Outlook instead of Email:\n * a `mailto:` link does nothing on a computer without a mail app, while the webmail compose windows always open. \"Link copied\" is the library toast. The link is the public page\n * of the item (never an `?embed=true` widget URL). Theming: `--ui-share-accent` (focus ring and the Copy link tile; default the library `--primary`).\n *\n * <ui-share-menu [url]=\"pageUrl\" [title]=\"post.title\" label=\"blog post\" />\n */\n@Component({\n selector: 'ui-share-menu',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [UiToastComponent],\n // Escape closes from anywhere (Safari does not focus a button on click); a click or Tab outside closes too\n host: { '(document:keydown.escape)': 'onEscape()', '(document:click)': 'onDocumentClick($event)', '(focusout)': 'onFocusOut($event)' },\n template: `\n <div class=\"share-wrap\">\n <button\n #trigger\n type=\"button\"\n class=\"share-trigger\"\n data-testid=\"share-trigger\"\n [attr.aria-label]=\"labels.t('shareMenu.shareNamed', { name: label() })\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? panelId : null\"\n (click)=\"toggle($event)\"\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"18\" cy=\"5\" r=\"3\"/><circle cx=\"6\" cy=\"12\" r=\"3\"/><circle cx=\"18\" cy=\"19\" r=\"3\"/>\n <line x1=\"8.59\" y1=\"13.51\" x2=\"15.42\" y2=\"17.49\"/><line x1=\"15.41\" y1=\"6.51\" x2=\"8.59\" y2=\"10.49\"/>\n </svg>{{ labels.t('common.share') }}</button>\n\n @if (open()) {\n <div\n #panel\n [id]=\"panelId\"\n class=\"share-panel\"\n role=\"group\"\n [attr.aria-label]=\"labels.t('shareMenu.shareOptions')\"\n data-testid=\"share-panel\"\n [style.transform]=\"'translateX(' + shiftX() + 'px)'\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n @for (tile of tiles(); track tile.value) {\n <button type=\"button\" class=\"share-tile\" [attr.data-testid]=\"'share-' + tile.value\" (click)=\"choose(tile.value)\">\n <span class=\"share-icon\" [style.background]=\"tile.background\" aria-hidden=\"true\">\n @switch (tile.value) {\n @case ('facebook') {\n <svg width=\"26\" height=\"26\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M13.5 21v-7.5h2.6l.4-3h-3V8.6c0-.9.3-1.5 1.6-1.5h1.5V4.4c-.3 0-1.2-.1-2.3-.1-2.3 0-3.8 1.4-3.8 3.9v2.3H8v3h2.5V21h3z\"/></svg>\n }\n @case ('x') {\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M17.8 3h3.1l-6.8 7.7L22 21h-6.2l-4.9-6.4L5.3 21H2.2l7.3-8.3L2 3h6.4l4.4 5.8L17.8 3zm-1.1 16.2h1.7L7.3 4.7H5.5l11.2 14.5z\"/></svg>\n }\n @case ('linkedin') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M6.9 8.9H3.6V20h3.3V8.9zM5.2 3.5a1.9 1.9 0 100 3.8 1.9 1.9 0 000-3.8zM20.4 13.4c0-3-1.6-4.7-4.1-4.7-1.2 0-2.2.6-2.7 1.4V8.9h-3.2V20h3.3v-6c0-1.4.7-2.4 1.9-2.4s1.5 1 1.5 2.4V20h3.3v-6.6z\"/></svg>\n }\n @case ('email') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('gmail') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('outlook') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 7l9 6 9-6\"/></svg>\n }\n @case ('copy') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 007.1 0l3-3a5 5 0 00-7.1-7.1l-1.7 1.7\"/><path d=\"M14 11a5 5 0 00-7.1 0l-3 3A5 5 0 0011 21l1.7-1.7\"/></svg>\n }\n @case ('native') {\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><circle cx=\"5\" cy=\"12\" r=\"2\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/><circle cx=\"19\" cy=\"12\" r=\"2\"/></svg>\n }\n }\n </span>\n <span class=\"share-name\">{{ tile.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n <ui-toast />\n `,\n styles: [`\n :host { display: inline-block; }\n .share-wrap { position: relative; }\n .share-trigger {\n display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0.35rem 0.95rem;\n border: 1px solid #d6d3d1; border-radius: 9999px; background: #fff; color: #44403c; font-size: 0.875rem; font-weight: 600;\n font-family: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;\n }\n .share-trigger:hover { border-color: #a8a29e; background: #fafaf9; }\n .share-trigger[aria-expanded='true'] { border-color: #78716c; background: #f5f5f4; }\n .share-trigger:focus-visible, .share-tile:focus-visible { outline: 2px solid var(--ui-share-accent, var(--primary, #2563eb)); outline-offset: 2px; }\n @media (pointer: coarse) { .share-trigger { min-height: 2.75rem; } }\n\n .share-panel {\n position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;\n display: flex; align-items: flex-start; gap: 4px; padding: 14px 12px 10px;\n /* Tiles wrap onto a second row when the screen is narrower than one row, so the panel never scrolls sideways or runs off the screen */\n flex-wrap: wrap; row-gap: 8px;\n width: max-content; max-width: calc(100vw - 16px); overflow-x: auto; -webkit-overflow-scrolling: touch;\n background: #fff; border: 1px solid #e7e5e4; border-radius: 16px; box-shadow: 0 10px 30px rgba(28, 25, 23, 0.18);\n }\n .share-tile {\n display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 64px; padding: 2px 0;\n border: 0; background: none; border-radius: 10px; font-family: inherit; cursor: pointer;\n touch-action: manipulation; -webkit-tap-highlight-color: transparent;\n }\n .share-icon {\n display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 9999px; color: #fff;\n transition: transform 120ms ease, box-shadow 120ms ease;\n }\n .share-tile:hover .share-icon { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(28, 25, 23, 0.25); }\n .share-name { font-size: 0.75rem; line-height: 1.1; font-weight: 500; color: #57534e; text-align: center; }\n @media (max-width: 480px) {\n /* A phone, or a narrow embedded frame: slightly smaller icons so all the options fit without scrolling the panel */\n .share-panel { padding: 12px 8px 8px; gap: 2px; }\n .share-tile { width: auto; min-width: 48px; padding: 2px 1px; }\n .share-icon { width: 44px; height: 44px; }\n .share-name { white-space: nowrap; font-size: 0.8125rem; }\n }\n @media (max-width: 360px) {\n /* A very narrow screen (320px phones, narrow frames): two even rows of three tiles inside the screen, never wider than it */\n .share-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 2px; width: calc(100vw - 16px); }\n .share-tile { min-width: 0; }\n }\n @media (prefers-reduced-motion: reduce) { .share-icon { transition: none; } .share-tile:hover .share-icon { transform: none; } }\n `],\n})\nexport class ShareMenuComponent {\n protected readonly labels = inject(UiLabelsService);\n /** The public page link to share. */\n readonly url = input.required<string>();\n /**\n * Optional: a link of its own for each option (e.g. the same page with `&via=facebook`), so an app can tell which option a visitor came from. When set, Facebook, X,\n * LinkedIn, Gmail / Outlook / Email, Copy link and More each share `urlFor(option)`; when not set every option shares `url`.\n */\n readonly urlFor = input<((option: ShareOption) => string) | null>(null);\n /** Fires when a visitor picks an option (before the option's own action; a copy that later fails still counts as picked). */\n readonly shared = output<ShareOption>();\n /** The headline: the item's name or title (the X text, the email subject and the share-sheet title). */\n readonly title = input.required<string>();\n /** Used in the accessible name, e.g. \"obituary\" or \"blog post\" (→ \"Share obituary\"). */\n readonly labelInput = input<string | null>(null, { alias: 'label' });\n readonly label = computed(() => this.labelInput() ?? this.labels.t('shareMenu.label'));\n\n /** Unique id of the floating panel (several menus can be on one page). */\n protected readonly panelId = `ui-share-panel-${nextShareMenuId++}`;\n\n private readonly doc = inject(DOCUMENT);\n private readonly toast = inject(ToastService);\n private readonly injector = inject(Injector);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly trigger = viewChild<ElementRef<HTMLButtonElement>>('trigger');\n private readonly panel = viewChild<ElementRef<HTMLElement>>('panel');\n\n readonly open = signal(false);\n /** Pixels the panel is moved sideways so it never runs off either edge of the screen (or of the embedding frame). */\n readonly shiftX = signal(0);\n\n /**\n * \"More\" opens the device's own share sheet (Messages, AirDrop, Mail, WhatsApp…). It is offered on touch devices only: a desktop\n * browser has the other options already, and its share sheet is limited (or absent), so \"More\" there would look broken.\n */\n private readonly isTouchDevice = computed(() => this.doc.defaultView?.matchMedia?.('(pointer: coarse)').matches === true);\n private readonly canNativeShare = computed(() => typeof this.doc.defaultView?.navigator?.share === 'function' && this.isTouchDevice());\n\n readonly tiles = computed((): ShareTile[] => [\n { value: 'facebook', label: 'Facebook', background: '#1877f2' },\n { value: 'x', label: 'X', background: '#000000' },\n { value: 'linkedin', label: 'LinkedIn', background: '#0a66c2' },\n ...(this.isTouchDevice()\n ? [{ value: 'email' as const, label: this.labels.t('common.email'), background: '#78716c' }]\n : [{ value: 'gmail' as const, label: 'Gmail', background: '#ea4335' }, { value: 'outlook' as const, label: 'Outlook', background: '#0078d4' }]),\n { value: 'copy', label: this.labels.t('shareMenu.copyLink'), background: 'var(--ui-share-accent, var(--primary, #2563eb))' },\n ...(this.canNativeShare() ? [{ value: 'native' as const, label: this.labels.t('common.more'), background: '#57534e' }] : []),\n ]);\n\n\n toggle(event: Event) {\n event.stopPropagation();\n if (this.open()) this.close(); else this.show();\n }\n\n private show() {\n this.shiftX.set(0);\n this.open.set(true);\n // After the panel renders: keep it on screen, and put focus on the first option for keyboard users\n afterNextRender(() => {\n const panel = this.panel()?.nativeElement;\n if (!panel) return;\n const view = this.doc.documentElement.clientWidth;\n const rect = panel.getBoundingClientRect();\n const margin = 8;\n if (rect.right > view - margin) this.shiftX.set(Math.round(view - margin - rect.right));\n else if (rect.left < margin) this.shiftX.set(Math.round(margin - rect.left));\n if (this.doc.activeElement === this.trigger()?.nativeElement) panel.querySelector<HTMLElement>('button')?.focus();\n }, { injector: this.injector });\n }\n\n close(returnFocus = false) {\n if (!this.open()) return;\n this.open.set(false);\n if (returnFocus) this.trigger()?.nativeElement.focus();\n }\n\n onEscape() {\n if (!this.open()) return;\n const focusInside = this.host.nativeElement.contains(this.doc.activeElement);\n this.close(focusInside);\n }\n\n onDocumentClick(event: Event) {\n if (this.open() && !this.host.nativeElement.contains(event.target as Node)) this.close();\n }\n\n onFocusOut(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n if (this.open() && next && !this.host.nativeElement.contains(next)) this.close();\n }\n\n /** Left / Right / Home / End move between the options. */\n onPanelKeydown(event: KeyboardEvent) {\n const options = Array.from(this.panel()!.nativeElement.querySelectorAll<HTMLElement>('button'));\n const i = options.indexOf(this.doc.activeElement as HTMLElement);\n const to = event.key === 'ArrowRight' ? (i + 1) % options.length\n : event.key === 'ArrowLeft' ? (i - 1 + options.length) % options.length\n : event.key === 'Home' ? 0\n : event.key === 'End' ? options.length - 1\n : -1;\n if (to < 0) return;\n event.preventDefault();\n options[to].focus();\n }\n\n /** The link an option shares: its own `urlFor(option)` when the app gave one, else `url`. */\n private urlOf(option: ShareOption): string {\n const make = this.urlFor();\n return make ? make(option) : this.url();\n }\n\n /** The address of a social / webmail / mail-app option, built from the link that option shares. */\n private linkFor(option: 'facebook' | 'x' | 'linkedin' | 'email' | 'gmail' | 'outlook'): string {\n const url = this.urlOf(option);\n const title = this.title();\n switch (option) {\n case 'facebook': return facebookShareUrl(url);\n case 'x': return xShareUrl(url, title);\n case 'linkedin': return linkedInShareUrl(url);\n case 'email': return emailShareUrl(url, title);\n case 'gmail': return gmailShareUrl(url, title);\n case 'outlook': return outlookShareUrl(url, title);\n }\n }\n\n choose(option: ShareOption) {\n this.shared.emit(option);\n switch (option) {\n case 'native': void this.nativeShare(); break;\n case 'facebook': case 'x': case 'linkedin': case 'gmail': case 'outlook':\n this.doc.defaultView?.open(this.linkFor(option), '_blank', 'noopener,noreferrer');\n break;\n case 'email': this.email(); break;\n case 'copy': void this.copy(); break;\n }\n this.close(true);\n }\n\n private async nativeShare() {\n try {\n await this.doc.defaultView!.navigator.share({ title: this.title(), url: this.urlOf('native') });\n } catch (err) {\n // The user closing the sheet is not an error; a browser that blocks it (an iframe without `allow=\"web-share\"`) leaves the other options.\n if ((err as DOMException)?.name !== 'AbortError') this.toast.error(this.labels.t('shareMenu.unavailable'));\n }\n }\n\n /** Phones and tablets: opens the device's mail app with the subject and body filled in. */\n private email() {\n const link = this.doc.createElement('a');\n link.href = this.linkFor('email');\n link.rel = 'noopener noreferrer';\n link.click();\n }\n\n private async copy() {\n const url = this.urlOf('copy');\n try {\n await this.doc.defaultView!.navigator.clipboard.writeText(url);\n this.toast.show(this.labels.t('shareMenu.linkCopied'));\n return;\n } catch { /* blocked (insecure context, or an iframe without clipboard-write): try the legacy path */ }\n if (this.legacyCopy(url)) { this.toast.show(this.labels.t('shareMenu.linkCopied')); return; }\n // Nothing can copy: show the link in the browser's own dialog, selected, so it can still be copied by hand.\n this.doc.defaultView?.prompt(this.labels.t('shareMenu.copyThisLink'), url);\n }\n\n private legacyCopy(text: string): boolean {\n const textarea = this.doc.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n this.doc.body.appendChild(textarea);\n try {\n textarea.select();\n textarea.setSelectionRange(0, text.length);\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n textarea.remove();\n }\n }\n}\n"],"mappings":";;;;;AAIA,MAAa,oBAAoB,QAC/B,gDAAgD,mBAAmB,GAAG;AAExE,MAAa,aAAa,KAAa,SACrC,wCAAwC,mBAAmB,GAAG,EAAC,QAAS,mBAAmB,IAAI;AAEjG,MAAa,oBAAoB,QAC/B,uDAAuD,mBAAmB,GAAG;AAG/E,MAAa,iBAAiB,KAAa,UACzC,iDAAiD,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AAG5H,MAAa,mBAAmB,KAAa,UAC3C,4DAA4D,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AAGvI,MAAa,iBAAiB,KAAa,UACzC,mBAAmB,mBAAmB,KAAK,EAAC,QAAS,mBAAmB,GAAG,MAAK,MAAO,KAAK;AChB9F,IAAI,kBAAkB;AAuItB,IAAa,qBAAb,MAAa,mBAAkB;CAxH/B,cAAA;EAyHqB,KAAA,SAAS,OAAO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