+                    Edit src/App.tsx and save to test HMR
+                
+ Click on the Vite and React logos to learn more +
+ > + ); +} + +export default App; diff --git a/examples/react/react-app/src/assets/react.svg b/examples/example-predeployed-connector/src/assets/react.svg similarity index 100% rename from examples/react/react-app/src/assets/react.svg rename to examples/example-predeployed-connector/src/assets/react.svg diff --git a/examples/react/react-pwa-app/src/index.css b/examples/example-predeployed-connector/src/index.css similarity index 94% rename from examples/react/react-pwa-app/src/index.css rename to examples/example-predeployed-connector/src/index.css index fa9cf5e5f..279fff56b 100644 --- a/examples/react/react-pwa-app/src/index.css +++ b/examples/example-predeployed-connector/src/index.css @@ -11,7 +11,6 @@ text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; } a { @@ -19,7 +18,6 @@ a { color: #646cff; text-decoration: inherit; } - a:hover { color: #535bf2; } @@ -48,11 +46,9 @@ button { cursor: pointer; transition: border-color 0.25s; } - button:hover { border-color: #646cff; } - button:focus, button:focus-visible { outline: 4px auto -webkit-focus-ring-color; @@ -63,16 +59,10 @@ button:focus-visible { color: #213547; background-color: #ffffff; } - a:hover { color: #747bff; } - button { background-color: #f9f9f9; } } - -canvas { - display: block; -} diff --git a/examples/example-predeployed-connector/src/main.tsx b/examples/example-predeployed-connector/src/main.tsx new file mode 100644 index 000000000..9a0f3ac2d --- /dev/null +++ b/examples/example-predeployed-connector/src/main.tsx @@ -0,0 +1,13 @@ +import { StrictMode } from "react"; +import { createRoot } from "react-dom/client"; +import "./index.css"; +import App from "./App.tsx"; +import StarknetProvider from "./starknet-provider.tsx"; + +createRoot(document.getElementById("root")!).render( +${JSON.stringify(update, null, 2)}`;
+        hljs.highlightElement(updateElement.firstChild! as HTMLElement);
+
+        const copyButton = document.createElement("button");
+        copyButton.textContent = "copy";
+        copyButton.style.cssText = `
+        position: absolute;
+        top: 5px;
+        right: 5px;
+        padding: 2px 4px;
+        border: none;
+        border-radius: 4px;
+        background: #e0e0e0;
+        cursor: pointer;
+    `;
+
+        copyButton.onclick = async () => {
+            try {
+                await navigator.clipboard.writeText(
+                    JSON.stringify(update, null, 2)
+                );
+                copyButton.textContent = "✓";
+                setTimeout(() => (copyButton.textContent = "copy"), 1000);
+            } catch (err) {
+                console.error("Failed to copy:", err);
+                copyButton.textContent = "❌";
+                setTimeout(() => (copyButton.textContent = "copy"), 1000);
+            }
+        };
+
+        updateContainer.appendChild(titleElement);
+        updateContainer.appendChild(updateElement);
+        updateContainer.appendChild(copyButton);
+        updatesDiv.appendChild(updateContainer);
+        updatesDiv.scrollTop = updatesDiv.scrollHeight;
+    }
+}
diff --git a/examples/react/react-phaser-example/src/vite-env.d.ts b/examples/example-vite-experimental-sdk/src/vite-env.d.ts
similarity index 100%
rename from examples/react/react-phaser-example/src/vite-env.d.ts
rename to examples/example-vite-experimental-sdk/src/vite-env.d.ts
diff --git a/examples/example-vite-experimental-sdk/tsconfig.json b/examples/example-vite-experimental-sdk/tsconfig.json
new file mode 100644
index 000000000..c62b3b564
--- /dev/null
+++ b/examples/example-vite-experimental-sdk/tsconfig.json
@@ -0,0 +1,22 @@
+{
+    "compilerOptions": {
+        "target": "ES2022",
+        "useDefineForClassFields": true,
+        "module": "ESNext",
+        "lib": ["ES2023"],
+        "skipLibCheck": true,
+        /* Bundler mode */
+        "moduleResolution": "bundler",
+        "allowImportingTsExtensions": true,
+        "isolatedModules": true,
+        "moduleDetection": "force",
+        "noEmit": true,
+        /* Linting */
+        "strict": true,
+        "noUnusedLocals": true,
+        "noUnusedParameters": true,
+        "noFallthroughCasesInSwitch": true,
+        "noUncheckedSideEffectImports": true
+    },
+    "include": ["src"]
+}
diff --git a/examples/example-vite-experimental-sdk/vite.config.ts b/examples/example-vite-experimental-sdk/vite.config.ts
new file mode 100644
index 000000000..9ec33a86d
--- /dev/null
+++ b/examples/example-vite-experimental-sdk/vite.config.ts
@@ -0,0 +1,17 @@
+import path from "path";
+import { defineConfig } from "vite";
+import wasm from "vite-plugin-wasm";
+import topLevelAwait from "vite-plugin-top-level-await";
+
+// https://vitejs.dev/config/
+export default defineConfig({
+    plugins: [wasm(), topLevelAwait()],
+    resolve: {
+        alias: {
+            "@": path.resolve(__dirname, "./src"),
+        },
+    },
+    build: {
+        target: "ES2022",
+    },
+});
diff --git a/examples/example-vite-grpc-playground/.gitignore b/examples/example-vite-grpc-playground/.gitignore
new file mode 100644
index 000000000..a547bf36d
--- /dev/null
+++ b/examples/example-vite-grpc-playground/.gitignore
@@ -0,0 +1,24 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/examples/example-vite-grpc-playground/.prettierignore b/examples/example-vite-grpc-playground/.prettierignore
new file mode 100644
index 000000000..b21d6f79d
--- /dev/null
+++ b/examples/example-vite-grpc-playground/.prettierignore
@@ -0,0 +1,19 @@
+**/*/target
+**/*/dist
+packages/torii-client/wasm
+packages/torii-client/pkg
+packages/torii-wasm/pkg/
+packages/utils-wasm/pkg/
+
+packages/create-burner/coverage
+packages/core/coverage
+
+worlds/dojo-starter
+worlds/onchain-dash
+
+# ignore lock files
+**/*-lock.yaml
+package-lock.json
+dev-dist
+
+**/CHANGELOG.md
diff --git a/examples/example-vite-grpc-playground/README.md b/examples/example-vite-grpc-playground/README.md
new file mode 100644
index 000000000..44f2acc07
--- /dev/null
+++ b/examples/example-vite-grpc-playground/README.md
@@ -0,0 +1,50 @@
+# React + TypeScript + Vite
+
+This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
+
+Currently, two official plugins are available:
+
+- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
+- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
+
+## Expanding the ESLint configuration
+
+If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
+
+- Configure the top-level `parserOptions` property like this:
+
+```js
+export default tseslint.config({
+    languageOptions: {
+        // other options...
+        parserOptions: {
+            project: ["./tsconfig.node.json", "./tsconfig.app.json"],
+            tsconfigRootDir: import.meta.dirname,
+        },
+    },
+});
+```
+
+- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
+- Optionally add `...tseslint.configs.stylisticTypeChecked`
+- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
+
+```js
+// eslint.config.js
+import react from "eslint-plugin-react";
+
+export default tseslint.config({
+    // Set the react version
+    settings: { react: { version: "18.3" } },
+    plugins: {
+        // Add the react plugin
+        react,
+    },
+    rules: {
+        // other rules...
+        // Enable its recommended rules
+        ...react.configs.recommended.rules,
+        ...react.configs["jsx-runtime"].rules,
+    },
+});
+```
diff --git a/examples/react/react-app/dojoConfig.ts b/examples/example-vite-grpc-playground/dojoConfig.ts
similarity index 60%
rename from examples/react/react-app/dojoConfig.ts
rename to examples/example-vite-grpc-playground/dojoConfig.ts
index 634a32e5f..e45ee85a3 100644
--- a/examples/react/react-app/dojoConfig.ts
+++ b/examples/example-vite-grpc-playground/dojoConfig.ts
@@ -1,6 +1,7 @@
-import manifest from "../../dojo-starter/manifests/deployments/KATANA.json";
 import { createDojoConfig } from "@dojoengine/core";
 
