ultimate-jekyll-manager 0.0.116 → 0.0.118

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.
package/CLAUDE.md CHANGED
@@ -1,41 +1,54 @@
1
- # Identity
2
- This is Ultimate Jekyll, it is a template project that other "consuming" projects can use to build a Jekyll site. It comes installed as an NPM module and is helpful for setting up, configuring, and maintaining a Jekyll site with best practices in mind.
1
+ # Ultimate Jekyll Manager
3
2
 
4
- It is not a stand-alone project, but rather a collection of components that can be used to build a Jekyll site quickly and efficiently.
5
- * You cannot use `npm start` or `npm run build` in this project.
3
+ ## Project Overview
6
4
 
7
- ## Structure
8
- Ultimate Jekll has the following structure:
9
- src/gulp/tasks = Gulp tasks that are used to build the Jekyll site.
10
- src/defaults/src = Default source files that can be used as a starting point for a Jekyll site and ARE meant to be edited by the user. They are copied to the consuming project's "src" directory.
11
- src/defaults/dist = Default distribution files that can be used as a starting point for a Jekyll site and NOT meant to be edited by the user. They are copied to the consuming project's "dist" directory.
5
+ Ultimate Jekyll Manager is a template framework that consuming projects install as an NPM module to build Jekyll sites quickly and efficiently. It provides best-practice configurations, default components, themes, and build tools.
12
6
 
