@operato/input 10.9.0 → 10.10.1

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 (35) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/src/image-selector.d.ts +14 -0
  3. package/dist/src/image-selector.js +54 -0
  4. package/dist/src/image-selector.js.map +1 -0
  5. package/dist/src/index.d.ts +1 -0
  6. package/dist/src/index.js +1 -0
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/ox-input-background-pattern.d.ts +15 -2
  9. package/dist/src/ox-input-background-pattern.js +47 -10
  10. package/dist/src/ox-input-background-pattern.js.map +1 -1
  11. package/dist/src/ox-input-color-stops.d.ts +2 -1
  12. package/dist/src/ox-input-color-stops.js +10 -4
  13. package/dist/src/ox-input-color-stops.js.map +1 -1
  14. package/dist/src/ox-input-container.js +18 -1
  15. package/dist/src/ox-input-container.js.map +1 -1
  16. package/dist/src/ox-input-formula.d.ts +1 -1
  17. package/dist/src/ox-input-formula.js +14 -2
  18. package/dist/src/ox-input-formula.js.map +1 -1
  19. package/dist/src/ox-input-search.js +15 -1
  20. package/dist/src/ox-input-search.js.map +1 -1
  21. package/dist/src/ox-input-secret.js +14 -0
  22. package/dist/src/ox-input-secret.js.map +1 -1
  23. package/dist/src/ox-input-select-buttons.js +1 -1
  24. package/dist/src/ox-input-select-buttons.js.map +1 -1
  25. package/dist/test/image-selector.test.d.ts +1 -0
  26. package/dist/test/image-selector.test.js +64 -0
  27. package/dist/test/image-selector.test.js.map +1 -0
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +9 -5
  30. package/test/image-selector.test.ts +82 -0
  31. package/translations/en.json +6 -5
  32. package/translations/ja.json +6 -5
  33. package/translations/ko.json +6 -5
  34. package/translations/ms.json +6 -5
  35. package/translations/zh.json +6 -5
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/input",
3
3
  "description": "Webcomponents for input following open-wc recommendations",
4
4
  "author": "heartyoh@hatiolab.com",
5
- "version": "10.9.0",
5
+ "version": "10.10.1",
6
6
  "type": "module",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
@@ -69,7 +69,8 @@
69
69
  "./ox-input-video.js": "./dist/src/ox-input-video.js",
70
70
  "./ox-input-work-shift.js": "./dist/src/ox-input-work-shift.js",
71
71
  "./ox-select-floor.js": "./dist/src/ox-select-floor.js",
72
- "./ox-select.js": "./dist/src/ox-select.js"
72
+ "./ox-select.js": "./dist/src/ox-select.js",
73
+ "./image-selector.js": "./dist/src/image-selector.js"
73
74
  },
74
75
  "typesVersions": {
75
76
  "*": {
@@ -216,6 +217,9 @@
216
217
  ],
217
218
  "./ox-input-table.js": [
218
219
  "./dist/src/ox-input-table.d.ts"
220
+ ],
221
+ "./image-selector.js": [
222
+ "./dist/src/image-selector.d.ts"
219
223
  ]
220
224
  }
221
225
  },
@@ -247,8 +251,8 @@
247
251
  "@material/web": "^2.0.0",
248
252
  "@operato/i18n": "^10.0.0",
249
253
  "@operato/pickr": "^10.0.0",
250
- "@operato/popup": "^10.9.0",
251
- "@operato/styles": "^10.9.0",
254
+ "@operato/popup": "^10.10.0",
255
+ "@operato/styles": "^10.10.0",
252
256
  "@operato/utils": "^10.7.0",
253
257
  "@types/codemirror": "^5.60.5",
254
258
  "@undecaf/zbar-wasm": "^0.11.0",
@@ -290,5 +294,5 @@
290
294
  "prettier --write"
291
295
  ]
292
296
  },
293
- "gitHead": "5282356a0fbf7601a1bd023cf65ba5dc60986337"
297
+ "gitHead": "b40e170b9e6a24e28935300dd2c77d8b8e5ce8a2"
294
298
  }
