@adam-milo/ui 1.0.24 → 1.0.25

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.
Files changed (158) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +3 -1
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +1 -1
  5. package/dist/index11.cjs +1 -1
  6. package/dist/index11.js +1 -1
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +1 -1
  9. package/dist/index13.cjs +1 -1
  10. package/dist/index13.js +1 -1
  11. package/dist/index14.cjs +1 -1
  12. package/dist/index14.js +1 -1
  13. package/dist/index15.cjs +1 -1
  14. package/dist/index15.js +2 -2
  15. package/dist/index16.cjs +1 -1
  16. package/dist/index16.js +1 -1
  17. package/dist/index17.cjs +1 -1
  18. package/dist/index17.js +1 -1
  19. package/dist/index18.cjs +1 -1
  20. package/dist/index18.js +36 -12
  21. package/dist/index19.cjs +1 -0
  22. package/dist/index19.js +14 -0
  23. package/dist/index2.cjs +1 -1
  24. package/dist/index2.js +1 -1
  25. package/dist/index21.cjs +1 -1
  26. package/dist/index21.js +20 -299
  27. package/dist/index22.cjs +1 -1
  28. package/dist/index22.js +298 -13
  29. package/dist/index23.cjs +1 -0
  30. package/dist/index23.js +16 -0
  31. package/dist/{index25.cjs → index26.cjs} +1 -1
  32. package/dist/{index25.js → index26.js} +21 -21
  33. package/dist/index3.cjs +1 -1
  34. package/dist/index3.js +2 -2
  35. package/dist/index38.cjs +1 -1
  36. package/dist/index38.js +18 -3
  37. package/dist/index4.cjs +1 -1
  38. package/dist/index4.js +1 -1
  39. package/dist/index40.cjs +1 -1
  40. package/dist/index40.js +3 -67
  41. package/dist/index41.cjs +1 -1
  42. package/dist/index41.js +6 -34
  43. package/dist/index42.cjs +1 -1
  44. package/dist/index42.js +64 -58
  45. package/dist/index43.cjs +1 -1
  46. package/dist/index43.js +35 -6
  47. package/dist/index44.cjs +1 -1
  48. package/dist/index44.js +53 -201
  49. package/dist/index45.cjs +1 -1
  50. package/dist/index45.js +6 -25
  51. package/dist/index46.cjs +1 -1
  52. package/dist/index46.js +190 -186
  53. package/dist/index47.cjs +1 -1
  54. package/dist/index47.js +24 -9
  55. package/dist/index48.cjs +1 -1
  56. package/dist/index48.js +193 -278
  57. package/dist/index49.cjs +1 -1
  58. package/dist/index49.js +11 -15
  59. package/dist/index5.cjs +1 -1
  60. package/dist/index5.js +1 -1
  61. package/dist/index50.cjs +1 -1
  62. package/dist/index50.js +287 -37
  63. package/dist/index51.cjs +1 -1
  64. package/dist/index51.js +14 -85
  65. package/dist/index52.cjs +1 -1
  66. package/dist/index52.js +38 -9
  67. package/dist/index53.cjs +1 -1
  68. package/dist/index53.js +80 -62
  69. package/dist/index54.cjs +1 -1
  70. package/dist/index54.js +11 -3
  71. package/dist/index55.cjs +1 -1
  72. package/dist/index55.js +66 -9
  73. package/dist/index56.cjs +1 -1
  74. package/dist/index56.js +3 -31
  75. package/dist/index57.cjs +1 -1
  76. package/dist/index57.js +12 -120
  77. package/dist/index58.cjs +1 -1
  78. package/dist/index58.js +30 -7
  79. package/dist/index59.cjs +1 -1
  80. package/dist/index59.js +118 -13
  81. package/dist/index6.cjs +1 -1
  82. package/dist/index6.js +2 -2
  83. package/dist/index60.cjs +1 -1
  84. package/dist/index60.js +7 -293
  85. package/dist/index61.cjs +1 -1
  86. package/dist/index61.js +14 -22
  87. package/dist/index62.cjs +1 -1
  88. package/dist/index62.js +291 -33
  89. package/dist/index63.cjs +1 -1
  90. package/dist/index63.js +22 -622
  91. package/dist/index64.cjs +1 -1
  92. package/dist/index64.js +35 -35
  93. package/dist/index65.cjs +1 -1
  94. package/dist/index65.js +620 -33
  95. package/dist/index66.cjs +1 -1
  96. package/dist/index66.js +37 -5
  97. package/dist/index67.cjs +1 -1
  98. package/dist/index67.js +36 -8
  99. package/dist/index68.cjs +1 -1
  100. package/dist/index68.js +5 -3
  101. package/dist/index69.cjs +1 -1
  102. package/dist/index69.js +8 -33
  103. package/dist/index7.cjs +1 -1
  104. package/dist/index7.js +1 -1
  105. package/dist/index70.cjs +1 -1
  106. package/dist/index70.js +3 -178
  107. package/dist/index71.cjs +1 -1
  108. package/dist/index71.js +31 -17
  109. package/dist/index72.cjs +1 -1
  110. package/dist/index72.js +165 -706
  111. package/dist/index73.cjs +1 -1
  112. package/dist/index73.js +16 -149
  113. package/dist/index74.cjs +1 -1
  114. package/dist/index74.js +697 -149
  115. package/dist/index75.cjs +1 -1
  116. package/dist/index75.js +146 -80
  117. package/dist/index76.cjs +1 -1
  118. package/dist/index76.js +170 -44
  119. package/dist/index77.cjs +1 -1
  120. package/dist/index77.js +44 -10
  121. package/dist/index78.cjs +1 -1
  122. package/dist/index78.js +11 -17
  123. package/dist/index79.cjs +1 -1
  124. package/dist/index79.js +14 -97
  125. package/dist/index8.cjs +1 -1
  126. package/dist/index8.js +1 -1
  127. package/dist/index80.cjs +1 -1
  128. package/dist/index80.js +99 -8
  129. package/dist/index81.cjs +1 -1
  130. package/dist/index81.js +82 -23
  131. package/dist/index82.cjs +1 -1
  132. package/dist/index82.js +9 -14
  133. package/dist/index83.cjs +1 -1
  134. package/dist/index83.js +25 -44
  135. package/dist/index84.cjs +1 -1
  136. package/dist/index84.js +33 -5
  137. package/dist/index85.cjs +1 -1
  138. package/dist/index85.js +12 -33
  139. package/dist/index86.cjs +1 -0
  140. package/dist/index86.js +48 -0
  141. package/dist/index87.cjs +1 -0
  142. package/dist/index87.js +9 -0
  143. package/dist/index9.cjs +1 -1
  144. package/dist/index9.js +2 -2
  145. package/dist/src/components/layout/container/Container.component.d.ts +26 -0
  146. package/dist/src/components/layout/container/Container.component.d.ts.map +1 -0
  147. package/dist/src/index.d.ts +2 -0
  148. package/dist/src/index.d.ts.map +1 -1
  149. package/dist/style.css +1 -1
  150. package/package.json +1 -1
  151. package/dist/index20.cjs +0 -1
  152. package/dist/index20.js +0 -22
  153. package/dist/index36.cjs +0 -1
  154. package/dist/index36.js +0 -21
  155. package/dist/index39.cjs +0 -1
  156. package/dist/index39.js +0 -11
  157. /package/dist/{index33.cjs → index34.cjs} +0 -0
  158. /package/dist/{index33.js → index34.js} +0 -0
