mancha 0.17.3 → 0.17.4
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 +309 -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 +263 -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.4",
|
|
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,263 @@
|
|
|
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
|
+
md += "\n";
|
|
109
|
+
|
|
110
|
+
md += "### Shadows & Effects\n\n";
|
|
111
|
+
md += "| Utility | Description |\n";
|
|
112
|
+
md += "| --- | --- |\n";
|
|
113
|
+
const effectProps = ["shadow", "opacity-", "mix-blend-"];
|
|
114
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
115
|
+
if (effectProps.some((p) => klass.startsWith(p))) {
|
|
116
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
md += "\n";
|
|
120
|
+
|
|
121
|
+
md += "### Transitions & Animations\n\n";
|
|
122
|
+
md += "| Utility | Description |\n";
|
|
123
|
+
md += "| --- | --- |\n";
|
|
124
|
+
const animProps = ["transition", "duration-", "animate-"];
|
|
125
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
126
|
+
if (animProps.some((p) => klass.startsWith(p))) {
|
|
127
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
md += "\n";
|
|
131
|
+
|
|
132
|
+
md += "### Interactivity\n\n";
|
|
133
|
+
md += "| Utility | Description |\n";
|
|
134
|
+
md += "| --- | --- |\n";
|
|
135
|
+
const interProps = ["cursor-", "select-", "pointer-events-", "resize", "user-select"];
|
|
136
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
137
|
+
if (interProps.some((p) => klass.startsWith(p))) {
|
|
138
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
md += "\n";
|
|
142
|
+
|
|
143
|
+
md += "### Typography\n\n";
|
|
144
|
+
md += "| Utility | Description |\n";
|
|
145
|
+
md += "| --- | --- |\n";
|
|
146
|
+
const typoProps = [
|
|
147
|
+
"font-",
|
|
148
|
+
"text-",
|
|
149
|
+
"italic",
|
|
150
|
+
"not-italic",
|
|
151
|
+
"leading-",
|
|
152
|
+
"tracking-",
|
|
153
|
+
"uppercase",
|
|
154
|
+
"lowercase",
|
|
155
|
+
"capitalize",
|
|
156
|
+
"truncate",
|
|
157
|
+
"whitespace-",
|
|
158
|
+
"decoration-",
|
|
159
|
+
"underline",
|
|
160
|
+
"line-through",
|
|
161
|
+
];
|
|
162
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
163
|
+
if (typoProps.some((p) => klass.startsWith(p)) && !handledBySize(klass)) {
|
|
164
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
md += "\n";
|
|
168
|
+
|
|
169
|
+
md += "### Flexbox & Layout\n\n";
|
|
170
|
+
md += "| Utility | Description |\n";
|
|
171
|
+
md += "| --- | --- |\n";
|
|
172
|
+
const flexProps = [
|
|
173
|
+
"flex",
|
|
174
|
+
"justify-",
|
|
175
|
+
"items-",
|
|
176
|
+
"self-",
|
|
177
|
+
"content-",
|
|
178
|
+
"grow",
|
|
179
|
+
"shrink",
|
|
180
|
+
"gap-",
|
|
181
|
+
"order-",
|
|
182
|
+
"grid-",
|
|
183
|
+
];
|
|
184
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
185
|
+
if (flexProps.some((p) => klass.startsWith(p))) {
|
|
186
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
md += "\n";
|
|
190
|
+
|
|
191
|
+
md += "### Position & Inset\n\n";
|
|
192
|
+
md += "| Utility | Description |\n";
|
|
193
|
+
md += "| --- | --- |\n";
|
|
194
|
+
const posProps = [
|
|
195
|
+
"relative",
|
|
196
|
+
"absolute",
|
|
197
|
+
"fixed",
|
|
198
|
+
"sticky",
|
|
199
|
+
"inset-",
|
|
200
|
+
"top-",
|
|
201
|
+
"bottom-",
|
|
202
|
+
"left-",
|
|
203
|
+
"right-",
|
|
204
|
+
"z-",
|
|
205
|
+
"object-",
|
|
206
|
+
];
|
|
207
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
208
|
+
if (posProps.some((p) => klass.startsWith(p))) {
|
|
209
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
md += "\n";
|
|
213
|
+
|
|
214
|
+
md += "### Other Utilities\n\n";
|
|
215
|
+
md += "| Utility | Description |\n";
|
|
216
|
+
md += "| --- | --- |\n";
|
|
217
|
+
const allHandledPrefixes = [
|
|
218
|
+
...typoProps,
|
|
219
|
+
...flexProps,
|
|
220
|
+
...posProps,
|
|
221
|
+
...borderProps,
|
|
222
|
+
...effectProps,
|
|
223
|
+
...animProps,
|
|
224
|
+
...interProps,
|
|
225
|
+
"w-",
|
|
226
|
+
"h-",
|
|
227
|
+
"min-w-",
|
|
228
|
+
"min-h-",
|
|
229
|
+
"max-w-",
|
|
230
|
+
"max-h-",
|
|
231
|
+
"bg-",
|
|
232
|
+
"border-",
|
|
233
|
+
"opacity-",
|
|
234
|
+
"cursor-",
|
|
235
|
+
"size-",
|
|
236
|
+
"block",
|
|
237
|
+
"inline",
|
|
238
|
+
"hidden",
|
|
239
|
+
"contents",
|
|
240
|
+
"visible",
|
|
241
|
+
"invisible",
|
|
242
|
+
"collapse",
|
|
243
|
+
"overflow-",
|
|
244
|
+
"overscroll-",
|
|
245
|
+
"list-",
|
|
246
|
+
"align-",
|
|
247
|
+
"sr-only",
|
|
248
|
+
"not-sr-only",
|
|
249
|
+
];
|
|
250
|
+
for (const [klass, props] of Object.entries(PROPS_CUSTOM)) {
|
|
251
|
+
if (!allHandledPrefixes.some((p) => klass.startsWith(p))) {
|
|
252
|
+
md += `| \`${klass}\` | \`${JSON.stringify(props)}\` |\n`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
md += "\n";
|
|
256
|
+
|
|
257
|
+
md += "--- \n\n*Generated automatically from `src/css_gen_utils.ts`*\n";
|
|
258
|
+
|
|
259
|
+
return md;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
fs.writeFileSync(DOCS_PATH, generateMarkdown());
|
|
263
|
+
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
|
}
|
package/tsec_exemptions.json
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"ban-domparser-parsefromstring": [
|
|
3
|
+
"src/browser.ts",
|
|
4
|
+
"src/dome.test.ts",
|
|
5
|
+
"src/worker.test.ts",
|
|
6
|
+
"src/test_utils.ts"
|
|
7
|
+
],
|
|
8
|
+
"ban-range-createcontextualfragment": ["src/browser.ts"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
2
|
+
import type { Configuration } from "webpack";
|
|
3
|
+
|
|
4
|
+
const config: Configuration = {
|
|
5
|
+
target: "web",
|
|
6
|
+
mode: "production",
|
|
7
|
+
entry: {
|
|
8
|
+
browser: "./dist/browser.js",
|
|
9
|
+
safe_browser: "./dist/safe_browser.js",
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
filename: "[name].js",
|
|
13
|
+
library: { type: "modern-module" },
|
|
14
|
+
},
|
|
15
|
+
experiments: {
|
|
16
|
+
outputModule: true,
|
|
17
|
+
},
|
|
18
|
+
optimization: {
|
|
19
|
+
minimize: true,
|
|
20
|
+
minimizer: [
|
|
21
|
+
new TerserPlugin({ extractComments: false, terserOptions: { output: { comments: false } } }),
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default config;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
2
|
+
import type { Configuration } from "webpack";
|
|
3
|
+
|
|
4
|
+
const config: Configuration = {
|
|
5
|
+
target: "web",
|
|
6
|
+
mode: "production",
|
|
7
|
+
entry: {
|
|
8
|
+
mancha: "./dist/mancha.js",
|
|
9
|
+
},
|
|
10
|
+
output: {
|
|
11
|
+
filename: "[name].js",
|
|
12
|
+
},
|
|
13
|
+
optimization: {
|
|
14
|
+
minimize: true,
|
|
15
|
+
minimizer: [
|
|
16
|
+
new TerserPlugin({ extractComments: false, terserOptions: { output: { comments: false } } }),
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default config;
|
package/gulpfile.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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) => {
|
|
7
|
-
return async function (done) {
|
|
8
|
-
const { err, stderr, stdout } = await new Promise((resolve) =>
|
|
9
|
-
exec(command, (err, stderr, stdout) => 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 ES2022 -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.js"));
|
|
36
|
-
GulpClient.task("webpack:esmodule", execTask("webpack --config webpack.config.esmodule.js"));
|
|
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"));
|