@@ -0,0 +1,82 @@
1
+ import { expect, fixture } from '@open-wc/testing'
2
+ import { html } from 'lit'
3
+
4
+ import '../src/ox-input-background-pattern.js'
5
+ import { registerImageSelector } from '../src/image-selector.js'
6
+
7
+ /**
8
+ * The image-picking slot.
9
+ *
10
+ * ## Why this is tested
11
+ *
12
+ * `@operato/input` used to import `@operato/attachment` directly. The bottom layer reached for a
13
+ * feature above it, closing a cycle (input ▶ attachment ▶ data-grist ▶ input) that stopped this
14
+ * package from building — TS5055 on seven files, with `noEmitOnError`.
15
+ *
16
+ * Reversing that arrow has to hold two things:
17
+ *
18
+ * ```
19
+ * never empty with nothing registered there must still be a field; an unregistered
20
+ * custom element renders as a silent empty box
21
+ * value lands either branch carries value-key and raises change, so the value takes
22
+ * the same path out
23
+ * ```
24
+ */
25
+ describe('image-picking field', () => {
26
+ async function pattern(value: any = {}) {
27
+ const el: any = await fixture(html`<ox-input-background-pattern .value=${value}></ox-input-background-pattern>`)
28
+ await el.updateComplete
29
+ return el
30
+ }
31
+
32
+ it('falls back to a text box when nothing is registered', async () => {
33
+ const el = await pattern({ image: 'https://example.com/a.png' })
34
+
35
+ const field = el.renderRoot.querySelector('[value-key="image"]') as HTMLInputElement
36
+
37
+ expect(field, 'no image field at all').to.exist
38
+ expect(field.tagName).to.equal('INPUT')
39
+ expect(field.value, 'existing address did not reach the field').to.equal('https://example.com/a.png')
40
+ })
41
+
42
+ it('takes an address typed into the fallback text box', async () => {
43
+ const el = await pattern({})
44
+
45
+ const field = el.renderRoot.querySelector('[value-key="image"]') as HTMLInputElement
46
+ field.value = 'https://example.com/b.png'
47
+ field.dispatchEvent(new Event('change', { bubbles: true, composed: true }))
48
+
49
+ expect(el.value.image).to.equal('https://example.com/b.png')
50
+ })
51
+
52
+ it('swaps in the registered field, even when registration lands after render', async () => {
53
+ class FakeSelector extends HTMLElement {
54
+ value: any
55
+ properties: any
56
+ }
57
+ customElements.define('test-image-selector', FakeSelector)
58
+
59
+ const el = await pattern({ image: 'https://example.com/c.png' })
60
+
61
+ registerImageSelector('test-image-selector')
62
+ await el.updateComplete
63
+
64
+ const field = el.renderRoot.querySelector('[value-key="image"]') as any
65
+
66
+ expect(field.tagName).to.equal('TEST-IMAGE-SELECTOR')
67
+ expect(field.value).to.equal('https://example.com/c.png')
68
+ expect(field.properties).to.deep.equal({ category: 'image' })
69
+ })
70
+
71
+ it('takes a change raised by the registered field the same way', async () => {
72
+ registerImageSelector('test-image-selector')
73
+
74
+ const el = await pattern({})
75
+ const field = el.renderRoot.querySelector('[value-key="image"]') as any
76
+
77
+ field.value = 'https://example.com/d.png'
78
+ field.dispatchEvent(new Event('change', { bubbles: true, composed: true }))
79
+
80
+ expect(el.value.image).to.equal('https://example.com/d.png')
81
+ })
82
+ })
@@ -20,6 +20,7 @@
20
20
  "label.operators": "operators",
21
21
  "label.privilege": "privilege",
22
22
  "label.protected-request-ip": "safe request IP",
23
+ "label.search": "search",
23
24
  "label.second": "second",
24
25
  "label.second by second": "second by second",
25
26
  "label.seconds": "seconds",
@@ -45,13 +46,13 @@
45
46
  "text.every second": "every second",
46
47
  "text.every sunday": "every sunday",
47
48
  "text.every weekday": "every weekday",
49
+ "text.input-secret-hide": "hide",
50
+ "text.input-secret-placeholder": "enter secret information",
51
+ "text.input-secret-show": "show",
52
+ "text.input-secret-toggle": "show/hide",
48
53
  "text.range of values": "range of values",
49
54
  "text.step values": "step values",
50
55
  "text.the first day of every month": "the first day of every month",
51
56
  "text.the first day of every year": "the first day of every year",
52
- "text.value list separator": "value list separator",
53
- "text.input-secret-placeholder": "enter secret information",
54
- "text.input-secret-show": "show",
55
- "text.input-secret-hide": "hide",
56
- "text.input-secret-toggle": "show/hide"
57
+ "text.value list separator": "value list separator"
57
58
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "演算子",
20
20
  "label.privilege": "権限",
21
21
  "label.protected-request-ip": "安全なリクエスト IP",
22
+ "label.search": "検索キーワード",
22
23
  "label.second": "秒",
23
24
  "label.seconds": "秒",
24
25
  "label.superuser": "スーパーユーザー",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "毎秒",
44
45
  "text.every sunday": "毎週日曜日",
