diff --git a/docs/Masa.Blazor.Docs/wwwroot/data/notifications.json b/docs/Masa.Blazor.Docs/wwwroot/data/notifications.json index 70b1b42100..97d0822990 100644 --- a/docs/Masa.Blazor.Docs/wwwroot/data/notifications.json +++ b/docs/Masa.Blazor.Docs/wwwroot/data/notifications.json @@ -1,31 +1,50 @@ [ { "title": "v1.4.0 Release", - "content": "We provides a best practice example of how to integrate MAUI hybrid with MASA Blazor. You can find the repository at [Masa.Blazor.MauiDemo](https://github.com/masastack/Masa.Blazor.MauiDemo).\r\nHighlights:\r\n- **Overlay**: add fade transition animation, use *block* scroll strategy, and update the bg color of scrim.\r\n- **PageStack**: new component that provides a container similar to a page stack, mainly for mobile.\r\n- **PageTabs**: add the `Closeable` state to tabs, hover to display the close button.\r\n- **Sortable**: new component for replacing the DragZone component.", + "content": { + "en": "We provides a best practice example of how to integrate MAUI hybrid with MASA Blazor. You can find the repository at [Masa.Blazor.MauiDemo](https://github.com/masastack/Masa.Blazor.MauiDemo).\r\nHighlights:\r\n- **Overlay**: add fade transition animation, use *block* scroll strategy, and update the bg color of scrim.\r\n- **PageStack**: new component that provides a container similar to a page stack, mainly for mobile.\r\n- **PageTabs**: add the `Closeable` state to tabs, hover to display the close button.\r\n- **Sortable**: new component for replacing the DragZone component." + }, "type": 0, "href": "/blazor/getting-started/release-notes?v=v1.4.0", "createdAt": "2024-04-07" }, { "title": "v1.5.0 Release", - "content": "Highlights:\r\n- **Button**: add `IconName`, `LeftIconName` and `RightIconName` to simplify the usage of icon buttons.\r\n- **Card**: add sub-component parameter, includes `Title`, `Subtitle` and `Text`.\r\n- **DataTable**: add support for cell ellipsis and custom cell content in `Headers`.\r\n- **ListItem**: add sub-component parameters, includes `Title`, `Subtitle`, `PrependAvatar`, `PrependIcon`, `AppendAvatar` and `AppendIcon`.", + "content": { + "en": "Highlights:\r\n- **Button**: add `IconName`, `LeftIconName` and `RightIconName` to simplify the usage of icon buttons.\r\n- **Card**: add sub-component parameter, includes `Title`, `Subtitle` and `Text`.\r\n- **DataTable**: add support for cell ellipsis and custom cell content in `Headers`.\r\n- **ListItem**: add sub-component parameters, includes `Title`, `Subtitle`, `PrependAvatar`, `PrependIcon`, `AppendAvatar` and `AppendIcon`." + }, "type": 0, "href": "/blazor/getting-started/release-notes?v=v1.5.0", "createdAt": "2024-05-07" }, { "title": "v1.6.0", - "content": "Highlight:\r\n- Remove all references to BlazorComponent.\r\n- **ExpansionPanel**: add sub-component parameters, including `Title` and `Text`.\r\n- **Form**: the context object provided by `ChildContent` now offers `Validate`, `Reset`, and `ResetValidation` methods, as well as an `IsValid` property.", + "content": { + "en": "Highlights:\r\n- Remove all references to BlazorComponent.\r\n- **ExpansionPanel**: add sub-component parameters, including `Title` and `Text`.\r\n- **Form**: the context object provided by `ChildContent` now offers `Validate`, `Reset`, and `ResetValidation` methods, as well as an `IsValid` property." + }, "type": 0, "href": "/blazor/getting-started/release-notes?v=v1.6.0", "createdAt": "2024-07-02" }, { "title": "v1.7.0", - "content": "Highlight:\r\n- **PdfMobileViewer**: a PDF viewer designed for mobile.\r\n- **Toggle**: a wrapper that allows you to toggle between two states.\r\n- **AppThemeStylesheet**: using for avoiding the brief flicker when application is loaded, more details can ben found in the docs.\r\n- **DateTimePicker**: a default **MTextField** component is built-in now, and you can customize the MTextField component using the **PDefaultDateTimePickerActivator**.\r\n- **Form**: auto label generation, built-in complex type validation, setting the validation timing by the `ValidateOn` property.\r\n- **PageStack**: support going back to a specific page or delta, and optionally replacing it with a new page.", + "content": { + "en": "Highlights:\r\n- **PdfMobileViewer**: a PDF viewer designed for mobile.\r\n- **Toggle**: a wrapper that allows you to toggle between two states.\r\n- **AppThemeStylesheet**: using for avoiding the brief flicker when application is loaded, more details can ben found in the docs.\r\n- **DateTimePicker**: a default **MTextField** component is built-in now, and you can customize the MTextField component using the **PDefaultDateTimePickerActivator**.\r\n- **Form**: auto label generation, built-in complex type validation, setting the validation timing by the `ValidateOn` property.\r\n- **PageStack**: support going back to a specific page or delta, and optionally replacing it with a new page." + }, "type": 0, "href": "/blazor/getting-started/release-notes?v=v1.7.0", "upgradeGuide": "/blazor/getting-started/upgrade-guide#upgrading-from-v1-6-x-to-v1-7-0", "createdAt": "2024-09-02" + }, + { + "title": "v1.8.0", + "content": { + "en": "Highlights:\r\n- [Sticky](/blazor/labs/sticky): new component that make elements stick of the viewport when scrolling.\r\n- **NavigationDrawer** and **PageStack** supports touching to expand or collapse.\r\n- **Menu**: add `ScrollStrategy` parameter to control the behavior of menu during scrolling.\r\n- **PageStackNavController**:\r\n - `Push` and `Replace` methods add a new `clearStack` argument that using for clear the stack.\r\n - new **TabChanged** event for changes to currently active tab.\r\n- **TextField**: add support for setting precision for number type.", + "zh": "亮点:\r\n- [Sticky](/blazor/labs/sticky):新组件,当滚动时使元素固定在视口上。\r\n- **NavigationDrawer** 和 **PageStack** 支付触摸展开或关闭。\r\n- **Menu**:添加 `ScrollStrategy` 策略以在滚动时控制菜单的行为。\r\n- **PageStackNavController**: \r\n - `Push` 和 `Replace` 方法添加了一个新的`clearStack`参数,用于清空现有的堆栈。\r\n - 新的 `TabChanged` 事件,激活标签更改时触发。\r\n- **TextField**: 数字类型现在支持设置精度。" + }, + "type": 0, + "href": "/blazor/getting-started/release-notes?v=v1.8.0", + "upgradeGuide": "/blazor/getting-started/upgrade-guide#upgrading-from-v1-7-x-to-v1-8-0", + "createdAt": "2024-11-02" } ] \ No newline at end of file diff --git a/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/en-US.md b/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/en-US.md index 18e625ef8f..43673290e2 100644 --- a/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/en-US.md +++ b/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/en-US.md @@ -1,5 +1,19 @@ # Upgrade Guides +## Upgrading form v1.7.x to v1.8.0 + +### Components {#v1-8-0-components} + +#### Pagination {#v1-8-0-pagination} + +The way to set the shadow is changed from setting the `box-shadow` style to using the `Elevation` parameter. +If you use custom styles, please note to modify to use the elevation style. + +```diff +- ++ +``` + ## Upgrading form v1.6.x to v1.7.0 ### Components {#v1-7-0-components} diff --git a/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/zh-CN.md b/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/zh-CN.md index 79a13bd765..33cf18dfcc 100644 --- a/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/zh-CN.md +++ b/docs/Masa.Blazor.Docs/wwwroot/pages/getting-started/upgrade-guide/zh-CN.md @@ -1,5 +1,18 @@ # 升级指南 +## 从 v1.7.x 升级到 v1.8.0 {#upgrading-from-v1-7-x-to-v1-8-0} + +### 组件 {#v1-8-0-components} + +#### Pagination {#v1-8-0-pagination} + +应用阴影的方式从 `box-shadow`样式已经改为使用 `Elevation` 参数,如果你使用了自定义样式,请注意修改为使用 `elevation` 样式。 + +```diff +- ++ +``` + ## 从 v1.6.x 升级到 v1.7.0 {#upgrading-from-v1-6-x-to-v1-7-0} ### 组件 {#v1-7-0-components} diff --git a/docs/Masa.Docs.Core/Components/AppHeading.razor.cs b/docs/Masa.Docs.Core/Components/AppHeading.razor.cs index 76f30a0de0..606ef3ebb2 100644 --- a/docs/Masa.Docs.Core/Components/AppHeading.razor.cs +++ b/docs/Masa.Docs.Core/Components/AppHeading.razor.cs @@ -55,7 +55,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) { childBuilder.OpenElement(0, "a"); childBuilder.AddAttribute(1, "href", Href); - childBuilder.AddAttribute(2, "class", "text-decoration-none text-right text-md-left"); + childBuilder.AddAttribute(2, "class", "text-decoration-none"); childBuilder.AddEventPreventDefaultAttribute(3, "onclick", true); childBuilder.AddAttribute(4, "onclick", EventCallback.Factory.Create(this, () => OnClick(Href!))); childBuilder.AddContent(5, "#"); diff --git a/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor b/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor index 9e269ee442..a2fbc6cecb 100644 --- a/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor +++ b/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor @@ -77,7 +77,7 @@ @item.CreatedAt
- + @I18n.T($"notifications.{item.HrefText}") diff --git a/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor.cs b/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor.cs index a8bc985687..b53c68a3d1 100644 --- a/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor.cs +++ b/docs/Masa.Docs.Shared/Components/Menus/NotificationsMenu.razor.cs @@ -16,7 +16,7 @@ public NotificationItem() } public NotificationItem(string title, - string content, + Dictionary content, NotificationType type, string href, string hrefAlias, @@ -33,7 +33,7 @@ public NotificationItem(string title, public string Title { get; init; } - public string Content { get; init; } + public Dictionary Content { get; init; } public NotificationType Type { get; init; } @@ -56,6 +56,16 @@ public NotificationItem(string title, NotificationType.Release => "release-notes", _ => "view-details" }; + + public string GetContent(string key) + { + if (Content.TryGetValue(key, out var content)) + { + return content; + } + + return Content.First().Value; + } } [Inject] private IHttpClientFactory HttpClientFactory { get; set; } = null!; diff --git a/docs/Masa.Docs.Shared/wwwroot/css/docs.css b/docs/Masa.Docs.Shared/wwwroot/css/docs.css index 5c2c3465b9..9711f2787f 100644 --- a/docs/Masa.Docs.Shared/wwwroot/css/docs.css +++ b/docs/Masa.Docs.Shared/wwwroot/css/docs.css @@ -196,12 +196,20 @@ h1+p, app-heading[level="1"]+p, .app-heading+p { .m-heading > a { bottom: 0; display: inline-block; - left: 0; + left: -0.7em; position: absolute; - right: -16px; + right: 0; top: 0; } +@media (max-width: 959px) { + .m-heading > a { + text-align: right; + left: 0; + right: -0.7em; + } +} + .m-heading > a:not(:hover):not(:focus) { opacity: 0; } diff --git a/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js b/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js index 04b6a72dee..6545a6a228 100644 --- a/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js +++ b/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js @@ -1,2 +1,2 @@ -function t(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}var e,n;"function"==typeof SuppressedError&&SuppressedError;class o{constructor(t){this.size=t,e.set(this,[]),n.set(this,0)}push(o){t(this,e,"f")[t(this,n,"f")]=o,function(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?i.call(t,n):i?i.value=n:e.set(t,n)}(this,n,(t(this,n,"f")+1)%this.size,"f")}values(){return t(this,e,"f").slice(t(this,n,"f")).concat(t(this,e,"f").slice(0,t(this,n,"f")))}}e=new WeakMap,n=new WeakMap;function i(t){return(t<0?-1:1)*Math.sqrt(Math.abs(t))*1.41421356237}function s(t){if(t.length<2)return 0;if(2===t.length)return t[1].t===t[0].t?0:(t[1].d-t[0].d)/(t[1].t-t[0].t);let e=0;for(let n=t.length-1;n>0;n--){if(t[n].t===t[n-1].t)continue;const o=i(e),s=(t[n].d-t[n-1].d)/(t[n].t-t[n-1].t);e+=(s-o)*Math.abs(s),n===t.length-1&&(e*=.5)}return 1e3*i(e)}function r(){const t={};return{addMovement:function(e){Array.from(e.changedTouches).forEach((n=>{var i;(null!==(i=t[n.identifier])&&void 0!==i?i:t[n.identifier]=new o(20)).push([e.timeStamp,n])}))},endTouch:function(e){Array.from(e.changedTouches).forEach((e=>{delete t[e.identifier]}))},getVelocity:function(e){var n;const o=null===(n=t[e])||void 0===n?void 0:n.values().reverse();if(!o)throw new Error(`No samples for touch id ${e}`);const i=o[0],r=[],c=[];for(const t of o){if(i[0]-t[0]>100)break;r.push({t:t[0],d:t[1].clientX}),c.push({t:t[0],d:t[1].clientY})}return{x:s(r),y:s(c),get direction(){const{x:t,y:e}=this,[n,o]=[Math.abs(t),Math.abs(e)];return n>o&&t>=0?"right":n>o&&t<=0?"left":o>n&&e>=0?"down":o>n&&e<=0?"up":function(){throw new Error}()}}}}}const c="undefined"!=typeof window;let a=!1;try{if(c){const t=Object.defineProperty({},"passive",{get:()=>{a=!0}});window.addEventListener("testListener",t,t),window.removeEventListener("testListener",t,t)}}catch(t){console.warn(t)}function d(t,e,n){var o,i;const s=function(t){return"string"==typeof t?document.querySelector(t):t}(t);console.log("el",s),console.log("state",n),window.addEventListener("touchstart",b,{passive:!0}),window.addEventListener("touchmove",M,{passive:!1}),window.addEventListener("touchend",T,{passive:!0});const c=["left","right"].includes(n.position),{addMovement:a,endTouch:d,getVelocity:h}=r();let u,f=!1,p=!1,m=0,w=0,v=null!==(o=s.style.transform)&&void 0!==o?o:null,g=null!==(i=s.style.transition)&&void 0!==i?i:null;function y(t,e){return("left"===n.position?t:"right"===n.position?document.documentElement.clientWidth-t:"top"===n.position?t:"bottom"===n.position?document.documentElement.clientHeight-t:l())-(e?n.width:0)}function E(t,e=!0){const o="left"===n.position?(t-w)/n.width:"right"===n.position?(document.documentElement.clientWidth-t-w)/n.width:"top"===n.position?(t-w)/n.width:"bottom"===n.position?(document.documentElement.clientHeight-t-w)/n.width:l();return e?Math.max(0,Math.min(1,o)):o}function b(t){var e,o;if(n.touchless)return;v=null!==(e=s.style.transform)&&void 0!==e?e:null,g=null!==(o=s.style.transition)&&void 0!==o?o:null;const i=t.changedTouches[0].clientX,r=t.changedTouches[0].clientY,h="left"===n.position?i<25:"right"===n.position?i>document.documentElement.clientWidth-25:"top"===n.position?r<25:"bottom"===n.position?r>document.documentElement.clientHeight-25:l(),p=n.isActive&&("left"===n.position?idocument.documentElement.clientWidth-n.width:"top"===n.position?rdocument.documentElement.clientHeight-n.width:l());console.log("inElement",p,"isActive",n.isActive,"state.width",n.width),console.log("touchX",i,"document.documentElement.clientWidth",document.documentElement.clientWidth,"state.width",n.width),(h||p||n.isActive&&n.isTemporary)&&(u=[i,r],w=y(c?i:r,n.isActive),m=E(c?i:r),f=w>-20&&w<80,d(t),a(t))}function M(t){const n=t.changedTouches[0].clientX,o=t.changedTouches[0].clientY;if(f){if(!t.cancelable)return void(f=!1);const e=Math.abs(n-u[0]),i=Math.abs(o-u[1]);(c?e>i&&e>3:i>e&&i>3)?(p=!0,f=!1):(c?i:e)>3&&(f=!1)}if(A(),!p)return;t.preventDefault(),a(t);const i=E(c?n:o,!1);m=Math.max(0,Math.min(1,i)),i>1?w=y(c?n:o,!0):i<0&&(w=y(c?n:o,!1)),e.invokeMethodAsync("TouchMove",p,m)}function T(t){if(f=!1,!p)return;a(t),p=!1,A();const o=h(t.changedTouches[0].identifier),i=Math.abs(o.x),s=Math.abs(o.y),r=c?i>s&&i>400:s>i&&s>3;n.isActive=r?o.direction===({left:"right",right:"left",top:"down",bottom:"up"}[n.position]||l()):m>.5,e.invokeMethodAsync("TouchEnd",n.isActive)}const A=()=>{const t=p?{transform:"left"===n.position?`translateX(calc(-100% + ${m*n.width}px))`:"right"===n.position?`translateX(calc(100% - ${m*n.width}px))`:"top"===n.position?`translateY(calc(-100% + ${m*n.width}px))`:"bottom"===n.position?`translateY(calc(100% - ${m*n.width}px))`:l(),transition:"none"}:void 0;p?(s.style.setProperty("transform",(null==t?void 0:t.transform)||"none"),s.style.setProperty("transition",(null==t?void 0:t.transition)||null)):(s.style.setProperty("transform",v),s.style.setProperty("transition",g))};return{syncState:t=>{n=t},dispose:()=>{e.invokeMethodAsync("Dispose"),window.removeEventListener("touchstart",b),window.removeEventListener("touchmove",M),window.removeEventListener("touchend",T)}}}function l(){throw new Error}Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34,shift:16});export{d as useTouch}; +function t(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}var e,n;"function"==typeof SuppressedError&&SuppressedError;class o{constructor(t){this.size=t,e.set(this,[]),n.set(this,0)}push(o){t(this,e,"f")[t(this,n,"f")]=o,function(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?i.call(t,n):i?i.value=n:e.set(t,n)}(this,n,(t(this,n,"f")+1)%this.size,"f")}values(){return t(this,e,"f").slice(t(this,n,"f")).concat(t(this,e,"f").slice(0,t(this,n,"f")))}}e=new WeakMap,n=new WeakMap;function i(t){return(t<0?-1:1)*Math.sqrt(Math.abs(t))*1.41421356237}function r(t){if(t.length<2)return 0;if(2===t.length)return t[1].t===t[0].t?0:(t[1].d-t[0].d)/(t[1].t-t[0].t);let e=0;for(let n=t.length-1;n>0;n--){if(t[n].t===t[n-1].t)continue;const o=i(e),r=(t[n].d-t[n-1].d)/(t[n].t-t[n-1].t);e+=(r-o)*Math.abs(r),n===t.length-1&&(e*=.5)}return 1e3*i(e)}function s(){const t={};return{addMovement:function(e){Array.from(e.changedTouches).forEach((n=>{var i;(null!==(i=t[n.identifier])&&void 0!==i?i:t[n.identifier]=new o(20)).push([e.timeStamp,n])}))},endTouch:function(e){Array.from(e.changedTouches).forEach((e=>{delete t[e.identifier]}))},getVelocity:function(e){var n;const o=null===(n=t[e])||void 0===n?void 0:n.values().reverse();if(!o)throw new Error(`No samples for touch id ${e}`);const i=o[0],s=[],c=[];for(const t of o){if(i[0]-t[0]>100)break;s.push({t:t[0],d:t[1].clientX}),c.push({t:t[0],d:t[1].clientY})}return{x:r(s),y:r(c),get direction(){const{x:t,y:e}=this,[n,o]=[Math.abs(t),Math.abs(e)];return n>o&&t>=0?"right":n>o&&t<=0?"left":o>n&&e>=0?"down":o>n&&e<=0?"up":function(){throw new Error}()}}}}}const c="undefined"!=typeof window;let a=!1;try{if(c){const t=Object.defineProperty({},"passive",{get:()=>{a=!0}});window.addEventListener("testListener",t,t),window.removeEventListener("testListener",t,t)}}catch(t){console.warn(t)}function d(t,e,n){var o,i;const r=function(t){return"string"==typeof t?document.querySelector(t):t}(t);r||h(),window.addEventListener("touchstart",b,{passive:!0}),window.addEventListener("touchmove",M,{passive:!1}),window.addEventListener("touchend",T,{passive:!0});const c=["left","right"].includes(n.position),{addMovement:a,endTouch:d,getVelocity:l}=s();let u,f=!1,p=!1,m=0,w=0,v=null!==(o=r.style.transform)&&void 0!==o?o:null,y=null!==(i=r.style.transition)&&void 0!==i?i:null;function g(t,e){return("left"===n.position?t:"right"===n.position?document.documentElement.clientWidth-t:"top"===n.position?t:"bottom"===n.position?document.documentElement.clientHeight-t:h())-(e?n.width:0)}function E(t,e=!0){const o="left"===n.position?(t-w)/n.width:"right"===n.position?(document.documentElement.clientWidth-t-w)/n.width:"top"===n.position?(t-w)/n.width:"bottom"===n.position?(document.documentElement.clientHeight-t-w)/n.width:h();return e?Math.max(0,Math.min(1,o)):o}function b(t){var e,o;if(n.touchless)return;v=null!==(e=r.style.transform)&&void 0!==e?e:null,y=null!==(o=r.style.transition)&&void 0!==o?o:null;const i=t.changedTouches[0].clientX,s=t.changedTouches[0].clientY,l="left"===n.position?i<25:"right"===n.position?i>document.documentElement.clientWidth-25:"top"===n.position?s<25:"bottom"===n.position?s>document.documentElement.clientHeight-25:h(),p=n.isActive&&("left"===n.position?idocument.documentElement.clientWidth-n.width:"top"===n.position?sdocument.documentElement.clientHeight-n.width:h());(l||p||n.isActive&&n.isTemporary)&&(u=[i,s],w=g(c?i:s,n.isActive),m=E(c?i:s),f=w>-20&&w<80,d(t),a(t))}function M(t){const n=t.changedTouches[0].clientX,o=t.changedTouches[0].clientY;if(f){if(!t.cancelable)return void(f=!1);const e=Math.abs(n-u[0]),i=Math.abs(o-u[1]);(c?e>i&&e>3:i>e&&i>3)?(p=!0,f=!1):(c?i:e)>3&&(f=!1)}if(x(),!p)return;t.preventDefault(),a(t);const i=E(c?n:o,!1);m=Math.max(0,Math.min(1,i)),i>1?w=g(c?n:o,!0):i<0&&(w=g(c?n:o,!1)),e.invokeMethodAsync("TouchMove",p,m)}function T(t){if(f=!1,!p)return;a(t),p=!1,x();const o=l(t.changedTouches[0].identifier),i=Math.abs(o.x),r=Math.abs(o.y),s=c?i>r&&i>400:r>i&&r>3;n.isActive=s?o.direction===({left:"right",right:"left",top:"down",bottom:"up"}[n.position]||h()):m>.5,e.invokeMethodAsync("TouchEnd",n.isActive)}const x=()=>{const t=p?{transform:"left"===n.position?`translateX(calc(-100% + ${m*n.width}px))`:"right"===n.position?`translateX(calc(100% - ${m*n.width}px))`:"top"===n.position?`translateY(calc(-100% + ${m*n.width}px))`:"bottom"===n.position?`translateY(calc(100% - ${m*n.width}px))`:h(),transition:"none"}:void 0;p?(r.style.setProperty("transform",(null==t?void 0:t.transform)||"none"),r.style.setProperty("transition",(null==t?void 0:t.transition)||null)):(r.style.setProperty("transform",v),r.style.setProperty("transition",y))};return{syncState:t=>{n=t},dispose:()=>{e.dispose(),window.removeEventListener("touchstart",b),window.removeEventListener("touchmove",M),window.removeEventListener("touchend",T)}}}function h(){throw new Error}Object.freeze({enter:13,tab:9,delete:46,esc:27,space:32,up:38,down:40,left:37,right:39,end:35,home:36,del:46,backspace:8,insert:45,pageup:33,pagedown:34,shift:16});export{d as useTouch}; //# sourceMappingURL=navigation-drawer-touch.js.map diff --git a/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js.map b/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js.map index 31903d7b4e..5c91ec6fe4 100644 --- a/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js.map +++ b/src/Masa.Blazor/wwwroot/js/components/navigation-drawer-touch.js.map @@ -1 +1 @@ -{"version":3,"file":"navigation-drawer-touch.js","sources":["../../../../Masa.Blazor.JS/node_modules/.pnpm/@rollup+plugin-typescript@8.5.0_rollup@2.79.2_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js","../../../../Masa.Blazor.JS/src/mixins/touch.ts","../../../../Masa.Blazor.JS/src/utils/helper.ts","../../../../Masa.Blazor.JS/src/components/navigation-drawer/touch.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","// The code is derived from Vuetify\r\n// License: MIT\r\n// Location: https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/touch.ts\r\n\r\nclass CircularBuffer {\r\n readonly #arr: Array = []\r\n #pointer = 0\r\n\r\n constructor (public readonly size: number) {}\r\n\r\n push (val: T) {\r\n this.#arr[this.#pointer] = val\r\n this.#pointer = (this.#pointer + 1) % this.size\r\n }\r\n\r\n values (): T[] {\r\n return this.#arr.slice(this.#pointer).concat(this.#arr.slice(0, this.#pointer))\r\n }\r\n}\r\n\r\nconst HORIZON = 100 // ms\r\nconst HISTORY = 20 // number of samples to keep\r\n\r\nexport interface Sample {\r\n t: number\r\n d: number\r\n}\r\n\r\n/** @see https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp */\r\nfunction kineticEnergyToVelocity (work: number) {\r\n const sqrt2 = 1.41421356237\r\n return (work < 0 ? -1.0 : 1.0) * Math.sqrt(Math.abs(work)) * sqrt2\r\n}\r\n\r\n/**\r\n * Returns pointer velocity in px/s\r\n */\r\nexport function calculateImpulseVelocity (samples: Sample[]) {\r\n // The input should be in reversed time order (most recent sample at index i=0)\r\n if (samples.length < 2) {\r\n // if 0 or 1 points, velocity is zero\r\n return 0\r\n }\r\n // if (samples[1].t > samples[0].t) {\r\n // // Algorithm will still work, but not perfectly\r\n // consoleWarn('Samples provided to calculateImpulseVelocity in the wrong order')\r\n // }\r\n if (samples.length === 2) {\r\n // if 2 points, basic linear calculation\r\n if (samples[1].t === samples[0].t) {\r\n // consoleWarn(`Events have identical time stamps t=${samples[0].t}, setting velocity = 0`)\r\n return 0\r\n }\r\n return (samples[1].d - samples[0].d) / (samples[1].t - samples[0].t)\r\n }\r\n // Guaranteed to have at least 3 points here\r\n // start with the oldest sample and go forward in time\r\n let work = 0\r\n for (let i = samples.length - 1; i > 0; i--) {\r\n if (samples[i].t === samples[i - 1].t) {\r\n // consoleWarn(`Events have identical time stamps t=${samples[i].t}, skipping sample`)\r\n continue\r\n }\r\n const vprev = kineticEnergyToVelocity(work) // v[i-1]\r\n const vcurr = (samples[i].d - samples[i - 1].d) / (samples[i].t - samples[i - 1].t) // v[i]\r\n work += (vcurr - vprev) * Math.abs(vcurr)\r\n if (i === samples.length - 1) {\r\n work *= 0.5\r\n }\r\n }\r\n return kineticEnergyToVelocity(work) * 1000\r\n}\r\n\r\nexport function useVelocity () {\r\n const touches: Record | undefined> = {}\r\n\r\n function addMovement (e: TouchEvent) {\r\n Array.from(e.changedTouches).forEach(touch => {\r\n const samples = touches[touch.identifier] ?? (touches[touch.identifier] = new CircularBuffer(HISTORY))\r\n samples.push([e.timeStamp, touch])\r\n })\r\n }\r\n\r\n function endTouch (e: TouchEvent) {\r\n Array.from(e.changedTouches).forEach(touch => {\r\n delete touches[touch.identifier]\r\n })\r\n }\r\n\r\n function getVelocity (id: number) {\r\n const samples = touches[id]?.values().reverse()\r\n\r\n if (!samples) {\r\n throw new Error(`No samples for touch id ${id}`)\r\n }\r\n\r\n const newest = samples[0]\r\n const x: Sample[] = []\r\n const y: Sample[] = []\r\n for (const val of samples) {\r\n if (newest[0] - val[0] > HORIZON) break\r\n\r\n x.push({ t: val[0], d: val[1].clientX })\r\n y.push({ t: val[0], d: val[1].clientY })\r\n }\r\n\r\n return {\r\n x: calculateImpulseVelocity(x),\r\n y: calculateImpulseVelocity(y),\r\n get direction () {\r\n const { x, y } = this\r\n const [absX, absY] = [Math.abs(x), Math.abs(y)]\r\n\r\n return absX > absY && x >= 0 ? 'right'\r\n : absX > absY && x <= 0 ? 'left'\r\n : absY > absX && y >= 0 ? 'down'\r\n : absY > absX && y <= 0 ? 'up'\r\n : oops()\r\n },\r\n }\r\n }\r\n\r\n return { addMovement, endTouch, getVelocity }\r\n}\r\n\r\nfunction oops (): never {\r\n throw new Error()\r\n}\r\n","export const IN_BROWSER = typeof window !== \"undefined\";\r\n\r\nexport function addOnceEventListener(\r\n el: EventTarget,\r\n eventName: string,\r\n cb: (event: Event) => void,\r\n options: boolean | AddEventListenerOptions = false\r\n): void {\r\n const once = (event: Event) => {\r\n cb(event);\r\n el.removeEventListener(eventName, once, options);\r\n };\r\n\r\n el.addEventListener(eventName, once, options);\r\n}\r\n\r\nlet passiveSupported = false;\r\ntry {\r\n if (IN_BROWSER) {\r\n const testListenerOpts = Object.defineProperty({}, \"passive\", {\r\n get: () => {\r\n passiveSupported = true;\r\n },\r\n });\r\n\r\n window.addEventListener(\r\n \"testListener\" as any,\r\n testListenerOpts as any,\r\n testListenerOpts\r\n );\r\n window.removeEventListener(\r\n \"testListener\" as any,\r\n testListenerOpts as any,\r\n testListenerOpts\r\n );\r\n }\r\n} catch (e) {\r\n console.warn(e);\r\n} /* eslint-disable-line no-console */\r\nexport { passiveSupported };\r\n\r\nexport function addPassiveEventListener(\r\n el: EventTarget,\r\n event: string,\r\n cb: (e: any) => void,\r\n options: {}\r\n): void {\r\n el.addEventListener(event, cb, passiveSupported ? options : false);\r\n}\r\n\r\nexport function getZIndex(el?: Element | null): number {\r\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return 0;\r\n\r\n const index = +window.getComputedStyle(el).getPropertyValue(\"z-index\");\r\n\r\n if (!index) return getZIndex(el.parentNode as Element);\r\n return index;\r\n}\r\n\r\n// KeyboardEvent.keyCode aliases\r\nexport const keyCodes = Object.freeze({\r\n enter: 13,\r\n tab: 9,\r\n delete: 46,\r\n esc: 27,\r\n space: 32,\r\n up: 38,\r\n down: 40,\r\n left: 37,\r\n right: 39,\r\n end: 35,\r\n home: 36,\r\n del: 46,\r\n backspace: 8,\r\n insert: 45,\r\n pageup: 33,\r\n pagedown: 34,\r\n shift: 16,\r\n});\r\n\r\n/** Polyfill for Event.prototype.composedPath */\r\nexport function composedPath(e: Event): EventTarget[] {\r\n if (e.composedPath) return e.composedPath();\r\n\r\n const path = [];\r\n let el = e.target as Element;\r\n\r\n while (el) {\r\n path.push(el);\r\n\r\n if (el.tagName === \"HTML\") {\r\n path.push(document);\r\n path.push(window);\r\n\r\n return path;\r\n }\r\n\r\n el = el.parentElement!;\r\n }\r\n return path;\r\n}\r\n\r\nexport function getBlazorId(el) {\r\n if (!el) {\r\n return null;\r\n }\r\n let _bl_ = el.getAttributeNames().find((a) => a.startsWith(\"_bl_\"));\r\n if (_bl_) {\r\n _bl_ = _bl_.substring(4);\r\n }\r\n\r\n return _bl_;\r\n}\r\n\r\nexport function getElementSelector(el) {\r\n if (!(el instanceof Element)) return;\r\n var path = [];\r\n while (el.nodeType === Node.ELEMENT_NODE) {\r\n var selector = el.nodeName.toLowerCase();\r\n if (el.id) {\r\n selector = \"#\" + el.id;\r\n path.unshift(selector);\r\n break;\r\n } else {\r\n var sib = el,\r\n nth = 1;\r\n while ((sib = sib.previousElementSibling)) {\r\n if (sib.nodeName.toLowerCase() == selector) nth++;\r\n }\r\n if (nth != 1) selector += \":nth-of-type(\" + nth + \")\";\r\n }\r\n path.unshift(selector);\r\n el = el.parentNode;\r\n }\r\n return path.join(\" > \");\r\n}\r\n\r\nexport function getEventTarget(target: HTMLElement | EventTarget) {\r\n const el = target as HTMLElement;\r\n const eventTarget: MbEventTarget = {};\r\n const elementReferenceId = el\r\n .getAttributeNames()\r\n .find((a) => a.startsWith(\"_bl_\"));\r\n if (elementReferenceId) {\r\n eventTarget.elementReferenceId = elementReferenceId;\r\n eventTarget.selector = `[${elementReferenceId}]`;\r\n } else {\r\n eventTarget.selector = getElementSelector(el);\r\n }\r\n\r\n eventTarget.class = el.getAttribute(\"class\");\r\n\r\n return eventTarget;\r\n}\r\n\r\nexport function getElement(elOrString: HTMLElement | string): HTMLElement {\r\n if (typeof elOrString === \"string\") {\r\n return document.querySelector(elOrString);\r\n } else {\r\n return elOrString;\r\n }\r\n}\r\n\r\nexport function getDom(elOrString: Element | string | undefined) {\r\n let element: HTMLElement;\r\n\r\n try {\r\n if (!elOrString) {\r\n element = document.body;\r\n } else if (typeof elOrString === \"string\") {\r\n if (elOrString === \"document\") {\r\n element = document.documentElement;\r\n } else if (elOrString.indexOf(\"__.__\") > 0) {\r\n // for example: el__.__parentElement\r\n let array = elOrString.split(\"__.__\");\r\n let i = 0;\r\n let el = document.querySelector(array[i++]);\r\n\r\n if (el) {\r\n while (array[i]) {\r\n el = el[array[i]];\r\n i++;\r\n }\r\n }\r\n\r\n if (el instanceof HTMLElement) {\r\n element = el;\r\n }\r\n } else {\r\n element = document.querySelector(elOrString);\r\n }\r\n } else {\r\n element = elOrString as HTMLElement;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n }\r\n\r\n return element;\r\n}\r\n\r\nexport const canUseDom = !!(\r\n IN_BROWSER &&\r\n typeof document !== \"undefined\" &&\r\n window.document &&\r\n window.document.createElement\r\n);\r\n\r\nexport function convertToUnit(str: number, unit?: string): string;\r\nexport function convertToUnit(\r\n str: string | number | null | undefined,\r\n unit?: string\r\n): string | undefined;\r\nexport function convertToUnit(\r\n str: string | number | null | undefined,\r\n unit = \"px\"\r\n): string | undefined {\r\n if (str == null || str === \"\") {\r\n return undefined;\r\n } else if (isNaN(+str!)) {\r\n return String(str);\r\n } else if (!isFinite(+str!)) {\r\n return undefined;\r\n } else {\r\n return `${Number(str)}${unit}`;\r\n }\r\n}\r\n","import { useVelocity } from \"mixins/touch\";\r\nimport { getElement } from \"utils/helper\";\r\n\r\ntype State = {\r\n isActive: boolean;\r\n isTemporary: boolean;\r\n width: number;\r\n touchless: boolean;\r\n position: \"left\" | \"right\" | \"top\" | \"bottom\";\r\n};\r\n\r\nexport function useTouch(\r\n elOrString: HTMLElement | string,\r\n dotNetObject: DotNet.DotNetObject,\r\n state: State\r\n) {\r\n const el = getElement(elOrString);\r\n\r\n console.log(\"el\", el);\r\n console.log(\"state\", state);\r\n\r\n window.addEventListener(\"touchstart\", onTouchstart, { passive: true });\r\n window.addEventListener(\"touchmove\", onTouchmove, { passive: false });\r\n window.addEventListener(\"touchend\", onTouchend, { passive: true });\r\n\r\n const isHorizontal = [\"left\", \"right\"].includes(state.position);\r\n\r\n const { addMovement, endTouch, getVelocity } = useVelocity();\r\n\r\n let maybeDragging = false;\r\n let isDragging = false;\r\n let dragProgress = 0;\r\n let offset = 0;\r\n let start: [number, number] | undefined;\r\n\r\n let transformBeforeTouchMove = el.style.transform ?? null;\r\n let transitionBeforeTouchMove = el.style.transition ?? null;\r\n\r\n function getOffset(pos: number, active: boolean): number {\r\n return (\r\n (state.position === \"left\"\r\n ? pos\r\n : state.position === \"right\"\r\n ? document.documentElement.clientWidth - pos\r\n : state.position === \"top\"\r\n ? pos\r\n : state.position === \"bottom\"\r\n ? document.documentElement.clientHeight - pos\r\n : oops()) - (active ? state.width : 0)\r\n );\r\n }\r\n\r\n function getProgress(pos: number, limit = true): number {\r\n const progress =\r\n state.position === \"left\"\r\n ? (pos - offset) / state.width\r\n : state.position === \"right\"\r\n ? (document.documentElement.clientWidth - pos - offset) / state.width\r\n : state.position === \"top\"\r\n ? (pos - offset) / state.width\r\n : state.position === \"bottom\"\r\n ? (document.documentElement.clientHeight - pos - offset) / state.width\r\n : oops();\r\n return limit ? Math.max(0, Math.min(1, progress)) : progress;\r\n }\r\n\r\n function onTouchstart(e: TouchEvent) {\r\n if (state.touchless) return;\r\n\r\n transformBeforeTouchMove = el.style.transform ?? null;\r\n transitionBeforeTouchMove = el.style.transition ?? null;\r\n\r\n const touchX = e.changedTouches[0].clientX;\r\n const touchY = e.changedTouches[0].clientY;\r\n\r\n const touchZone = 25;\r\n const inTouchZone: boolean =\r\n state.position === \"left\"\r\n ? touchX < touchZone\r\n : state.position === \"right\"\r\n ? touchX > document.documentElement.clientWidth - touchZone\r\n : state.position === \"top\"\r\n ? touchY < touchZone\r\n : state.position === \"bottom\"\r\n ? touchY > document.documentElement.clientHeight - touchZone\r\n : oops();\r\n\r\n const inElement: boolean =\r\n state.isActive &&\r\n (state.position === \"left\"\r\n ? touchX < state.width\r\n : state.position === \"right\"\r\n ? touchX > document.documentElement.clientWidth - state.width\r\n : state.position === \"top\"\r\n ? touchY < state.width\r\n : state.position === \"bottom\"\r\n ? touchY > document.documentElement.clientHeight - state.width\r\n : oops());\r\n\r\n console.log('inElement', inElement, 'isActive', state.isActive, 'state.width', state.width);\r\n console.log('touchX', touchX, 'document.documentElement.clientWidth', document.documentElement.clientWidth, 'state.width', state.width);\r\n\r\n if (inTouchZone || inElement || (state.isActive && state.isTemporary)) {\r\n start = [touchX, touchY];\r\n\r\n offset = getOffset(isHorizontal ? touchX : touchY, state.isActive);\r\n dragProgress = getProgress(isHorizontal ? touchX : touchY);\r\n\r\n maybeDragging = offset > -20 && offset < 80;\r\n endTouch(e);\r\n addMovement(e);\r\n }\r\n }\r\n\r\n function onTouchmove(e: TouchEvent) {\r\n const touchX = e.changedTouches[0].clientX;\r\n const touchY = e.changedTouches[0].clientY;\r\n\r\n if (maybeDragging) {\r\n if (!e.cancelable) {\r\n maybeDragging = false;\r\n return;\r\n }\r\n\r\n const dx = Math.abs(touchX - start![0]);\r\n const dy = Math.abs(touchY - start![1]);\r\n\r\n const thresholdMet = isHorizontal ? dx > dy && dx > 3 : dy > dx && dy > 3;\r\n\r\n if (thresholdMet) {\r\n isDragging = true;\r\n maybeDragging = false;\r\n } else if ((isHorizontal ? dy : dx) > 3) {\r\n maybeDragging = false;\r\n }\r\n }\r\n\r\n applyDragStyles();\r\n\r\n if (!isDragging) return;\r\n\r\n e.preventDefault();\r\n addMovement(e);\r\n\r\n const progress = getProgress(isHorizontal ? touchX : touchY, false);\r\n dragProgress = Math.max(0, Math.min(1, progress));\r\n\r\n if (progress > 1) {\r\n offset = getOffset(isHorizontal ? touchX : touchY, true);\r\n } else if (progress < 0) {\r\n offset = getOffset(isHorizontal ? touchX : touchY, false);\r\n }\r\n\r\n dotNetObject.invokeMethodAsync(\"TouchMove\", isDragging, dragProgress);\r\n }\r\n\r\n function onTouchend(e: TouchEvent) {\r\n maybeDragging = false;\r\n\r\n if (!isDragging) return;\r\n\r\n addMovement(e);\r\n\r\n isDragging = false;\r\n\r\n applyDragStyles();\r\n\r\n const velocity = getVelocity(e.changedTouches[0].identifier);\r\n const vx = Math.abs(velocity.x);\r\n const vy = Math.abs(velocity.y);\r\n const thresholdMet = isHorizontal ? vx > vy && vx > 400 : vy > vx && vy > 3;\r\n\r\n if (thresholdMet) {\r\n state.isActive =\r\n velocity.direction ===\r\n ({\r\n left: \"right\",\r\n right: \"left\",\r\n top: \"down\",\r\n bottom: \"up\",\r\n }[state.position] || oops());\r\n } else {\r\n state.isActive = dragProgress > 0.5;\r\n }\r\n\r\n dotNetObject.invokeMethodAsync(\"TouchEnd\", state.isActive);\r\n }\r\n\r\n const getDragStyles = () => {\r\n return isDragging\r\n ? {\r\n transform:\r\n state.position === \"left\"\r\n ? `translateX(calc(-100% + ${dragProgress * state.width}px))`\r\n : state.position === \"right\"\r\n ? `translateX(calc(100% - ${dragProgress * state.width}px))`\r\n : state.position === \"top\"\r\n ? `translateY(calc(-100% + ${dragProgress * state.width}px))`\r\n : state.position === \"bottom\"\r\n ? `translateY(calc(100% - ${dragProgress * state.width}px))`\r\n : oops(),\r\n transition: \"none\",\r\n }\r\n : undefined;\r\n };\r\n\r\n const applyDragStyles = () => {\r\n const dragStyles = getDragStyles();\r\n\r\n if (isDragging) {\r\n el.style.setProperty(\"transform\", dragStyles?.transform || \"none\");\r\n el.style.setProperty(\"transition\", dragStyles?.transition || null);\r\n } else {\r\n el.style.setProperty(\"transform\", transformBeforeTouchMove);\r\n el.style.setProperty(\"transition\", transitionBeforeTouchMove);\r\n }\r\n };\r\n\r\n return {\r\n syncState: (newState: State) => {\r\n state = newState;\r\n },\r\n dispose: () => {\r\n dotNetObject.invokeMethodAsync(\"Dispose\");\r\n window.removeEventListener(\"touchstart\", onTouchstart);\r\n window.removeEventListener(\"touchmove\", onTouchmove);\r\n window.removeEventListener(\"touchend\", onTouchend);\r\n },\r\n };\r\n}\r\n\r\nfunction oops(): never {\r\n throw new Error();\r\n}\r\n"],"names":["__classPrivateFieldGet","receiver","state","kind","f","TypeError","has","call","value","get","SuppressedError","CircularBuffer","constructor","size","this","_CircularBuffer_arr","set","_CircularBuffer_pointer","push","val","__classPrivateFieldSet","values","slice","concat","kineticEnergyToVelocity","work","Math","sqrt","abs","calculateImpulseVelocity","samples","length","t","d","i","vprev","vcurr","useVelocity","touches","addMovement","e","Array","from","changedTouches","forEach","touch","_a","identifier","timeStamp","endTouch","getVelocity","id","reverse","Error","newest","x","y","clientX","clientY","direction","absX","absY","oops","IN_BROWSER","window","passiveSupported","testListenerOpts","Object","defineProperty","addEventListener","removeEventListener","console","warn","useTouch","elOrString","dotNetObject","el","document","querySelector","getElement","log","onTouchstart","passive","onTouchmove","onTouchend","isHorizontal","includes","position","start","maybeDragging","isDragging","dragProgress","offset","transformBeforeTouchMove","style","transform","transitionBeforeTouchMove","_b","transition","getOffset","pos","active","documentElement","clientWidth","clientHeight","width","getProgress","limit","progress","max","min","touchless","touchX","touchY","inTouchZone","inElement","isActive","isTemporary","cancelable","dx","dy","applyDragStyles","preventDefault","invokeMethodAsync","velocity","vx","vy","thresholdMet","left","right","top","bottom","dragStyles","undefined","setProperty","syncState","newState","dispose","freeze","enter","tab","delete","esc","space","up","down","end","home","del","backspace","insert","pageup","pagedown","shift"],"mappings":"AA8RO,SAASA,EAAuBC,EAAUC,EAAOC,EAAMC,GAC1D,GAAa,MAATD,IAAiBC,EAAG,MAAM,IAAIC,UAAU,iDAC5C,GAAqB,mBAAVH,EAAuBD,IAAaC,IAAUE,GAAKF,EAAMI,IAAIL,GAAW,MAAM,IAAII,UAAU,4EACvG,MAAgB,MAATF,EAAeC,EAAa,MAATD,EAAeC,EAAEG,KAAKN,GAAYG,EAAIA,EAAEI,MAAQN,EAAMO,IAAIR,EACxF,SAsCkD,mBAApBS,iBAAiCA,gBCpU/D,M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AoB,WAAYc,EAAW,EAGxD,CAEA,SAAStB,IACP,MAAM,IAAIT,KACZ,CD7KwBc,OAAOuE,OAAO,CACpCC,MAAO,GACPC,IAAK,EACLC,OAAQ,GACRC,IAAK,GACLC,MAAO,GACPC,GAAI,GACJC,KAAM,GACNjB,KAAM,GACNC,MAAO,GACPiB,IAAK,GACLC,KAAM,GACNC,IAAK,GACLC,UAAW,EACXC,OAAQ,GACRC,OAAQ,GACRC,SAAU,GACVC,MAAO"} \ No newline at end of file +{"version":3,"file":"navigation-drawer-touch.js","sources":["../../../../Masa.Blazor.JS/node_modules/.pnpm/@rollup+plugin-typescript@8.5.0_rollup@2.79.2_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js","../../../../Masa.Blazor.JS/src/mixins/touch.ts","../../../../Masa.Blazor.JS/src/utils/helper.ts","../../../../Masa.Blazor.JS/src/components/navigation-drawer/touch.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","// The code is derived from Vuetify\r\n// License: MIT\r\n// Location: https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/touch.ts\r\n\r\nclass CircularBuffer {\r\n readonly #arr: Array = []\r\n #pointer = 0\r\n\r\n constructor (public readonly size: number) {}\r\n\r\n push (val: T) {\r\n this.#arr[this.#pointer] = val\r\n this.#pointer = (this.#pointer + 1) % this.size\r\n }\r\n\r\n values (): T[] {\r\n return this.#arr.slice(this.#pointer).concat(this.#arr.slice(0, this.#pointer))\r\n }\r\n}\r\n\r\nconst HORIZON = 100 // ms\r\nconst HISTORY = 20 // number of samples to keep\r\n\r\nexport interface Sample {\r\n t: number\r\n d: number\r\n}\r\n\r\n/** @see https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp */\r\nfunction kineticEnergyToVelocity (work: number) {\r\n const sqrt2 = 1.41421356237\r\n return (work < 0 ? -1.0 : 1.0) * Math.sqrt(Math.abs(work)) * sqrt2\r\n}\r\n\r\n/**\r\n * Returns pointer velocity in px/s\r\n */\r\nexport function calculateImpulseVelocity (samples: Sample[]) {\r\n // The input should be in reversed time order (most recent sample at index i=0)\r\n if (samples.length < 2) {\r\n // if 0 or 1 points, velocity is zero\r\n return 0\r\n }\r\n // if (samples[1].t > samples[0].t) {\r\n // // Algorithm will still work, but not perfectly\r\n // consoleWarn('Samples provided to calculateImpulseVelocity in the wrong order')\r\n // }\r\n if (samples.length === 2) {\r\n // if 2 points, basic linear calculation\r\n if (samples[1].t === samples[0].t) {\r\n // consoleWarn(`Events have identical time stamps t=${samples[0].t}, setting velocity = 0`)\r\n return 0\r\n }\r\n return (samples[1].d - samples[0].d) / (samples[1].t - samples[0].t)\r\n }\r\n // Guaranteed to have at least 3 points here\r\n // start with the oldest sample and go forward in time\r\n let work = 0\r\n for (let i = samples.length - 1; i > 0; i--) {\r\n if (samples[i].t === samples[i - 1].t) {\r\n // consoleWarn(`Events have identical time stamps t=${samples[i].t}, skipping sample`)\r\n continue\r\n }\r\n const vprev = kineticEnergyToVelocity(work) // v[i-1]\r\n const vcurr = (samples[i].d - samples[i - 1].d) / (samples[i].t - samples[i - 1].t) // v[i]\r\n work += (vcurr - vprev) * Math.abs(vcurr)\r\n if (i === samples.length - 1) {\r\n work *= 0.5\r\n }\r\n }\r\n return kineticEnergyToVelocity(work) * 1000\r\n}\r\n\r\nexport function useVelocity () {\r\n const touches: Record | undefined> = {}\r\n\r\n function addMovement (e: TouchEvent) {\r\n Array.from(e.changedTouches).forEach(touch => {\r\n const samples = touches[touch.identifier] ?? (touches[touch.identifier] = new CircularBuffer(HISTORY))\r\n samples.push([e.timeStamp, touch])\r\n })\r\n }\r\n\r\n function endTouch (e: TouchEvent) {\r\n Array.from(e.changedTouches).forEach(touch => {\r\n delete touches[touch.identifier]\r\n })\r\n }\r\n\r\n function getVelocity (id: number) {\r\n const samples = touches[id]?.values().reverse()\r\n\r\n if (!samples) {\r\n throw new Error(`No samples for touch id ${id}`)\r\n }\r\n\r\n const newest = samples[0]\r\n const x: Sample[] = []\r\n const y: Sample[] = []\r\n for (const val of samples) {\r\n if (newest[0] - val[0] > HORIZON) break\r\n\r\n x.push({ t: val[0], d: val[1].clientX })\r\n y.push({ t: val[0], d: val[1].clientY })\r\n }\r\n\r\n return {\r\n x: calculateImpulseVelocity(x),\r\n y: calculateImpulseVelocity(y),\r\n get direction () {\r\n const { x, y } = this\r\n const [absX, absY] = [Math.abs(x), Math.abs(y)]\r\n\r\n return absX > absY && x >= 0 ? 'right'\r\n : absX > absY && x <= 0 ? 'left'\r\n : absY > absX && y >= 0 ? 'down'\r\n : absY > absX && y <= 0 ? 'up'\r\n : oops()\r\n },\r\n }\r\n }\r\n\r\n return { addMovement, endTouch, getVelocity }\r\n}\r\n\r\nfunction oops (): never {\r\n throw new Error()\r\n}\r\n","export const IN_BROWSER = typeof window !== 'undefined'\r\n\r\nexport function addOnceEventListener (\r\n el: EventTarget,\r\n eventName: string,\r\n cb: (event: Event) => void,\r\n options: boolean | AddEventListenerOptions = false\r\n): void {\r\n const once = (event: Event) => {\r\n cb(event)\r\n el.removeEventListener(eventName, once, options)\r\n }\r\n\r\n el.addEventListener(eventName, once, options)\r\n}\r\n\r\nlet passiveSupported = false\r\ntry {\r\n if (IN_BROWSER) {\r\n const testListenerOpts = Object.defineProperty({}, 'passive', {\r\n get: () => {\r\n passiveSupported = true\r\n },\r\n })\r\n\r\n window.addEventListener('testListener' as any, testListenerOpts as any, testListenerOpts)\r\n window.removeEventListener('testListener' as any, testListenerOpts as any, testListenerOpts)\r\n }\r\n} catch (e) { console.warn(e) } /* eslint-disable-line no-console */\r\nexport { passiveSupported }\r\n\r\nexport function addPassiveEventListener (\r\n el: EventTarget,\r\n event: string,\r\n cb: ((e: any) => void),\r\n options: {}\r\n): void {\r\n el.addEventListener(event, cb, passiveSupported ? options : false)\r\n}\r\n\r\nexport function getZIndex (el?: Element | null): number {\r\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return 0\r\n\r\n const index = +window.getComputedStyle(el).getPropertyValue('z-index')\r\n\r\n if (!index) return getZIndex(el.parentNode as Element)\r\n return index\r\n}\r\n\r\n// KeyboardEvent.keyCode aliases\r\nexport const keyCodes = Object.freeze({\r\n enter: 13,\r\n tab: 9,\r\n delete: 46,\r\n esc: 27,\r\n space: 32,\r\n up: 38,\r\n down: 40,\r\n left: 37,\r\n right: 39,\r\n end: 35,\r\n home: 36,\r\n del: 46,\r\n backspace: 8,\r\n insert: 45,\r\n pageup: 33,\r\n pagedown: 34,\r\n shift: 16,\r\n})\r\n\r\n/** Polyfill for Event.prototype.composedPath */\r\nexport function composedPath (e: Event): EventTarget[] {\r\n if (e.composedPath) return e.composedPath()\r\n\r\n const path = []\r\n let el = e.target as Element\r\n\r\n while (el) {\r\n path.push(el)\r\n\r\n if (el.tagName === 'HTML') {\r\n path.push(document)\r\n path.push(window)\r\n\r\n return path\r\n }\r\n\r\n el = el.parentElement!\r\n }\r\n return path\r\n}\r\n\r\nexport function getBlazorId(el) {\r\n if (!el) {\r\n return null;\r\n }\r\n let _bl_ = el.getAttributeNames().find(a => a.startsWith('_bl_'))\r\n if (_bl_) {\r\n _bl_ = _bl_.substring(4);\r\n }\r\n\r\n return _bl_;\r\n}\r\n\r\nexport function getElementSelector(el) {\r\n if (!(el instanceof Element))\r\n return;\r\n var path = [];\r\n while (el.nodeType === Node.ELEMENT_NODE) {\r\n var selector = el.nodeName.toLowerCase();\r\n if (el.id) {\r\n selector = '#' + el.id;\r\n path.unshift(selector);\r\n break;\r\n } else {\r\n var sib = el, nth = 1;\r\n while (sib = sib.previousElementSibling) {\r\n if (sib.nodeName.toLowerCase() == selector)\r\n nth++;\r\n }\r\n if (nth != 1)\r\n selector += \":nth-of-type(\" + nth + \")\";\r\n }\r\n path.unshift(selector);\r\n el = el.parentNode;\r\n }\r\n return path.join(\" > \");\r\n}\r\n\r\nexport function getEventTarget(target: HTMLElement | EventTarget) {\r\n const el = target as HTMLElement;\r\n const eventTarget: MbEventTarget = {};\r\n const elementReferenceId = el\r\n .getAttributeNames()\r\n .find((a) => a.startsWith(\"_bl_\"));\r\n if (elementReferenceId) {\r\n eventTarget.elementReferenceId = elementReferenceId;\r\n eventTarget.selector = `[${elementReferenceId}]`;\r\n } else {\r\n eventTarget.selector = getElementSelector(el);\r\n }\r\n\r\n eventTarget.class = el.getAttribute(\"class\");\r\n\r\n return eventTarget;\r\n}\r\n\r\nexport function getElement(elOrString: HTMLElement | string): HTMLElement {\r\n if (typeof elOrString === \"string\") {\r\n return document.querySelector(elOrString);\r\n } else {\r\n return elOrString;\r\n }\r\n}\r\n\r\nexport function getDom(elOrString: Element | string | undefined) {\r\n let element: HTMLElement;\r\n\r\n try {\r\n if (!elOrString) {\r\n element = document.body;\r\n } else if (typeof elOrString === \"string\") {\r\n if (elOrString === \"document\") {\r\n element = document.documentElement;\r\n } else if (elOrString.indexOf(\"__.__\") > 0) {\r\n // for example: el__.__parentElement\r\n let array = elOrString.split(\"__.__\");\r\n let i = 0;\r\n let el = document.querySelector(array[i++]);\r\n\r\n if (el) {\r\n while (array[i]) {\r\n el = el[array[i]];\r\n i++;\r\n }\r\n }\r\n\r\n if (el instanceof HTMLElement) {\r\n element = el;\r\n }\r\n } else {\r\n element = document.querySelector(elOrString);\r\n }\r\n } else {\r\n element = elOrString as HTMLElement;\r\n }\r\n\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n\r\n return element;\r\n}\r\n\r\nexport const canUseDom = !!(\r\n IN_BROWSER &&\r\n typeof document !== 'undefined' &&\r\n window.document &&\r\n window.document.createElement\r\n)\r\n\r\nexport function convertToUnit (str: number, unit?: string): string\r\nexport function convertToUnit (str: string | number | null | undefined, unit?: string): string | undefined\r\nexport function convertToUnit (str: string | number | null | undefined, unit = 'px'): string | undefined {\r\n if (str == null || str === '') {\r\n return undefined\r\n } else if (isNaN(+str!)) {\r\n return String(str)\r\n } else if (!isFinite(+str!)) {\r\n return undefined\r\n } else {\r\n return `${Number(str)}${unit}`\r\n }\r\n}","import { useVelocity } from \"mixins/touch\";\r\nimport { getElement } from \"utils/helper\";\r\n\r\ntype State = {\r\n isActive: boolean;\r\n isTemporary: boolean;\r\n width: number;\r\n touchless: boolean;\r\n position: \"left\" | \"right\" | \"top\" | \"bottom\";\r\n};\r\n\r\nexport function useTouch(\r\n elOrString: HTMLElement | string,\r\n dotNetObject: DotNet.DotNetObject,\r\n state: State\r\n) {\r\n const el = getElement(elOrString);\r\n \r\n if (!el) {\r\n oops()\r\n }\r\n\r\n window.addEventListener(\"touchstart\", onTouchstart, { passive: true });\r\n window.addEventListener(\"touchmove\", onTouchmove, { passive: false });\r\n window.addEventListener(\"touchend\", onTouchend, { passive: true });\r\n\r\n const isHorizontal = [\"left\", \"right\"].includes(state.position);\r\n\r\n const { addMovement, endTouch, getVelocity } = useVelocity();\r\n\r\n let maybeDragging = false;\r\n let isDragging = false;\r\n let dragProgress = 0;\r\n let offset = 0;\r\n let start: [number, number] | undefined;\r\n\r\n let transformBeforeTouchMove = el.style.transform ?? null;\r\n let transitionBeforeTouchMove = el.style.transition ?? null;\r\n\r\n function getOffset(pos: number, active: boolean): number {\r\n return (\r\n (state.position === \"left\"\r\n ? pos\r\n : state.position === \"right\"\r\n ? document.documentElement.clientWidth - pos\r\n : state.position === \"top\"\r\n ? pos\r\n : state.position === \"bottom\"\r\n ? document.documentElement.clientHeight - pos\r\n : oops()) - (active ? state.width : 0)\r\n );\r\n }\r\n\r\n function getProgress(pos: number, limit = true): number {\r\n const progress =\r\n state.position === \"left\"\r\n ? (pos - offset) / state.width\r\n : state.position === \"right\"\r\n ? (document.documentElement.clientWidth - pos - offset) / state.width\r\n : state.position === \"top\"\r\n ? (pos - offset) / state.width\r\n : state.position === \"bottom\"\r\n ? (document.documentElement.clientHeight - pos - offset) / state.width\r\n : oops();\r\n return limit ? Math.max(0, Math.min(1, progress)) : progress;\r\n }\r\n\r\n function onTouchstart(e: TouchEvent) {\r\n if (state.touchless) return;\r\n\r\n transformBeforeTouchMove = el.style.transform ?? null;\r\n transitionBeforeTouchMove = el.style.transition ?? null;\r\n\r\n const touchX = e.changedTouches[0].clientX;\r\n const touchY = e.changedTouches[0].clientY;\r\n\r\n const touchZone = 25;\r\n const inTouchZone: boolean =\r\n state.position === \"left\"\r\n ? touchX < touchZone\r\n : state.position === \"right\"\r\n ? touchX > document.documentElement.clientWidth - touchZone\r\n : state.position === \"top\"\r\n ? touchY < touchZone\r\n : state.position === \"bottom\"\r\n ? touchY > document.documentElement.clientHeight - touchZone\r\n : oops();\r\n\r\n const inElement: boolean =\r\n state.isActive &&\r\n (state.position === \"left\"\r\n ? touchX < state.width\r\n : state.position === \"right\"\r\n ? touchX > document.documentElement.clientWidth - state.width\r\n : state.position === \"top\"\r\n ? touchY < state.width\r\n : state.position === \"bottom\"\r\n ? touchY > document.documentElement.clientHeight - state.width\r\n : oops());\r\n\r\n if (inTouchZone || inElement || (state.isActive && state.isTemporary)) {\r\n start = [touchX, touchY];\r\n\r\n offset = getOffset(isHorizontal ? touchX : touchY, state.isActive);\r\n dragProgress = getProgress(isHorizontal ? touchX : touchY);\r\n\r\n maybeDragging = offset > -20 && offset < 80;\r\n endTouch(e);\r\n addMovement(e);\r\n }\r\n }\r\n\r\n function onTouchmove(e: TouchEvent) {\r\n const touchX = e.changedTouches[0].clientX;\r\n const touchY = e.changedTouches[0].clientY;\r\n\r\n if (maybeDragging) {\r\n if (!e.cancelable) {\r\n maybeDragging = false;\r\n return;\r\n }\r\n\r\n const dx = Math.abs(touchX - start![0]);\r\n const dy = Math.abs(touchY - start![1]);\r\n\r\n const thresholdMet = isHorizontal ? dx > dy && dx > 3 : dy > dx && dy > 3;\r\n\r\n if (thresholdMet) {\r\n isDragging = true;\r\n maybeDragging = false;\r\n } else if ((isHorizontal ? dy : dx) > 3) {\r\n maybeDragging = false;\r\n }\r\n }\r\n\r\n applyDragStyles();\r\n\r\n if (!isDragging) return;\r\n\r\n e.preventDefault();\r\n addMovement(e);\r\n\r\n const progress = getProgress(isHorizontal ? touchX : touchY, false);\r\n dragProgress = Math.max(0, Math.min(1, progress));\r\n\r\n if (progress > 1) {\r\n offset = getOffset(isHorizontal ? touchX : touchY, true);\r\n } else if (progress < 0) {\r\n offset = getOffset(isHorizontal ? touchX : touchY, false);\r\n }\r\n\r\n dotNetObject.invokeMethodAsync(\"TouchMove\", isDragging, dragProgress);\r\n }\r\n\r\n function onTouchend(e: TouchEvent) {\r\n maybeDragging = false;\r\n\r\n if (!isDragging) return;\r\n\r\n addMovement(e);\r\n\r\n isDragging = false;\r\n\r\n applyDragStyles();\r\n\r\n const velocity = getVelocity(e.changedTouches[0].identifier);\r\n const vx = Math.abs(velocity.x);\r\n const vy = Math.abs(velocity.y);\r\n const thresholdMet = isHorizontal ? vx > vy && vx > 400 : vy > vx && vy > 3;\r\n\r\n if (thresholdMet) {\r\n state.isActive =\r\n velocity.direction ===\r\n ({\r\n left: \"right\",\r\n right: \"left\",\r\n top: \"down\",\r\n bottom: \"up\",\r\n }[state.position] || oops());\r\n } else {\r\n state.isActive = dragProgress > 0.5;\r\n }\r\n\r\n dotNetObject.invokeMethodAsync(\"TouchEnd\", state.isActive);\r\n }\r\n\r\n const getDragStyles = () => {\r\n return isDragging\r\n ? {\r\n transform:\r\n state.position === \"left\"\r\n ? `translateX(calc(-100% + ${dragProgress * state.width}px))`\r\n : state.position === \"right\"\r\n ? `translateX(calc(100% - ${dragProgress * state.width}px))`\r\n : state.position === \"top\"\r\n ? `translateY(calc(-100% + ${dragProgress * state.width}px))`\r\n : state.position === \"bottom\"\r\n ? `translateY(calc(100% - ${dragProgress * state.width}px))`\r\n : oops(),\r\n transition: \"none\",\r\n }\r\n : undefined;\r\n };\r\n\r\n const applyDragStyles = () => {\r\n const dragStyles = getDragStyles();\r\n\r\n if (isDragging) {\r\n el.style.setProperty(\"transform\", dragStyles?.transform || \"none\");\r\n el.style.setProperty(\"transition\", dragStyles?.transition || null);\r\n } else {\r\n el.style.setProperty(\"transform\", transformBeforeTouchMove);\r\n el.style.setProperty(\"transition\", transitionBeforeTouchMove);\r\n }\r\n };\r\n\r\n return {\r\n syncState: (newState: State) => {\r\n state = newState;\r\n },\r\n dispose: () => {\r\n dotNetObject.dispose();\r\n window.removeEventListener(\"touchstart\", onTouchstart);\r\n window.removeEventListener(\"touchmove\", onTouchmove);\r\n window.removeEventListener(\"touchend\", onTouchend);\r\n },\r\n };\r\n}\r\n\r\nfunction oops(): never {\r\n throw new Error();\r\n}\r\n"],"names":["__classPrivateFieldGet","receiver","state","kind","f","TypeError","has","call","value","get","SuppressedError","CircularBuffer","constructor","size","this","_CircularBuffer_arr","set","_CircularBuffer_pointer","push","val","__classPrivateFieldSet","values","slice","concat","kineticEnergyToVelocity","work","Math","sqrt","abs","calculateImpulseVelocity","samples","length","t","d","i","vprev","vcurr","useVelocity","touches","addMovement","e","Array","from","changedTouches","forEach","touch","_a","identifier","timeStamp","endTouch","getVelocity","id","reverse","Error","newest","x","y","clientX","clientY","direction","absX","absY","oops","IN_BROWSER","window","passiveSupported","testListenerOpts","Object","defineProperty","addEventListener","removeEventListener","console","warn","useTouch","elOrString","dotNetObject","el","document","querySelector","getElement","onTouchstart","passive","onTouchmove","onTouchend","isHorizontal","includes","position","start","maybeDragging","isDragging","dragProgress","offset","transformBeforeTouchMove","style","transform","transitionBeforeTouchMove","_b","transition","getOffset","pos","active","documentElement","clientWidth","clientHeight","width","getProgress","limit","progress","max","min","touchless","touchX","touchY","inTouchZone","inElement","isActive","isTemporary","cancelable","dx","dy","applyDragStyles","preventDefault","invokeMethodAsync","velocity","vx","vy","thresholdMet","left","right","top","bottom","dragStyles","undefined","setProperty","syncState","newState","dispose","freeze","enter","tab","delete","esc","space","up","down","end","home","del","backspace","insert","pageup","pagedown","shift"],"mappings":"AA8RO,SAASA,EAAuBC,EAAUC,EAAOC,EAAMC,GAC1D,GAAa,MAATD,IAAiBC,EAAG,MAAM,IAAIC,UAAU,iDAC5C,GAAqB,mBAAVH,EAAuBD,IAAaC,IAAUE,GAAKF,EAAMI,IAAIL,GAAW,MAAM,IAAII,UAAU,4EACvG,MAAgB,MAATF,EAAeC,EAAa,MAATD,EAAeC,EAAEG,KAAKN,GAAYG,EAAIA,EAAEI,MAAQN,EAAMO,IAAIR,EACxF,SAsCkD,mBAApBS,iBAAiCA,gBCpU/D,MAAMC,EAIJ,WA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