jekyll-theme-zer0 0.22.0 → 0.22.19

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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +236 -0
  3. data/README.md +66 -19
  4. data/_data/navigation/admin.yml +53 -0
  5. data/_data/theme_backgrounds.yml +121 -0
  6. data/_includes/components/admin-tabs.html +59 -0
  7. data/_includes/components/analytics-dashboard.html +232 -0
  8. data/_includes/components/background-customizer.html +159 -0
  9. data/_includes/components/background-settings.html +137 -0
  10. data/_includes/components/collection-manager.html +151 -0
  11. data/_includes/components/component-showcase.html +452 -0
  12. data/_includes/components/config-editor.html +207 -0
  13. data/_includes/components/config-viewer.html +479 -0
  14. data/_includes/components/env-dashboard.html +154 -0
  15. data/_includes/components/feature-card.html +94 -0
  16. data/_includes/components/info-section.html +172 -149
  17. data/_includes/components/js-cdn.html +4 -1
  18. data/_includes/components/nav-editor.html +99 -0
  19. data/_includes/components/setup-banner.html +28 -0
  20. data/_includes/components/setup-check.html +53 -0
  21. data/_includes/components/svg-background.html +42 -0
  22. data/_includes/components/theme-customizer.html +46 -0
  23. data/_includes/content/seo.html +68 -135
  24. data/_includes/core/footer.html +1 -1
  25. data/_includes/core/head.html +3 -2
  26. data/_includes/core/header.html +14 -7
  27. data/_includes/landing/landing-install-cards.html +18 -7
  28. data/_includes/navigation/admin-nav.html +95 -0
  29. data/_includes/navigation/navbar.html +43 -5
  30. data/_includes/navigation/sidebar-left.html +1 -1
  31. data/_includes/setup/wizard.html +330 -0
  32. data/_layouts/admin.html +166 -0
  33. data/_layouts/landing.html +23 -9
  34. data/_layouts/root.html +12 -6
  35. data/_layouts/setup.html +73 -0
  36. data/_plugins/preview_image_generator.rb +26 -12
  37. data/_sass/core/_navbar.scss +2 -2
  38. data/_sass/custom.scss +28 -6
  39. data/_sass/theme/_background-mixins.scss +95 -0
  40. data/_sass/theme/_backgrounds.scss +156 -0
  41. data/_sass/theme/_color-modes.scss +2 -1
  42. data/assets/backgrounds/gradients/air.svg +15 -0
  43. data/assets/backgrounds/gradients/aqua.svg +15 -0
  44. data/assets/backgrounds/gradients/contrast.svg +15 -0
  45. data/assets/backgrounds/gradients/dark.svg +15 -0
  46. data/assets/backgrounds/gradients/dirt.svg +15 -0
  47. data/assets/backgrounds/gradients/mint.svg +15 -0
  48. data/assets/backgrounds/gradients/neon.svg +15 -0
  49. data/assets/backgrounds/gradients/plum.svg +15 -0
  50. data/assets/backgrounds/gradients/sunrise.svg +15 -0
  51. data/assets/backgrounds/noise/air.svg +8 -0
  52. data/assets/backgrounds/noise/aqua.svg +8 -0
  53. data/assets/backgrounds/noise/contrast.svg +8 -0
  54. data/assets/backgrounds/noise/dark.svg +8 -0
  55. data/assets/backgrounds/noise/dirt.svg +8 -0
  56. data/assets/backgrounds/noise/mint.svg +8 -0
  57. data/assets/backgrounds/noise/neon.svg +8 -0
  58. data/assets/backgrounds/noise/plum.svg +8 -0
  59. data/assets/backgrounds/noise/sunrise.svg +8 -0
  60. data/assets/backgrounds/patterns/air.svg +7 -0
  61. data/assets/backgrounds/patterns/aqua.svg +7 -0
  62. data/assets/backgrounds/patterns/contrast.svg +4 -0
  63. data/assets/backgrounds/patterns/dark.svg +5 -0
  64. data/assets/backgrounds/patterns/dirt.svg +5 -0
  65. data/assets/backgrounds/patterns/mint.svg +6 -0
  66. data/assets/backgrounds/patterns/neon.svg +6 -0
  67. data/assets/backgrounds/patterns/plum.svg +6 -0
  68. data/assets/backgrounds/patterns/sunrise.svg +5 -0
  69. data/assets/js/background-customizer.js +73 -0
  70. data/assets/js/code-copy.js +18 -47
  71. data/assets/js/config-utility.js +307 -0
  72. data/assets/js/nav-editor.js +39 -0
  73. data/assets/js/palette-generator.js +415 -0
  74. data/assets/js/search-modal.js +31 -11
  75. data/assets/js/setup-wizard.js +306 -0
  76. data/assets/js/skin-editor.js +645 -0
  77. data/assets/js/theme-customizer.js +102 -0
  78. data/assets/js/ui-enhancements.js +15 -24
  79. data/assets/vendor/bootstrap/css/bootstrap.min.css +1 -0
  80. data/assets/vendor/bootstrap/js/bootstrap.bundle.min.js +1 -0
  81. data/scripts/README.md +45 -0
  82. data/scripts/features/generate-preview-images +297 -7
  83. data/scripts/features/install-preview-generator +51 -33
  84. data/scripts/fork-cleanup.sh +92 -19
  85. data/scripts/github-setup.sh +284 -0
  86. data/scripts/init_setup.sh +0 -1
  87. data/scripts/lib/frontmatter.sh +543 -0
  88. data/scripts/lib/migrate.sh +265 -0
  89. data/scripts/lib/preview_generator.py +607 -32
  90. data/scripts/lint-pages +505 -0
  91. data/scripts/migrate.sh +201 -0
  92. data/scripts/platform/setup-linux.sh +244 -0
  93. data/scripts/platform/setup-macos.sh +187 -0
  94. data/scripts/platform/setup-wsl.sh +196 -0
  95. metadata +71 -6
