microboard-temp 0.1.12 → 0.1.14
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/dist/cjs/browser.js +27 -73
- package/dist/cjs/canvas-ya3gk09w.node +0 -0
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/node.js +11563 -3618
- package/dist/esm/browser.js +27 -73
- package/dist/esm/canvas-ya3gk09w.node +0 -0
- package/dist/esm/index.js +27 -1
- package/dist/esm/node.js +11563 -3618
- package/dist/types/Settings.d.ts +3 -2
- package/dist/types/api/MockDocumentFactory.d.ts +8 -0
- package/package.json +3 -3
- package/dist/cjs/canvas-dbaby9xg.node +0 -0
- package/dist/esm/canvas-dbaby9xg.node +0 -0
package/dist/esm/browser.js
CHANGED
|
@@ -2085,80 +2085,8 @@ var require_escape_html = __commonJS((exports, module) => {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
});
|
|
2087
2087
|
|
|
2088
|
-
// node_modules/canvas/lib/parse-font.js
|
|
2089
|
-
var require_parse_font = __commonJS((exports, module) => {
|
|
2090
|
-
var weights = "bold|bolder|lighter|[1-9]00";
|
|
2091
|
-
var styles2 = "italic|oblique";
|
|
2092
|
-
var variants = "small-caps";
|
|
2093
|
-
var stretches = "ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded";
|
|
2094
|
-
var units = "px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q";
|
|
2095
|
-
var string5 = `'([^']+)'|"([^"]+)"|[\\w\\s-]+`;
|
|
2096
|
-
var weightRe = new RegExp(`(${weights}) +`, "i");
|
|
2097
|
-
var styleRe = new RegExp(`(${styles2}) +`, "i");
|
|
2098
|
-
var variantRe = new RegExp(`(${variants}) +`, "i");
|
|
2099
|
-
var stretchRe = new RegExp(`(${stretches}) +`, "i");
|
|
2100
|
-
var sizeFamilyRe = new RegExp(`([\\d\\.]+)(${units}) *((?:${string5})( *, *(?:${string5}))*)`);
|
|
2101
|
-
var cache2 = {};
|
|
2102
|
-
var defaultHeight = 16;
|
|
2103
|
-
module.exports = (str) => {
|
|
2104
|
-
if (cache2[str])
|
|
2105
|
-
return cache2[str];
|
|
2106
|
-
const sizeFamily = sizeFamilyRe.exec(str);
|
|
2107
|
-
if (!sizeFamily)
|
|
2108
|
-
return;
|
|
2109
|
-
const font = {
|
|
2110
|
-
weight: "normal",
|
|
2111
|
-
style: "normal",
|
|
2112
|
-
stretch: "normal",
|
|
2113
|
-
variant: "normal",
|
|
2114
|
-
size: parseFloat(sizeFamily[1]),
|
|
2115
|
-
unit: sizeFamily[2],
|
|
2116
|
-
family: sizeFamily[3].replace(/["']/g, "").replace(/ *, */g, ",")
|
|
2117
|
-
};
|
|
2118
|
-
let weight, style2, variant, stretch;
|
|
2119
|
-
const substr = str.substring(0, sizeFamily.index);
|
|
2120
|
-
if (weight = weightRe.exec(substr))
|
|
2121
|
-
font.weight = weight[1];
|
|
2122
|
-
if (style2 = styleRe.exec(substr))
|
|
2123
|
-
font.style = style2[1];
|
|
2124
|
-
if (variant = variantRe.exec(substr))
|
|
2125
|
-
font.variant = variant[1];
|
|
2126
|
-
if (stretch = stretchRe.exec(substr))
|
|
2127
|
-
font.stretch = stretch[1];
|
|
2128
|
-
switch (font.unit) {
|
|
2129
|
-
case "pt":
|
|
2130
|
-
font.size /= 0.75;
|
|
2131
|
-
break;
|
|
2132
|
-
case "pc":
|
|
2133
|
-
font.size *= 16;
|
|
2134
|
-
break;
|
|
2135
|
-
case "in":
|
|
2136
|
-
font.size *= 96;
|
|
2137
|
-
break;
|
|
2138
|
-
case "cm":
|
|
2139
|
-
font.size *= 96 / 2.54;
|
|
2140
|
-
break;
|
|
2141
|
-
case "mm":
|
|
2142
|
-
font.size *= 96 / 25.4;
|
|
2143
|
-
break;
|
|
2144
|
-
case "%":
|
|
2145
|
-
break;
|
|
2146
|
-
case "em":
|
|
2147
|
-
case "rem":
|
|
2148
|
-
font.size *= defaultHeight / 0.75;
|
|
2149
|
-
break;
|
|
2150
|
-
case "q":
|
|
2151
|
-
font.size *= 96 / 25.4 / 4;
|
|
2152
|
-
break;
|
|
2153
|
-
}
|
|
2154
|
-
return cache2[str] = font;
|
|
2155
|
-
};
|
|
2156
|
-
});
|
|
2157
|
-
|
|
2158
2088
|
// node_modules/canvas/browser.js
|
|
2159
2089
|
var require_browser2 = __commonJS((exports) => {
|
|
2160
|
-
var parseFont = require_parse_font();
|
|
2161
|
-
exports.parseFont = parseFont;
|
|
2162
2090
|
exports.createCanvas = function(width2, height3) {
|
|
2163
2091
|
return Object.assign(document.createElement("canvas"), { width: width2, height: height3 });
|
|
2164
2092
|
};
|
|
@@ -4965,6 +4893,32 @@ class BrowserPath2D {
|
|
|
4965
4893
|
}
|
|
4966
4894
|
}
|
|
4967
4895
|
|
|
4896
|
+
// src/api/MockDocumentFactory.ts
|
|
4897
|
+
class MockDocumentFactory {
|
|
4898
|
+
logPreInitializationCall(methodName) {
|
|
4899
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
4900
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
4901
|
+
The application will continue but may not work as expected.`);
|
|
4902
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
4903
|
+
}
|
|
4904
|
+
createElement(tagName) {
|
|
4905
|
+
this.logPreInitializationCall("createElement");
|
|
4906
|
+
return {};
|
|
4907
|
+
}
|
|
4908
|
+
createElementNS(namespace, tagName) {
|
|
4909
|
+
this.logPreInitializationCall("createElementNS");
|
|
4910
|
+
return {};
|
|
4911
|
+
}
|
|
4912
|
+
caretPositionFromPoint(x, y, options) {
|
|
4913
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
4914
|
+
return null;
|
|
4915
|
+
}
|
|
4916
|
+
caretRangeFromPoint(x, y) {
|
|
4917
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
4918
|
+
return null;
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4968
4922
|
// src/api/MockPath2D.ts
|
|
4969
4923
|
class MockPath2D {
|
|
4970
4924
|
nativePath = null;
|
|
@@ -5067,7 +5021,7 @@ var ExportQuality;
|
|
|
5067
5021
|
var conf2 = {
|
|
5068
5022
|
connection: undefined,
|
|
5069
5023
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5070
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
5024
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
5071
5025
|
getDOMParser: undefined,
|
|
5072
5026
|
measureCtx: undefined,
|
|
5073
5027
|
i18n: {},
|
|
Binary file
|
package/dist/esm/index.js
CHANGED
|
@@ -4856,6 +4856,32 @@ class BrowserPath2D {
|
|
|
4856
4856
|
}
|
|
4857
4857
|
}
|
|
4858
4858
|
|
|
4859
|
+
// src/api/MockDocumentFactory.ts
|
|
4860
|
+
class MockDocumentFactory {
|
|
4861
|
+
logPreInitializationCall(methodName) {
|
|
4862
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
4863
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
4864
|
+
The application will continue but may not work as expected.`);
|
|
4865
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
4866
|
+
}
|
|
4867
|
+
createElement(tagName) {
|
|
4868
|
+
this.logPreInitializationCall("createElement");
|
|
4869
|
+
return {};
|
|
4870
|
+
}
|
|
4871
|
+
createElementNS(namespace, tagName) {
|
|
4872
|
+
this.logPreInitializationCall("createElementNS");
|
|
4873
|
+
return {};
|
|
4874
|
+
}
|
|
4875
|
+
caretPositionFromPoint(x, y, options) {
|
|
4876
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
4877
|
+
return null;
|
|
4878
|
+
}
|
|
4879
|
+
caretRangeFromPoint(x, y) {
|
|
4880
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
4881
|
+
return null;
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
|
|
4859
4885
|
// src/api/MockPath2D.ts
|
|
4860
4886
|
class MockPath2D {
|
|
4861
4887
|
nativePath = null;
|
|
@@ -4958,7 +4984,7 @@ var ExportQuality;
|
|
|
4958
4984
|
var conf2 = {
|
|
4959
4985
|
connection: undefined,
|
|
4960
4986
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
4961
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
4987
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
4962
4988
|
getDOMParser: undefined,
|
|
4963
4989
|
measureCtx: undefined,
|
|
4964
4990
|
i18n: {},
|