45
46
  "text.every weekday": "平日毎日",
47
+ "text.input-secret-hide": "非表示",
48
+ "text.input-secret-placeholder": "機密情報を入力",
49
+ "text.input-secret-show": "表示",
50
+ "text.input-secret-toggle": "表示/非表示",
46
51
  "text.range of values": "値の範囲",
47
52
  "text.step values": "ステップ値",
48
53
  "text.the first day of every month": "毎月1日",
49
54
  "text.the first day of every year": "毎年1月1日",
50
- "text.value list separator": "値リスト区切り",
51
- "text.input-secret-placeholder": "機密情報を入力",
52
- "text.input-secret-show": "表示",
53
- "text.input-secret-hide": "非表示",
54
- "text.input-secret-toggle": "表示/非表示"
55
+ "text.value list separator": "値リスト区切り"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "연산자",
20
20
  "label.privilege": "권한",
21
21
  "label.protected-request-ip": "안전한 요청 IP",
22
+ "label.search": "검색어",
22
23
  "label.second": "초",
23
24
  "label.seconds": "초",
24
25
  "label.superuser": "수퍼유저",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "매초",
44
45
  "text.every sunday": "매주 일요일마다",
45
46
  "text.every weekday": "평일마다",
47
+ "text.input-secret-hide": "숨기기",
48
+ "text.input-secret-placeholder": "보안 정보 입력",
49
+ "text.input-secret-show": "보기",
50
+ "text.input-secret-toggle": "보기/숨기기",
46
51
  "text.range of values": "값의 범위",
47
52
  "text.step values": "단계 값",
48
53
  "text.the first day of every month": "매월 1일마다",
49
54
  "text.the first day of every year": "매년 1월 1일마다",
50
- "text.value list separator": "값 구분자",
51
- "text.input-secret-placeholder": "보안 정보 입력",
52
- "text.input-secret-show": "보기",
53
- "text.input-secret-hide": "숨기기",
54
- "text.input-secret-toggle": "보기/숨기기"
55
+ "text.value list separator": "값 구분자"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "operator",
20
20
  "label.privilege": "keistimewaan",
21
21
  "label.protected-request-ip": "IP permintaan yang selamat",
22
+ "label.search": "carian",
22
23
  "label.second": "saat",
23
24
  "label.seconds": "saat",
24
25
  "label.superuser": "pengguna super",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "setiap saat",
44
45
  "text.every sunday": "setiap hari Ahad",
45
46
  "text.every weekday": "setiap hari minggu",
47
+ "text.input-secret-hide": "Sembunyi",
48
+ "text.input-secret-placeholder": "Masukkan maklumat rahsia",
49
+ "text.input-secret-show": "Tunjuk",
50
+ "text.input-secret-toggle": "Tunjuk/Sembunyi",
46
51
  "text.range of values": "julat nilai",
47
52
  "text.step values": "nilai langkah",
48
53
  "text.the first day of every month": "hari pertama setiap bulan",
49
54
  "text.the first day of every year": "hari pertama setiap tahun",
50
- "text.value list separator": "pemisah senarai nilai",
51
- "text.input-secret-placeholder": "Masukkan maklumat rahsia",
52
- "text.input-secret-show": "Tunjuk",
53
- "text.input-secret-hide": "Sembunyi",
54
- "text.input-secret-toggle": "Tunjuk/Sembunyi"
55
+ "text.value list separator": "pemisah senarai nilai"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "运算符",
20
20
  "label.privilege": "权限",
21
21
  "label.protected-request-ip": "安全请求 IP",
22
+ "label.search": "搜索关键词",
22
23
  "label.second": "秒",
23
24
  "label.seconds": "秒",
24
25
  "label.superuser": "超级用户",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "每秒",
44
45
  "text.every sunday": "每个星期天",
45
46
  "text.every weekday": "每个工作日",
47
+ "text.input-secret-hide": "隐藏",
48
+ "text.input-secret-placeholder": "输入机密信息",
49
+ "text.input-secret-show": "显示",
50
+ "text.input-secret-toggle": "显示/隐藏",
46
51
  "text.range of values": "值的范围",
47
52
  "text.step values": "步进值",
48
53
  "text.the first day of every month": "每月第一天",
49
54
  "text.the first day of every year": "每年1月1日",
50
- "text.value list separator": "值列表分隔符",
51
- "text.input-secret-placeholder": "输入机密信息",
52
- "text.input-secret-show": "显示",
53
- "text.input-secret-hide": "隐藏",
54
- "text.input-secret-toggle": "显示/隐藏"
55
+ "text.value list separator": "值列表分隔符"
55
56
  }