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/cjs/browser.js
CHANGED
|
@@ -2097,80 +2097,8 @@ var require_escape_html = __commonJS((exports2, module2) => {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
});
|
|
2099
2099
|
|
|
2100
|
-
// node_modules/canvas/lib/parse-font.js
|
|
2101
|
-
var require_parse_font = __commonJS((exports2, module2) => {
|
|
2102
|
-
var weights = "bold|bolder|lighter|[1-9]00";
|
|
2103
|
-
var styles2 = "italic|oblique";
|
|
2104
|
-
var variants = "small-caps";
|
|
2105
|
-
var stretches = "ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded";
|
|
2106
|
-
var units = "px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q";
|
|
2107
|
-
var string5 = `'([^']+)'|"([^"]+)"|[\\w\\s-]+`;
|
|
2108
|
-
var weightRe = new RegExp(`(${weights}) +`, "i");
|
|
2109
|
-
var styleRe = new RegExp(`(${styles2}) +`, "i");
|
|
2110
|
-
var variantRe = new RegExp(`(${variants}) +`, "i");
|
|
2111
|
-
var stretchRe = new RegExp(`(${stretches}) +`, "i");
|
|
2112
|
-
var sizeFamilyRe = new RegExp(`([\\d\\.]+)(${units}) *((?:${string5})( *, *(?:${string5}))*)`);
|
|
2113
|
-
var cache2 = {};
|
|
2114
|
-
var defaultHeight = 16;
|
|
2115
|
-
module2.exports = (str) => {
|
|
2116
|
-
if (cache2[str])
|
|
2117
|
-
return cache2[str];
|
|
2118
|
-
const sizeFamily = sizeFamilyRe.exec(str);
|
|
2119
|
-
if (!sizeFamily)
|
|
2120
|
-
return;
|
|
2121
|
-
const font = {
|
|
2122
|
-
weight: "normal",
|
|
2123
|
-
style: "normal",
|
|
2124
|
-
stretch: "normal",
|
|
2125
|
-
variant: "normal",
|
|
2126
|
-
size: parseFloat(sizeFamily[1]),
|
|
2127
|
-
unit: sizeFamily[2],
|
|
2128
|
-
family: sizeFamily[3].replace(/["']/g, "").replace(/ *, */g, ",")
|
|
2129
|
-
};
|
|
2130
|
-
let weight, style2, variant, stretch;
|
|
2131
|
-
const substr = str.substring(0, sizeFamily.index);
|
|
2132
|
-
if (weight = weightRe.exec(substr))
|
|
2133
|
-
font.weight = weight[1];
|
|
2134
|
-
if (style2 = styleRe.exec(substr))
|
|
2135
|
-
font.style = style2[1];
|
|
2136
|
-
if (variant = variantRe.exec(substr))
|
|
2137
|
-
font.variant = variant[1];
|
|
2138
|
-
if (stretch = stretchRe.exec(substr))
|
|
2139
|
-
font.stretch = stretch[1];
|
|
2140
|
-
switch (font.unit) {
|
|
2141
|
-
case "pt":
|
|
2142
|
-
font.size /= 0.75;
|
|
2143
|
-
break;
|
|
2144
|
-
case "pc":
|
|
2145
|
-
font.size *= 16;
|
|
2146
|
-
break;
|
|
2147
|
-
case "in":
|
|
2148
|
-
font.size *= 96;
|
|
2149
|
-
break;
|
|
2150
|
-
case "cm":
|
|
2151
|
-
font.size *= 96 / 2.54;
|
|
2152
|
-
break;
|
|
2153
|
-
case "mm":
|
|
2154
|
-
font.size *= 96 / 25.4;
|
|
2155
|
-
break;
|
|
2156
|
-
case "%":
|
|
2157
|
-
break;
|
|
2158
|
-
case "em":
|
|
2159
|
-
case "rem":
|
|
2160
|
-
font.size *= defaultHeight / 0.75;
|
|
2161
|
-
break;
|
|
2162
|
-
case "q":
|
|
2163
|
-
font.size *= 96 / 25.4 / 4;
|
|
2164
|
-
break;
|
|
2165
|
-
}
|
|
2166
|
-
return cache2[str] = font;
|
|
2167
|
-
};
|
|
2168
|
-
});
|
|
2169
|
-
|
|
2170
2100
|
// node_modules/canvas/browser.js
|
|
2171
2101
|
var require_browser2 = __commonJS((exports2) => {
|
|
2172
|
-
var parseFont = require_parse_font();
|
|
2173
|
-
exports2.parseFont = parseFont;
|
|
2174
2102
|
exports2.createCanvas = function(width2, height3) {
|
|
2175
2103
|
return Object.assign(document.createElement("canvas"), { width: width2, height: height3 });
|
|
2176
2104
|
};
|
|
@@ -5124,6 +5052,32 @@ class BrowserPath2D {
|
|
|
5124
5052
|
}
|
|
5125
5053
|
}
|
|
5126
5054
|
|
|
5055
|
+
// src/api/MockDocumentFactory.ts
|
|
5056
|
+
class MockDocumentFactory {
|
|
5057
|
+
logPreInitializationCall(methodName) {
|
|
5058
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
5059
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
5060
|
+
The application will continue but may not work as expected.`);
|
|
5061
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
5062
|
+
}
|
|
5063
|
+
createElement(tagName) {
|
|
5064
|
+
this.logPreInitializationCall("createElement");
|
|
5065
|
+
return {};
|
|
5066
|
+
}
|
|
5067
|
+
createElementNS(namespace, tagName) {
|
|
5068
|
+
this.logPreInitializationCall("createElementNS");
|
|
5069
|
+
return {};
|
|
5070
|
+
}
|
|
5071
|
+
caretPositionFromPoint(x, y, options) {
|
|
5072
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
5073
|
+
return null;
|
|
5074
|
+
}
|
|
5075
|
+
caretRangeFromPoint(x, y) {
|
|
5076
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
5077
|
+
return null;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
|
|
5127
5081
|
// src/api/MockPath2D.ts
|
|
5128
5082
|
class MockPath2D {
|
|
5129
5083
|
nativePath = null;
|
|
@@ -5226,7 +5180,7 @@ var ExportQuality;
|
|
|
5226
5180
|
var conf2 = {
|
|
5227
5181
|
connection: undefined,
|
|
5228
5182
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5229
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
5183
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
5230
5184
|
getDOMParser: undefined,
|
|
5231
5185
|
measureCtx: undefined,
|
|
5232
5186
|
i18n: {},
|
|
Binary file
|
package/dist/cjs/index.js
CHANGED
|
@@ -5015,6 +5015,32 @@ class BrowserPath2D {
|
|
|
5015
5015
|
}
|
|
5016
5016
|
}
|
|
5017
5017
|
|
|
5018
|
+
// src/api/MockDocumentFactory.ts
|
|
5019
|
+
class MockDocumentFactory {
|
|
5020
|
+
logPreInitializationCall(methodName) {
|
|
5021
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
5022
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
5023
|
+
The application will continue but may not work as expected.`);
|
|
5024
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
5025
|
+
}
|
|
5026
|
+
createElement(tagName) {
|
|
5027
|
+
this.logPreInitializationCall("createElement");
|
|
5028
|
+
return {};
|
|
5029
|
+
}
|
|
5030
|
+
createElementNS(namespace, tagName) {
|
|
5031
|
+
this.logPreInitializationCall("createElementNS");
|
|
5032
|
+
return {};
|
|
5033
|
+
}
|
|
5034
|
+
caretPositionFromPoint(x, y, options) {
|
|
5035
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
5036
|
+
return null;
|
|
5037
|
+
}
|
|
5038
|
+
caretRangeFromPoint(x, y) {
|
|
5039
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
5040
|
+
return null;
|
|
5041
|
+
}
|
|
5042
|
+
}
|
|
5043
|
+
|
|
5018
5044
|
// src/api/MockPath2D.ts
|
|
5019
5045
|
class MockPath2D {
|
|
5020
5046
|
nativePath = null;
|
|
@@ -5117,7 +5143,7 @@ var ExportQuality;
|
|
|
5117
5143
|
var conf2 = {
|
|
5118
5144
|
connection: undefined,
|
|
5119
5145
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5120
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
5146
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
5121
5147
|
getDOMParser: undefined,
|
|
5122
5148
|
measureCtx: undefined,
|
|
5123
5149
|
i18n: {},
|