@operato/property-editor 10.29.81 → 10.29.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/stories/ox-properties-dynamic-view.stories.d.ts +60 -0
  2. package/dist/stories/ox-properties-dynamic-view.stories.js +535 -0
  3. package/dist/stories/ox-properties-editor-textarea.stories.d.ts +31 -0
  4. package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
  5. package/package.json +21 -6
  6. package/CHANGELOG.md +0 -6821
  7. package/dist/src/index.js.map +0 -1
  8. package/dist/src/ox-properties-dynamic-view.js.map +0 -1
  9. package/dist/src/ox-property-editor-3axis.js.map +0 -1
  10. package/dist/src/ox-property-editor-3dish.js.map +0 -1
  11. package/dist/src/ox-property-editor-action.js.map +0 -1
  12. package/dist/src/ox-property-editor-angle.js.map +0 -1
  13. package/dist/src/ox-property-editor-backdrop-faces.js.map +0 -1
  14. package/dist/src/ox-property-editor-checkbox.js.map +0 -1
  15. package/dist/src/ox-property-editor-color.js.map +0 -1
  16. package/dist/src/ox-property-editor-crontab.js.map +0 -1
  17. package/dist/src/ox-property-editor-data.js.map +0 -1
  18. package/dist/src/ox-property-editor-date.js.map +0 -1
  19. package/dist/src/ox-property-editor-datetime.js.map +0 -1
  20. package/dist/src/ox-property-editor-description.js.map +0 -1
  21. package/dist/src/ox-property-editor-duration.js.map +0 -1
  22. package/dist/src/ox-property-editor-file.js.map +0 -1
  23. package/dist/src/ox-property-editor-fill-style.js.map +0 -1
  24. package/dist/src/ox-property-editor-gradient-colorstops.js.map +0 -1
  25. package/dist/src/ox-property-editor-hashtags.js.map +0 -1
  26. package/dist/src/ox-property-editor-image.js.map +0 -1
  27. package/dist/src/ox-property-editor-key-values.js.map +0 -1
  28. package/dist/src/ox-property-editor-legend.js.map +0 -1
  29. package/dist/src/ox-property-editor-mass-fraction.js.map +0 -1
  30. package/dist/src/ox-property-editor-month.js.map +0 -1
  31. package/dist/src/ox-property-editor-multiple-colors.js.map +0 -1
  32. package/dist/src/ox-property-editor-number-map.js.map +0 -1
  33. package/dist/src/ox-property-editor-number.js.map +0 -1
  34. package/dist/src/ox-property-editor-options.js.map +0 -1
  35. package/dist/src/ox-property-editor-partition-keys.js.map +0 -1
  36. package/dist/src/ox-property-editor-password.js.map +0 -1
  37. package/dist/src/ox-property-editor-range.js.map +0 -1
  38. package/dist/src/ox-property-editor-scene-component-id.js.map +0 -1
  39. package/dist/src/ox-property-editor-secret.js.map +0 -1
  40. package/dist/src/ox-property-editor-select.js.map +0 -1
  41. package/dist/src/ox-property-editor-signature.js.map +0 -1
  42. package/dist/src/ox-property-editor-solid-colorstops.js.map +0 -1
  43. package/dist/src/ox-property-editor-string.js.map +0 -1
  44. package/dist/src/ox-property-editor-table-column-config.js.map +0 -1
  45. package/dist/src/ox-property-editor-table.js.map +0 -1
  46. package/dist/src/ox-property-editor-textarea.js.map +0 -1
  47. package/dist/src/ox-property-editor-time.js.map +0 -1
  48. package/dist/src/ox-property-editor-unit-number.js.map +0 -1
  49. package/dist/src/ox-property-editor-value-map.js.map +0 -1
  50. package/dist/src/ox-property-editor-value-ranges.js.map +0 -1
  51. package/dist/src/ox-property-editor-work-shift.js.map +0 -1
  52. package/dist/src/ox-property-editor.js.map +0 -1
  53. package/dist/src/types.js.map +0 -1
  54. package/dist/test/date-editors.test.d.ts +0 -2
  55. package/dist/test/date-editors.test.js +0 -45
  56. package/dist/test/date-editors.test.js.map +0 -1
  57. package/dist/test/dynamic-view-copy.test.d.ts +0 -2
  58. package/dist/test/dynamic-view-copy.test.js +0 -22
  59. package/dist/test/dynamic-view-copy.test.js.map +0 -1
  60. package/dist/test/number-map.test.d.ts +0 -1
  61. package/dist/test/number-map.test.js +0 -193
  62. package/dist/test/number-map.test.js.map +0 -1
  63. package/dist/tsconfig.tsbuildinfo +0 -1
  64. package/test/date-editors.test.ts +0 -50
  65. package/test/dynamic-view-copy.test.ts +0 -27
  66. package/test/number-map.test.ts +0 -218
