@operato/property-editor 0.1.19 → 0.2.31
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/.storybook/main.js +2 -2
- package/.storybook/server.mjs +4 -4
- package/CHANGELOG.md +16 -1
- package/LICENSE +2 -2
- package/README.md +26 -7
- package/custom-elements.json +317 -0
- package/demo/index.html +18 -4
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +1 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-property-editor.d.ts +28 -0
- package/dist/src/ox-property-editor.js +161 -0
- package/dist/src/ox-property-editor.js.map +1 -0
- package/dist/stories/index.stories.d.ts +1 -1
- package/dist/stories/index.stories.js +11 -15
- package/dist/stories/index.stories.js.map +1 -1
- package/dist/test/property-editor.test.d.ts +1 -0
- package/dist/test/property-editor.test.js +24 -0
- package/dist/test/property-editor.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -33
- package/src/index.ts +1 -3
- package/src/ox-property-editor.ts +158 -0
- package/stories/index.stories.ts +30 -38
- package/test/property-editor.test.ts +34 -0
- package/tsconfig.json +2 -2
- package/web-dev-server.config.mjs +9 -8
- package/web-test-runner.config.mjs +7 -19
- package/.editorconfig +0 -29
- package/demo/index-3dish.html +0 -22
- package/demo/index-angle.html +0 -31
- package/demo/index-button-radio.html +0 -30
- package/dist/src/property-3dish.d.ts +0 -30
- package/dist/src/property-3dish.js +0 -140
- package/dist/src/property-3dish.js.map +0 -1
- package/dist/src/property-angle.d.ts +0 -14
- package/dist/src/property-angle.js +0 -56
- package/dist/src/property-angle.js.map +0 -1
- package/dist/src/property-buttons-radio.d.ts +0 -28
- package/dist/src/property-buttons-radio.js +0 -90
- package/dist/src/property-buttons-radio.js.map +0 -1
- package/dist/src/property-stack.d.ts +0 -21
- package/dist/src/property-stack.js +0 -108
- package/dist/src/property-stack.js.map +0 -1
- package/dist/test/property-angle.test.d.ts +0 -1
- package/dist/test/property-angle.test.js +0 -23
- package/dist/test/property-angle.test.js.map +0 -1
- package/src/property-3dish.ts +0 -150
- package/src/property-angle.ts +0 -56
- package/src/property-buttons-radio.ts +0 -87
- package/src/property-stack.ts +0 -109
- package/test/property-angle.test.ts +0 -32
package/src/property-stack.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { LitElement, css, html } from 'lit'
|
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
7
|
-
|
|
8
|
-
@customElement('property-stack')
|
|
9
|
-
export default class PropertyStack extends LitElement {
|
|
10
|
-
static styles = [
|
|
11
|
-
css`
|
|
12
|
-
:host {
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#add-floor {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 20px;
|
|
19
|
-
background-color: blue;
|
|
20
|
-
color: white;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
div {
|
|
24
|
-
background-color: blue;
|
|
25
|
-
width: calc(100% - 40px);
|
|
26
|
-
width: -webkit-calc(100% - 40px);
|
|
27
|
-
min-height: 20px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
div[active] {
|
|
31
|
-
background-color: red;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
div button {
|
|
35
|
-
position: absolute;
|
|
36
|
-
right: 10px;
|
|
37
|
-
width: 30px;
|
|
38
|
-
min-height: 20px;
|
|
39
|
-
}
|
|
40
|
-
`
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* `stack`은 stack에 의해 만들어진 층의 배열을 유지한다.
|
|
45
|
-
*/
|
|
46
|
-
@property({ type: Array }) stack: { name: string }[] = []
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* `activeIndex`은 현재 active된 층의 인덱스를 유지한다.
|
|
50
|
-
*/
|
|
51
|
-
@property({ type: Number }) activeIndex: number = 0
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
const stack = [...this.stack].reverse()
|
|
55
|
-
const length = stack.length
|
|
56
|
-
|
|
57
|
-
return html`
|
|
58
|
-
<button id="add-floor" @click=${(e: Event) => this._onClickAddFloor(e)}>+</button>
|
|
59
|
-
|
|
60
|
-
${stack.map(
|
|
61
|
-
(item, index) => html`
|
|
62
|
-
<div
|
|
63
|
-
?active=${length - index - 1 == this.activeIndex}
|
|
64
|
-
@click=${(e: Event) => this._onClickToActive(e)}
|
|
65
|
-
idx=${length - index - 1}
|
|
66
|
-
>
|
|
67
|
-
${item.name} <button @click=${(e: Event) => this._onClickRemoveFloor(e)}>-</button>
|
|
68
|
-
</div>
|
|
69
|
-
`
|
|
70
|
-
)}
|
|
71
|
-
`
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_onClickAddFloor(e: Event) {
|
|
75
|
-
this.stack.push({ name: String(this.stack.length + 1) })
|
|
76
|
-
this.requestUpdate()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
_onClickToActive(e: Event) {
|
|
80
|
-
const div = e.target as HTMLElement
|
|
81
|
-
if (div.tagName != 'DIV') {
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
this.activeIndex = Number(div.getAttribute('idx'))
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
_onClickRemoveFloor(e: Event) {
|
|
89
|
-
const div = (e.target as HTMLElement).parentElement
|
|
90
|
-
|
|
91
|
-
if (div?.tagName != 'DIV') {
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const idx = Number(div.getAttribute('idx'))
|
|
96
|
-
|
|
97
|
-
this.stack.splice(idx, 1)
|
|
98
|
-
|
|
99
|
-
if (this.activeIndex == idx) {
|
|
100
|
-
this.activeIndex = 0
|
|
101
|
-
} else if (this.activeIndex >= idx) {
|
|
102
|
-
this.activeIndex--
|
|
103
|
-
} else if (this.activeIndex >= this.stack.length) {
|
|
104
|
-
this.activeIndex = 0
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this.requestUpdate()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { expect, fixture } from '@open-wc/testing'
|
|
2
|
-
|
|
3
|
-
import { PropertyAngle } from '../src/property-angle'
|
|
4
|
-
import { html } from 'lit'
|
|
5
|
-
|
|
6
|
-
describe('PropertyAngle', () => {
|
|
7
|
-
it('has a default title "Hey there" and angle 5', async () => {
|
|
8
|
-
const el = await fixture<PropertyAngle>(html`<property-angle></property-angle>`)
|
|
9
|
-
|
|
10
|
-
expect(el.title).to.equal('Hey there')
|
|
11
|
-
expect(el.radian).to.equal(5)
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('increases the angle on button click', async () => {
|
|
15
|
-
const el = await fixture<PropertyAngle>(html`<property-angle></property-angle>`)
|
|
16
|
-
el.shadowRoot!.querySelector('button')!.click()
|
|
17
|
-
|
|
18
|
-
expect(el.radian).to.equal(6)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('can override the title via attribute', async () => {
|
|
22
|
-
const el = await fixture<PropertyAngle>(html`<property-angle title="attribute title"></property-angle>`)
|
|
23
|
-
|
|
24
|
-
expect(el.title).to.equal('attribute title')
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('passes the a11y audit', async () => {
|
|
28
|
-
const el = await fixture<PropertyAngle>(html`<property-angle></property-angle>`)
|
|
29
|
-
|
|
30
|
-
await expect(el).shadowDom.to.be.accessible()
|
|
31
|
-
})
|
|
32
|
-
})
|