@techinject/sveltekit 0.0.0-stage → 0.1.0-alpha.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SignalKit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # @techinject/sveltekit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Unpublished alpha browser lifecycle adapter. Construct createSvelteKitClient(config) per root layout, mount it inside Svelte onMount, and return client.dispose from that callback. Construction is SSR-safe; mounting on the server throws. mount is idempotent; dispose restores owned patches and allows a fresh mount.
4
+
5
+ getSignals() exposes the browser SDK after mounting: setConsent, track, page and flush. Initial/pathname pages and browser fetch/XHR use the existing browser instrumentation. Do not also call page from afterNavigate for every navigation: that would duplicate automatic pages. Query-only navigation is not a new page. Denied pages are dropped; explicitly call page after a real consent decision if the current page should be recorded.
6
+
7
+ Keep this client per layout, never in a shared server module. Use host-owned persisted consent. Inject a browser observer for technical requests; GA4/Meta receive business events, not API telemetry. No server credentials belong in client configuration. Use @techinject/sveltekit-server only in hooks.server.ts on Node.
8
+
9
+ See [integration reference](../INTEGRATION.md), [runtime evidence](../../../../docs/COMPATIBILITY.md) and [SvelteKit lab](../../../../examples/sveltekit/README.md). Verified SvelteKit 3/Svelte 5; other majors and Edge runtimes are not certified.
@@ -0,0 +1,40 @@
1
+ import { type BrowserConfig } from '@techinject/browser';
2
+ /** Construct per layout (SSR-safe); mount only from Svelte's onMount. */
3
+ export declare function createSvelteKitClient(config?: BrowserConfig): {
4
+ mount(): {
5
+ flush(): Promise<void>;
6
+ setConsent: (consent: import("@techinject/contracts").Consent) => void;
7
+ page: (path?: string, eventId?: string) => Promise<import("@techinject/contracts").DispatchResult>;
8
+ start: () => void;
9
+ stop: () => void;
10
+ dispose: () => void;
11
+ track: (input: import("@techinject/contracts").EventInput) => Promise<import("@techinject/contracts").DispatchResult>;
12
+ getConsent: () => {
13
+ analytics: boolean;
14
+ marketing: boolean;
15
+ observability: boolean;
16
+ };
17
+ getConnections: () => import("@techinject/core").ConnectionStatus[];
18
+ subscribeConnections(listener: () => void): () => void;
19
+ };
20
+ getSignals(): {
21
+ flush(): Promise<void>;
22
+ setConsent: (consent: import("@techinject/contracts").Consent) => void;
23
+ page: (path?: string, eventId?: string) => Promise<import("@techinject/contracts").DispatchResult>;
24
+ start: () => void;
25
+ stop: () => void;
26
+ dispose: () => void;
27
+ track: (input: import("@techinject/contracts").EventInput) => Promise<import("@techinject/contracts").DispatchResult>;
28
+ getConsent: () => {
29
+ analytics: boolean;
30
+ marketing: boolean;
31
+ observability: boolean;
32
+ };
33
+ getConnections: () => import("@techinject/core").ConnectionStatus[];
34
+ subscribeConnections(listener: () => void): () => void;
35
+ };
36
+ dispose(): void;
37
+ };
38
+ export { createGA4Provider, createMetaPixelProvider, createClarityProvider, } from '@techinject/browser';
39
+ export type { BrowserConfig, BrowserSignals } from '@techinject/browser';
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,aAAa,EAAuB,MAAM,qBAAqB,CAAC;AAEpG,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,aAAkB;;;;mBAU5D,CAAD,iBACG,CAAJ;;;;;;;;;;;;;;;;mBADE,CAAD,iBACG,CAAJ;;;;;;;;;;;;;;EAQD;AACD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ import { createBrowserSignals } from '@techinject/browser';
2
+ /** Construct per layout (SSR-safe); mount only from Svelte's onMount. */
3
+ export function createSvelteKitClient(config = {}) {
4
+ let signals;
5
+ return {
6
+ mount() {
7
+ if (typeof window === 'undefined')
8
+ throw new Error('Mount SignalKit in onMount, not during SSR');
9
+ signals ??= createBrowserSignals({ ...config, autoTrack: false });
10
+ signals.start();
11
+ return signals;
12
+ },
13
+ getSignals() {
14
+ if (!signals)
15
+ throw new Error('SignalKit client has not mounted');
16
+ return signals;
17
+ },
18
+ dispose() {
19
+ signals?.dispose();
20
+ signals = undefined;
21
+ },
22
+ };
23
+ }
24
+ export { createGA4Provider, createMetaPixelProvider, createClarityProvider, } from '@techinject/browser';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA2C,MAAM,qBAAqB,CAAC;AAEpG,yEAAyE;AACzE,MAAM,UAAU,qBAAqB,CAAC,SAAwB,EAAE;IAC9D,IAAI,OAAmC,CAAC;IACxC,OAAO;QACL,KAAK;YACH,IAAI,OAAO,MAAM,KAAK,WAAW;gBAC/B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAChE,OAAO,KAAK,oBAAoB,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;YAClE,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,UAAU;YACR,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClE,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO;YACL,OAAO,EAAE,OAAO,EAAE,CAAC;YACnB,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AACD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@techinject/sveltekit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-alpha.2",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "files": [
7
+ "dist",
8
+ "LICENSE",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "dependencies": {
18
+ "@techinject/browser": "0.1.0-alpha.2"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/TechInjectIndia/signal-kit.git",
23
+ "directory": "packages/features/signals/sveltekit"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "engines": {},
29
+ "description": "SignalKit SvelteKit browser lifecycle adapter",
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.json",
32
+ "typecheck": "tsc -p tsconfig.json --noEmit",
33
+ "test": "vitest run",
34
+ "lint": "tsc -p tsconfig.json --noEmit"
35
+ }
6
36
  }