highmark-tex 0.0.17 → 0.0.21
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/.swcrc +11 -0
- package/bin/main.js +15 -0
- package/example.js +18803 -0
- package/index.html +44 -0
- package/lib/example/utilities/svg.js +33 -0
- package/lib/example/view.js +181 -0
- package/lib/example.js +16 -0
- package/lib/index.js +3 -0
- package/otf/STIXTwoMath-Regular.otf +0 -0
- package/otf/STIXTwoText-Bold.otf +0 -0
- package/otf/STIXTwoText-BoldItalic.otf +0 -0
- package/otf/STIXTwoText-Italic.otf +0 -0
- package/otf/STIXTwoText-Regular.otf +0 -0
- package/package.json +8 -13
- package/src/example/utilities/svg.js +32 -0
- package/src/example/view.js +37 -0
- package/src/example.js +15 -0
- package/src/index.js +2 -0
package/index.html
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Highmark TeX</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<style>
|
|
7
|
+
|
|
8
|
+
*,
|
|
9
|
+
*::after,
|
|
10
|
+
*::before {
|
|
11
|
+
border: 0;
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
line-height: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
html {
|
|
19
|
+
font-size: 10px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<script src="example.js"> </script>
|
|
26
|
+
<script>
|
|
27
|
+
|
|
28
|
+
var xmlHttpRequest = new XMLHttpRequest();
|
|
29
|
+
|
|
30
|
+
xmlHttpRequest.onreadystatechange = function() {
|
|
31
|
+
if (xmlHttpRequest.readyState == 4) {
|
|
32
|
+
if (xmlHttpRequest.status == 200) {
|
|
33
|
+
location.reload();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
xmlHttpRequest.open("GET", "/live-reload");
|
|
39
|
+
|
|
40
|
+
xmlHttpRequest.send();
|
|
41
|
+
|
|
42
|
+
</script>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get default () {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
15
|
+
get svgFromCodePoint () {
|
|
16
|
+
return svgFromCodePoint;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _opentype = require("opentype.js");
|
|
20
|
+
function svgFromCodePoint(codePoint, arrayBuffer) {
|
|
21
|
+
var font = (0, _opentype.parse)(arrayBuffer), character = String.fromCodePoint(codePoint), glyph = font.charToGlyph(character), path = glyph.getPath(0, 0, 1000), pathData = path.toPathData(), boundingBox = path.getBoundingBox();
|
|
22
|
+
var x1 = boundingBox.x1, y1 = boundingBox.y1, x2 = boundingBox.x2, y2 = boundingBox.y2, x = x1, y = y1, width = x2 - x1, height = y2 - y1, viewBox = "".concat(x, " ").concat(y, " ").concat(width, " ").concat(height), d = pathData; ///
|
|
23
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
24
|
+
viewBox: viewBox
|
|
25
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
26
|
+
d: d
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
var _default = {
|
|
30
|
+
svgFromCodePoint: svgFromCodePoint
|
|
31
|
+
};
|
|
32
|
+
|
|
33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FLElBQUliLFVBQVUsR0FBRztJQUV2QixxQkFFRSxvQkFBQ2M7UUFBSUYsU0FBU0E7cUJBQ1osb0JBQUNkO1FBQUtlLEdBQUdBOztBQUlmO0lBRUEsV0FBZTtJQUNiekIsa0JBQUFBO0FBQ0YifQ==
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return View;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _easy = require("easy");
|
|
12
|
+
var _necessary = require("necessary");
|
|
13
|
+
var _svg = require("./utilities/svg");
|
|
14
|
+
function _assert_this_initialized(self) {
|
|
15
|
+
if (self === void 0) {
|
|
16
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
17
|
+
}
|
|
18
|
+
return self;
|
|
19
|
+
}
|
|
20
|
+
function _call_super(_this, derived, args) {
|
|
21
|
+
derived = _get_prototype_of(derived);
|
|
22
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
23
|
+
}
|
|
24
|
+
function _class_call_check(instance, Constructor) {
|
|
25
|
+
if (!(instance instanceof Constructor)) {
|
|
26
|
+
throw new TypeError("Cannot call a class as a function");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _construct(Parent, args, Class) {
|
|
30
|
+
if (_is_native_reflect_construct()) {
|
|
31
|
+
_construct = Reflect.construct;
|
|
32
|
+
} else {
|
|
33
|
+
_construct = function construct(Parent, args, Class) {
|
|
34
|
+
var a = [
|
|
35
|
+
null
|
|
36
|
+
];
|
|
37
|
+
a.push.apply(a, args);
|
|
38
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
39
|
+
var instance = new Constructor();
|
|
40
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
41
|
+
return instance;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return _construct.apply(null, arguments);
|
|
45
|
+
}
|
|
46
|
+
function _defineProperties(target, props) {
|
|
47
|
+
for(var i = 0; i < props.length; i++){
|
|
48
|
+
var descriptor = props[i];
|
|
49
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
50
|
+
descriptor.configurable = true;
|
|
51
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
52
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
56
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
57
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
58
|
+
return Constructor;
|
|
59
|
+
}
|
|
60
|
+
function _define_property(obj, key, value) {
|
|
61
|
+
if (key in obj) {
|
|
62
|
+
Object.defineProperty(obj, key, {
|
|
63
|
+
value: value,
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
obj[key] = value;
|
|
70
|
+
}
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
function _get_prototype_of(o) {
|
|
74
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
75
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
76
|
+
};
|
|
77
|
+
return _get_prototype_of(o);
|
|
78
|
+
}
|
|
79
|
+
function _inherits(subClass, superClass) {
|
|
80
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
81
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
82
|
+
}
|
|
83
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
84
|
+
constructor: {
|
|
85
|
+
value: subClass,
|
|
86
|
+
writable: true,
|
|
87
|
+
configurable: true
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
91
|
+
}
|
|
92
|
+
function _is_native_function(fn) {
|
|
93
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
94
|
+
}
|
|
95
|
+
function _possible_constructor_return(self, call) {
|
|
96
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
97
|
+
return call;
|
|
98
|
+
}
|
|
99
|
+
return _assert_this_initialized(self);
|
|
100
|
+
}
|
|
101
|
+
function _set_prototype_of(o, p) {
|
|
102
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
103
|
+
o.__proto__ = p;
|
|
104
|
+
return o;
|
|
105
|
+
};
|
|
106
|
+
return _set_prototype_of(o, p);
|
|
107
|
+
}
|
|
108
|
+
function _type_of(obj) {
|
|
109
|
+
"@swc/helpers - typeof";
|
|
110
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
111
|
+
}
|
|
112
|
+
function _wrap_native_super(Class) {
|
|
113
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
114
|
+
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
115
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
116
|
+
if (typeof Class !== "function") {
|
|
117
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
118
|
+
}
|
|
119
|
+
if (typeof _cache !== "undefined") {
|
|
120
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
121
|
+
_cache.set(Class, Wrapper);
|
|
122
|
+
}
|
|
123
|
+
function Wrapper() {
|
|
124
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
125
|
+
}
|
|
126
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
127
|
+
constructor: {
|
|
128
|
+
value: Wrapper,
|
|
129
|
+
enumerable: false,
|
|
130
|
+
writable: true,
|
|
131
|
+
configurable: true
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return _set_prototype_of(Wrapper, Class);
|
|
135
|
+
};
|
|
136
|
+
return _wrap_native_super(Class);
|
|
137
|
+
}
|
|
138
|
+
function _is_native_reflect_construct() {
|
|
139
|
+
try {
|
|
140
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
141
|
+
} catch (_) {}
|
|
142
|
+
return (_is_native_reflect_construct = function() {
|
|
143
|
+
return !!result;
|
|
144
|
+
})();
|
|
145
|
+
}
|
|
146
|
+
var get = _necessary.ajaxUtilities.get;
|
|
147
|
+
var View = /*#__PURE__*/ function(Element) {
|
|
148
|
+
_inherits(View, Element);
|
|
149
|
+
function View() {
|
|
150
|
+
_class_call_check(this, View);
|
|
151
|
+
return _call_super(this, View, arguments);
|
|
152
|
+
}
|
|
153
|
+
_create_class(View, [
|
|
154
|
+
{
|
|
155
|
+
key: "didMount",
|
|
156
|
+
value: function didMount() {
|
|
157
|
+
var _this = this;
|
|
158
|
+
var codePoint = 0x1d538, host = "http://localhost:8888/", uri = "otf/STIXTwoText-Regular.otf", query = {}, headers = {
|
|
159
|
+
"accept": "font/otf"
|
|
160
|
+
}, responseType = "arraybuffer";
|
|
161
|
+
get(host, uri, query, headers, responseType, function(arrayBuffer) {
|
|
162
|
+
var svg = (0, _svg.svgFromCodePoint)(codePoint, arrayBuffer);
|
|
163
|
+
_this.mount(svg);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
key: "willUnmount",
|
|
169
|
+
value: function willUnmount() {
|
|
170
|
+
///
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
]);
|
|
174
|
+
return View;
|
|
175
|
+
}(_wrap_native_super(_easy.Element));
|
|
176
|
+
_define_property(View, "tagName", "div");
|
|
177
|
+
_define_property(View, "defaultProperties", {
|
|
178
|
+
className: "view"
|
|
179
|
+
});
|
|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FJSSxNQUFNQyxLQUFLQyxPQUFPQyxTQUFTQyxjQUFjLFNBQUNDO29CQUM1QyxJQUFNQyxNQUFNQyxJQUFBQSxxQkFBZ0IsRUFBQ1IsV0FBV007b0JBRXhDLE1BQUtHLEtBQUssQ0FBQ0Y7Z0JBQ2I7WUFDRjs7O1lBRUFHLEtBQUFBO21CQUFBQSxTQUFBQTtZQUNFLEdBQUc7WUFDTDs7O1dBcEJtQmQ7cUJBQWFlLGFBQU87QUFzQnZDLGlCQXRCbUJmLE1Bc0JaZ0IsV0FBVTtBQUVqQixpQkF4Qm1CaEIsTUF3QlppQixxQkFBb0I7SUFDekJDLFdBQVc7QUFDYiJ9
|
package/lib/example.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
require("juxtapose");
|
|
6
|
+
var _easy = require("easy");
|
|
7
|
+
var _view = /*#__PURE__*/ _interop_require_default(require("./example/view"));
|
|
8
|
+
function _interop_require_default(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
var body = new _easy.Body();
|
|
14
|
+
body.mount(/*#__PURE__*/ React.createElement(_view.default, null));
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9leGFtcGxlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgXCJqdXh0YXBvc2VcIjtcblxuaW1wb3J0IHsgQm9keSB9IGZyb20gXCJlYXN5XCI7XG5cbmltcG9ydCBWaWV3IGZyb20gXCIuL2V4YW1wbGUvdmlld1wiO1xuXG5jb25zdCBib2R5ID0gbmV3IEJvZHkoKTtcblxuYm9keS5tb3VudChcblxuICA8Vmlldy8+XG5cbik7XG4iXSwibmFtZXMiOlsiYm9keSIsIkJvZHkiLCJtb3VudCIsIlZpZXciXSwibWFwcGluZ3MiOiJBQUFBOzs7O1FBRU87b0JBRWM7MkRBRUo7Ozs7OztBQUVqQixJQUFNQSxPQUFPLElBQUlDLFVBQUk7QUFFckJELEtBQUtFLEtBQUssZUFFUixvQkFBQ0MsYUFBSSJ9
|
package/lib/index.js
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "highmark-tex",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/highmark-tex",
|
|
7
7
|
"description": "Highmark's TeX-like functionality.",
|
|
@@ -10,21 +10,16 @@
|
|
|
10
10
|
"url": "https://github.com/djalbat/highmark-tex"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"necessary": "^15.0.1"
|
|
14
|
-
"occam-dom": "^5.3.20",
|
|
15
|
-
"occam-lexers": "^23.1.3",
|
|
16
|
-
"occam-parsers": "^23.1.5",
|
|
17
|
-
"occam-query": "^4.1.110"
|
|
13
|
+
"necessary": "^15.0.1"
|
|
18
14
|
},
|
|
19
15
|
"devDependencies": {
|
|
20
|
-
"@swc/core": "
|
|
21
|
-
"
|
|
22
|
-
"easy
|
|
23
|
-
"easy-with-style": "^3.0.511",
|
|
24
|
-
"esbuild": "^0.9.2",
|
|
16
|
+
"@swc/core": "1.13.20",
|
|
17
|
+
"esbuild": "0.11.14",
|
|
18
|
+
"easy": "^23.1.6",
|
|
25
19
|
"express": "^4.17.1",
|
|
26
|
-
"juxtapose": "^4.0.
|
|
27
|
-
"lively-cli": "^2.0.
|
|
20
|
+
"juxtapose": "^4.0.121",
|
|
21
|
+
"lively-cli": "^2.0.77",
|
|
22
|
+
"opentype.js": "^1.3.4",
|
|
28
23
|
"watchful-cli": "^1.7.56"
|
|
29
24
|
},
|
|
30
25
|
"scripts": {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { parse } from "opentype.js";
|
|
4
|
+
|
|
5
|
+
export function svgFromCodePoint(codePoint, arrayBuffer) {
|
|
6
|
+
const font = parse(arrayBuffer),
|
|
7
|
+
character = String.fromCodePoint(codePoint),
|
|
8
|
+
glyph = font.charToGlyph(character),
|
|
9
|
+
path = glyph.getPath(0, 0, 1000),
|
|
10
|
+
pathData = path.toPathData(), ///
|
|
11
|
+
boundingBox = path.getBoundingBox();
|
|
12
|
+
|
|
13
|
+
const { x1, y1, x2, y2 } = boundingBox,
|
|
14
|
+
x = x1, ///
|
|
15
|
+
y = y1, ///
|
|
16
|
+
width = x2 - x1,
|
|
17
|
+
height = y2 - y1,
|
|
18
|
+
viewBox = `${x} ${y} ${width} ${height}`,
|
|
19
|
+
d = pathData; ///
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
|
|
23
|
+
<svg viewBox={viewBox}>
|
|
24
|
+
<path d={d} />
|
|
25
|
+
</svg>
|
|
26
|
+
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
svgFromCodePoint
|
|
32
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Element } from "easy";
|
|
4
|
+
import { ajaxUtilities } from "necessary";
|
|
5
|
+
|
|
6
|
+
import { svgFromCodePoint } from "./utilities/svg";
|
|
7
|
+
|
|
8
|
+
const { get } = ajaxUtilities;
|
|
9
|
+
|
|
10
|
+
export default class View extends Element {
|
|
11
|
+
didMount() {
|
|
12
|
+
const codePoint = 0x1d538,
|
|
13
|
+
host = "http://localhost:8888/",
|
|
14
|
+
uri = `otf/STIXTwoText-Regular.otf`,
|
|
15
|
+
query = {},
|
|
16
|
+
headers = {
|
|
17
|
+
"accept": "font/otf"
|
|
18
|
+
},
|
|
19
|
+
responseType = "arraybuffer";
|
|
20
|
+
|
|
21
|
+
get(host, uri, query, headers, responseType, (arrayBuffer) => {
|
|
22
|
+
const svg = svgFromCodePoint(codePoint, arrayBuffer);
|
|
23
|
+
|
|
24
|
+
this.mount(svg)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
willUnmount() {
|
|
29
|
+
///
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static tagName = "div";
|
|
33
|
+
|
|
34
|
+
static defaultProperties = {
|
|
35
|
+
className: "view"
|
|
36
|
+
};
|
|
37
|
+
}
|
package/src/example.js
ADDED
package/src/index.js
ADDED