package/dist/index79.js CHANGED
@@ -1,102 +1,19 @@
1
- var alwaysContainsScroll = function(node) {
2
- return node.tagName === "TEXTAREA";
3
- };
4
- var elementCanBeScrolled = function(node, overflow) {
5
- if (!(node instanceof Element)) {
6
- return false;
7
- }
8
- var styles = window.getComputedStyle(node);
9
- return (
10
- // not-not-scrollable
11
- styles[overflow] !== "hidden" && // contains scroll inside self
12
- !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
13
- );
14
- };
15
- var elementCouldBeVScrolled = function(node) {
16
- return elementCanBeScrolled(node, "overflowY");
17
- };
18
- var elementCouldBeHScrolled = function(node) {
19
- return elementCanBeScrolled(node, "overflowX");
20
- };
21
- var locationCouldBeScrolled = function(axis, node) {
22
- var ownerDocument = node.ownerDocument;
23
- var current = node;
24
- do {
25
- if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
26
- current = current.host;
27
- }
28
- var isScrollable = elementCouldBeScrolled(axis, current);
29
- if (isScrollable) {
30
- var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
31
- if (scrollHeight > clientHeight) {
1
+ var passiveSupported = false;
2
+ if (typeof window !== "undefined") {
3
+ try {
4
+ var options = Object.defineProperty({}, "passive", {
5
+ get: function() {
6
+ passiveSupported = true;
32
7
  return true;
33
8
  }
34
- }
35
- current = current.parentNode;
36
- } while (current && current !== ownerDocument.body);
37
- return false;
38
- };
39
- var getVScrollVariables = function(_a) {
40
- var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
41
- return [
42
- scrollTop,
43
- scrollHeight,
44
- clientHeight
45
- ];
46
- };
47
- var getHScrollVariables = function(_a) {
48
- var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
49
- return [
50
- scrollLeft,
51
- scrollWidth,
52
- clientWidth
53
- ];
54
- };
55
- var elementCouldBeScrolled = function(axis, node) {
56
- return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
57
- };
58
- var getScrollVariables = function(axis, node) {
59
- return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
60
- };
61
- var getDirectionFactor = function(axis, direction) {
62
- return axis === "h" && direction === "rtl" ? -1 : 1;
63
- };
64
- var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
65
- var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
66
- var delta = directionFactor * sourceDelta;
67
- var target = event.target;
68
- var targetInLock = endTarget.contains(target);
69
- var shouldCancelScroll = false;
70
- var isDeltaPositive = delta > 0;
71
- var availableScroll = 0;
72
- var availableScrollTop = 0;
73
- do {
74
- if (!target) {
75
- break;
76
- }
77
- var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
78
- var elementScroll = scroll_1 - capacity - directionFactor * position;
79
- if (position || elementScroll) {
80
- if (elementCouldBeScrolled(axis, target)) {
81
- availableScroll += elementScroll;
82
- availableScrollTop += position;
83
- }
84
- }
85
- var parent_1 = target.parentNode;
86
- target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
87
- } while (
88
- // portaled content
89
- !targetInLock && target !== document.body || // self content
90
- targetInLock && (endTarget.contains(target) || endTarget === target)
91
- );
92
- if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
93
- shouldCancelScroll = true;
94
- } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
95
- shouldCancelScroll = true;
9
+ });
10
+ window.addEventListener("test", options, options);
11
+ window.removeEventListener("test", options, options);
12
+ } catch (err) {
13
+ passiveSupported = false;
96
14
  }