@@ -0,0 +1,265 @@
1
+ #!/bin/bash
2
+
3
+ # =========================================================================
4
+ # Migration Library for Zer0-Mistakes Theme
5
+ # =========================================================================
6
+ # Provides functions for migrating / installing optional theme features
7
+ # (admin pages, settings UI, etc.) into consumer Jekyll sites.
8
+ #
9
+ # Source this file in other scripts:
10
+ # source "$(dirname "$0")/lib/migrate.sh"
11
+ #
12
+ # Dependencies:
13
+ # - common.sh (logging, dry_run_exec, confirm)
14
+ # - template.sh (render_template, load_config)
15
+ # =========================================================================
16
+
17
+ # Admin page template names (without .md.template suffix)
18
+ ADMIN_PAGES=(
19
+ theme
20
+ config
21
+ navigation
22
+ collections
23
+ analytics
24
+ environment
25
+ )
26
+
27
+ # Default admin pages output directory (relative to site root)
28
+ ADMIN_OUTPUT_DIR="pages/_about/settings"
29
+
30
+ # -------------------------------------------------------------------------
31
+ # Detection & Validation
32
+ # -------------------------------------------------------------------------
33
+
34
+ # Detect whether a directory looks like a Jekyll site
35
+ # Usage: detect_jekyll_site "/path/to/site"
36
+ # Returns 0 if it looks like a Jekyll site, 1 otherwise
37
+ detect_jekyll_site() {
38
+ local site_dir="${1:-.}"
39
+
40
+ if [[ ! -f "$site_dir/_config.yml" ]]; then
41
+ debug "No _config.yml found in $site_dir"
42
+ return 1
43
+ fi
44
+
45
+ # Extra confidence checks (any one is enough)
46
+ if [[ -f "$site_dir/Gemfile" ]] || [[ -d "$site_dir/_layouts" ]] || [[ -d "$site_dir/_includes" ]] || [[ -d "$site_dir/pages" ]]; then
47
+ debug "Detected Jekyll site at $site_dir"
48
+ return 0
49
+ fi
50
+
51
+ debug "Directory has _config.yml but doesn't look like a Jekyll site: $site_dir"
52
+ return 1
53
+ }
54
+
55
+ # Check whether the target site uses the zer0-mistakes theme
56
+ # Usage: validate_theme_connection "/path/to/site"
57
+ # Returns 0 if connected, 1 otherwise. Sets THEME_CONNECTION_TYPE.
58
+ validate_theme_connection() {
59
+ local site_dir="${1:-.}"
60
+ local config="$site_dir/_config.yml"
61
+ THEME_CONNECTION_TYPE=""
62
+
63
+ if [[ ! -f "$config" ]]; then
64
+ return 1
65
+ fi
66
+
67
+ # Check remote_theme
68
+ if grep -qE 'remote_theme:\s*"?bamr87/zer0-mistakes' "$config" 2>/dev/null; then
69
+ THEME_CONNECTION_TYPE="remote"
70
+ debug "Theme connection: remote_theme"
71
+ return 0
72
+ fi
73
+
74
+ # Check gem theme
75
+ if grep -qE 'theme:\s*"?jekyll-theme-zer0' "$config" 2>/dev/null; then
76
+ THEME_CONNECTION_TYPE="gem"
77
+ debug "Theme connection: gem theme"
78
+ return 0
79
+ fi
80
+
81
+ # Check Gemfile for local path
82
+ if [[ -f "$site_dir/Gemfile" ]]; then
83
+ if grep -qE 'jekyll-theme-zer0.*path:' "$site_dir/Gemfile" 2>/dev/null; then
84
+ THEME_CONNECTION_TYPE="local"
85
+ debug "Theme connection: local path gem"
86
+ return 0
87
+ fi
88
+ if grep -q 'jekyll-theme-zer0' "$site_dir/Gemfile" 2>/dev/null; then
89
+ THEME_CONNECTION_TYPE="gem"
90
+ debug "Theme connection: Gemfile gem"
91
+ return 0
92
+ fi
93
+ fi
94
+
95
+ debug "No zer0-mistakes theme connection found"
96
+ return 1
97
+ }
98
+
99
+ # -------------------------------------------------------------------------
100
+ # Admin Page Installation
101
+ # -------------------------------------------------------------------------
102
+
103
+ # Install admin pages from templates into a target site
104
+ # Usage: install_admin_pages "/path/to/site" [--force]
105
+ # Requires TEMPLATES_DIR to be set and config loaded
106
+ install_admin_pages() {
107
+ local site_dir="${1:-.}"
108
+ local force="${2:-false}"
109
+ local output_dir="$site_dir/$ADMIN_OUTPUT_DIR"
110
+ local installed=0
111
+ local skipped=0
112
+
113
+ step "Installing admin pages to $output_dir"
114
+
115
+ # Ensure templates directory is available
116
+ local admin_templates_dir=""
117
+ if [[ -n "${TEMPLATES_DIR:-}" ]] && [[ -d "$TEMPLATES_DIR/pages/admin" ]]; then
118
+ admin_templates_dir="$TEMPLATES_DIR/pages/admin"
119
+ else
120
+ # Try to find it
121
+ local found_dir
122
+ if found_dir=$(find_templates_dir "${BASH_SOURCE[0]}" 2>/dev/null); then
123
+ admin_templates_dir="$found_dir/pages/admin"
124
+ TEMPLATES_DIR="$found_dir"
125
+ fi
126
+ fi
127
+
128
+ if [[ -z "$admin_templates_dir" ]] || [[ ! -d "$admin_templates_dir" ]]; then
129
+ error "Admin templates directory not found. Ensure TEMPLATES_DIR is set or run from the theme repo."
130
+ return 1
131
+ fi
132
+
133
+ # Ensure config is loaded for template rendering
134
+ if [[ -z "${CURRENT_DATE:-}" ]]; then
135
+ load_config 2>/dev/null || true
136
+ export CURRENT_DATE="${CURRENT_DATE:-$(date +%Y-%m-%d)}"
137
+ fi
138
+
139
+ # Create output directory
140
+ dry_run_exec "Create $output_dir" mkdir -p "$output_dir"
141
+
142
+ local page template_file output_file
143
+ for page in "${ADMIN_PAGES[@]}"; do
144
+ template_file="$admin_templates_dir/${page}.md.template"
145
+ output_file="$output_dir/${page}.md"
146
+
147
+ if [[ ! -f "$template_file" ]]; then
148
+ warn "Template not found: $template_file — skipping"
149
+ ((skipped++))
150
+ continue
151
+ fi
152
+
153
+ if [[ -f "$output_file" ]] && [[ "$force" != "true" ]]; then
154
+ info "Already exists (use --force to overwrite): $output_file"
155
+ ((skipped++))
156
+ continue
157
+ fi
158
+
159
+ dry_run_exec "Render ${page}.md" render_template "$template_file" "$output_file"
160
+ ((installed++))
161
+ debug "Installed: $output_file"
162
+ done
163
+
164
+ if [[ "$installed" -gt 0 ]]; then
165
+ success "Installed $installed admin page(s) ($skipped skipped)"
166
+ else
167
+ info "No new admin pages installed ($skipped skipped)"
168
+ fi
169
+
170
+ return 0
171
+ }
172
+
173
+ # -------------------------------------------------------------------------
174
+ # Verification
175
+ # -------------------------------------------------------------------------
176
+
177
+ # Verify that admin pages are installed and have required front matter
178
+ # Usage: verify_admin_pages "/path/to/site"
179
+ # Returns 0 if all pages are valid, 1 otherwise
180
+ verify_admin_pages() {
181
+ local site_dir="${1:-.}"
182
+ local output_dir="$site_dir/$ADMIN_OUTPUT_DIR"
183
+ local errors=0
184
+ local total=0
185
+
186
+ step "Verifying admin pages in $output_dir"
187
+
188
+ if [[ ! -d "$output_dir" ]]; then
189
+ warn "Admin pages directory does not exist: $output_dir"
190
+ return 1
191
+ fi
192
+
193
+ local page page_file
194
+ for page in "${ADMIN_PAGES[@]}"; do
195
+ page_file="$output_dir/${page}.md"
196
+ ((total++))
197
+
198
+ if [[ ! -f "$page_file" ]]; then
199
+ warn "Missing: $page_file"
200
+ ((errors++))
201
+ continue
202
+ fi
203
+
204
+ # Check required front matter fields
205
+ if ! grep -q 'layout: admin' "$page_file" 2>/dev/null; then
206
+ warn "Missing 'layout: admin' in $page_file"
207
+ ((errors++))
208
+ continue
209
+ fi
210
+
211
+ if ! grep -q 'permalink:' "$page_file" 2>/dev/null; then
212
+ warn "Missing 'permalink' in $page_file"
213
+ ((errors++))
214
+ continue
215
+ fi
216
+
217
+ debug "Verified: $page_file"
218
+ done
219
+
220
+ if [[ "$errors" -eq 0 ]]; then
221
+ success "All $total admin pages verified"
222
+ return 0
223
+ else
224
+ warn "$errors of $total admin page(s) have issues"
225
+ return 1
226
+ fi
227
+ }
228
+
229
+ # -------------------------------------------------------------------------
230
+ # Version Detection
231
+ # -------------------------------------------------------------------------
232
+
233
+ # Detect the installed theme version and warn if admin features may be missing
234
+ # Usage: detect_version_gap "/path/to/site"
235
+ detect_version_gap() {
236
+ local site_dir="${1:-.}"
237
+ local gemfile_lock="$site_dir/Gemfile.lock"
238
+ local min_admin_version="0.22.10"
239
+
240
+ if [[ ! -f "$gemfile_lock" ]]; then
241
+ debug "No Gemfile.lock found — cannot check theme version"
242
+ return 0
243
+ fi
244
+
245
+ local installed_version
246
+ installed_version=$(grep -A1 'jekyll-theme-zer0' "$gemfile_lock" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
247
+
248
+ if [[ -z "$installed_version" ]]; then
249
+ debug "Could not determine installed theme version"
250
+ return 0
251
+ fi
252
+
253
+ info "Installed theme version: $installed_version"
254
+
255
+ # Simple version comparison (works for same-major versions)
256
+ if [[ "$(printf '%s\n' "$min_admin_version" "$installed_version" | sort -V | head -1)" != "$min_admin_version" ]]; then
257
+ warn "Theme version $installed_version may not include admin layout/includes."
258
+ warn "Admin pages require version >= $min_admin_version."
259
+ warn "Consider updating: bundle update jekyll-theme-zer0"
260
+ return 1
261
+ fi
262
+
263
+ debug "Theme version $installed_version >= $min_admin_version — admin features supported"
264
+ return 0
265
+ }