@lmjs/core 2.1.24 → 2.2.1

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.
@@ -883,7 +883,10 @@ $.fn.priorityOn = function (type, selector, data, fn) {
883
883
  for (var t in types) {
884
884
  $this.on(types[t], selector, data, fn);
885
885
 
886
- var currentBindings = $._data(this, "events")[types[t]];
886
+ // Reordering needs real jQuery's private event table; the
887
+ // lightweight shim has none, so there it's a plain .on().
888
+ if (typeof $._data !== "function") continue;
889
+ var currentBindings = ($._data(this, "events") || {})[types[t]];
887
890
  if ($.isArray(currentBindings)) {
888
891
  currentBindings.unshift(currentBindings.pop());
889
892
  }
@@ -892,6 +895,22 @@ $.fn.priorityOn = function (type, selector, data, fn) {
892
895
  return this;
893
896
  };
894
897
 
898
+ $.fn.lock = function () {
899
+ if ($(this).is('form')) {
900
+ $(this).find('[type="submit"]').attr('disabled', 'disabled');
901
+ $(this).find('button:not([type])').attr('disabled', 'disabled');
902
+ }
903
+ return this;
904
+ };
905
+
906
+ $.fn.unlock = function () {
907
+ if ($(this).is('form')) {
908
+ $(this).find('[type="submit"]').removeAttr('disabled');
909
+ $(this).find('button:not([type])').removeAttr('disabled');
910
+ }
911
+ return this;
912
+ };
913
+
895
914
  $.fn.onClose = function (selector, data, fn) {
896
915
  this.each(function () {
897
916
  var el = $(this);
@@ -1857,10 +1876,21 @@ function renderViewsTpls() {
1857
1876
  }
1858
1877
 
1859
1878
 
1879
+ // 2026-09-26: every optional-plugin call below is guarded on the plugin
1880
+ // actually being loaded. A V1 project can legitimately carry the attribute
1881
+ // while the library is not bundled: the CLI's detectUsedPlugins() only scans
1882
+ // static project files, so markup arriving at runtime (BaaS data rendered
1883
+ // through a raw-HTML mustache, for instance) is invisible to it. Unguarded,
1884
+ // the call throws and aborts the REST of this pass -- confirmed live in
1885
+ // /BEACDN/_test: one [numeric] input stopped the [pattern] -> data-pattern
1886
+ // transfer that checkFormInputs() depends on, so form validation broke with
1887
+ // no error anywhere. Same failure shape as the old CKEDITOR throw. Matches
1888
+ // the guard convention autoInitPlugins() (src/_re.js) already uses.
1860
1889
  function renderPlugins() {
1861
1890
  $(
1862
1891
  "[crslf]:not(.flickity-enabled,[comp],[tpl],[view]),[crslf][comp]:not(.flickity-enabled),[crslf][tpl]:not(.flickity-enabled),[crslf][view]:not(.flickity-enabled)"
1863
1892
  ).each(function () {
1893
+ if (typeof $.fn.flickity !== "function") return;
1864
1894
  var el = $(this);
1865
1895
 
1866
1896
  if (el.hasAttr("[tpl]") || el.hasAttr("[comp]") || el.hasAttr("[view]")) {
@@ -1889,6 +1919,7 @@ function renderPlugins() {
1889
1919
  $(
1890
1920
  "[crsl]:not(.crsl-initialized,[comp],[tpl],[view]),[crsl][comp]:not(.crsl-initialized),[crsl][tpl]:not(.crsl-initialized),[crsl][view]:not(.crsl-initialized)"
1891
1921
  ).each(function () {
1922
+ if (typeof $.fn.crsl !== "function") return;
1892
1923
  var el = $(this);
1893
1924
  if (el.hasAttr("[tpl]") || el.hasAttr("[comp]") || el.hasAttr("[view]")) {
1894
1925
  if (el.data("_status") != "complete") return;
@@ -2109,7 +2140,7 @@ function renderPlugins() {
2109
2140
  if (editor.is("[mini]")) TB = miniTB;
2110
2141
  else if (editor.is("[full]")) TB = fullTB;
2111
2142
 
2112
- if (CKEDITOR !== undefined) {
2143
+ if (typeof CKEDITOR !== "undefined") {
2113
2144
  /*CKEDITOR.plugins.addExternal( 'autocomplete', 'https://s.beacdn.com/j/autocomplete/plugin.js' );*/
2114
2145
  CKEDITOR.replace(this, {
2115
2146
  uiColor: "#ffffff",
@@ -2241,6 +2272,7 @@ function renderPlugins() {
2241
2272
  });
2242
2273
 
2243
2274
  $("[tags]:not(.tag-editor-hidden-src)").each(function () {
2275
+ if (typeof $.fn.tagEditor !== "function") return;
2244
2276
  var t = $(this);
2245
2277
 
2246
2278
  var u = currentlyValidTags.length;
@@ -2311,6 +2343,7 @@ function renderPlugins() {
2311
2343
  });
2312
2344
 
2313
2345
  $("[slct]:not(.select2-hidden-accessible)").each(function () {
2346
+ if (typeof $.fn.select2 !== "function") return;
2314
2347
  var t = $(this);
2315
2348
  var plchldr = t.attr("placeholder") ? t.attr("placeholder") : "";
2316
2349
  var dropdownParent = t.attr("prnt") ? t.attr("prnt") : "body";
@@ -2413,6 +2446,7 @@ function renderPlugins() {
2413
2446
  });
2414
2447
 
2415
2448
  $("[sl]:not(.select2-hidden-accessible)").each(function () {
2449
+ if (typeof $.fn.select2 !== "function") return;
2416
2450
  var t = $(this);
2417
2451
  try {
2418
2452
 
@@ -2511,6 +2545,7 @@ function renderPlugins() {
2511
2545
  });
2512
2546
 
2513
2547
  $("[pinnable]:not(.pinnable)").each(function () {
2548
+ if (typeof Headroom === "undefined") return;
2514
2549
  var t = $(this);
2515
2550
  var offsetU = t.attr("pinnable-offset-up") ?? 100;
2516
2551
  var offsetD = t.attr("pinnable-offset-down") ?? 50;
@@ -2570,6 +2605,7 @@ function renderPlugins() {
2570
2605
  });
2571
2606
 
2572
2607
  $("[sort]").each(function (e) {
2608
+ if (typeof $.fn.sortable !== "function") return;
2573
2609
  let t = $(this);
2574
2610
  if (t.hasClass("ui-sortable")) return;
2575
2611
  let opts = {
@@ -2604,6 +2640,7 @@ function renderPlugins() {
2604
2640
  });
2605
2641
 
2606
2642
  $("[drag]").each(function (e) {
2643
+ if (typeof $.fn.draggable !== "function") return;
2607
2644
  let t = $(this);
2608
2645
  let opts = {
2609
2646
  // delay: 50,
@@ -2647,6 +2684,7 @@ function renderPlugins() {
2647
2684
 
2648
2685
 
2649
2686
  $("[drop]").each(function (e) {
2687
+ if (typeof $.fn.droppable !== "function") return;
2650
2688
  let t = $(this);
2651
2689
  let opts = {};
2652
2690
 
@@ -2713,6 +2751,7 @@ function renderPlugins() {
2713
2751
  });
2714
2752
 
2715
2753
  $("[numeric]").each(function () {
2754
+ if (typeof $.fn.numeric !== "function") return;
2716
2755
  $(this).removeAttr("numeric").numeric();
2717
2756
  });
2718
2757
 
@@ -2721,6 +2760,7 @@ function renderPlugins() {
2721
2760
  });
2722
2761
 
2723
2762
  $("[integer]:not([pve])").each(function () {
2763
+ if (typeof $.fn.numeric !== "function") return;
2724
2764
  $(this).removeAttr("integer").numeric(
2725
2765
  {
2726
2766
  decimal: false,
@@ -2728,6 +2768,7 @@ function renderPlugins() {
2728
2768
  );
2729
2769
  });
2730
2770
  $("[integer][pve]").each(function () {
2771
+ if (typeof $.fn.numeric !== "function") return;
2731
2772
  $(this).removeAttr("integer").numeric(
2732
2773
  {
2733
2774
  decimal: false,
@@ -2736,6 +2777,7 @@ function renderPlugins() {
2736
2777
  );
2737
2778
  });
2738
2779
  $("[decimal]:not([pve])").each(function () {
2780
+ if (typeof $.fn.numeric !== "function") return;
2739
2781
  var places = -1;
2740
2782
  if ($(this).is("[dp0]")) places = 0;
2741
2783
  else if ($(this).is("[dp1]")) places = 1;
@@ -2759,6 +2801,7 @@ function renderPlugins() {
2759
2801
  );
2760
2802
  });
2761
2803
  $("[decimal][pve]").each(function () {
2804
+ if (typeof $.fn.numeric !== "function") return;
2762
2805
  var places = -1;
2763
2806
  if ($(this).is("[dp0]")) places = 0;
2764
2807
  else if ($(this).is("[dp1]")) places = 1;
@@ -2794,10 +2837,30 @@ function renderPlugins() {
2794
2837
  });
2795
2838
 
2796
2839
  $("[color]").each(function () {
2840
+ if (typeof $.fn.colorpicker !== "function") return;
2797
2841
  $(this).removeAttr("color").colorpicker({
2798
2842
  format: "rgba",
2799
2843
  });
2800
2844
  });
2845
+
2846
+ $('lmlst:not(.binded)').each(function () {
2847
+ var el = $(this);
2848
+ el.addClass('binded');
2849
+ let _conf = el.attr(':config');
2850
+ let conf = null;
2851
+ if (_conf) {
2852
+ // V1 eval'd this globally; V2 view vars live in the reactive
2853
+ // scope, so resolve it the way @-handler expressions are.
2854
+ try {
2855
+ conf = (typeof _evalEventScopedExpr === 'function')
2856
+ ? _evalEventScopedExpr(el[0]._ownerRe, _conf)
2857
+ : eval(_conf);
2858
+ } catch (x) {
2859
+ conf = null;
2860
+ }
2861
+ }
2862
+ el[0].list = new __myList(el, conf || {});
2863
+ });
2801
2864
  }
2802
2865
 
2803
2866
  function dtp(el, t) {
@@ -3159,6 +3222,7 @@ function globalWatch() {
3159
3222
 
3160
3223
  function loadPics() {
3161
3224
  $("[lazy]").each(function () {
3225
+ if (typeof $.fn.lazy !== "function") return;
3162
3226
  let _el = $(this);
3163
3227
  _el.lazy({
3164
3228
  effect: "show",
@@ -4443,6 +4507,429 @@ function ObjFromArr(a, v, k = 'objectId') {
4443
4507
  return obj;
4444
4508
  }
4445
4509
 
4510
+ // V1's <lmlst :config="..." @query="..."> data table/grid component
4511
+ // (core.js:5302-5717), ported verbatim. Initialized by renderPlugins().
4512
+ class __myList {
4513
+ el = null;
4514
+ data = [];
4515
+ config = {
4516
+ viewType: 'dataTable',
4517
+ show: 10,
4518
+ page: 1,
4519
+ order: {
4520
+ column: null,
4521
+ order: "asc",
4522
+ },
4523
+ columns: {},
4524
+ total: 0,
4525
+ pagination: {
4526
+ middle: "",
4527
+ },
4528
+ itemRender: function (k, obj) {
4529
+ let val = "";
4530
+ if (obj.hasOwnProperty(k)) val = obj[k];
4531
+ return val;
4532
+ },
4533
+ gridRender: function (obj) {
4534
+ return obj;
4535
+ },
4536
+ gridPlaceholder: function () {
4537
+ return "---";
4538
+ },
4539
+ itemPlaceholder: function (k) {
4540
+ return "---";
4541
+ },
4542
+ rowClassRender: function (obj) {
4543
+ return "";
4544
+ },
4545
+ gridClassRender: function (obj) {
4546
+ return "";
4547
+ },
4548
+ emptyRender: function (obj) {
4549
+ return `<div class="ov bgb5 op60"><span class="fs26 cc cb pb120">No Data!</span></div>`;
4550
+ }
4551
+ };
4552
+ state = 'loading';
4553
+
4554
+ constructor(el, config) {
4555
+ this.el = el;
4556
+ if (config && typeof config === "object") this.config = { ...this.config, ...config };
4557
+ this.el.trigger("query-list", [this, this.config, "initiated"]);
4558
+ this.render();
4559
+ }
4560
+
4561
+ render() {
4562
+ let self = this;
4563
+ var html = ``;
4564
+ if (this.el) {
4565
+ html = ``;
4566
+
4567
+ if (this.config.viewType.toLowerCase() == 'datagrid') {
4568
+ this.el.removeClass('dataTable').addClass('dataGrid');
4569
+ html +=
4570
+ `
4571
+ <lmlst-body>
4572
+ `;
4573
+
4574
+ // cl(this.state);
4575
+ if (this.state == 'empty') {
4576
+ html += self.config.emptyRender();
4577
+ } else if (this.state == 'loading') {
4578
+ for (let i = 0; i < this.config.show; i++) {
4579
+ html += self.config.gridPlaceholder();
4580
+ }
4581
+ } else {
4582
+ for (let i = 0; i < (this.data.length <= this.config.show ? this.data.length : this.config.show); i++) {
4583
+ const data = this.data[i];
4584
+ html += self.config.gridRender(data);
4585
+ }
4586
+ }
4587
+ html +=
4588
+ `
4589
+ </lmlst-body>
4590
+ `;
4591
+
4592
+ if (this.state != 'empty') {
4593
+ html += `
4594
+ <lmlst-footer class="lh36 r ez-f">
4595
+ <ul style="list-style-type: none;">
4596
+ `;
4597
+
4598
+ const pagings = this.pagination(this.config.page);
4599
+
4600
+
4601
+
4602
+
4603
+
4604
+
4605
+ if (pagings.hasStart) {
4606
+ if (self.config.page > 1) html += `<li page="1"><span class='iconify cc fs14' data-icon='fa-solid:angle-double-left'></span></li>`;
4607
+ else html += `<li><span class='iconify cc fs14' data-icon='fa-solid:angle-double-left'></span></li>`;
4608
+ }
4609
+ if (pagings.hasPrev) {
4610
+ if (self.config.page > 1) html += `<li page="` + (pagings.current - 1 > 0 ? pagings.current - 1 : 1) + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-left'></span></li>`;
4611
+ else html += `<li><span class='iconify cc fs14' data-icon='fa-solid:angle-left'></span></li>`;
4612
+ }
4613
+
4614
+
4615
+
4616
+ // if (pagings.hasStart && self.config.page > 2) html += `<li page="1"><span class='iconify cc fs14' data-icon='fa-solid:angle-double-left'></span></li>`;
4617
+ // if (pagings.hasPrev && self.config.page > 2) html += `<li page="` + (pagings.current - 1 > 0 ? pagings.current - 1 : 1) + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-left'></span></li>`;
4618
+
4619
+ if (pagings.totalpages > 1) pagings.first.forEach(function (page) {
4620
+ html += `<li class='pointer ` + (self.config.page == page ? 'active' : '') + `' page="` + page + `">` + page + `</li>`
4621
+ });
4622
+
4623
+ html += (pagings.totalpages > 5 ? `<li>` + pagings.middle + `</li>` : '');
4624
+
4625
+ if (pagings.totalpages > 1) pagings.last.forEach(function (page) {
4626
+ html += `<li class='pointer ` + (self.config.page == page ? 'active' : '') + `' page="` + page + `">` + page + `</li>`
4627
+ });
4628
+
4629
+
4630
+
4631
+ if (pagings.hasNext) {
4632
+ if (self.config.page != pagings.totalpages) html += `<li page="` + (pagings.current * 1 + 1 < pagings.totalpages ? pagings.current * 1 + 1 : pagings.totalpages) + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-right'></span></li>`;
4633
+ else html += `<li><span class='iconify cc fs14' data-icon='fa-solid:angle-right'></span></li>`;
4634
+ }
4635
+ if (pagings.hasEnd) {
4636
+ if (self.config.page != pagings.totalpages)
4637
+ html += `<li page="` + pagings.totalpages + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-double-right'></span></li>`;
4638
+ else html += `<li><span class='iconify cc fs14' data-icon='fa-solid:angle-double-right'></span></li>`;
4639
+ }
4640
+ // if (pagings.hasNext && self.config.page < pagings.totalpages - 2) html += `<li page="` + (pagings.current * 1 + 1 < pagings.totalpages ? pagings.current * 1 + 1 : pagings.totalpages) + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-right'></span></li>`;
4641
+ // if (pagings.hasEnd && self.config.page < pagings.totalpages - 2) html += `<li page="` + pagings.totalpages + `"><span class='iconify cc fs14' data-icon='fa-solid:angle-double-right'></span></li>`;
4642
+
4643
+
4644
+ html += `</ul>`;
4645
+ html +=
4646
+ `
4647
+ </lmlst-footer>
4648
+ `
4649
+ ;
4650
+ }
4651
+ } else {
4652
+ this.el.removeClass('dataGrid').addClass('dataTable');
4653
+ html +=
4654
+ `
4655
+ <lmlst-header class="ps ez-f" wrapper>
4656
+ <div scsc="list" dgsc class="grab">
4657
+ <ul class="b p0">
4658
+ <li>
4659
+ <div class="tsh ez-f">
4660
+ <div></div>
4661
+ `;
4662
+ for (const k in this.config.columns) {
4663
+ const col = this.config.columns[k];
4664
+ if (!isObject(col)) continue;
4665
+ if (col?.hide) continue;
4666
+
4667
+ html +=
4668
+ `
4669
+ <div class="`+ (col.mini ? 'mini' : '') + `"><span class=vm>` + col.title + ` </span>` + (col?.sort ? `<span ` + 'order="' + (this.config.order.order == 'asc' ? 'desc' : 'asc') + '" column="' + k + '"' + ` class="iconify vm" ` + (k == this.config.order.column ?
4670
+ (this.config.order.order == 'asc'
4671
+ ? ` data-icon="fluent:arrow-up-24-regular" `
4672
+ : ' data-icon="fluent:arrow-down-24-regular" ')
4673
+ : ` data-icon="fluent:arrow-sort-24-regular" `) + `></span>` : ``) + `</div>
4674
+ `;
4675
+ }
4676
+ html +=
4677
+ `
4678
+ <div></div>
4679
+ </div>
4680
+ </li>
4681
+ </ul>
4682
+ </div>
4683
+ </lmlst-header>
4684
+ <lmlst-body scsc="list" dgsc class="`+ (this.state != 'empty' ? 'grab' : '') + `">
4685
+ `;
4686
+
4687
+ // cl(this.state);
4688
+ if (this.state == 'empty') {
4689
+ html += self.config.emptyRender();
4690
+ } else if (this.state == 'loading') {
4691
+
4692
+ for (let i = 0; i < this.config.show; i++) {
4693
+ html +=
4694
+ `
4695
+ <ul class="shimmer">
4696
+ <li>
4697
+ <div class="bgw80 round sh tsh ez-f ` + self.config.rowClassRender({}) + `">
4698
+ <div></div>
4699
+ `;
4700
+
4701
+ for (const k in this.config.columns) {
4702
+ if (!isObject(this.config.columns[k])) continue;
4703
+ if (this.config.columns[k]?.hide) continue;
4704
+ html += `<div class="` + (this.config.columns[k].mini ? 'mini' : '') + `">` + self.config.itemPlaceholder(k) + `</div>`;
4705
+ }
4706
+
4707
+ html +=
4708
+ `
4709
+ <div>
4710
+ <div></div>
4711
+
4712
+ </div>
4713
+ </li>
4714
+ </ul>
4715
+ `;
4716
+ }
4717
+ } else {
4718
+
4719
+ for (let i = 0; i < (this.data.length <= this.config.show ? this.data.length : this.config.show); i++) {
4720
+ const data = this.data[i];
4721
+
4722
+ html +=
4723
+ `
4724
+ <ul class="p0">
4725
+ <li>
4726
+ <div class="bgw80 round sh tsh ez-f ` + self.config.rowClassRender(data) + `">
4727
+ <div></div>
4728
+ `;
4729
+
4730
+ for (const k in this.config.columns) {
4731
+ const col = this.config.columns[k];
4732
+ if (!isObject(col)) continue;
4733
+ if (col?.hide) continue;
4734
+
4735
+ html +=
4736
+ `
4737
+ <div class="`+ (col.mini ? 'mini' : '') + `">` + self.config.itemRender(k, data) + `</div>
4738
+ `;
4739
+ }
4740
+
4741
+ html +=
4742
+ `
4743
+ <div></div>
4744
+ </div>
4745
+ </li>
4746
+ </ul>
4747
+ `;
4748
+ }
4749
+ }
4750
+ html +=
4751
+ `
4752
+ </div>
4753
+ </div>
4754
+ </lmlst-body>
4755
+ `;
4756
+ if (this.state != 'empty') {
4757
+ html += `
4758
+ <lmlst-footer class="ov pf bgw ta sh50 lh36 r z100 ez-f">
4759
+ <ul style="list-style-type: none;">
4760
+ `;
4761
+
4762
+ const pagings = this.pagination(this.config.page);
4763
+
4764
+ if (pagings.hasStart) {
4765
+ if (self.config.page > 2) html += `<li page="1"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.88em" height="1em" viewBox="0 0 448 512" class="vm"><path fill="currentColor" d="m224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4l-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34m192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4l-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8"></path></svg></li>`;
4766
+ else html += `<li><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.88em" height="1em" viewBox="0 0 448 512" class="op40 vm"><path fill="currentColor" d="m224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4l-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34m192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4l-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8"></path></svg></li>`;
4767
+ }
4768
+ if (pagings.hasPrev) {
4769
+ if (self.config.page > 1) html += `<li page="` + (pagings.current - 1 > 0 ? pagings.current - 1 : 1) + `"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.5em" height="1em" viewBox="0 0 256 512" class="vm"><path fill="currentColor" d="m224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4l-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34"></path></svg></li>`;
4770
+ else html += `<li><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.5em" height="1em" viewBox="0 0 256 512" class="op40 vm"><path fill="currentColor" d="m224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4l-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34"></path></svg></li>`;
4771
+ }
4772
+
4773
+ if (pagings.totalpages > 1) pagings.first.forEach(function (page) {
4774
+ html += `<li class='pointer ` + (self.config.page == page ? 'active' : '') + `' page="` + page + `">` + page + `</li>`
4775
+ });
4776
+
4777
+ if (pagings.totalpages > 5) html += `<li>` + pagings.middle + `</li>`;
4778
+
4779
+ if (pagings.totalpages > 1) pagings.last.forEach(function (page) {
4780
+ html += `<li class='pointer ` + (self.config.page == page ? 'active' : '') + `' page="` + page + `">` + page + `</li>`
4781
+ });
4782
+
4783
+
4784
+ if (pagings.hasNext) {
4785
+ if (self.config.page != pagings.totalpages) html += `<li page="` + (pagings.current * 1 + 1 < pagings.totalpages ? pagings.current * 1 + 1 : pagings.totalpages) + `"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.5em" height="1em" viewBox="0 0 256 512" class="vm"><path fill="currentColor" d="m31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34"></path></svg></li>`;
4786
+ else html += `<li><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.5em" height="1em" viewBox="0 0 256 512" class="op40 vm"><path fill="currentColor" d="m31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34"></path></svg></li>`;
4787
+ }
4788
+ if (pagings.hasEnd) {
4789
+ if (self.config.page != pagings.totalpages)
4790
+ html += `<li page="` + pagings.totalpages + `"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.88em" height="1em" viewBox="0 0 448 512" class="vm"><path fill="currentColor" d="m223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34m-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34"></path></svg></li>`;
4791
+ else html += `<li><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="0.88em" height="1em" viewBox="0 0 448 512" class="op40 vm"><path fill="currentColor" d="m223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34m-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34"></path></svg></li>`;
4792
+ }
4793
+
4794
+
4795
+ html += `</ul>`;
4796
+ html +=
4797
+ `
4798
+ </lmlst-footer>
4799
+ `
4800
+ ;
4801
+ }
4802
+ }
4803
+
4804
+ this.el.html(html);
4805
+ globalWatch();
4806
+ }
4807
+ }
4808
+
4809
+ refresh() {
4810
+ this.el.trigger("query-list", [this, this.config, "refresh"]);
4811
+ }
4812
+
4813
+ setPage(p) {
4814
+ this.config.page = p;
4815
+ }
4816
+ setOrder(o) {
4817
+ this.config.order = o;
4818
+ }
4819
+ setLoading() {
4820
+ this.state = 'loading';
4821
+ this.render();
4822
+ }
4823
+ setData(data) {
4824
+ this.data = data;
4825
+ if (data.length) this.state = 'loaded';
4826
+ else this.state = 'empty';
4827
+ this.render();
4828
+ }
4829
+
4830
+ pagination(currPage) {
4831
+ var show = this.config.show;
4832
+ var total = this.config.total;
4833
+ var totalpages = Math.ceil((total) / show);
4834
+
4835
+ if (currPage > totalpages) currPage = totalpages;
4836
+ if (currPage <= 0) currPage = 1;
4837
+ if (currPage > totalpages) currPage = totalpages;
4838
+ var previousPage = currPage - 1;
4839
+ var nextPage = currPage * 1 + 1;
4840
+ let weight = currPage <= totalpages / 2 ? "left" : "right";
4841
+
4842
+ var result = {
4843
+ hasStart: false,
4844
+ hasEnd: false,
4845
+ first: [],
4846
+ totalpages: totalpages,
4847
+ middle: this.config.pagination.middle,
4848
+ last: [],
4849
+ weight: weight,
4850
+ current: currPage,
4851
+ };
4852
+
4853
+ if (totalpages > 5) {
4854
+ result.hasEnd = true;
4855
+ result.hasStart = true;
4856
+ result.hasPrev = true;
4857
+ result.hasNext = true;
4858
+ if (currPage < totalpages * 1 - 2) {
4859
+ if (currPage > 1) {
4860
+ result.first = [previousPage, currPage, nextPage];
4861
+ result.last = [totalpages * 1 - 1, totalpages];
4862
+ } else {
4863
+ result.first = [currPage, nextPage, nextPage * 1 + 1];
4864
+ result.last = [totalpages * 1 - 1, totalpages];
4865
+ }
4866
+ } else {
4867
+ if (currPage >= totalpages) {
4868
+ result.first = [1, 2];
4869
+ result.last = [previousPage * 1 - 1, previousPage, currPage];
4870
+ }
4871
+ else if (currPage == totalpages * 1 - 2) {
4872
+ result.first = [1, 2];
4873
+ result.last = [previousPage, currPage, nextPage, totalpages];
4874
+ } else {
4875
+ result.first = [1, 2];
4876
+ result.last = [previousPage, currPage, nextPage];
4877
+ }
4878
+ }
4879
+ } else if (totalpages > 0 && totalpages <= 5) {
4880
+ for (var i = 0; i < totalpages; i++) {
4881
+ if (
4882
+ weight == "left" &&
4883
+ result.first.length < Math.trunc(totalpages / 2) + 1
4884
+ ) {
4885
+ result.first.push(i * 1 + 1);
4886
+ } else if (
4887
+ weight == "right" &&
4888
+ result.first.length < Math.trunc(totalpages / 2)
4889
+ ) {
4890
+ result.first.push(i * 1 + 1);
4891
+ } else {
4892
+ result.last.push(i * 1 + 1);
4893
+ }
4894
+ }
4895
+ }
4896
+ return result;
4897
+
4898
+ }
4899
+
4900
+ }
4901
+
4902
+ $("body").on("query-list", "lmlst", function (ev, list, config, type) {
4903
+ processEv(ev, $(this), "query", list, config, type);
4904
+ });
4905
+
4906
+ $("body").on("click touch", "[page]", function (ev) {
4907
+ let el = $(this);
4908
+ let host = el.closest("lmlst")[0];
4909
+ if (!host || !host.list) return;
4910
+ let list = host.list;
4911
+ list.setPage(el.attr("page"));
4912
+ list.setLoading();
4913
+ list.el.trigger("query-list", [list, list.config, "page-changed"]);
4914
+ });
4915
+
4916
+ $("body").on("click touch", "[order]", function (ev) {
4917
+ let el = $(this);
4918
+ let host = el.closest("lmlst")[0];
4919
+ if (!host || !host.list) return;
4920
+ let list = host.list;
4921
+ list.setPage(1);
4922
+ list.setOrder({
4923
+ column: el.attr("column") ?? null,
4924
+ order:
4925
+ list.config.order.column != el.attr("column")
4926
+ ? "asc"
4927
+ : el.attr("order") ?? "asc",
4928
+ });
4929
+ list.setLoading();
4930
+ list.el.trigger("query-list", [list, list.config, "order-changed"]);
4931
+ });
4932
+
4446
4933
  // 2026-09-22: the real gesture-dispatch mechanism — tap/doubletap/
4447
4934
  // singletap/taphold/clickhold/tap2/tap2hold/tapstart/tapend/tapmove/
4448
4935
  // swipe(+4 directions)/swipeend. Every one of lstnrs.js's own real
@@ -4464,9 +4951,32 @@ function ObjFromArr(a, v, k = 'objectId') {
4464
4951
  var TAP_MOVE_PX = 12; // max movement to still count as a tap (not a drag/swipe)
4465
4952
  var DOUBLE_TAP_WINDOW_MS = 350; // max gap between two taps to count as a double-tap
4466
4953
  var HOLD_MS = 500; // held this long without moving/releasing = a hold
4467
- var SWIPE_MIN_PX = 30; // minimum movement to count as a swipe
4954
+ // V1's real defaults, read straight from ttsh.js's own options object
4955
+ // (swipe_h_threshold / swipe_v_threshold): 50px PER AXIS, not one
4956
+ // combined minimum. V2 previously used a single 30px for both.
4957
+ var SWIPE_H_THRESHOLD = 50;
4958
+ var SWIPE_V_THRESHOLD = 50;
4468
4959
  var SWIPE_MAX_MS = 1000; // swipes slower than this don't count (a drag, not a swipe)
4469
4960
 
4961
+ // 2026-09-26: V1 lets a page override the swipe distance per element via
4962
+ // data-xthreshold / data-ythreshold, and gives the PARENT's value
4963
+ // precedence over the element's own -- ttsh.js does
4964
+ // `s.parent().data("xthreshold") ? s.parent()... : s.data(...)`, which is
4965
+ // how a swipeable list sets one threshold for all its rows. A value that
4966
+ // parseInt()s to 0/NaN falls back to the default, matching V1's own
4967
+ // `parseInt(c) ? parseInt(c) : default` test.
4968
+ function swipeThreshold(target, attr, dflt) {
4969
+ try {
4970
+ var el = $(target);
4971
+ var raw = el.parent().data(attr);
4972
+ if (!raw) raw = el.data(attr);
4973
+ var n = parseInt(raw, 10);
4974
+ return n ? n : dflt;
4975
+ } catch (e) {
4976
+ return dflt;
4977
+ }
4978
+ }
4979
+
4470
4980
  var active = {}; // pointerId -> tracking state, for tap/hold/swipe
4471
4981
  var activeCount = 0; // real simultaneous-pointer count, for tap2/tap2hold
4472
4982
  var pendingSingleTap = null; // {target, timer}, awaiting the double-tap window
@@ -4555,9 +5065,18 @@ function ObjFromArr(a, v, k = 'objectId') {
4555
5065
  }
4556
5066
 
4557
5067
  if (state.moved && !state.holdFired && dt < SWIPE_MAX_MS) {
4558
- var absDx = Math.abs(dx), absDy = Math.abs(dy);
4559
- if (Math.max(absDx, absDy) >= SWIPE_MIN_PX) {
4560
- var dir = absDx > absDy ? (dx > 0 ? "swiperight" : "swipeleft") : (dy > 0 ? "swipedown" : "swipeup");
5068
+ var hT = swipeThreshold(state.target, "xthreshold", SWIPE_H_THRESHOLD);
5069
+ var vT = swipeThreshold(state.target, "ythreshold", SWIPE_V_THRESHOLD);
5070
+ // V1's own order and precedence (ttsh.js): up, right, down, left,
5071
+ // each overwriting the last, so on a diagonal the later test wins.
5072
+ // Deliberately kept rather than V2's old dominant-axis choice, so a
5073
+ // real V1 page gets the direction it has always gotten.
5074
+ var dir;
5075
+ if (dy < 0 && -dy > vT) dir = "swipeup";
5076
+ if (dx > 0 && dx > hT) dir = "swiperight";
5077
+ if (dy > 0 && dy > vT) dir = "swipedown";
5078
+ if (dx < 0 && -dx > hT) dir = "swipeleft";
5079
+ if (dir) {
4561
5080
  fire(state.target, "swipe");
4562
5081
  fire(state.target, dir);
4563
5082
  fire(state.target, "swipeend");