@untemps/react-vocal 2.0.0-beta.6 → 2.0.0-beta.8

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 +24 -0
  2. package/README.md +23 -5
  3. package/dist/index.es.js +233 -759
  4. package/dist/index.js +2 -4
  5. package/package.json +7 -6
  6. package/.github/workflows/publish.yml +0 -32
  7. package/.husky/commit-msg +0 -1
  8. package/.husky/pre-commit +0 -1
  9. package/.prettierignore +0 -3
  10. package/.prettierrc +0 -29
  11. package/CLAUDE.md +0 -59
  12. package/assets/icon-idle.png +0 -0
  13. package/assets/icon-listening.png +0 -0
  14. package/assets/microphone.png +0 -0
  15. package/assets/react-vocal.png +0 -0
  16. package/commitlint.config.js +0 -7
  17. package/dev/index.html +0 -24
  18. package/dev/package.json +0 -18
  19. package/dev/public/index.html +0 -24
  20. package/dev/src/index.jsx +0 -66
  21. package/dev/vite.config.js +0 -10
  22. package/dev/yarn.lock +0 -325
  23. package/dist/index.es.js.map +0 -1
  24. package/dist/index.js.map +0 -1
  25. package/dist/index.umd.js +0 -9
  26. package/dist/index.umd.js.map +0 -1
  27. package/src/components/Icon.jsx +0 -24
  28. package/src/components/Vocal.jsx +0 -261
  29. package/src/components/__tests__/Icon.test.jsx +0 -38
  30. package/src/components/__tests__/Vocal.test.jsx +0 -748
  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 -207
  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 -83
package/vitest.setup.js DELETED
@@ -1,83 +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
- let accumulatedResults = []
43
- return {
44
- addEventListener: vi.fn(function (type, callback) {
45
- handlers[type] = callback
46
- }),
47
- removeEventListener: vi.fn(),
48
- dispatchEvent: vi.fn(),
49
- start: vi.fn(function () {
50
- accumulatedResults = []
51
- handlers.start?.()
52
- }),
53
- stop: vi.fn(function () {
54
- handlers.end?.()
55
- }),
56
- abort: vi.fn(function () {
57
- handlers.end?.()
58
- }),
59
- say: vi.fn(function (input) {
60
- handlers.speechstart?.()
61
-
62
- const newSegments = Array.isArray(input) ? input : input ? [[{ transcript: input }]] : []
63
- const resultIndex = accumulatedResults.length
64
- accumulatedResults = [...accumulatedResults, ...newSegments]
65
-
66
- const resultEvent = new Event('result')
67
- resultEvent.resultIndex = resultIndex
68
- resultEvent.results = accumulatedResults
69
- handlers.speechend?.()
70
- if (input) {
71
- handlers.result?.(resultEvent)
72
- } else {
73
- handlers.nomatch?.()
74
- }
75
- }),
76
- end: vi.fn(function () {
77
- handlers.end?.()
78
- }),
79
- error: vi.fn(function (err) {
80
- handlers.error?.(err)
81
- }),
82
- }
83
- })