Skip to content

Commit 84659a7

Browse files
committed
Removes view style management and adds payment badge
Eliminates complex style tag cleanup and injection logic from the SPA router renderer to simplify view rendering and prevent potential style conflicts. Adds crypto payment badge to module documentation for donation support.
1 parent 379013c commit 84659a7

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

public/js/modules/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ProFullStack Modules
22

3+
[![Crypto Payment](https://paybadge.profullstack.com/badge.svg)](https://paybadge.profullstack.com/?tickers=btc%2Ceth%2Csol%2Cusdc)
4+
35
This repository contains modular components extracted from the ProFullStack boilerplate application. These modules can be used independently in other projects.
46

57
## Available Modules

public/js/modules/spa-router/src/renderer.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -105,44 +105,6 @@ export function createRenderer(options = {}) {
105105
}
106106
}
107107

108-
// Clean up previous view styles to prevent accumulation
109-
const previousViewStyles = document.head.querySelectorAll('style[data-view-style]');
110-
previousViewStyles.forEach(style => {
111-
try {
112-
const styleId = style.getAttribute('data-view-style-id');
113-
style.remove();
114-
console.log(`Removed previous view style: ${styleId}`);
115-
} catch (error) {
116-
console.warn('Error removing view style:', error);
117-
}
118-
});
119-
120-
// Extract and process style tags from both head and body sections
121-
// Views might have style tags at the root level or in the body
122-
const headStyleTags = Array.from(doc.head.querySelectorAll('style'));
123-
const bodyStyleTags = Array.from(doc.body.querySelectorAll('style'));
124-
const allStyleTags = [...headStyleTags, ...bodyStyleTags];
125-
126-
console.log(`Found ${allStyleTags.length} style tags in view (${headStyleTags.length} in head, ${bodyStyleTags.length} in body)`);
127-
128-
// Process style tags from the view
129-
allStyleTags.forEach((styleTag, index) => {
130-
const styleId = `view-style-${Date.now()}-${index}`;
131-
const newStyle = document.createElement('style');
132-
newStyle.textContent = styleTag.textContent;
133-
newStyle.setAttribute('data-view-style', 'true');
134-
newStyle.setAttribute('data-view-style-id', styleId);
135-
136-
// Add to document head
137-
document.head.appendChild(newStyle);
138-
console.log(`Added view style tag: ${styleId} with content: ${styleTag.textContent.substring(0, 100)}...`);
139-
140-
// Remove the style tag from the original location to prevent duplication
141-
if (styleTag.parentNode) {
142-
styleTag.parentNode.removeChild(styleTag);
143-
}
144-
});
145-
146108
// Get all existing web components in the current DOM to preserve
147109
const existingComponents = {};
148110
const customElements = element.querySelectorAll('*').filter(el => el.tagName.includes('-'));

0 commit comments

Comments
 (0)