@luzmo/lucero 1.0.1-alpha.4 → 1.0.1-alpha.42

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 (253) hide show
  1. package/components/accordion/index.cjs +6 -6
  2. package/components/accordion/index.js +14 -13
  3. package/components/action-bar/index.cjs +4 -4
  4. package/components/action-bar/index.js +20 -18
  5. package/components/action-button/index.cjs +3 -3
  6. package/components/action-button/index.js +7 -6
  7. package/components/action-group/index.cjs +1 -1
  8. package/components/action-group/index.js +2 -2
  9. package/components/{action-group-DBImibFn.js → action-group-Bwt9w8Vh.js} +10 -9
  10. package/components/action-group-D917z7XF.cjs +20 -0
  11. package/components/action-menu/index.cjs +9 -9
  12. package/components/action-menu/index.js +10 -10
  13. package/components/avatar/index.cjs +3 -3
  14. package/components/avatar/index.js +7 -7
  15. package/components/base-5nDSSNeT.cjs +18 -0
  16. package/components/base-CdYjmV_8.js +96 -0
  17. package/components/button/button-base.d.ts +16 -0
  18. package/components/button/button.d.ts +38 -2
  19. package/components/button/index.cjs +2 -2
  20. package/components/button/index.js +84 -50
  21. package/components/{button-base-DbkDzb71.js → button-base-B_SkfcFn.js} +54 -39
  22. package/components/button-base-BdzHcHRs.cjs +25 -0
  23. package/components/button-group/index.cjs +1 -1
  24. package/components/button-group/index.js +11 -9
  25. package/components/calendar/index.cjs +96 -1
  26. package/components/calendar/index.js +538 -6
  27. package/components/chat-message/chat-message.d.ts +127 -0
  28. package/components/chat-message/index.cjs +80 -0
  29. package/components/chat-message/index.d.ts +8 -0
  30. package/components/chat-message/index.js +254 -0
  31. package/components/chat-message-group/chat-message-group.d.ts +50 -0
  32. package/components/chat-message-group/index.cjs +24 -0
  33. package/components/chat-message-group/index.d.ts +7 -0
  34. package/components/chat-message-group/index.js +144 -0
  35. package/components/checkbox/index.cjs +4 -4
  36. package/components/checkbox/index.js +12 -10
  37. package/components/{checkbox-mixin-Do7EgtpQ.js → checkbox-mixin-DUbGDm7f.js} +9 -9
  38. package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-DhN8CIXY.cjs} +3 -3
  39. package/components/close-button-CGZxCNlI.js +52 -0
  40. package/components/close-button-Decm0Qbb.cjs +18 -0
  41. package/components/color-area/index.cjs +5 -5
  42. package/components/color-area/index.js +12 -11
  43. package/components/color-controller-7sNUf7SP.js +386 -0
  44. package/components/color-controller-ChN-A9Ft.cjs +18 -0
  45. package/components/color-field/color-field.d.ts +8 -0
  46. package/components/color-field/index.cjs +4 -4
  47. package/components/color-field/index.js +38 -25
  48. package/components/color-handle/index.cjs +2 -2
  49. package/components/color-handle/index.js +8 -6
  50. package/components/color-loupe/index.cjs +1 -1
  51. package/components/color-loupe/index.js +2 -2
  52. package/components/color-loupe-CIEFp7ln.cjs +56 -0
  53. package/components/{color-loupe-CmMsXbjT.js → color-loupe-CLPX6xVb.js} +6 -4
  54. package/components/color-menu/index.cjs +8 -8
  55. package/components/color-menu/index.js +46 -46
  56. package/components/color-palette/color-palette.d.ts +6 -2
  57. package/components/color-palette/index.cjs +1 -1
  58. package/components/color-palette/index.js +35 -34
  59. package/components/color-palette-group/color-palette-group.d.ts +79 -0
  60. package/components/color-palette-group/index.cjs +28 -0
  61. package/components/color-palette-group/index.d.ts +7 -0
  62. package/components/color-palette-group/index.js +206 -0
  63. package/components/color-picker/color-picker.d.ts +31 -2
  64. package/components/color-picker/index.cjs +6 -5
  65. package/components/color-picker/index.js +16 -12
  66. package/components/color-slider/index.cjs +40 -1
  67. package/components/color-slider/index.js +452 -6
  68. package/components/date-time-picker/index.cjs +16 -16
  69. package/components/date-time-picker/index.js +105 -106
  70. package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-CO-VPlqq.js} +4 -4
  71. package/components/{dependency-manger-C5HCkMMB.cjs → dependency-manger-uthev62E.cjs} +1 -1
  72. package/components/divider/index.cjs +1 -1
  73. package/components/divider/index.js +11 -9
  74. package/components/field-group/index.cjs +1 -1
  75. package/components/field-group/index.js +2 -2
  76. package/components/field-group-BYHNJmv0.cjs +23 -0
  77. package/components/{field-group-DXfBWrkO.js → field-group-CHmw159R.js} +7 -5
  78. package/components/field-label/index.cjs +1 -1
  79. package/components/field-label/index.js +2 -2
  80. package/components/{field-label-CZ2zzChK.js → field-label-Cy3xMWZ-.js} +9 -8
  81. package/components/field-label-DZoeqJJX.cjs +25 -0
  82. package/components/{focus-visible-DBlJGoEW.js → focus-visible-BvScGDCE.js} +20 -20
  83. package/components/focus-visible-D4BXb5RB.cjs +18 -0
  84. package/components/{focusable-BxtpnzWp.js → focusable-BjvsvVam.js} +3 -2
  85. package/components/focusable-CbVKgGfS.cjs +18 -0
  86. package/components/icon/index.cjs +1 -1
  87. package/components/icon/index.js +22 -20
  88. package/components/index.cjs +205 -1
  89. package/components/index.js +972 -167
  90. package/components/infield-button/index.cjs +2 -2
  91. package/components/infield-button/index.js +6 -5
  92. package/components/label/index.cjs +1 -1
  93. package/components/label/index.js +7 -5
  94. package/components/{language-resolution-8yZa5r_P.js → language-resolution-B-wjV5bb.js} +9 -8
  95. package/components/{directive-C7oCP5Bh.cjs → language-resolution-EUER43cg.cjs} +1 -5
  96. package/components/like-anchor-B2EqJPdw.cjs +32 -0
  97. package/components/{like-anchor-Bvn_vLQ8.js → like-anchor-CgqCU210.js} +23 -22
  98. package/components/{manage-help-text-DhgARkZX.cjs → manage-help-text-Bat9yGvF.cjs} +3 -3
  99. package/components/{manage-help-text-syYnjKGL.js → manage-help-text-C9sCHK3R.js} +8 -8
  100. package/components/menu/index.cjs +38 -13
  101. package/components/menu/index.js +138 -105
  102. package/components/menu/menu-item.d.ts +8 -1
  103. package/components/multi-language-field/index.cjs +2 -2
  104. package/components/multi-language-field/index.js +9 -7
  105. package/components/number-field/index.cjs +5 -5
  106. package/components/number-field/index.js +122 -85
  107. package/components/number-field/number-field.d.ts +145 -0
  108. package/components/observe-slot-presence-CNltc0C0.cjs +18 -0
  109. package/components/{observe-slot-presence-CmVi0zTc.js → observe-slot-presence-DFi6GE3H.js} +1 -1
  110. package/components/observe-slot-text-CBMHpuIK.cjs +18 -0
  111. package/components/{observe-slot-text-BPfIQQtz.js → observe-slot-text-DorVpCL4.js} +14 -15
  112. package/components/options/index.cjs +26 -58
  113. package/components/options/index.js +205 -849
  114. package/components/overlay/index.cjs +6 -6
  115. package/components/overlay/index.js +31 -32
  116. package/components/overlay-BhrVS5h7.cjs +47 -0
  117. package/components/overlay-C-No3oJQ.js +1736 -0
  118. package/components/{pending-state-CaH1si5b.cjs → pending-state-DQctFHI8.cjs} +2 -2
  119. package/components/{pending-state-DTX7ggyF.js → pending-state-Dx1u3EXA.js} +2 -2
  120. package/components/picker/index.cjs +1 -1
  121. package/components/picker/index.js +3 -3
  122. package/components/picker-DxYgh4LR.cjs +123 -0
  123. package/components/{picker-BmoXv1jt.js → picker-GyeSAxxY.js} +45 -45
  124. package/components/picker-button/index.cjs +4 -4
  125. package/components/picker-button/index.js +9 -8
  126. package/components/{platform-BiXhwqk3.cjs → platform-BJnOJJag.cjs} +1 -1
  127. package/components/{platform-BM-uMWpX.js → platform-CqwNrovd.js} +12 -12
  128. package/components/popover/index.cjs +1 -1
  129. package/components/popover/index.js +2 -2
  130. package/components/popover-lcZnODPK.cjs +30 -0
  131. package/components/{popover-DjX0aAnY.js → popover-ucIgjbQs.js} +8 -7
  132. package/components/progress-circle/index.cjs +1 -1
  133. package/components/progress-circle/index.js +2 -2
  134. package/components/{progress-circle-DXH9z8-6.js → progress-circle-D5J0ZwY0.js} +8 -7
  135. package/components/progress-circle-DgMbqrzG.cjs +33 -0
  136. package/components/prompt-box/index.d.ts +8 -0
  137. package/components/prompt-box/prompt-box.d.ts +326 -0
  138. package/components/radio/index.cjs +2 -2
  139. package/components/radio/index.js +12 -11
  140. package/components/search/index.cjs +6 -6
  141. package/components/search/index.js +6 -6
  142. package/components/select/index.cjs +43 -42
  143. package/components/select/index.js +142 -126
  144. package/components/select/select.d.ts +1 -1
  145. package/components/{base-BjTwmyRF.cjs → sized-mixin-DcvJLFeo.cjs} +1 -5
  146. package/components/{sized-mixin-D4ACoVUr.js → sized-mixin-cJbo3PKR.js} +5 -5
  147. package/components/slider/index.cjs +1 -1
  148. package/components/slider/index.js +48 -1101
  149. package/components/{strategies-9indNIEb.js → strategies-Bk97oVn1.js} +15 -50
  150. package/components/strategies-CNgBb6dM.cjs +18 -0
  151. package/components/{streaming-listener-CP-JE6Fa.js → streaming-listener-BlWm-XZU.js} +5 -6
  152. package/components/streaming-listener-D9Wc7skA.cjs +18 -0
  153. package/components/swatch/index.cjs +7 -7
  154. package/components/swatch/index.js +18 -17
  155. package/components/switch/index.cjs +2 -2
  156. package/components/switch/index.js +6 -5
  157. package/components/tabs/index.cjs +16 -24
  158. package/components/tabs/index.js +94 -162
  159. package/components/tags/index.cjs +5 -5
  160. package/components/tags/index.js +39 -25
  161. package/components/tags/tag.d.ts +2 -0
  162. package/components/tags/tags.d.ts +3 -1
  163. package/components/text-field/index.cjs +3 -3
  164. package/components/text-field/index.js +13 -11
  165. package/components/text-field/text-field.d.ts +1 -0
  166. package/components/{text-field-BIADXoLC.js → text-field-BHaLKkf1.js} +73 -99
  167. package/components/text-field-DFP7p8Rv.cjs +81 -0
  168. package/components/text-field.module-Bp4Mwuvj.js +21 -0
  169. package/components/text-field.module-eAEqjvZu.cjs +18 -0
  170. package/components/toast/index.cjs +11 -11
  171. package/components/toast/index.js +12 -10
  172. package/components/tooltip/index.cjs +4 -4
  173. package/components/tooltip/index.js +60 -36
  174. package/components/tooltip/tooltip.d.ts +12 -1
  175. package/components/utils.cjs +1 -1
  176. package/components/utils.js +14 -12
  177. package/components/voice-recorder-BRq_gEkz.js +210 -0
  178. package/components/voice-recorder-CAm5iDre.cjs +18 -0
  179. package/custom-elements.json +1 -1
  180. package/index.d.ts +4 -1
  181. package/package.json +84 -6
  182. package/utils/index.d.ts +1 -0
  183. package/utils/voice-recorder.d.ts +121 -0
  184. package/components/NumberFormatter-DewVDY5w.cjs +0 -18
  185. package/components/NumberFormatter-DgOUVrge.js +0 -136
  186. package/components/NumberParser-Dik4a0h-.cjs +0 -18
  187. package/components/NumberParser-ci9J5EKv.js +0 -173
  188. package/components/action-group-DJGMcRHb.cjs +0 -20
  189. package/components/async-directive-BX1T1e1_.cjs +0 -22
  190. package/components/async-directive-BfcqVjDp.js +0 -82
  191. package/components/base-CBCg3yyw.cjs +0 -40
  192. package/components/base-D76d76ww.js +0 -26
  193. package/components/base-WsynuqaS.js +0 -677
  194. package/components/button-base-XgPLmwP-.cjs +0 -25
  195. package/components/class-map-Di1D_rCm.cjs +0 -22
  196. package/components/class-map-NbVXqBU0.js +0 -51
  197. package/components/clear-button-DoeRUWQ3.js +0 -53
  198. package/components/clear-button-Qi1pMA5S.cjs +0 -18
  199. package/components/close-button-BFMBEw3q.cjs +0 -18
  200. package/components/close-button-BWXdHSx3.js +0 -51
  201. package/components/color-controller-DTp1juRz.js +0 -3198
  202. package/components/color-controller-_ZwyhvaU.cjs +0 -18
  203. package/components/color-loupe-CaA_Lfkk.cjs +0 -56
  204. package/components/directive-helpers-Cm6gitnu.js +0 -62
  205. package/components/directive-helpers-DyIRTWwA.cjs +0 -22
  206. package/components/directive-oAbCiebi.js +0 -44
  207. package/components/field-group-DkGst3r5.cjs +0 -23
  208. package/components/field-label-mO1AkUgR.cjs +0 -25
  209. package/components/flow-D-0MTYCm.js +0 -527
  210. package/components/flow-DM3dNAKs.cjs +0 -30
  211. package/components/focus-visible-B0P9aY_G.cjs +0 -18
  212. package/components/focusable-EbipgXRh.cjs +0 -18
  213. package/components/if-defined-C9YGdo33.cjs +0 -22
  214. package/components/if-defined-DOaE2coe.js +0 -27
  215. package/components/index-A-yOTB_d.js +0 -1490
  216. package/components/index-BLWuwZXx.cjs +0 -113
  217. package/components/index-BwxgAdzi.cjs +0 -57
  218. package/components/index-HjQa8tew.js +0 -1174
  219. package/components/language-resolution-DJzmyzZq.cjs +0 -18
  220. package/components/like-anchor-sod1C1fR.cjs +0 -32
  221. package/components/luzmo-icons-DbwDQtuO.js +0 -229
  222. package/components/luzmo-icons-DletXGWU.cjs +0 -29
  223. package/components/mutation-controller-DH7YOCyj.js +0 -52
  224. package/components/mutation-controller-DkOMCW-c.cjs +0 -22
  225. package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
  226. package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
  227. package/components/overlay-Cig9r6uU.js +0 -2747
  228. package/components/overlay-KSKMzzkh.cjs +0 -47
  229. package/components/picker-DWsBWdPN.cjs +0 -123
  230. package/components/popover-KFfO0IYL.cjs +0 -30
  231. package/components/progress-circle-BvRJNuNo.cjs +0 -33
  232. package/components/query-BL-TJj7K.cjs +0 -22
  233. package/components/query-D_KR_GUc.js +0 -51
  234. package/components/query-assigned-elements-DjfhL1cl.js +0 -36
  235. package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
  236. package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
  237. package/components/query-assigned-nodes-C76XVPWY.js +0 -36
  238. package/components/sized-mixin-CPxE5C96.cjs +0 -18
  239. package/components/state-D8JEtYqe.cjs +0 -22
  240. package/components/state-Deh-vKYE.js +0 -29
  241. package/components/strategies-BACP6MhR.cjs +0 -18
  242. package/components/streaming-listener-B00MvALi.cjs +0 -18
  243. package/components/style-map-CeilmSgs.cjs +0 -22
  244. package/components/style-map-IgqIKvlE.js +0 -53
  245. package/components/text-field-D5d_Gt0t.cjs +0 -85
  246. package/components/text-field.module-ColtFhf_.js +0 -21
  247. package/components/text-field.module-p_VF2tC_.cjs +0 -18
  248. package/components/unit-input/index.cjs +0 -43
  249. package/components/unit-input/index.d.ts +0 -7
  250. package/components/unit-input/index.js +0 -183
  251. package/components/unit-input/unit-input.d.ts +0 -33
  252. package/components/when-CDK1Tt5Y.js +0 -28
  253. package/components/when-CDZyJPvd.cjs +0 -22
