|
|
|
|
@ -17,7 +17,7 @@ import { ALERT_DIALOG_LANGS } from './langs';
|
|
|
|
|
* differently, and they wire `onclick` to close the dialog.
|
|
|
|
|
*/
|
|
|
|
|
import { alertDialogMorfo } from '../../../morfo/components/alert-dialog';
|
|
|
|
|
import type { SomaRuntimePart } from '../../runtime.svelte';
|
|
|
|
|
import type { SomaRuntime, SomaRuntimePart } from '../../runtime.svelte';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ── Action button (primary / destructive) ─────────────────────────────────
|
|
|
|
|
@ -33,22 +33,28 @@ export class AlertDialogActionProvider {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly dialog: DialogProvider;
|
|
|
|
|
readonly soma = Soma.get();
|
|
|
|
|
readonly soma: Soma;
|
|
|
|
|
readonly runtime: SomaRuntime;
|
|
|
|
|
|
|
|
|
|
private constructor(opts: AlertDialogActionOpts) {
|
|
|
|
|
this.opts = opts;
|
|
|
|
|
this.dialog = DialogProvider.require();
|
|
|
|
|
this.runtimePart = Soma.require()
|
|
|
|
|
.runtime(alertDialogMorfo, {
|
|
|
|
|
this.soma = Soma.require();
|
|
|
|
|
this.runtime = this.soma.runtime(alertDialogMorfo, {
|
|
|
|
|
props: {
|
|
|
|
|
ariaLabel: () => this.resolvedAriaLabel
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.part('action', { id: opts.id, ref: opts.ref, owner: this, syncAttrs: true });
|
|
|
|
|
});
|
|
|
|
|
this.runtimePart = this.runtime.part('action', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this,
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly resolvedAriaLabel = $derived.by(
|
|
|
|
|
() => this.opts.ariaLabel.current || this.soma?.langs.ts(ALERT_DIALOG_LANGS.ACTION)
|
|
|
|
|
() => this.opts.ariaLabel.current || this.soma.langs.ts(ALERT_DIALOG_LANGS.ACTION)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
readonly onclick = (_e: SomaMouseEvent<HTMLButtonElement>) => {
|
|
|
|
|
@ -76,22 +82,28 @@ export class AlertDialogCancelProvider {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly dialog: DialogProvider;
|
|
|
|
|
readonly soma = Soma.get();
|
|
|
|
|
readonly soma: Soma;
|
|
|
|
|
readonly runtime: SomaRuntime;
|
|
|
|
|
|
|
|
|
|
private constructor(opts: AlertDialogCancelOpts) {
|
|
|
|
|
this.opts = opts;
|
|
|
|
|
this.dialog = DialogProvider.require();
|
|
|
|
|
this.runtimePart = Soma.require()
|
|
|
|
|
.runtime(alertDialogMorfo, {
|
|
|
|
|
this.soma = Soma.require();
|
|
|
|
|
this.runtime = this.soma.runtime(alertDialogMorfo, {
|
|
|
|
|
props: {
|
|
|
|
|
ariaLabel: () => this.resolvedAriaLabel
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.part('cancel', { id: opts.id, ref: opts.ref, owner: this, syncAttrs: true });
|
|
|
|
|
});
|
|
|
|
|
this.runtimePart = this.runtime.part('cancel', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this,
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly resolvedAriaLabel = $derived.by(
|
|
|
|
|
() => this.opts.ariaLabel.current || this.soma?.langs.ts(ALERT_DIALOG_LANGS.CANCEL)
|
|
|
|
|
() => this.opts.ariaLabel.current || this.soma.langs.ts(ALERT_DIALOG_LANGS.CANCEL)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
readonly onclick = (_e: SomaMouseEvent<HTMLButtonElement>) => {
|
|
|
|
|
|