@lumiastream/ui 0.8.4 → 0.8.6

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.
@@ -536,6 +536,10 @@ var resolvePlatformChatterProfileUrl = ({ platform, username, displayname, userI
536
536
  return normalizedUsername ? `https://www.tiktok.com/@${encodeURIComponent(normalizedUsername)}` : null;
537
537
  case "kick":
538
538
  return normalizedUsername ? `https://kick.com/${encodeURIComponent(normalizedUsername)}` : null;
539
+ case "twitter":
540
+ return normalizedUsername ? `https://twitter.com/${encodeURIComponent(normalizedUsername)}` : null;
541
+ case "trovo":
542
+ return normalizedUsername ? `https://trovo.live/s/${encodeURIComponent(normalizedUsername)}` : null;
539
543
  case "discord":
540
544
  return normalizedUserId ? `https://discord.com/users/${encodeURIComponent(normalizedUserId)}` : null;
541
545
  default:
package/dist/utils.d.ts CHANGED
@@ -108,4 +108,13 @@ declare const codeMirrorlinterOptions: (type: "overlay" | "code", language?: "js
108
108
  };
109
109
  };
110
110
 
111
- export { codeMirrorlinterOptions, variableCompletionOptions };
111
+ type PingNote = {
112
+ freq: number;
113
+ at: number;
114
+ };
115
+ declare const PING_NOTES: PingNote[];
116
+ declare const playEventPing: (options?: {
117
+ sinkId?: string;
118
+ }) => void;
119
+
120
+ export { PING_NOTES, type PingNote, codeMirrorlinterOptions, playEventPing, variableCompletionOptions };
package/dist/utils.js CHANGED
@@ -752,6 +752,10 @@ var resolvePlatformChatterProfileUrl = ({ platform, username, displayname, userI
752
752
  return normalizedUsername ? `https://www.tiktok.com/@${encodeURIComponent(normalizedUsername)}` : null;
753
753
  case "kick":
754
754
  return normalizedUsername ? `https://kick.com/${encodeURIComponent(normalizedUsername)}` : null;
755
+ case "twitter":
756
+ return normalizedUsername ? `https://twitter.com/${encodeURIComponent(normalizedUsername)}` : null;
757
+ case "trovo":
758
+ return normalizedUsername ? `https://trovo.live/s/${encodeURIComponent(normalizedUsername)}` : null;
755
759
  case "discord":
756
760
  return normalizedUserId ? `https://discord.com/users/${encodeURIComponent(normalizedUserId)}` : null;
757
761
  default:
@@ -808,8 +812,97 @@ var resolveChatterProfileUrlWithResolvers = async ({
808
812
  userId: normalizedUserId || void 0
809
813
  });
810
814
  };
815
+
816
+ // src/utils/eventPing.ts
817
+ var PING_NOTES = [
818
+ { freq: 1046.5, at: 0 },
819
+ { freq: 1318.51, at: 0.075 },
820
+ { freq: 1567.98, at: 0.15 },
821
+ { freq: 2093, at: 0.235 }
822
+ ];
823
+ var pingAudioContext = null;
824
+ var pingUnlockBound = false;
825
+ var appliedSinkId = null;
826
+ var getPingContext = () => {
827
+ const Ctx = globalThis.AudioContext ?? globalThis.webkitAudioContext;
828
+ if (!Ctx) {
829
+ return null;
830
+ }
831
+ if (!pingAudioContext) {
832
+ pingAudioContext = new Ctx();
833
+ }
834
+ if (!pingUnlockBound) {
835
+ pingUnlockBound = true;
836
+ const unlock = () => {
837
+ pingAudioContext?.resume().catch(() => {
838
+ });
839
+ };
840
+ globalThis.addEventListener?.("pointerdown", unlock);
841
+ globalThis.addEventListener?.("keydown", unlock);
842
+ }
843
+ return pingAudioContext;
844
+ };
845
+ var applyPingSink = (ctx, sinkId) => {
846
+ if (sinkId === void 0 || sinkId === appliedSinkId) {
847
+ return null;
848
+ }
849
+ const sinkCtx = ctx;
850
+ if (typeof sinkCtx.setSinkId !== "function") {
851
+ return null;
852
+ }
853
+ appliedSinkId = sinkId;
854
+ return sinkCtx.setSinkId(sinkId).catch(() => {
855
+ });
856
+ };
857
+ var emitPingTone = (ctx) => {
858
+ const start = ctx.currentTime;
859
+ const master = ctx.createGain();
860
+ master.gain.setValueAtTime(0.85, start);
861
+ master.connect(ctx.destination);
862
+ for (const note of PING_NOTES) {
863
+ const noteStart = start + note.at;
864
+ for (const detune of [-5, 6]) {
865
+ const osc = ctx.createOscillator();
866
+ const gain = ctx.createGain();
867
+ osc.type = "triangle";
868
+ osc.frequency.setValueAtTime(note.freq, noteStart);
869
+ osc.detune.setValueAtTime(detune, noteStart);
870
+ osc.connect(gain);
871
+ gain.connect(master);
872
+ gain.gain.setValueAtTime(1e-4, noteStart);
873
+ gain.gain.exponentialRampToValueAtTime(0.13, noteStart + 0.012);
874
+ gain.gain.exponentialRampToValueAtTime(1e-4, noteStart + 0.4);
875
+ osc.start(noteStart);
876
+ osc.stop(noteStart + 0.42);
877
+ }
878
+ }
879
+ };
880
+ var playEventPing = (options) => {
881
+ try {
882
+ const ctx = getPingContext();
883
+ if (!ctx) {
884
+ return;
885
+ }
886
+ const run = () => {
887
+ if (ctx.state === "suspended") {
888
+ ctx.resume().then(() => emitPingTone(ctx)).catch(() => {
889
+ });
890
+ return;
891
+ }
892
+ emitPingTone(ctx);
893
+ };
894
+ const sinkApplied = applyPingSink(ctx, options?.sinkId);
895
+ if (sinkApplied) {
896
+ sinkApplied.then(run, run);
897
+ } else {
898
+ run();
899
+ }
900
+ } catch {
901
+ }
902
+ };
811
903
  export {
812
904
  MEDIA_PREVIEW_USER_LEVEL_VALUES,
905
+ PING_NOTES,
813
906
  buildChatMessageContent,
814
907
  codeMirrorlinterOptions,
815
908
  getMediaPreviewFromUrl,
@@ -818,6 +911,7 @@ export {
818
911
  normalizeHttpUrl,
819
912
  normalizeMediaPreviewUserLevels,
820
913
  parseMessageLinks,
914
+ playEventPing,
821
915
  resolveChatterProfileUrlWithResolvers,
822
916
  resolveMediaPreviewRoleSettings,
823
917
  resolveMediaPreviewSetting,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/ui",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "author": "Lumia Stream",
5
5
  "license": "ISC",
6
6
  "description": "Lumia UI Kit",
@@ -153,7 +153,6 @@
153
153
  "watch": "tsup --watch",
154
154
  "test": "vitest run",
155
155
  "test:watch": "vitest",
156
- "link-local": "npm run build && node ./scripts/link-local.mjs",
157
156
  "release": "changeset && changeset tag && npm run build && npm publish",
158
157
  "prepublishOnly": "npm run build",
159
158
  "postpublish": "npm cache clean --force && node ./scripts/postpublish-install.mjs",
@@ -193,8 +192,8 @@
193
192
  "vitest": "^4.1.6"
194
193
  },
195
194
  "dependencies": {
196
- "@lumiastream/lumia-translations": "1.18.0",
197
- "@lumiastream/lumia-types": "3.8.2",
195
+ "@lumiastream/lumia-translations": "1.18.5",
196
+ "@lumiastream/lumia-types": "3.8.5",
198
197
  "classnames": "^2.5.1",
199
198
  "globals": "^17.4.0",
200
199
  "nanoid": "^5.1.11",