@untemps/react-vocal 2.0.0-beta.6 → 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 (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.json +7 -1
  3. package/.github/workflows/publish.yml +0 -32
  4. package/.husky/commit-msg +0 -1
  5. package/.husky/pre-commit +0 -1
  6. package/.prettierignore +0 -3
  7. package/.prettierrc +0 -29
  8. package/CLAUDE.md +0 -59
  9. package/assets/icon-idle.png +0 -0
  10. package/assets/icon-listening.png +0 -0
  11. package/assets/microphone.png +0 -0
  12. package/assets/react-vocal.png +0 -0
  13. package/commitlint.config.js +0 -7
  14. package/dev/index.html +0 -24
  15. package/dev/package.json +0 -18
  16. package/dev/public/index.html +0 -24
  17. package/dev/src/index.jsx +0 -66
  18. package/dev/vite.config.js +0 -10
  19. package/dev/yarn.lock +0 -325
  20. package/dist/index.es.js.map +0 -1
  21. package/dist/index.js.map +0 -1
  22. package/dist/index.umd.js.map +0 -1
  23. package/src/components/Icon.jsx +0 -24
  24. package/src/components/Vocal.jsx +0 -261
  25. package/src/components/__tests__/Icon.test.jsx +0 -38
  26. package/src/components/__tests__/Vocal.test.jsx +0 -748
  27. package/src/components/__tests__/VocalWithMockedUseVocal.test.jsx +0 -38
  28. package/src/components/__tests__/__snapshots__/Icon.test.jsx.snap +0 -21
  29. package/src/components/__tests__/__snapshots__/Vocal.test.jsx.snap +0 -28
  30. package/src/hooks/__tests__/useCommands.test.js +0 -115
  31. package/src/hooks/__tests__/useTimeout.test.js +0 -69
  32. package/src/hooks/__tests__/useVocal.test.js +0 -207
  33. package/src/hooks/useCommands.js +0 -75
  34. package/src/hooks/useTimeout.js +0 -21
  35. package/src/hooks/useVocal.js +0 -56
  36. package/src/index.js +0 -7
  37. package/vite.config.js +0 -36
  38. 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
- })