@neomorph/sdk 1.0.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.
@@ -0,0 +1,2 @@
1
+ export * from "./loomer";
2
+ export * from "./weaver";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function e(e){return"string"==typeof e?e:null}function n(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const t=function(t){if(n(t)){const i=e(t.requestId),r=e(t.service),a=function(e){if(n(e))return{...e};return null}(t.payload);if(null!==i&&null!==r&&null!==a)return{requestId:i,service:r,payload:a}}return null};class i{applicationFrame;constructor(){this.applicationFrame=null}loadApplication(e,n){if("undefined"!=typeof document&&"undefined"!=typeof window)try{this.applicationFrame=document.createElement("iframe"),this.applicationFrame.src=e,this.applicationFrame.style.width="100%",this.applicationFrame.style.height="100%",this.applicationFrame.style.border="none",document.body.appendChild(this.applicationFrame),window.addEventListener("message",e=>{const i=t(e.data);n(i)})}catch(e){console.error("🕸️ Weaver: Failed to load application:",e)}else console.warn("🕸️ Weaver: loadApplication() called in non-browser environment")}listenCssVariables(){if("undefined"!=typeof window)try{const e=this.applicationFrame;if(!e?.contentWindow)return void console.error("🕸️ Weaver: No iframe loaded or iframe not ready");e.contentWindow.postMessage(JSON.stringify({source:"skinweaver",payload:JSON.stringify({requestId:"randomId",service:"skinweaver",payload:{action:"listenCssVariables"}})}),"*")}catch(e){console.error("🕸️ Weaver: Failed to send message to iframe:",e)}else console.warn("🕸️ Weaver: listenCssVariables() called in non-browser environment")}}class r{static inject(e="1.0.0"){if("undefined"!=typeof document)try{const n=document.createElement("script");n.src=`https://cdn.jsdelivr.net/gh/sinha-sahil/neomorph/build/weaver/${e}/index.js`,n.type="text/javascript",document.head.appendChild(n)}catch(e){console.error("🕸️ Weaver: Failed to inject weaver script:",e)}else console.warn("🕸️ Weaver: inject() called in non-browser environment")}}export{i as Loomer,r as Weaver};
@@ -0,0 +1,7 @@
1
+ import { SDKResponse } from "./types";
2
+ export declare class Loomer {
3
+ private applicationFrame;
4
+ constructor();
5
+ loadApplication(url: string, callback: (response: SDKResponse | null) => void): void;
6
+ listenCssVariables(): void;
7
+ }
@@ -0,0 +1,21 @@
1
+ export type DocumentHost = {
2
+ name: string;
3
+ target: DocumentLike;
4
+ };
5
+ export type DocumentLike = Document | ShadowRoot;
6
+ export type CSSProperty = {
7
+ property: string;
8
+ value: string;
9
+ };
10
+ export type HostStyles = Map<string, Array<CSSProperty>>;
11
+ export type SDKPayload = {
12
+ requestId: string;
13
+ service: string;
14
+ payload: SDKPayloadPayload;
15
+ };
16
+ export type SDKPayloadPayload = Record<string, unknown>;
17
+ export type SDKResponse = SDKPayload;
18
+ export declare function decodeCssProperty(rawInput: unknown): CSSProperty | null;
19
+ export declare function decodeSDKPayload(rawInput: unknown): SDKPayload | null;
20
+ export declare function decodeSDKPayloadPayload(rawInput: unknown): SDKPayloadPayload | null;
21
+ export declare const decodeSDKResponse: (rawInput: unknown) => SDKResponse | null;
@@ -0,0 +1,3 @@
1
+ export declare class Weaver {
2
+ static inject(version?: string): void;
3
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@neomorph/sdk",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "Core SDK for Neomorph - Advanced theme generator toolkit for web applications",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/"
16
+ ],
17
+ "scripts": {
18
+ "dev": "rollup -c rollup.config.js --watch",
19
+ "build": "rollup --config rollup.config.js",
20
+ "format": "npx prettier --write .",
21
+ "lint": "prettier --plugin-search-dir . --check . && eslint .",
22
+ "clean": "rm -rf dist"
23
+ },
24
+ "keywords": [
25
+ "neomorph",
26
+ "theme",
27
+ "css-variables",
28
+ "transformation",
29
+ "ui",
30
+ "design-system",
31
+ "theming",
32
+ "sdk"
33
+ ],
34
+ "author": "Sahil Sinha",
35
+ "license": "ISC",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/sinha-sahil/neomorph.git",
39
+ "directory": "packages/sdk"
40
+ },
41
+ "homepage": "https://github.com/sinha-sahil/neomorph#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/sinha-sahil/neomorph/issues"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "packageManager": "pnpm@10.18.0",
49
+ "dependencies": {
50
+ "type-decoder": "^2.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@eslint/eslintrc": "^3.3.1",
54
+ "@eslint/js": "^9.36.0",
55
+ "@rollup/plugin-alias": "^5.1.1",
56
+ "@rollup/plugin-commonjs": "^28.0.6",
57
+ "@rollup/plugin-node-resolve": "^16.0.1",
58
+ "@rollup/plugin-terser": "^0.4.4",
59
+ "@rollup/plugin-typescript": "^12.1.4",
60
+ "@typescript-eslint/eslint-plugin": "^8.44.0",
61
+ "@typescript-eslint/parser": "^8.44.0",
62
+ "eslint": "^9.36.0",
63
+ "eslint-config-prettier": "^10.1.8",
64
+ "prettier": "^3.6.2",
65
+ "rollup": "^4.52.0",
66
+ "tslib": "^2.8.1",
67
+ "typescript": "^5.9.2"
68
+ }
69
+ }