Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial cssProps feature #389

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f5b68d6
Initial cssProps feature
B-Teague Nov 10, 2021
3a924ed
Merge branch 'master' into cssProps
cristianbote Nov 22, 2021
ab3d317
Merge branch 'master' into cssProps
cristianbote Nov 22, 2021
bc7095a
Add mustache templates and regen
B-Teague Nov 28, 2021
c0a797c
Finish creating mustache templates
B-Teague Nov 28, 2021
02a3f69
Merge branch 'cristianbote:master' into cssProps
B-Teague Nov 28, 2021
2e9d0d6
Merge branch 'cssProps' of github.com:B-Teague/goober into cssProps
B-Teague Nov 28, 2021
ec5c294
Create dedicated syntax files
B-Teague Dec 9, 2021
58e67fe
Merge branch 'master' into cssProps
cristianbote Dec 10, 2021
14158a6
creating peggy css syntax parser
B-Teague Dec 11, 2021
987bba5
Merge branch 'cssProps' of github.com:B-Teague/goober into cssProps
B-Teague Dec 11, 2021
2347192
Merge branch 'master' into cssProps
cristianbote Jan 14, 2022
8888225
Updated template generators
B-Teague Feb 2, 2023
b656ee4
Merge branch 'cristianbote:master' into cssProps
B-Teague Feb 2, 2023
9127d2f
Reformat mdn data
B-Teague Feb 4, 2023
e435719
Updating template generators with using cssMdnData
B-Teague Feb 9, 2023
cd26ce4
Update template generators with simpler syntax using cssMsnData
B-Teague Feb 9, 2023
8c1eb88
delete tests
B-Teague Feb 10, 2023
7ca4a9d
generators and templates
B-Teague Feb 10, 2023
8acd2a2
updated indices
B-Teague Feb 10, 2023
fdd8454
updated indices
B-Teague Feb 10, 2023
f6fb511
updated indices
B-Teague Feb 10, 2023
413ac09
Merge branch 'cristianbote:master' into cssProps
B-Teague Feb 10, 2023
c2f95fd
Generate README
B-Teague Feb 10, 2023
6092ff2
Finish units
B-Teague Feb 10, 2023
b395825
Remove jsdocs
B-Teague Feb 11, 2023
d8b2735
Remove jsdocs
B-Teague Feb 11, 2023
f23d677
Remove jsdocs
B-Teague Feb 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
creating peggy css syntax parser
  • Loading branch information
B-Teague committed Dec 11, 2021
commit 14158a66850f724d96ca7356da97c2018a98fbbe
34 changes: 34 additions & 0 deletions cssProps/scripts/expandSyntaxes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const jetpack = require('fs-jetpack');
const mdnData = require('mdn-data');

//[ 'atRules', 'selectors', 'types', 'properties', 'syntaxes', 'units' ]
const cssData = mdnData.css;

// "color": {
// "syntax": "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
// },
const cssSyntaxes = cssData.syntaxes;

console.log(cssSyntaxes);

const expand = (syntax) => {
childSyntaxes = syntax.match(/<[\w\-]+>/g);

if (childSyntaxes) {
childSyntaxes.forEach((childSyntax, index) => {
const childSyntaxName = childSyntax.slice(1, -1); //remove <>
console.log('Processing key: ' + childSyntaxName);
if (cssSyntaxes[childSyntaxName]) {
syntax = syntax.replace(childSyntax, expand(cssSyntaxes[childSyntaxName].syntax));
} else {
syntax = syntax.replace(childSyntax, childSyntax.toUpperCase());
}
});
return syntax;
} else {
return syntax;
}
};

console.log(cssSyntaxes.color.syntax);
console.log(expand(cssSyntaxes.color.syntax));
4 changes: 2 additions & 2 deletions cssProps/scripts/generateFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const cssSyntaxes = cssData.syntaxes;
const cssSyntaxFunctions = Object.keys(cssSyntaxes).reduce((result, nextKey) => {
if (nextKey.slice(-2) === '()') {
const cssFunction = nextKey.slice(0, -2);
result[cssFunction] = cssSyntaxes[nextKey];
result[cssFunction] = cssSyntaxes[nextKey].syntax;
}
return result;
}, {});