+import manifest from "../../worlds/dojo-starter/manifest_dev.json";
+
 export const dojoConfig = createDojoConfig({
     manifest,
 });
diff --git a/examples/example-vite-grpc-playground/eslint.config.js b/examples/example-vite-grpc-playground/eslint.config.js
new file mode 100644
index 000000000..1c38349ad
--- /dev/null
+++ b/examples/example-vite-grpc-playground/eslint.config.js
@@ -0,0 +1,28 @@
+import js from "@eslint/js";
+import reactHooks from "eslint-plugin-react-hooks";
+import reactRefresh from "eslint-plugin-react-refresh";
+import globals from "globals";
+import tseslint from "typescript-eslint";
+
+export default tseslint.config(
+    { ignores: ["dist"] },
+    {
+        extends: [js.configs.recommended, ...tseslint.configs.recommended],
+        files: ["**/*.{ts,tsx}"],
+        languageOptions: {
+            ecmaVersion: 2020,
+            globals: globals.browser,
+        },
+        plugins: {
+            "react-hooks": reactHooks,
+            "react-refresh": reactRefresh,
+        },
+        rules: {
+            ...reactHooks.configs.recommended.rules,
+            "react-refresh/only-export-components": [
+                "warn",
+                { allowConstantExport: true },
+            ],
+        },
+    }
+);
diff --git a/examples/example-vite-grpc-playground/index.html b/examples/example-vite-grpc-playground/index.html
new file mode 100644
index 000000000..9b2e0d820
--- /dev/null
+++ b/examples/example-vite-grpc-playground/index.html
@@ -0,0 +1,13 @@
+
+
+    
+        
+        
+        
+        + Write and execute gRPC queries in real-time +
+| + {header} ++ ))} + | 
|---|
| + {value === null ? ( + + NULL + + ) : typeof value === + "object" ? ( + JSON.stringify(value) + ) : ( + String(value) + )} ++ ) + )} + | 
No Results Yet
++ Execute a query to see results here +
++ Showing {response.length} row + {response.length !== 1 ? "s" : ""} +
+ {executionTime && ( ++ {executionTime.toFixed(0)}ms +
+ )} ++ This is a simple example of using Dojo, Recs, and + Tailwind CSS in a React application. +
+ +