@@ -1,50 +0,0 @@
1
- import { expect, fixture, oneEvent } from '@open-wc/testing'
2
- import { sendKeys } from '@web/test-runner-commands'
3
- import { html } from 'lit'
4
-
5
- import { i18next } from '@operato/i18n'
6
- import { OxInputDate } from '@operato/input/ox-input-date.js'
7
-
8
- import '../src/ox-property-editor-date.js'
9
- import '../src/ox-property-editor-month.js'
10
-
11
- /* A date or a month property is the one field for them (ox-input-date); what is typed there is the property's value. */
12
- describe('date and month property editors', () => {
13
- const touchQuery = OxInputDate.touchQuery
14
- let previousLanguage: string
15
- before(async () => {
16
- OxInputDate.touchQuery = 'not all'
17
- previousLanguage = i18next.language
18
- await i18next.changeLanguage('ko')
19
- })
20
- after(async () => {
21
- OxInputDate.touchQuery = touchQuery
22
- /* The language is kept in the browser's storage; the next test file must not start in Korean. */
23
- await i18next.changeLanguage(previousLanguage)
24
- })
25
-
26
- for (const [tag, start, typed, after] of [
27
- ['date', '2026-01-01', '1110', '2026-11-10'],
28
- ['month', '2026-01', '11월', '2026-11']
29
- ]) {
30
- it(`takes a ${tag} typed into its field`, async () => {
31
- const el = await fixture<any>(
32
- tag === 'date'
33
- ? html`<ox-property-editor-date label="day" .value=${start}></ox-property-editor-date>`
34
- : html`<ox-property-editor-month label="month" .value=${start}></ox-property-editor-month>`
35
- )
36
- const field = el.renderRoot.querySelector('#editor') as OxInputDate
37
- expect(field.tagName).to.equal('OX-INPUT-DATE')
38
- await field.updateComplete
39
- const input = field.renderRoot.querySelector('input') as HTMLInputElement
40
- input.focus()
41
- input.select()
42
- setTimeout(async () => {
43
- await sendKeys({ type: typed })
44
- await sendKeys({ press: 'Enter' })
45
- })
46
- await oneEvent(el, 'change')
47
- expect(el.value).to.equal(after)
48
- })
49
- }
50
- })
@@ -1,27 +0,0 @@
1
- import { expect, fixture, oneEvent } from '@open-wc/testing'
2
- import { html } from 'lit'
3
-
4
- import '../src/ox-properties-dynamic-view.js'
5
- import '../src/ox-property-editor-string.js'
6
- import type { OxPropertiesDynamicView } from '../src/ox-properties-dynamic-view.js'
7
- import { OxPropertyEditor } from '../src/ox-property-editor.js'
8
-
9
- OxPropertyEditor.register({ string: 'ox-property-editor-string' })
10
-
11
- /** An edit never writes into the value the view was given - that may be what a screen read (ADR-0190). */
12
- describe('ox-properties-dynamic-view', () => {
13
- it('tells a new value and leaves the given one as it was', async () => {
14
- const given = { title: 'read' }
15
- const view = await fixture<OxPropertiesDynamicView>(
16
- html`<ox-properties-dynamic-view .props=${[{ type: 'string', name: 'title', label: 'title' }]} .value=${given}></ox-properties-dynamic-view>`
17
- )
18
- await view.updateComplete
19
- const editor = view.querySelector('[name="title"]') as any
20
- editor.value = 'typed'
21
- const told = oneEvent(view, 'property-change')
22
- editor.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
23
- const event = await told
24
- expect(event.detail).to.deep.equal({ title: 'typed' })
25
- expect(given).to.deep.equal({ title: 'read' })
26
- })
27
- })
@@ -1,218 +0,0 @@
1
- import { expect, fixture, oneEvent } from '@open-wc/testing'
2
- import { html } from 'lit'
3
-
4
- import '../src/ox-property-editor-number-map.js'
5
- import type { OxPropertyEditorNumberMap } from '../src/ox-property-editor-number-map.js'
6
-
7
- /**
8
- * Several numbers as one map (ADR-0096): a board's design values for a figure. A value within range becomes part of the
9
- * map and the whole map is told; one outside its range is not taken and the field shows what the map holds.
10
- */
11
- describe('number-map', () => {
12
- const entries = [
13
- { key: 'pitch', label: '롤러 간격', unit: 'mm', min: 100, max: 400, default: 200 },
14
- { key: 'gap', label: '틈', unit: 'mm', min: 0, max: 50, default: 10 }
15
- ]
16
- const make = () =>
17
- fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="designInputs" .property=${{ entries }} .value=${{ pitch: 150 }}></ox-property-editor-number-map>`)
18
- const field = (el: OxPropertyEditorNumberMap, key: string) => el.renderRoot.querySelector(`input[type=number][data-key="${key}"]`) as HTMLInputElement
19
-
20
- it('shows each value, or its default, with its range', async () => {
21
- const el = await make()
22
- expect(field(el, 'pitch').value).to.equal('150')
23
- expect(field(el, 'gap').value).to.equal('10')
24
- expect(field(el, 'pitch').placeholder).to.equal('100–400 (200)')
25
- })
26
-
27
- it('a value within range: the whole map is told', async () => {
28
- const el = await make()
29
- const input = field(el, 'gap')
30
- input.value = '20'
31
- const told = oneEvent(el, 'change')
32
- input.dispatchEvent(new Event('change', { bubbles: true }))
33
- await told
34
- expect(el.value).to.deep.equal({ pitch: 150, gap: 20 })
35
- })
36
-
37
- it('a value outside its range is not taken: nothing is told, the field shows the map again', async () => {
38
- const el = await make()
39
- let told = false
40
- el.addEventListener('change', () => (told = true))
41
- const input = field(el, 'pitch')
42
- input.value = '1000'
43
- input.dispatchEvent(new Event('change', { bubbles: true }))
44
- await el.updateComplete
45
- expect(told).to.equal(false)
46
- expect(el.value).to.deep.equal({ pitch: 150 })
47
- expect(input.value).to.equal('150')
48
- })
49
-
50
- it('an emptied field is not a number: not taken, the field shows the map again', async () => {
51
- const el = await make()
52
- let told = false
53
- el.addEventListener('change', () => (told = true))
54
- const input = field(el, 'gap')
55
- input.value = ''
56
- input.dispatchEvent(new Event('change', { bubbles: true }))
57
- await el.updateComplete
58
- expect(told).to.equal(false)
59
- expect(el.value).to.deep.equal({ pitch: 150 })
60
- expect(input.value).to.equal('10')
61
- })
62
-
63
- it('★ a ranged entry has a slider: every step of a drag is told, and the number follows', async () => {
64
- const el = await make()
65
- const slider = el.renderRoot.querySelector('input[type=range][data-key="gap"]') as HTMLInputElement
66
- let told = 0
67
- el.addEventListener('change', () => told++)
68
- slider.value = '30'
69
- slider.dispatchEvent(new Event('input', { bubbles: true }))
70
- expect(field(el, 'gap').value).to.equal('30')
71
- expect(told).to.equal(1)
72
- expect(el.value).to.deep.equal({ pitch: 150, gap: 30 })
73
- slider.value = '40'
74
- slider.dispatchEvent(new Event('input', { bubbles: true }))
75
- expect(told).to.equal(2)
76
- expect(el.value).to.deep.equal({ pitch: 150, gap: 40 })
77
- })
78
-
79
- it('an entry without a range has no slider; its field takes the room', async () => {
80
- const el = await fixture<OxPropertyEditorNumberMap>(
81
- html`<ox-property-editor-number-map name="clips" .property=${{ entries: [{ key: 'run', label: 'run', min: 0 }] }}></ox-property-editor-number-map>`
82
- )
83
- expect(el.renderRoot.querySelector('input[type=range]')).to.equal(null)
84
- expect(field(el, 'run').hasAttribute('wide')).to.equal(true)
85
- })
86
- })
87
-
88
- /** A figure's data values and motion settings (ADR-0051): a boolean, an enum, and a map of maps for the groups. */
89
- describe('number-map — other kinds and nested keys', () => {
90
- const field = (el: OxPropertyEditorNumberMap, key: string) => el.renderRoot.querySelector(`[data-key="${key}"]`) as HTMLInputElement & HTMLSelectElement
91
-
92
- it('a boolean is a checkbox and an enum a choice; each change tells the whole map, false included', async () => {
93
- const entries = [
94
- { key: 'batteryLow', label: '배터리 부족', kind: 'boolean', default: false },
95
- { key: 'mode', label: '동작', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle' },
96
- { key: 'cadence', label: '동작 속도', unit: 'ratio', min: 0, max: 3, default: 1 }
97
- ]
98
- const el = await fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="figureValues" .property=${{ entries }} .value=${{ batteryLow: true }}></ox-property-editor-number-map>`)
99
- expect(field(el, 'batteryLow').checked).to.equal(true)
100
- expect(field(el, 'mode').value).to.equal('idle')
101
- const box = field(el, 'batteryLow')
102
- box.checked = false
103
- let told = oneEvent(el, 'change')
104
- box.dispatchEvent(new Event('change', { bubbles: true }))
105
- await told
106
- expect(el.value).to.deep.equal({ batteryLow: false })
107
- const choice = field(el, 'mode')
108
- choice.value = 'run'
109
- told = oneEvent(el, 'change')
110
- choice.dispatchEvent(new Event('change', { bubbles: true }))
111
- await told
112
- expect(el.value).to.deep.equal({ batteryLow: false, mode: 'run' })
113
- })
114
-
115
- it('nested: a key a.b is the value b inside a, and writing one keeps the others of a', async () => {
116
- const entries = [
117
- { key: 'locomotion.clip', label: '보행', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle' },
118
- { key: 'locomotion.speed', label: '보행', unit: '×', min: 0, max: 3, default: 0 },
119
- { key: 'locomotion.paused', label: '보행', kind: 'boolean', default: false }
120
- ]
121
- const el = await fixture<OxPropertyEditorNumberMap>(
122
- html`<ox-property-editor-number-map name="motion" .property=${{ entries, nested: true }} .value=${{ locomotion: { clip: 'walk', speed: 1 } }}></ox-property-editor-number-map>`
123
- )
124
- expect(field(el, 'locomotion.clip').value).to.equal('walk')
125
- const speed = el.renderRoot.querySelector('input[type=number][data-key="locomotion.speed"]') as HTMLInputElement
126
- expect(speed.value).to.equal('1')
127
- speed.value = '2'
128
- const told = oneEvent(el, 'change')
129
- speed.dispatchEvent(new Event('change', { bubbles: true }))
130
- await told
131
- expect(el.value).to.deep.equal({ locomotion: { clip: 'walk', speed: 2 } })
132
- })
133
- })
134
-
135
- /**
136
- * Several things edited together that hold different values (a board's figures selected together): an entry marked
137
- * `mixed` shows it is mixed, not its default, until a value is given -- and a value given is shown as any other.
138
- */
139
- describe('number-map — mixed entries', () => {
140
- const entries = [
141
- { key: 'pitch', label: '롤러 간격', unit: 'mm', min: 100, max: 400, default: 200, mixed: true },
142
- { key: 'gap', label: '틈', unit: 'mm', min: 0, max: 50, default: 10 },
143
- { key: 'mode', label: '동작', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle', mixed: true },
144
- { key: 'batteryLow', label: '배터리 부족', kind: 'boolean', default: false, mixed: true }
145
- ]
146
- const make = (value: Record<string, unknown> = { gap: 20 }) =>
147
- fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="figureValues" .property=${{ entries }} .value=${value}></ox-property-editor-number-map>`)
148
- const at = (el: OxPropertyEditorNumberMap, selector: string) => el.renderRoot.querySelector(selector) as HTMLInputElement & HTMLSelectElement
149
-
150
- it('a mixed number: an empty field saying so, the range kept as its title, no thumb on the slider', async () => {
151
- const el = await make()
152
- const field = at(el, 'input[type=number][data-key="pitch"]')
153
- expect(field.value).to.equal('')
154
- expect(field.placeholder).to.equal('Mixed')
155
- expect(field.title).to.equal('100–400 (200)')
156
- expect(field.hasAttribute('mixed')).to.equal(true)
157
- expect(at(el, 'input[type=range][data-key="pitch"]').hasAttribute('mixed')).to.equal(true)
158
- })
159
-
160
- it('an entry not marked mixed shows its value as before', async () => {
161
- const el = await make()
162
- expect(at(el, 'input[type=number][data-key="gap"]').value).to.equal('20')
163
- expect(at(el, 'input[type=number][data-key="gap"]').hasAttribute('mixed')).to.equal(false)
164
- })
165
-
166
- it('a mixed choice is none of its values; a mixed checkbox is indeterminate', async () => {
167
- const el = await make()
168
- const choice = at(el, 'select[data-key="mode"]')
169
- expect(choice.value).to.equal('')
170
- expect(choice.selectedOptions[0].textContent).to.equal('Mixed')
171
- expect(at(el, 'input[type=checkbox][data-key="batteryLow"]').indeterminate).to.equal(true)
172
- })
173
-
174
- it('a value given to a mixed number is told and then shown as any other', async () => {
175
- const el = await make()
176
- const field = at(el, 'input[type=number][data-key="pitch"]')
177
- field.value = '300'
178
- const told = oneEvent(el, 'change')
179
- field.dispatchEvent(new Event('change', { bubbles: true }))
180
- await told
181
- await el.updateComplete
182
- expect(el.value).to.deep.equal({ gap: 20, pitch: 300 })
183
- expect(at(el, 'input[type=number][data-key="pitch"]').value).to.equal('300')
184
- expect(at(el, 'input[type=number][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
185
- expect(at(el, 'input[type=range][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
186
- })
187
-
188
- it('a choice made on a mixed entry is told; it is then that choice', async () => {
189
- const el = await make()
190
- const choice = at(el, 'select[data-key="mode"]')
191
- choice.value = 'run'
192
- const told = oneEvent(el, 'change')
193
- choice.dispatchEvent(new Event('change', { bubbles: true }))
194
- await told
195
- await el.updateComplete
196
- expect(el.value).to.deep.equal({ gap: 20, mode: 'run' })
197
- expect(at(el, 'select[data-key="mode"]').value).to.equal('run')
198
- expect(at(el, 'select[data-key="mode"]').querySelector('option[hidden]')).to.equal(null)
199
- })
200
-
201
- it('a value outside the range on a mixed entry is not taken: the field is empty again, not the default', async () => {
202
- const el = await make()
203
- let told = false
204
- el.addEventListener('change', () => (told = true))
205
- const field = at(el, 'input[type=number][data-key="pitch"]')
206
- field.value = '1000'
207
- field.dispatchEvent(new Event('change', { bubbles: true }))
208
- await el.updateComplete
209
- expect(told).to.equal(false)
210
- expect(field.value).to.equal('')
211
- })
212
-
213
- it('a mixed entry the map holds a value for shows that value', async () => {
214
- const el = await make({ pitch: 250 })
215
- expect(at(el, 'input[type=number][data-key="pitch"]').value).to.equal('250')
216
- expect(at(el, 'input[type=number][data-key="pitch"]').hasAttribute('mixed')).to.equal(false)
217
- })
218
- })