|
1 | | -# GitHub Workflows & Automation |
| 1 | +# 🚀 JSON Viewer Component for Blazor |
2 | 2 |
|
3 | | -This directory contains all GitHub Actions workflows and automation configurations for JsonViewer.Blazor. |
| 3 | +<div align="center"> |
4 | 4 |
|
5 | | -## 📁 Directory Structure |
| 5 | + |
6 | 6 |
|
| 7 | +A powerful, feature-rich JSON viewer component for Blazor applications with VS Code-style syntax highlighting. |
| 8 | + |
| 9 | +[](https://www.nuget.org/packages/JsonViewer.Blazor/) |
| 10 | +[](https://www.nuget.org/packages/JsonViewer.Blazor/) |
| 11 | +[](https://github.com/JsonViewer-Component/Blazor) |
| 12 | +[](https://github.com/JsonViewer-Component/Blazor/blob/main/LICENSE) |
| 13 | + |
| 14 | +[Demo](https://jsonviewer-component.github.io/Blazor/) | [Documentation](https://github.com/JsonViewer-Component/Blazor#readme) | [Report Bug](https://github.com/JsonViewer-Component/Blazor/issues) | [Request Feature](https://github.com/JsonViewer-Component/Blazor/issues) |
| 15 | + |
| 16 | +</div> |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## ✨ Features |
| 21 | + |
| 22 | +- 🎨 **VS Code-style** syntax highlighting |
| 23 | +- 🌓 **Dark & Light** theme support with persistence |
| 24 | +- 🔍 **Real-time search** with match highlighting and navigation |
| 25 | +- 📊 **JSON statistics** (size, depth, type distribution) |
| 26 | +- 📝 **Edit mode** with auto-formatting and validation |
| 27 | +- 📋 **Copy & Export** functionality |
| 28 | +- ⌨️ **Keyboard shortcuts** (Enter, Shift+Enter for search navigation) |
| 29 | +- 🔢 **Line numbers** with active line highlighting |
| 30 | +- 🎯 **Expand/Collapse** individual or all nodes |
| 31 | +- 📱 **Fully responsive** design for mobile, tablet, and desktop |
| 32 | +- ⚡ **High performance** - handles large JSON files efficiently |
| 33 | +- 🎭 **Smooth animations** and transitions |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## 📦 Installation |
| 38 | + |
| 39 | +Install via NuGet Package Manager: |
| 40 | +```bash |
| 41 | +dotnet add package JsonViewer.Blazor |
7 | 42 | ``` |
8 | | -.github/ |
9 | | -├── workflows/ # CI/CD workflows |
10 | | -│ ├── build.yml # Build & test on PR/push |
11 | | -│ ├── deploy-pages.yml # Deploy demo to GitHub Pages |
12 | | -│ ├── nuget-publish.yml # Publish to NuGet |
13 | | -│ ├── codeql.yml # Security analysis |
14 | | -│ ├── labeler.yml # Auto-label PRs |
15 | | -│ ├── greet-new-contributors.yml |
16 | | -│ └── stale.yml # Mark stale issues |
17 | | -├── ISSUE_TEMPLATE/ # Issue templates |
18 | | -│ ├── bug_report.yml |
19 | | -│ ├── feature_request.yml |
20 | | -│ ├── question.yml |
21 | | -│ └── config.yml |
22 | | -├── DISCUSSION_TEMPLATE/ # Discussion templates |
23 | | -│ └── ideas.yml |
24 | | -├── PULL_REQUEST_TEMPLATE.md |
25 | | -├── FUNDING.yml # Sponsor configuration |
26 | | -├── dependabot.yml # Dependency updates |
27 | | -└── labeler.yml # Label configuration |
| 43 | +Or via Package Manager Console: |
| 44 | + |
| 45 | +```powershell |
| 46 | +Install-Package JsonViewer.Blazor |
28 | 47 | ``` |
| 48 | +--- |
29 | 49 |
|
30 | | -## 🔄 Workflows |
31 | | - |
32 | | -### Build & Test (`build.yml`) |
33 | | -- **Trigger**: Push to main/develop, Pull requests |
34 | | -- **Actions**: |
35 | | - - Restore dependencies |
36 | | - - Build solution |
37 | | - - Run tests |
38 | | - - Code coverage |
39 | | - - Format check |
40 | | - - Code analysis |
41 | | - |
42 | | -### Deploy GitHub Pages (`deploy-pages.yml`) |
43 | | -- **Trigger**: Push to main, Manual |
44 | | -- **Actions**: |
45 | | - - Build Blazor WASM |
46 | | - - Configure base path |
47 | | - - Deploy to GitHub Pages |
48 | | - |
49 | | -### Publish to NuGet (`nuget-publish.yml`) |
50 | | -- **Trigger**: Release published, Manual |
51 | | -- **Actions**: |
52 | | - - Build & test |
53 | | - - Create NuGet package |
54 | | - - Publish to NuGet.org |
55 | | - |
56 | | -### CodeQL Security (`codeql.yml`) |
57 | | -- **Trigger**: Push, PR, Weekly schedule |
58 | | -- **Actions**: |
59 | | - - Security analysis |
60 | | - - Vulnerability scanning |
61 | | - - Code quality checks |
62 | | - |
63 | | -### Auto Labeler (`labeler.yml`) |
64 | | -- **Trigger**: Pull request |
65 | | -- **Actions**: |
66 | | - - Auto-label based on file changes |
67 | | - |
68 | | -### Greet Contributors (`greet-new-contributors.yml`) |
69 | | -- **Trigger**: First issue/PR |
70 | | -- **Actions**: |
71 | | - - Welcome message |
72 | | - - Helpful resources |
73 | | - |
74 | | -### Stale Management (`stale.yml`) |
75 | | -- **Trigger**: Daily schedule |
76 | | -- **Actions**: |
77 | | - - Mark stale issues/PRs |
78 | | - - Close inactive items |
79 | | - |
80 | | -## 🔐 Secrets Required |
81 | | - |
82 | | -The following secrets need to be configured in repository settings: |
83 | | - |
84 | | -- `NUGET_API_KEY` - For publishing to NuGet.org |
85 | | - |
86 | | -## 🏷️ Labels |
87 | | - |
88 | | -Labels are automatically applied based on: |
89 | | -- File changes (component, demo, docs, etc.) |
90 | | -- Issue/PR type (bug, feature, question) |
91 | | -- Status (stale, in-progress, etc.) |
92 | | - |
93 | | -## 📋 Issue & PR Templates |
94 | | - |
95 | | -### Issue Templates |
96 | | -- **Bug Report**: Detailed bug reporting with environment info |
97 | | -- **Feature Request**: Feature suggestions with priority |
98 | | -- **Question**: Ask questions about usage |
99 | | - |
100 | | -### Pull Request Template |
101 | | -- Comprehensive checklist |
102 | | -- Code quality requirements |
103 | | -- Testing requirements |
104 | | -- Documentation requirements |
| 50 | +## 🚀 Quick Start |
105 | 51 |
|
106 | | -## 🤝 Contributing |
| 52 | +### 1️⃣ Add namespace to `_Imports.razor`: |
| 53 | + |
| 54 | +```razor |
| 55 | +@using JsonViewerComponent |
| 56 | +@using JsonViewerComponent.Components |
| 57 | +``` |
| 58 | +### 2️⃣ Use in your component: |
| 59 | + |
| 60 | +```razor |
| 61 | +@page "/json-demo" |
| 62 | +
|
| 63 | +<JsonViewer JsonData="@jsonString" IsEditable="true" /> |
| 64 | +
|
| 65 | +@code { |
| 66 | +private string jsonString = @"{ |
| 67 | +""name"": ""John Doe"", |
| 68 | +""age"": 30, |
| 69 | + |
| 70 | +""hobbies"": [""reading"", ""gaming"", ""coding""] |
| 71 | +}"; |
| 72 | +} |
| 73 | +``` |
| 74 | +--- |
107 | 75 |
|
108 | | -See the main [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. |
| 76 | +## 📖 Usage Examples |
109 | 77 |
|
110 | | -## 🔄 Workflow Badges |
| 78 | +### Read-Only Mode |
111 | 79 |
|
112 | | -Add these to your README: |
| 80 | +```razor |
| 81 | +<JsonViewer JsonData="@jsonData" IsEditable="false" /> |
| 82 | +``` |
| 83 | +### Editable Mode with Two-Way Binding |
| 84 | + |
| 85 | +```razor |
| 86 | +<JsonViewer @bind-JsonData="jsonData" IsEditable="true" /> |
113 | 87 |
|
114 | | -```markdown |
115 | | -[](https://github.com/JsonViewer-Component/Blazor/actions/workflows/build.yml) |
116 | | -[](https://github.com/JsonViewer-Component/Blazor/actions/workflows/deploy-pages.yml) |
117 | | -[](https://github.com/JsonViewer-Component/Blazor/actions/workflows/codeql.yml) |
| 88 | +@code { |
| 89 | +private string jsonData = "{}"; |
| 90 | +} |
118 | 91 | ``` |
| 92 | +### Dynamic JSON Loading |
| 93 | + |
| 94 | +```razor |
| 95 | +<button @onclick="LoadSampleData">Load Sample</button> |
| 96 | +<JsonViewer JsonData="@jsonData" IsEditable="true" /> |
| 97 | +
|
| 98 | +@code { |
| 99 | +private string jsonData = ""; |
| 100 | +
|
| 101 | +private void LoadSampleData() |
| 102 | +{ |
| 103 | +jsonData = @"{""userId"": 1, ""userName"": ""Alice""}"; |
| 104 | +} |
| 105 | +} |
| 106 | +``` |
| 107 | +--- |
| 108 | + |
| 109 | +## ⌨️ Keyboard Shortcuts |
| 110 | + |
| 111 | +| Shortcut | Action | |
| 112 | +|----------|--------| |
| 113 | +| `Enter` | Navigate to next search match | |
| 114 | +| `Shift + Enter` | Navigate to previous search match | |
| 115 | +| `Escape` | Clear search (when search is active) | |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 🎨 Theme Support |
| 120 | + |
| 121 | +The component automatically saves your theme preference to localStorage: |
| 122 | + |
| 123 | +```razor |
| 124 | +@* Theme persists across page refreshes *@ |
| 125 | +<JsonViewer JsonData="@jsonData" IsEditable="true" /> |
| 126 | +``` |
| 127 | +--- |
| 128 | + |
| 129 | +## 📊 JSON Statistics |
| 130 | + |
| 131 | +View detailed statistics about your JSON: |
| 132 | + |
| 133 | +- **Total Size** (bytes) |
| 134 | +- **Total Properties** |
| 135 | +- **Object Count** |
| 136 | +- **Array Count** |
| 137 | +- **Max Depth** |
| 138 | +- **Average Array Length** |
| 139 | + |
| 140 | +Access statistics via the stats button in the sidebar. |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## 🔍 Search Features |
| 145 | + |
| 146 | +- **Real-time highlighting** of all matches |
| 147 | +- **Match counter** showing current match / total matches |
| 148 | +- **Navigation buttons** to jump between matches |
| 149 | +- **Keyboard support** for quick navigation |
| 150 | +- **Case-insensitive** search |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +## 🛠️ Configuration |
| 155 | + |
| 156 | +Currently, the component works out-of-the-box with minimal configuration. Future versions will support: |
| 157 | + |
| 158 | +- Custom themes |
| 159 | +- Plugin system |
| 160 | +- Additional export formats |
| 161 | +- And more! |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## 🤝 Contributing |
| 166 | + |
| 167 | +We welcome contributions! Here's how you can help: |
| 168 | + |
| 169 | +1. Fork the repository |
| 170 | +2. Create a feature branch (`git checkout -b feature/amazing-feature`) |
| 171 | +3. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 172 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 173 | +5. Open a Pull Request |
| 174 | + |
| 175 | +Please read our [Contributing Guide](https://github.com/JsonViewer-Component/Blazor/blob/main/CONTRIBUTING.md) for more details. |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +## 🐛 Bug Reports & Feature Requests |
| 180 | + |
| 181 | +Found a bug or have an idea? Please open an issue: |
| 182 | + |
| 183 | +- [Report a Bug](https://github.com/JsonViewer-Component/Blazor/issues/new?labels=bug) |
| 184 | +- [Request a Feature](https://github.com/JsonViewer-Component/Blazor/issues/new?labels=enhancement) |
| 185 | + |
| 186 | +--- |
| 187 | + |
| 188 | +## 📜 License |
| 189 | + |
| 190 | +This project is licensed under the MIT License - see the [LICENSE](https://github.com/JsonViewer-Component/Blazor/blob/main/LICENSE) file for details. |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## 💖 Support |
| 195 | + |
| 196 | +If you find this project helpful, please consider: |
| 197 | + |
| 198 | +- ⭐ **Starring** the repository |
| 199 | +- 🐛 **Reporting bugs** or **suggesting features** |
| 200 | +- 📢 **Sharing** with others |
| 201 | +- ☕ **Sponsoring** the project |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +## 👨💻 Author |
| 206 | + |
| 207 | +**Parsa Panahpoor** |
| 208 | + |
| 209 | +- GitHub: [@parsapanahpoor](https://github.com/parsapanahpoor) |
| 210 | +- Website: [Your Website](https://your-website.com) |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## 🌟 Acknowledgments |
| 215 | + |
| 216 | +Special thanks to all contributors and the Blazor community! |
| 217 | + |
| 218 | +--- |
| 219 | + |
| 220 | +<div align="center"> |
| 221 | + |
| 222 | +Made with ❤️ by [JsonViewer Component](https://github.com/JsonViewer-Component) |
119 | 223 |
|
120 | | -## 📞 Support |
| 224 | +</div> |
121 | 225 |
|
122 | | -If you have questions about workflows or need help with automation: |
123 | | -- 💬 [GitHub Discussions](https://github.com/JsonViewer-Component/Blazor/discussions) |
124 | | - |
125 | 226 |
|
| 227 | +--- |
0 commit comments