ssovee-os-web-ui 0.1.40 → 0.1.41
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/dist/index.cjs +35 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -42
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +35 -43
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.js +36 -43
- package/dist/sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var react = require('@phosphor-icons/react');
|
|
6
6
|
var uaParserJs = require('ua-parser-js');
|
|
7
7
|
|
|
8
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
8
|
function _interopNamespace(e) {
|
|
10
9
|
if (e && e.__esModule) return e;
|
|
11
10
|
var n = Object.create(null);
|
|
@@ -3259,65 +3258,58 @@ var swipe_tone_default = "data:audio/wave;base64,UklGRuzOAgBXQVZFZm10IBAAAAABAAI
|
|
|
3259
3258
|
// src/hooks/useSound.tsx
|
|
3260
3259
|
var soundMap = {
|
|
3261
3260
|
click: click_tone_default,
|
|
3262
|
-
alert: error_tone_default,
|
|
3263
|
-
notification: notification_tone_default,
|
|
3264
3261
|
error: error_tone_default,
|
|
3265
3262
|
success: success_tone_default,
|
|
3263
|
+
alert: error_tone_default,
|
|
3264
|
+
notification: notification_tone_default,
|
|
3266
3265
|
swipe: swipe_tone_default
|
|
3267
3266
|
};
|
|
3268
3267
|
var DEFAULT_SOUND_TYPE = "click";
|
|
3269
|
-
var getAssetUrl = (asset) => {
|
|
3270
|
-
if (typeof asset === "string") return asset;
|
|
3271
|
-
if (asset && typeof asset === "object") {
|
|
3272
|
-
const record = asset;
|
|
3273
|
-
const candidate = record.default ?? record.src ?? record.url ?? record.href;
|
|
3274
|
-
if (typeof candidate === "string") return candidate;
|
|
3275
|
-
}
|
|
3276
|
-
return "";
|
|
3277
|
-
};
|
|
3278
|
-
var resolveSoundCandidates = (src) => {
|
|
3279
|
-
if (!src) return [];
|
|
3280
|
-
const candidates = [src];
|
|
3281
|
-
if (!/^https?:|^data:|^blob:/.test(src)) {
|
|
3282
|
-
try {
|
|
3283
|
-
candidates.push(new URL(src, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).href);
|
|
3284
|
-
} catch {
|
|
3285
|
-
}
|
|
3286
|
-
}
|
|
3287
|
-
return [...new Set(candidates)];
|
|
3288
|
-
};
|
|
3289
3268
|
var isSoundType = (type) => {
|
|
3290
3269
|
return type in soundMap;
|
|
3291
3270
|
};
|
|
3292
3271
|
var useSound = () => {
|
|
3272
|
+
const audioCache = React22.useRef({});
|
|
3293
3273
|
const playSound = React22.useCallback((type) => {
|
|
3294
|
-
if (typeof window === "undefined"
|
|
3274
|
+
if (typeof window === "undefined") {
|
|
3295
3275
|
return;
|
|
3296
3276
|
}
|
|
3297
3277
|
const requestedType = isSoundType(type) ? type : DEFAULT_SOUND_TYPE;
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3278
|
+
const src = soundMap[requestedType];
|
|
3279
|
+
if (!src) {
|
|
3280
|
+
console.error(
|
|
3281
|
+
`Sound playback failed: no source found for "${requestedType}"`
|
|
3282
|
+
);
|
|
3302
3283
|
return;
|
|
3303
3284
|
}
|
|
3304
|
-
|
|
3305
|
-
let
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3285
|
+
try {
|
|
3286
|
+
let audio = audioCache.current[requestedType];
|
|
3287
|
+
if (!audio) {
|
|
3288
|
+
audio = new Audio(src);
|
|
3289
|
+
audio.preload = "auto";
|
|
3290
|
+
audioCache.current[requestedType] = audio;
|
|
3291
|
+
}
|
|
3292
|
+
audio.pause();
|
|
3293
|
+
audio.currentTime = 0;
|
|
3294
|
+
const playPromise = audio.play();
|
|
3295
|
+
if (playPromise !== void 0) {
|
|
3296
|
+
playPromise.catch((error) => {
|
|
3297
|
+
console.error(
|
|
3298
|
+
`Sound playback failed for "${requestedType}":`,
|
|
3299
|
+
error
|
|
3300
|
+
);
|
|
3301
|
+
});
|
|
3316
3302
|
}
|
|
3317
|
-
|
|
3318
|
-
|
|
3303
|
+
} catch (error) {
|
|
3304
|
+
console.error(
|
|
3305
|
+
`Sound playback failed for "${requestedType}":`,
|
|
3306
|
+
error
|
|
3307
|
+
);
|
|
3308
|
+
}
|
|
3319
3309
|
}, []);
|
|
3320
|
-
return {
|
|
3310
|
+
return {
|
|
3311
|
+
playSound
|
|
3312
|
+
};
|
|
3321
3313
|
};
|
|
3322
3314
|
|
|
3323
3315
|
exports.Accordion = Accordion_default;
|