@rannah-labs/react-voice-orb 1.1.3

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 (60) hide show
  1. package/README.md +240 -0
  2. package/assets/orb-ss.png +0 -0
  3. package/assets/thing.png +0 -0
  4. package/dist/bun-server/src/types/index.d.ts +37 -0
  5. package/dist/bun-server/src/types/index.js +2 -0
  6. package/dist/src/app/Types/TranscriberStuff.d.ts +0 -0
  7. package/dist/src/app/Types/TranscriberStuff.js +1 -0
  8. package/dist/src/app/Types/apiModels.d.ts +31 -0
  9. package/dist/src/app/Types/apiModels.js +2 -0
  10. package/dist/src/app/Types/api_types.d.ts +34 -0
  11. package/dist/src/app/Types/api_types.js +2 -0
  12. package/dist/src/app/Types/better-trpc.d.ts +5 -0
  13. package/dist/src/app/Types/better-trpc.js +23 -0
  14. package/dist/src/app/Types/browser-only.d.ts +1 -0
  15. package/dist/src/app/Types/browser-only.js +12 -0
  16. package/dist/src/app/Types/builltInNodesTemplates.d.ts +1070 -0
  17. package/dist/src/app/Types/builltInNodesTemplates.js +1341 -0
  18. package/dist/src/app/Types/defaults.d.ts +7 -0
  19. package/dist/src/app/Types/defaults.js +210 -0
  20. package/dist/src/app/Types/demo_extension.d.ts +11 -0
  21. package/dist/src/app/Types/demo_extension.js +190 -0
  22. package/dist/src/app/Types/envObject.d.ts +97 -0
  23. package/dist/src/app/Types/envObject.js +5 -0
  24. package/dist/src/app/Types/firebase.d.ts +30413 -0
  25. package/dist/src/app/Types/firebase.js +6696 -0
  26. package/dist/src/app/Types/gen_openapi.d.ts +130 -0
  27. package/dist/src/app/Types/gen_openapi.js +2 -0
  28. package/dist/src/app/Types/global_types.d.ts +254 -0
  29. package/dist/src/app/Types/global_types.js +6 -0
  30. package/dist/src/app/Types/messages_types.d.ts +76 -0
  31. package/dist/src/app/Types/messages_types.js +1 -0
  32. package/dist/src/app/Types/vapi_types.d.ts +358 -0
  33. package/dist/src/app/Types/vapi_types.js +2 -0
  34. package/dist/src/app/Types/vf_types.d.ts +33 -0
  35. package/dist/src/app/Types/vf_types.js +2 -0
  36. package/dist/src/public_packages/react-voice-orb/src/animation-orb.d.ts +11 -0
  37. package/dist/src/public_packages/react-voice-orb/src/animation-orb.js +397 -0
  38. package/dist/src/public_packages/react-voice-orb/src/index.d.ts +5 -0
  39. package/dist/src/public_packages/react-voice-orb/src/index.js +16 -0
  40. package/dist/src/public_packages/react-voice-orb/src/providers/AIAudioProvider.d.ts +21 -0
  41. package/dist/src/public_packages/react-voice-orb/src/providers/AIAudioProvider.js +81 -0
  42. package/dist/src/public_packages/react-voice-orb/src/providers/ThemeProvider.d.ts +23 -0
  43. package/dist/src/public_packages/react-voice-orb/src/providers/ThemeProvider.js +202 -0
  44. package/dist/src/public_packages/react-voice-orb/src/scripts/same-script.d.ts +1 -0
  45. package/dist/src/public_packages/react-voice-orb/src/scripts/same-script.js +79 -0
  46. package/dist/src/public_packages/react-voice-orb/src/spinner.d.ts +3 -0
  47. package/dist/src/public_packages/react-voice-orb/src/spinner.js +17 -0
  48. package/dist/src/public_packages/react-voice-orb/tsconfig.tsbuildinfo +1 -0
  49. package/dist/vg-docker/src/+global_consts/client.d.ts +84 -0
  50. package/dist/vg-docker/src/+global_consts/client.js +105 -0
  51. package/package.json +46 -0
  52. package/scripts/post-tsc.ts +74 -0
  53. package/src/animation-orb.tsx +441 -0
  54. package/src/index.ts +5 -0
  55. package/src/providers/AIAudioProvider.tsx +100 -0
  56. package/src/providers/ThemeProvider.tsx +211 -0
  57. package/src/scripts/same-script.ts +73 -0
  58. package/src/spinner.tsx +19 -0
  59. package/tsconfig.json +34 -0
  60. package/webpack.config.js +141 -0
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.useOrbTheme = useOrbTheme;
31
+ const react_1 = __importStar(require("react"));
32
+ const color_convert_1 = __importDefault(require("color-convert"));
33
+ const ThemeContext = (0, react_1.createContext)("blue-light");
34
+ function useOrbTheme() {
35
+ const context = (0, react_1.useContext)(ThemeContext);
36
+ if (!context) {
37
+ throw new Error("use orb theme must be used within a theme provider");
38
+ }
39
+ return context;
40
+ }
41
+ const OrbThemeProvider = (props) => {
42
+ const [customStyles, setCustomStyles] = (0, react_1.useState)(props.customStyles || {});
43
+ react_1.default.useEffect(() => {
44
+ // no keys in the customStyles object
45
+ if (Object.keys(customStyles)?.length === 0) {
46
+ // handle autogenerate by the primary color
47
+ if (props.primaryColor) {
48
+ switchCustomColorPallet(props.primaryColor);
49
+ }
50
+ else {
51
+ // handle default theme
52
+ switchCustomColorPallet("#0000FF");
53
+ }
54
+ }
55
+ }, [customStyles, props.primaryColor, props.isDark]);
56
+ function getColor(colorToGet, opacity) {
57
+ const element = document.getElementById("vg-theme-container");
58
+ if (!element)
59
+ return;
60
+ const styles = window.getComputedStyle(element);
61
+ const mainColorRaw = styles.getPropertyValue(`--vg-${colorToGet}`);
62
+ const mainColorHsl = mainColorRaw
63
+ .split(" ")
64
+ .map((item) => Number(item.replaceAll(`%`, "")));
65
+ if (opacity) {
66
+ return `rgba(${color_convert_1.default.hsl
67
+ .rgb(mainColorHsl)
68
+ .join(`,`)}, ${opacity})`;
69
+ }
70
+ const mainColorHex = color_convert_1.default.hsl.hex(mainColorHsl);
71
+ return `#${mainColorHex}`;
72
+ }
73
+ const handleAutoGenPallet = (rootColor, themeType) => {
74
+ const baseColorHSL = color_convert_1.default.hex.hsl(rootColor);
75
+ // console.log(baseColorHSL);
76
+ if (baseColorHSL?.length) {
77
+ const newHSLColorsArray = [];
78
+ for (let i = 10; i > 0; i--) {
79
+ const changePerIndex = 10;
80
+ let newHslColor = baseColorHSL.slice(0, 2);
81
+ const finalLuinousValue = i * changePerIndex === 100 ? 95 : i * changePerIndex || 5;
82
+ newHslColor[2] = finalLuinousValue;
83
+ newHSLColorsArray.push(newHslColor);
84
+ }
85
+ const nineColorPalletFinale = themeType === "light"
86
+ ? newHSLColorsArray.slice().reverse()
87
+ : newHSLColorsArray;
88
+ return nineColorPalletFinale;
89
+ }
90
+ };
91
+ function switchCustomColorPallet(customThemeJSONString) {
92
+ let themeObject = {
93
+ primary: props.primaryColor || "#0000FF",
94
+ };
95
+ try {
96
+ themeObject = JSON.parse(customThemeJSONString);
97
+ }
98
+ catch (error) {
99
+ themeObject = {
100
+ primary: props.primaryColor || "#0000FF",
101
+ };
102
+ }
103
+ try {
104
+ // themeObject = JSON.parse(customThemeJSONString);
105
+ // console.log(themeObject)
106
+ const primaryHSL = color_convert_1.default.hex.hsl(themeObject.primary);
107
+ const nineCollorPallet = handleAutoGenPallet(themeObject.primary, props.isDark ? "dark" : "light");
108
+ // console.log(nineCollorPallet)
109
+ setCustomStyles({
110
+ "--vg-primary": primaryHSL
111
+ .map((item, index) => (index === 0 ? item : `${item}%`))
112
+ .join(` `),
113
+ "--vg-primary-50": nineCollorPallet[0]
114
+ .map((item, index) => (index === 0 ? item : `${item}%`))
115
+ .join(` `),
116
+ "--vg-primary-100": nineCollorPallet[1]
117
+ .map((item, index) => (index === 0 ? item : `${item}%`))
118
+ .join(` `),
119
+ "--vg-primary-200": nineCollorPallet[2]
120
+ .map((item, index) => (index === 0 ? item : `${item}%`))
121
+ .join(` `),
122
+ "--vg-primary-300": nineCollorPallet[3]
123
+ .map((item, index) => (index === 0 ? item : `${item}%`))
124
+ .join(` `),
125
+ "--vg-primary-400": nineCollorPallet[4]
126
+ .map((item, index) => (index === 0 ? item : `${item}%`))
127
+ .join(` `),
128
+ "--vg-primary-500": nineCollorPallet[5]
129
+ .map((item, index) => (index === 0 ? item : `${item}%`))
130
+ .join(` `),
131
+ "--vg-primary-600": nineCollorPallet[6]
132
+ .map((item, index) => (index === 0 ? item : `${item}%`))
133
+ .join(` `),
134
+ "--vg-primary-700": nineCollorPallet[7]
135
+ .map((item, index) => (index === 0 ? item : `${item}%`))
136
+ .join(` `),
137
+ "--vg-primary-800": nineCollorPallet[8]
138
+ .map((item, index) => (index === 0 ? item : `${item}%`))
139
+ .join(` `),
140
+ "--vg-primary-900": nineCollorPallet[9]
141
+ .map((item, index) => (index === 0 ? item : `${item}%`))
142
+ .join(` `),
143
+ });
144
+ }
145
+ catch (error) {
146
+ console.error(`Error parsing custom theme JSON: `, error);
147
+ }
148
+ }
149
+ const setCustomTheme = (primaryHSL, nineCollorPallet) => {
150
+ // console.log(`custom theme triggered:: `, primaryHSL, nineCollorPallet)
151
+ if (primaryHSL === false && !nineCollorPallet.length) {
152
+ setCustomStyles({});
153
+ }
154
+ if (nineCollorPallet?.length) {
155
+ // console.log('SETTING CUSTOM STYLES ')
156
+ setCustomStyles({
157
+ "--vg-primary": primaryHSL
158
+ .map((item, index) => (index === 0 ? item : `${item}%`))
159
+ .join(` `),
160
+ "--vg-primary-50": nineCollorPallet[0]
161
+ .map((item, index) => (index === 0 ? item : `${item}%`))
162
+ .join(` `),
163
+ "--vg-primary-100": nineCollorPallet[1]
164
+ .map((item, index) => (index === 0 ? item : `${item}%`))
165
+ .join(` `),
166
+ "--vg-primary-200": nineCollorPallet[2]
167
+ .map((item, index) => (index === 0 ? item : `${item}%`))
168
+ .join(` `),
169
+ "--vg-primary-300": nineCollorPallet[3]
170
+ .map((item, index) => (index === 0 ? item : `${item}%`))
171
+ .join(` `),
172
+ "--vg-primary-400": nineCollorPallet[4]
173
+ .map((item, index) => (index === 0 ? item : `${item}%`))
174
+ .join(` `),
175
+ "--vg-primary-500": nineCollorPallet[5]
176
+ .map((item, index) => (index === 0 ? item : `${item}%`))
177
+ .join(` `),
178
+ "--vg-primary-600": nineCollorPallet[6]
179
+ .map((item, index) => (index === 0 ? item : `${item}%`))
180
+ .join(` `),
181
+ "--vg-primary-700": nineCollorPallet[7]
182
+ .map((item, index) => (index === 0 ? item : `${item}%`))
183
+ .join(` `),
184
+ "--vg-primary-800": nineCollorPallet[8]
185
+ .map((item, index) => (index === 0 ? item : `${item}%`))
186
+ .join(` `),
187
+ "--vg-primary-900": nineCollorPallet[9]
188
+ .map((item, index) => (index === 0 ? item : `${item}%`))
189
+ .join(` `),
190
+ });
191
+ }
192
+ };
193
+ const value = {
194
+ customStyles,
195
+ setCustomTheme,
196
+ getColor,
197
+ switchCustomColorPallet,
198
+ };
199
+ return (react_1.default.createElement(ThemeContext.Provider, { value: value },
200
+ react_1.default.createElement("div", { id: "vg-theme-container", style: customStyles }, props.children)));
201
+ };
202
+ exports.default = OrbThemeProvider;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const fs = __importStar(require("fs/promises"));
27
+ const path = __importStar(require("path"));
28
+ /**
29
+ * Deletes all files and folders inside `rootPath` except for those
30
+ * whose relative paths (from rootPath) appear in the `exceptions` array.
31
+ *
32
+ * @param rootPath - The directory to process.
33
+ * @param exceptions - An array of paths (relative to rootPath) to keep.
34
+ */
35
+ async function deleteAllExcept(rootPath, exceptions) {
36
+ // Normalize exception paths for consistent matching.
37
+ const exceptionsSet = new Set(exceptions.map(e => path.normalize(e)));
38
+ /**
39
+ * Recursively processes the directory at `currentPath`.
40
+ *
41
+ * @param currentPath - Absolute path of the current directory.
42
+ * @param relativePath - The path relative to the original rootPath.
43
+ */
44
+ async function processDirectory(currentPath, relativePath) {
45
+ // Read the directory entries.
46
+ const items = await fs.readdir(currentPath);
47
+ for (const item of items) {
48
+ // Build the relative path for the item.
49
+ const itemRelPath = relativePath ? path.join(relativePath, item) : item;
50
+ const fullItemPath = path.join(currentPath, item);
51
+ // If the item is in the exceptions list, skip processing it.
52
+ if (exceptionsSet.has(path.normalize(itemRelPath))) {
53
+ // Do not process inside an exception folder (or delete an exception file).
54
+ continue;
55
+ }
56
+ const stats = await fs.lstat(fullItemPath);
57
+ if (stats.isDirectory()) {
58
+ // Process the contents of the directory.
59
+ await processDirectory(fullItemPath, itemRelPath);
60
+ // After processing, check if the directory is now empty.
61
+ const remaining = await fs.readdir(fullItemPath);
62
+ if (remaining.length === 0) {
63
+ await fs.rmdir(fullItemPath);
64
+ }
65
+ }
66
+ else {
67
+ // Delete the file.
68
+ await fs.unlink(fullItemPath);
69
+ }
70
+ }
71
+ }
72
+ // Process the root directory but never remove the root itself.
73
+ await processDirectory(rootPath, '');
74
+ }
75
+ // --- Example usage ---
76
+ // This call will delete everything under './dist/vg-docker/src'
77
+ // except for the folder "+global_consts" and any file/folder whose
78
+ // relative path matches one of the entries in the exceptions array.
79
+ deleteAllExcept('./dist', ['vg-docker/src/+global_consts/client.js', 'vg-docker/src/+global_consts/client.d.ts', 'src/app/Types', 'src/app/Types', "bun-server", 'src/public_packages/react-voice-orb']).catch(console.error);
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Spinner: () => React.JSX.Element;
3
+ export default Spinner;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const Spinner = () => {
8
+ return (react_1.default.createElement("div", { className: "pulse", style: {
9
+ width: "50px",
10
+ height: "50px",
11
+ backgroundColor: "white",
12
+ borderRadius: "50%",
13
+ animation: "pulse 1.5s infinite",
14
+ margin: " auto",
15
+ } }));
16
+ };
17
+ exports.default = Spinner;