@pageboard/html 0.10.16 → 0.10.19

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/lib/nouislider.js CHANGED
@@ -714,6 +714,7 @@
714
714
  var hover = entry.indexOf("hover") >= 0;
715
715
  var unconstrained = entry.indexOf("unconstrained") >= 0;
716
716
  var dragAll = entry.indexOf("drag-all") >= 0;
717
+ var smoothSteps = entry.indexOf("smooth-steps") >= 0;
717
718
  if (fixed) {
718
719
  if (parsed.handles !== 2) {
719
720
  throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");
@@ -728,6 +729,7 @@
728
729
  tap: tap || snap,
729
730
  drag: drag,
730
731
  dragAll: dragAll,
732
+ smoothSteps: smoothSteps,
731
733
  fixed: fixed,
732
734
  snap: snap,
733
735
  hover: hover,
@@ -1472,6 +1474,14 @@
1472
1474
  scope_Body.removeEventListener("selectstart", preventDefault);
1473
1475
  }
1474
1476
  }
1477
+ if (options.events.smoothSteps) {
1478
+ data.handleNumbers.forEach(function (handleNumber) {
1479
+ setHandle(handleNumber, scope_Locations[handleNumber], true, true, false, false);
1480
+ });
1481
+ data.handleNumbers.forEach(function (handleNumber) {
1482
+ fireEvent("update", handleNumber);
1483
+ });
1484
+ }
1475
1485
  data.handleNumbers.forEach(function (handleNumber) {
1476
1486
  fireEvent("change", handleNumber);
1477
1487
  fireEvent("set", handleNumber);
@@ -1771,7 +1781,7 @@
1771
1781
  });
1772
1782
  }
1773
1783
  // Split out the handle positioning logic so the Move event can use it, too
1774
- function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {
1784
+ function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue, smoothSteps) {
1775
1785
  var distance;
1776
1786
  // For sliders with multiple handles, limit movement to the other handle.
1777
1787
  // Apply the margin option by adding it to the handle positions.
@@ -1810,7 +1820,9 @@
1810
1820
  to = Math.min(to, distance);
1811
1821
  }
1812
1822
  }
1813
- to = scope_Spectrum.getStep(to);
1823
+ if (!smoothSteps) {
1824
+ to = scope_Spectrum.getStep(to);
1825
+ }
1814
1826
  // Limit percentage to the 0 - 100 range
1815
1827
  to = limit(to);
1816
1828
  // Return false if handle can't move
@@ -1830,6 +1842,7 @@
1830
1842
  var proposals = locations.slice();
1831
1843
  // Store first handle now, so we still have it in case handleNumbers is reversed
1832
1844
  var firstHandle = handleNumbers[0];
1845
+ var smoothSteps = options.events.smoothSteps;
1833
1846
  var b = [!upward, upward];
1834
1847
  var f = [upward, !upward];
1835
1848
  // Copy handleNumbers so we don't change the dataset
@@ -1842,7 +1855,7 @@
1842
1855
  // Step 1: get the maximum percentage that any of the handles can move
1843
1856
  if (handleNumbers.length > 1) {
1844
1857
  handleNumbers.forEach(function (handleNumber, o) {
1845
- var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false);
1858
+ var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false, smoothSteps);
1846
1859
  // Stop if one of the handles can't move.
1847
1860
  if (to === false) {
1848
1861
  proposal = 0;
@@ -1860,7 +1873,8 @@
1860
1873
  var state = false;
1861
1874
  // Step 2: Try to set the handles with the found percentage
1862
1875
  handleNumbers.forEach(function (handleNumber, o) {
1863
- state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;
1876
+ state =
1877
+ setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o], false, smoothSteps) || state;
1864
1878
  });
1865
1879
  // Step 3: If a handle moved, fire events
1866
1880
  if (state) {
@@ -1905,9 +1919,9 @@
1905
1919
  }
1906
1920
  // Test suggested values and apply margin, step.
1907
1921
  // if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
1908
- function setHandle(handleNumber, to, lookBackward, lookForward, exactInput) {
1922
+ function setHandle(handleNumber, to, lookBackward, lookForward, exactInput, smoothSteps) {
1909
1923
  if (!exactInput) {
1910
- to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);
1924
+ to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false, smoothSteps);
1911
1925
  }
1912
1926
  if (to === false) {
1913
1927
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.10.16",
3
+ "version": "0.10.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/ui/menu.css CHANGED
@@ -45,14 +45,20 @@
45
45
  display: flex;
46
46
  flex-direction: column;
47
47
  }
48
+ .right.burger .popup.item > .placer {
49
+ left: 0;
50
+ right:0;
51
+ }
48
52
  .right.popup.item > .placer > div {
49
53
  left:auto;
50
54
  right:0;
51
55
  }
