@vibecodeapp/sdk 0.4.2 → 0.4.4

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,8 @@
1
+ /**
2
+ * Native version of Screenshot
3
+ *
4
+ * This is a stub that does nothing on native platforms.
5
+ * The .web.tsx version handles web-specific screenshot functionality.
6
+ */
7
+ export declare function VibeScreenshot(): null;
8
+ //# sourceMappingURL=Screenshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Screenshot.d.ts","sourceRoot":"","sources":["../../src/dev/Screenshot.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,cAAc,SAE7B"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Native version of Screenshot
3
+ *
4
+ * This is a stub that does nothing on native platforms.
5
+ * The .web.tsx version handles web-specific screenshot functionality.
6
+ */
7
+ export function VibeScreenshot() {
8
+ return null;
9
+ }
10
+ //# sourceMappingURL=Screenshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Screenshot.js","sourceRoot":"","sources":["../../src/dev/Screenshot.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UAAU,cAAc;IAC7B,OAAO,IAAI,CAAA;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Web version of Screenshot - listens for screenshot requests from parent iframe
3
+ *
4
+ * On web, this component listens for postMessage requests and captures
5
+ * the current page using html-to-image, then sends the result back.
6
+ */
7
+ export declare function VibeScreenshot(): null;
8
+ //# sourceMappingURL=Screenshot.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Screenshot.web.d.ts","sourceRoot":"","sources":["../../src/dev/Screenshot.web.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkDH,wBAAgB,cAAc,SA2B7B"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Web version of Screenshot - listens for screenshot requests from parent iframe
3
+ *
4
+ * On web, this component listens for postMessage requests and captures
5
+ * the current page using html-to-image, then sends the result back.
6
+ */
7
+ import { useEffect } from 'react';
8
+ import { toPng } from 'html-to-image';
9
+ async function captureScreenshot() {
10
+ const scale = window.devicePixelRatio || 1;
11
+ const width = document.body.scrollWidth;
12
+ const height = document.body.scrollHeight;
13
+ const image = await toPng(document.body, {
14
+ cacheBust: true,
15
+ pixelRatio: scale,
16
+ });
17
+ return {
18
+ image,
19
+ width: width * scale,
20
+ height: height * scale,
21
+ };
22
+ }
23
+ function postScreenshotToParent(data) {
24
+ try {
25
+ if (typeof window !== 'undefined' &&
26
+ window.parent &&
27
+ window.parent !== window) {
28
+ window.parent.postMessage(data, '*');
29
+ }
30
+ }
31
+ catch {
32
+ // Silently fail
33
+ }
34
+ }
35
+ export function VibeScreenshot() {
36
+ useEffect(() => {
37
+ const handleMessage = async (event) => {
38
+ if (event.data?.type === 'vibecode:screenshot:request') {
39
+ try {
40
+ const { image, width, height } = await captureScreenshot();
41
+ postScreenshotToParent({
42
+ type: 'vibecode:screenshot:response',
43
+ requestId: event.data.requestId,
44
+ image,
45
+ width,
46
+ height,
47
+ timestamp: Date.now(),
48
+ });
49
+ }
50
+ catch (error) {
51
+ // Failed to capture screenshot - silently fail
52
+ console.warn('[Vibecode] Screenshot capture failed:', error);
53
+ }
54
+ }
55
+ };
56
+ window.addEventListener('message', handleMessage);
57
+ return () => window.removeEventListener('message', handleMessage);
58
+ }, []);
59
+ // This component renders nothing
60
+ return null;
61
+ }
62
+ //# sourceMappingURL=Screenshot.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Screenshot.web.js","sourceRoot":"","sources":["../../src/dev/Screenshot.web.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAgBrC,KAAK,UAAU,iBAAiB;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,g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oBAChB,+CAA+C;oBAC/C,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAA;gBAC7D,CAAC;YACF,CAAC;QACF,CAAC,CAAA;QAED,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;QACjD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;IAClE,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,iCAAiC;IACjC,OAAO,IAAI,CAAA;AACZ,CAAC"}
@@ -4,6 +4,7 @@
4
4
  * Automatically wraps the root layout with necessary providers.
5
5
  * Currently includes VibeSafeInsets for safe area handling on web.
6
6
  * VibeErrorBoundary for error reporting on web.
7
+ * VibeScreenshot for screenshot capture on web.
7
8
  */
8
9
  import type { PropsWithChildren } from 'react';
9
10
  export declare function VibeDevWrapper({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"VibeDevWrapper.d.ts","sourceRoot":"","sources":["../../src/dev/VibeDevWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAI9C,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAQ7D"}
1
+ {"version":3,"file":"VibeDevWrapper.d.ts","sourceRoot":"","sources":["../../src/dev/VibeDevWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAK9C,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAS7D"}
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { VibeErrorBoundary } from './error-boundry/ErrorBoundary';
3
3
  import { VibeSafeInsets } from './safe-inserts/safe-insets';
4
+ import { VibeScreenshot } from './Screenshot';
4
5
  export function VibeDevWrapper({ children }) {
5
- return (_jsx(VibeErrorBoundary, { children: _jsx(VibeSafeInsets, { children: children }) }));
6
+ return (_jsx(VibeErrorBoundary, { children: _jsxs(VibeSafeInsets, { children: [_jsx(VibeScreenshot, {}), children] }) }));
6
7
  }
7
8
  //# sourceMappingURL=VibeDevWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VibeDevWrapper.js","sourceRoot":"","sources":["../../src/dev/VibeDevWrapper.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAE3D,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAqB;IAC7D,OAAO,CACN,KAAC,iBAAiB,cACjB,KAAC,cAAc,cACb,QAAQ,GACO,GACE,CACpB,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"VibeDevWrapper.js","sourceRoot":"","sources":["../../src/dev/VibeDevWrapper.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAqB;IAC7D,OAAO,CACN,KAAC,iBAAiB,cACjB,MAAC,cAAc,eACd,KAAC,cAAc,KAAG,EACjB,QAAQ,IACO,GACE,CACpB,CAAA;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecodeapp/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "SDK for Vibecodeapp.com - Web polyfills and Metro configuration for React Native",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "@teovilla/react-native-web-maps": "^0.9.5",
41
41
  "@stardazed/streams-text-encoding": "^1.0.2",
42
42
  "assert": "^2.1.0",
43
+ "html-to-image": "^1.11.11",
43
44
  "p-limit": "^3.1.0"
44
45
  },
45
46
  "devDependencies": {
@@ -55,7 +56,7 @@
55
56
  "react": "*",
56
57
  "react-native": "*",
57
58
  "react-native-web": "*",
58
- "react-native-safe-area-context": "^5.6.2",
59
+ "react-native-safe-area-context": "*",
59
60
  "react-native-svg-transformer": "*",
60
61
  "metro-cache": "*",
61
62
  "expo-status-bar": "*"