@muibook/components 15.0.1 → 17.0.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.
@@ -1,29 +1,28 @@
1
1
  import "../mui-body/index.js";
2
- class u extends HTMLElement {
2
+ class d extends HTMLElement {
3
3
  constructor() {
4
- super(), this.resizeObserver = null, this.avatarSlotEl = null, this.contentSlotEl = null, this.attachShadow({ mode: "open" });
4
+ super(), this.avatarSlotEl = null, this.contentSlotEl = null, this.attachShadow({ mode: "open" });
5
5
  }
6
6
  static get observedAttributes() {
7
7
  return ["size", "variant", "density"];
8
8
  }
9
9
  connectedCallback() {
10
- this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), this.hasAttribute("density") || this.setAttribute("density", "default"), this.render(), this.bindLayoutSync(), this.bindSlotSync();
10
+ this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), this.hasAttribute("density") || this.setAttribute("density", "default"), this.render(), this.bindSlotSync();
11
11
  }
12
- attributeChangedCallback(t, e, s) {
13
- e !== s && (this.render(), this.bindLayoutSync(), this.bindSlotSync());
12
+ attributeChangedCallback(a, t, e) {
13
+ t !== e && (this.render(), this.bindSlotSync());
14
14
  }
15
15
  disconnectedCallback() {
16
- var t;
17
- (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = null, this.avatarSlotEl = null, this.contentSlotEl = null;
16
+ this.avatarSlotEl = null, this.contentSlotEl = null;
18
17
  }
19
18
  render() {
20
19
  if (!this.shadowRoot) return;
21
- const t = this.getAttribute("size") || "medium", e = {
20
+ const a = this.getAttribute("size") || "medium", t = {
22
21
  "x-small": { gap: "var(--space-100)", padding: "var(--space-200)" },
23
22
  small: { gap: "var(--space-200)", padding: "var(--space-300)" },
24
23
  medium: { gap: "var(--space-300)", padding: "var(--space-400)" },
25
24
  large: { gap: "var(--space-400)", padding: "var(--space-500)" }
26
- }, s = e[t] || e.medium;
25
+ }, e = t[a] || t.medium;
27
26
  this.shadowRoot.innerHTML = /*html*/
28
27
  `
29
28
  <style>
@@ -33,11 +32,11 @@ class u extends HTMLElement {
33
32
  .bubble {
34
33
  display: grid;
35
34
  grid-template-columns: auto 1fr;
36
- align-items: center;
37
- gap: ${s.gap};
35
+ align-items: start;
36
+ gap: ${e.gap};
38
37
  width: 100%;
39
38
  box-sizing: border-box;
40
- padding: ${s.padding};
39
+ padding: ${e.padding};
41
40
  border: var(--border-thin);
42
41
  border-color: var(--form-default-border-color);
43
42
  border-radius: var(--radius-300);
@@ -55,12 +54,10 @@ class u extends HTMLElement {
55
54
  .content {
56
55
  min-width: 0;
57
56
  }
58
- :host([multi-line]) .bubble {
59
- align-items: start;
60
- }
61
- :host([multi-line]) .content {
62
- margin-top: var(--space-050);
63
- }
57
+ :host([size="x-small"]) .content { margin-top: calc(var(--space-025) + var(--stroke-size-100)); }
58
+ :host([size="small"]) .content { margin-top: var(--space-200); }
59
+ :host([size="medium"]) .content { margin-top: var(--space-200); }
60
+ :host([size="large"]) .content { margin-top: var(--space-300); }
64
61
  </style>
65
62
 
66
63
  <div class="bubble">
@@ -75,40 +72,26 @@ class u extends HTMLElement {
75
72
  }
76
73
  bindSlotSync() {
77
74
  if (!this.shadowRoot || (this.avatarSlotEl = this.shadowRoot.querySelector("#avatarSlot"), this.contentSlotEl = this.shadowRoot.querySelector("#contentSlot"), !this.avatarSlotEl || !this.contentSlotEl)) return;
78
- const t = () => {
79
- var r, o;
80
- const e = this.getAttribute("size") || "medium", s = {
75
+ const a = () => {
76
+ var i, o;
77
+ const t = this.getAttribute("size") || "medium", e = {
81
78
  "x-small": "x-small",
82
79
  small: "small",
83
80
  medium: "small",
84
81
  large: "medium"
85
- }, i = {
82
+ }, r = {
86
83
  "x-small": "x-small",
87
84
  small: "small",
88
85
  medium: "small",
89
86
  large: "medium"
90
- }, d = s[e] || "small", l = i[e] || "small";
91
- (((r = this.avatarSlotEl) == null ? void 0 : r.assignedElements({ flatten: !0 })) || []).forEach((a) => {
92
- a.tagName.toLowerCase() === "mui-avatar" && a.setAttribute("size", d);
93
- }), (((o = this.contentSlotEl) == null ? void 0 : o.assignedElements({ flatten: !0 })) || []).forEach((a) => {
94
- a.tagName.toLowerCase() === "mui-body" && a.setAttribute("size", l);
95
- });
96
- };
97
- this.avatarSlotEl.addEventListener("slotchange", t), this.contentSlotEl.addEventListener("slotchange", t), t();
98
- }
99
- bindLayoutSync() {
100
- var i;
101
- if (!this.shadowRoot) return;
102
- (i = this.resizeObserver) == null || i.disconnect(), this.resizeObserver = null;
103
- const t = this.shadowRoot.querySelector(".content"), e = this.shadowRoot.querySelector("#contentSlot");
104
- if (!t || !e) return;
105
- const s = () => {
106
- requestAnimationFrame(() => {
107
- const l = e.assignedElements({ flatten: !0 })[0] || t, c = getComputedStyle(l).lineHeight || "0", n = Number.parseFloat(c), r = Number.isFinite(n) && n > 0 ? n : 20, o = Math.round(t.getBoundingClientRect().height / r);
108
- this.toggleAttribute("multi-line", o > 1);
87
+ }, l = e[t] || "small", n = r[t] || "small";
88
+ (((i = this.avatarSlotEl) == null ? void 0 : i.assignedElements({ flatten: !0 })) || []).forEach((s) => {
89
+ s.tagName.toLowerCase() === "mui-avatar" && s.setAttribute("size", l);
90
+ }), (((o = this.contentSlotEl) == null ? void 0 : o.assignedElements({ flatten: !0 })) || []).forEach((s) => {
91
+ s.tagName.toLowerCase() === "mui-body" && s.setAttribute("size", n);
109
92
  });
110
93
  };
111
- e.addEventListener("slotchange", s), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => s()), this.resizeObserver.observe(t), this.resizeObserver.observe(this)), s();
94
+ this.avatarSlotEl.addEventListener("slotchange", a), this.contentSlotEl.addEventListener("slotchange", a), a();
112
95
  }
113
96
  }
114
- customElements.get("mui-prompt-message") || customElements.define("mui-prompt-message", u);
97
+ customElements.get("mui-prompt-message") || customElements.define("mui-prompt-message", d);
@@ -1,13 +1,14 @@
1
1
  import "../mui-heading/index.js";
2
2
  import "../mui-body/index.js";
3
+ import "../mui-slide-section/index.js";
3
4
  import "../mui-stack/vstack/index.js";
4
5
  import "../mui-stack/hstack/index.js";
5
6
  import "../mui-button/index.js";
6
7
  import "../mui-icons/warning/index.js";
7
8
  import "../mui-select/index.js";
8
- class C extends HTMLElement {
9
+ class x extends HTMLElement {
9
10
  constructor() {
10
- super(), this.defaultSlot = null, this.headerSlot = null, this.headerAfterSlot = null, this.headerDescriptionSlot = null, this.footerSlot = null, this.footerAfterSlot = null, this.footerDescriptionSlot = null, this.notesSlot = null, this.stageEl = null, this.surfaceEl = null, this.nativeFullscreenActive = !1, this.pointerStartX = null, this.pointerStartY = null, this.onSlotChange = () => this.syncSections(), this.onChromeSlotChange = () => this.syncChromeState(), this.onPointerDown = (e) => this.handlePointerDown(e), this.onPointerUp = (e) => this.handlePointerUp(e), this.onKeyDown = (e) => this.handleArrowNavigation(e), this.onFullscreenChange = () => this.handleFullscreenChange(), this.onFullscreenError = () => this.handleFullscreenError(), this.onWindowResize = () => this.updateFullscreenSurfaceFit(), this.onDocumentKeyDown = (e) => {
11
+ super(), this.defaultSlot = null, this.headerSlot = null, this.headerAfterSlot = null, this.headerDescriptionSlot = null, this.footerSlot = null, this.footerAfterSlot = null, this.footerDescriptionSlot = null, this.notesSlot = null, this.stageEl = null, this.activeSectionEl = null, this.nativeFullscreenActive = !1, this.onSlotChange = () => this.syncSections(), this.onChromeSlotChange = () => this.syncChromeState(), this.onKeyDown = (e) => this.handleArrowNavigation(e), this.onFullscreenChange = () => this.handleFullscreenChange(), this.onFullscreenError = () => this.handleFullscreenError(), this.onWindowResize = () => this.updateFullscreenSurfaceFit(), this.onDocumentKeyDown = (e) => {
11
12
  const t = document.fullscreenElement === this;
12
13
  if (e.key === "Escape" && this.hasAttribute("present") && !t) {
13
14
  e.preventDefault(), this.resetPresentationState();
@@ -19,8 +20,6 @@ class C extends HTMLElement {
19
20
  static get observedAttributes() {
20
21
  return [
21
22
  "ratio",
22
- "ratio-width",
23
- "ratio-height",
24
23
  "present",
25
24
  "active-section",
26
25
  "padding",
@@ -32,6 +31,7 @@ class C extends HTMLElement {
32
31
  "hide-header",
33
32
  "hide-footer",
34
33
  "hide-counter",
34
+ "allow-add-section",
35
35
  "scroll",
36
36
  "fullscreen"
37
37
  ];
@@ -40,8 +40,8 @@ class C extends HTMLElement {
40
40
  this.hasAttribute("ratio") || this.setAttribute("ratio", "16:9"), this.hasAttribute("padding") || this.setAttribute("padding", "medium"), this.hasAttribute("active-section") || this.setAttribute("active-section", "0"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), this.hasAttribute("radius") || this.setAttribute("radius", "default"), this.render(), this.syncSections(), this.syncChromeState(), this.addEventListener("keydown", this.onKeyDown), document.addEventListener("keydown", this.onDocumentKeyDown), document.addEventListener("fullscreenchange", this.onFullscreenChange), document.addEventListener("fullscreenerror", this.onFullscreenError), window.addEventListener("resize", this.onWindowResize);
41
41
  }
42
42
  disconnectedCallback() {
43
- var e, t, i, s, a, r, l, h, p, m;
44
- (e = this.defaultSlot) == null || e.removeEventListener("slotchange", this.onSlotChange), (t = this.headerSlot) == null || t.removeEventListener("slotchange", this.onChromeSlotChange), (i = this.headerAfterSlot) == null || i.removeEventListener("slotchange", this.onChromeSlotChange), (s = this.headerDescriptionSlot) == null || s.removeEventListener("slotchange", this.onChromeSlotChange), (a = this.footerSlot) == null || a.removeEventListener("slotchange", this.onChromeSlotChange), (r = this.footerAfterSlot) == null || r.removeEventListener("slotchange", this.onChromeSlotChange), (l = this.footerDescriptionSlot) == null || l.removeEventListener("slotchange", this.onChromeSlotChange), (h = this.notesSlot) == null || h.removeEventListener("slotchange", this.onChromeSlotChange), (p = this.surfaceEl) == null || p.removeEventListener("pointerdown", this.onPointerDown), (m = this.surfaceEl) == null || m.removeEventListener("pointerup", this.onPointerUp), this.removeEventListener("keydown", this.onKeyDown), document.removeEventListener("keydown", this.onDocumentKeyDown), document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("fullscreenerror", this.onFullscreenError), window.removeEventListener("resize", this.onWindowResize);
43
+ var e, t, i, s, r, n, d, h;
44
+ (e = this.defaultSlot) == null || e.removeEventListener("slotchange", this.onSlotChange), (t = this.headerSlot) == null || t.removeEventListener("slotchange", this.onChromeSlotChange), (i = this.headerAfterSlot) == null || i.removeEventListener("slotchange", this.onChromeSlotChange), (s = this.headerDescriptionSlot) == null || s.removeEventListener("slotchange", this.onChromeSlotChange), (r = this.footerSlot) == null || r.removeEventListener("slotchange", this.onChromeSlotChange), (n = this.footerAfterSlot) == null || n.removeEventListener("slotchange", this.onChromeSlotChange), (d = this.footerDescriptionSlot) == null || d.removeEventListener("slotchange", this.onChromeSlotChange), (h = this.notesSlot) == null || h.removeEventListener("slotchange", this.onChromeSlotChange), this.removeEventListener("keydown", this.onKeyDown), document.removeEventListener("keydown", this.onDocumentKeyDown), document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("fullscreenerror", this.onFullscreenError), window.removeEventListener("resize", this.onWindowResize);
45
45
  }
46
46
  attributeChangedCallback(e, t, i) {
47
47
  t !== i && (this.render(), this.syncSections(), this.syncChromeState());
@@ -72,15 +72,16 @@ class C extends HTMLElement {
72
72
  this.nativeFullscreenActive = !1, this.removeAttribute("present"), this.removeAttribute("fullscreen"), this.syncChromeState();
73
73
  }
74
74
  getSections() {
75
- var t;
76
- return (((t = this.defaultSlot) == null ? void 0 : t.assignedElements({ flatten: !0 })) || []).filter((i) => !["header", "footer"].includes(i.getAttribute("slot") || ""));
75
+ var s;
76
+ const t = (((s = this.defaultSlot) == null ? void 0 : s.assignedElements({ flatten: !0 })) || []).filter((r) => !["header", "footer"].includes(r.getAttribute("slot") || "")), i = t.filter((r) => r.tagName.toLowerCase() === "mui-slide-section");
77
+ return i.length > 0 ? i : t;
77
78
  }
78
79
  getActiveSectionIndex() {
79
80
  const e = this.getSections(), t = parseInt(this.getAttribute("active-section") || "0", 10);
80
81
  return !Number.isFinite(t) || e.length === 0 ? 0 : Math.max(0, Math.min(t, e.length - 1));
81
82
  }
82
83
  setActiveSectionIndex(e) {
83
- this.setAttribute("active-section", String(e));
84
+ this.activeSectionEl = null, this.setAttribute("active-section", String(e));
84
85
  }
85
86
  nextSection() {
86
87
  const e = this.getSections();
@@ -106,18 +107,37 @@ class C extends HTMLElement {
106
107
  })
107
108
  );
108
109
  }
110
+ createDefaultSection(e) {
111
+ const t = document.createElement("mui-slide-section"), i = document.createElement("mui-v-stack");
112
+ i.setAttribute("space", "var(--space-400)"), i.setAttribute("alignx", "center"), i.setAttribute("aligny", "center");
113
+ const s = document.createElement("mui-body");
114
+ return s.setAttribute("size", "large"), s.textContent = e, i.appendChild(s), t.appendChild(i), t;
115
+ }
109
116
  addSection(e) {
110
- const t = document.createElement("div");
111
- t.setAttribute("data-slide-section", ""), typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && t.appendChild(e), this.appendChild(t);
112
- const i = this.getSections(), s = Math.max(0, i.length - 1);
113
- this.setActiveSectionIndex(s), this.syncSections(), this.dispatchEvent(
117
+ const t = `Section ${(this.getSections().length + 1).toString()}`;
118
+ let i;
119
+ typeof e == "string" ? i = this.createDefaultSection(e) : e instanceof HTMLElement ? e.tagName.toLowerCase() === "mui-slide-section" ? i = e : (i = document.createElement("mui-slide-section"), i.appendChild(e)) : i = this.createDefaultSection(t), this.appendChild(i);
120
+ const s = this.getSections(), r = Math.max(0, s.length - 1);
121
+ this.setActiveSectionIndex(r), this.syncSections(), this.dispatchEvent(
114
122
  new CustomEvent("section-add", {
115
- detail: { index: s, total: i.length },
123
+ detail: { index: r, total: s.length },
116
124
  bubbles: !0,
117
125
  composed: !0
118
126
  })
119
127
  );
120
128
  }
129
+ requestAddSection() {
130
+ const e = this.getSections().length, t = new CustomEvent("section-add-request", {
131
+ detail: {
132
+ index: e,
133
+ total: e + 1
134
+ },
135
+ bubbles: !0,
136
+ composed: !0,
137
+ cancelable: !0
138
+ });
139
+ this.dispatchEvent(t) && this.addSection(`Section ${(e + 1).toString()}`);
140
+ }
121
141
  toggleNotes(e) {
122
142
  const t = typeof e == "boolean" ? e : !this.hasAttribute("notes-open");
123
143
  this.toggleAttribute("notes-open", t), this.dispatchEvent(
@@ -129,12 +149,7 @@ class C extends HTMLElement {
129
149
  );
130
150
  }
131
151
  resolveRatio() {
132
- const e = (this.getAttribute("ratio") || "16:9").trim();
133
- if (e === "custom") {
134
- const i = parseFloat(this.getAttribute("ratio-width") || "16"), s = parseFloat(this.getAttribute("ratio-height") || "9");
135
- return i > 0 && s > 0 ? `${i} / ${s}` : "16 / 9";
136
- }
137
- const t = e.split(":");
152
+ const t = (this.getAttribute("ratio") || "16:9").trim().split(":");
138
153
  if (t.length === 2) {
139
154
  const i = parseFloat(t[0]), s = parseFloat(t[1]);
140
155
  if (i > 0 && s > 0) return `${i} / ${s}`;
@@ -142,12 +157,7 @@ class C extends HTMLElement {
142
157
  return "16 / 9";
143
158
  }
144
159
  resolveRatioParts() {
145
- const e = (this.getAttribute("ratio") || "16:9").trim();
146
- if (e === "custom") {
147
- const i = parseFloat(this.getAttribute("ratio-width") || "16"), s = parseFloat(this.getAttribute("ratio-height") || "9");
148
- return i > 0 && s > 0 ? { width: i, height: s } : { width: 16, height: 9 };
149
- }
150
- const t = e.split(":");
160
+ const t = (this.getAttribute("ratio") || "16:9").trim().split(":");
151
161
  if (t.length === 2) {
152
162
  const i = parseFloat(t[0]), s = parseFloat(t[1]);
153
163
  if (i > 0 && s > 0) return { width: i, height: s };
@@ -156,10 +166,13 @@ class C extends HTMLElement {
156
166
  }
157
167
  syncSections() {
158
168
  if (!this.shadowRoot) return;
159
- const e = this.getSections(), t = this.getActiveSectionIndex(), i = this.hasAttribute("present") || e.length > 1;
160
- e.forEach((s, a) => {
161
- s.setAttribute("data-slide-section", ""), a === t ? (s.removeAttribute("slide-hidden"), s.setAttribute("slide-active", "")) : (s.removeAttribute("slide-active"), i ? s.setAttribute("slide-hidden", "") : s.removeAttribute("slide-hidden"));
162
- }), this.style.setProperty("--slide-frame-ratio", this.resolveRatio()), this.updateFullscreenSurfaceFit();
169
+ const e = this.getSections();
170
+ let t = this.getActiveSectionIndex();
171
+ this.activeSectionEl && e.includes(this.activeSectionEl) && (t = e.indexOf(this.activeSectionEl)), t = Math.max(0, Math.min(t, Math.max(0, e.length - 1))), (this.getAttribute("active-section") || "0") !== String(t) && this.setAttribute("active-section", String(t));
172
+ const i = this.hasAttribute("present") || e.length > 1;
173
+ e.forEach((s, r) => {
174
+ s.setAttribute("data-slide-section", ""), r === t ? (s.removeAttribute("slide-hidden"), s.setAttribute("slide-active", "")) : (s.removeAttribute("slide-active"), i ? s.setAttribute("slide-hidden", "") : s.removeAttribute("slide-hidden"));
175
+ }), this.activeSectionEl = e[t] ?? null, this.style.setProperty("--slide-frame-ratio", this.resolveRatio()), this.updateFullscreenSurfaceFit();
163
176
  }
164
177
  handleArrowNavigation(e) {
165
178
  const t = document.fullscreenElement === this;
@@ -185,7 +198,7 @@ class C extends HTMLElement {
185
198
  return !!(i && this.contains(i));
186
199
  }
187
200
  render() {
188
- var a, r, l, h, p, m, b, v, d, S, w, y, c, u, o, n, g, E;
201
+ var r, n, d, h, w, p, v, f, c, b, S, y, u, l, g, m;
189
202
  if (!this.shadowRoot) return;
190
203
  const e = (this.getAttribute("title") || "").trim(), t = (this.getAttribute("footer-text") || "").trim(), i = this.escapeHtml(e), s = this.escapeHtml(t);
191
204
  this.shadowRoot.innerHTML = /*html*/
@@ -204,7 +217,7 @@ class C extends HTMLElement {
204
217
  --slide-frame-footer-padding-inline: var(--slide-frame-surface-padding-active);
205
218
  --slide-frame-footer-padding-block: var(--slide-frame-surface-padding-active);
206
219
  --slide-frame-footer-padding-top: 0;
207
- --slide-frame-footer-padding-bottom: var(--space-200);
220
+ --slide-frame-footer-padding-bottom: var(--space-400);
208
221
  }
209
222
  :host([padding="none"]) { --slide-frame-surface-padding-active: 0; }
210
223
  :host([padding="small"]) { --slide-frame-surface-padding-active: var(--slide-frame-padding-small); }
@@ -408,15 +421,11 @@ class C extends HTMLElement {
408
421
  <mui-grid col="1fr auto" class="present-controls" aligny="center">
409
422
  <mui-h-stack space="var(--space-050)" aligny="center">
410
423
  <mui-button id="slideFrameAddSectionBtn" variant="tertiary" size="x-small">Add Section</mui-button>
411
- <mui-rule direction="vertical" length="var(--space-300)"></mui-rule>
412
424
  <mui-button id="slideFrameToggleFullscreenBtn" variant="tertiary" size="x-small">Full Screen</mui-button>
413
- <mui-rule direction="vertical" length="var(--space-300)"></mui-rule>
414
425
  <mui-button id="slideFrameToggleNotesBtn" variant="tertiary" size="x-small">Notes</mui-button>
415
- <mui-rule direction="vertical" length="var(--space-300)"></mui-rule>
416
426
  </mui-h-stack>
417
427
  <mui-h-stack space="var(--space-050)" aligny="center">
418
428
  <mui-button id="slideFramePrevSectionBtn" variant="tertiary" size="x-small"><mui-icon-left-chevron slot="before"></mui-icon-left-chevron>Previous</mui-button>
419
- <mui-rule direction="vertical" length="var(--space-300)"></mui-rule>
420
429
  <mui-button id="slideFrameNextSectionBtn" variant="tertiary" size="x-small">Next<mui-icon-right-chevron slot="after"></mui-icon-right-chevron></mui-button>
421
430
  </mui-h-stack>
422
431
  </mui-grid>
@@ -467,55 +476,51 @@ class C extends HTMLElement {
467
476
  </div>
468
477
  <div class="notes"><mui-body variant="optional" size="x-small">Notes...</mui-body><slot name="notes"></slot></div>
469
478
  </div>
470
- `, this.defaultSlot = this.shadowRoot.querySelector("slot:not([name])"), (a = this.defaultSlot) == null || a.addEventListener("slotchange", this.onSlotChange), this.headerSlot = this.shadowRoot.querySelector('slot[name="header"]'), this.headerAfterSlot = this.shadowRoot.querySelector('slot[name="header-after"]'), this.headerDescriptionSlot = this.shadowRoot.querySelector('slot[name="header-description"]'), this.footerSlot = this.shadowRoot.querySelector('slot[name="footer"]'), this.footerAfterSlot = this.shadowRoot.querySelector('slot[name="footer-after"]'), this.notesSlot = this.shadowRoot.querySelector('slot[name="notes"]'), this.stageEl = this.shadowRoot.querySelector(".stage"), this.surfaceEl = this.shadowRoot.querySelector(".surface"), (r = this.headerSlot) == null || r.addEventListener("slotchange", this.onChromeSlotChange), (l = this.headerAfterSlot) == null || l.addEventListener("slotchange", this.onChromeSlotChange), (h = this.headerDescriptionSlot) == null || h.addEventListener("slotchange", this.onChromeSlotChange), (p = this.footerSlot) == null || p.addEventListener("slotchange", this.onChromeSlotChange), (m = this.footerAfterSlot) == null || m.addEventListener("slotchange", this.onChromeSlotChange), (b = this.footerDescriptionSlot) == null || b.addEventListener("slotchange", this.onChromeSlotChange), (v = this.notesSlot) == null || v.addEventListener("slotchange", this.onChromeSlotChange), (d = this.surfaceEl) == null || d.addEventListener("pointerdown", this.onPointerDown), (S = this.surfaceEl) == null || S.addEventListener("pointerup", this.onPointerUp), this.style.setProperty("--slide-frame-ratio", this.resolveRatio()), (w = this.shadowRoot.querySelector("#notesActionBtn")) == null || w.addEventListener("click", () => {
479
+ `, this.defaultSlot = this.shadowRoot.querySelector("slot:not([name])"), (r = this.defaultSlot) == null || r.addEventListener("slotchange", this.onSlotChange), this.headerSlot = this.shadowRoot.querySelector('slot[name="header"]'), this.headerAfterSlot = this.shadowRoot.querySelector('slot[name="header-after"]'), this.headerDescriptionSlot = this.shadowRoot.querySelector('slot[name="header-description"]'), this.footerSlot = this.shadowRoot.querySelector('slot[name="footer"]'), this.footerAfterSlot = this.shadowRoot.querySelector('slot[name="footer-after"]'), this.notesSlot = this.shadowRoot.querySelector('slot[name="notes"]'), this.stageEl = this.shadowRoot.querySelector(".stage"), (n = this.headerSlot) == null || n.addEventListener("slotchange", this.onChromeSlotChange), (d = this.headerAfterSlot) == null || d.addEventListener("slotchange", this.onChromeSlotChange), (h = this.headerDescriptionSlot) == null || h.addEventListener("slotchange", this.onChromeSlotChange), (w = this.footerSlot) == null || w.addEventListener("slotchange", this.onChromeSlotChange), (p = this.footerAfterSlot) == null || p.addEventListener("slotchange", this.onChromeSlotChange), (v = this.footerDescriptionSlot) == null || v.addEventListener("slotchange", this.onChromeSlotChange), (f = this.notesSlot) == null || f.addEventListener("slotchange", this.onChromeSlotChange), this.style.setProperty("--slide-frame-ratio", this.resolveRatio()), (c = this.shadowRoot.querySelector("#notesActionBtn")) == null || c.addEventListener("click", () => {
471
480
  this.toggleNotes();
472
- }), (y = this.shadowRoot.querySelector("#slideFrameAddSectionBtn")) == null || y.addEventListener("click", () => {
473
- this.addSection(`Section ${(this.getSections().length + 1).toString()}: New`);
474
- }), (c = this.shadowRoot.querySelector("#slideFramePrevSectionBtn")) == null || c.addEventListener("click", () => {
481
+ }), (b = this.shadowRoot.querySelector("#slideFrameAddSectionBtn")) == null || b.addEventListener("click", () => {
482
+ this.requestAddSection();
483
+ }), (S = this.shadowRoot.querySelector("#slideFramePrevSectionBtn")) == null || S.addEventListener("click", () => {
475
484
  this.prevSection();
476
- }), (u = this.shadowRoot.querySelector("#slideFrameNextSectionBtn")) == null || u.addEventListener("click", () => {
485
+ }), (y = this.shadowRoot.querySelector("#slideFrameNextSectionBtn")) == null || y.addEventListener("click", () => {
477
486
  this.nextSection();
478
- }), (o = this.shadowRoot.querySelector("#slideFrameToggleFullscreenBtn")) == null || o.addEventListener("click", () => {
487
+ }), (u = this.shadowRoot.querySelector("#slideFrameToggleFullscreenBtn")) == null || u.addEventListener("click", () => {
479
488
  if (this.hasAttribute("fullscreen") || document.fullscreenElement === this) {
480
489
  this.resetPresentationState(), this.exitFullscreen();
481
490
  return;
482
491
  }
483
- this.setAttribute("present", ""), this.setAttribute("fullscreen", ""), this.syncChromeState(), this.enterFullscreen().then((f) => {
484
- f && this.syncChromeState();
492
+ this.setAttribute("present", ""), this.setAttribute("fullscreen", ""), this.syncChromeState(), this.enterFullscreen().then((a) => {
493
+ a && this.syncChromeState();
485
494
  });
486
- }), (n = this.shadowRoot.querySelector("#slideFrameExitPresentBtn")) == null || n.addEventListener("click", () => {
495
+ }), (l = this.shadowRoot.querySelector("#slideFrameExitPresentBtn")) == null || l.addEventListener("click", () => {
487
496
  this.resetPresentationState(), this.exitFullscreen();
488
497
  }), (g = this.shadowRoot.querySelector("#slideFrameToggleNotesBtn")) == null || g.addEventListener("click", () => {
489
498
  this.toggleNotes();
490
- }), (E = this.shadowRoot.querySelector("#slideFrameRatioSelect")) == null || E.addEventListener("change", (A) => {
491
- var x;
492
- const f = A.currentTarget, F = (f == null ? void 0 : f.value) || ((x = f == null ? void 0 : f.getAttribute) == null ? void 0 : x.call(f, "value")) || "16:9";
493
- this.setAttribute("ratio", F);
499
+ }), (m = this.shadowRoot.querySelector("#slideFrameRatioSelect")) == null || m.addEventListener("change", (o) => {
500
+ var A;
501
+ const a = o.currentTarget, E = (a == null ? void 0 : a.value) || ((A = a == null ? void 0 : a.getAttribute) == null ? void 0 : A.call(a, "value")) || "16:9";
502
+ this.setAttribute("ratio", E);
494
503
  }), requestAnimationFrame(() => this.updateFullscreenSurfaceFit());
495
504
  }
496
505
  syncChromeState() {
497
506
  if (!this.shadowRoot) return;
498
507
  const e = (o) => ((o == null ? void 0 : o.assignedNodes({ flatten: !0 })) || []).some(
499
- (n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent || "").trim().length > 0
500
- ), t = !!(this.getAttribute("title") || "").trim(), i = !!(this.getAttribute("footer-text") || "").trim(), s = this.hasAttribute("hide-header"), a = this.hasAttribute("hide-footer"), r = !this.hasAttribute("hide-counter") && this.getSections().length > 0, l = !s && (t || e(this.headerSlot) || e(this.headerAfterSlot) || e(this.headerDescriptionSlot)), h = !a && (i || e(this.footerSlot) || e(this.footerAfterSlot) || e(this.footerDescriptionSlot) || r || this.hasAttribute("present") || this.hasAttribute("fullscreen")), p = e(this.notesSlot), m = this.hasAttribute("notes-open"), b = this.shadowRoot.querySelector("#headerRegion"), v = this.shadowRoot.querySelector("#footerRegion"), d = this.shadowRoot.querySelector("#footerCounter"), S = this.shadowRoot.querySelector("#slideFrameExitPresentBtn"), w = this.shadowRoot.querySelector("#slideFrameToggleFullscreenBtn"), y = this.shadowRoot.querySelector(".present-controls"), c = Math.max(this.getSections().length, 1), u = this.getActiveSectionIndex() + 1;
508
+ (a) => a.nodeType === Node.ELEMENT_NODE || (a.textContent || "").trim().length > 0
509
+ ), t = !!(this.getAttribute("title") || "").trim(), i = !!(this.getAttribute("footer-text") || "").trim(), s = this.hasAttribute("hide-header"), r = this.hasAttribute("hide-footer"), n = !this.hasAttribute("hide-counter") && this.getSections().length > 0, d = !s && (t || e(this.headerSlot) || e(this.headerAfterSlot) || e(this.headerDescriptionSlot)), h = !r && (i || e(this.footerSlot) || e(this.footerAfterSlot) || e(this.footerDescriptionSlot) || n || this.hasAttribute("present") || this.hasAttribute("fullscreen")), w = e(this.notesSlot), p = this.hasAttribute("notes-open"), v = this.shadowRoot.querySelector("#headerRegion"), f = this.shadowRoot.querySelector("#footerRegion"), c = this.shadowRoot.querySelector("#footerCounter"), b = this.shadowRoot.querySelector("#slideFrameExitPresentBtn"), S = this.shadowRoot.querySelector("#slideFrameToggleFullscreenBtn"), y = this.shadowRoot.querySelector(".present-controls"), u = this.shadowRoot.querySelector("#slideFrameAddSectionBtn"), l = this.shadowRoot.querySelector("#slideFrameAddSectionRule"), g = Math.max(this.getSections().length, 1), m = this.getActiveSectionIndex() + 1;
501
510
  if (y) {
502
511
  const o = this.hasAttribute("fullscreen") || document.fullscreenElement === this;
503
512
  y.hidden = o;
504
513
  }
505
- if (d) {
506
- d.hidden = !r;
507
- const o = Math.min(u, c), n = String(c).length;
508
- d.style.setProperty("--slide-frame-counter-digits", String(n)), d.setAttribute("aria-label", `Section ${o} of ${c}`), d.innerHTML = `Section <span class="counter-value">${o}</span>/<span class="counter-value">${c}</span>`;
514
+ if (u) {
515
+ const o = this.hasAttribute("allow-add-section");
516
+ u.hidden = !o, u.style.display = o ? "" : "none", l && (l.hidden = !o), l && (l.style.display = o ? "" : "none");
509
517
  }
510
- S && (S.hidden = !this.hasAttribute("fullscreen")), w && (w.textContent = this.hasAttribute("fullscreen") ? "Exit Fullscreen" : "Full Screen"), b && (b.hidden = !l), v && (v.hidden = !h), this.toggleAttribute("has-header", l), this.toggleAttribute("has-footer", h), this.toggleAttribute("has-notes", p), this.toggleAttribute("notes-visible", m), this.toggleAttribute("has-chrome", l || h || m), this.updateFullscreenSurfaceFit();
511
- }
512
- handlePointerDown(e) {
513
- this.pointerStartX = e.clientX, this.pointerStartY = e.clientY;
514
- }
515
- handlePointerUp(e) {
516
- if (this.pointerStartX == null || this.pointerStartY == null || this.getSections().length < 2) return;
517
- const t = e.clientX - this.pointerStartX, i = e.clientY - this.pointerStartY;
518
- this.pointerStartX = null, this.pointerStartY = null, !(Math.abs(t) < 40 || Math.abs(t) <= Math.abs(i)) && (t < 0 ? this.nextSection() : this.prevSection());
518
+ if (c) {
519
+ c.hidden = !n;
520
+ const o = Math.min(m, g), a = String(g).length;
521
+ c.style.setProperty("--slide-frame-counter-digits", String(a)), c.setAttribute("aria-label", `Section ${o} of ${g}`), c.innerHTML = `Section <span class="counter-value">${o}</span>/<span class="counter-value">${g}</span>`;
522
+ }
523
+ b && (b.hidden = !this.hasAttribute("fullscreen")), S && (S.textContent = this.hasAttribute("fullscreen") ? "Exit Fullscreen" : "Full Screen"), v && (v.hidden = !d), f && (f.hidden = !h), this.toggleAttribute("has-header", d), this.toggleAttribute("has-footer", h), this.toggleAttribute("has-notes", w), this.toggleAttribute("notes-visible", p), this.toggleAttribute("has-chrome", d || h || p), this.updateFullscreenSurfaceFit();
519
524
  }
520
525
  handleFullscreenChange() {
521
526
  const e = document.fullscreenElement === this, t = this.hasAttribute("fullscreen");
@@ -548,12 +553,12 @@ class C extends HTMLElement {
548
553
  }
549
554
  const t = this.shadowRoot.querySelector(".frame"), i = this.shadowRoot.querySelector(".present-controls"), s = this.shadowRoot.querySelector(".notes");
550
555
  if (!t) return;
551
- const a = t.getBoundingClientRect(), r = getComputedStyle(t), l = parseFloat(r.paddingTop || "0") || 0, h = parseFloat(r.paddingBottom || "0") || 0, p = parseFloat(r.paddingLeft || "0") || 0, m = parseFloat(r.paddingRight || "0") || 0, b = parseFloat(r.rowGap || r.gap || "0") || 0, v = i && getComputedStyle(i).display !== "none" ? i.getBoundingClientRect().height : 0, d = s && getComputedStyle(s).display !== "none" ? s.getBoundingClientRect().height : 0, S = [v > 0, !0, d > 0].filter(Boolean).length, w = Math.max(0, S - 1), y = Math.max(0, a.width - p - m), c = Math.max(0, a.height - l - h - v - d - b * w), u = this.resolveRatioParts(), o = this.hasAttribute("fullscreen") || document.fullscreenElement === this;
552
- let n, g;
553
- o ? (g = c, n = g * (u.width / u.height)) : (n = y, g = n * (u.height / u.width), g > c && (g = c, n = g * (u.width / u.height))), this.stageEl.style.width = `${Math.max(0, Math.floor(n))}px`, this.stageEl.style.height = `${Math.max(0, Math.floor(g))}px`;
556
+ const r = t.getBoundingClientRect(), n = getComputedStyle(t), d = parseFloat(n.paddingTop || "0") || 0, h = parseFloat(n.paddingBottom || "0") || 0, w = parseFloat(n.paddingLeft || "0") || 0, p = parseFloat(n.paddingRight || "0") || 0, v = parseFloat(n.rowGap || n.gap || "0") || 0, f = i && getComputedStyle(i).display !== "none" ? i.getBoundingClientRect().height : 0, c = s && getComputedStyle(s).display !== "none" ? s.getBoundingClientRect().height : 0, b = [f > 0, !0, c > 0].filter(Boolean).length, S = Math.max(0, b - 1), y = Math.max(0, r.width - w - p), u = Math.max(0, r.height - d - h - f - c - v * S), l = this.resolveRatioParts(), g = this.hasAttribute("fullscreen") || document.fullscreenElement === this;
557
+ let m, o;
558
+ g ? (o = u, m = o * (l.width / l.height)) : (m = y, o = m * (l.height / l.width), o > u && (o = u, m = o * (l.width / l.height))), this.stageEl.style.width = `${Math.max(0, Math.floor(m))}px`, this.stageEl.style.height = `${Math.max(0, Math.floor(o))}px`;
554
559
  }
555
560
  escapeHtml(e) {
556
561
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
557
562
  }
558
563
  }
559
- customElements.get("mui-slide-frame") || customElements.define("mui-slide-frame", C);
564
+ customElements.get("mui-slide-frame") || customElements.define("mui-slide-frame", x);
@@ -0,0 +1,23 @@
1
+ class e extends HTMLElement {
2
+ constructor() {
3
+ super(), this.attachShadow({ mode: "open" });
4
+ }
5
+ connectedCallback() {
6
+ this.render();
7
+ }
8
+ render() {
9
+ this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
10
+ `
11
+ <style>
12
+ :host {
13
+ display: block;
14
+ width: 100%;
15
+ min-width: 0;
16
+ box-sizing: border-box;
17
+ }
18
+ </style>
19
+ <slot></slot>
20
+ `);
21
+ }
22
+ }
23
+ customElements.get("mui-slide-section") || customElements.define("mui-slide-section", e);
@@ -1,6 +1,6 @@
1
1
 
2
2
  /* ================================================================================================== */
3
- /* Don't edit directly • Generated on Fri, 27 Feb 2026 13:59:34 GMT • muibook.com */
3
+ /* Don't edit directly • Generated on Sat, 28 Feb 2026 05:07:44 GMT • muibook.com */
4
4
  /* ================================================================================================== */
5
5
 
6
6
  /* ================================================================================================== */