@blackcube/aurelia-kit 1.0.0-rc1 → 1.0.0-rc2

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/README.md CHANGED
@@ -12,7 +12,7 @@ widgets, styled with Tailwind classes written in the PHP markup. The HTTP layer
12
12
  npm install @blackcube/aurelia-kit @blackcube/aurelia-api
13
13
  ```
14
14
 
15
- Peer dependencies: `aurelia` `^2.0.0-rc.2`, `@blackcube/aurelia-api` `^1.0.0`.
15
+ Peer dependencies: `aurelia` `^2.0.0-rc.2`, `@blackcube/aurelia-api` `^1.0.0-rc1`.
16
16
 
17
17
  The package is ESM only (`dist/index.es.js`, built by Vite in library mode); the application bundler resolves it.
18
18
 
@@ -101,6 +101,7 @@ sends. Its template holds no markup of its own:
101
101
  <au-slot name="loader" if.bind="loading"><progress></progress></au-slot>
102
102
  <template else>
103
103
  <au-compose if.bind="contentView" template.bind="contentView"></au-compose>
104
+ <au-slot else></au-slot>
104
105
  </template>
105
106
  </dialog>
106
107
  ```
@@ -140,12 +141,17 @@ Behavior:
140
141
  - `content` is the whole HTML of the dialog (frame, header, body, footer), rendered by the server; it becomes the
141
142
  view of the `au-compose`, so the `bleet-*` attributes it holds work. A response without `content` keeps the
142
143
  current view.
144
+ - `Open` (or `Toggle` when closed) with a `content` and no `url`: that HTML is shown as the server's would be, without
145
+ request (the same view, its `bleet-*` attributes, its forms posted by the element) — a page that already holds the
146
+ HTML (a confirmation, a `<template>` of the page).
143
147
  - A `<form>` submitted inside the dialog is posted by the element (multipart, method from `_method` or the form,
144
148
  POST by default, with the clicked submit button `name` / `value`); its `IDialogResponse` is applied the same way.
145
149
  - A `<form>` marked `data-dialog="native"` is not intercepted: the browser submits it (download, plain post).
146
150
  - A click on an element inside `[data-dialog="close"]`, the Escape key, or a click on the overlay closes the dialog
147
151
  with the hide transition; closing empties the view. A `cancel` coming from an `<input type="file">` (file chooser
148
152
  dismissed) does not close it. An `Open` received while the dialog is closing cancels the closing.
153
+ - Escape while a menu of the dialog is open (`[aria-expanded="true"]`: `bleet-dropdown`, `bleet-profile`) closes
154
+ that menu, not the dialog.
149
155
  - Statuses `Opening`, `Opened`, `Closing`, `Closed` (with the `id`) on `Channels.ModalStatus`.
150
156
 
