@enquio/svelte-popup 1.1.0

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/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @enquio/svelte-popup
2
+
3
+ One component for Svelte 5.57.1+ (below 6) and SvelteKit. Install this package;
4
+ the shared core loader is included as a dependency.
5
+
6
+ ```sh
7
+ npm install @enquio/svelte-popup
8
+ ```
9
+
10
+ <!-- example:svelte -->
11
+
12
+ ```svelte
13
+ <script>
14
+ import { EnquioPopup } from '@enquio/svelte-popup';
15
+ </script>
16
+
17
+ <EnquioPopup projectId="YOUR_PROJECT_ID" />
18
+ ```
19
+
20
+ Place it once alongside existing content in `App.svelte`, or in a persistent
21
+ SvelteKit `+layout.svelte` alongside `{@render children()}`. Keep the component
22
+ outside clipped/transformed containers. No plugin, browser guard or SSR opt-out
23
+ is required. When consent is required, conditionally mount the component after consent.
24
+
25
+ `projectId` is a required string and can change reactively. The component creates
26
+ its popup only after browser mount and removes it on unmount. The loader shares
27
+ one runtime request; failures use the [core diagnostics](../core/README.md).
28
+ Removing a component does not cancel requests already started. Remounting while
29
+ loading does not start a duplicate load or resurrect the removed owner.
30
+
31
+ Remove the component/import and uninstall the package to remove the integration.
32
+ Local packed-package tests cover Svelte/Vite and SvelteKit SSR with simulated API
33
+ responses. Hosting and real-project verification remain separate. See the
34
+ [support matrix](../../docs/support-matrix.md) and [examples](../../docs/svelte-astro-examples.md).
35
+
36
+ The new package is pending its first public release. Source version 1.1.0 is
37
+ not evidence of npm availability; see the [release procedure](../../docs/npm-release.md).
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+ import { loadEnquioScript } from '@enquio/popup-core';
4
+
5
+ let { projectId }: { projectId: string } = $props();
6
+ let container: HTMLDivElement;
7
+ let host: HTMLElement | undefined;
8
+
9
+ onMount(() => {
10
+ // Create in the live document: template clones can be inert in WebKit.
11
+ // Mount also lets the outgoing route release its previous owner first.
12
+ host = document.createElement('enquio-popup');
13
+ host.setAttribute('project-id', projectId);
14
+ container.append(host);
15
+ void loadEnquioScript().catch(() => {});
16
+ return () => {
17
+ host?.remove();
18
+ host = undefined;
19
+ };
20
+ });
21
+
22
+ $effect(() => {
23
+ host?.setAttribute('project-id', projectId);
24
+ });
25
+ </script>
26
+
27
+ <div bind:this={container}></div>
@@ -0,0 +1,6 @@
1
+ type $$ComponentProps = {
2
+ projectId: string;
3
+ };
4
+ declare const EnquioPopup: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type EnquioPopup = ReturnType<typeof EnquioPopup>;
6
+ export default EnquioPopup;
@@ -0,0 +1 @@
1
+ export { default as EnquioPopup } from './EnquioPopup.svelte';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default as EnquioPopup } from './EnquioPopup.svelte';
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@enquio/svelte-popup",
3
+ "version": "1.1.0",
4
+ "description": "Svelte 5 and SvelteKit popup component for Enquio",
5
+ "type": "module",
6
+ "types": "./dist/index.d.ts",
7
+ "svelte": "./dist/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "svelte": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "sideEffects": false,
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/skutam/EnquioWrappers.git",
22
+ "directory": "packages/svelte"
23
+ },
24
+ "peerDependencies": {
25
+ "svelte": ">=5.57.1 <6"
26
+ },
27
+ "dependencies": {
28
+ "@enquio/popup-core": "1.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "@sveltejs/package": "2.5.8",
32
+ "svelte": "5.57.1",
33
+ "svelte-check": "4.7.6",
34
+ "typescript": "^5.0.0"
35
+ },
36
+ "scripts": {
37
+ "build": "svelte-package -i src",
38
+ "check": "svelte-check --tsconfig ./tsconfig.json",
39
+ "prepublishOnly": "npm run check && npm run build"
40
+ }
41
+ }