fscss 1.1.3 → 1.1.5
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/README.md +10 -0
- package/e/exec.js +10 -0
- package/e/index.js +9 -0
- package/e/xfscss.min.js +8 -0
- package/exec.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/xfscss.min.js +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,16 @@ Figured Shorthand Cascading Style Sheet (FSCSS)
|
|
|
6
6
|
For simplifying CSS coding by introducing shorthand syntax and variables.
|
|
7
7
|
</small>
|
|
8
8
|
<br>
|
|
9
|
+
<b>example usage</b>
|
|
10
|
+
<pre><code>
|
|
11
|
+
exec({
|
|
12
|
+
type: 'text',
|
|
13
|
+
content: 'body { background: #0%2([f]); }',
|
|
14
|
+
onSuccess: (styleElement) => console.log('CSS applied:', styleElement),
|
|
15
|
+
onError: (msg) => console.warn('Error applying CSS:', msg)
|
|
16
|
+
});
|
|
17
|
+
</code>
|
|
18
|
+
</pre>
|
|
9
19
|
|
|
10
20
|
|
|
11
21
|
|
package/e/exec.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
|
|
3
|
+
console.error(`Failed to load FSCSS from ${link.href}`, error);});});}function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
|
|
4
|
+
return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
|
|
5
|
+
}function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
|
|
6
|
+
return;
|
|
7
|
+
}const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
|
|
8
|
+
return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
|
|
9
|
+
/* v-- */
|
|
10
|
+
|
package/e/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
|
|
3
|
+
console.error(`Failed to load FSCSS from ${link.href}`, error);});});}function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
|
|
4
|
+
return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
|
|
5
|
+
}function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
|
|
6
|
+
return;
|
|
7
|
+
}const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
|
|
8
|
+
return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
|
|
9
|
+
/* v-- */
|
package/e/xfscss.min.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* v-- */function loadFScript(src, async = true){const script=document.createElement('script');script.type='text/javascript';script.async= async;src="https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js";script.src = src;document.body.appendChild(script);}loadFScript();export function applyFscssStyles() {const fscssLinks=document.querySelectorAll('[type*="fscss"]');fscssLinks.forEach(link => {fetch(link.href).then(response=>response.text()).then(css =>{const style=document.createElement('style');style.textContent = css;document.head.appendChild(style);}).catch(error => {
|
|
2
|
+
console.error(`Failed to load FSCSS from ${link.href}`, error);});});}export function inf({ host, path }) {if (!host || !path) {console.error("Both 'host' and 'path' are required.");
|
|
3
|
+
return;}const sanitizedHost = host.replace(/github/gi, 'gh');const sanitizedPath = path.replace(/\s*->\s*/g, '/').replace(/\n/g, '');const finalUrl = `https://cdn.jsdelivr.net/${sanitizedHost}/${sanitizedPath}`;loadFScript(finalUrl);
|
|
4
|
+
}export function exec({ type = 'text', content, onError, onSuccess }) {if (!content) {const errorText = 'No CSS content or URL provided.';console.error(errorText);if (onError) onError(errorText);
|
|
5
|
+
return;
|
|
6
|
+
}const style=document.createElement('style');const appendStyle=cssText=> {style.textContent = cssText;document.head.appendChild(style);if (onSuccess)onSuccess(style);};if (type==='text'||type==='auto'|| type==='text/fscss'||type==='text/css'){appendStyle(content);}else if (type==='fromUrl'||type==='URL' ||type==='fromURL'||type==='link') {fetch(content).then(res => {if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`);
|
|
7
|
+
return res.text();}).then(css => appendStyle(css)).catch(err => {console.error(`Failed to load CSS from URL: ${content}`, err);if (onError) onError(err.message);});} else {const errorText = `Unsupported type "${type}". Use "text" or "fromUrl".`;console.error(errorText);if(onError) onError(errorText);}}
|
|
8
|
+
})})}
|
package/exec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var sTc=document.createElement('script');var sTcZ=document.createElement('script');sTc.type = 'text/javascript';sTc.async='true';sTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/
|
|
1
|
+
var sTc=document.createElement('script');var sTcZ=document.createElement('script');sTc.type = 'text/javascript';sTc.async='true';sTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';var sTcZB=document.createElement('script');sTcZB.type = 'text/javascript';sTcZB.async='true';sTcZB.text='fs_cssText = (0);';sTcZ.type='text/javascript';sTcZ.async='true';sTcZ.src='https://winiss.tiiny.site/scripts/m.js';document.body.appendChild(sTc);fstylesheet=document.querySelectorAll("[type*='fscss']");for(c=0;c<fstylesheet.length;c++){fetch(fstylesheet[c].href).then(response => response.text()).then(data => {document.body.innerHTML+=`<style>${data}</style>`;}).catch(error => {});}
|
|
2
2
|
var text ='text';var url ='fromUrl';var fromUrl = 'fromUrl';var write = 'text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet!=='undefined'&&text=='text'){var doc=document;
|
|
3
3
|
const AJWinDocStyleElement = document.createElement("style");
|
|
4
4
|
AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var sTc=document.createElement('script');var sTcZ=document.createElement('script');sTc.type = 'text/javascript';sTc.async='true';sTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/
|
|
1
|
+
var sTc=document.createElement('script');var sTcZ=document.createElement('script');sTc.type = 'text/javascript';sTc.async='true';sTc.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';var sTcZB=document.createElement('script');sTcZB.type = 'text/javascript';sTcZB.async='true';sTcZB.text='fs_cssText = (0);';sTcZ.type='text/javascript';sTcZ.async='true';sTcZ.src='https://winiss.tiiny.site/scripts/m.js';document.body.appendChild(sTc);fstylesheet=document.querySelectorAll("[type*='fscss']");for(c=0;c<fstylesheet.length;c++){fetch(fstylesheet[c].href).then(response => response.text()).then(data => {document.body.innerHTML+=`<style>${data}</style>`;}).catch(error => {});}
|
|
2
2
|
var text ='text';var url ='fromUrl';var fromUrl = 'fromUrl';var write = 'text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet!=='undefined'&&text=='text'){var doc=document;
|
|
3
3
|
const AJWinDocStyleElement = document.createElement("style");
|
|
4
4
|
AJWinDocStyleElement.innerHTML = `${fscss_style_sheet}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fscss",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Figured Shorthand Cascading Style Sheet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"dotenv": "^16.0.3",
|
|
32
32
|
"express": "^4.18.2",
|
|
33
|
-
"fscss": "^1.1.
|
|
33
|
+
"fscss": "^1.1.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"chai": "^4.3.4",
|
package/xfscss.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export var text='text';export var url='fromUrl';export var external='fromUrl';export var fromUrl='fromUrl';export var write='text';function inf(host,jsdl){if(typeof jsdl!=='undefined'&&host!=='undefined'){var ht=host.replace(/github/gi, 'gh');var cov=jsdl.replace(/\s*-\>\s*/g, '/').replace(/\n/g, '');var url=`https://cdn.jsdelivr.net/${ht}/${cov}`;var ScrT=document.createElement('script');ScrT.type='text/javascript';ScrT.async='true';ScrT.src=url;document.body.appendChild(ScrT);}}function exec(text,fscss_style_sheet){if(typeof fscss_style_sheet !== 'undefined' && text == 'text'){var doc=document;var SrT = doc.createElement('script');
|
|
2
|
-
SrT.type='text/javascript';SrT.async='true';SrT.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/
|
|
2
|
+
SrT.type='text/javascript';SrT.async='true';SrT.src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@main/rtF4.js';doc.body.appendChild(SrT);doc.body.innerHTML += (`<style>${fscss_style_sheet}</style>`);}else if(typeof fscss_style_sheet!=='undefined'&&text=='fromUrl'){var doc=document;var SrT=doc.createElement('script');SrT.type = 'text/javascript';SrT.async='true';SrT.src= 'https://combinatronics.io/Figsh/FSCSS/refs/heads/4.0.1/fscss_exec.js ';doc.body.appendChild(SrT);fetch(fscss_style_sheet).then(response =>response.text()).then(data=>{const AJWinDocStyleElement = document.createElement("style");
|
|
3
3
|
AJWinDocStyleElement.innerHTML = `${data}`;
|
|
4
4
|
document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}export{ inf };export{ exec };
|