97
- return shouldCancelScroll;
98
- };
15
+ }
16
+ var nonPassive = passiveSupported ? { passive: false } : false;
99
17
  export {
100
- handleScroll,
101
- locationCouldBeScrolled
18
+ nonPassive
102
19
  };
package/dist/index8.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),a=require("./index18.cjs");;/* empty css */const d=r.forwardRef(({label:d,error:i,helperText:t,className:s,id:l,required:c,disabled:o,checked:n,"data-cy":p,"data-testid":u,...b},h)=>{const x=r.useId(),y=l||x,_=`${y}-error`,m=`${y}-helper`,$=p||"radio",j=u||"radio",N=r.useRef(null),f=r.useCallback(e=>{N.current=e,h&&("function"==typeof h?h(e):"current"in h&&(h.current=e))},[h]),q=d&&c&&!d.includes("*")?`${d} *`:d;return e.jsxs("div",{className:a.cn("radio-wrapper",o&&"radio-wrapper--disabled"),"data-cy":`${$}-wrapper`,"data-testid":`${j}-wrapper`,children:[e.jsxs("div",{className:"radio__container",children:[e.jsx("input",{ref:f,id:y,type:"radio",checked:n,className:a.cn("radio__input",i&&"radio__input--error",s),"aria-describedby":i?_:t?m:void 0,"data-cy":$,"data-testid":j,disabled:o,required:c,...b}),d&&e.jsx("label",{htmlFor:y,className:"radio__label","data-cy":`${$}-label`,"data-testid":`${j}-label`,children:q})]}),i&&e.jsx("span",{id:_,className:"radio__error",role:"alert","data-cy":`${$}-error`,"data-testid":`${j}-error`,children:i}),t&&!i&&e.jsx("span",{id:m,className:"radio__helper","data-cy":`${$}-helper`,"data-testid":`${j}-helper`,children:t})]})});d.displayName="Radio",exports.Radio=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),a=require("./index19.cjs");;/* empty css */const d=r.forwardRef(({label:d,error:i,helperText:t,className:s,id:l,required:c,disabled:o,checked:n,"data-cy":p,"data-testid":u,...b},h)=>{const x=r.useId(),y=l||x,_=`${y}-error`,m=`${y}-helper`,$=p||"radio",j=u||"radio",N=r.useRef(null),f=r.useCallback(e=>{N.current=e,h&&("function"==typeof h?h(e):"current"in h&&(h.current=e))},[h]),q=d&&c&&!d.includes("*")?`${d} *`:d;return e.jsxs("div",{className:a.cn("radio-wrapper",o&&"radio-wrapper--disabled"),"data-cy":`${$}-wrapper`,"data-testid":`${j}-wrapper`,children:[e.jsxs("div",{className:"radio__container",children:[e.jsx("input",{ref:f,id:y,type:"radio",checked:n,className:a.cn("radio__input",i&&"radio__input--error",s),"aria-describedby":i?_:t?m:void 0,"data-cy":$,"data-testid":j,disabled:o,required:c,...b}),d&&e.jsx("label",{htmlFor:y,className:"radio__label","data-cy":`${$}-label`,"data-testid":`${j}-label`,children:q})]}),i&&e.jsx("span",{id:_,className:"radio__error",role:"alert","data-cy":`${$}-error`,"data-testid":`${j}-error`,children:i}),t&&!i&&e.jsx("span",{id:m,className:"radio__helper","data-cy":`${$}-helper`,"data-testid":`${j}-helper`,children:t})]})});d.displayName="Radio",exports.Radio=d;
package/dist/index8.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, useRef, useCallback } from "react";
3
- import { cn } from "./index18.js";
3
+ import { cn } from "./index19.js";
4
4
  /* empty css */