@@ -0,0 +1,210 @@
1
+ /*! * Lucero - The design system for Luzmo.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
+ * This license allows users with a current active Luzmo account to use Lucero.
7
+ * This license terminates automatically if a user no longer has an active Luzmo account.
8
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
+ * SOFTWARE.
17
+ * */
18
+ class c {
19
+ constructor(t = {}) {
20
+ this.mediaRecorder = null, this.audioChunks = [], this.isRecording = !1, this.stream = null, this.recordingStartTime = 0, this.mimeType = "", this.audioContext = null, this.analyser = null, this.animationFrame = null, this.durationInterval = null, this.maxDuration = t.maxDuration ?? 3e5, this.audioBitsPerSecond = t.audioBitsPerSecond ?? 128e3;
21
+ }
22
+ /**
23
+ * Check if the browser supports audio recording.
24
+ */
25
+ static isSupported() {
26
+ return !!(typeof navigator < "u" && navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia == "function" && typeof MediaRecorder < "u");
27
+ }
28
+ /**
29
+ * Get the best supported MIME type for recording.
30
+ */
31
+ getSupportedMimeType() {
32
+ const t = [
33
+ "audio/webm;codecs=opus",
34
+ "audio/webm",
35
+ "audio/mp4",
36
+ "audio/ogg;codecs=opus",
37
+ "audio/ogg",
38
+ "audio/wav"
39
+ ];
40
+ for (const i of t)
41
+ if (MediaRecorder.isTypeSupported(i))
42
+ return i;
43
+ return "audio/webm";
44
+ }
45
+ /**
46
+ * Start audio recording.
47
+ * @returns Promise that resolves to true if recording started successfully.
48
+ */
49
+ async startRecording() {
50
+ var t, i;
51
+ if (this.isRecording)
52
+ return !1;
53
+ try {
54
+ return this.stream = await navigator.mediaDevices.getUserMedia({
55
+ audio: {
56
+ echoCancellation: !0,
57
+ noiseSuppression: !0,
58
+ autoGainControl: !0
59
+ }
60
+ }), this.mimeType = this.getSupportedMimeType(), this.mediaRecorder = new MediaRecorder(this.stream, {
61
+ mimeType: this.mimeType,
62
+ audioBitsPerSecond: this.audioBitsPerSecond
63
+ }), this.audioChunks = [], this.recordingStartTime = Date.now(), this.mediaRecorder.ondataavailable = (e) => {
64
+ e.data.size > 0 && this.audioChunks.push(e.data);
65
+ }, this.mediaRecorder.onstop = () => {
66
+ var o;
67
+ const e = Date.now() - this.recordingStartTime, s = new Blob(this.audioChunks, { type: this.mimeType });
68
+ (o = this.onStopCallback) == null || o.call(this, {
69
+ audioBlob: s,
70
+ duration: e,
71
+ mimeType: this.mimeType
72
+ }), this.cleanup();
73
+ }, this.mediaRecorder.onerror = () => {
74
+ var e;
75
+ (e = this.onErrorCallback) == null || e.call(this, "Recording failed"), this.cleanup();
76
+ }, this.mediaRecorder.start(1e3), this.isRecording = !0, await this.setupAudioAnalysis(), this.startDurationUpdates(), (t = this.onStartCallback) == null || t.call(this), setTimeout(() => {
77
+ this.isRecording && this.stopRecording();
78
+ }, this.maxDuration), !0;
79
+ } catch (e) {
80
+ return console.error("Error starting recording:", e), (i = this.onErrorCallback) == null || i.call(this, "Failed to access microphone"), !1;
81
+ }
82
+ }
83
+ /**
84
+ * Stop audio recording.
85
+ */
86
+ stopRecording() {
87
+ this.mediaRecorder && this.isRecording && (this.mediaRecorder.stop(), this.isRecording = !1, this.stopDurationUpdates());
88
+ }
89
+ /**
90
+ * Cancel audio recording without emitting the result.
91
+ */
92
+ cancelRecording() {
93
+ this.mediaRecorder && this.isRecording && (this.mediaRecorder.onstop = null, this.mediaRecorder.stop(), this.isRecording = !1, this.stopDurationUpdates(), this.audioChunks = [], this.cleanup());
94
+ }
95
+ /**
96
+ * Check if currently recording.
97
+ */
98
+ isCurrentlyRecording() {
99
+ return this.isRecording;
100
+ }
101
+ /**
102
+ * Get recording duration in milliseconds.
103
+ */
104
+ getRecordingDuration() {
105
+ return this.isRecording ? Date.now() - this.recordingStartTime : 0;
106
+ }
107
+ /**
108
+ * Set up audio analysis for waveform visualization.
109
+ */
110
+ async setupAudioAnalysis() {
111
+ if (this.stream)
112
+ try {
113
+ const t = window.AudioContext || window.webkitAudioContext;
114
+ if (!t)
115
+ return;
116
+ this.audioContext = new t(), this.audioContext.state === "suspended" && await this.audioContext.resume(), this.analyser = this.audioContext.createAnalyser(), this.analyser.fftSize = 256, this.analyser.smoothingTimeConstant = 0.8, this.audioContext.createMediaStreamSource(this.stream).connect(this.analyser), this.startAudioLevelMonitoring();
117
+ } catch (t) {
118
+ console.warn("Audio analysis setup failed:", t);
119
+ }
120
+ }
121
+ /**
122
+ * Start monitoring audio levels for visualization.
123
+ */
124
+ startAudioLevelMonitoring() {
125
+ if (!this.analyser)
126
+ return;
127
+ const t = () => {
128
+ var a;
129
+ if (!this.isRecording || !this.analyser)
130
+ return;
131
+ const i = new Uint8Array(this.analyser.frequencyBinCount);
132
+ this.analyser.getByteFrequencyData(i);
133
+ let e = 0;
134
+ for (const r of i)
135
+ e += r * r;
136
+ const s = Math.sqrt(e / i.length), o = Math.min(s / 255, 1), n = o > 0.01 ? o : 0, d = Math.pow(n, 0.4);
137
+ (a = this.onAudioLevelCallback) == null || a.call(this, d), this.animationFrame = requestAnimationFrame(t);
138
+ };
139
+ t();
140
+ }
141
+ /**
142
+ * Start duration update interval.
143
+ */
144
+ startDurationUpdates() {
145
+ this.durationInterval = window.setInterval(() => {
146
+ var t;
147
+ this.isRecording && ((t = this.onDurationUpdateCallback) == null || t.call(this, this.getRecordingDuration()));
148
+ }, 100);
149
+ }
150
+ /**
151
+ * Stop duration update interval.
152
+ */
153
+ stopDurationUpdates() {
154
+ this.durationInterval !== null && (clearInterval(this.durationInterval), this.durationInterval = null);
155
+ }
156
+ /**
157
+ * Clean up resources.
158
+ */
159
+ cleanup() {
160
+ this.isRecording = !1, this.stopDurationUpdates(), this.animationFrame !== null && (cancelAnimationFrame(this.animationFrame), this.animationFrame = null), this.audioContext && (this.audioContext.close(), this.audioContext = null), this.analyser = null, this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null), this.mediaRecorder = null;
161
+ }
162
+ /**
163
+ * Destroy the recorder and clean up all resources.
164
+ */
165
+ destroy() {
166
+ this.stopRecording(), this.cleanup();
167
+ }
168
+ // Event handlers
169
+ /**
170
+ * Set callback for when recording starts.
171
+ */
172
+ onStart(t) {
173
+ return this.onStartCallback = t, this;
174
+ }
175
+ /**
176
+ * Set callback for when recording stops with the result.
177
+ */
178
+ onStop(t) {
179
+ return this.onStopCallback = t, this;
180
+ }
181
+ /**
182
+ * Set callback for recording errors.
183
+ */
184
+ onError(t) {
185
+ return this.onErrorCallback = t, this;
186
+ }
187
+ /**
188
+ * Set callback for audio level updates (for waveform visualization).
189
+ * Level is normalized between 0 and 1.
190
+ */
191
+ onAudioLevel(t) {
192
+ return this.onAudioLevelCallback = t, this;
193
+ }
194
+ /**
195
+ * Set callback for duration updates (in milliseconds).
196
+ */
197
+ onDurationUpdate(t) {
198
+ return this.onDurationUpdateCallback = t, this;
199
+ }
200
+ /**
201
+ * Format duration in milliseconds to MM:SS format.
202
+ */
203
+ static formatDuration(t) {
204
+ const i = Math.floor(t / 1e3), e = Math.floor(i / 60), s = i % 60;
205
+ return `${e}:${s.toString().padStart(2, "0")}`;
206
+ }
207
+ }
208
+ export {
209
+ c as V
210
+ };
@@ -0,0 +1,18 @@
1
+ /*! * Lucero - The design system for Luzmo.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
+ * This license allows users with a current active Luzmo account to use Lucero.
7
+ * This license terminates automatically if a user no longer has an active Luzmo account.
8
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
+ * SOFTWARE.
17
+ * */
18
+ "use strict";class u{constructor(t={}){this.mediaRecorder=null,this.audioChunks=[],this.isRecording=!1,this.stream=null,this.recordingStartTime=0,this.mimeType="",this.audioContext=null,this.analyser=null,this.animationFrame=null,this.durationInterval=null,this.maxDuration=t.maxDuration??3e5,this.audioBitsPerSecond=t.audioBitsPerSecond??128e3}static isSupported(){return!!(typeof navigator<"u"&&navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia=="function"&&typeof MediaRecorder<"u")}getSupportedMimeType(){const t=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg","audio/wav"];for(const i of t)if(MediaRecorder.isTypeSupported(i))return i;return"audio/webm"}async startRecording(){var t,i;if(this.isRecording)return!1;try{return this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),this.mimeType=this.getSupportedMimeType(),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:this.mimeType,audioBitsPerSecond:this.audioBitsPerSecond}),this.audioChunks=[],this.recordingStartTime=Date.now(),this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data)},this.mediaRecorder.onstop=()=>{var o;const e=Date.now()-this.recordingStartTime,s=new Blob(this.audioChunks,{type:this.mimeType});(o=this.onStopCallback)==null||o.call(this,{audioBlob:s,duration:e,mimeType:this.mimeType}),this.cleanup()},this.mediaRecorder.onerror=()=>{var e;(e=this.onErrorCallback)==null||e.call(this,"Recording failed"),this.cleanup()},this.mediaRecorder.start(1e3),this.isRecording=!0,await this.setupAudioAnalysis(),this.startDurationUpdates(),(t=this.onStartCallback)==null||t.call(this),setTimeout(()=>{this.isRecording&&this.stopRecording()},this.maxDuration),!0}catch(e){return console.error("Error starting recording:",e),(i=this.onErrorCallback)==null||i.call(this,"Failed to access microphone"),!1}}stopRecording(){this.mediaRecorder&&this.isRecording&&(this.mediaRecorder.stop(),this.isRecording=!1,this.stopDurationUpdates())}cancelRecording(){this.mediaRecorder&&this.isRecording&&(this.mediaRecorder.onstop=null,this.mediaRecorder.stop(),this.isRecording=!1,this.stopDurationUpdates(),this.audioChunks=[],this.cleanup())}isCurrentlyRecording(){return this.isRecording}getRecordingDuration(){return this.isRecording?Date.now()-this.recordingStartTime:0}async setupAudioAnalysis(){if(this.stream)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;this.audioContext=new t,this.audioContext.state==="suspended"&&await this.audioContext.resume(),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8,this.audioContext.createMediaStreamSource(this.stream).connect(this.analyser),this.startAudioLevelMonitoring()}catch(t){console.warn("Audio analysis setup failed:",t)}}startAudioLevelMonitoring(){if(!this.analyser)return;const t=()=>{var r;if(!this.isRecording||!this.analyser)return;const i=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(i);let e=0;for(const a of i)e+=a*a;const s=Math.sqrt(e/i.length),o=Math.min(s/255,1),n=o>.01?o:0,d=Math.pow(n,.4);(r=this.onAudioLevelCallback)==null||r.call(this,d),this.animationFrame=requestAnimationFrame(t)};t()}startDurationUpdates(){this.durationInterval=window.setInterval(()=>{var t;this.isRecording&&((t=this.onDurationUpdateCallback)==null||t.call(this,this.getRecordingDuration()))},100)}stopDurationUpdates(){this.durationInterval!==null&&(clearInterval(this.durationInterval),this.durationInterval=null)}cleanup(){this.isRecording=!1,this.stopDurationUpdates(),this.animationFrame!==null&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null),this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.analyser=null,this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null),this.mediaRecorder=null}destroy(){this.stopRecording(),this.cleanup()}onStart(t){return this.onStartCallback=t,this}onStop(t){return this.onStopCallback=t,this}onError(t){return this.onErrorCallback=t,this}onAudioLevel(t){return this.onAudioLevelCallback=t,this}onDurationUpdate(t){return this.onDurationUpdateCallback=t,this}static formatDuration(t){const i=Math.floor(t/1e3),e=Math.floor(i/60),s=i%60;return`${e}:${s.toString().padStart(2,"0")}`}}exports.VoiceRecorder=u;