// jetpack.write('./cssSyntaxFunctions.json', cssSyntaxFunctions)
jetpack.write('./syntax/functions.syntax.json', cssSyntaxFunctions);

const functionsIndexTemplate = jetpack.read('./templates/functions.index.mustache');
const functionsFunctionIndexTemplate = jetpack.read(
Expand Down
5 changes: 1 addition & 4 deletions cssProps/src/functions/attr/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name attr
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function attr()
*/
export default function attr() {
return 'attr(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `attr(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/blur/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name blur
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function blur()
*/
export default function blur() {
return 'blur(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `blur(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/brightness/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name brightness
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function brightness()
*/
export default function brightness() {
return 'brightness(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `brightness(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/calc/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name calc
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function calc()
*/
export default function calc() {
return 'calc(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `calc(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/circle/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name circle
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function circle()
*/
export default function circle() {
return 'circle(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `circle(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/clamp/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name clamp
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function clamp()
*/
export default function clamp() {
return 'clamp(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `clamp(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/conicGradient/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name conicGradient
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function conicGradient()
*/
export default function conicGradient() {
return 'conicGradient(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `conicGradient(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/contrast/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name contrast
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function contrast()
*/
export default function contrast() {
return 'contrast(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `contrast(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/counter/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name counter
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function counter()
*/
export default function counter() {
return 'counter(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `counter(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/counters/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name counters
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function counters()
*/
export default function counters() {
return 'counters(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `counters(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/crossFade/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name crossFade
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function crossFade()
*/
export default function crossFade() {
return 'crossFade(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `crossFade(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/dropShadow/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name dropShadow
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function dropShadow()
*/
export default function dropShadow() {
return 'dropShadow(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `dropShadow(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/element/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name element
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function element()
*/
export default function element() {
return 'element(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `element(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/ellipse/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name ellipse
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function ellipse()
*/
export default function ellipse() {
return 'ellipse(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `ellipse(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/env/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name env
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function env()
*/
export default function env() {
return 'env(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `env(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/fitContent/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name fitContent
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function fitContent()
*/
export default function fitContent() {
return 'fitContent(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `fitContent(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/grayscale/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name grayscale
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function grayscale()
*/
export default function grayscale() {
return 'grayscale(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `grayscale(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/hsl/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name hsl
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function hsl()
*/
export default function hsl() {
return 'hsl(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `hsl(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/hsla/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name hsla
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function hsla()
*/
export default function hsla() {
return 'hsla(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `hsla(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/hueRotate/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name hueRotate
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function hueRotate()
*/
export default function hueRotate() {
return 'hueRotate(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `hueRotate(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/image/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name image
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function image()
*/
export default function image() {
return 'image(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `image(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/imageSet/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name imageSet
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function imageSet()
*/
export default function imageSet() {
return 'imageSet(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `imageSet(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/inset/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name inset
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function inset()
*/
export default function inset() {
return 'inset(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `inset(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/invert/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name invert
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function invert()
*/
export default function invert() {
return 'invert(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `invert(${args.join()})`;
5 changes: 1 addition & 4 deletions cssProps/src/functions/leader/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Do not modify this file. This file is generated from ./cssProps/templates/functions.function.index.mustache */
import { default as appendArgs } from '../../util/index';

/**
* @name leader
Expand All @@ -11,6 +10,4 @@ import { default as appendArgs } from '../../util/index';
* @param arguments - String or numerical values that will be comma delimited for the function call
* @returns {string} Returns a comma delimited function call for the function leader()
*/
export default function leader() {
return 'leader(' + appendArgs(arguments, ',') + ')';
}
export default (...args) => `leader(${args.join()})`;
Loading