fscss 1.1.6 → 1.1.8
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 +62 -20
- package/bin/fscss.js +36 -0
- package/devcontainer.json +22 -2
- package/e/exec.js +5 -7
- package/e/index.js +5 -6
- package/e/xfscss.js +7 -0
- package/example.fscss +7 -0
- package/index.js +0 -1
- package/lib/functions/all.js +1079 -0
- package/lib/functions/impSel.js +59 -0
- package/lib/functions/procImp.js +50 -0
- package/lib/index.js +2 -0
- package/lib/processor.js +49 -0
- package/package.json +26 -23
- package/public/test.html +24 -0
- package/public/vars.fscss +7 -0
- package/style.fscss +4 -0
- package/xfscss.js +4 -0
- package/e/xfscss.min.js +0 -9
- package/strg/de +0 -5
- package/strg/xvars.fscss +0 -23
- package/xfscss.min.js +0 -4
package/README.md
CHANGED
|
@@ -1,21 +1,63 @@
|
|
|
1
1
|
# FSCSS
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
FSCSS (Figured Shorthand CSS) is a CSS preprocessor that extends CSS with shorthand utilities, variables, functions, and advanced transformations.
|
|
3
|
+
It works both in the browser and on the backend (Node.js).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
🚀 Installation
|
|
9
|
+
|
|
10
|
+
`npm install -g fscss`
|
|
11
|
+
|
|
12
|
+
Or locally to your project:
|
|
13
|
+
|
|
14
|
+
`npm install fscss`
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## ✨ Features
|
|
22
|
+
|
|
23
|
+
Works in browser and backend (Node.js)
|
|
24
|
+
|
|
25
|
+
Supports:
|
|
26
|
+
|
|
27
|
+
- `@import(exec(...))` inline imports
|
|
28
|
+
|
|
29
|
+
- Variables
|
|
30
|
+
|
|
31
|
+
- Functions
|
|
32
|
+
|
|
33
|
+
- Arrays
|
|
34
|
+
|
|
35
|
+
- replace
|
|
36
|
+
|
|
37
|
+
- Random values (random)
|
|
38
|
+
|
|
39
|
+
- Copy (copy)
|
|
40
|
+
|
|
41
|
+
- Number operations (num)
|
|
42
|
+
|
|
43
|
+
- Extract string (ext)
|
|
44
|
+
|
|
45
|
+
- Event bindings (event)
|
|
46
|
+
|
|
47
|
+
- count(number)
|
|
48
|
+
|
|
49
|
+
- length(string)
|
|
50
|
+
|
|
51
|
+
- Debug helpers (debug)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Transform shorthand syntax into valid CSS
|
|
55
|
+
|
|
56
|
+
Extensible with plugins
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
📜 License
|
|
62
|
+
|
|
63
|
+
MIT © 2025 Figsh—FSCSS
|
package/bin/fscss.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { processFscss } from "../lib/processor.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
const input = process.argv[2];
|
|
12
|
+
const output = process.argv[3] || "out.css";
|
|
13
|
+
|
|
14
|
+
if (!input) {
|
|
15
|
+
console.error("Usage: fscss <input.fscss> [output.css]");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const inputPath = path.resolve(process.cwd(), input);
|
|
20
|
+
const outputPath = path.resolve(process.cwd(), output);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const css = fs.readFileSync(inputPath, "utf8");
|
|
24
|
+
|
|
25
|
+
const processed = await processFscss(css);
|
|
26
|
+
|
|
27
|
+
if (typeof processed !== "string") {
|
|
28
|
+
throw new TypeError("processFscss did not return a string");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fs.writeFileSync(outputPath, processed, "utf8");
|
|
32
|
+
console.log(`[FSCSS] ✔ Compiled ${input} → ${output}`);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error("Error:", err.message);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
package/devcontainer.json
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "Node.js Dev Container",
|
|
3
|
+
"build": {
|
|
4
|
+
"dockerfile": "Dockerfile",
|
|
5
|
+
"context": ".",
|
|
6
|
+
"args": {
|
|
7
|
+
"NODE_VERSION": "18"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"settings": {
|
|
11
|
+
"terminal.integrated.shell.linux": "/bin/bash",
|
|
12
|
+
"editor.formatOnSave": true
|
|
13
|
+
},
|
|
14
|
+
"extensions": [
|
|
15
|
+
"dbaeumer.vscode-eslint",
|
|
16
|
+
"esbenp.prettier-vscode",
|
|
17
|
+
"ms-vscode.vscode-typescript-next"
|
|
18
|
+
],
|
|
19
|
+
"postCreateCommand": "npm install -g npm@latest && npm install",
|
|
20
|
+
"forwardPorts": [3000],
|
|
21
|
+
"remoteUser": "node"
|
|
22
|
+
}
|
package/e/exec.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
|
|
2
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
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/* v-- */
|
|
10
|
-
|
|
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);}}
|
package/e/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
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
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/* v-- */
|
|
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);}}
|
package/e/xfscss.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
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);}}
|
package/example.fscss
ADDED
package/index.js
CHANGED
|
@@ -6,4 +6,3 @@ document.head.appendChild(AJWinDocStyleElement);
|
|
|
6
6
|
}else if(typeof fscss_style_sheet!=='undefined'&&text=='fromUrl'){var doc=document;fetch(fscss_style_sheet).then(response =>response.text()).then(data=>{const AJWinDocStyleElement = document.createElement("style");
|
|
7
7
|
AJWinDocStyleElement.innerHTML = `${data}`;
|
|
8
8
|
document.head.appendChild(AJWinDocStyleElement);}).catch(error=>{});}}
|
|
9
|
-
|