@neomorph/sdk 0.0.1 → 0.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/dist/cdn.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/loomer.d.ts +4 -3
- package/dist/types.d.ts +1 -0
- package/package.json +2 -1
package/dist/cdn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return"string"==typeof e?e:null}function
|
|
1
|
+
function e(e){return"string"==typeof e?e:null}function t(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const a=function(a){if(t(a)){const n=e(a.requestId),i=e(a.service),r=function(e){if(t(e))return{...e};return null}(a.payload);if(null!==n&&null!==i&&null!==r)return{requestId:n,service:i,payload:r}}return null};class n{applicationFrame;callbacks;constructor(){this.applicationFrame=null,this.callbacks=[]}loadApplication(e,t=document.body){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",t.appendChild(this.applicationFrame),window.addEventListener("message",e=>{const t=a(e.data);null!==t&&console.log("DecodedResponse: ",t)})}catch(e){console.error("🕸️ Weaver: Failed to load application:",e)}}listenCssVariables(e){try{this.applicationFrame?.contentWindow?.postMessage(JSON.stringify({source:"skinweaver",payload:JSON.stringify({requestId:"randomId",service:"skinweaver",payload:{action:"listenCssVariables"}})}),"*"),this.callbacks.push(e)}catch(e){console.error("🕸️ Weaver: Failed to send message to iframe:",e)}}}class i{static inject(e="1.0.0"){if("undefined"!=typeof document)try{const t=document.createElement("script");t.src=`https://cdn.jsdelivr.net/gh/sinha-sahil/neomorph/build/weaver/${e}/index.js`,t.type="text/javascript",document.head.appendChild(t)}catch(e){console.error("🕸️ Weaver: Failed to inject weaver script:",e)}else console.warn("🕸️ Weaver: inject() called in non-browser environment")}}export{n as Loomer,i as Weaver};
|
package/dist/loomer.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StylesCallback } from "./types";
|
|
2
2
|
export declare class Loomer {
|
|
3
3
|
private applicationFrame;
|
|
4
|
+
private callbacks;
|
|
4
5
|
constructor();
|
|
5
|
-
loadApplication(url: string,
|
|
6
|
-
listenCssVariables(): void;
|
|
6
|
+
loadApplication(url: string, container?: HTMLElement): void;
|
|
7
|
+
listenCssVariables(callback: StylesCallback): void;
|
|
7
8
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type SDKPayload = {
|
|
|
15
15
|
};
|
|
16
16
|
export type SDKPayloadPayload = Record<string, unknown>;
|
|
17
17
|
export type SDKResponse = SDKPayload;
|
|
18
|
+
export type StylesCallback = (val: HostStyles) => void;
|
|
18
19
|
export declare function decodeCssProperty(rawInput: unknown): CSSProperty | null;
|
|
19
20
|
export declare function decodeSDKPayload(rawInput: unknown): SDKPayload | null;
|
|
20
21
|
export declare function decodeSDKPayloadPayload(rawInput: unknown): SDKPayloadPayload | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neomorph/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "Core SDK for Neomorph - Advanced theme generator toolkit for web applications",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "rollup -c rollup.config.js --watch",
|
|
20
20
|
"build": "rollup --config rollup.config.js",
|
|
21
|
+
"build:cdn": "rollup --config rollup.config.js --environment buildType=cdn",
|
|
21
22
|
"format": "npx prettier --write .",
|
|
22
23
|
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
23
24
|
"clean": "rm -rf dist"
|