151
157
  ```typescript
@@ -163,6 +169,28 @@ interface IDialogResponse {
163
169
 
164
170
  PHP side, `AureliaCommunication::dialogContent($content, $color)` builds the `content` / `color` part of it.
165
171
 
172
+ **In a SPA**, the content is the application's: its frame and its view go in the default slot of `<bleet-dialog>`,
173
+ written once in the shell, and the dialog is opened without `url`:
174
+
175
+ ```html
176
+ <bleet-dialog id="drawer"
177
+ data-dialog-class="… translate-x-full"
178
+ data-dialog-show="translate-x-0"
179
+ data-dialog-hide="translate-x-full">
180
+ <header …>${$host.title} <button type="button" data-dialog="close">…</button></header>
181
+ <au-viewport name="drawer"></au-viewport>
182
+ </bleet-dialog>
183
+ ```
184
+
185
+ ```typescript
186
+ resolve(IEventAggregator).publish(Channels.Modal, <IModal>{ action: ModalAction.Open, id: 'drawer', title: 'Edit user', color: UiColor.Primary });
187
+ ```
188
+
189
+ - `Open` (or `Toggle` when closed) with neither `url` nor `content` opens the dialog on its default slot; its `title`
190
+ and `color` are kept on the element for the frame (`$host.title`, `$host.color`) until it is closed.
191
+ - A form of the default slot is not posted by the element: it belongs to the page that projects it.
192
+ - `ModalStatus.Closed` with the `id` tells the page the dialog is closed (its route can be left).
193
+
166
194
  ## Ajaxify
167
195
 
168
196
  ### `<bleet-ajaxify>`
@@ -538,6 +566,17 @@ Behavior:
538
566
  is selected, the `count` template text beyond.
539
567
  - The panel does not open while the native select is disabled.
540
568
 
569
+ ### `bleet-focus`
570
+
571
+ An element that takes the focus as it appears — a field or a message shown later (a condition of the page, a fragment
572
+ loaded by ajaxify):
573
+
574
+ ```html
575
+ <input bleet-focus …>
576
+ ```
577
+
578
+ When attached, the element is focused on the next frame; the browser brings it into view.
579
+
541
580
  ## Upload channel
542
581
 
543
582
  `Channels.Upload` carries `IUpload` (`{ action: UploadAction.Reset, id?: string }`) for the upload bridges
package/dist/index.es.js CHANGED
@@ -3627,26 +3627,178 @@ var Hr = l("bleet-overlay"), Ur, Wr;
3627
3627
  }
3628
3628
  });
3629
3629
  //#endregion
3630
+ //#region src/attributes/focus.ts
3631
+ function Gr(e, t) {
3632
+ if (typeof e != "object" || !e) return e;
3633
+ var n = e[Symbol.toPrimitive];
3634
+ if (n !== void 0) {
3635
+ var r = n.call(e, t || "default");
3636
+ if (typeof r != "object") return r;
3637
+ throw TypeError("@@toPrimitive must return a primitive value.");
3638
+ }
3639
+ return (t === "string" ? String : Number)(e);
3640
+ }
3641
+ function Kr(e) {
3642
+ var t = Gr(e, "string");
3643
+ return typeof t == "symbol" ? t : String(t);
3644
+ }
3645
+ function qr(e) {
3646
+ if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
3647
+ return e;
3648
+ }
3649
+ function Jr(e, t, n) {
3650
+ typeof t == "symbol" && (t = t.description, t = t ? "[" + t + "]" : "");
3651
+ try {
3652
+ Object.defineProperty(e, "name", {
3653
+ configurable: !0,
3654
+ value: n ? n + " " + t : t
3655
+ });
3656
+ } catch {}
3657
+ return e;
3658
+ }
3659
+ function Yr(e, t, n, r, i, a) {
3660
+ var o = Symbol.metadata || Symbol.for("Symbol.metadata"), s = Object.defineProperty, c = Object.create, l, u = [c(null), c(null)], d = t.length, f;
3661
+ function p(t, n, r) {
3662
+ return function(i, a) {
3663
+ n && (a = i, i = e);
3664
+ for (var o = 0; o < t.length; o++) a = t[o].apply(i, r ? [a] : []);
3665
+ return r ? a : i;
3666
+ };
3667
+ }
3668
+ function m(e, t, n, r) {
3669
+ if (typeof e != "function" && (r || e !== void 0)) throw TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
3670
+ return e;
3671
+ }
3672
+ function h(e, t, n, r, i, a, o, c, d, h, g) {
3673
+ function _(e) {
3674
+ if (!g(e)) throw TypeError("Attempted to access private element on non-instance");
3675
+ }
3676
+ var v = [].concat(t[0]), y = t[3], b = !o, x = i === 1, S = i === 3, C = i === 4, w = i === 2;
3677
+ function T(t, n, r) {
3678
+ return function(i, a) {
3679
+ return n && (a = i, i = e), r && r(i), desc[t].call(i, a);
3680
+ };
3681
+ }
3682
+ var E = {}, D = [], O = S ? "get" : C || x ? "set" : "value";
3683
+ if (!b && (d ? (h || x ? E = {
3684
+ get: Jr(function() {
3685
+ return y(this);
3686
+ }, r, "get"),
3687
+ set: function(e) {
3688
+ t[4](this, e);
3689
+ }
3690
+ } : E[O] = y, h || Jr(E[O], r, w ? "" : O)) : h || (E = Object.getOwnPropertyDescriptor(e, r)), !h && !d)) {
3691
+ if (f = u[+c][r], f && (f ^ i) !== 7) throw Error("Decorating two elements with the same name (" + E[O].name + ") is not supported yet");
3692
+ u[+c][r] = i < 3 ? 1 : i;
3693
+ }
3694
+ for (var k = e, A = v.length - 1; A >= 0; A -= n ? 2 : 1) {
3695
+ var j = m(v[A], "A decorator", "be", !0), M = n ? v[A - 1] : void 0, N = {}, P = {
3696
+ kind: [
3697
+ "field",
3698
+ "accessor",
3699
+ "method",
3700
+ "getter",
3701
+ "setter",
3702
+ "class"
3703
+ ][i],
3704
+ name: r,
3705
+ metadata: l,
3706
+ addInitializer: (function(e, t) {
3707
+ if (e.v) throw TypeError("attempted to call addInitializer after decoration was finished");
3708
+ m(t, "An initializer", "be", !0), a.push(t);
3709
+ }).bind(null, N)
3710
+ };
3711
+ if (b) f = j.call(M, k, P), N.v = 1, m(f, "class decorators", "return") && (k = f);
3712
+ else if (P.static = c, P.private = d, f = P.access = { has: d ? g.bind() : function(e) {
3713
+ return r in e;
3714
+ } }, C || (f.get = d ? w ? function(e) {
3715
+ return _(e), E.value;
3716
+ } : T("get", 0, _) : function(e) {
3717
+ return e[r];
3718
+ }), !w && !S && (f.set = d ? T("set", 0, _) : function(e, t) {
3719
+ e[r] = t;
3720
+ }), k = j.call(M, x ? {
3721
+ get: E.get,
3722
+ set: E.set
3723
+ } : E[O], P), N.v = 1, x) {
3724
+ if (typeof k == "object" && k) (f = m(k.get, "accessor.get")) && (E.get = f), (f = m(k.set, "accessor.set")) && (E.set = f), (f = m(k.init, "accessor.init")) && D.unshift(f);
3725
+ else if (k !== void 0) throw TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
3726
+ } else m(k, (h ? "field" : "method") + " decorators", "return") && (h ? D.unshift(k) : E[O] = k);
3727
+ }
3728
+ return i < 2 && o.push(p(D, c, 1), p(a, c, 0)), !h && !b && (d ? x ? o.splice(-1, 0, T("get", c), T("set", c)) : o.push(w ? E[O] : m.call.bind(E[O])) : s(e, r, E)), k;
3729
+ }
3730
+ function g() {
3731
+ var t = [], r, a, o = function(e) {
3732
+ e && t.push(p(e));
3733
+ }, s = function(o, s) {
3734
+ for (var c = 0; c < n.length; c++) {
3735
+ var l = n[c], u = l[1], d = u & 7;
3736
+ if ((u & 8) == o && !d == s) {
3737
+ var f = l[2], p = !!l[3], m = u & 16;
3738
+ h(o ? e : e.prototype, l, m, p ? "#" + f : Kr(f), d, d < 2 ? [] : o ? a ||= [] : r ||= [], t, !!o, p, s, o && p ? function(t) {
3739
+ return qr(t) === e;
3740
+ } : i);
3741
+ }
3742
+ }
3743
+ };
3744
+ return s(8, 0), s(0, 0), s(8, 1), s(0, 1), o(r), o(a), t;
3745
+ }
3746
+ function _(e) {
3747
+ return s(e, o, {
3748
+ configurable: !0,
3749
+ enumerable: !0,
3750
+ value: l
3751
+ });
3752
+ }
3753
+ return a !== void 0 && (l = a[o]), l = c(l ?? null), f = g(), d || _(e), {
3754
+ e: f,
3755
+ get c() {
3756
+ var n = [];
3757
+ return d && [_(e = h(e, [t], r, e.name, 5, n)), p(n, 1)];
3758
+ }
3759
+ };
3760
+ }
3761
+ var Xr = l("bleet-focus"), Zr, Qr;
3762
+ (class {
3763
+ logger;
3764
+ element;
3765
+ p;
3766
+ static {
3767
+ ({c: [Qr, Zr]} = Yr(this, [Xr], []));
3768
+ }
3769
+ constructor(e = f(a).scopeTo("bleet-focus"), t = f(o), n = f(s)) {
3770
+ this.logger = e, this.element = t, this.p = n, this.logger.trace("constructor");
3771
+ }
3772
+ attached() {
3773
+ this.logger.trace("attached"), this.p.requestAnimationFrame(() => {
3774
+ this.element.focus();
3775
+ });
3776
+ }
3777
+ static {
3778
+ Zr();
3779
+ }
3780
+ });
3781
+ //#endregion
3630
3782
  //#region src/components/bleet-ajaxify.$au.ts
3631
- var Gr = /* @__PURE__ */ h({
3632
- bindables: () => Yr,
3633
- default: () => qr,
3634
- dependencies: () => Jr,
3635
- name: () => Kr,
3636
- register: () => Zr,
3637
- template: () => qr
3638
- }), Kr = "bleet-ajaxify", qr = "<template>\n <au-slot if.bind=\"!ajaxedView\"></au-slot>\n <au-compose if.bind=\"ajaxedView\" template.bind=\"ajaxedView\"></au-compose>\n</template>\n", Jr = [], Yr = {}, Xr;
3639
- function Zr(e) {
3640
- Xr ||= p.define({
3641
- name: Kr,
3642
- template: qr,
3643
- dependencies: Jr,
3644
- bindables: Yr
3645
- }), e.register(Xr);
3783
+ var $r = /* @__PURE__ */ h({
3784
+ bindables: () => ri,
3785
+ default: () => ti,
3786
+ dependencies: () => ni,
3787
+ name: () => ei,
3788
+ register: () => ai,
3789
+ template: () => ti
3790
+ }), ei = "bleet-ajaxify", ti = "<template>\n <au-slot if.bind=\"!ajaxedView\"></au-slot>\n <au-compose if.bind=\"ajaxedView\" template.bind=\"ajaxedView\"></au-compose>\n</template>\n", ni = [], ri = {}, ii;
3791
+ function ai(e) {
3792
+ ii ||= p.define({
3793
+ name: ei,
3794
+ template: ti,
3795
+ dependencies: ni,
3796
+ bindables: ri
3797
+ }), e.register(ii);
3646
3798
  }
3647
3799
  //#endregion
3648
3800
  //#region src/components/bleet-ajaxify.ts
3649
- function Qr(e, t) {
3801
+ function oi(e, t) {
3650
3802
  if (typeof e != "object" || !e) return e;
3651
3803
  var n = e[Symbol.toPrimitive];
3652
3804
  if (n !== void 0) {
@@ -3656,15 +3808,15 @@ function Qr(e, t) {
3656
3808
  }
3657
3809
  return (t === "string" ? String : Number)(e);
3658
3810
  }
3659
- function $r(e) {
3660
- var t = Qr(e, "string");
3811
+ function si(e) {
3812
+ var t = oi(e, "string");
3661
3813
  return typeof t == "symbol" ? t : String(t);
3662
3814
  }
3663
- function ei(e) {
3815
+ function ci(e) {
3664
3816
  if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
3665
3817
  return e;
3666
3818
  }
3667
- function ti(e, t, n) {
3819
+ function li(e, t, n) {
3668
3820
  typeof t == "symbol" && (t = t.description, t = t ? "[" + t + "]" : "");
3669
3821
  try {
3670
3822
  Object.defineProperty(e, "name", {
@@ -3674,7 +3826,7 @@ function ti(e, t, n) {
3674
3826
  } catch {}
3675
3827
  return e;
3676
3828
  }
3677
- function ni(e, t, n, r, i, a) {
3829
+ function ui(e, t, n, r, i, a) {
3678
3830
  var o = Symbol.metadata || Symbol.for("Symbol.metadata"), s = Object.defineProperty, c = Object.create, l, u = [c(null), c(null)], d = t.length, f;
3679
3831
  function p(t, n, r) {
3680
3832
  return function(i, a) {
@@ -3699,13 +3851,13 @@ function ni(e, t, n, r, i, a) {
3699
3851
  }
3700
3852
  var E = {}, D = [], O = S ? "get" : C || x ? "set" : "value";
3701
3853
  if (!b && (d ? (h || x ? E = {
3702
- get: ti(function() {
3854
+ get: li(function() {
3703
3855
  return y(this);
3704
3856
  }, r, "get"),
3705
3857
  set: function(e) {
3706
3858
  t[4](this, e);
3707
3859
  }
3708
- } : E[O] = y, h || ti(E[O], r, w ? "" : O)) : h || (E = Object.getOwnPropertyDescriptor(e, r)), !h && !d)) {
3860
+ } : E[O] = y, h || li(E[O], r, w ? "" : O)) : h || (E = Object.getOwnPropertyDescriptor(e, r)), !h && !d)) {
3709
3861
  if (f = u[+c][r], f && (f ^ i) !== 7) throw Error("Decorating two elements with the same name (" + E[O].name + ") is not supported yet");
3710
3862
  u[+c][r] = i < 3 ? 1 : i;
3711
3863
  }
@@ -3753,8 +3905,8 @@ function ni(e, t, n, r, i, a) {
3753
3905
  var l = n[c], u = l[1], d = u & 7;
3754
3906
  if ((u & 8) == o && !d == s) {
3755
3907
  var f = l[2], p = !!l[3], m = u & 16;
3756
- h(o ? e : e.prototype, l, m, p ? "#" + f : $r(f), d, d < 2 ? [] : o ? a ||= [] : r ||= [], t, !!o, p, s, o && p ? function(t) {
3757
- return ei(t) === e;
3908
+ h(o ? e : e.prototype, l, m, p ? "#" + f : si(f), d, d < 2 ? [] : o ? a ||= [] : r ||= [], t, !!o, p, s, o && p ? function(t) {
3909
+ return ci(t) === e;
3758
3910
  } : i);
3759
3911
  }
3760
3912
  }
@@ -3776,22 +3928,22 @@ function ni(e, t, n, r, i, a) {
3776
3928
  }
3777
3929
  };
3778
3930
  }
3779
- var ri = u({
3780
- ...Gr,
3931
+ var di = u({
3932
+ ...$r,
3781
3933
  name: "bleet-ajaxify"
3782
- }), ii, ai = c(), oi = c(), si, ci, li, ui, di;
3934
+ }), fi, pi = c(), mi = c(), hi, gi, _i, vi, yi;
3783
3935
  (class {
3784
3936
  ea;
3785
3937
  logger;
3786
3938
  apiService;
3787
3939
  element;
3788
3940
  static {
3789
- ({e: [si, ci, li, ui], c: [di, ii]} = ni(this, [ri], [[
3790
- ai,
3941
+ ({e: [hi, gi, _i, vi], c: [yi, fi]} = ui(this, [di], [[
3942
+ pi,
3791
3943
  0,
3792
3944
  "id"
3793
3945
  ], [
3794
- oi,
3946
+ mi,
3795
3947
  0,
3796
3948
  "url"
3797
3949
  ]]));
@@ -3799,9 +3951,9 @@ var ri = u({
3799
3951
  constructor(e = f(i), t = f(a).scopeTo("<bleet-ajaxify>"), r = f(n), s = f(o)) {
3800
3952
  this.ea = e, this.logger = t, this.apiService = r, this.element = s, this.logger.trace("constructor");
3801
3953
  }
3802
- id = si(this, "");
3803
- url = (ci(this), li(this));
3804
- ajaxedView = (ui(this), null);
3954
+ id = hi(this, "");
3955
+ url = (gi(this), _i(this));
3956
+ ajaxedView = (vi(this), null);
3805
3957
  disposable;
3806
3958
  attaching() {
3807
3959
  this.logger.trace("attaching"), this.disposable = this.ea.subscribe(w.Ajaxify, this.onEvent);
@@ -3851,30 +4003,30 @@ var ri = u({
3851
4003
  });
3852
4004
  }
3853
4005
  static {
3854
- ii();
4006
+ fi();
3855
4007
  }
3856
4008
  });
3857
4009
  //#endregion
3858
4010
  //#region src/components/bleet-dialog.$au.ts
3859
- var fi = /* @__PURE__ */ h({
3860
- bindables: () => gi,
3861
- default: () => mi,
3862
- dependencies: () => hi,
3863
- name: () => pi,
3864
- register: () => vi,
3865
- template: () => mi
3866
- }), pi = "bleet-dialog", mi = "<template>\n <dialog ref=\"dialogElement\" class.bind=\"dialogClass\">\n <au-slot name=\"loader\" if.bind=\"loading\"><progress></progress></au-slot>\n <template else>\n <au-compose if.bind=\"contentView\" template.bind=\"contentView\"></au-compose>\n </template>\n </dialog>\n</template>\n", hi = [], gi = {}, _i;
3867
- function vi(e) {
3868
- _i ||= p.define({
3869
- name: pi,
3870
- template: mi,
3871
- dependencies: hi,
3872
- bindables: gi
3873
- }), e.register(_i);
4011
+ var bi = /* @__PURE__ */ h({
4012
+ bindables: () => wi,
4013
+ default: () => Si,
4014
+ dependencies: () => Ci,
4015
+ name: () => xi,
4016
+ register: () => Ei,
4017
+ template: () => Si
4018
+ }), xi = "bleet-dialog", Si = "<template>\n <dialog ref=\"dialogElement\" class.bind=\"dialogClass\">\n <au-slot name=\"loader\" if.bind=\"loading\"><progress></progress></au-slot>\n <template else>\n <au-compose if.bind=\"contentView\" template.bind=\"contentView\"></au-compose>\n <au-slot else></au-slot>\n </template>\n </dialog>\n</template>\n", Ci = [], wi = {}, Ti;
4019
+ function Ei(e) {
4020
+ Ti ||= p.define({
4021
+ name: xi,
4022
+ template: Si,
4023
+ dependencies: Ci,
4024
+ bindables: wi
4025
+ }), e.register(Ti);
3874
4026
  }
3875
4027
  //#endregion
3876
4028
  //#region src/components/bleet-dialog.ts
3877
- function yi(e, t) {
4029
+ function Di(e, t) {
3878
4030
  if (typeof e != "object" || !e) return e;
3879
4031
  var n = e[Symbol.toPrimitive];
3880
4032
  if (n !== void 0) {
@@ -3884,15 +4036,15 @@ function yi(e, t) {
3884
4036
  }
3885
4037
  return (t === "string" ? String : Number)(e);
3886
4038
  }
3887
- function bi(e) {
3888
- var t = yi(e, "string");
4039
+ function Oi(e) {
4040
+ var t = Di(e, "string");
3889
4041
  return typeof t == "symbol" ? t : String(t);
3890
4042
  }
3891
- function xi(e) {
4043
+ function ki(e) {
3892
4044
  if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
3893
4045
  return e;
3894
4046
  }
3895
- function Si(e, t, n) {
4047
+ function Ai(e, t, n) {
3896
4048
  typeof t == "symbol" && (t = t.description, t = t ? "[" + t + "]" : "");
3897
4049
  try {
3898
4050
  Object.defineProperty(e, "name", {
@@ -3902,7 +4054,7 @@ function Si(e, t, n) {
3902
4054
  } catch {}
3903
4055
  return e;
3904
4056
  }
3905
- function Ci(e, t, n, r, i, a) {
4057
+ function ji(e, t, n, r, i, a) {
3906
4058
  var o = Symbol.metadata || Symbol.for("Symbol.metadata"), s = Object.defineProperty, c = Object.create, l, u = [c(null), c(null)], d = t.length, f;
3907
4059
  function p(t, n, r) {
3908
4060
  return function(i, a) {
@@ -3927,13 +4079,13 @@ function Ci(e, t, n, r, i, a) {
3927
4079
  }
3928
4080
  var E = {}, D = [], O = S ? "get" : C || x ? "set" : "value";
3929
4081
  if (!b && (d ? (h || x ? E = {
3930
- get: Si(function() {
4082
+ get: Ai(function() {
3931
4083
  return y(this);
3932
4084
  }, r, "get"),
3933
4085
  set: function(e) {
3934
4086
  t[4](this, e);
3935
4087
  }
3936
- } : E[O] = y, h || Si(E[O], r, w ? "" : O)) : h || (E = Object.getOwnPropertyDescriptor(e, r)), !h && !d)) {
4088
+ } : E[O] = y, h || Ai(E[O], r, w ? "" : O)) : h || (E = Object.getOwnPropertyDescriptor(e, r)), !h && !d)) {
3937
4089
  if (f = u[+c][r], f && (f ^ i) !== 7) throw Error("Decorating two elements with the same name (" + E[O].name + ") is not supported yet");
3938
4090
  u[+c][r] = i < 3 ? 1 : i;
3939
4091
  }
@@ -3981,8 +4133,8 @@ function Ci(e, t, n, r, i, a) {
3981
4133
  var l = n[c], u = l[1], d = u & 7;
3982
4134
  if ((u & 8) == o && !d == s) {
3983
4135
  var f = l[2], p = !!l[3], m = u & 16;
3984
- h(o ? e : e.prototype, l, m, p ? "#" + f : bi(f), d, d < 2 ? [] : o ? a ||= [] : r ||= [], t, !!o, p, s, o && p ? function(t) {
3985
- return xi(t) === e;
4136
+ h(o ? e : e.prototype, l, m, p ? "#" + f : Oi(f), d, d < 2 ? [] : o ? a ||= [] : r ||= [], t, !!o, p, s, o && p ? function(t) {
4137
+ return ki(t) === e;
3986
4138
  } : i);
3987
4139
  }
3988
4140
  }
@@ -4004,10 +4156,10 @@ function Ci(e, t, n, r, i, a) {
4004
4156
  }
4005
4157
  };
4006
4158
  }
4007
- var wi = u({
4008
- ...fi,
4159
+ var Mi = u({
4160
+ ...bi,
4009
4161
  name: "bleet-dialog"
4010
- }), Ti, Ei = c({ attribute: "data-dialog-class" }), Di, Oi, ki, Ai, ji, Mi, Ni, Pi, Fi;
4162
+ }), Ni, Pi = c({ attribute: "data-dialog-class" }), Fi, Ii, Li, Ri, zi, Bi, Vi, Hi, Ui;
4011
4163
  (class {
4012
4164
  logger;
4013
4165
  element;
@@ -4016,14 +4168,14 @@ var wi = u({
4016
4168
  transitionService;
4017
4169
  apiService;
4018
4170
  static {
4019
- ({e: [Di, Oi, ki, Ai, ji, Mi, Ni, Pi], c: [Fi, Ti]} = Ci(this, [wi], [
4171
+ ({e: [Fi, Ii, Li, Ri, zi, Bi, Vi, Hi], c: [Ui, Ni]} = ji(this, [Mi], [
4020
4172
  [
4021
4173
  c,
4022
4174
  0,
4023
4175
  "id"
4024
4176
  ],
4025
4177
  [
4026
- Ei,
4178
+ Pi,
4027
4179
  0,
4028
4180
  "dialogClass"
4029
4181
  ],
@@ -4042,11 +4194,13 @@ var wi = u({
4042
4194
  constructor(e = f(a).scopeTo("<bleet-dialog>"), t = f(o), r = f(i), c = f(s), l = f(v), u = f(n)) {
4043
4195
  this.logger = e, this.element = t, this.ea = r, this.p = c, this.transitionService = l, this.apiService = u;
4044
4196
  }
4045
- id = Di(this, "");
4046
- dialogClass = (Oi(this), ki(this, ""));
4047
- loadError = (Ai(this), ji(this, ""));
4048
- submitError = (Mi(this), Ni(this, ""));
4049
- dialogElement = (Pi(this), void 0);
4197
+ id = Fi(this, "");
4198
+ dialogClass = (Ii(this), Li(this, ""));
4199
+ loadError = (Ri(this), zi(this, ""));
4200
+ submitError = (Bi(this), Vi(this, ""));
4201
+ title = (Hi(this), "");
4202
+ color = "";
4203
+ dialogElement;
4050
4204
  disposable;
4051
4205
  loading = !1;
4052
4206
  closing = !1;
@@ -4066,18 +4220,21 @@ var wi = u({
4066
4220
  onModalEvent = (e) => {
4067
4221
  if (this.id && this.id !== "" && e.id === this.id) {
4068
4222
  let t = this.dialogElement.open === !0 && this.closing === !1;
4069
- e.action === A.Open && t === !1 ? e.url && this.loadFromUrl(e.url) : e.action === A.Close && t === !0 ? this.close() : e.action === A.Toggle && (t === !0 ? this.close() : e.url && this.loadFromUrl(e.url));
4223
+ e.action === A.Open && t === !1 ? this.show(e) : e.action === A.Close && t === !0 ? this.close() : e.action === A.Toggle && (t === !0 ? this.close() : this.show(e));
4070
4224
  }
4071
4225
  };
4072
4226
  onCancelEvent = (e) => {
4073
- e.target === this.dialogElement && (e.preventDefault(), this.close());
4227
+ if (e.target === this.dialogElement) {
4228
+ let t = this.dialogElement.querySelector("[aria-expanded=\"true\"]");
4229
+ e.preventDefault(), t === null ? this.close() : t.click();
4230
+ }
4074
4231
  };
4075
4232
  onDialogClick = (e) => {
4076
4233
  e.target.closest("[data-dialog=\"close\"]") && (e.preventDefault(), this.close());
4077
4234
  };
4078
4235
  onFormSubmit = (e) => {
4079
4236
  let t = e.target.closest("form");
4080
- if (t && t.getAttribute("data-dialog") !== "native") {
4237
+ if (t && this.contentView !== null && t.getAttribute("data-dialog") !== "native") {
4081
4238
  e.preventDefault();
4082
4239
  let n = new FormData(t);
4083
4240
  e.submitter instanceof HTMLButtonElement && e.submitter.name && n.append(e.submitter.name, e.submitter.value || "");
@@ -4089,6 +4246,9 @@ var wi = u({
4089
4246
  });
4090
4247
  }
4091
4248
  };
4249
+ show(e) {
4250
+ this.title = e.title ?? "", this.color = e.color ?? "", e.url ? this.loadFromUrl(e.url) : (this.contentView = e.content ?? null, this.open());
4251
+ }
4092
4252
  loadFromUrl(e) {
4093
4253
  this.loading = !0, this.open(), this.apiService.url(e).get().then((e) => {
4094
4254
  this.applyResponse(e.body);
@@ -4139,19 +4299,19 @@ var wi = u({
4139
4299
  id: this.id
4140
4300
  }), this.ea.publish(w.Overlay, { action: E.Close }), S(e, "dialog", "hide", this.element));
4141
4301
  }, (e) => {
4142
- this.closing === !0 && (this.closing = !1, e.close(), this.unbindDialogEvents(), this.contentView = null, this.loading = !1, this.ea.publish(w.ModalStatus, {
4302
+ this.closing === !0 && (this.closing = !1, e.close(), this.unbindDialogEvents(), this.contentView = null, this.loading = !1, this.title = "", this.color = "", this.ea.publish(w.ModalStatus, {
4143
4303
  status: j.Closed,
4144
4304
  id: this.id
4145
4305
  }));
4146
4306
  });
4147
4307
  }
4148
4308
  static {
4149
- Ti();
4309
+ Ni();
4150
4310
  }
4151
4311
  });
4152
4312
  //#endregion
4153
4313
  //#region src/index.ts
4154
- var Ii = [
4314
+ var Wi = [
4155
4315
  Y,
4156
4316
  V,
4157
4317
  W,
@@ -4169,21 +4329,22 @@ var Ii = [
4169
4329
  dr,
4170
4330
  Ir,
4171
4331
  Wr,
4172
- di,
4173
- Fi
4332
+ Qr,
4333
+ yi,
4334
+ Ui
4174
4335
  ];
4175
- function Li(e) {
4336
+ function Gi(e) {
4176
4337
  return {
4177
4338
  register(n) {
4178
- return (e ? t.customize(e) : t).register(n), n.register(...Ii);
4339
+ return (e ? t.customize(e) : t).register(n), n.register(...Wi);
4179
4340
  },
4180
4341
  customize(e) {
4181
- return Li(e);
4342
+ return Gi(e);
4182
4343
  }
4183
4344
  };
4184
4345
  }
4185
- var Ri = Li();
4346
+ var Ki = Gi();
4186
4347
  //#endregion
4187
- export { M as AjaxifyAction, N as AjaxifyTriggerMode, te as BadgeAction, di as BleetAjaxify, Q as BleetAjaxifyTriggerCustomAttribute, Y as BleetAlertCustomAttribute, U as BleetBadgeCustomAttribute, V as BleetBurgerCustomAttribute, Ri as BleetConfiguration, Fi as BleetDialog, W as BleetDropdownCustomAttribute, H as BleetMenuCustomAttribute, X as BleetModalTriggerCustomAttribute, Wr as BleetOverlayCustomAttribute, Z as BleetPagerCustomAttribute, G as BleetPasswordCustomAttribute, $ as BleetPopoverCustomAttribute, rr as BleetPopoverTriggerCustomAttribute, q as BleetProfileCustomAttribute, K as BleetTabsCustomAttribute, Ir as BleetToastCustomAttribute, dr as BleetToasterCustomAttribute, J as BleetToasterTriggerCustomAttribute, w as Channels, B as DialogAction, g as IStorageService, v as ITransitionService, b as ITrapFocusService, F as MenuAction, I as MenuStatus, A as ModalAction, j as ModalStatus, E as OverlayAction, D as OverlayStatus, L as PopoverAction, ne as PopoverStatus, O as ProfileAction, k as ProfileStatus, P as ToasterAction, ee as ToasterStatus, R as UiColor, re as UiIcon, z as UiToastIcon, T as UploadAction, S as setState };
4348
+ export { M as AjaxifyAction, N as AjaxifyTriggerMode, te as BadgeAction, yi as BleetAjaxify, Q as BleetAjaxifyTriggerCustomAttribute, Y as BleetAlertCustomAttribute, U as BleetBadgeCustomAttribute, V as BleetBurgerCustomAttribute, Ki as BleetConfiguration, Ui as BleetDialog, W as BleetDropdownCustomAttribute, Qr as BleetFocusCustomAttribute, H as BleetMenuCustomAttribute, X as BleetModalTriggerCustomAttribute, Wr as BleetOverlayCustomAttribute, Z as BleetPagerCustomAttribute, G as BleetPasswordCustomAttribute, $ as BleetPopoverCustomAttribute, rr as BleetPopoverTriggerCustomAttribute, q as BleetProfileCustomAttribute, K as BleetTabsCustomAttribute, Ir as BleetToastCustomAttribute, dr as BleetToasterCustomAttribute, J as BleetToasterTriggerCustomAttribute, w as Channels, B as DialogAction, g as IStorageService, v as ITransitionService, b as ITrapFocusService, F as MenuAction, I as MenuStatus, A as ModalAction, j as ModalStatus, E as OverlayAction, D as OverlayStatus, L as PopoverAction, ne as PopoverStatus, O as ProfileAction, k as ProfileStatus, P as ToasterAction, ee as ToasterStatus, R as UiColor, re as UiIcon, z as UiToastIcon, T as UploadAction, S as setState };
4188
4349
 
4189
4350
  //# sourceMappingURL=index.es.js.map