@fluid-topics/ft-resizer 0.1.6 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ !function(t,i,e,s){
2
+ /**
3
+ * @license
4
+ * Copyright 2021 Google LLC
5
+ * SPDX-LIcense-Identifier: Apache-2.0
6
+ */
7
+ const o=i.css`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`
8
+ /**
9
+ * @license
10
+ * Copyright 2018 Google LLC
11
+ * SPDX-License-Identifier: Apache-2.0
12
+ */;let n=class extends i.LitElement{render(){return i.html`<span><slot></slot></span>`}};n.styles=[o],n=
13
+ /*! *****************************************************************************
14
+ Copyright (c) Microsoft Corporation.
15
+
16
+ Permission to use, copy, modify, and/or distribute this software for any
17
+ purpose with or without fee is hereby granted.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
+ PERFORMANCE OF THIS SOFTWARE.
26
+ ***************************************************************************** */
27
+ function(t,i,e,s){for(var o,n=arguments.length,r=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(i,e,r):o(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r}([e.customElement("mwc-icon")],n);var r=function(t,i,e,s){for(var o,n=arguments.length,r=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,c=t.length-1;c>=0;c--)(o=t[c])&&(r=(n<3?o(r):n>3?o(i,e,r):o(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class c extends CustomEvent{constructor(t,i){super("resize",{detail:{width:t,height:i}})}}const h={colorOutline:s.FtCssVariable.external(s.designSystemVariables.colorOutline,"Design system"),colorOnSurfaceMedium:s.FtCssVariable.external(s.designSystemVariables.colorOnSurfaceMedium,"Design system")};t.FtResizer=class extends s.FtLitElement{constructor(){super(...arguments),this.initialWidth=0,this.initialHeight=0,this.icon="drag_handle",this.cursor="nwse-resize",this.dragging=!1,this.fixedWidth=0,this.fixedHeight=0,this.startX=0,this.startY=0,this.doDragFromMouse=t=>this.doDrag(t.clientX,t.clientY),this.doDragFromTouch=t=>this.doDrag(t.touches[0].clientX,t.touches[0].clientY),this.stopDrag=()=>{this.dragging=!1,document.removeEventListener("mousemove",this.doDragFromMouse,!1),document.removeEventListener("mouseup",this.stopDrag,!1),document.removeEventListener("touchmove",this.doDragFromTouch,!1),document.removeEventListener("touchend",this.stopDrag,!1),document.removeEventListener("touchcancel",this.stopDrag,!1)}}getStyles(){return[s.noTextSelect,i.css`
28
+ :host {
29
+ display: block;
30
+ }
31
+
32
+ .ft-resizer {
33
+ display: flex;
34
+ cursor: ${i.unsafeCSS(this.cursor)}
35
+ }
36
+
37
+ mwc-icon {
38
+ transform: rotate(-45deg);
39
+ color: ${h.colorOutline};
40
+ }
41
+
42
+ .ft-resizer--dragging mwc-icon,
43
+ .ft-resizer:hover mwc-icon {
44
+ color: ${h.colorOnSurfaceMedium};
45
+ }
46
+ `]}getTemplate(){return i.html`
47
+ <div class="ft-resizer ft-no-text-select ${this.dragging?"ft-resizer--dragging":""}"
48
+ @mousedown=${this.initDragFromMouse}
49
+ @touchstart=${this.initDragFromTouch}>
50
+ <mwc-icon>${this.icon}</mwc-icon>
51
+ </div>
52
+ `}initDragFromMouse(t){this.initDrag(t.clientX,t.clientY)}initDragFromTouch(t){t.preventDefault(),t.stopPropagation(),this.initDrag(t.touches[0].clientX,t.touches[0].clientY)}initDrag(t,i){this.dragging=!0,this.startX=t,this.startY=i,this.fixedWidth=this.initialWidth,this.fixedHeight=this.initialHeight,this.installDocumentEventListeners()}installDocumentEventListeners(){document.addEventListener("mousemove",this.doDragFromMouse,!1),document.addEventListener("mouseup",this.stopDrag,!1),document.addEventListener("touchmove",this.doDragFromTouch,!1),document.addEventListener("touchend",this.stopDrag,!1),document.addEventListener("touchcancel",this.stopDrag,!1)}doDrag(t,i){let e=this.fixedWidth+t-this.startX,s=this.fixedHeight+i-this.startY;this.dispatchEvent(new c(e,s))}},t.FtResizer.elementDefinitions={"mwc-icon":n},r([e.property({type:Number})],t.FtResizer.prototype,"initialWidth",void 0),r([e.property({type:Number})],t.FtResizer.prototype,"initialHeight",void 0),r([e.property()],t.FtResizer.prototype,"icon",void 0),r([e.property()],t.FtResizer.prototype,"cursor",void 0),r([e.state()],t.FtResizer.prototype,"dragging",void 0),t.FtResizer=r([e.customElement("ft-resizer")],t.FtResizer),t.FtResizerCssVariables=h,t.ResizeEvent=c,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.wcUtils);
@@ -48,13 +48,27 @@ var ot;null===(ot=window.HTMLSlotElement)||void 0===ot||ot.prototype.assignedEle
48
48
  * @license
49
49
  * Copyright 2021 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */class at extends(function(t){return class extends t{createRenderRoot(){const t=this.constructor,{registry:i,elementDefinitions:e,shadowRootOptions:n}=t;e&&!i&&(t.registry=new CustomElementRegistry,Object.entries(e).forEach((([i,e])=>t.registry.define(i,e))));const o=this.renderOptions.creationScope=this.attachShadow({...n,customElements:t.registry});return a(o,this.constructor.elementStyles),o}}}(Y)){constructor(){super(),this.constructorName=this.constructor.name,this.proto=this.constructor.prototype}getStyles(){return[]}getTemplate(){return null}render(){let t=this.getStyles();return Array.isArray(t)||(t=[t]),L`${t.map((t=>L`<style>${t}</style>`))} ${this.getTemplate()}`}adoptedCallback(){Object.getPrototypeOf(this)!==this.constructorName&&Object.setPrototypeOf(this,this.proto)}updated(t){super.updated(t),setTimeout((()=>this.contentAvailableCallback(t)),0)}contentAvailableCallback(t){}}const lt=s`.ft-no-text-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}`;var ct,ht;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(ht=null===(ct=window.safari)||void 0===ct?void 0:ct.pushNotification)||void 0===ht||ht.toString());
51
+ */class at extends(function(t){return class extends t{createRenderRoot(){const t=this.constructor,{registry:i,elementDefinitions:e,shadowRootOptions:n}=t;e&&!i&&(t.registry=new CustomElementRegistry,Object.entries(e).forEach((([i,e])=>t.registry.define(i,e))));const o=this.renderOptions.creationScope=this.attachShadow({...n,customElements:t.registry});return a(o,this.constructor.elementStyles),o}}}(Y)){constructor(){super(),this.constructorName=this.constructor.name,this.proto=this.constructor.prototype}getStyles(){return[]}getTemplate(){return null}render(){let t=this.getStyles();return Array.isArray(t)||(t=[t]),L`
52
+ ${t.map((t=>L`
53
+ <style>${t}</style>
54
+ `))}
55
+ ${this.getTemplate()}
56
+ `}adoptedCallback(){Object.getPrototypeOf(this)!==this.constructorName&&Object.setPrototypeOf(this,this.proto)}updated(t){super.updated(t),setTimeout((()=>this.contentAvailableCallback(t)),0)}contentAvailableCallback(t){}}const lt=s`
57
+ .ft-no-text-select {
58
+ -webkit-touch-callout: none;
59
+ -webkit-user-select: none;
60
+ -khtml-user-select: none;
61
+ -moz-user-select: none;
62
+ -ms-user-select: none;
63
+ user-select: none;
64
+ }
65
+ `;var ct,ht;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(ht=null===(ct=window.safari)||void 0===ct?void 0:ct.pushNotification)||void 0===ht||ht.toString());
52
66
  /**
53
67
  * @license
54
68
  * Copyright 2021 Google LLC
55
69
  * SPDX-LIcense-Identifier: Apache-2.0
56
70
  */
57
- const ut=s`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:400;font-style:normal;font-size:var(--mdc-icon-size,24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`
71
+ const ut=s`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`
58
72
  /**
59
73
  * @license
60
74
  * Copyright 2018 Google LLC
@@ -74,4 +88,29 @@ const ut=s`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:
74
88
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
75
89
  PERFORMANCE OF THIS SOFTWARE.
76
90
  ***************************************************************************** */
77
- function(t,i,e,n){for(var o,r=arguments.length,s=r<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(i,e,s):o(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s}([it("mwc-icon")],dt);var ft=function(t,i,e,n){for(var o,r=arguments.length,s=r<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(i,e,s):o(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s};class pt extends CustomEvent{constructor(t,i){super("resize",{detail:{width:t,height:i}})}}const vt={colorOutline:rt.external(st.colorOutline,"Design system"),colorOnSurfaceMedium:rt.external(st.colorOnSurfaceMedium,"Design system")};t.FtResizer=class extends at{constructor(){super(...arguments),this.initialWidth=0,this.initialHeight=0,this.icon="drag_handle",this.cursor="nwse-resize",this.dragging=!1,this.fixedWidth=0,this.fixedHeight=0,this.startX=0,this.startY=0,this.doDragFromMouse=t=>this.doDrag(t.clientX,t.clientY),this.doDragFromTouch=t=>this.doDrag(t.touches[0].clientX,t.touches[0].clientY),this.stopDrag=()=>{this.dragging=!1,document.removeEventListener("mousemove",this.doDragFromMouse,!1),document.removeEventListener("mouseup",this.stopDrag,!1),document.removeEventListener("touchmove",this.doDragFromTouch,!1),document.removeEventListener("touchend",this.stopDrag,!1),document.removeEventListener("touchcancel",this.stopDrag,!1)}}getStyles(){return[lt,s`:host{display:block}.ft-resizer{display:flex;cursor:${r(this.cursor)}}mwc-icon{transform:rotate(-45deg);color:${vt.colorOutline}}.ft-resizer--dragging mwc-icon,.ft-resizer:hover mwc-icon{color:${vt.colorOnSurfaceMedium}}`]}getTemplate(){return L`<div class="ft-resizer ft-no-text-select ${this.dragging?"ft-resizer--dragging":""}" @mousedown="${this.initDragFromMouse}" @touchstart="${this.initDragFromTouch}"><mwc-icon>${this.icon}</mwc-icon></div>`}initDragFromMouse(t){this.initDrag(t.clientX,t.clientY)}initDragFromTouch(t){t.preventDefault(),t.stopPropagation(),this.initDrag(t.touches[0].clientX,t.touches[0].clientY)}initDrag(t,i){this.dragging=!0,this.startX=t,this.startY=i,this.fixedWidth=this.initialWidth,this.fixedHeight=this.initialHeight,this.installDocumentEventListeners()}installDocumentEventListeners(){document.addEventListener("mousemove",this.doDragFromMouse,!1),document.addEventListener("mouseup",this.stopDrag,!1),document.addEventListener("touchmove",this.doDragFromTouch,!1),document.addEventListener("touchend",this.stopDrag,!1),document.addEventListener("touchcancel",this.stopDrag,!1)}doDrag(t,i){let e=this.fixedWidth+t-this.startX,n=this.fixedHeight+i-this.startY;this.dispatchEvent(new pt(e,n))}},t.FtResizer.elementDefinitions={"mwc-icon":dt},ft([nt({type:Number})],t.FtResizer.prototype,"initialWidth",void 0),ft([nt({type:Number})],t.FtResizer.prototype,"initialHeight",void 0),ft([nt()],t.FtResizer.prototype,"icon",void 0),ft([nt()],t.FtResizer.prototype,"cursor",void 0),ft([function(t){return nt({...t,state:!0})}()],t.FtResizer.prototype,"dragging",void 0),t.FtResizer=ft([it("ft-resizer")],t.FtResizer),t.FtResizerCssVariables=vt,t.ResizeEvent=pt,Object.defineProperty(t,"t",{value:!0})}({});
91
+ function(t,i,e,n){for(var o,r=arguments.length,s=r<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(i,e,s):o(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s}([it("mwc-icon")],dt);var ft=function(t,i,e,n){for(var o,r=arguments.length,s=r<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(i,e,s):o(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s};class pt extends CustomEvent{constructor(t,i){super("resize",{detail:{width:t,height:i}})}}const vt={colorOutline:rt.external(st.colorOutline,"Design system"),colorOnSurfaceMedium:rt.external(st.colorOnSurfaceMedium,"Design system")};t.FtResizer=class extends at{constructor(){super(...arguments),this.initialWidth=0,this.initialHeight=0,this.icon="drag_handle",this.cursor="nwse-resize",this.dragging=!1,this.fixedWidth=0,this.fixedHeight=0,this.startX=0,this.startY=0,this.doDragFromMouse=t=>this.doDrag(t.clientX,t.clientY),this.doDragFromTouch=t=>this.doDrag(t.touches[0].clientX,t.touches[0].clientY),this.stopDrag=()=>{this.dragging=!1,document.removeEventListener("mousemove",this.doDragFromMouse,!1),document.removeEventListener("mouseup",this.stopDrag,!1),document.removeEventListener("touchmove",this.doDragFromTouch,!1),document.removeEventListener("touchend",this.stopDrag,!1),document.removeEventListener("touchcancel",this.stopDrag,!1)}}getStyles(){return[lt,s`
92
+ :host {
93
+ display: block;
94
+ }
95
+
96
+ .ft-resizer {
97
+ display: flex;
98
+ cursor: ${r(this.cursor)}
99
+ }
100
+
101
+ mwc-icon {
102
+ transform: rotate(-45deg);
103
+ color: ${vt.colorOutline};
104
+ }
105
+
106
+ .ft-resizer--dragging mwc-icon,
107
+ .ft-resizer:hover mwc-icon {
108
+ color: ${vt.colorOnSurfaceMedium};
109
+ }
110
+ `]}getTemplate(){return L`
111
+ <div class="ft-resizer ft-no-text-select ${this.dragging?"ft-resizer--dragging":""}"
112
+ @mousedown=${this.initDragFromMouse}
113
+ @touchstart=${this.initDragFromTouch}>
114
+ <mwc-icon>${this.icon}</mwc-icon>
115
+ </div>
116
+ `}initDragFromMouse(t){this.initDrag(t.clientX,t.clientY)}initDragFromTouch(t){t.preventDefault(),t.stopPropagation(),this.initDrag(t.touches[0].clientX,t.touches[0].clientY)}initDrag(t,i){this.dragging=!0,this.startX=t,this.startY=i,this.fixedWidth=this.initialWidth,this.fixedHeight=this.initialHeight,this.installDocumentEventListeners()}installDocumentEventListeners(){document.addEventListener("mousemove",this.doDragFromMouse,!1),document.addEventListener("mouseup",this.stopDrag,!1),document.addEventListener("touchmove",this.doDragFromTouch,!1),document.addEventListener("touchend",this.stopDrag,!1),document.addEventListener("touchcancel",this.stopDrag,!1)}doDrag(t,i){let e=this.fixedWidth+t-this.startX,n=this.fixedHeight+i-this.startY;this.dispatchEvent(new pt(e,n))}},t.FtResizer.elementDefinitions={"mwc-icon":dt},ft([nt({type:Number})],t.FtResizer.prototype,"initialWidth",void 0),ft([nt({type:Number})],t.FtResizer.prototype,"initialHeight",void 0),ft([nt()],t.FtResizer.prototype,"icon",void 0),ft([nt()],t.FtResizer.prototype,"cursor",void 0),ft([function(t){return nt({...t,state:!0})}()],t.FtResizer.prototype,"dragging",void 0),t.FtResizer=ft([it("ft-resizer")],t.FtResizer),t.FtResizerCssVariables=vt,t.ResizeEvent=pt,Object.defineProperty(t,"t",{value:!0})}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-resizer",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "small",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,9 +19,9 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "^0.1.6",
22
+ "@fluid-topics/ft-wc-utils": "^0.1.9",
23
23
  "@material/mwc-icon": "^0.25.3",
24
24
  "lit": "^2.0.2"
25
25
  },
26
- "gitHead": "c441937eb1375dc40ff477dec50b917f2adf3b38"
26
+ "gitHead": "9f649211936b1529bf691190603f2f721d2a72bd"
27
27
  }