initial commit
This commit is contained in:
13
src/app.d.ts
vendored
Normal file
13
src/app.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
12
src/app.html
Normal file
12
src/app.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
51
src/lib/Jitsi.svelte
Normal file
51
src/lib/Jitsi.svelte
Normal file
@@ -0,0 +1,51 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { type JitsiMeetExternalAPIOptions, JitsiMeetExternalAPI } from './jitsi-iframe-api.js';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
* The domain of the Jitsi Meet instance to be used. Defaults to "meet.jit.si".
|
||||
* @example "https://meet.jit.si"
|
||||
* @example "https://8x8.vc/<AppID>"
|
||||
*/
|
||||
domain: string;
|
||||
/**
|
||||
* The options to be passed to the Jitsi Meet External API.
|
||||
*/
|
||||
options: JitsiMeetExternalAPIOptions;
|
||||
}
|
||||
|
||||
let { domain = 'https://meet.jit.si', options }: Props = $props();
|
||||
|
||||
const src = $derived(`${new URL('external_api.js', domain).toString()}`);
|
||||
|
||||
let container: HTMLDivElement;
|
||||
let api = $state<JitsiMeetExternalAPI | null>(null);
|
||||
|
||||
onMount(() => {
|
||||
// check if we have a duplicate container
|
||||
if (document.querySelectorAll('#jitsi-container').length > 1) {
|
||||
console.warn('Duplicate Jitsi container detected. This may lead to unexpected behavior.');
|
||||
}
|
||||
|
||||
// Initialize the Jitsi Meet External API
|
||||
api = new JitsiMeetExternalAPI(new URL(domain).host, {
|
||||
...options,
|
||||
parentNode: container
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the Jitsi Meet External API instance.
|
||||
* @returns The Jitsi Meet External API instance or null if not initialized.
|
||||
*/
|
||||
export const getAPI = (): JitsiMeetExternalAPI | null => {
|
||||
return api;
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<script {src}></script>
|
||||
</svelte:head>
|
||||
|
||||
<div id="jitsi-container" bind:this={container}></div>
|
||||
3
src/lib/index.ts
Normal file
3
src/lib/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Reexport your entry components here
|
||||
export * from './Jitsi.svelte';
|
||||
export type * from './jitsi-iframe-api.d.ts';
|
||||
1338
src/lib/jitsi-iframe-api.d.ts
vendored
Normal file
1338
src/lib/jitsi-iframe-api.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
src/routes/+page.svelte
Normal file
3
src/routes/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>Welcome to your library project</h1>
|
||||
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
|
||||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
||||
Reference in New Issue
Block a user