56
+ .fixed.popup.item {
57
+ position:static !important;
58
+ }
52
59
  .fixed.popup.item > .placer > div {
53
- position:fixed;
54
- max-width: 100%;
55
- max-height: 100%;
60
+ max-width: 100vw;
61
+ margin-top: -1rem;
56
62
  }
57
63
  .center.popup.item > .placer > div {
58
64
  transform: translateX(-50%);
@@ -79,7 +85,6 @@
79
85
 
80
86
  /* menu_group */
81
87
  element-menu {
82
- position: relative;
83
88
  flex-shrink: 1;
84
89
  }
85
90
  .ui.menu:not(.vertical) > element-menu {
@@ -96,12 +101,12 @@ element-menu > [block-content="items"] {
96
101
  display:flex;
97
102
  }
98
103
  element-menu.burger > [block-content="items"] {
99
- position: fixed;
100
104
  left:0;
101
105
  }
102
106
  element-menu.burger.right > [block-content="items"] {
103
- left:auto;
104
- right: 0;
107
+ position: absolute;
108
+ pointer-events: none;
109
+ height: 0;
105
110
  }
106
111
 
107
112
  element-menu:not(.burger) > .item {
@@ -114,6 +119,9 @@ element-menu.burger .placer .title {
114
119
  element-menu.burger > .item .popup.item {
115
120
  display:block;
116
121
  }
122
+ .ui.menu [block-type="menu_item_popup"] {
123
+ position:initial !important;
124
+ }
117
125
  element-menu.burger .placer .popup.active .title {
118
126
  margin-bottom:0.5em;
119
127
  }
@@ -123,6 +131,10 @@ element-menu.burger > [block-content="items"] > * {
123
131
  element-menu.burger .popup.item.active > .placer > div {
124
132
  display:block;
125
133
  }
134
+ element-menu.burger .popup.item > .placer > div {
135
+ left: 0 !important;
136
+ right: 0 !important;
137
+ }
126
138
  element-menu.burger > .item .dropdown.item:hover > .menu,
127
139
  element-menu.burger > .item .popup.item:hover > .placer > div {
128
140
  display:none !important;
@@ -135,8 +147,8 @@ element-menu.burger > .item .dropdown.item.active > .menu {
135
147
  }
136
148
 
137
149
  element-menu.burger > .item .popup.item.active > .placer > div {
138
- display:block !important;
139
- position:relative;
150
+ display: block !important;
151
+ position: relative;
140
152
  }
141
153
  element-menu.burger > .item:hover > .popup.item {
142
154
  display:block;
@@ -147,7 +159,7 @@ element-menu.burger > .item .placer .menu .ui.dropdown {
147
159
  }
148
160
 
149
161
  element-menu.burger > .item .popup.item > .placer {
150
- position:relative;
162
+ position: relative;
151
163
  }
152
164
  element-menu.burger > .item .popup.item > .placer > div > .grid {
153
165
  border:0 !important;
@@ -159,9 +171,7 @@ element-menu.burger > .popup > .icon {
159
171
  font-weight: bold;
160
172
  font-family: sans-serif;
161
173
  }
162
- element-menu.burger > .popup > .placer > .menu {
163
- right:auto; /* disables the right:0 given by .popup > .placer > div */
164
- }
174
+
165
175
 
166
176
  @media screen and (max-width: 768px) {
167
177
  .ui.menu [block-type="menu_item_text"] {
package/ui/menu.js CHANGED
@@ -33,7 +33,7 @@ class HTMLElementMenu extends VirtualHTMLElement {
33
33
  const styles = window.getComputedStyle(this);
34
34
  const parentWidth = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight) + this.offsetWidth;
35
35
  const menuWidth = menu.offsetWidth;
36
- this.classList.toggle('burger', parentWidth <= menuWidth);
36
+ this.classList.toggle('burger', menuWidth >= parentWidth);
37
37
  });
38
38
  });
39
39
  this.observer.observe(this.parentNode);
@@ -55,9 +55,9 @@ class HTMLElementMenu extends VirtualHTMLElement {
55
55
  tosser.classList.add('inactive');
56
56
  tosser.blur();
57
57
  } else {
58
- const padding = this.offsetTop + this.offsetHeight;
59
- const menu = tosser.lastElementChild.lastElementChild;
60
- menu.style.maxHeight = `calc(100% - ${padding}px)`;
58
+ const placer = tosser.lastElementChild;
59
+ const padding = placer.offsetTop;
60
+ placer.lastElementChild.style.maxHeight = `calc(100vh - ${padding}px)`;
61
61
  }
62
62
  } else if (item) {
63
63
  this.active = item != this.active ? item : null;