architwin 1.0.74 → 1.0.76
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.
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +1 -1
- package/lib/atwinui/components/toolbar/tagFormPane.js +98 -34
- package/lib/atwinui/components/toolbar/tagListPane.d.ts +7 -1
- package/lib/atwinui/components/toolbar/tagListPane.js +106 -8
- package/lib/atwinui/components/toolbar/tagMessagingPane.js +1 -1
- package/lib/atwinui/events.js +6 -1
- package/lib/color.js +1 -1
- package/lib/meeting/meetingSidebar.js +1 -1
- package/lib/socketio.js +3 -4
- package/lib/superviz.js +1 -1
- package/lib/tag.js +12 -10
- package/lib/utils.d.ts +27 -0
- package/lib/utils.js +117 -0
- package/lib/zoom.js +1 -1
- package/package.json +1 -1
- package/static/utility.css +16 -0
package/lib/utils.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { format, toDate } from 'date-fns';
|
|
2
|
+
import { ja } from 'date-fns/locale';
|
|
3
|
+
export let generatedIds = [];
|
|
4
|
+
export function meterToMillimeter(meter, decimal = 2) {
|
|
5
|
+
const mm = meter * 1000;
|
|
6
|
+
return parseFloat(mm.toFixed(decimal));
|
|
7
|
+
}
|
|
8
|
+
export function generateRandomUniqueNumber(currentIds) {
|
|
9
|
+
function generateRandomNumber() {
|
|
10
|
+
return Math.floor(Math.random() * 40000);
|
|
11
|
+
}
|
|
12
|
+
// Loop until a unique number is generated
|
|
13
|
+
let randomNumber;
|
|
14
|
+
do {
|
|
15
|
+
randomNumber = generateRandomNumber();
|
|
16
|
+
} while (currentIds.indexOf(randomNumber) !== -1);
|
|
17
|
+
return randomNumber;
|
|
18
|
+
}
|
|
19
|
+
export function generateUUID(config) {
|
|
20
|
+
const cryptoObj = window.crypto;
|
|
21
|
+
if (!cryptoObj) {
|
|
22
|
+
console.error('crypto.getRandomValues() is not supported in this browser.');
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const buffer = new Uint16Array(8);
|
|
26
|
+
cryptoObj.getRandomValues(buffer);
|
|
27
|
+
const hex = [];
|
|
28
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
29
|
+
let val = buffer[i].toString(16);
|
|
30
|
+
while (val.length < 4) {
|
|
31
|
+
val = '0' + val;
|
|
32
|
+
}
|
|
33
|
+
hex.push(val);
|
|
34
|
+
}
|
|
35
|
+
let randUUID = `${hex[0]}${hex[1]}-${hex[2]}-${hex[3]}-${hex[4]}-${hex[5]}${hex[6]}${hex[7]}`;
|
|
36
|
+
if (config && config.length) {
|
|
37
|
+
console.log('Length set');
|
|
38
|
+
randUUID = randUUID.slice(0, config.length);
|
|
39
|
+
}
|
|
40
|
+
if (config && config.separator) {
|
|
41
|
+
console.log('Separator set');
|
|
42
|
+
if (config.separator === 'none') {
|
|
43
|
+
randUUID = randUUID.replace(/-/g, config.separator);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return randUUID;
|
|
47
|
+
}
|
|
48
|
+
export function generateRandomUsername() {
|
|
49
|
+
// Helper function to generate a random word
|
|
50
|
+
function getRandomWord(length) {
|
|
51
|
+
let result = '';
|
|
52
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
53
|
+
const charactersLength = characters.length;
|
|
54
|
+
for (let i = 0; i < length; i++) {
|
|
55
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
const randomWord = getRandomWord(Math.floor(Math.random() * 5) + 4);
|
|
60
|
+
const randomNumber = Math.floor(Math.random() * 10000);
|
|
61
|
+
const username = `${randomWord}${randomNumber}`;
|
|
62
|
+
return username;
|
|
63
|
+
}
|
|
64
|
+
export function useHexToRgb(hexcode) {
|
|
65
|
+
// Remove '#' symbol if it exists
|
|
66
|
+
hexcode = hexcode.replace("#", "");
|
|
67
|
+
// Parse hex values for red, green, and blue
|
|
68
|
+
const r = parseInt(hexcode.substring(0, 2), 16) / 255;
|
|
69
|
+
const g = parseInt(hexcode.substring(2, 4), 16) / 255;
|
|
70
|
+
const b = parseInt(hexcode.substring(4, 6), 16) / 255;
|
|
71
|
+
return { r, g, b };
|
|
72
|
+
}
|
|
73
|
+
export function useRgbToHex(color) {
|
|
74
|
+
// Ensure the values are within the valid range (0-255)
|
|
75
|
+
color.r = Math.min(255, Math.max(0, color.r));
|
|
76
|
+
color.g = Math.min(255, Math.max(0, color.g));
|
|
77
|
+
color.b = Math.min(255, Math.max(0, color.b));
|
|
78
|
+
// Convert to hex and pad with zeros if needed
|
|
79
|
+
const hexR = color.r.toString(16).padStart(2, "0");
|
|
80
|
+
const hexG = color.g.toString(16).padStart(2, "0");
|
|
81
|
+
const hexB = color.b.toString(16).padStart(2, "0");
|
|
82
|
+
return `${hexR}${hexG}${hexB}`;
|
|
83
|
+
}
|
|
84
|
+
export function convertToCssRgb(values) {
|
|
85
|
+
// console.log('convertToCssRgb()', values)
|
|
86
|
+
if (!values) {
|
|
87
|
+
console.log('values is undefined');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let r = Math.round(values.r * 255);
|
|
91
|
+
let g = Math.round(values.g * 255);
|
|
92
|
+
let b = Math.round(values.b * 255);
|
|
93
|
+
return `rgb(${r},${g},${b})`;
|
|
94
|
+
}
|
|
95
|
+
export function arrayBufferToBase64(buffer) {
|
|
96
|
+
let binary = '';
|
|
97
|
+
const bytes = new Uint8Array(buffer);
|
|
98
|
+
const len = bytes.byteLength;
|
|
99
|
+
for (let i = 0; i < len; i++) {
|
|
100
|
+
binary += String.fromCharCode(bytes[i]);
|
|
101
|
+
}
|
|
102
|
+
return btoa(binary);
|
|
103
|
+
}
|
|
104
|
+
export function isUrlValid(userInput) {
|
|
105
|
+
const urlPattern = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
|
|
106
|
+
return urlPattern.test(userInput);
|
|
107
|
+
}
|
|
108
|
+
export function dateTimeFormat(d) {
|
|
109
|
+
const local = format(toDate(d), 'yyyy年M月d日 HH:mm:ss', { locale: ja });
|
|
110
|
+
return local;
|
|
111
|
+
}
|
|
112
|
+
export function stringContains(str, target, isCaseSensitive = false) {
|
|
113
|
+
if (isCaseSensitive) {
|
|
114
|
+
return str.includes(target);
|
|
115
|
+
}
|
|
116
|
+
return str.toLowerCase().includes(target.toLowerCase());
|
|
117
|
+
}
|
package/lib/zoom.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as atwin from "./architwin";
|
|
|
11
11
|
import ZoomVideo from "@zoom/videosdk";
|
|
12
12
|
import KJUR from "jsrsasign";
|
|
13
13
|
import { SPACE_EVENTS } from "./types";
|
|
14
|
-
import { generateUUID } from "./
|
|
14
|
+
import { generateUUID } from "./utils";
|
|
15
15
|
const roles = { HOST: 1 /* Meeting_Role.HOST */, GUEST: 0 /* Meeting_Role.GUEST */ };
|
|
16
16
|
const zoomClient = ZoomVideo.createClient();
|
|
17
17
|
let SelfVideoElement;
|
package/package.json
CHANGED
package/static/utility.css
CHANGED
|
@@ -110,10 +110,26 @@ width: 100vw;
|
|
|
110
110
|
height: 100vh;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
.at_h-min-45 {
|
|
114
|
+
min-height: 45vh;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.at_h-min-50 {
|
|
118
|
+
min-height: 50vh;
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
.at_h-min-60 {
|
|
114
122
|
min-height: 60vh;
|
|
115
123
|
}
|
|
116
124
|
|
|
125
|
+
.at_h-min-64 {
|
|
126
|
+
min-height: 64vh;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.at_h-min-68 {
|
|
130
|
+
min-height: 68vh;
|
|
131
|
+
}
|
|
132
|
+
|
|
117
133
|
.at_h-min-70 {
|
|
118
134
|
min-height: 70vh;
|
|
119
135
|
}
|