@gomusdev/web-components 3.3.1 → 3.3.3

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
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.3 (2026-06-04)
4
+
5
+ ### Bug Fixes
6
+
7
+ * Mark timeslots as unavailable if max-capacity is 0
8
+
9
+ ## 3.3.2 (2026-06-03)
10
+
11
+ ### Bug Fixes
12
+
13
+ * **capacity:** timeslotsOn must not collapse slots to an unrelated zero quota
14
+
3
15
  ## 3.3.1 (2026-06-02)
4
16
 
5
17
  ### Bug Fixes
@@ -3541,23 +3541,23 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3541
3541
  function pause_effects(state2, to_destroy, controlled_anchor) {
3542
3542
  var transitions = [];
3543
3543
  var length = to_destroy.length;
3544
- var group;
3544
+ var group2;
3545
3545
  var remaining = to_destroy.length;
3546
3546
  for (var i = 0; i < length; i++) {
3547
3547
  let effect2 = to_destroy[i];
3548
3548
  pause_effect(
3549
3549
  effect2,
3550
3550
  () => {
3551
- if (group) {
3552
- group.pending.delete(effect2);
3553
- group.done.add(effect2);
3554
- if (group.pending.size === 0) {
3551
+ if (group2) {
3552
+ group2.pending.delete(effect2);
3553
+ group2.done.add(effect2);
3554
+ if (group2.pending.size === 0) {
3555
3555
  var groups = (
3556
3556
  /** @type {Set<EachOutroGroup>} */
3557
3557
  state2.outrogroups
3558
3558
  );
3559
- destroy_effects(array_from(group.done));
3560
- groups.delete(group);
3559
+ destroy_effects(array_from(group2.done));
3560
+ groups.delete(group2);
3561
3561
  if (groups.size === 0) {
3562
3562
  state2.outrogroups = null;
3563
3563
  }
@@ -3586,11 +3586,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3586
3586
  }
3587
3587
  destroy_effects(to_destroy, !fast_path);
3588
3588
  } else {
3589
- group = {
3589
+ group2 = {
3590
3590
  pending: new Set(to_destroy),
3591
3591
  done: /* @__PURE__ */ new Set()
3592
3592
  };
3593
- (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group);
3593
+ (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group2);
3594
3594
  }
3595
3595
  }
3596
3596
  function destroy_effects(to_destroy, remove_dom = true) {
@@ -3767,9 +3767,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3767
3767
  effect2 = /** @type {EachItem} */
3768
3768
  items.get(key).e;
3769
3769
  if (state2.outrogroups !== null) {
3770
- for (const group of state2.outrogroups) {
3771
- group.pending.delete(effect2);
3772
- group.done.delete(effect2);
3770
+ for (const group2 of state2.outrogroups) {
3771
+ group2.pending.delete(effect2);
3772
+ group2.done.delete(effect2);
3773
3773
  }
3774
3774
  }
3775
3775
  if ((effect2.f & EFFECT_OFFSCREEN) !== 0) {
@@ -3850,10 +3850,10 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3850
3850
  current = skip_to_branch(effect2.next);
3851
3851
  }
3852
3852
  if (state2.outrogroups !== null) {
3853
- for (const group of state2.outrogroups) {
3854
- if (group.pending.size === 0) {
3855
- destroy_effects(array_from(group.done));
3856
- state2.outrogroups?.delete(group);
3853
+ for (const group2 of state2.outrogroups) {
3854
+ if (group2.pending.size === 0) {
3855
+ destroy_effects(array_from(group2.done));
3856
+ state2.outrogroups?.delete(group2);
3857
3857
  }
3858
3858
  }
3859
3859
  if (state2.outrogroups.size === 0) {
@@ -4845,11 +4845,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
4845
4845
  input.checked = Boolean(value);
4846
4846
  });
4847
4847
  }
4848
- function get_binding_group_value(group, __value, checked) {
4848
+ function get_binding_group_value(group2, __value, checked) {
4849
4849
  var value = /* @__PURE__ */ new Set();
4850
- for (var i = 0; i < group.length; i += 1) {
4851
- if (group[i].checked) {
4852
- value.add(group[i].__value);
4850
+ for (var i = 0; i < group2.length; i += 1) {
4851
+ if (group2[i].checked) {
4852
+ value.add(group2[i].__value);
4853
4853
  }
4854
4854
  }
4855
4855
  if (!checked) {
@@ -5623,6 +5623,15 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5623
5623
  return false;
5624
5624
  }
5625
5625
  };
5626
+ const group = (array2, getGroupId) => {
5627
+ return array2.reduce((acc, item) => {
5628
+ const groupId = getGroupId(item);
5629
+ if (!acc[groupId])
5630
+ acc[groupId] = [];
5631
+ acc[groupId].push(item);
5632
+ return acc;
5633
+ }, {});
5634
+ };
5626
5635
  const boil = (array2, compareFunc) => {
5627
5636
  if (!array2 || (array2.length ?? 0) === 0)
5628
5637
  return null;
@@ -5638,10 +5647,24 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5638
5647
  const dsc = (a2, b) => getter(b) - getter(a2);
5639
5648
  return array2.slice().sort(desc === true ? dsc : asc);
5640
5649
  };
5650
+ function max$2(array2, getter) {
5651
+ const get2 = getter ?? ((v) => v);
5652
+ return boil(array2, (a2, b) => get2(a2) > get2(b) ? a2 : b);
5653
+ }
5641
5654
  function min$2(array2, getter) {
5642
- const get2 = ((v) => v);
5655
+ const get2 = getter ?? ((v) => v);
5643
5656
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5644
5657
  }
5658
+ const unique = (array2, toKey) => {
5659
+ const valueMap = array2.reduce((acc, item) => {
5660
+ const key = item;
5661
+ if (acc[key])
5662
+ return acc;
5663
+ acc[key] = item;
5664
+ return acc;
5665
+ }, {});
5666
+ return Object.values(valueMap);
5667
+ };
5645
5668
  const iterate = (count, func, initValue) => {
5646
5669
  let value = initValue;
5647
5670
  for (let i = 1; i <= count; i++) {
@@ -11165,18 +11188,14 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11165
11188
  return totalCap;
11166
11189
  },
11167
11190
  timeslotsOn(date2) {
11168
- const filtered = Object.values(
11169
- this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11170
- (acc, item) => {
11171
- if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11172
- acc[item.timeSlot] = item;
11173
- }
11174
- return acc;
11175
- },
11176
- {}
11177
- )
11178
- );
11179
- return filtered.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11191
+ const rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11192
+ const bySlot = group(rows, (r2) => r2.timeSlot);
11193
+ const result = Object.values(bySlot).map((slotRows) => {
11194
+ const tickets = unique(slotRows.flatMap((r2) => r2.tickets));
11195
+ const bindingPerTicket = tickets.map((t) => min$2(slotRows.filter((r2) => r2.tickets.includes(t)), (r2) => r2.capacity)).filter((r2) => r2 !== null);
11196
+ return max$2(bindingPerTicket, (r2) => r2.capacity) ?? slotRows[0];
11197
+ });
11198
+ return result.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11180
11199
  }
11181
11200
  };
11182
11201
  return ret;
@@ -37310,8 +37329,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
37310
37329
  var consequent = ($$anchor2) => {
37311
37330
  var ul = root_1$1();
37312
37331
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
37313
- const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
37314
- const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
37332
+ const unavailable = /* @__PURE__ */ user_derived(() => timeslot.totalCapacity === 0);
37333
+ const soldOut = /* @__PURE__ */ user_derived(() => !get$2(unavailable) && timeslot.capacity === 0);
37334
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(unavailable) || get$2(soldOut) || !timeslot.available);
37315
37335
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
37316
37336
  var li = root_2$1();
37317
37337
  var label = child(li);
@@ -37325,6 +37345,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
37325
37345
  template_effect(() => {
37326
37346
  set_class(li, 1, clsx({
37327
37347
  "go-timeslot": true,
37348
+ "is-unavailable": get$2(unavailable),
37328
37349
  "is-sold-out": get$2(soldOut),
37329
37350
  "is-disabled": get$2(disabled),
37330
37351
  "is-selected": get$2(selected)
@@ -3539,23 +3539,23 @@ function index$1(_, i) {
3539
3539
  function pause_effects(state2, to_destroy, controlled_anchor) {
3540
3540
  var transitions = [];
3541
3541
  var length = to_destroy.length;
3542
- var group;
3542
+ var group2;
3543
3543
  var remaining = to_destroy.length;
3544
3544
  for (var i = 0; i < length; i++) {
3545
3545
  let effect2 = to_destroy[i];
3546
3546
  pause_effect(
3547
3547
  effect2,
3548
3548
  () => {
3549
- if (group) {
3550
- group.pending.delete(effect2);
3551
- group.done.add(effect2);
3552
- if (group.pending.size === 0) {
3549
+ if (group2) {
3550
+ group2.pending.delete(effect2);
3551
+ group2.done.add(effect2);
3552
+ if (group2.pending.size === 0) {
3553
3553
  var groups = (
3554
3554
  /** @type {Set<EachOutroGroup>} */
3555
3555
  state2.outrogroups
3556
3556
  );
3557
- destroy_effects(array_from(group.done));
3558
- groups.delete(group);
3557
+ destroy_effects(array_from(group2.done));
3558
+ groups.delete(group2);
3559
3559
  if (groups.size === 0) {
3560
3560
  state2.outrogroups = null;
3561
3561
  }
@@ -3584,11 +3584,11 @@ function pause_effects(state2, to_destroy, controlled_anchor) {
3584
3584
  }
3585
3585
  destroy_effects(to_destroy, !fast_path);
3586
3586
  } else {
3587
- group = {
3587
+ group2 = {
3588
3588
  pending: new Set(to_destroy),
3589
3589
  done: /* @__PURE__ */ new Set()
3590
3590
  };
3591
- (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group);
3591
+ (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group2);
3592
3592
  }
3593
3593
  }
3594
3594
  function destroy_effects(to_destroy, remove_dom = true) {
@@ -3765,9 +3765,9 @@ function reconcile(state2, array2, anchor, flags2, get_key) {
3765
3765
  effect2 = /** @type {EachItem} */
3766
3766
  items.get(key).e;
3767
3767
  if (state2.outrogroups !== null) {
3768
- for (const group of state2.outrogroups) {
3769
- group.pending.delete(effect2);
3770
- group.done.delete(effect2);
3768
+ for (const group2 of state2.outrogroups) {
3769
+ group2.pending.delete(effect2);
3770
+ group2.done.delete(effect2);
3771
3771
  }
3772
3772
  }
3773
3773
  if ((effect2.f & EFFECT_OFFSCREEN) !== 0) {
@@ -3848,10 +3848,10 @@ function reconcile(state2, array2, anchor, flags2, get_key) {
3848
3848
  current = skip_to_branch(effect2.next);
3849
3849
  }
3850
3850
  if (state2.outrogroups !== null) {
3851
- for (const group of state2.outrogroups) {
3852
- if (group.pending.size === 0) {
3853
- destroy_effects(array_from(group.done));
3854
- state2.outrogroups?.delete(group);
3851
+ for (const group2 of state2.outrogroups) {
3852
+ if (group2.pending.size === 0) {
3853
+ destroy_effects(array_from(group2.done));
3854
+ state2.outrogroups?.delete(group2);
3855
3855
  }
3856
3856
  }
3857
3857
  if (state2.outrogroups.size === 0) {
@@ -4844,11 +4844,11 @@ function bind_checked(input, get2, set2 = get2) {
4844
4844
  input.checked = Boolean(value);
4845
4845
  });
4846
4846
  }
4847
- function get_binding_group_value(group, __value, checked) {
4847
+ function get_binding_group_value(group2, __value, checked) {
4848
4848
  var value = /* @__PURE__ */ new Set();
4849
- for (var i = 0; i < group.length; i += 1) {
4850
- if (group[i].checked) {
4851
- value.add(group[i].__value);
4849
+ for (var i = 0; i < group2.length; i += 1) {
4850
+ if (group2[i].checked) {
4851
+ value.add(group2[i].__value);
4852
4852
  }
4853
4853
  }
4854
4854
  if (!checked) {
@@ -5623,6 +5623,15 @@ const isNumber = (value) => {
5623
5623
  return false;
5624
5624
  }
5625
5625
  };
5626
+ const group = (array2, getGroupId) => {
5627
+ return array2.reduce((acc, item) => {
5628
+ const groupId = getGroupId(item);
5629
+ if (!acc[groupId])
5630
+ acc[groupId] = [];
5631
+ acc[groupId].push(item);
5632
+ return acc;
5633
+ }, {});
5634
+ };
5626
5635
  const boil = (array2, compareFunc) => {
5627
5636
  if (!array2 || (array2.length ?? 0) === 0)
5628
5637
  return null;
@@ -5638,10 +5647,24 @@ const sort = (array2, getter, desc = false) => {
5638
5647
  const dsc = (a2, b) => getter(b) - getter(a2);
5639
5648
  return array2.slice().sort(desc === true ? dsc : asc);
5640
5649
  };
5650
+ function max$2(array2, getter) {
5651
+ const get2 = getter ?? ((v) => v);
5652
+ return boil(array2, (a2, b) => get2(a2) > get2(b) ? a2 : b);
5653
+ }
5641
5654
  function min$2(array2, getter) {
5642
- const get2 = ((v) => v);
5655
+ const get2 = getter ?? ((v) => v);
5643
5656
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5644
5657
  }
5658
+ const unique = (array2, toKey) => {
5659
+ const valueMap = array2.reduce((acc, item) => {
5660
+ const key = item;
5661
+ if (acc[key])
5662
+ return acc;
5663
+ acc[key] = item;
5664
+ return acc;
5665
+ }, {});
5666
+ return Object.values(valueMap);
5667
+ };
5645
5668
  const iterate = (count, func, initValue) => {
5646
5669
  let value = initValue;
5647
5670
  for (let i = 1; i <= count; i++) {
@@ -11165,18 +11188,14 @@ function createQuotaManager(quotas) {
11165
11188
  return totalCap;
11166
11189
  },
11167
11190
  timeslotsOn(date2) {
11168
- const filtered = Object.values(
11169
- this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11170
- (acc, item) => {
11171
- if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11172
- acc[item.timeSlot] = item;
11173
- }
11174
- return acc;
11175
- },
11176
- {}
11177
- )
11178
- );
11179
- return filtered.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11191
+ const rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11192
+ const bySlot = group(rows, (r2) => r2.timeSlot);
11193
+ const result = Object.values(bySlot).map((slotRows) => {
11194
+ const tickets = unique(slotRows.flatMap((r2) => r2.tickets));
11195
+ const bindingPerTicket = tickets.map((t) => min$2(slotRows.filter((r2) => r2.tickets.includes(t)), (r2) => r2.capacity)).filter((r2) => r2 !== null);
11196
+ return max$2(bindingPerTicket, (r2) => r2.capacity) ?? slotRows[0];
11197
+ });
11198
+ return result.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11180
11199
  }
11181
11200
  };
11182
11201
  return ret;
@@ -37310,8 +37329,9 @@ function Timeslots($$anchor, $$props) {
37310
37329
  var consequent = ($$anchor2) => {
37311
37330
  var ul = root_1$1();
37312
37331
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
37313
- const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
37314
- const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
37332
+ const unavailable = /* @__PURE__ */ user_derived(() => timeslot.totalCapacity === 0);
37333
+ const soldOut = /* @__PURE__ */ user_derived(() => !get$2(unavailable) && timeslot.capacity === 0);
37334
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(unavailable) || get$2(soldOut) || !timeslot.available);
37315
37335
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
37316
37336
  var li = root_2$1();
37317
37337
  var label = child(li);
@@ -37325,6 +37345,7 @@ function Timeslots($$anchor, $$props) {
37325
37345
  template_effect(() => {
37326
37346
  set_class(li, 1, clsx({
37327
37347
  "go-timeslot": true,
37348
+ "is-unavailable": get$2(unavailable),
37328
37349
  "is-sold-out": get$2(soldOut),
37329
37350
  "is-disabled": get$2(disabled),
37330
37351
  "is-selected": get$2(selected)