| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
0 parents commit 4db7539
74 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + module.exports = { | ||
| 2 | + root: true, | ||
| 3 | + env: { browser: true, es2020: true }, | ||
| 4 | + extends: [ | ||
| 5 | + "eslint:recommended", | ||
| 6 | + "plugin:react/recommended", | ||
| 7 | + "plugin:react/jsx-runtime", | ||
| 8 | + "plugin:react-hooks/recommended", | ||
| 9 | + ], | ||
| 10 | + ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
| 11 | + parserOptions: { ecmaVersion: "latest", sourceType: "module" }, | ||
| 12 | + settings: { react: { version: "18.2" } }, | ||
| 13 | + plugins: ["react-refresh"], | ||
| 14 | + rules: { | ||
| 15 | + "react/jsx-no-target-blank": "off", | ||
| 16 | + "react/prop-types": "off", | ||
| 17 | + }, | ||
| 18 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + # Logs | ||
| 2 | + logs | ||
| 3 | + *.log | ||
| 4 | + npm-debug.log* | ||
| 5 | + yarn-debug.log* | ||
| 6 | + yarn-error.log* | ||
| 7 | + pnpm-debug.log* | ||
| 8 | + lerna-debug.log* | ||
| 9 | + | ||
| 10 | + node_modules | ||
| 11 | + dist | ||
| 12 | + dist-ssr | ||
| 13 | + *.local | ||
| 14 | + | ||
| 15 | + # Editor directories and files | ||
| 16 | + .vscode/* | ||
| 17 | + !.vscode/extensions.json | ||
| 18 | + .idea | ||
| 19 | + .DS_Store | ||
| 20 | + *.suo | ||
| 21 | + *.ntvs* | ||
| 22 | + *.njsproj | ||
| 23 | + *.sln | ||
| 24 | + *.sw? | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + import { toPng } from "html-to-image"; | ||
| 2 | + | ||
| 3 | + export const loadGetUserSnapshotEventListener = () => { | ||
| 4 | + window.addEventListener("blur", () => { | ||
| 5 | + toPng(document.body).then((url) => { | ||
| 6 | + window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "http://localhost:3000"); | ||
| 7 | + window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "https://gptengineer.app"); | ||
| 8 | + }); | ||
| 9 | + }); | ||
| 10 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + import { loadGetUserSnapshotEventListener } from "./get-user-snapshot"; | ||
| 2 | + import { loadReportUrlChangeEventListener } from "./report-url-change"; | ||
| 3 | + import { loadReportErrorEventListener } from "./report-error"; | ||
| 4 | + | ||
| 5 | + const main = () => { | ||
| 6 | + if (window.top === window.self) { | ||
| 7 | + return; | ||
| 8 | + } | ||
| 9 | + loadGetUserSnapshotEventListener(); | ||
| 10 | + loadReportUrlChangeEventListener(); | ||
| 11 | + loadReportErrorEventListener(); | ||
| 12 | + }; | ||
| 13 | + | ||
| 14 | + main(); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,88 @@ | |||
| 1 | + export const loadReportErrorEventListener = (() => { | ||
| 2 | + let isInitialized = false; | ||
| 3 | + | ||
| 4 | + const extractError = ({ message, lineno, colno, filename, error }) => { | ||
| 5 | + return { message, lineno, colno, filename, stack: error?.stack }; | ||
| 6 | + }; | ||
| 7 | + | ||
| 8 | + return () => { | ||
| 9 | + if (isInitialized) return; | ||
| 10 | + | ||
| 11 | + const reportedErrors = new Set(); | ||
| 12 | + | ||
| 13 | + const generateErrorId = (event) => { | ||
| 14 | + const { lineno, colno, filename, message } = event; | ||
| 15 | + return `${message}|${filename}|${lineno}|${colno}`; | ||
| 16 | + }; | ||
| 17 | + | ||
| 18 | + const isErrorAlreadyReported = (errorId) => { | ||
| 19 | + if (reportedErrors.has(errorId)) { | ||
| 20 | + return true; | ||
| 21 | + } | ||
| 22 | + reportedErrors.add(errorId); | ||
| 23 | + // Optionally, clear the set after some time to prevent it from growing indefinitely | ||
| 24 | + setTimeout(() => reportedErrors.delete(errorId), 5000); | ||
| 25 | + return false; | ||
| 26 | + }; | ||
| 27 | + | ||
| 28 | + const reportError = (event) => { | ||
| 29 | + const errorId = generateErrorId(event); | ||
| 30 | + | ||
| 31 | + // Prevent error being reported multiple times | ||
| 32 | + if (isErrorAlreadyReported(errorId)) { | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + const error = extractError(event); | ||
| 37 | + | ||
| 38 | + console.log("GOTERR EVENT", event); | ||
| 39 | + console.log("GOTERR ", error); | ||
| 40 | + | ||
| 41 | + window.top.postMessage( | ||
| 42 | + { type: "RUNTIME_ERROR", error }, | ||
| 43 | + "https://gptengineer.app" | ||
| 44 | + ); | ||
| 45 | + window.top.postMessage( | ||
| 46 | + { type: "RUNTIME_ERROR", error }, | ||
| 47 | + "http://localhost:3000" | ||
| 48 | + ); | ||
| 49 | + }; | ||
| 50 | + | ||
| 51 | + // Listen to runtime errors and report them to the parent window | ||
| 52 | + window.addEventListener("error", reportError); | ||
| 53 | + | ||
| 54 | + // Listen to unhandled promise rejections | ||
| 55 | + window.addEventListener("unhandledrejection", (event) => { | ||
| 56 | + if (!event.reason?.stack) { | ||
| 57 | + return; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + const errorId = | ||
| 61 | + event.reason?.stack || event.reason?.message || String(event.reason); | ||
| 62 | + | ||
| 63 | + // Prevent error being reported multiple times | ||
| 64 | + if (isErrorAlreadyReported(errorId)) { | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + const error = { | ||
| 69 | + message: event.reason?.message || "Unhandled promise rejection", | ||
| 70 | + stack: event.reason?.stack || String(event.reason), | ||
| 71 | + }; | ||
| 72 | + | ||
| 73 | + console.log("GOT UNHANDLED PROMISE REJECTION", event); | ||
| 74 | + console.log("GOT UNHANDLED PROMISE REJECTION ", error); | ||
| 75 | + | ||
| 76 | + window.top.postMessage( | ||
| 77 | + { type: "UNHANDLED_PROMISE_REJECTION", error }, | ||
| 78 | + "https://gptengineer.app" | ||
| 79 | + ); | ||
| 80 | + window.top.postMessage( | ||
| 81 | + { type: "UNHANDLED_PROMISE_REJECTION", error }, | ||
| 82 | + "http://localhost:3000" | ||
| 83 | + ); | ||
| 84 | + }); | ||
| 85 | + | ||
| 86 | + isInitialized = true; | ||
| 87 | + }; | ||
| 88 | + })(); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + export const loadReportUrlChangeEventListener = () => { | ||
| 2 | + /** | ||
| 3 | + * Listen to URL changes and report them to the parent window | ||
| 4 | + * | ||
| 5 | + * See https://stackoverflow.com/a/46428962 | ||
| 6 | + * The Navigation API https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API seemed promising, | ||
| 7 | + * but it is not supported in all major browsers. | ||
| 8 | + */ | ||
| 9 | + const observeUrlChange = () => { | ||
| 10 | + let oldHref = document.location.href; | ||
| 11 | + const body = document.querySelector("body"); | ||
| 12 | + const observer = new MutationObserver(() => { | ||
| 13 | + if (oldHref !== document.location.href) { | ||
| 14 | + oldHref = document.location.href; | ||
| 15 | + window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "https://run.gptengineer.app"); | ||
| 16 | + window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "http://localhost:3000"); | ||
| 17 | + } | ||
| 18 | + }); | ||
| 19 | + observer.observe(body, { childList: true, subtree: true }); | ||
| 20 | + }; | ||
| 21 | + | ||
| 22 | + window.addEventListener("load", observeUrlChange); | ||
| 23 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,67 @@ | |||
| 1 | + # Welcome to your GPT Engineer project | ||
| 2 | + | ||
| 3 | + ## Project info | ||
| 4 | + | ||
| 5 | + **Project**: modelflow-diagram | ||
| 6 | + | ||
| 7 | + **URL**: https://run.gptengineer.app/projects/fefc33f0-6bbc-4168-962a-9198397f70f8/improve | ||
| 8 | + | ||
| 9 | + ## How can I edit this code? | ||
| 10 | + | ||
| 11 | + There are several ways of editing your application. | ||
| 12 | + | ||
| 13 | + **Use GPT Engineer** | ||
| 14 | + | ||
| 15 | + Simply visit the GPT Engineer project at [GPT Engineer](https://gptengineer.app/projects/fefc33f0-6bbc-4168-962a-9198397f70f8/improve) and start prompting. | ||
| 16 | + | ||
| 17 | + Changes made via gptengineer.app will be committed automatically to this repo. | ||
| 18 | + | ||
| 19 | + **Use your preferred IDE** | ||
| 20 | + | ||
| 21 | + If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in the GPT Engineer UI. | ||
| 22 | + | ||
| 23 | + The only requirement is having Node.js & npm installed - [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating) | ||
| 24 | + | ||
| 25 | + Follow these steps: | ||
| 26 | + | ||
| 27 | + ```sh | ||
| 28 | + git clone https://github.com/GPT-Engineer-App/modelflow-diagram.git | ||
| 29 | + cd modelflow-diagram | ||
| 30 | + npm i | ||
| 31 | + | ||
| 32 | + # This will run a dev server with auto reloading and an instant preview. | ||
| 33 | + npm run dev | ||
| 34 | + ``` | ||
| 35 | + | ||
| 36 | + **Edit a file directly in GitHub** | ||
| 37 | + | ||
| 38 | + - Navigate to the desired file(s). | ||
| 39 | + - Click the "Edit" button (pencil icon) at the top right of the file view. | ||
| 40 | + - Make your changes and commit the changes. | ||
| 41 | + | ||
| 42 | + **Use GitHub Codespaces** | ||
| 43 | + | ||
| 44 | + - Navigate to the main page of your repository. | ||
| 45 | + - Click on the "Code" button (green button) near the top right. | ||
| 46 | + - Select the "Codespaces" tab. | ||
| 47 | + - Click on "New codespace" to launch a new Codespace environment. | ||
| 48 | + - Edit files directly within the Codespace and commit and push your changes once you're done. | ||
| 49 | + | ||
| 50 | + ## What technologies are used for this project? | ||
| 51 | + | ||
| 52 | + This project is built with . | ||
| 53 | + | ||
| 54 | + - Vite | ||
| 55 | + - React | ||
| 56 | + - shadcn-ui | ||
| 57 | + - Tailwind CSS | ||
| 58 | + | ||
| 59 | + ## How can I deploy this project? | ||
| 60 | + | ||
| 61 | + All GPT Engineer projects can be deployed directly via the GPT Engineer app. | ||
| 62 | + | ||
| 63 | + Simply visit your project at [GPT Engineer](https://gptengineer.app/projects/fefc33f0-6bbc-4168-962a-9198397f70f8/improve) and click on Share -> Publish. | ||
| 64 | + | ||
| 65 | + ## I want to use a custom domain - is that possible? | ||
| 66 | + | ||
| 67 | + We don't support custom domains (yet). If you want to deploy your project under your own domain then we recommend using Netlify or GitHub pages. Visit our docs for more details: [Custom domains](https://docs.gptengineer.app/tips-tricks/custom-domain/) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + { | ||
| 2 | + "$schema": "https://ui.shadcn.com/schema.json", | ||
| 3 | + "style": "default", | ||
| 4 | + "rsc": false, | ||
| 5 | + "tsx": false, | ||
| 6 | + "tailwind": { | ||
| 7 | + "config": "tailwind.config.js", | ||
| 8 | + "css": "src/index.css", | ||
| 9 | + "baseColor": "slate", | ||
| 10 | + "cssVariables": true, | ||
| 11 | + "prefix": "" | ||
| 12 | + }, | ||
| 13 | + "aliases": { | ||
| 14 | + "components": "@/components", | ||
| 15 | + "utils": "@/lib/utils" | ||
| 16 | + } | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + [run] | ||
| 2 | + build = "npm run build" | ||
| 3 | + | ||
| 4 | + [gptengineer-app] | ||
| 5 | + project_id = "..." | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments