commit 476906500a433101a6163bc99ee9422ac83a29a7
Author: root <root@hub.scroll.pub> Date: 2024-12-28 21:32:19 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..8ad9c2e --- /dev/null +++ b/body.html @@ -0,0 +1,95 @@ +<header> + <nav> + <div class="logo">BrowserView</div> + <div class="nav-links"> + <a href="#features">Features</a> + <a href="#implementation">Implementation</a> + <a href="#components">Components</a> + <a href="#demo">Demo</a> + </div> + <button class="theme-toggle" aria-label="Toggle dark mode">🌓</button> + </nav> +</header> + +<main> + <section class="hero"> + <h1>Build Your Custom Browser</h1> + <p>Create a powerful mobile browser using React Native WebView</p> + <div class="browser-preview"> + <div class="browser-frame"> + <div class="browser-controls"> + <div class="control-buttons"> + <button aria-label="Back">←</button> + <button aria-label="Forward">→</button> + <button aria-label="Refresh">↻</button> + </div> + <input type="text" class="url-bar" placeholder="Enter URL..."> + <button class="bookmark-btn" aria-label="Bookmark">★</button> + </div> + <div class="browser-content"> + <div class="loading-bar"></div> + <div class="tab-container"> + <div class="tab active">Home</div> + <div class="tab">New Tab</div> + <button class="new-tab-btn">+</button> + </div> + <div class="webpage-view"></div> + </div> + </div> + </div> + </section> + + <section id="features"> + <h2>Key Features</h2> + <div class="feature-grid"> + <div class="feature-card"> + <h3>Web Rendering</h3> + <p>Full HTML5, CSS3, and JavaScript support</p> + </div> + <div class="feature-card"> + <h3>Tab Management</h3> + <p>Multiple tabs with smooth switching</p> + </div> + <div class="feature-card"> + <h3>Bookmarking</h3> + <p>Save and manage favorite sites</p> + </div> + <div class="feature-card"> + <h3>Dark Mode</h3> + <p>Toggle between light and dark themes</p> + </div> + </div> + </section> + + <section id="implementation"> + <h2>Technical Implementation</h2> + <div class="code-preview"> + <pre><code>// Sample WebView implementation +import { WebView } from 'react-native-webview'; + +const BrowserScreen = () => { + return ( + &lt;WebView + source={{ uri: 'https://example.com' }} + style={{ flex: 1 }} + /&gt; + ); +}</code></pre> + </div> + </section> +</main> + +<footer> + <div class="footer-content"> + <div class="footer-section"> + <h4>Documentation</h4> + <a href="#setup">Setup Guide</a> + <a href="#api">API Reference</a> + </div> + <div class="footer-section"> + <h4>Resources</h4> + <a href="#examples">Examples</a> + <a href="#tutorials">Tutorials</a> + </div> + </div> +</footer> diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..a03328e --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://browserview.scroll.pub +metaTags +editButton /edit.html +title Custom Browser Builder - React Native WebView Browser Creator +style.css +body.html +script.js diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..8f9cb6e --- /dev/null +++ b/prompt.json @@ -0,0 +1,20 @@ +{ + "id": "msg_01TE1EMgn12WkS7Bqc4vz3Rg", + "type": "message", + "role": "assistant", + "model": "claude-3-5-sonnet-20241022", + "content": [ + { + "type": "text", + "text": "I'll help create this custom browser website with your requirements.\n\n---domain---\nbrowserview.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://browserview.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Custom Browser Builder - React Native WebView Browser Creator\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n<header>\n <nav>\n <div class=\"logo\">BrowserView</div>\n <div class=\"nav-links\">\n <a href=\"#features\">Features</a>\n <a href=\"#implementation\">Implementation</a>\n <a href=\"#components\">Components</a>\n <a href=\"#demo\">Demo</a>\n </div>\n <button class=\"theme-toggle\" aria-label=\"Toggle dark mode\">🌓</button>\n </nav>\n</header>\n\n<main>\n <section class=\"hero\">\n <h1>Build Your Custom Browser</h1>\n <p>Create a powerful mobile browser using React Native WebView</p>\n <div class=\"browser-preview\">\n <div class=\"browser-frame\">\n <div class=\"browser-controls\">\n <div class=\"control-buttons\">\n <button aria-label=\"Back\">←</button>\n <button aria-label=\"Forward\">→</button>\n <button aria-label=\"Refresh\">↻</button>\n </div>\n <input type=\"text\" class=\"url-bar\" placeholder=\"Enter URL...\">\n <button class=\"bookmark-btn\" aria-label=\"Bookmark\">★</button>\n </div>\n <div class=\"browser-content\">\n <div class=\"loading-bar\"></div>\n <div class=\"tab-container\">\n <div class=\"tab active\">Home</div>\n <div class=\"tab\">New Tab</div>\n <button class=\"new-tab-btn\">+</button>\n </div>\n <div class=\"webpage-view\"></div>\n </div>\n </div>\n </div>\n </section>\n\n <section id=\"features\">\n <h2>Key Features</h2>\n <div class=\"feature-grid\">\n <div class=\"feature-card\">\n <h3>Web Rendering</h3>\n <p>Full HTML5, CSS3, and JavaScript support</p>\n </div>\n <div class=\"feature-card\">\n <h3>Tab Management</h3>\n <p>Multiple tabs with smooth switching</p>\n </div>\n <div class=\"feature-card\">\n <h3>Bookmarking</h3>\n <p>Save and manage favorite sites</p>\n </div>\n <div class=\"feature-card\">\n <h3>Dark Mode</h3>\n <p>Toggle between light and dark themes</p>\n </div>\n </div>\n </section>\n\n <section id=\"implementation\">\n <h2>Technical Implementation</h2>\n <div class=\"code-preview\">\n <pre><code>// Sample WebView implementation\nimport { WebView } from 'react-native-webview';\n\nconst BrowserScreen = () => {\n return (\n &lt;WebView\n source={{ uri: 'https://example.com' }}\n style={{ flex: 1 }}\n /&gt;\n );\n}</code></pre>\n </div>\n </section>\n</main>\n\n<footer>\n <div class=\"footer-content\">\n <div class=\"footer-section\">\n <h4>Documentation</h4>\n <a href=\"#setup\">Setup Guide</a>\n <a href=\"#api\">API Reference</a>\n </div>\n <div class=\"footer-section\">\n <h4>Resources</h4>\n <a href=\"#examples\">Examples</a>\n <a href=\"#tutorials\">Tutorials</a>\n </div>\n </div>\n</footer>\n\n---style.css---\n:root {\n --primary: #2563eb;\n --secondary: #3b82f6;\n --background: #ffffff;\n --text: #1f2937;\n --card-bg: #f3f4f6;\n --accent: #dbeafe;\n --transition: all 0.3s ease;\n}\n\n[data-theme=\"dark\"] {\n --primary: #3b82f6;\n --secondary: #60a5fa;\n --background: #111827;\n --text: #f3f4f6;\n --card-bg: #1f2937;\n --accent: #1e3a8a;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: system-ui, -apple-system, sans-serif;\n background: var(--background);\n color: var(--text);\n line-height: 1.6;\n transition: var(--transition);\n}\n\nheader {\n position: fixed;\n width: 100%;\n top: 0;\n z-index: 100;\n background: var(--background);\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n}\n\nnav {\n max-width: 1200px;\n margin: 0 auto;\n padding: 1rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.logo {\n font-size: 1.5rem;\n font-weight: bold;\n color: var(--primary);\n}\n\n.nav-links a {\n margin-left: 2rem;\n text-decoration: none;\n color: var(--text);\n transition: var(--transition);\n}\n\n.nav-links a:hover {\n color: var(--primary);\n}\n\n.theme-toggle {\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n padding: 0.5rem;\n border-radius: 50%;\n transition: var(--transition);\n}\n\n.theme-toggle:hover {\n background: var(--accent);\n}\n\nmain {\n margin-top: 4rem;\n padding: 2rem;\n}\n\n.hero {\n text-align: center;\n padding: 4rem 0;\n}\n\nh1 {\n font-size: 3rem;\n margin-bottom: 1rem;\n background: linear-gradient(45deg, var(--primary), var(--secondary));\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n}\n\n.browser-preview {\n max-width: 900px;\n margin: 3rem auto;\n padding: 1rem;\n}\n\n.browser-frame {\n background: var(--card-bg);\n border-radius: 1rem;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0,0,0,0.1);\n}\n\n.browser-controls {\n display: flex;\n padding: 1rem;\n gap: 1rem;\n background: var(--accent);\n}\n\n.control-buttons button {\n background: none;\n border: none;\n padding: 0.5rem;\n cursor: pointer;\n border-radius: 50%;\n transition: var(--transition);\n}\n\n.url-bar {\n flex: 1;\n padding: 0.5rem 1rem;\n border: none;\n border-radius: 2rem;\n background: var(--background);\n color: var(--text);\n}\n\n.feature-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n gap: 2rem;\n padding: 2rem 0;\n}\n\n.feature-card {\n background: var(--card-bg);\n padding: 2rem;\n border-radius: 1rem;\n transition: var(--transition);\n}\n\n.feature-card:hover {\n transform: translateY(-5px);\n box-shadow: 0 10px 20px rgba(0,0,0,0.1);\n}\n\n.code-preview {\n background: var(--card-bg);\n padding: 2rem;\n border-radius: 1rem;\n overflow-x: auto;\n}\n\ncode {\n font-family: 'Monaco', monospace;\n color: var(--primary);\n}\n\nfooter {\n background: var(--card-bg);\n padding: 3rem 0;\n margin-top: 4rem;\n}\n\n.footer-content {\n max-width: 1200px;\n margin: 0 auto;\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n gap: 2rem;\n padding: 0 2rem;\n}\n\n@media (max-width: 768px) {\n .nav-links {\n display: none;\n }\n \n h1 {\n font-size: 2rem;\n }\n \n .browser-preview {\n padding: 0.5rem;\n }\n \n .footer-content {\n grid-template-columns: 1fr;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n // Theme Toggle\n const themeToggle = document.querySelector('.theme-toggle');\n const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');\n \n function setTheme(isDark) {\n document.documentElement.setAttribute('data-theme', isDark ? 'dark' : 'light');\n themeToggle.textContent = isDark ? '☀️' : '🌓';\n }\n \n setTheme(prefersDark.matches);\n \n themeToggle.addEventListener('click', () => {\n const isDark = document.documentElement.getAttribute('data-theme') === 'dark';\n setTheme(!isDark);\n });\n\n // Browser Preview Animation\n const loadingBar = document.querySelector('.loading-bar');\n \n function simulateLoading() {\n loadingBar.style.width = '0%';\n loadingBar.style.opacity = '1';\n \n let progress = 0;\n const interval = setInterval(() => {\n progress += Math.random() * 30;\n if (progress > 100) {\n progress = 100;\n setTimeout(() => {\n loadingBar.style.opacity = '0';\n clearInterval(interval);\n }, 200);\n }\n loadingBar.style.width = `${progress}%`;\n }, 200);\n }\n\n // URL Bar Functionality\n const urlBar = document.querySelector('.url-bar');\n urlBar.addEventListener('keypress', (e) => {\n if (e.key === 'Enter') {\n simulateLoading();\n }\n });\n\n // Tab Management\n const newTabBtn = document.querySelector('.new-tab-btn');\n const tabContainer = document.querySelector('.tab-container');\n \n newTabBtn.addEventListener('click', () => {\n const tab = document.createElement('div');\n tab.className = 'tab';\n tab.textContent = 'New Tab';\n tabContainer.insertBefore(tab, newTabBtn);\n });\n});\n\n---end---" + } + ], + "stop_reason": "end_turn", + "stop_sequence": null, + "usage": { + "input_tokens": 1123, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 0, + "output_tokens": 2871 + } +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..79aade4 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# browserview.scroll.pub +Website generated by Claude from prompt: Build a Custom Browser Using React Native WebView ## Overview Develop a custom web browser application using React Native. The browser should leverage the `react-native-webview` library to load web pages and include additional functionality to improve user experience. --- ## Key Features ### 1. Web Page Rendering - Use the `react-native-webview` component to load and render web pages. - Ensure full support for HTML5, CSS3, and JavaScript. ### 2. Navigation Controls - Include buttons for basic navigation: - **Back**: Navigate to the previous page. - **Forward**: Navigate to the next page. - **Refresh**: Reload the current page. - **Stop**: Stop loading the current page. ### 3. URL Bar - Add a text input field for users to enter URLs: - Support autocomplete for popular domains (e.g., `.com`, `.org`, `.net`). - Automatically prepend `https://` if the user does not include it. ### 4. Tabs (Optional but Recommended) - Implement a simple tab system: - Allow users to open multiple web pages simultaneously. - Use a swipeable or clickable interface to switch between tabs. ### 5. Bookmarking - Add a "Bookmark" button to save favorite URLs locally. - Display a list of saved bookmarks with options to: - Open the bookmarked page. - Edit bookmarks (e.g., rename or update the URL). - Remove bookmarks. ### 6. Loading Indicator - Show a progress bar or spinner while pages are loading. ### 7. Error Handling - Display a user-friendly error page if a website fails to load. ### 8. Full-Screen Mode - Allow users to toggle full-screen mode for a more immersive experience. ### 9. Dark Mode - Include a setting for switching between light and dark themes. ### 10. Security and Permissions - Manage WebView permissions for: - Camera and microphone access. - Geolocation. - File uploads/downloads. ### 11. File Downloads - Enable file downloads with a confirmation dialog. ### 12. Offline Support - Cache static resources for offline access to recently visited pages. --- ## Technical Implementation ### React Native Packages 1. **WebView**: Use `react-native-webview` for rendering web content. 2. **AsyncStorage**: Store user data such as bookmarks and preferences. 3. **react-navigation**: For managing navigation between tabs and settings screens. 4. **react-native-gesture-handler**: Enhance touch interactions for features like swiping between tabs. 5. **react-native-community/netinfo**: Detect network connectivity to display offline errors. --- ## Components ### 1. BrowserScreen - Includes: - `WebView` component. - Navigation controls (Back, Forward, Refresh, Stop). - URL bar. ### 2. TabManager - Handles: - Creating, closing, and switching between tabs. ### 3. SettingsScreen - Allows users to: - Toggle Dark Mode. - Manage permissions. - View app version and additional info. ### 4. BookmarkScreen - Displays a list of saved bookmarks. - Allows users to: - Open, edit, or delete bookmarks. --- ## UI/UX Considerations - Ensure a **responsive design** for compatibility with various device sizes. - Use **native-like transitions** for smooth navigation. - Add **tooltips** or hints to guide first-time users. --- ## Deliverables 1. A fully functional React Native WebView-based browser app. 2. Support for Android and iOS platforms. 3. Well-documented source code with comments. 4. A basic README explaining app setup and usage. \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..f4a86b8 --- /dev/null +++ b/script.js @@ -0,0 +1,57 @@ +document.addEventListener('DOMContentLoaded', () => { + // Theme Toggle + const themeToggle = document.querySelector('.theme-toggle'); + const prefersDark = window.matchMedia('(prefers-color-scheme: dark)'); + + function setTheme(isDark) { + document.documentElement.setAttribute('data-theme', isDark ? 'dark' : 'light'); + themeToggle.textContent = isDark ? '☀️' : '🌓'; + } + + setTheme(prefersDark.matches); + + themeToggle.addEventListener('click', () => { + const isDark = document.documentElement.getAttribute('data-theme') === 'dark'; + setTheme(!isDark); + }); + + // Browser Preview Animation + const loadingBar = document.querySelector('.loading-bar'); + + function simulateLoading() { + loadingBar.style.width = '0%'; + loadingBar.style.opacity = '1'; + + let progress = 0; + const interval = setInterval(() => { + progress += Math.random() * 30; + if (progress > 100) { + progress = 100; + setTimeout(() => { + loadingBar.style.opacity = '0'; + clearInterval(interval); + }, 200); + } + loadingBar.style.width = `${progress}%`; + }, 200); + } + + // URL Bar Functionality + const urlBar = document.querySelector('.url-bar'); + urlBar.addEventListener('keypress', (e) => { + if (e.key === 'Enter') { + simulateLoading(); + } + }); + + // Tab Management + const newTabBtn = document.querySelector('.new-tab-btn'); + const tabContainer = document.querySelector('.tab-container'); + + newTabBtn.addEventListener('click', () => { + const tab = document.createElement('div'); + tab.className = 'tab'; + tab.textContent = 'New Tab'; + tabContainer.insertBefore(tab, newTabBtn); + }); +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..e688fe8 --- /dev/null +++ b/style.css @@ -0,0 +1,201 @@ +:root { + --primary: #2563eb; + --secondary: #3b82f6; + --background: #ffffff; + --text: #1f2937; + --card-bg: #f3f4f6; + --accent: #dbeafe; + --transition: all 0.3s ease; +} + +[data-theme="dark"] { + --primary: #3b82f6; + --secondary: #60a5fa; + --background: #111827; + --text: #f3f4f6; + --card-bg: #1f2937; + --accent: #1e3a8a; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: system-ui, -apple-system, sans-serif; + background: var(--background); + color: var(--text); + line-height: 1.6; + transition: var(--transition); +} + +header { + position: fixed; + width: 100%; + top: 0; + z-index: 100; + background: var(--background); + box-shadow: 0 2px 10px rgba(0,0,0,0.1); +} + +nav { + max-width: 1200px; + margin: 0 auto; + padding: 1rem; + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + font-size: 1.5rem; + font-weight: bold; + color: var(--primary); +} + +.nav-links a { + margin-left: 2rem; + text-decoration: none; + color: var(--text); + transition: var(--transition); +} + +.nav-links a:hover { + color: var(--primary); +} + +.theme-toggle { + background: none; + border: none; + font-size: 1.5rem; + cursor: pointer; + padding: 0.5rem; + border-radius: 50%; + transition: var(--transition); +} + +.theme-toggle:hover { + background: var(--accent); +} + +main { + margin-top: 4rem; + padding: 2rem; +} + +.hero { + text-align: center; + padding: 4rem 0; +} + +h1 { + font-size: 3rem; + margin-bottom: 1rem; + background: linear-gradient(45deg, var(--primary), var(--secondary)); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +.browser-preview { + max-width: 900px; + margin: 3rem auto; + padding: 1rem; +} + +.browser-frame { + background: var(--card-bg); + border-radius: 1rem; + overflow: hidden; + box-shadow: 0 4px 20px rgba(0,0,0,0.1); +} + +.browser-controls { + display: flex; + padding: 1rem; + gap: 1rem; + background: var(--accent); +} + +.control-buttons button { + background: none; + border: none; + padding: 0.5rem; + cursor: pointer; + border-radius: 50%; + transition: var(--transition); +} + +.url-bar { + flex: 1; + padding: 0.5rem 1rem; + border: none; + border-radius: 2rem; + background: var(--background); + color: var(--text); +} + +.feature-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); + gap: 2rem; + padding: 2rem 0; +} + +.feature-card { + background: var(--card-bg); + padding: 2rem; + border-radius: 1rem; + transition: var(--transition); +} + +.feature-card:hover { + transform: translateY(-5px); + box-shadow: 0 10px 20px rgba(0,0,0,0.1); +} + +.code-preview { + background: var(--card-bg); + padding: 2rem; + border-radius: 1rem; + overflow-x: auto; +} + +code { + font-family: 'Monaco', monospace; + color: var(--primary); +} + +footer { + background: var(--card-bg); + padding: 3rem 0; + margin-top: 4rem; +} + +.footer-content { + max-width: 1200px; + margin: 0 auto; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 2rem; + padding: 0 2rem; +} + +@media (max-width: 768px) { + .nav-links { + display: none; + } + + h1 { + font-size: 2rem; + } + + .browser-preview { + padding: 0.5rem; + } + + .footer-content { + grid-template-columns: 1fr; + } +}