13
- The "consuming" project has the following structure:
14
- "src" = Compiled to "dist" with npm
15
- "dist" = Compiled to "_site" with Jekyll.
7
+ **Important:** This is NOT a standalone project. You cannot run `npm start` or `npm run build` directly in this repository.
8
+
9
+ ## Project Structure
10
+
11
+ ### Directory Organization
12
+ - `src/gulp/tasks` - Gulp tasks for building Jekyll sites
13
+ - `src/defaults/src` - Default source files (editable by users, copied to consuming project's `src/`)
14
+ - `src/defaults/dist` - Default distribution files (not editable by users, copied to consuming project's `dist/`)
15
+ - `src/assets/css` - Stylesheets (global, pages, themes)
16
+ - `src/assets/js` - JavaScript modules (core, pages, libraries)
17
+ - `src/assets/themes` - Theme SCSS and JS files
18
+
19
+ ### Consuming Project Structure
20
+ - `src/` - Compiled to `dist/` via npm
21
+ - `dist/` - Compiled to `_site/` via Jekyll
16
22
 
17
23
  ## Local Development
18
- When working with a consuming project, the local development server URL can be found in the `.temp/_config_browsersync.yml` file in the consuming project's root directory. You should read this file to determine the correct local URL for browsing and testing the site.
19
24
 
20
- ## Other Ultimate Jekyll Components:
21
- src/assets/css/ultimate-jekyll-manager.scss = Main stylesheet used by Ultimate Jekyll to style the site
22
- src/assets/css/global = Global styles that are used by Ultimate Jekyll
23
- src/assets/css/pages = Page-specific styles that are used by Ultimate Jekyll
24
- * If you are making a page, put the styles in this directory like so: `src/assets/css/pages/[page-name]/index.scss`
25
+ The local development server URL is stored in `.temp/_config_browsersync.yml` in the consuming project's root directory. Read this file to determine the correct URL for browsing and testing.
26
+
27
+ ## Asset Organization
28
+
29
+ ### CSS Architecture
30
+ - `src/assets/css/ultimate-jekyll-manager.scss` - Main UJ stylesheet
31
+ - `src/assets/css/main.scss` - Site-wide styles (runs on every page)
32
+ - `src/assets/css/global/` - Global UJ styles
33
+ - `src/assets/css/pages/` - Page-specific styles
34
+ - Format: `src/assets/css/pages/[page-name]/index.scss`
35
+
36
+ ### JavaScript Architecture
37
+ - `src/assets/js/ultimate-jekyll-manager.js` - Main UJ JavaScript entry point
38
+ - `src/assets/js/main.js` - Site-wide JavaScript (runs on every page)
39
+ - `src/assets/js/core/` - Core UJ modules
40
+ - `src/assets/js/pages/` - Page-specific JavaScript
41
+ - Format: `src/assets/js/pages/[page-name]/index.js`
25
42
 
26
- src/assets/css/main.scss
27
- * This file runs on EVERY page and should be edited to contain site-wide CSS styles.
43
+ **Asset Loading:** Page-specific CSS/JS files are automatically included based on the page's canonical path. Override with `asset_path` frontmatter.
28
44
 
45
+ ### Page Module Structure
29
46
 
30
- src/assets/js/ultimate-jekyll-manager.js = Main JavaScript file used by Ultimate Jekyll to manage the site
31
- src/assets/js/pages = Page-specific JavaScript files that are used by Ultimate Jekyll
32
- * If you are making a page, put the JavaScript in this directory like so: `src/assets/js/pages/[page-name]/index.js`
33
- * The page-specific JS and CSS files are automatically included in the page based on the page's canonical path.
34
- * You need to use our standardized structure:
35
- * Notice how how the helpers are outside the main export function.
36
- ```js
47
+ All page modules must follow this standardized pattern:
48
+
49
+ ```javascript
37
50
  /**
38
- * XXX Page JavaScript
51
+ * [Page Name] Page JavaScript
39
52
  */
40
53
 
41
54
  // Libraries
@@ -50,7 +63,7 @@ export default (Manager) => {
50
63
  // Initialize when DOM is ready
51
64
  await webManager.dom().ready();
52
65
 
53
- // We just need to pause videos when switching tabs for better UX
66
+ // Page initialization logic
54
67
  helper1();
55
68
 
56
69
  // Resolve after initialization
@@ -60,155 +73,334 @@ export default (Manager) => {
60
73
 
61
74
  // Helper functions
62
75
  function helper1() {
63
- // ...
76
+ // Helper implementation
64
77
  }
65
78
  ```
66
79
 
67
- /src/assets/js/main.js
68
- * This file runs on EVERY page and should be edited to contain site-wide JavaScript functionality.
80
+ **Key Points:**
81
+ - Helpers are defined outside the main export function
82
+ - Use `webManager` shortcuts for common operations
83
+ - Always wait for DOM ready before manipulating elements
84
+
85
+ ## Layouts and Pages
86
+
87
+ ### Page Types
88
+ - **One-off pages** (e.g., `/categories`, `/sitemap`) - Create as pages without custom layouts; use existing layouts
89
+ - **Repeating page types** (e.g., blog posts, category pages) - Create a dedicated layout (e.g., `_layouts/category.html`)
90
+
91
+ ### Layout Requirements
92
+ All layouts and pages must eventually require a theme entry point:
93
+ ```yaml
94
+ layout: themes/[ site.theme.id ]/frontend/core/base
95
+ ```
96
+
97
+ **Note:** The `[ site.theme.id ]` syntax is correct and allows dynamic theme selection.
98
+
99
+ ### Asset Path Configuration
100
+
101
+ For pages sharing the same assets, use the `asset_path` frontmatter variable:
102
+
103
+ ```yaml
104
+ ---
105
+ # Instead of deriving path from page.canonical.path
106
+ asset_path: categories/category
107
+ ---
108
+ ```
109
+
110
+ **Example:**
111
+ - One-off page: `pages/categories.html` → `src/assets/css/pages/categories/index.scss`
112
+ - Repeating layout: `_layouts/category.html` → `src/assets/css/pages/categories/category.scss` (set `asset_path: categories/category` in layout frontmatter)
113
+
114
+ ## UJ Powertools (Jekyll Plugin)
115
+
116
+ Ultimate Jekyll uses the `jekyll-uj-powertools` gem for custom Liquid functionality.
117
+
118
+ **Documentation:** `/Users/ian/Developer/Repositories/ITW-Creative-works/jekyll-uj-powertools/README.md`
119
+
120
+ ### Available Features
121
+ - **Filters:** `uj_strip_ads`, `uj_json_escape`, `uj_title_case`, `uj_content_format`
122
+ - **Tags:** `iftruthy`, `iffalsy`, `uj_icon`, `uj_logo`, `uj_image`, `uj_member`, `uj_post`, `uj_readtime`, `uj_social`, `uj_translation_url`, `uj_fake_comments`, `uj_language`
123
+ - **Global Variables:** `site.uj.cache_breaker`
124
+ - **Page Variables:** `page.random_id`, `page.extension`, `page.layout_data`, `page.resolved`
125
+
126
+ **Always check the README before assuming functionality.**
127
+
128
+ ### Key Liquid Functions
129
+
130
+ #### `uj_content_format`
131
+ Formats content by first liquifying it, then markdownifying it (if markdown file).
132
+
133
+ #### `iftruthy` / `iffalsy`
134
+ Custom tags that check JavaScript truthiness (not null, undefined, or empty string).
135
+
136
+ ```liquid
137
+ {% iftruthy variable %}
138
+ <!-- Content -->
139
+ {% endiftruthy %}
140
+ ```
141
+
142
+ **Limitations:**
143
+ - Does NOT support logical operators
144
+ - Does NOT support `else` statements
145
+ - CAN contain nested sub-statements
146
+
147
+ #### `page.resolved`
148
+ A deeply merged object containing all site, layout, and page variables. Precedence: page > layout > site. Enables a system of defaults with progressive overrides.
149
+
150
+ #### `uj_icon`
151
+ Inserts Font Awesome icons:
152
+
153
+ ```liquid
154
+ {% uj_icon icon-name, "fa-md" %}
155
+ {% uj_icon "rocket", "fa-3xl" %}
156
+ ```
157
+
158
+ **Parameters:**
159
+ 1. Icon name (string or variable, without "fa-" prefix)
160
+ 2. CSS classes (optional, defaults to "fa-3xl")
161
+
162
+ #### `asset_path` Override
163
+ Override default page-specific CSS/JS path derivation:
164
+
165
+ ```yaml
166
+ ---
167
+ asset_path: blog/post
168
+ ---
169
+ ```
170
+
171
+ Uses `/assets/css/pages/{{ asset_path }}.bundle.css` instead of deriving from `page.canonical.path`. Useful when multiple pages share assets (e.g., all blog posts).
172
+
173
+ ## Icon Pre-rendering System
174
+
175
+ Ultimate Jekyll includes a frontmatter-based icon pre-rendering system for optimal performance.
176
+
177
+ ### How It Works
178
+
179
+ 1. **Define icons in page frontmatter:**
180
+ ```yaml
181
+ ---
182
+ prerender_icons:
183
+ - name: "apple"
184
+ class: "fa-3xl"
185
+ - name: "android"
186
+ class: "fa-2xl"
187
+ - name: "chrome"
188
+ ---
189
+ ```
190
+
191
+ 2. **Icons are rendered in HTML** via `src/defaults/dist/_includes/core/body.html`
192
+
193
+ 3. **Access icons in JavaScript:**
194
+ ```javascript
195
+ const iconHTML = webManager.utilities().getPrerenderedIcon('apple');
196
+ ```
197
+
198
+ ### Benefits
199
+ - Icons are rendered server-side with proper Font Awesome classes
200
+ - No client-side icon generation overhead
201
+ - Consistent icon styling across the application
202
+ - Easy to access via JavaScript utilities
203
+
204
+ ## CSS Guidelines
69
205
 
70
- src/assets/themes = Theme scss and js files that are can be picked and used by the consuming project.
206
+ ### Theme-Adaptive Classes
71
207
 
72
- ## UJ Powertools
73
- Ultimate Jekyll uses the `jekyll-uj-powertools` gem which provides many custom Liquid filters, tags, and variables. You should review the full documentation to understand all available tools: `/Users/ian/Developer/Repositories/ITW-Creative-works/jekyll-uj-powertools/README.md`
208
+ **DO NOT USE:** `bg-light`, `bg-dark`, `text-light`, `text-dark`
74
209
 
75
- Key features include:
76
- * **Filters**: `uj_strip_ads`, `uj_json_escape`, `uj_title_case`, `uj_content_format`
77
- * **Tags**: `iftruthy`, `iffalsy`, `uj_icon`, `uj_logo`, `uj_image`, `uj_member`, `uj_post`, `uj_readtime`, `uj_social`, `uj_translation_url`, `uj_fake_comments`, `uj_language`
78
- * **Global Variables**: `site.uj.cache_breaker`
79
- * **Page Variables**: `page.random_id`, `page.extension`, `page.layout_data`, `page.resolved`
210
+ Ultimate Jekyll supports both light and dark modes. Use adaptive classes instead:
80
211
 
81
- ALWAYS check the README before assuming a filter or tag exists or how it works.
212
+ **Backgrounds:**
213
+ - `bg-body` - Primary background
214
+ - `bg-body-secondary` - Secondary background
215
+ - `bg-body-tertiary` - Tertiary background
82
216
 
83
- ## SOME SPECIAL LIQUID FUNCTIONS:
84
- * uj_content_format = A custom liquid filter that formats the content like so: first, it LIQUIFIES the content, then, if it's a markdown file, it runs MARKDOWNIFY.
85
- * iftruthy = a custom liquid tag that checks if a variable is truthy in JavaScript terms, meaning it checks if the variable is not null, undefined, or an empty string. Use it like this: `{% iftruthy variable %}`. But it DOES NOT SUPPORT any logical operators and does not support `else` statements. But you CAN put sub-statements inside it.
86
- * iffalsy = same but opposite of iftruthy.
87
- * page.resolved = a custom page object property of all site, layout, and page variables deeply merged together, with page variables taking precedence over layout, and layout variables taking precedence over site variables. This allows a system of site defaults, layout overrides, and page-specific overrides.
217
+ **Text:**
218
+ - `text-body` - Body text color
88
219
 
89
- ### Specifics:
90
- * {% uj_icon icon-name, "fa-md" %} = Custom tag for inserting fontawesome icons. "icon-name" can be a string or a variable. If its a string, put it in quotes like "rocket" (dont include "fa-")
91
- * Set `asset_path: path/to/asset` for layouts or pages to override the default page-specific CSS/JS path. When set, it uses `/assets/css/pages/{{ asset_path }}.bundle.css` instead of deriving the path from `page.canonical.path`. Useful when multiple pages share the same assets like all blog posts using `asset_path: blog/post`.
220
+ **Buttons:**
221
+ - `btn-adaptive` - Adaptive button
222
+ - `btn-outline-adaptive` - Adaptive outline button
92
223
 
93
- ## Layouts and Pages in Consuming Projects
94
- When creating pages in the consuming project, follow these guidelines:
95
- * **One-off pages** (like `/categories`, `/sitemap`, etc.) should be created directly as pages (e.g., `pages/categories.html`) WITHOUT their own custom layout. These pages should use an existing layout.
96
- * **Repeating page types** (like individual category pages, individual blog posts, etc.) should have a dedicated layout that all instances use (e.g., `_layouts/category.html` used by all category pages).
97
- * **All layouts and pages** must eventually require one of the theme entry points, such as `layout: themes/[ site.theme.id ]/frontend/core/base`. This ensures consistent theming across the site.
98
- * YES, the "[[ site.theme.id ]]" syntax is correct here; it allows dynamic selection of the theme based on site configuration.
99
- * This approach keeps the codebase maintainable by reusing layouts for similar pages while avoiding unnecessary layout files for unique pages.
100
- * So you should put assets like CSS and JS for a one-off page like `categories.html` in `src/assets/css/pages/categories/index.scss` and `src/assets/js/pages/categories/index.js` respectively, and for repeating page types like an individual category that uses a LAYOUT, put them in `src/assets/css/pages/categories/category.scss` and `src/assets/js/pages/categories/category.js` (and you will of course set the `asset_path: categories/category` frontmatter variable on the layout so that the correct assets are loaded).
224
+ These classes automatically adapt to the current theme mode.
101
225
 
102
- ## CSS
103
- DO NOT USE `bg-light`, `bg-dark`, `text-light`, or `text-dark`. We support BOTH light and dark mode, so instead use `bg-body`, `bg-body-secondary`, `bg-body-tertiary`, `text-body` and for buttons you can use `btn-adaptive` or `btn-outline-adaptive`.
104
- These classes adapt to light and dark mode automatically.
226
+ ## Page Loading Protection System
105
227
 
106
- ## Page Loading State & Button Protection
107
- Ultimate Jekyll implements a sophisticated system to prevent premature button clicks during page initialization. This prevents race conditions and ensures JavaScript is fully loaded before users can trigger actions.
228
+ Ultimate Jekyll prevents race conditions by disabling buttons during JavaScript initialization.
108
229
 
109
- ### How It Works:
110
- 1. **Initial State**: The HTML element starts with `data-page-loading="true"` and `aria-busy="true"` attributes (set in `src/defaults/dist/_layouts/core/root.html`)
111
- 2. **Protection During Load**: While `data-page-loading` is present, certain elements are automatically disabled via CSS and JavaScript
112
- 3. **Ready State**: When JavaScript initialization completes, these attributes are removed by `src/assets/js/core/complete.js`
230
+ ### How It Works
231
+ 1. HTML element starts with `data-page-loading="true"` and `aria-busy="true"` (`src/defaults/dist/_layouts/core/root.html`)
232
+ 2. Protected elements are automatically disabled during this state
233
+ 3. Attributes are removed when JavaScript completes (`src/assets/js/core/complete.js`)
113
234
 
114
- ### What Gets Protected:
115
- When `data-page-loading` is active, the following elements are automatically protected from clicks:
235
+ ### Protected Elements
236
+ - All form buttons (`<button>`, `<input type="submit">`, `<input type="button">`, `<input type="reset">`)
237
+ - Elements with `.btn` class (Bootstrap buttons)
238
+ - Elements with `.btn-action` class (custom action triggers)
116
239
 
117
- - **All form buttons**: `<button>`, `<input type="submit">`, `<input type="button">`, `<input type="reset">`
118
- - **Elements with `.btn` class**: Standard Bootstrap buttons
119
- - **Elements with `.btn-action` class**: Custom action triggers (see below)
120
- - **Always disabled**: Any element with `disabled` attribute, `.disabled` class, or `:disabled` state
240
+ ### The `.btn-action` Class
121
241
 
122
- ### The `.btn-action` Class:
123
- Use the `.btn-action` class to selectively protect non-standard elements that trigger important actions:
242
+ Selectively protect non-standard elements that trigger important actions:
124
243
 
125
244
  ```html
126
- <!-- These will be protected during page load -->
245
+ <!-- Protected during page load -->
127
246
  <a href="/api/delete" class="custom-link btn-action">Delete Item</a>
128
247
  <div class="card-action btn-action" onclick="processData()">Process</div>
129
- <span class="text-link btn-action" data-action="save">Save Changes</span>
130
248
 
131
- <!-- These will NOT be protected (regular navigation/UI) -->
249
+ <!-- NOT protected (regular navigation/UI) -->
132
250
  <a href="/about" class="btn btn-primary">About Us</a>
133
251
  <button data-bs-toggle="modal">Show Info</button>
134
- <button data-bs-toggle="collapse">Toggle Details</button>
135
252
  ```
136
253
 
137
- ### When to Use `.btn-action`:
138
- - **Use it for**: API calls, form submissions, data modifications, payment processing, destructive actions
139
- - **Don't use it for**: Navigation links, UI toggles, modals, accordions, tabs, harmless interactions
254
+ **Use `.btn-action` for:**
255
+ - API calls
256
+ - Form submissions
257
+ - Data modifications
258
+ - Payment processing
259
+ - Destructive actions
140
260
 
141
- ### Implementation Files:
142
- - **CSS Styles**: `src/assets/css/core/utilities.scss` - Applies `cursor: not-allowed` and disabled styling
143
- - **Click Prevention**: `src/defaults/dist/_includes/core/body.html` - Inline script that prevents clicks
144
- - **State Removal**: `src/assets/js/core/complete.js` - Removes `data-page-loading` when ready
261
+ **Don't use for:**
262
+ - Navigation links
263
+ - UI toggles (modals, accordions, tabs)
264
+ - Harmless interactions
145
265
 
146
- This system ensures a smooth, error-free user experience by preventing premature interactions while maintaining full flexibility for developers.
266
+ ### Implementation
267
+ - **CSS:** `src/assets/css/core/utilities.scss` - Disabled styling
268
+ - **Click Prevention:** `src/defaults/dist/_includes/core/body.html` - Inline script
269
+ - **State Removal:** `src/assets/js/core/complete.js` - Removes loading state
147
270
 
148
- ## Lazy Loading
149
- Ultimate Jekyll uses a custom lazy loading system powered by web-manager. Elements can be lazy-loaded using the `data-lazy` attribute with the following format:
271
+ ## Lazy Loading System
150
272
 
273
+ Ultimate Jekyll uses a custom lazy loading system powered by web-manager.
274
+
275
+ ### Syntax
151
276
  ```html
152
277
  data-lazy="@type value"
153
278
  ```
154
279
 
155
- ### Supported Types:
156
- * `@src` - Lazy load the `src` attribute (for images, iframes, videos, source elements)
157
- ```html
158
- <img data-lazy="@src /assets/images/hero.jpg" alt="Hero">
159
- <iframe data-lazy="@src https://example.com/embed"></iframe>
160
- ```
280
+ ### Supported Types
161
281
 
162
- * `@srcset` - Lazy load the `srcset` attribute (for responsive images)
163
- ```html
164
- <img data-lazy="@srcset /img/small.jpg 480w, /img/large.jpg 1024w">
165
- ```
282
+ #### `@src` - Lazy load src attribute
283
+ ```html
284
+ <img data-lazy="@src /assets/images/hero.jpg" alt="Hero">
285
+ <iframe data-lazy="@src https://example.com/embed"></iframe>
286
+ ```
166
287
 
167
- * `@bg` - Lazy load background images via `background-image` CSS
168
- ```html
169
- <div data-lazy="@bg /assets/images/background.jpg"></div>
170
- ```
288
+ #### `@srcset` - Lazy load srcset attribute
289
+ ```html
290
+ <img data-lazy="@srcset /img/small.jpg 480w, /img/large.jpg 1024w">
291
+ ```
171
292
 
172
- * `@class` - Lazy add CSS classes when element comes into view (useful for animations)
173
- ```html
174
- <div data-lazy="@class animation-fade-in">Content</div>
175
- ```
293
+ #### `@bg` - Lazy load background images
294
+ ```html
295
+ <div data-lazy="@bg /assets/images/background.jpg"></div>
296
+ ```
176
297
 
177
- * `@html` - Lazy inject HTML content
178
- ```html
179
- <div data-lazy="@html <p>Lazy loaded content</p>"></div>
180
- ```
298
+ #### `@class` - Lazy add CSS classes
299
+ ```html
300
+ <div data-lazy="@class animation-fade-in">Content</div>
301
+ ```
181
302
 
182
- * `@script` - Lazy load external scripts with JSON configuration
183
- ```html
184
- <div data-lazy='@script {"src": "https://example.com/widget.js", "attributes": {"async": true}}'></div>
185
- ```
303
+ #### `@html` - Lazy inject HTML content
304
+ ```html
305
+ <div data-lazy="@html <p>Lazy loaded content</p>"></div>
306
+ ```
186
307
 
187
- ### Features:
188
- * Automatically adds cache busters to URLs using `buildTime`
189
- * Uses IntersectionObserver for performance (starts loading 50px before element enters viewport)
190
- * Adds CSS classes during loading states: `lazy-loading`, `lazy-loaded`, `lazy-error`
191
- * Handles video/audio sources intelligently by observing the parent element
192
- * Automatically re-scans DOM for dynamically added elements
308
+ #### `@script` - Lazy load external scripts
309
+ ```html
310
+ <div data-lazy='@script {"src": "https://example.com/widget.js", "attributes": {"async": true}}'></div>
311
+ ```
312
+
313
+ ### Features
314
+ - Automatic cache busting via `buildTime`
315
+ - IntersectionObserver for performance (50px threshold)
316
+ - Loading state CSS classes: `lazy-loading`, `lazy-loaded`, `lazy-error`
317
+ - Intelligent handling of video/audio sources
318
+ - Automatic DOM re-scanning for dynamic elements
193
319
 
194
- See implementation: [src/assets/js/core/lazy-loading.js](src/assets/js/core/lazy-loading.js)
320
+ **Implementation:** `src/assets/js/core/lazy-loading.js`
195
321
 
196
- ## Libraries
197
- I have some library preferences that I want you to follow:
322
+ ## JavaScript Libraries
198
323
 
199
324
  ### WebManager
200
- We use a custom library called `web-manager` to manage various aspects of the site. Please make yourself familiar with it by reviewing it: `/Users/ian/Developer/Repositories/ITW-Creative-Works/web-manager/src`
201
- It offers various ultities like webManager.auth(), webManager.utilities(), webManager.sentry(), webManager.dom(). You should be using these utilities instead of writing your own code all the time.
202
- DO NOT JUST ASSUME THAT webManager has a function, though, you should CHECK THE SOURCE CODE to see what functions are available and how to use them or check the README: `/Users/ian/Developer/Repositories/ITW-Creative-Works/web-manager/README.md`
203
-
204
- ## FormManager
205
- We use a custom library called `form-manager` to manage forms on the site. Please make yourself familiar with it by reviewing it: `/Users/ian/Developer/Repositories/ITW-Creative-Works/ultimate-jekyll-manager/src/assets/js/libs/form-manager.js`
206
- * A good example of how to use it is the contact page
207
- * HTML: `/Users/ian/Developer/Repositories/ITW-Creative-Works/ultimate-jekyll-manager/src/defaults/dist/_layouts/themes/classy/frontend/pages/contact.html`
208
- * JS: `/Users/ian/Developer/Repositories/ITW-Creative-Works/ultimate-jekyll-manager/src/assets/js/pages/contact/index.js`
209
-
210
- ## Audits
211
- I may ask you to help me fix problems identified by the AUDIT TASK (@src/gulp/tasks/audit.js)
212
- * In that case, please LOOK AT THE AUDIT FILES (Which I will provide the location to) and help me fix the issues ONE BY ONE.
213
- * Make a TODO list for each category in the audit, then read the ENTIRE AUDIT file and make a plan for what items in that category need to be fixed.
214
- * Remember, these are BIG AUDIT FILES, so you will have to tackle them in parts. DO NOT TRY TO FIX EVERYTHING AT ONCE.
325
+
326
+ Custom library for site management functionality.
327
+
328
+ **Documentation:** `/Users/ian/Developer/Repositories/ITW-Creative-Works/web-manager/README.md`
329
+
330
+ **Available Utilities:**
331
+ - `webManager.auth()` - Authentication management
332
+ - `webManager.utilities()` - Utility functions
333
+ - `webManager.sentry()` - Error tracking
334
+ - `webManager.dom()` - DOM manipulation
335
+
336
+ **Important:** Always check the source code or README before assuming a function exists. Do not guess at API methods.
337
+
338
+ ### Ultimate Jekyll Libraries
339
+
340
+ Ultimate Jekyll provides helper libraries in `src/assets/js/libs/` that can be imported as needed.
341
+
342
+ #### Prerendered Icons Library
343
+
344
+ Provides access to icons defined in page frontmatter and rendered server-side.
345
+
346
+ **Import:**
347
+ ```javascript
348
+ import { getPrerenderedIcon } from '__main_assets__/js/libs/prerendered-icons.js';
349
+ ```
350
+
351
+ **Usage:**
352
+ ```javascript
353
+ const iconHTML = getPrerenderedIcon('apple');
354
+ ```
355
+
356
+ **Reference:** `src/assets/js/libs/prerendered-icons.js`
357
+
358
+ #### Authorized Fetch Library
359
+
360
+ Simplifies authenticated API requests by automatically adding Firebase authentication tokens via Authorization Bearer header.
361
+
362
+ **Import:**
363
+ ```javascript
364
+ import authorizedFetch from '__main_assets__/js/libs/authorized-fetch.js';
365
+ ```
366
+
367
+ **Usage:**
368
+ ```javascript
369
+ const response = await authorizedFetch(url, options);
370
+ ```
371
+
372
+ **Key Benefits:**
373
+ - No need to manually call `webManager.auth().getIdToken()`
374
+ - Automatic token injection as Authorization Bearer header
375
+ - Centralized authentication handling
376
+
377
+ **Reference:** `src/assets/js/libs/authorized-fetch.js`
378
+
379
+ #### FormManager Library
380
+
381
+ Form handling library with built-in state management and validation.
382
+
383
+ **Import:**
384
+ ```javascript
385
+ import { FormManager } from '__main_assets__/js/libs/form-manager.js';
386
+ ```
387
+
388
+ **Usage:**
389
+ ```javascript
390
+ const formManager = new FormManager('#my-form', options);
391
+ ```
392
+
393
+ **Reference:** `src/assets/js/libs/form-manager.js`
394
+ **Example:** `src/assets/js/pages/contact/index.js`
395
+
396
+ ## Audit Workflow
397
+
398
+ When fixing issues identified by the audit task (`src/gulp/tasks/audit.js`):
399
+
400
+ 1. Review the audit file location provided
401
+ 2. Create a TODO list for each audit category
402
+ 3. Read the ENTIRE audit file and plan fixes for each category
403
+ 4. Tackle issues incrementally - DO NOT attempt to fix everything at once
404
+ 5. Work through one category at a time
405
+
406
+ **Remember:** Audit files are large. Systematic, incremental fixes prevent errors and ensure thoroughness.
package/README.md CHANGED
@@ -282,6 +282,114 @@ Add the `.btn-action` class to protect custom elements that trigger important ac
282
282
  - `_test_trialEligible=false`: User is not eligible for trial
283
283
  * `_test_cardProcessor`: Force a specific payment processor for testing (e.g., `_test_cardProcessor=stripe` or `_test_cardProcessor=paypal`)
284
284
 
285
+ ## JavaScript API
286
+
287
+ ### Ultimate Jekyll Libraries
288
+
289
+ Ultimate Jekyll provides helper libraries in `src/assets/js/libs/` that can be imported as needed in your page modules.
290
+
291
+ #### Prerendered Icons Library
292
+
293
+ The prerendered icons library provides access to icons defined in page frontmatter. Icons are rendered server-side for optimal performance.
294
+
295
+ **Import:**
296
+ ```javascript
297
+ import { getPrerenderedIcon } from '__main_assets__/js/libs/prerendered-icons.js';
298
+ ```
299
+
300
+ **Function: `getPrerenderedIcon(iconName)`**
301
+
302
+ **Parameters:**
303
+ - `iconName` (string) - Name of the icon to retrieve (matches `data-icon` attribute in frontmatter)
304
+
305
+ **Returns:**
306
+ - (string) Icon HTML or empty string if not found
307
+
308
+ **Example:**
309
+ ```javascript
310
+ import { getPrerenderedIcon } from '__main_assets__/js/libs/prerendered-icons.js';
311
+
312
+ // Get a pre-rendered icon
313
+ const appleIcon = getPrerenderedIcon('apple');
314
+
315
+ // Use in your page
316
+ document.querySelector('.device-icon').innerHTML = appleIcon;
317
+ ```
318
+
319
+ **Setup:**
320
+ Define icons in your page frontmatter:
321
+ ```yaml
322
+ ---
323
+ prerender_icons:
324
+ - name: "apple"
325
+ class: "fa-3xl"
326
+ - name: "android"
327
+ class: "fa-2xl"
328
+ - name: "chrome"
329
+ class: "fa-lg"
330
+ ---
331
+ ```
332
+
333
+ Icons are automatically rendered in the page HTML and can be retrieved by importing the library function.
334
+
335
+ #### Authorized Fetch Library
336
+
337
+ The authorized fetch library simplifies authenticated API requests by automatically adding Firebase authentication tokens.
338
+
339
+ **Import:**
340
+ ```javascript
341
+ import authorizedFetch from '__main_assets__/js/libs/authorized-fetch.js';
342
+ ```
343
+
344
+ **Function: `authorizedFetch(url, options)`**
345
+
346
+ **Parameters:**
347
+ - `url` (string) - The API endpoint URL
348
+ - `options` (Object) - Request options for wonderful-fetch (method, body, timeout, etc.)
349
+
350
+ **Returns:**
351
+ - (Promise) - The response from the API
352
+
353
+ **Example:**
354
+ ```javascript
355
+ import authorizedFetch from '__main_assets__/js/libs/authorized-fetch.js';
356
+
357
+ // Make an authenticated API call
358
+ const response = await authorizedFetch(serverApiURL, {
359
+ method: 'POST',
360
+ timeout: 30000,
361
+ response: 'json',
362
+ tries: 2,
363
+ body: {
364
+ command: 'user:get-data',
365
+ payload: { id: 'example' }
366
+ }
367
+ });
368
+ ```
369
+
370
+ **How It Works:**
371
+ 1. Retrieves the current Firebase user's ID token automatically
372
+ 2. Adds the token to the request as an `Authorization: Bearer <token>` header
373
+ 3. Makes the request using wonderful-fetch
374
+ 4. Throws an error if no authenticated user is found
375
+
376
+ **Benefits:**
377
+ - No need to manually call `webManager.auth().getIdToken()`
378
+ - No need to add `authenticationToken` to request body
379
+ - Centralized authentication handling
380
+ - Consistent authentication across all API calls
381
+
382
+ #### FormManager Library
383
+
384
+ Custom library for form handling with built-in state management and validation.
385
+
386
+ **Import:**
387
+ ```javascript
388
+ import { FormManager } from '__main_assets__/js/libs/form-manager.js';
389
+ ```
390
+
391
+ **Documentation:** See [form-manager.js](src/assets/js/libs/form-manager.js) for full API and usage examples.
392
+
285
393
  ### Icons
286
394
  * Fontawesome
287
395
  * https://fontawesome.com/search
package/TODO.md CHANGED
@@ -34,7 +34,7 @@ MAKE COMPONENTS? ASK CLAUDE HOW AND IF ITS POSSIBLE
34
34
 
35
35
  FIX SIGNIN/SINGUP FORM
36
36
 
37
- https://192.168.86.69:4000/payment/checkout?product=premium&_test_trialEligible=true&_test_appId=dev&_test_cardProcessor=stripe
37
+ https://192.168.86.69:4000/payment/checkout?product=premium&_dev_trialEligible=true&_dev_appId=dev&_dev_cardProcessor=stripe
38
38
 
39
39
  filter-adaptive-inverse
40
40