@untemps/react-vocal 2.0.0-beta.5 → 2.0.0-beta.7

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 (42) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +4 -1
  3. package/dist/index.es.js +99 -78
  4. package/dist/index.js +2 -2
  5. package/dist/index.umd.js +2 -2
  6. package/package.json +7 -1
  7. package/.github/workflows/publish.yml +0 -32
  8. package/.husky/commit-msg +0 -1
  9. package/.husky/pre-commit +0 -1
  10. package/.prettierignore +0 -3
  11. package/.prettierrc +0 -29
  12. package/CLAUDE.md +0 -59
  13. package/assets/icon-idle.png +0 -0
  14. package/assets/icon-listening.png +0 -0
  15. package/assets/microphone.png +0 -0
  16. package/assets/react-vocal.png +0 -0
  17. package/commitlint.config.js +0 -7
  18. package/dev/index.html +0 -24
  19. package/dev/package.json +0 -18
  20. package/dev/public/index.html +0 -24
  21. package/dev/src/index.jsx +0 -58
  22. package/dev/vite.config.js +0 -10
  23. package/dev/yarn.lock +0 -325
  24. package/dist/index.es.js.map +0 -1
  25. package/dist/index.js.map +0 -1
  26. package/dist/index.umd.js.map +0 -1
  27. package/src/components/Icon.jsx +0 -24
  28. package/src/components/Vocal.jsx +0 -233
  29. package/src/components/__tests__/Icon.test.jsx +0 -38
  30. package/src/components/__tests__/Vocal.test.jsx +0 -611
  31. package/src/components/__tests__/VocalWithMockedUseVocal.test.jsx +0 -38
  32. package/src/components/__tests__/__snapshots__/Icon.test.jsx.snap +0 -21
  33. package/src/components/__tests__/__snapshots__/Vocal.test.jsx.snap +0 -28
  34. package/src/hooks/__tests__/useCommands.test.js +0 -115
  35. package/src/hooks/__tests__/useTimeout.test.js +0 -69
  36. package/src/hooks/__tests__/useVocal.test.js +0 -202
  37. package/src/hooks/useCommands.js +0 -75
  38. package/src/hooks/useTimeout.js +0 -21
  39. package/src/hooks/useVocal.js +0 -56
  40. package/src/index.js +0 -7
  41. package/vite.config.js +0 -36
  42. package/vitest.setup.js +0 -77
package/vitest.setup.js DELETED
@@ -1,77 +0,0 @@
1
- import { vi } from 'vitest'
2
- import '@testing-library/jest-dom/vitest'
3
-
4
- Object.defineProperty(global, 'navigator', {
5
- value: { userAgent: 'node.js' },
6
- writable: true,
7
- configurable: true,
8
- })
9
- global.PermissionStatus = vi.fn(function () {
10
- return {
11
- state: 'granted',
12
- addEventListener: vi.fn(),
13
- }
14
- })
15
- global.Permissions = vi.fn(function () {
16
- return {
17
- query: vi.fn().mockResolvedValue(new PermissionStatus()),
18
- }
19
- })
20
- Object.defineProperty(global.navigator, 'permissions', {
21
- value: new Permissions(),
22
- writable: true,
23
- configurable: true,
24
- })
25
- global.MediaDevices = vi.fn(function () {
26
- return {
27
- getUserMedia: vi.fn().mockResolvedValue('foo'),
28
- }
29
- })
30
- Object.defineProperty(global.navigator, 'mediaDevices', {
31
- value: new MediaDevices(),
32
- writable: true,
33
- configurable: true,
34
- })
35
- global.SpeechGrammarList = vi.fn(function () {
36
- return {
37
- length: 0,
38
- }
39
- })
40
- global.SpeechRecognition = vi.fn(function () {
41
- const handlers = {}
42
- return {
43
- addEventListener: vi.fn(function (type, callback) {
44
- handlers[type] = callback
45
- }),
46
- removeEventListener: vi.fn(),
47
- dispatchEvent: vi.fn(),
48
- start: vi.fn(function () {
49
- handlers.start?.()
50
- }),
51
- stop: vi.fn(function () {
52
- handlers.end?.()
53
- }),
54
- abort: vi.fn(function () {
55
- handlers.end?.()
56
- }),
57
- say: vi.fn(function (input) {
58
- handlers.speechstart?.()
59
-
60
- const resultEvent = new Event('result')
61
- resultEvent.resultIndex = 0
62
- resultEvent.results = Array.isArray(input) ? input : input ? [[{ transcript: input }]] : []
63
- handlers.speechend?.()
64
- if (input) {
65
- handlers.result?.(resultEvent)
66
- } else {
67
- handlers.nomatch?.()
68
- }
69
- }),
70
- end: vi.fn(function () {
71
- handlers.end?.()
72
- }),
73
- error: vi.fn(function (err) {
74
- handlers.error?.(err)
75
- }),
76
- }
77
- })