@operato/contact 8.0.0-alpha.4 → 8.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/src/ox-pfp-edit.d.ts +377 -12
- package/dist/src/ox-pfp-edit.js +72 -126
- package/dist/src/ox-pfp-edit.js.map +1 -1
- package/dist/src/ox-pfp.js +1 -1
- package/dist/src/ox-pfp.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -17
- package/src/ox-pfp-edit.ts +64 -131
- package/src/ox-pfp.ts +1 -1
- package/themes/calendar-theme.css +3 -1
- package/src/ox-zoomable-image.ts +0 -169
- package/stories/ox-zoomable-image.stories.ts +0 -40
package/src/ox-pfp.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class OxPfp extends LitElement {
|
|
|
68
68
|
|
|
69
69
|
render() {
|
|
70
70
|
return this.editMode
|
|
71
|
-
? html`<ox-pfp-edit .profile=${this.profile} name=${this.name || ''}
|
|
71
|
+
? html`<ox-pfp-edit .profile=${this.profile} name=${this.name || ''}>
|
|
72
72
|
<md-icon title="clear" icon="clear" @click=${() => this.edit.clear()}>delete</md-icon>
|
|
73
73
|
<md-icon
|
|
74
74
|
title="save"
|
|
@@ -9,7 +9,8 @@ body {
|
|
|
9
9
|
/* monthly layout */
|
|
10
10
|
--calendar-monthly-ol-margin: var(--margin-default) 0;
|
|
11
11
|
--calendar-monthly-ol-top-border: 2px solid var(--md-sys-color-secondary);
|
|
12
|
-
--calendar-current-
|
|
12
|
+
--calendar-current-month-background-color: var(--md-sys-color-surface-variant);
|
|
13
|
+
--calendar-current-month-color: var(--md-sys-color-on-surface);
|
|
13
14
|
--calendar-monthly-label-align: left;
|
|
14
15
|
--calendar-monthly-label-padding: var(--padding-narrow) 0;
|
|
15
16
|
--calendar-monthly-label-color: var(--md-sys-color-secondary);
|
|
@@ -35,6 +36,7 @@ body {
|
|
|
35
36
|
--calendar-weekly-ol-margin: var(--margin-default) 0;
|
|
36
37
|
--calendar-weekly-ol-top-border: 2px solid var(--md-sys-color-secondary);
|
|
37
38
|
--calendar-current-week-background-color: var(--md-sys-color-surface-variant);
|
|
39
|
+
--calendar-current-week-color: var(--md-sys-color-on-surface);
|
|
38
40
|
--calendar-weekly-label-align: center;
|
|
39
41
|
--calendar-weekly-label-padding: var(--padding-narrow) 0;
|
|
40
42
|
--calendar-weekly-label-color: var(--md-sys-color-secondary);
|
package/src/ox-zoomable-image.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { css, LitElement, PropertyValues } from 'lit'
|
|
2
|
-
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
function getPoint(e: Event): { x: number; y: number } | undefined {
|
|
5
|
-
if ((e as MouseEvent).button == 0) {
|
|
6
|
-
return {
|
|
7
|
-
x: (e as MouseEvent).clientX,
|
|
8
|
-
y: (e as MouseEvent).clientY
|
|
9
|
-
}
|
|
10
|
-
} else if ((e as TouchEvent).touches?.length == 1) {
|
|
11
|
-
const touch = (e as TouchEvent).touches[0]
|
|
12
|
-
return {
|
|
13
|
-
x: touch.clientX,
|
|
14
|
-
y: touch.clientY
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@customElement('ox-zoomable-image')
|
|
22
|
-
export class OxZoomableImage extends LitElement {
|
|
23
|
-
static styles = css`
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
position: relative;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 100%;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host::before {
|
|
33
|
-
content: '';
|
|
34
|
-
display: block;
|
|
35
|
-
|
|
36
|
-
position: absolute;
|
|
37
|
-
top: 0;
|
|
38
|
-
right: 0;
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
|
|
42
|
-
background-image: var(
|
|
43
|
-
--background-image,
|
|
44
|
-
linear-gradient(var(--primary-color, lightgray), var(--primary-color, lightgray))
|
|
45
|
-
);
|
|
46
|
-
transform: var(--image-transform, '');
|
|
47
|
-
background-size: 100% 100%;
|
|
48
|
-
}
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
@property({ type: String }) src?: string
|
|
52
|
-
|
|
53
|
-
@state() zoom: number = 1
|
|
54
|
-
@state() left: number = 0
|
|
55
|
-
@state() top: number = 0
|
|
56
|
-
|
|
57
|
-
private dragStart?: { x: number; y: number }
|
|
58
|
-
|
|
59
|
-
private dragEndHandler = this.onDragEnd.bind(this) as EventListener
|
|
60
|
-
private dragMoveHandler = this.onDragMove.bind(this) as EventListener
|
|
61
|
-
private dragStartHandler = this.onDragStart.bind(this) as EventListener
|
|
62
|
-
private wheelEventHandler = this.onWheelEvent.bind(this) as EventListener
|
|
63
|
-
private resetHandler = this.onReset.bind(this) as EventListener
|
|
64
|
-
|
|
65
|
-
connectedCallback(): void {
|
|
66
|
-
super.connectedCallback()
|
|
67
|
-
|
|
68
|
-
this.addEventListener('mousewheel', this.wheelEventHandler, false)
|
|
69
|
-
|
|
70
|
-
this.addEventListener('mousedown', this.dragStartHandler)
|
|
71
|
-
this.addEventListener('touchstart', this.dragStartHandler)
|
|
72
|
-
this.addEventListener('dblclick', this.resetHandler)
|
|
73
|
-
|
|
74
|
-
document.addEventListener('mouseup', this.dragEndHandler)
|
|
75
|
-
document.addEventListener('touchend', this.dragEndHandler)
|
|
76
|
-
document.addEventListener('touchcancel', this.dragEndHandler)
|
|
77
|
-
document.addEventListener('mousemove', this.dragMoveHandler)
|
|
78
|
-
document.addEventListener('touchmove', this.dragMoveHandler)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
disconnectedCallback() {
|
|
82
|
-
this.removeEventListener('mousewheel', this.wheelEventHandler, false)
|
|
83
|
-
|
|
84
|
-
this.removeEventListener('mousedown', this.dragStartHandler!)
|
|
85
|
-
this.removeEventListener('touchstart', this.dragStartHandler!)
|
|
86
|
-
this.removeEventListener('dblclick', this.resetHandler!)
|
|
87
|
-
|
|
88
|
-
document.removeEventListener('mouseup', this.dragEndHandler!)
|
|
89
|
-
document.removeEventListener('touchend', this.dragEndHandler!)
|
|
90
|
-
document.removeEventListener('touchcancel', this.dragEndHandler!)
|
|
91
|
-
document.removeEventListener('mousemove', this.dragMoveHandler!)
|
|
92
|
-
document.removeEventListener('touchmove', this.dragMoveHandler!)
|
|
93
|
-
|
|
94
|
-
super.disconnectedCallback()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
updated(changes: PropertyValues<this>) {
|
|
98
|
-
const style = this.style
|
|
99
|
-
|
|
100
|
-
if (changes.has('src') && this.src) {
|
|
101
|
-
style.setProperty('--background-image', `url('${this.src}')`)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
style.setProperty('--image-transform', `translate(${this.left}%, ${this.top}%) scale(${this.zoom}, ${this.zoom})`)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
onWheelEvent(e: MouseEvent) {
|
|
108
|
-
e.preventDefault()
|
|
109
|
-
|
|
110
|
-
var delta = Math.max(-1, Math.min(1, (e as WheelEvent).deltaY || -(e as WheelEvent).detail))
|
|
111
|
-
|
|
112
|
-
this.zoom *= 1 - delta / 20
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
onDragStart(e: Event) {
|
|
116
|
-
const point = getPoint(e)
|
|
117
|
-
|
|
118
|
-
if (point) {
|
|
119
|
-
this.dragStart = point
|
|
120
|
-
e.stopPropagation()
|
|
121
|
-
return false
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
onDragMove(e: Event) {
|
|
126
|
-
if (!this.dragStart) {
|
|
127
|
-
return false
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const point = getPoint(e)
|
|
131
|
-
|
|
132
|
-
if (!point) {
|
|
133
|
-
return false
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
e.stopPropagation()
|
|
137
|
-
e.preventDefault()
|
|
138
|
-
|
|
139
|
-
const dragStart = point
|
|
140
|
-
var { x, y } = point
|
|
141
|
-
|
|
142
|
-
x -= this.dragStart.x
|
|
143
|
-
y -= this.dragStart.y
|
|
144
|
-
|
|
145
|
-
this.dragStart = dragStart
|
|
146
|
-
|
|
147
|
-
const { offsetHeight, offsetWidth } = this
|
|
148
|
-
|
|
149
|
-
this.top += (y / offsetHeight) * 100
|
|
150
|
-
this.left += (x / offsetWidth) * 100
|
|
151
|
-
|
|
152
|
-
return false
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
onDragEnd(e: Event) {
|
|
156
|
-
if (this.dragStart) {
|
|
157
|
-
e.stopPropagation()
|
|
158
|
-
e.preventDefault()
|
|
159
|
-
|
|
160
|
-
delete this.dragStart
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
onReset(e: Event) {
|
|
165
|
-
this.zoom = 1
|
|
166
|
-
this.left = 0
|
|
167
|
-
this.top = 0
|
|
168
|
-
}
|
|
169
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import '@operato/i18n'
|
|
2
|
-
import '../src/ox-zoomable-image.js'
|
|
3
|
-
|
|
4
|
-
import { html, TemplateResult } from 'lit'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'ox-zoomable-image',
|
|
8
|
-
component: 'ox-zoomable-image',
|
|
9
|
-
argTypes: {
|
|
10
|
-
src: { control: 'text' }
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface Story<T> {
|
|
15
|
-
(args: T): TemplateResult
|
|
16
|
-
args?: Partial<T>
|
|
17
|
-
argTypes?: Record<string, unknown>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface ArgTypes {
|
|
21
|
-
src?: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Template: Story<ArgTypes> = ({ src = '' }: ArgTypes) => html`
|
|
25
|
-
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
26
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
27
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
28
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
29
|
-
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
30
|
-
<link href="/themes/form-theme.css" rel="stylesheet" />
|
|
31
|
-
|
|
32
|
-
<div style="height: 300px">
|
|
33
|
-
<ox-zoomable-image src=${src} style="width: 300px; height: 300px"> </ox-zoomable-image>
|
|
34
|
-
</div>
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
export const Regular = Template.bind({})
|
|
38
|
-
Regular.args = {
|
|
39
|
-
src: '/assets/sample-image.png'
|
|
40
|
-
}
|