ntk 7.6.1 → 8.0.0
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 +9 -10
- package/lib/image.js +12 -0
- package/lib/index.js +9 -30
- package/lib/maskcluster.js +191 -0
- package/lib/renderingcontext_2d.js +590 -175
- package/lib/text/layout.js +4 -4
- package/lib/widgets/svgview.js +5 -4
- package/package.json +4 -9
- package/lib/widgets/css.js +0 -673
- package/lib/widgets/highlight.js +0 -97
- package/lib/widgets/htmlview.js +0 -893
- package/lib/widgets/markdown.js +0 -148
- package/lib/widgets/markdownview.js +0 -492
- package/lib/widgets/tex.js +0 -679
- package/lib/yoga.js +0 -119
package/lib/text/layout.js
CHANGED
|
@@ -51,10 +51,10 @@ export class TextLayout {
|
|
|
51
51
|
const maxWidth = options.maxWidth ?? Infinity;
|
|
52
52
|
|
|
53
53
|
// ---- normalize spans, resolve fonts eagerly ----
|
|
54
|
-
// unknown span fields ride along untouched
|
|
55
|
-
//
|
|
56
|
-
// An empty span list is a legitimate thing to lay out —
|
|
57
|
-
// reaches it for a blank paragraph while
|
|
54
|
+
// unknown span fields ride along untouched, so a caller can attach its
|
|
55
|
+
// own markers to a span and read them back off the line runs
|
|
56
|
+
// An empty span list is a legitimate thing to lay out — a document view
|
|
57
|
+
// reaches it for a blank paragraph while one is being typed —
|
|
58
58
|
// and every line still needs a style to take its metrics from, so
|
|
59
59
|
// stand one in rather than crashing on the first empty line.
|
|
60
60
|
const given = typeof content === 'string' ? [{ text: content }] : content;
|
package/lib/widgets/svgview.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// view.setSvg('<svg viewBox="0 0 24 24">…</svg>');
|
|
10
10
|
// wnd.map();
|
|
11
11
|
//
|
|
12
|
-
// Standalone (windowless) use
|
|
12
|
+
// Standalone (windowless) use, which is how a document renderer drives it:
|
|
13
13
|
// const view = new SvgView(null);
|
|
14
14
|
// view.setSvg(svgText);
|
|
15
15
|
// view.draw(ctx, x, y, width, height);
|
|
@@ -59,7 +59,7 @@ const STYLE_ATTRS = {
|
|
|
59
59
|
const NUMERIC = new Set(['strokeWidth', 'miterLimit', 'fillOpacity', 'strokeOpacity', 'fontSize']);
|
|
60
60
|
|
|
61
61
|
// documents may come from an XML parse (setSvg: exact case) or from an HTML
|
|
62
|
-
// parse (
|
|
62
|
+
// parse (inline <svg>: tag/attribute names lowercased) — compare
|
|
63
63
|
// names lowercased and look attributes up by their lowercase form too
|
|
64
64
|
const tag = (node) => (node.name || '').toLowerCase();
|
|
65
65
|
|
|
@@ -342,8 +342,9 @@ export default class SvgView {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
|
-
* Adopt an already-parsed `<svg>` element (htmlparser2 DOM node) —
|
|
346
|
-
*
|
|
345
|
+
* Adopt an already-parsed `<svg>` element (htmlparser2 DOM node) — how a
|
|
346
|
+
* host document hands over its inline SVG, and how react-x11's `<svg>`
|
|
347
|
+
* element passes JSX children. HTML-mode parses (lowercased tag/attribute
|
|
347
348
|
* names) are handled.
|
|
348
349
|
*/
|
|
349
350
|
setSvgDom(element) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ntk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Desktop UI toolkit for X11 with canvas-like 2d and OpenGL rendering",
|
|
5
5
|
"author": "Andrey Sidorov <sidorares@yandex.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,21 +36,15 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"bidi-js": "^1.0.3",
|
|
38
38
|
"canvas-fontstyle": "^1.0.1",
|
|
39
|
-
"css-select": "^7.0.0",
|
|
40
39
|
"domutils": "^4.0.2",
|
|
41
40
|
"extrude-polyline": "^1.0.6",
|
|
42
41
|
"fontkit": "^2.0.4",
|
|
43
|
-
"highlight.js": "^11.11.1",
|
|
44
42
|
"htmlparser2": "^12.0.0",
|
|
45
43
|
"jpeg-js": "^0.4.4",
|
|
46
|
-
"katex": "^0.18.1",
|
|
47
44
|
"linebreak": "^1.1.0",
|
|
48
|
-
"marked": "^18.0.7",
|
|
49
45
|
"parse-color": "^1.0.0",
|
|
50
46
|
"pngjs": "^7.0.0",
|
|
51
|
-
"
|
|
52
|
-
"x11": "^3.9.0",
|
|
53
|
-
"yoga-layout": "^3.2.1"
|
|
47
|
+
"x11": "^3.9.0"
|
|
54
48
|
},
|
|
55
49
|
"optionalDependencies": {
|
|
56
50
|
"x11-dri": ">=0.2.0 <1"
|
|
@@ -60,6 +54,7 @@
|
|
|
60
54
|
"check-release-message": "node scripts/check-release-message.mjs"
|
|
61
55
|
},
|
|
62
56
|
"devDependencies": {
|
|
63
|
-
"@conventional-commits/parser": "^0.4.1"
|
|
57
|
+
"@conventional-commits/parser": "^0.4.1",
|
|
58
|
+
"katex": "^0.18.1"
|
|
64
59
|
}
|
|
65
60
|
}
|