5
5
  const Radio = forwardRef(
6
6
  ({
package/dist/index80.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.assignRef=function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=function(t,e){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return"hidden"!==o[e]&&!(o.overflowY===o.overflowX&&!function(t){return"TEXTAREA"===t.tagName}(t)&&"visible"===o[e])},e=function(e,o){return"v"===e?function(e){return t(e,"overflowY")}(o):function(e){return t(e,"overflowX")}(o)},o=function(t,e){return"v"===t?[(o=e).scrollTop,o.scrollHeight,o.clientHeight]:function(t){return[t.scrollLeft,t.scrollWidth,t.clientWidth]}(e);var o};exports.handleScroll=function(t,n,r,i,l){var u=function(t,e){return"h"===t&&"rtl"===e?-1:1}(t,window.getComputedStyle(n).direction),a=u*i,c=r.target,d=n.contains(c),f=!1,s=a>0,v=0,h=0;do{if(!c)break;var w=o(t,c),p=w[0],b=w[1]-w[2]-u*p;(p||b)&&e(t,c)&&(v+=b,h+=p);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!d&&c!==document.body||d&&(n.contains(c)||n===c));return(s&&Math.abs(v)<1||!s&&Math.abs(h)<1)&&(f=!0),f},exports.locationCouldBeScrolled=function(t,n){var r=n.ownerDocument,i=n;do{if("undefined"!=typeof ShadowRoot&&i instanceof ShadowRoot&&(i=i.host),e(t,i)){var l=o(t,i);if(l[1]>l[2])return!0}i=i.parentNode}while(i&&i!==r.body);return!1};
package/dist/index80.js CHANGED
@@ -1,11 +1,102 @@
1
- function assignRef(ref, value) {
2
- if (typeof ref === "function") {
3
- ref(value);
4
- } else if (ref) {
5
- ref.current = value;
1
+ var alwaysContainsScroll = function(node) {
2
+ return node.tagName === "TEXTAREA";
3
+ };
4
+ var elementCanBeScrolled = function(node, overflow) {
5
+ if (!(node instanceof Element)) {
6
+ return false;
7
+ }
8
+ var styles = window.getComputedStyle(node);
9
+ return (
10
+ // not-not-scrollable
11
+ styles[overflow] !== "hidden" && // contains scroll inside self
12
+ !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
13
+ );
14
+ };
15
+ var elementCouldBeVScrolled = function(node) {
16
+ return elementCanBeScrolled(node, "overflowY");
17
+ };
18
+ var elementCouldBeHScrolled = function(node) {
19
+ return elementCanBeScrolled(node, "overflowX");
20
+ };
21
+ var locationCouldBeScrolled = function(axis, node) {
22
+ var ownerDocument = node.ownerDocument;
23
+ var current = node;
24
+ do {
25
+ if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
26
+ current = current.host;
27
+ }
28
+ var isScrollable = elementCouldBeScrolled(axis, current);
29
+ if (isScrollable) {
30
+ var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
31
+ if (scrollHeight > clientHeight) {
32
+ return true;
33
+ }
34
+ }
35
+ current = current.parentNode;
36
+ } while (current && current !== ownerDocument.body);
37
+ return false;
38
+ };
39
+ var getVScrollVariables = function(_a) {
40
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
41
+ return [
42
+ scrollTop,
43
+ scrollHeight,
44
+ clientHeight
45
+ ];
46
+ };
47
+ var getHScrollVariables = function(_a) {
48
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
49
+ return [
50
+ scrollLeft,
51
+ scrollWidth,
52
+ clientWidth
53
+ ];
54
+ };
55
+ var elementCouldBeScrolled = function(axis, node) {
56
+ return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
57
+ };
58
+ var getScrollVariables = function(axis, node) {
59
+ return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
60
+ };
61
+ var getDirectionFactor = function(axis, direction) {
62
+ return axis === "h" && direction === "rtl" ? -1 : 1;
63
+ };
64
+ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
65
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
66
+ var delta = directionFactor * sourceDelta;
67
+ var target = event.target;
68
+ var targetInLock = endTarget.contains(target);
69
+ var shouldCancelScroll = false;
70
+ var isDeltaPositive = delta > 0;
71
+ var availableScroll = 0;
72
+ var availableScrollTop = 0;
73
+ do {
74
+ if (!target) {
75
+ break;
76
+ }
77
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
78
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
79
+ if (position || elementScroll) {
80
+ if (elementCouldBeScrolled(axis, target)) {
81
+ availableScroll += elementScroll;
82
+ availableScrollTop += position;
83
+ }
84
+ }
85
+ var parent_1 = target.parentNode;
86
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
87
+ } while (
88
+ // portaled content
89
+ !targetInLock && target !== document.body || // self content
90
+ targetInLock && (endTarget.contains(target) || endTarget === target)
91
+ );
92
+ if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
93
+ shouldCancelScroll = true;
94
+ } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
95
+ shouldCancelScroll = true;
6
96
  }
7
- return ref;
8
- }
97
+ return shouldCancelScroll;
98
+ };
9
99
  export {
10
- assignRef
100
+ handleScroll,
101
+ locationCouldBeScrolled
11
102
  };
