mancha 0.17.3 → 0.17.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/.github/workflows/ci.yml +8 -8
- package/.prettierrc +2 -2
- package/.vscode/extensions.json +1 -1
- package/.vscode/launch.json +33 -43
- package/README.md +94 -94
- package/dist/browser.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/css_gen_basic.js.map +1 -1
- package/dist/css_gen_utils.d.ts +786 -0
- package/dist/css_gen_utils.js +63 -23
- package/dist/css_gen_utils.js.map +1 -1
- package/dist/dome.js.map +1 -1
- package/dist/expressions/ast.d.ts +16 -16
- package/dist/expressions/ast.test.js +89 -64
- package/dist/expressions/ast.test.js.map +1 -1
- package/dist/expressions/ast_factory.d.ts +1 -1
- package/dist/expressions/ast_factory.js +17 -17
- package/dist/expressions/ast_factory.js.map +1 -1
- package/dist/expressions/ast_factory.test.js +42 -36
- package/dist/expressions/ast_factory.test.js.map +1 -1
- package/dist/expressions/constants.js +56 -56
- package/dist/expressions/constants.js.map +1 -1
- package/dist/expressions/constants.test.js +57 -57
- package/dist/expressions/constants.test.js.map +1 -1
- package/dist/expressions/eval.d.ts +17 -17
- package/dist/expressions/eval.js +58 -60
- package/dist/expressions/eval.js.map +1 -1
- package/dist/expressions/eval.test.js +11 -8
- package/dist/expressions/eval.test.js.map +1 -1
- package/dist/expressions/expressions.test.d.ts +6 -6
- package/dist/expressions/expressions.test.js +6 -6
- package/dist/expressions/index.d.ts +6 -6
- package/dist/expressions/index.js +6 -6
- package/dist/expressions/parser.d.ts +3 -3
- package/dist/expressions/parser.js +37 -42
- package/dist/expressions/parser.js.map +1 -1
- package/dist/expressions/parser.test.js +3 -6
- package/dist/expressions/parser.test.js.map +1 -1
- package/dist/expressions/tokenizer.js +22 -25
- package/dist/expressions/tokenizer.js.map +1 -1
- package/dist/expressions/tokenizer.test.js +40 -15
- package/dist/expressions/tokenizer.test.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/iterator.js.map +1 -1
- package/dist/mancha.js.map +1 -1
- package/dist/plugins.js +2 -2
- package/dist/plugins.js.map +1 -1
- package/dist/query.js.map +1 -1
- package/dist/renderer.js.map +1 -1
- package/dist/safe_browser.js.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/dist/test_utils.js.map +1 -1
- package/dist/trusted_attributes.js.map +1 -1
- package/dist/type_checker.js +11 -7
- package/dist/type_checker.js.map +1 -1
- package/dist/worker.js.map +1 -1
- package/docs/css.md +419 -0
- package/docs/quickstart.md +305 -296
- package/global.d.ts +2 -2
- package/gulpfile.ts +44 -0
- package/package.json +86 -84
- package/scripts/generate-css-docs.ts +374 -0
- package/tsconfig.json +42 -19
- package/tsec_exemptions.json +8 -3
- package/webpack.config.esmodule.ts +26 -0
- package/webpack.config.ts +21 -0
- package/gulpfile.js +0 -44
- package/webpack.config.esmodule.js +0 -23
- package/webpack.config.js +0 -18
package/global.d.ts
CHANGED
package/gulpfile.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import GulpClient from "gulp";
|
|
3
|
+
import csso from "gulp-csso";
|
|
4
|
+
import { exec } from "child_process";
|
|
5
|
+
|
|
6
|
+
const execTask = (command: string) => {
|
|
7
|
+
return async function (done: (err?: any) => void) {
|
|
8
|
+
const { err, stderr, stdout } = await new Promise<{ err: any; stderr: string; stdout: string }>(
|
|
9
|
+
(resolve) => exec(command, (err, stdout, stderr) => resolve({ err, stderr, stdout })),
|
|
10
|
+
);
|
|
11
|
+
if (stdout) console.log(stdout);
|
|
12
|
+
if (stderr) console.error(stderr);
|
|
13
|
+
done(err);
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Clean tasks
|
|
18
|
+
|
|
19
|
+
GulpClient.task("clean", function (done) {
|
|
20
|
+
return fs.rm("dist", { recursive: true, force: true }).then(() => done());
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Build tasks
|
|
24
|
+
|
|
25
|
+
GulpClient.task("ts", execTask("tsec -m NodeNext -p ."));
|
|
26
|
+
|
|
27
|
+
GulpClient.task("chmod", function (done) {
|
|
28
|
+
return fs.chmod("dist/cli.js", 0o755).then(() => done());
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
GulpClient.task("css", function () {
|
|
32
|
+
return GulpClient.src("src/**/*.css").pipe(csso()).pipe(GulpClient.dest("dist"));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
GulpClient.task("webpack:main", execTask("webpack --config webpack.config.ts"));
|
|
36
|
+
GulpClient.task("webpack:esmodule", execTask("webpack --config webpack.config.esmodule.ts"));
|
|
37
|
+
|
|
38
|
+
GulpClient.task("fixtures", function () {
|
|
39
|
+
return GulpClient.src("src/fixtures/**/*").pipe(GulpClient.dest("dist/fixtures"));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
GulpClient.task("webpack", GulpClient.series("webpack:main", "webpack:esmodule"));
|
|
43
|
+
GulpClient.task("build", GulpClient.series("ts", "chmod", "css", "webpack", "fixtures"));
|
|
44
|
+
GulpClient.task("default", GulpClient.series("build"));
|
package/package.json
CHANGED
|
@@ -1,86 +1,88 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
2
|
+
"name": "mancha",
|
|
3
|
+
"version": "0.17.5",
|
|
4
|
+
"description": "Javscript HTML rendering engine",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"unpkg": "dist/mancha.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./browser": {
|
|
15
|
+
"types": "./dist/browser.d.ts",
|
|
16
|
+
"default": "./dist/browser.js"
|
|
17
|
+
},
|
|
18
|
+
"./dist/*.js": {
|
|
19
|
+
"types": "./dist/*.d.ts",
|
|
20
|
+
"default": "./dist/*.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "rm -rf dist/",
|
|
25
|
+
"build": "gulp build",
|
|
26
|
+
"pretest": "npm run build",
|
|
27
|
+
"test:node": "mocha 'dist/**/*.test.js' --ignore 'dist/browser.test.js'",
|
|
28
|
+
"test:browser": "web-test-runner 'dist/**/*.test.js' '!dist/cli.test.js' '!dist/ssr.test.js' '!dist/index.test.js' '!dist/worker.test.js' '!dist/type_checker.test.js' --node-resolve --compatibility all --playwright --browsers chromium --no-sandbox",
|
|
29
|
+
"test": "npm run test:node && npm run test:browser",
|
|
30
|
+
"check_size": "brotli -c dist/mancha.js | wc -c",
|
|
31
|
+
"cli": "node dist/cli.js",
|
|
32
|
+
"gen:docs": "tsx scripts/generate-css-docs.ts"
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"mancha": "dist/cli.js"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/fresho-dev/mancha.git"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"templating",
|
|
43
|
+
"rendering",
|
|
44
|
+
"reactive",
|
|
45
|
+
"html"
|
|
46
|
+
],
|
|
47
|
+
"author": "contact@fresho.dev",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"dom-serializer": "^2.0.0",
|
|
51
|
+
"glob": "^10.3.10",
|
|
52
|
+
"htmlparser2": "^9.1.0",
|
|
53
|
+
"jsdom": "^27.0.1",
|
|
54
|
+
"safevalues": "^0.6.0",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"yargs": "^17.7.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/chai": "^5.2.3",
|
|
60
|
+
"@types/chai-as-promised": "^8.0.1",
|
|
61
|
+
"@types/glob": "^8.1.0",
|
|
62
|
+
"@types/jsdom": "^21.1.6",
|
|
63
|
+
"@types/mocha": "^10.0.10",
|
|
64
|
+
"@types/node": "^20.12.11",
|
|
65
|
+
"@types/path-browserify": "^1.0.1",
|
|
66
|
+
"@types/trusted-types": "^2.0.7",
|
|
67
|
+
"@types/yargs": "^17.0.29",
|
|
68
|
+
"@web/test-runner": "^0.19.0",
|
|
69
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
70
|
+
"chai": "^5.3.3",
|
|
71
|
+
"chai-as-promised": "^8.0.1",
|
|
72
|
+
"css-loader": "^7.1.2",
|
|
73
|
+
"csso": "^5.0.5",
|
|
74
|
+
"gulp": "^5.0.0",
|
|
75
|
+
"gulp-csso": "^4.0.1",
|
|
76
|
+
"gulp-typescript": "^6.0.0-alpha.1",
|
|
77
|
+
"mocha": "^11.0.1",
|
|
78
|
+
"static-server": "^3.0.0",
|
|
79
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
80
|
+
"ts-node": "^10.9.2",
|
|
81
|
+
"tsec": "^0.2.8",
|
|
82
|
+
"tsx": "^4.21.0",
|
|
83
|
+
"typescript": "^5.9.3",
|
|
84
|
+
"webpack": "^5.97.1",
|
|
85
|
+
"webpack-cli": "^5.1.4",
|
|
86
|
+
"yargs": "^17.7.2"
|
|
87
|
+
}
|
|
86
88
|
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
MEDIA_BREAKPOINTS,
|
|
5
|
+
PROPS_CUSTOM,
|
|
6
|
+
PROPS_COLORS,
|
|
7
|
+
PROPS_SPACING,
|
|
8
|
+
PROPS_SIZING,
|
|
9
|
+
PROPS_POSITION,
|
|
10
|
+
PROPS_SIZING_MINMAX,
|
|
11
|
+
UNITS_ALL,
|
|
12
|
+
REM_UNIT,
|
|
13
|
+
PERCENTS,
|
|
14
|
+
DURATIONS,
|
|
15
|
+
} from "../src/css_gen_utils.ts";
|
|
16
|
+
|
|
17
|
+
const DOCS_PATH = path.join(process.cwd(), "docs", "css.md");
|
|
18
|
+
|
|
19
|
+
function handledBySize(klass: string) {
|
|
20
|
+
return klass.startsWith("text-") && (klass.endsWith("px") || klass.endsWith("rem"));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function generateMarkdown() {
|
|
24
|
+
let md = "# CSS Documentation\n\n";
|
|
25
|
+
|
|
26
|
+
md +=
|
|
27
|
+
"Mancha provides a set of CSS utilities and basic styles to help you build your application.\n\n";
|
|
28
|
+
|
|
29
|
+
md += "## Basic CSS\n\n";
|
|
30
|
+
md +=
|
|
31
|
+
'The basic CSS rules provide a clean, readable default style for standard HTML elements. You can inject them using `injectBasicCss()` or by adding `css="basic"` to your script tag.\n\n';
|
|
32
|
+
md += "### Reset & Defaults\n";
|
|
33
|
+
md += "- **Max Width**: 70ch (centered)\n";
|
|
34
|
+
md += "- **Padding**: 2em 1em\n";
|
|
35
|
+
md += "- **Line Height**: 1.75\n";
|
|
36
|
+
md += "- **Font Family**: sans-serif\n";
|
|
37
|
+
md += "- **H1-H6 Margin**: 1em 0 0.5em\n";
|
|
38
|
+
md += "- **P, UL, OL Margin Bottom**: 1em\n\n";
|
|
39
|
+
|
|
40
|
+
md += "## Utility CSS\n\n";
|
|
41
|
+
md +=
|
|
42
|
+
'The utility CSS rules are inspired by Tailwind CSS. You can inject them using `injectUtilsCss()` or by adding `css="utils"` to your script tag.\n\n';
|
|
43
|
+
|
|
44
|
+
md += "### Media Breakpoints\n\n";
|
|
45
|
+
md += "| Prefix | Min Width |\n";
|
|
46
|
+
md += "| --- | --- |\n";
|
|
47
|
+
for (const [bp, width] of Object.entries(MEDIA_BREAKPOINTS)) {
|
|
48
|
+
md += `| \`${bp}:\` | \`${width}px\` |\n`;
|
|
49
|
+
}
|
|
50
|
+
md += "\n";
|
|
51
|
+
|
|
52
|
+
md += "### Pseudo States\n\n";
|
|
53
|
+
md += "The following pseudo states are supported for all utilities:\n";
|
|
54
|
+
md += "- `hover:`\n";
|
|
55
|
+
md += "- `focus:`\n";
|
|
56
|
+
md += "- `disabled:`\n";
|
|
57
|
+
md += "- `active:`\n\n";
|
|
58
|
+
|
|
59
|
+
md += "### Spacing (Margin & Padding)\n\n";
|
|
60
|
+
md += "Spacing utilities use a 0.25rem (4px) unit by default.\n\n";
|
|
61
|
+
md += "| Prefix | Property | Values |\n";
|
|
62
|
+
md += "| --- | --- | --- |\n";
|
|
63
|
+
for (const [prop, prefix] of Object.entries(PROPS_SPACING)) {
|
|
64
|
+
md += `| \`${prefix}-\` | \`${prop}\` | \`0\`, \`0.25rem\` - \`128rem\` (and negative versions) |\n`;
|
|
65
|
+
md += `| \`${prefix}x-\` | \`${prop}-left/right\` | Same as above |\n`;
|
|
66
|
+
md += `| \`${prefix}y-\` | \`${prop}-top/bottom\` | Same as above |\n`;
|
|
67
|
+
md += `| \`${prefix}t-\` | \`${prop}-top\` | Same as above |\n`;
|
|
68
|
+
md += `| \`${prefix}b-\` | \`${prop}-bottom\` | Same as above |\n`;
|
|
69
|
+
md += `| \`${prefix}l-\` | \`${prop}-left\` | Same as above |\n`;
|
|
70
|
+
md += `| \`${prefix}r-\` | \`${prop}-right\` | Same as above |\n`;
|
|
71
|
+
}
|
|
72
|
+
md += "\n";
|
|
73
|
+
|
|
74
|
+
md += "### Sizing (Width & Height)\n\n";
|
|
75
|
+
md += "| Prefix | Property | Values |\n";
|
|
76
|
+
md += "| --- | --- | --- |\n";
|
|
77
|
+
for (const [prop, prefix] of Object.entries(PROPS_SIZING)) {
|
|
78
|
+
md += `| \`${prefix}-\` | \`${prop}\` | \`0\`, \`full\` (100%), \`screen\` (100vw/vh), \`auto\`, \`px\`, \`0.25rem\` - \`128rem\` |\n`;
|
|
79
|
+
md += `| \`${prefix}-dvw/dvh/svw/svh/lvw/lvh\` | \`${prop}\` | Viewport-relative units |\n`;
|
|
80
|
+
md += `| \`${prefix}-fit/min/max\` | \`${prop}\` | \`fit-content\`, \`min-content\`, \`max-content\` |\n`;
|
|
81
|
+
}
|
|
82
|
+
for (const [prop, prefix] of Object.entries(PROPS_SIZING_MINMAX)) {
|
|
83
|
+
md += `| \`${prefix}-\` | \`${prop}\` | Same as sizing |\n`;
|
|
84
|
+
}
|
|
85
|
+
md +=
|
|
86
|
+
"| `size-` | `width` & `height` | `auto`, `px`, `full`, `dvw`, `dvh`, `svw`, `svh`, `lvw`, `lvh`, `min`, `max`, `fit` |\n";
|
|
87
|
+
md += "\n";
|
|
88
|
+
|
|
89
|
+
md += "### Colors\n\n";
|
|
90
|
+
md += "Supported prefixes: `text-`, `bg-`, `border-`, `fill-`.\n\n";
|
|
91
|
+
md += "| Color | Shades |\n";
|
|
92
|
+
md += "| --- | --- |\n";
|
|
93
|
+
md += "| `white`, `black`, `transparent` | N/A |\n";
|
|
94
|
+
for (const [color, shades] of Object.entries(PROPS_COLORS)) {
|
|
95
|
+
md += `| \`${color}\` | \`50\`, \`100\`, \`200\`, \`300\`, \`400\`, \`500\`, \`600\`, \`700\`, \`800\`, \`900\` |\n`;
|
|
96
|
+
}
|
|
97
|
+
md += "\n";
|
|
98
|
+
|
|
99
|
+
md += "### Borders & Corners\n\n";
|
|
100
|
+
md += "| Utility | Description |\n";
|
|
101
|
+
md += "| --- | --- |\n";
|
|
102
|
+
const borderProps = ["border", "rounded"];
|
|
103
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
104
|
+
if (borderProps.some((p) => klass.startsWith(p))) {
|
|
105
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Document dynamic border widths
|
|
109
|
+
md += "| `border-{0-15}` | Border width in pixels (e.g., `border-0`, `border-1`, ..., `border-15`) |\n";
|
|
110
|
+
md += "| `border-x-{0-15}` | Horizontal border width in pixels |\n";
|
|
111
|
+
md += "| `border-y-{0-15}` | Vertical border width in pixels |\n";
|
|
112
|
+
md += "| `border-{t,b,l,r}-{0-15}` | Individual side border width in pixels |\n";
|
|
113
|
+
md += "\n";
|
|
114
|
+
|
|
115
|
+
md += "### Shadows & Effects\n\n";
|
|
116
|
+
md += "| Utility | Description |\n";
|
|
117
|
+
md += "| --- | --- |\n";
|
|
118
|
+
const effectProps = ["shadow", "mix-blend-"];
|
|
119
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
120
|
+
if (effectProps.some((p) => klass.startsWith(p))) {
|
|
121
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Document opacity
|
|
125
|
+
md += "| `opacity-0` | Fully transparent |\n";
|
|
126
|
+
md += `| \`opacity-{${PERCENTS.join(",")}}\` | Opacity values from 0-100 |\n`;
|
|
127
|
+
md += "\n";
|
|
128
|
+
|
|
129
|
+
md += "### Transitions & Animations\n\n";
|
|
130
|
+
md += "| Utility | Description |\n";
|
|
131
|
+
md += "| --- | --- |\n";
|
|
132
|
+
const animProps = ["transition", "animate-"];
|
|
133
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
134
|
+
if (animProps.some((p) => klass.startsWith(p))) {
|
|
135
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Document durations
|
|
139
|
+
md += `| \`duration-{${DURATIONS.join(",")}}\` | Transition duration in milliseconds |\n`;
|
|
140
|
+
md += "\n";
|
|
141
|
+
|
|
142
|
+
md += "### Interactivity\n\n";
|
|
143
|
+
md += "| Utility | Description |\n";
|
|
144
|
+
md += "| --- | --- |\n";
|
|
145
|
+
const interProps = ["cursor-", "select-", "pointer-events-", "resize", "user-select"];
|
|
146
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
147
|
+
if (interProps.some((p) => klass.startsWith(p))) {
|
|
148
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
md += "\n";
|
|
152
|
+
|
|
153
|
+
md += "### Typography\n\n";
|
|
154
|
+
md += "| Utility | Description |\n";
|
|
155
|
+
md += "| --- | --- |\n";
|
|
156
|
+
const typoProps = [
|
|
157
|
+
"font-",
|
|
158
|
+
"text-",
|
|
159
|
+
"italic",
|
|
160
|
+
"not-italic",
|
|
161
|
+
"leading-",
|
|
162
|
+
"tracking-",
|
|
163
|
+
"uppercase",
|
|
164
|
+
"lowercase",
|
|
165
|
+
"capitalize",
|
|
166
|
+
"truncate",
|
|
167
|
+
"whitespace-",
|
|
168
|
+
"decoration-",
|
|
169
|
+
"underline",
|
|
170
|
+
"line-through",
|
|
171
|
+
];
|
|
172
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
173
|
+
if (typoProps.some((p) => klass.startsWith(p)) && !handledBySize(klass)) {
|
|
174
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
md += "\n";
|
|
178
|
+
|
|
179
|
+
md += "### Flexbox & Layout\n\n";
|
|
180
|
+
md += "| Utility | Description |\n";
|
|
181
|
+
md += "| --- | --- |\n";
|
|
182
|
+
const flexProps = [
|
|
183
|
+
"flex",
|
|
184
|
+
"justify-",
|
|
185
|
+
"items-",
|
|
186
|
+
"self-",
|
|
187
|
+
"content-",
|
|
188
|
+
"grow",
|
|
189
|
+
"shrink",
|
|
190
|
+
"gap-",
|
|
191
|
+
"order-",
|
|
192
|
+
"grid-",
|
|
193
|
+
];
|
|
194
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
195
|
+
if (flexProps.some((p) => klass.startsWith(p))) {
|
|
196
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Document gap utilities
|
|
200
|
+
md += "| `gap-0` | No gap |\n";
|
|
201
|
+
md += "| `gap-{1-512}` | Gap in rem units (0.25rem increments) |\n";
|
|
202
|
+
md += "| `gap-{1-512}px` | Gap in pixels |\n";
|
|
203
|
+
md += "| `gap-x-{1-512}` | Horizontal gap in rem units |\n";
|
|
204
|
+
md += "| `gap-y-{1-512}` | Vertical gap in rem units |\n";
|
|
205
|
+
md += "| `gap-x-{1-512}px` | Horizontal gap in pixels |\n";
|
|
206
|
+
md += "| `gap-y-{1-512}px` | Vertical gap in pixels |\n";
|
|
207
|
+
md += "| `space-x-{0-512}` | Horizontal spacing between children (rem) |\n";
|
|
208
|
+
md += "| `space-y-{0-512}` | Vertical spacing between children (rem) |\n";
|
|
209
|
+
md += "| `space-x-{0-512}px` | Horizontal spacing between children (px) |\n";
|
|
210
|
+
md += "| `space-y-{0-512}px` | Vertical spacing between children (px) |\n";
|
|
211
|
+
md += "\n";
|
|
212
|
+
|
|
213
|
+
md += "### Position & Inset\n\n";
|
|
214
|
+
md += "| Utility | Description |\n";
|
|
215
|
+
md += "| --- | --- |\n";
|
|
216
|
+
const posProps = [
|
|
217
|
+
"relative",
|
|
218
|
+
"absolute",
|
|
219
|
+
"fixed",
|
|
220
|
+
"sticky",
|
|
221
|
+
"inset-",
|
|
222
|
+
"object-",
|
|
223
|
+
];
|
|
224
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
225
|
+
if (posProps.some((p) => klass.startsWith(p))) {
|
|
226
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// Document position values
|
|
230
|
+
md += "| `top-{0-512}`, `bottom-{0-512}`, `left-{0-512}`, `right-{0-512}` | Position in rem units (0.25rem increments) |\n";
|
|
231
|
+
md += "| `top-{0-512}px`, `bottom-{0-512}px`, `left-{0-512}px`, `right-{0-512}px` | Position in pixels |\n";
|
|
232
|
+
md += "| `top-{1-100}%`, `bottom-{1-100}%`, `left-{1-100}%`, `right-{1-100}%` | Position in percentages |\n";
|
|
233
|
+
md += "| `top-auto`, `bottom-auto`, `left-auto`, `right-auto` | Auto positioning |\n";
|
|
234
|
+
// Document z-index
|
|
235
|
+
md += `| \`z-{${PERCENTS.join(",")}}\` | Z-index values |\n`;
|
|
236
|
+
md += "\n";
|
|
237
|
+
|
|
238
|
+
md += "### Display & Visibility\n\n";
|
|
239
|
+
md += "| Utility | Description |\n";
|
|
240
|
+
md += "| --- | --- |\n";
|
|
241
|
+
const displayProps = ["block", "inline", "hidden", "contents", "visible", "invisible", "collapse"];
|
|
242
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
243
|
+
if (displayProps.some((p) => klass === p)) {
|
|
244
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
md += "\n";
|
|
248
|
+
|
|
249
|
+
md += "### Overflow & Scrolling\n\n";
|
|
250
|
+
md += "| Utility | Description |\n";
|
|
251
|
+
md += "| --- | --- |\n";
|
|
252
|
+
const overflowProps = ["overflow-", "overscroll-"];
|
|
253
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
254
|
+
if (overflowProps.some((p) => klass.startsWith(p))) {
|
|
255
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
md += "\n";
|
|
259
|
+
|
|
260
|
+
md += "### Backgrounds\n\n";
|
|
261
|
+
md += "| Utility | Description |\n";
|
|
262
|
+
md += "| --- | --- |\n";
|
|
263
|
+
const bgProps = ["bg-auto", "bg-cover", "bg-contain", "bg-no-repeat", "bg-fixed", "bg-local", "bg-scroll"];
|
|
264
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
265
|
+
if (bgProps.some((p) => klass === p)) {
|
|
266
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
md += "\n";
|
|
270
|
+
|
|
271
|
+
md += "### Lists\n\n";
|
|
272
|
+
md += "| Utility | Description |\n";
|
|
273
|
+
md += "| --- | --- |\n";
|
|
274
|
+
const listProps = ["list-"];
|
|
275
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
276
|
+
if (listProps.some((p) => klass.startsWith(p))) {
|
|
277
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
md += "\n";
|
|
281
|
+
|
|
282
|
+
md += "### Vertical Alignment\n\n";
|
|
283
|
+
md += "| Utility | Description |\n";
|
|
284
|
+
md += "| --- | --- |\n";
|
|
285
|
+
const alignProps = ["align-"];
|
|
286
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
287
|
+
if (alignProps.some((p) => klass.startsWith(p))) {
|
|
288
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
md += "\n";
|
|
292
|
+
|
|
293
|
+
md += "### Viewport Sizing\n\n";
|
|
294
|
+
md += "| Utility | Description |\n";
|
|
295
|
+
md += "| --- | --- |\n";
|
|
296
|
+
const viewportProps = [
|
|
297
|
+
"min-h-screen", "max-h-screen", "min-w-screen",
|
|
298
|
+
"h-dvh", "h-svh", "h-lvh",
|
|
299
|
+
"w-dvw", "w-svw", "w-lvw",
|
|
300
|
+
"min-h-dvh", "min-h-svh", "min-h-lvh"
|
|
301
|
+
];
|
|
302
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
303
|
+
if (viewportProps.some((p) => klass === p)) {
|
|
304
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
md += "\n";
|
|
308
|
+
|
|
309
|
+
md += "### Accessibility\n\n";
|
|
310
|
+
md += "| Utility | Description |\n";
|
|
311
|
+
md += "| --- | --- |\n";
|
|
312
|
+
const a11yProps = ["sr-only", "not-sr-only"];
|
|
313
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
314
|
+
if (a11yProps.some((p) => klass === p)) {
|
|
315
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
md += "\n";
|
|
319
|
+
|
|
320
|
+
md += "### Other Utilities\n\n";
|
|
321
|
+
md += "| Utility | Description |\n";
|
|
322
|
+
md += "| --- | --- |\n";
|
|
323
|
+
const allHandledPrefixes = [
|
|
324
|
+
...typoProps,
|
|
325
|
+
...flexProps,
|
|
326
|
+
...posProps,
|
|
327
|
+
...borderProps,
|
|
328
|
+
...effectProps,
|
|
329
|
+
...animProps,
|
|
330
|
+
...interProps,
|
|
331
|
+
...displayProps,
|
|
332
|
+
...overflowProps,
|
|
333
|
+
...bgProps,
|
|
334
|
+
...listProps,
|
|
335
|
+
...alignProps,
|
|
336
|
+
...a11yProps,
|
|
337
|
+
...viewportProps,
|
|
338
|
+
"w-",
|
|
339
|
+
"h-",
|
|
340
|
+
"min-w-",
|
|
341
|
+
"min-h-",
|
|
342
|
+
"max-w-",
|
|
343
|
+
"max-h-",
|
|
344
|
+
"bg-",
|
|
345
|
+
"border-",
|
|
346
|
+
"opacity-",
|
|
347
|
+
"cursor-",
|
|
348
|
+
"size-",
|
|
349
|
+
"top-",
|
|
350
|
+
"bottom-",
|
|
351
|
+
"left-",
|
|
352
|
+
"right-",
|
|
353
|
+
"z-",
|
|
354
|
+
"duration-",
|
|
355
|
+
"gap-",
|
|
356
|
+
"space-",
|
|
357
|
+
];
|
|
358
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
359
|
+
if (!allHandledPrefixes.some((p) => klass.startsWith(p) || klass === p)) {
|
|
360
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Document text sizes
|
|
364
|
+
md += "| `text-{0-99}px` | Font size in pixels (e.g., `text-12px`, `text-16px`) |\n";
|
|
365
|
+
md += "| `text-{0-24.75}rem` | Font size in rem units (0.25rem increments) |\n";
|
|
366
|
+
md += "\n";
|
|
367
|
+
|
|
368
|
+
md += "--- \n\n*Generated automatically from `src/css_gen_utils.ts`*\n";
|
|
369
|
+
|
|
370
|
+
return md;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
fs.writeFileSync(DOCS_PATH, generateMarkdown());
|
|
374
|
+
console.log(`Documentation generated at ${DOCS_PATH}`);
|
package/tsconfig.json
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"stripInternal": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"baseUrl": ".",
|
|
17
|
+
"paths": {
|
|
18
|
+
"mancha": [
|
|
19
|
+
"./src/index.ts"
|
|
20
|
+
],
|
|
21
|
+
"mancha/*": [
|
|
22
|
+
"./src/*.ts"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"plugins": [
|
|
26
|
+
{
|
|
27
|
+
"name": "tsec",
|
|
28
|
+
"exemptionConfig": "./tsec_exemptions.json"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"include": [
|
|
33
|
+
"src/**/*",
|
|
34
|
+
"global.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"exclude": [
|
|
37
|
+
"scripts",
|
|
38
|
+
"examples",
|
|
39
|
+
"gulpfile.ts",
|
|
40
|
+
"webpack.config.ts",
|
|
41
|
+
"webpack.config.esmodule.ts",
|
|
42
|
+
"dist"
|
|
43
|
+
]
|
|
21
44
|
}
|