package/dist/index81.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useCallbackRef=function(a,r){var t=e.useState(function(){return{value:a,callback:r,facade:{get current(){return t.value},set current(e){var a=t.value;a!==e&&(t.value=e,t.callback(e,a))}}}})[0];return t.callback=r,t.facade};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index66.cjs");function r(n){return n}exports.createSidecarMedium=function(e){void 0===e&&(e={});var t=function(n,e){void 0===e&&(e=r);var t=[],u=!1;return{read:function(){if(u)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:n},useMedium:function(n){var r=e(n,u);return t.push(r),function(){t=t.filter(function(n){return n!==r})}},assignSyncMedium:function(n){for(u=!0;t.length;){var r=t;t=[],r.forEach(n)}t={push:function(r){return n(r)},filter:function(){return t}}},assignMedium:function(n){u=!0;var r=[];if(t.length){var e=t;t=[],e.forEach(n),r=t}var i=function(){var e=r;r=[],e.forEach(n)},o=function(){return Promise.resolve().then(i)};o(),t={push:function(n){r.push(n),o()},filter:function(n){return r=r.filter(n),t}}}}}(null);return t.options=n.__assign({async:!0,ssr:!1},e),t};
package/dist/index81.js CHANGED
@@ -1,29 +1,88 @@
1
- import { useState } from "react";
2
- function useCallbackRef(initialValue, callback) {
3
- var ref = useState(function() {
4
- return {
5
- // value
6
- value: initialValue,
7
- // last callback
8
- callback,
9
- // "memoized" public interface
10
- facade: {
11
- get current() {
12
- return ref.value;
1
+ import { __assign } from "./index66.js";
2
+ function ItoI(a) {
3
+ return a;
4
+ }
5
+ function innerCreateMedium(defaults, middleware) {
6
+ if (middleware === void 0) {
7
+ middleware = ItoI;
8
+ }
9
+ var buffer = [];
10
+ var assigned = false;
11
+ var medium = {
12
+ read: function() {
13
+ if (assigned) {
14
+ throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
15
+ }
16
+ if (buffer.length) {
17
+ return buffer[buffer.length - 1];
18
+ }
19
+ return defaults;
20
+ },
21
+ useMedium: function(data) {
22
+ var item = middleware(data, assigned);
23
+ buffer.push(item);
24
+ return function() {
25
+ buffer = buffer.filter(function(x) {
26
+ return x !== item;
27
+ });
28
+ };
29
+ },
30
+ assignSyncMedium: function(cb) {
31
+ assigned = true;
32
+ while (buffer.length) {
33
+ var cbs = buffer;
34
+ buffer = [];
35
+ cbs.forEach(cb);
36
+ }
37
+ buffer = {
38
+ push: function(x) {
39
+ return cb(x);
13
40
  },
14
- set current(value) {
15
- var last = ref.value;
16
- if (last !== value) {
17
- ref.value = value;
18
- ref.callback(value, last);
19
- }
41
+ filter: function() {
42
+ return buffer;
20
43
  }
44
+ };
45
+ },
46
+ assignMedium: function(cb) {
47
+ assigned = true;
48
+ var pendingQueue = [];
49
+ if (buffer.length) {
50
+ var cbs = buffer;
51
+ buffer = [];
52
+ cbs.forEach(cb);
53
+ pendingQueue = buffer;
21
54
  }
22
- };
23
- })[0];
24
- ref.callback = callback;
25
- return ref.facade;
55
+ var executeQueue = function() {
56
+ var cbs2 = pendingQueue;
57
+ pendingQueue = [];
58
+ cbs2.forEach(cb);
59
+ };
60
+ var cycle = function() {
61
+ return Promise.resolve().then(executeQueue);
62
+ };
63
+ cycle();
64
+ buffer = {
65
+ push: function(x) {
66
+ pendingQueue.push(x);
67
+ cycle();
68
+ },
69
+ filter: function(filter) {
70
+ pendingQueue = pendingQueue.filter(filter);
71
+ return buffer;
72
+ }
73
+ };
74
+ }
75
+ };
76
+ return medium;
77
+ }
78
+ function createSidecarMedium(options) {
79
+ if (options === void 0) {
80
+ options = {};
81
+ }
82
+ var medium = innerCreateMedium(null);
83
+ medium.options = __assign({ async: true, ssr: false }, options);
84
+ return medium;
26
85
  }
27
86
  export {
28
- useCallbackRef
87
+ createSidecarMedium
29
88
  };
package/dist/index82.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index83.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);exports.styleHookSingleton=function(){var e=t.stylesheetSingleton();return function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.assignRef=function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e};
package/dist/index82.js CHANGED
@@ -1,16 +1,11 @@
1
- import * as React from "react";
2
- import { stylesheetSingleton } from "./index83.js";
3
- var styleHookSingleton = function() {
4
- var sheet = stylesheetSingleton();
5
- return function(styles, isDynamic) {
6
- React.useEffect(function() {
7
- sheet.add(styles);
8
- return function() {
9
- sheet.remove();
10
- };
11
- }, [styles && isDynamic]);
12
- };
13
- };
1
+ function assignRef(ref, value) {
2
+ if (typeof ref === "function") {
3
+ ref(value);
4
+ } else if (ref) {
5
+ ref.current = value;
6
+ }
7
+ return ref;
8
+ }
14
9
  export {
15
- styleHookSingleton
10
+ assignRef
16
11
  };
package/dist/index83.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index84.cjs");exports.stylesheetSingleton=function(){var t=0,n=null;return{add:function(o){var r,u;0==t&&(n=function(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=e.getNonce();return n&&t.setAttribute("nonce",n),t}())&&(u=o,(r=n).styleSheet?r.styleSheet.cssText=u:r.appendChild(document.createTextNode(u)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useCallbackRef=function(a,r){var t=e.useState(function(){return{value:a,callback:r,facade:{get current(){return t.value},set current(e){var a=t.value;a!==e&&(t.value=e,t.callback(e,a))}}}})[0];return t.callback=r,t.facade};
package/dist/index83.js CHANGED
@@ -1,48 +1,29 @@
1
- import { getNonce } from "./index84.js";
2
- function makeStyleTag() {
3
- if (!document)
4
- return null;
5
- var tag = document.createElement("style");
6
- tag.type = "text/css";
7
- var nonce = getNonce();
8
- if (nonce) {
9
- tag.setAttribute("nonce", nonce);
10
- }
11
- return tag;
12
- }
13
- function injectStyles(tag, css) {
14
- if (tag.styleSheet) {
15
- tag.styleSheet.cssText = css;
16
- } else {
17
- tag.appendChild(document.createTextNode(css));
18
- }
19
- }
20
- function insertStyleTag(tag) {
21
- var head = document.head || document.getElementsByTagName("head")[0];
22
- head.appendChild(tag);
23
- }
24
- var stylesheetSingleton = function() {
25
- var counter = 0;
26
- var stylesheet = null;
27
- return {
28
- add: function(style) {
29
- if (counter == 0) {
30
- if (stylesheet = makeStyleTag()) {
31
- injectStyles(stylesheet, style);
32
- insertStyleTag(stylesheet);
1
+ import { useState } from "react";
2
+ function useCallbackRef(initialValue, callback) {
3
+ var ref = useState(function() {
4
+ return {
5
+ // value
6
+ value: initialValue,
7
+ // last callback
8
+ callback,
9
+ // "memoized" public interface
10
+ facade: {
11
+ get current() {
12
+ return ref.value;
13
+ },
14
+ set current(value) {
15
+ var last = ref.value;
16
+ if (last !== value) {
17
+ ref.value = value;
18
+ ref.callback(value, last);
19
+ }
33
20
  }
34
21
  }
35
- counter++;
36
- },
37
- remove: function() {
38
- counter--;
39
- if (!counter && stylesheet) {
40
- stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
41
- stylesheet = null;
42
- }
43
- }
44
- };
45
- };
22
+ };
23
+ })[0];
24
+ ref.callback = callback;
25
+ return ref.facade;
26
+ }
46
27
  export {
47
- stylesheetSingleton
28
+ useCallbackRef
48
29
  };
package/dist/index84.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.getNonce=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t={left:0,top:0,right:0,gap:0},n=function(t){return parseInt(t||"",10)||0};exports.getGapWidth=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return t;var i=function(t){var e=window.getComputedStyle(document.body),i=e["padding"===t?"paddingLeft":"marginLeft"],d=e["padding"===t?"paddingTop":"marginTop"],r=e["padding"===t?"paddingRight":"marginRight"];return[n(i),n(d),n(r)]}(e),d=document.documentElement.clientWidth,r=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,r-d+i[2]-i[0])}},exports.zeroGap=t;
package/dist/index84.js CHANGED
@@ -1,9 +1,37 @@
1
- var getNonce = function() {
2
- if (typeof __webpack_nonce__ !== "undefined") {
3
- return __webpack_nonce__;
1
+ var zeroGap = {
2
+ left: 0,
3
+ top: 0,
4
+ right: 0,
5
+ gap: 0
6
+ };
7
+ var parse = function(x) {
8
+ return parseInt(x || "", 10) || 0;
9
+ };
10
+ var getOffset = function(gapMode) {
11
+ var cs = window.getComputedStyle(document.body);
12
+ var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
13
+ var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
14
+ var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
15
+ return [parse(left), parse(top), parse(right)];
16
+ };
17
+ var getGapWidth = function(gapMode) {
18
+ if (gapMode === void 0) {
19
+ gapMode = "margin";
20
+ }
21
+ if (typeof window === "undefined") {
22
+ return zeroGap;
4
23
  }
5
- return void 0;
24
+ var offsets = getOffset(gapMode);
25
+ var documentWidth = document.documentElement.clientWidth;
26
+ var windowWidth = window.innerWidth;
27
+ return {
28
+ left: offsets[0],
29
+ top: offsets[1],
30
+ right: offsets[2],
31
+ gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
32
+ };
6
33
  };
7
34
  export {
8
- getNonce
35
+ getGapWidth,
36
+ zeroGap
9
37
  };
package/dist/index85.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t={left:0,top:0,right:0,gap:0},n=function(t){return parseInt(t||"",10)||0};exports.getGapWidth=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return t;var i=function(t){var e=window.getComputedStyle(document.body),i=e["padding"===t?"paddingLeft":"marginLeft"],d=e["padding"===t?"paddingTop":"marginTop"],r=e["padding"===t?"paddingRight":"marginRight"];return[n(i),n(d),n(r)]}(e),d=document.documentElement.clientWidth,r=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,r-d+i[2]-i[0])}},exports.zeroGap=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index86.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);exports.styleHookSingleton=function(){var e=t.stylesheetSingleton();return function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};
package/dist/index85.js CHANGED
@@ -1,37 +1,16 @@
1
- var zeroGap = {
2
- left: 0,
3
- top: 0,
4
- right: 0,
5
- gap: 0
6
- };
7
- var parse = function(x) {
8
- return parseInt(x || "", 10) || 0;
9
- };
10
- var getOffset = function(gapMode) {
11
- var cs = window.getComputedStyle(document.body);
12
- var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
13
- var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
14
- var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
15
- return [parse(left), parse(top), parse(right)];
16
- };
17
- var getGapWidth = function(gapMode) {
18
- if (gapMode === void 0) {
19
- gapMode = "margin";
20
- }
21
- if (typeof window === "undefined") {
22
- return zeroGap;
23
- }
24
- var offsets = getOffset(gapMode);
25
- var documentWidth = document.documentElement.clientWidth;
26
- var windowWidth = window.innerWidth;
27
- return {
28
- left: offsets[0],
29
- top: offsets[1],
30
- right: offsets[2],
31
- gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
1
+ import * as React from "react";
2
+ import { stylesheetSingleton } from "./index86.js";
3
+ var styleHookSingleton = function() {
4
+ var sheet = stylesheetSingleton();
5
+ return function(styles, isDynamic) {
6
+ React.useEffect(function() {
7
+ sheet.add(styles);
8
+ return function() {
9
+ sheet.remove();
10
+ };
11
+ }, [styles && isDynamic]);
32
12
  };
33
13
  };
34
14
  export {
35
- getGapWidth,
36
- zeroGap
15
+ styleHookSingleton
37
16
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs");exports.stylesheetSingleton=function(){var t=0,n=null;return{add:function(o){var r,u;0==t&&(n=function(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=e.getNonce();return n&&t.setAttribute("nonce",n),t}())&&(u=o,(r=n).styleSheet?r.styleSheet.cssText=u:r.appendChild(document.createTextNode(u)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}};
@@ -0,0 +1,48 @@
1
+ import { getNonce } from "./index87.js";
2
+ function makeStyleTag() {
3
+ if (!document)
4
+ return null;
5
+ var tag = document.createElement("style");
6
+ tag.type = "text/css";
7
+ var nonce = getNonce();
8
+ if (nonce) {
9
+ tag.setAttribute("nonce", nonce);
10
+ }
11
+ return tag;
12
+ }
13
+ function injectStyles(tag, css) {
14
+ if (tag.styleSheet) {
15
+ tag.styleSheet.cssText = css;
16
+ } else {
17
+ tag.appendChild(document.createTextNode(css));
18
+ }
19
+ }
20
+ function insertStyleTag(tag) {
21
+ var head = document.head || document.getElementsByTagName("head")[0];
22
+ head.appendChild(tag);
23
+ }
24
+ var stylesheetSingleton = function() {
25
+ var counter = 0;
26
+ var stylesheet = null;
27
+ return {
28
+ add: function(style) {
29
+ if (counter == 0) {
30
+ if (stylesheet = makeStyleTag()) {
31
+ injectStyles(stylesheet, style);
32
+ insertStyleTag(stylesheet);
33
+ }
34
+ }
35
+ counter++;
36
+ },
37
+ remove: function() {
38
+ counter--;
39
+ if (!counter && stylesheet) {
40
+ stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
41
+ stylesheet = null;
42
+ }
43
+ }
44
+ };
45
+ };
46
+ export {
47
+ stylesheetSingleton
48
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.getNonce=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__};
@@ -0,0 +1,9 @@
1
+ var getNonce = function() {
2
+ if (typeof __webpack_nonce__ !== "undefined") {
3
+ return __webpack_nonce__;
4
+ }
5
+ return void 0;
6
+ };
7
+ export {
8
+ getNonce
9
+ };