sdfsdfs
This commit is contained in:
9
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.d.ts
generated
vendored
Normal file
9
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { HTMLTextStyle } from '../HtmlTextStyle';
|
||||
/**
|
||||
* Extracts font families from text. It will extract font families from the style, tagStyles and any font families
|
||||
* embedded in the text. It should also strip out duplicates as it goes.
|
||||
* @param text - The text to extract font families from
|
||||
* @param style - The style to extract font families from
|
||||
* @returns {string[]} - The font families as an array of strings
|
||||
*/
|
||||
export declare function extractFontFamilies(text: string, style: HTMLTextStyle): string[];
|
37
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.js
generated
vendored
Normal file
37
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function extractFontFamilies(text, style) {
|
||||
const fontFamily = style.fontFamily;
|
||||
const fontFamilies = [];
|
||||
const dedupe = {};
|
||||
const regex = /font-family:([^;"\s]+)/g;
|
||||
const matches = text.match(regex);
|
||||
function addFontFamily(fontFamily2) {
|
||||
if (!dedupe[fontFamily2]) {
|
||||
fontFamilies.push(fontFamily2);
|
||||
dedupe[fontFamily2] = true;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(fontFamily)) {
|
||||
for (let i = 0; i < fontFamily.length; i++) {
|
||||
addFontFamily(fontFamily[i]);
|
||||
}
|
||||
} else {
|
||||
addFontFamily(fontFamily);
|
||||
}
|
||||
if (matches) {
|
||||
matches.forEach((match) => {
|
||||
const fontFamily2 = match.split(":")[1].trim();
|
||||
addFontFamily(fontFamily2);
|
||||
});
|
||||
}
|
||||
for (const i in style.tagStyles) {
|
||||
const fontFamily2 = style.tagStyles[i].fontFamily;
|
||||
addFontFamily(fontFamily2);
|
||||
}
|
||||
return fontFamilies;
|
||||
}
|
||||
|
||||
exports.extractFontFamilies = extractFontFamilies;
|
||||
//# sourceMappingURL=extractFontFamilies.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extractFontFamilies.js","sources":["../../../../src/scene/text-html/utils/extractFontFamilies.ts"],"sourcesContent":["import type { HTMLTextStyle } from '../HtmlTextStyle';\n\n/**\n * Extracts font families from text. It will extract font families from the style, tagStyles and any font families\n * embedded in the text. It should also strip out duplicates as it goes.\n * @param text - The text to extract font families from\n * @param style - The style to extract font families from\n * @returns {string[]} - The font families as an array of strings\n */\nexport function extractFontFamilies(text: string, style: HTMLTextStyle): string[]\n{\n const fontFamily = style.fontFamily;\n const fontFamilies: string[] = [];\n const dedupe: Record<string, boolean> = {};\n\n // first ensure fonts are loaded inline..\n // find any font..\n const regex = /font-family:([^;\"\\s]+)/g;\n\n const matches = text.match(regex);\n\n function addFontFamily(fontFamily: string)\n {\n if (!dedupe[fontFamily])\n {\n fontFamilies.push(fontFamily);\n\n dedupe[fontFamily] = true;\n }\n }\n\n if (Array.isArray(fontFamily))\n {\n for (let i = 0; i < fontFamily.length; i++)\n {\n addFontFamily(fontFamily[i]);\n }\n }\n else\n {\n addFontFamily(fontFamily);\n }\n\n if (matches)\n {\n matches.forEach((match) =>\n {\n const fontFamily = match.split(':')[1].trim();\n\n addFontFamily(fontFamily);\n });\n }\n\n for (const i in style.tagStyles)\n {\n const fontFamily = style.tagStyles[i].fontFamily;\n\n addFontFamily(fontFamily as string);\n }\n\n return fontFamilies;\n}\n"],"names":["fontFamily"],"mappings":";;;AASgB,SAAA,mBAAA,CAAoB,MAAc,KAClD,EAAA;AACI,EAAA,MAAM,aAAa,KAAM,CAAA,UAAA,CAAA;AACzB,EAAA,MAAM,eAAyB,EAAC,CAAA;AAChC,EAAA,MAAM,SAAkC,EAAC,CAAA;AAIzC,EAAA,MAAM,KAAQ,GAAA,yBAAA,CAAA;AAEd,EAAM,MAAA,OAAA,GAAU,IAAK,CAAA,KAAA,CAAM,KAAK,CAAA,CAAA;AAEhC,EAAA,SAAS,cAAcA,WACvB,EAAA;AACI,IAAI,IAAA,CAAC,MAAOA,CAAAA,WAAU,CACtB,EAAA;AACI,MAAA,YAAA,CAAa,KAAKA,WAAU,CAAA,CAAA;AAE5B,MAAA,MAAA,CAAOA,WAAU,CAAI,GAAA,IAAA,CAAA;AAAA,KACzB;AAAA,GACJ;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,UAAU,CAC5B,EAAA;AACI,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,UAAA,CAAW,QAAQ,CACvC,EAAA,EAAA;AACI,MAAc,aAAA,CAAA,UAAA,CAAW,CAAC,CAAC,CAAA,CAAA;AAAA,KAC/B;AAAA,GAGJ,MAAA;AACI,IAAA,aAAA,CAAc,UAAU,CAAA,CAAA;AAAA,GAC5B;AAEA,EAAA,IAAI,OACJ,EAAA;AACI,IAAQ,OAAA,CAAA,OAAA,CAAQ,CAAC,KACjB,KAAA;AACI,MAAA,MAAMA,cAAa,KAAM,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,EAAE,IAAK,EAAA,CAAA;AAE5C,MAAA,aAAA,CAAcA,WAAU,CAAA,CAAA;AAAA,KAC3B,CAAA,CAAA;AAAA,GACL;AAEA,EAAW,KAAA,MAAA,CAAA,IAAK,MAAM,SACtB,EAAA;AACI,IAAA,MAAMA,WAAa,GAAA,KAAA,CAAM,SAAU,CAAA,CAAC,CAAE,CAAA,UAAA,CAAA;AAEtC,IAAA,aAAA,CAAcA,WAAoB,CAAA,CAAA;AAAA,GACtC;AAEA,EAAO,OAAA,YAAA,CAAA;AACX;;;;"}
|
35
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.mjs
generated
vendored
Normal file
35
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.mjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
function extractFontFamilies(text, style) {
|
||||
const fontFamily = style.fontFamily;
|
||||
const fontFamilies = [];
|
||||
const dedupe = {};
|
||||
const regex = /font-family:([^;"\s]+)/g;
|
||||
const matches = text.match(regex);
|
||||
function addFontFamily(fontFamily2) {
|
||||
if (!dedupe[fontFamily2]) {
|
||||
fontFamilies.push(fontFamily2);
|
||||
dedupe[fontFamily2] = true;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(fontFamily)) {
|
||||
for (let i = 0; i < fontFamily.length; i++) {
|
||||
addFontFamily(fontFamily[i]);
|
||||
}
|
||||
} else {
|
||||
addFontFamily(fontFamily);
|
||||
}
|
||||
if (matches) {
|
||||
matches.forEach((match) => {
|
||||
const fontFamily2 = match.split(":")[1].trim();
|
||||
addFontFamily(fontFamily2);
|
||||
});
|
||||
}
|
||||
for (const i in style.tagStyles) {
|
||||
const fontFamily2 = style.tagStyles[i].fontFamily;
|
||||
addFontFamily(fontFamily2);
|
||||
}
|
||||
return fontFamilies;
|
||||
}
|
||||
|
||||
export { extractFontFamilies };
|
||||
//# sourceMappingURL=extractFontFamilies.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/extractFontFamilies.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extractFontFamilies.mjs","sources":["../../../../src/scene/text-html/utils/extractFontFamilies.ts"],"sourcesContent":["import type { HTMLTextStyle } from '../HtmlTextStyle';\n\n/**\n * Extracts font families from text. It will extract font families from the style, tagStyles and any font families\n * embedded in the text. It should also strip out duplicates as it goes.\n * @param text - The text to extract font families from\n * @param style - The style to extract font families from\n * @returns {string[]} - The font families as an array of strings\n */\nexport function extractFontFamilies(text: string, style: HTMLTextStyle): string[]\n{\n const fontFamily = style.fontFamily;\n const fontFamilies: string[] = [];\n const dedupe: Record<string, boolean> = {};\n\n // first ensure fonts are loaded inline..\n // find any font..\n const regex = /font-family:([^;\"\\s]+)/g;\n\n const matches = text.match(regex);\n\n function addFontFamily(fontFamily: string)\n {\n if (!dedupe[fontFamily])\n {\n fontFamilies.push(fontFamily);\n\n dedupe[fontFamily] = true;\n }\n }\n\n if (Array.isArray(fontFamily))\n {\n for (let i = 0; i < fontFamily.length; i++)\n {\n addFontFamily(fontFamily[i]);\n }\n }\n else\n {\n addFontFamily(fontFamily);\n }\n\n if (matches)\n {\n matches.forEach((match) =>\n {\n const fontFamily = match.split(':')[1].trim();\n\n addFontFamily(fontFamily);\n });\n }\n\n for (const i in style.tagStyles)\n {\n const fontFamily = style.tagStyles[i].fontFamily;\n\n addFontFamily(fontFamily as string);\n }\n\n return fontFamilies;\n}\n"],"names":["fontFamily"],"mappings":";AASgB,SAAA,mBAAA,CAAoB,MAAc,KAClD,EAAA;AACI,EAAA,MAAM,aAAa,KAAM,CAAA,UAAA,CAAA;AACzB,EAAA,MAAM,eAAyB,EAAC,CAAA;AAChC,EAAA,MAAM,SAAkC,EAAC,CAAA;AAIzC,EAAA,MAAM,KAAQ,GAAA,yBAAA,CAAA;AAEd,EAAM,MAAA,OAAA,GAAU,IAAK,CAAA,KAAA,CAAM,KAAK,CAAA,CAAA;AAEhC,EAAA,SAAS,cAAcA,WACvB,EAAA;AACI,IAAI,IAAA,CAAC,MAAOA,CAAAA,WAAU,CACtB,EAAA;AACI,MAAA,YAAA,CAAa,KAAKA,WAAU,CAAA,CAAA;AAE5B,MAAA,MAAA,CAAOA,WAAU,CAAI,GAAA,IAAA,CAAA;AAAA,KACzB;AAAA,GACJ;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,UAAU,CAC5B,EAAA;AACI,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,UAAA,CAAW,QAAQ,CACvC,EAAA,EAAA;AACI,MAAc,aAAA,CAAA,UAAA,CAAW,CAAC,CAAC,CAAA,CAAA;AAAA,KAC/B;AAAA,GAGJ,MAAA;AACI,IAAA,aAAA,CAAc,UAAU,CAAA,CAAA;AAAA,GAC5B;AAEA,EAAA,IAAI,OACJ,EAAA;AACI,IAAQ,OAAA,CAAA,OAAA,CAAQ,CAAC,KACjB,KAAA;AACI,MAAA,MAAMA,cAAa,KAAM,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,EAAE,IAAK,EAAA,CAAA;AAE5C,MAAA,aAAA,CAAcA,WAAU,CAAA,CAAA;AAAA,KAC3B,CAAA,CAAA;AAAA,GACL;AAEA,EAAW,KAAA,MAAA,CAAA,IAAK,MAAM,SACtB,EAAA;AACI,IAAA,MAAMA,WAAa,GAAA,KAAA,CAAM,SAAU,CAAA,CAAC,CAAE,CAAA,UAAA,CAAA;AAEtC,IAAA,aAAA,CAAcA,WAAoB,CAAA,CAAA;AAAA,GACtC;AAEA,EAAO,OAAA,YAAA,CAAA;AACX;;;;"}
|
16
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.d.ts
generated
vendored
Normal file
16
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { FontCSSStyleOptions } from './loadFontCSS';
|
||||
export declare const FontStylePromiseCache: Map<string, Promise<string>>;
|
||||
/**
|
||||
* takes the font families and returns a css string that can be injected into a style tag
|
||||
* It will contain the font families and the font urls encoded as base64
|
||||
* @param fontFamilies - The font families to load
|
||||
* @param style - The FontCSSStyleOptions to load the font with (used for the first font family)
|
||||
* @param defaultOptions - The default options to load the font with (used for the rest of the font families)
|
||||
* @param defaultOptions.fontWeight - The default font weight
|
||||
* @param defaultOptions.fontStyle - The default font style
|
||||
* @returns - The css string
|
||||
*/
|
||||
export declare function getFontCss(fontFamilies: string[], style: FontCSSStyleOptions, defaultOptions: {
|
||||
fontWeight: string;
|
||||
fontStyle: string;
|
||||
}): Promise<string>;
|
33
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.js
generated
vendored
Normal file
33
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var Cache = require('../../../assets/cache/Cache.js');
|
||||
var loadFontCSS = require('./loadFontCSS.js');
|
||||
|
||||
"use strict";
|
||||
const FontStylePromiseCache = /* @__PURE__ */ new Map();
|
||||
async function getFontCss(fontFamilies, style, defaultOptions) {
|
||||
const fontPromises = fontFamilies.filter((fontFamily) => Cache.Cache.has(`${fontFamily}-and-url`)).map((fontFamily, i) => {
|
||||
if (!FontStylePromiseCache.has(fontFamily)) {
|
||||
const { url } = Cache.Cache.get(`${fontFamily}-and-url`);
|
||||
if (i === 0) {
|
||||
FontStylePromiseCache.set(fontFamily, loadFontCSS.loadFontCSS({
|
||||
fontWeight: style.fontWeight,
|
||||
fontStyle: style.fontStyle,
|
||||
fontFamily
|
||||
}, url));
|
||||
} else {
|
||||
FontStylePromiseCache.set(fontFamily, loadFontCSS.loadFontCSS({
|
||||
fontWeight: defaultOptions.fontWeight,
|
||||
fontStyle: defaultOptions.fontStyle,
|
||||
fontFamily
|
||||
}, url));
|
||||
}
|
||||
}
|
||||
return FontStylePromiseCache.get(fontFamily);
|
||||
});
|
||||
return (await Promise.all(fontPromises)).join("\n");
|
||||
}
|
||||
|
||||
exports.FontStylePromiseCache = FontStylePromiseCache;
|
||||
exports.getFontCss = getFontCss;
|
||||
//# sourceMappingURL=getFontCss.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getFontCss.js","sources":["../../../../src/scene/text-html/utils/getFontCss.ts"],"sourcesContent":["import { Cache } from '../../../assets/cache/Cache';\nimport { loadFontCSS } from './loadFontCSS';\n\nimport type { FontCSSStyleOptions } from './loadFontCSS';\n\nexport const FontStylePromiseCache = new Map<string, Promise<string>>();\n\n/**\n * takes the font families and returns a css string that can be injected into a style tag\n * It will contain the font families and the font urls encoded as base64\n * @param fontFamilies - The font families to load\n * @param style - The FontCSSStyleOptions to load the font with (used for the first font family)\n * @param defaultOptions - The default options to load the font with (used for the rest of the font families)\n * @param defaultOptions.fontWeight - The default font weight\n * @param defaultOptions.fontStyle - The default font style\n * @returns - The css string\n */\nexport async function getFontCss(\n fontFamilies: string[],\n style: FontCSSStyleOptions,\n defaultOptions: {fontWeight: string, fontStyle: string}\n)\n{\n const fontPromises = fontFamilies\n .filter((fontFamily) => Cache.has(`${fontFamily}-and-url`))\n .map((fontFamily, i) =>\n {\n if (!FontStylePromiseCache.has(fontFamily))\n {\n const { url } = Cache.get(`${fontFamily}-and-url`);\n\n if (i === 0)\n {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: style.fontWeight,\n fontStyle: style.fontStyle,\n fontFamily,\n }, url));\n }\n\n else\n {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: defaultOptions.fontWeight,\n fontStyle: defaultOptions.fontStyle,\n fontFamily,\n }, url));\n }\n }\n\n return FontStylePromiseCache.get(fontFamily);\n });\n\n return (await Promise.all(fontPromises)).join('\\n');\n}\n"],"names":["Cache","loadFontCSS"],"mappings":";;;;;;AAKa,MAAA,qBAAA,uBAA4B,GAA6B,GAAA;AAYhD,eAAA,UAAA,CAClB,YACA,EAAA,KAAA,EACA,cAEJ,EAAA;AACI,EAAA,MAAM,YAAe,GAAA,YAAA,CAChB,MAAO,CAAA,CAAC,eAAeA,WAAM,CAAA,GAAA,CAAI,CAAG,EAAA,UAAU,UAAU,CAAC,CAAA,CACzD,GAAI,CAAA,CAAC,YAAY,CAClB,KAAA;AACI,IAAA,IAAI,CAAC,qBAAA,CAAsB,GAAI,CAAA,UAAU,CACzC,EAAA;AACI,MAAA,MAAM,EAAE,GAAI,EAAA,GAAIA,YAAM,GAAI,CAAA,CAAA,EAAG,UAAU,CAAU,QAAA,CAAA,CAAA,CAAA;AAEjD,MAAA,IAAI,MAAM,CACV,EAAA;AACI,QAAsB,qBAAA,CAAA,GAAA,CAAI,YAAYC,uBAAY,CAAA;AAAA,UAC9C,YAAY,KAAM,CAAA,UAAA;AAAA,UAClB,WAAW,KAAM,CAAA,SAAA;AAAA,UACjB,UAAA;AAAA,SACJ,EAAG,GAAG,CAAC,CAAA,CAAA;AAAA,OAIX,MAAA;AACI,QAAsB,qBAAA,CAAA,GAAA,CAAI,YAAYA,uBAAY,CAAA;AAAA,UAC9C,YAAY,cAAe,CAAA,UAAA;AAAA,UAC3B,WAAW,cAAe,CAAA,SAAA;AAAA,UAC1B,UAAA;AAAA,SACJ,EAAG,GAAG,CAAC,CAAA,CAAA;AAAA,OACX;AAAA,KACJ;AAEA,IAAO,OAAA,qBAAA,CAAsB,IAAI,UAAU,CAAA,CAAA;AAAA,GAC9C,CAAA,CAAA;AAEL,EAAA,OAAA,CAAQ,MAAM,OAAQ,CAAA,GAAA,CAAI,YAAY,CAAA,EAAG,KAAK,IAAI,CAAA,CAAA;AACtD;;;;;"}
|
30
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.mjs
generated
vendored
Normal file
30
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.mjs
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Cache } from '../../../assets/cache/Cache.mjs';
|
||||
import { loadFontCSS } from './loadFontCSS.mjs';
|
||||
|
||||
"use strict";
|
||||
const FontStylePromiseCache = /* @__PURE__ */ new Map();
|
||||
async function getFontCss(fontFamilies, style, defaultOptions) {
|
||||
const fontPromises = fontFamilies.filter((fontFamily) => Cache.has(`${fontFamily}-and-url`)).map((fontFamily, i) => {
|
||||
if (!FontStylePromiseCache.has(fontFamily)) {
|
||||
const { url } = Cache.get(`${fontFamily}-and-url`);
|
||||
if (i === 0) {
|
||||
FontStylePromiseCache.set(fontFamily, loadFontCSS({
|
||||
fontWeight: style.fontWeight,
|
||||
fontStyle: style.fontStyle,
|
||||
fontFamily
|
||||
}, url));
|
||||
} else {
|
||||
FontStylePromiseCache.set(fontFamily, loadFontCSS({
|
||||
fontWeight: defaultOptions.fontWeight,
|
||||
fontStyle: defaultOptions.fontStyle,
|
||||
fontFamily
|
||||
}, url));
|
||||
}
|
||||
}
|
||||
return FontStylePromiseCache.get(fontFamily);
|
||||
});
|
||||
return (await Promise.all(fontPromises)).join("\n");
|
||||
}
|
||||
|
||||
export { FontStylePromiseCache, getFontCss };
|
||||
//# sourceMappingURL=getFontCss.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getFontCss.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getFontCss.mjs","sources":["../../../../src/scene/text-html/utils/getFontCss.ts"],"sourcesContent":["import { Cache } from '../../../assets/cache/Cache';\nimport { loadFontCSS } from './loadFontCSS';\n\nimport type { FontCSSStyleOptions } from './loadFontCSS';\n\nexport const FontStylePromiseCache = new Map<string, Promise<string>>();\n\n/**\n * takes the font families and returns a css string that can be injected into a style tag\n * It will contain the font families and the font urls encoded as base64\n * @param fontFamilies - The font families to load\n * @param style - The FontCSSStyleOptions to load the font with (used for the first font family)\n * @param defaultOptions - The default options to load the font with (used for the rest of the font families)\n * @param defaultOptions.fontWeight - The default font weight\n * @param defaultOptions.fontStyle - The default font style\n * @returns - The css string\n */\nexport async function getFontCss(\n fontFamilies: string[],\n style: FontCSSStyleOptions,\n defaultOptions: {fontWeight: string, fontStyle: string}\n)\n{\n const fontPromises = fontFamilies\n .filter((fontFamily) => Cache.has(`${fontFamily}-and-url`))\n .map((fontFamily, i) =>\n {\n if (!FontStylePromiseCache.has(fontFamily))\n {\n const { url } = Cache.get(`${fontFamily}-and-url`);\n\n if (i === 0)\n {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: style.fontWeight,\n fontStyle: style.fontStyle,\n fontFamily,\n }, url));\n }\n\n else\n {\n FontStylePromiseCache.set(fontFamily, loadFontCSS({\n fontWeight: defaultOptions.fontWeight,\n fontStyle: defaultOptions.fontStyle,\n fontFamily,\n }, url));\n }\n }\n\n return FontStylePromiseCache.get(fontFamily);\n });\n\n return (await Promise.all(fontPromises)).join('\\n');\n}\n"],"names":[],"mappings":";;;;AAKa,MAAA,qBAAA,uBAA4B,GAA6B,GAAA;AAYhD,eAAA,UAAA,CAClB,YACA,EAAA,KAAA,EACA,cAEJ,EAAA;AACI,EAAA,MAAM,YAAe,GAAA,YAAA,CAChB,MAAO,CAAA,CAAC,eAAe,KAAM,CAAA,GAAA,CAAI,CAAG,EAAA,UAAU,UAAU,CAAC,CAAA,CACzD,GAAI,CAAA,CAAC,YAAY,CAClB,KAAA;AACI,IAAA,IAAI,CAAC,qBAAA,CAAsB,GAAI,CAAA,UAAU,CACzC,EAAA;AACI,MAAA,MAAM,EAAE,GAAI,EAAA,GAAI,MAAM,GAAI,CAAA,CAAA,EAAG,UAAU,CAAU,QAAA,CAAA,CAAA,CAAA;AAEjD,MAAA,IAAI,MAAM,CACV,EAAA;AACI,QAAsB,qBAAA,CAAA,GAAA,CAAI,YAAY,WAAY,CAAA;AAAA,UAC9C,YAAY,KAAM,CAAA,UAAA;AAAA,UAClB,WAAW,KAAM,CAAA,SAAA;AAAA,UACjB,UAAA;AAAA,SACJ,EAAG,GAAG,CAAC,CAAA,CAAA;AAAA,OAIX,MAAA;AACI,QAAsB,qBAAA,CAAA,GAAA,CAAI,YAAY,WAAY,CAAA;AAAA,UAC9C,YAAY,cAAe,CAAA,UAAA;AAAA,UAC3B,WAAW,cAAe,CAAA,SAAA;AAAA,UAC1B,UAAA;AAAA,SACJ,EAAG,GAAG,CAAC,CAAA,CAAA;AAAA,OACX;AAAA,KACJ;AAEA,IAAO,OAAA,qBAAA,CAAsB,IAAI,UAAU,CAAA,CAAA;AAAA,GAC9C,CAAA,CAAA;AAEL,EAAA,OAAA,CAAQ,MAAM,OAAQ,CAAA,GAAA,CAAI,YAAY,CAAA,EAAG,KAAK,IAAI,CAAA,CAAA;AACtD;;;;"}
|
12
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.d.ts
generated
vendored
Normal file
12
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { HTMLTextRenderData } from '../HTMLTextRenderData';
|
||||
import type { HTMLTextStyle } from '../HtmlTextStyle';
|
||||
/**
|
||||
* takes all the data and returns a svg url string can be loaded by an image element
|
||||
* @param text - The text to measure
|
||||
* @param style - The style to use
|
||||
* @param resolution - The resolution to use
|
||||
* @param fontCSS - The font css to use
|
||||
* @param htmlTextData - The HTMLTextRenderData to write the SVG to
|
||||
* @returns - The SVG as a url string
|
||||
*/
|
||||
export declare function getSVGUrl(text: string, style: HTMLTextStyle, resolution: number, fontCSS: string, htmlTextData: HTMLTextRenderData): string;
|
16
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.js
generated
vendored
Normal file
16
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function getSVGUrl(text, style, resolution, fontCSS, htmlTextData) {
|
||||
const { domElement, styleElement, svgRoot } = htmlTextData;
|
||||
domElement.innerHTML = `<style>${style.cssStyle}</style><div style='padding:0;'>${text}</div>`;
|
||||
domElement.setAttribute("style", `transform: scale(${resolution});transform-origin: top left; display: inline-block`);
|
||||
styleElement.textContent = fontCSS;
|
||||
const { width, height } = htmlTextData.image;
|
||||
svgRoot.setAttribute("width", width.toString());
|
||||
svgRoot.setAttribute("height", height.toString());
|
||||
return new XMLSerializer().serializeToString(svgRoot);
|
||||
}
|
||||
|
||||
exports.getSVGUrl = getSVGUrl;
|
||||
//# sourceMappingURL=getSVGUrl.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getSVGUrl.js","sources":["../../../../src/scene/text-html/utils/getSVGUrl.ts"],"sourcesContent":["import type { HTMLTextRenderData } from '../HTMLTextRenderData';\nimport type { HTMLTextStyle } from '../HtmlTextStyle';\n\n/**\n * takes all the data and returns a svg url string can be loaded by an image element\n * @param text - The text to measure\n * @param style - The style to use\n * @param resolution - The resolution to use\n * @param fontCSS - The font css to use\n * @param htmlTextData - The HTMLTextRenderData to write the SVG to\n * @returns - The SVG as a url string\n */\nexport function getSVGUrl(\n text: string,\n style: HTMLTextStyle,\n resolution: number,\n fontCSS: string,\n htmlTextData: HTMLTextRenderData\n)\n{\n const { domElement, styleElement, svgRoot } = htmlTextData;\n\n domElement.innerHTML = `<style>${style.cssStyle}</style><div style='padding:0;'>${text}</div>`;\n domElement.setAttribute('style', `transform: scale(${resolution});transform-origin: top left; display: inline-block`);\n styleElement.textContent = fontCSS;\n\n const { width, height } = htmlTextData.image;\n\n svgRoot.setAttribute('width', width.toString());\n svgRoot.setAttribute('height', height.toString());\n\n return new XMLSerializer().serializeToString(svgRoot);\n}\n"],"names":[],"mappings":";;;AAYO,SAAS,SACZ,CAAA,IAAA,EACA,KACA,EAAA,UAAA,EACA,SACA,YAEJ,EAAA;AACI,EAAA,MAAM,EAAE,UAAA,EAAY,YAAc,EAAA,OAAA,EAAY,GAAA,YAAA,CAAA;AAE9C,EAAA,UAAA,CAAW,SAAY,GAAA,CAAA,OAAA,EAAU,KAAM,CAAA,QAAQ,mCAAmC,IAAI,CAAA,MAAA,CAAA,CAAA;AACtF,EAAA,UAAA,CAAW,YAAa,CAAA,OAAA,EAAS,CAAoB,iBAAA,EAAA,UAAU,CAAqD,mDAAA,CAAA,CAAA,CAAA;AACpH,EAAA,YAAA,CAAa,WAAc,GAAA,OAAA,CAAA;AAE3B,EAAA,MAAM,EAAE,KAAA,EAAO,MAAO,EAAA,GAAI,YAAa,CAAA,KAAA,CAAA;AAEvC,EAAA,OAAA,CAAQ,YAAa,CAAA,OAAA,EAAS,KAAM,CAAA,QAAA,EAAU,CAAA,CAAA;AAC9C,EAAA,OAAA,CAAQ,YAAa,CAAA,QAAA,EAAU,MAAO,CAAA,QAAA,EAAU,CAAA,CAAA;AAEhD,EAAA,OAAO,IAAI,aAAA,EAAgB,CAAA,iBAAA,CAAkB,OAAO,CAAA,CAAA;AACxD;;;;"}
|
14
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.mjs
generated
vendored
Normal file
14
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
function getSVGUrl(text, style, resolution, fontCSS, htmlTextData) {
|
||||
const { domElement, styleElement, svgRoot } = htmlTextData;
|
||||
domElement.innerHTML = `<style>${style.cssStyle}</style><div style='padding:0;'>${text}</div>`;
|
||||
domElement.setAttribute("style", `transform: scale(${resolution});transform-origin: top left; display: inline-block`);
|
||||
styleElement.textContent = fontCSS;
|
||||
const { width, height } = htmlTextData.image;
|
||||
svgRoot.setAttribute("width", width.toString());
|
||||
svgRoot.setAttribute("height", height.toString());
|
||||
return new XMLSerializer().serializeToString(svgRoot);
|
||||
}
|
||||
|
||||
export { getSVGUrl };
|
||||
//# sourceMappingURL=getSVGUrl.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getSVGUrl.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getSVGUrl.mjs","sources":["../../../../src/scene/text-html/utils/getSVGUrl.ts"],"sourcesContent":["import type { HTMLTextRenderData } from '../HTMLTextRenderData';\nimport type { HTMLTextStyle } from '../HtmlTextStyle';\n\n/**\n * takes all the data and returns a svg url string can be loaded by an image element\n * @param text - The text to measure\n * @param style - The style to use\n * @param resolution - The resolution to use\n * @param fontCSS - The font css to use\n * @param htmlTextData - The HTMLTextRenderData to write the SVG to\n * @returns - The SVG as a url string\n */\nexport function getSVGUrl(\n text: string,\n style: HTMLTextStyle,\n resolution: number,\n fontCSS: string,\n htmlTextData: HTMLTextRenderData\n)\n{\n const { domElement, styleElement, svgRoot } = htmlTextData;\n\n domElement.innerHTML = `<style>${style.cssStyle}</style><div style='padding:0;'>${text}</div>`;\n domElement.setAttribute('style', `transform: scale(${resolution});transform-origin: top left; display: inline-block`);\n styleElement.textContent = fontCSS;\n\n const { width, height } = htmlTextData.image;\n\n svgRoot.setAttribute('width', width.toString());\n svgRoot.setAttribute('height', height.toString());\n\n return new XMLSerializer().serializeToString(svgRoot);\n}\n"],"names":[],"mappings":";AAYO,SAAS,SACZ,CAAA,IAAA,EACA,KACA,EAAA,UAAA,EACA,SACA,YAEJ,EAAA;AACI,EAAA,MAAM,EAAE,UAAA,EAAY,YAAc,EAAA,OAAA,EAAY,GAAA,YAAA,CAAA;AAE9C,EAAA,UAAA,CAAW,SAAY,GAAA,CAAA,OAAA,EAAU,KAAM,CAAA,QAAQ,mCAAmC,IAAI,CAAA,MAAA,CAAA,CAAA;AACtF,EAAA,UAAA,CAAW,YAAa,CAAA,OAAA,EAAS,CAAoB,iBAAA,EAAA,UAAU,CAAqD,mDAAA,CAAA,CAAA,CAAA;AACpH,EAAA,YAAA,CAAa,WAAc,GAAA,OAAA,CAAA;AAE3B,EAAA,MAAM,EAAE,KAAA,EAAO,MAAO,EAAA,GAAI,YAAa,CAAA,KAAA,CAAA;AAEvC,EAAA,OAAA,CAAQ,YAAa,CAAA,OAAA,EAAS,KAAM,CAAA,QAAA,EAAU,CAAA,CAAA;AAC9C,EAAA,OAAA,CAAQ,YAAa,CAAA,QAAA,EAAU,MAAO,CAAA,QAAA,EAAU,CAAA,CAAA;AAEhD,EAAA,OAAO,IAAI,aAAA,EAAgB,CAAA,iBAAA,CAAkB,OAAO,CAAA,CAAA;AACxD;;;;"}
|
12
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.d.ts
generated
vendored
Normal file
12
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* This function converts an image to a canvas, and returns the canvas.
|
||||
* It is used to convert images to canvases to work around a CORS issue where WebGPU cannot
|
||||
* upload an SVGImage to a texture.
|
||||
*
|
||||
* It uses the CanvasPool to get an optimal canvas and context, and then draws the image onto it.
|
||||
* This canvas is immediately returned to the CanvasPool for reuse, so use the result straight away!
|
||||
* (eg upload it to the GPU!)
|
||||
* @param image - The image to convert to a canvas.
|
||||
* @param resolution - The resolution of the canvas.
|
||||
*/
|
||||
export declare function getTemporaryCanvasFromImage(image: HTMLImageElement, resolution: number): HTMLCanvasElement;
|
20
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.js
generated
vendored
Normal file
20
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var CanvasPool = require('../../../rendering/renderers/shared/texture/CanvasPool.js');
|
||||
|
||||
"use strict";
|
||||
function getTemporaryCanvasFromImage(image, resolution) {
|
||||
const canvasAndContext = CanvasPool.CanvasPool.getOptimalCanvasAndContext(
|
||||
image.width,
|
||||
image.height,
|
||||
resolution
|
||||
);
|
||||
const { context } = canvasAndContext;
|
||||
context.clearRect(0, 0, image.width, image.height);
|
||||
context.drawImage(image, 0, 0);
|
||||
CanvasPool.CanvasPool.returnCanvasAndContext(canvasAndContext);
|
||||
return canvasAndContext.canvas;
|
||||
}
|
||||
|
||||
exports.getTemporaryCanvasFromImage = getTemporaryCanvasFromImage;
|
||||
//# sourceMappingURL=getTemporaryCanvasFromImage.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getTemporaryCanvasFromImage.js","sources":["../../../../src/scene/text-html/utils/getTemporaryCanvasFromImage.ts"],"sourcesContent":["import { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool';\n\n/**\n * This function converts an image to a canvas, and returns the canvas.\n * It is used to convert images to canvases to work around a CORS issue where WebGPU cannot\n * upload an SVGImage to a texture.\n *\n * It uses the CanvasPool to get an optimal canvas and context, and then draws the image onto it.\n * This canvas is immediately returned to the CanvasPool for reuse, so use the result straight away!\n * (eg upload it to the GPU!)\n * @param image - The image to convert to a canvas.\n * @param resolution - The resolution of the canvas.\n */\nexport function getTemporaryCanvasFromImage(image: HTMLImageElement, resolution: number): HTMLCanvasElement\n{\n // Get an optimal canvas and context from the CanvasPool, based on the\n // dimensions of the image and the desired resolution.\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(\n image.width,\n image.height,\n resolution\n );\n\n // Clear the context of the canvas, and draw the image onto it.\n const { context } = canvasAndContext;\n\n context.clearRect(0, 0, image.width, image.height);\n context.drawImage(image, 0, 0);\n\n // Return the canvas and context to the CanvasPool.\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n\n // Return the canvas.\n return canvasAndContext.canvas as HTMLCanvasElement;\n}\n\n"],"names":["CanvasPool"],"mappings":";;;;;AAagB,SAAA,2BAAA,CAA4B,OAAyB,UACrE,EAAA;AAGI,EAAA,MAAM,mBAAmBA,qBAAW,CAAA,0BAAA;AAAA,IAChC,KAAM,CAAA,KAAA;AAAA,IACN,KAAM,CAAA,MAAA;AAAA,IACN,UAAA;AAAA,GACJ,CAAA;AAGA,EAAM,MAAA,EAAE,SAAY,GAAA,gBAAA,CAAA;AAEpB,EAAA,OAAA,CAAQ,UAAU,CAAG,EAAA,CAAA,EAAG,KAAM,CAAA,KAAA,EAAO,MAAM,MAAM,CAAA,CAAA;AACjD,EAAQ,OAAA,CAAA,SAAA,CAAU,KAAO,EAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AAG7B,EAAAA,qBAAA,CAAW,uBAAuB,gBAAgB,CAAA,CAAA;AAGlD,EAAA,OAAO,gBAAiB,CAAA,MAAA,CAAA;AAC5B;;;;"}
|
18
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.mjs
generated
vendored
Normal file
18
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool.mjs';
|
||||
|
||||
"use strict";
|
||||
function getTemporaryCanvasFromImage(image, resolution) {
|
||||
const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(
|
||||
image.width,
|
||||
image.height,
|
||||
resolution
|
||||
);
|
||||
const { context } = canvasAndContext;
|
||||
context.clearRect(0, 0, image.width, image.height);
|
||||
context.drawImage(image, 0, 0);
|
||||
CanvasPool.returnCanvasAndContext(canvasAndContext);
|
||||
return canvasAndContext.canvas;
|
||||
}
|
||||
|
||||
export { getTemporaryCanvasFromImage };
|
||||
//# sourceMappingURL=getTemporaryCanvasFromImage.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/getTemporaryCanvasFromImage.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getTemporaryCanvasFromImage.mjs","sources":["../../../../src/scene/text-html/utils/getTemporaryCanvasFromImage.ts"],"sourcesContent":["import { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool';\n\n/**\n * This function converts an image to a canvas, and returns the canvas.\n * It is used to convert images to canvases to work around a CORS issue where WebGPU cannot\n * upload an SVGImage to a texture.\n *\n * It uses the CanvasPool to get an optimal canvas and context, and then draws the image onto it.\n * This canvas is immediately returned to the CanvasPool for reuse, so use the result straight away!\n * (eg upload it to the GPU!)\n * @param image - The image to convert to a canvas.\n * @param resolution - The resolution of the canvas.\n */\nexport function getTemporaryCanvasFromImage(image: HTMLImageElement, resolution: number): HTMLCanvasElement\n{\n // Get an optimal canvas and context from the CanvasPool, based on the\n // dimensions of the image and the desired resolution.\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(\n image.width,\n image.height,\n resolution\n );\n\n // Clear the context of the canvas, and draw the image onto it.\n const { context } = canvasAndContext;\n\n context.clearRect(0, 0, image.width, image.height);\n context.drawImage(image, 0, 0);\n\n // Return the canvas and context to the CanvasPool.\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n\n // Return the canvas.\n return canvasAndContext.canvas as HTMLCanvasElement;\n}\n\n"],"names":[],"mappings":";;;AAagB,SAAA,2BAAA,CAA4B,OAAyB,UACrE,EAAA;AAGI,EAAA,MAAM,mBAAmB,UAAW,CAAA,0BAAA;AAAA,IAChC,KAAM,CAAA,KAAA;AAAA,IACN,KAAM,CAAA,MAAA;AAAA,IACN,UAAA;AAAA,GACJ,CAAA;AAGA,EAAM,MAAA,EAAE,SAAY,GAAA,gBAAA,CAAA;AAEpB,EAAA,OAAA,CAAQ,UAAU,CAAG,EAAA,CAAA,EAAG,KAAM,CAAA,KAAA,EAAO,MAAM,MAAM,CAAA,CAAA;AACjD,EAAQ,OAAA,CAAA,SAAA,CAAU,KAAO,EAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AAG7B,EAAA,UAAA,CAAW,uBAAuB,gBAAgB,CAAA,CAAA;AAGlD,EAAA,OAAO,gBAAiB,CAAA,MAAA,CAAA;AAC5B;;;;"}
|
6
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Resolves a font url to a base64 string
|
||||
* @param url - The url to load the font from
|
||||
* @returns - The font as a base64 string
|
||||
*/
|
||||
export declare function loadFontAsBase64(url: string): Promise<string>;
|
19
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.js
generated
vendored
Normal file
19
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var adapter = require('../../../environment/adapter.js');
|
||||
|
||||
"use strict";
|
||||
async function loadFontAsBase64(url) {
|
||||
const response = await adapter.DOMAdapter.get().fetch(url);
|
||||
const blob = await response.blob();
|
||||
const reader = new FileReader();
|
||||
const dataSrc = await new Promise((resolve, reject) => {
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = reject;
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
return dataSrc;
|
||||
}
|
||||
|
||||
exports.loadFontAsBase64 = loadFontAsBase64;
|
||||
//# sourceMappingURL=loadFontAsBase64.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadFontAsBase64.js","sources":["../../../../src/scene/text-html/utils/loadFontAsBase64.ts"],"sourcesContent":["import { DOMAdapter } from '../../../environment/adapter';\n\n/**\n * Resolves a font url to a base64 string\n * @param url - The url to load the font from\n * @returns - The font as a base64 string\n */\nexport async function loadFontAsBase64(url: string): Promise<string>\n{\n const response = await DOMAdapter.get().fetch(url);\n\n const blob = await response.blob();\n\n const reader = new FileReader();\n\n const dataSrc: string = await new Promise((resolve, reject) =>\n {\n reader.onloadend = () => resolve(reader.result as string);\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n\n return dataSrc;\n}\n"],"names":["DOMAdapter"],"mappings":";;;;;AAOA,eAAsB,iBAAiB,GACvC,EAAA;AACI,EAAA,MAAM,WAAW,MAAMA,kBAAA,CAAW,GAAI,EAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAEjD,EAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AAEjC,EAAM,MAAA,MAAA,GAAS,IAAI,UAAW,EAAA,CAAA;AAE9B,EAAA,MAAM,UAAkB,MAAM,IAAI,OAAQ,CAAA,CAAC,SAAS,MACpD,KAAA;AACI,IAAA,MAAA,CAAO,SAAY,GAAA,MAAM,OAAQ,CAAA,MAAA,CAAO,MAAgB,CAAA,CAAA;AACxD,IAAA,MAAA,CAAO,OAAU,GAAA,MAAA,CAAA;AACjB,IAAA,MAAA,CAAO,cAAc,IAAI,CAAA,CAAA;AAAA,GAC5B,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACX;;;;"}
|
17
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.mjs
generated
vendored
Normal file
17
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { DOMAdapter } from '../../../environment/adapter.mjs';
|
||||
|
||||
"use strict";
|
||||
async function loadFontAsBase64(url) {
|
||||
const response = await DOMAdapter.get().fetch(url);
|
||||
const blob = await response.blob();
|
||||
const reader = new FileReader();
|
||||
const dataSrc = await new Promise((resolve, reject) => {
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = reject;
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
return dataSrc;
|
||||
}
|
||||
|
||||
export { loadFontAsBase64 };
|
||||
//# sourceMappingURL=loadFontAsBase64.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontAsBase64.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadFontAsBase64.mjs","sources":["../../../../src/scene/text-html/utils/loadFontAsBase64.ts"],"sourcesContent":["import { DOMAdapter } from '../../../environment/adapter';\n\n/**\n * Resolves a font url to a base64 string\n * @param url - The url to load the font from\n * @returns - The font as a base64 string\n */\nexport async function loadFontAsBase64(url: string): Promise<string>\n{\n const response = await DOMAdapter.get().fetch(url);\n\n const blob = await response.blob();\n\n const reader = new FileReader();\n\n const dataSrc: string = await new Promise((resolve, reject) =>\n {\n reader.onloadend = () => resolve(reader.result as string);\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n\n return dataSrc;\n}\n"],"names":[],"mappings":";;;AAOA,eAAsB,iBAAiB,GACvC,EAAA;AACI,EAAA,MAAM,WAAW,MAAM,UAAA,CAAW,GAAI,EAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAEjD,EAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AAEjC,EAAM,MAAA,MAAA,GAAS,IAAI,UAAW,EAAA,CAAA;AAE9B,EAAA,MAAM,UAAkB,MAAM,IAAI,OAAQ,CAAA,CAAC,SAAS,MACpD,KAAA;AACI,IAAA,MAAA,CAAO,SAAY,GAAA,MAAM,OAAQ,CAAA,MAAA,CAAO,MAAgB,CAAA,CAAA;AACxD,IAAA,MAAA,CAAO,OAAU,GAAA,MAAA,CAAA;AACjB,IAAA,MAAA,CAAO,cAAc,IAAI,CAAA,CAAA;AAAA,GAC5B,CAAA,CAAA;AAED,EAAO,OAAA,OAAA,CAAA;AACX;;;;"}
|
13
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.d.ts
generated
vendored
Normal file
13
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface FontCSSStyleOptions {
|
||||
fontFamily: string | string[];
|
||||
fontWeight: string;
|
||||
fontStyle: string;
|
||||
}
|
||||
/**
|
||||
* This will take a font url and a style and return a css string that can be injected into a style tag
|
||||
* This will contain inlined base64 font and the font family information
|
||||
* @param style - the style to generate the css for
|
||||
* @param url - The url to load the font from
|
||||
* @returns - The css string
|
||||
*/
|
||||
export declare function loadFontCSS(style: FontCSSStyleOptions, url: string): Promise<string>;
|
17
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.js
generated
vendored
Normal file
17
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var loadFontAsBase64 = require('./loadFontAsBase64.js');
|
||||
|
||||
"use strict";
|
||||
async function loadFontCSS(style, url) {
|
||||
const dataSrc = await loadFontAsBase64.loadFontAsBase64(url);
|
||||
return `@font-face {
|
||||
font-family: "${style.fontFamily}";
|
||||
src: url('${dataSrc}');
|
||||
font-weight: ${style.fontWeight};
|
||||
font-style: ${style.fontStyle};
|
||||
}`;
|
||||
}
|
||||
|
||||
exports.loadFontCSS = loadFontCSS;
|
||||
//# sourceMappingURL=loadFontCSS.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadFontCSS.js","sources":["../../../../src/scene/text-html/utils/loadFontCSS.ts"],"sourcesContent":["import { loadFontAsBase64 } from './loadFontAsBase64';\n\nexport interface FontCSSStyleOptions\n{\n fontFamily: string | string[]\n fontWeight: string\n fontStyle: string\n}\n\n/**\n * This will take a font url and a style and return a css string that can be injected into a style tag\n * This will contain inlined base64 font and the font family information\n * @param style - the style to generate the css for\n * @param url - The url to load the font from\n * @returns - The css string\n */\nexport async function loadFontCSS(style: FontCSSStyleOptions, url: string): Promise<string>\n{\n const dataSrc = await loadFontAsBase64(url);\n\n return `@font-face {\n font-family: \"${style.fontFamily}\";\n src: url('${dataSrc}');\n font-weight: ${style.fontWeight};\n font-style: ${style.fontStyle};\n }`;\n}\n"],"names":["loadFontAsBase64"],"mappings":";;;;;AAgBsB,eAAA,WAAA,CAAY,OAA4B,GAC9D,EAAA;AACI,EAAM,MAAA,OAAA,GAAU,MAAMA,iCAAA,CAAiB,GAAG,CAAA,CAAA;AAE1C,EAAO,OAAA,CAAA;AAAA,sBAAA,EACa,MAAM,UAAU,CAAA;AAAA,kBAAA,EACpB,OAAO,CAAA;AAAA,qBAAA,EACJ,MAAM,UAAU,CAAA;AAAA,oBAAA,EACjB,MAAM,SAAS,CAAA;AAAA,KAAA,CAAA,CAAA;AAErC;;;;"}
|
15
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.mjs
generated
vendored
Normal file
15
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.mjs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { loadFontAsBase64 } from './loadFontAsBase64.mjs';
|
||||
|
||||
"use strict";
|
||||
async function loadFontCSS(style, url) {
|
||||
const dataSrc = await loadFontAsBase64(url);
|
||||
return `@font-face {
|
||||
font-family: "${style.fontFamily}";
|
||||
src: url('${dataSrc}');
|
||||
font-weight: ${style.fontWeight};
|
||||
font-style: ${style.fontStyle};
|
||||
}`;
|
||||
}
|
||||
|
||||
export { loadFontCSS };
|
||||
//# sourceMappingURL=loadFontCSS.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadFontCSS.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadFontCSS.mjs","sources":["../../../../src/scene/text-html/utils/loadFontCSS.ts"],"sourcesContent":["import { loadFontAsBase64 } from './loadFontAsBase64';\n\nexport interface FontCSSStyleOptions\n{\n fontFamily: string | string[]\n fontWeight: string\n fontStyle: string\n}\n\n/**\n * This will take a font url and a style and return a css string that can be injected into a style tag\n * This will contain inlined base64 font and the font family information\n * @param style - the style to generate the css for\n * @param url - The url to load the font from\n * @returns - The css string\n */\nexport async function loadFontCSS(style: FontCSSStyleOptions, url: string): Promise<string>\n{\n const dataSrc = await loadFontAsBase64(url);\n\n return `@font-face {\n font-family: \"${style.fontFamily}\";\n src: url('${dataSrc}');\n font-weight: ${style.fontWeight};\n font-style: ${style.fontStyle};\n }`;\n}\n"],"names":[],"mappings":";;;AAgBsB,eAAA,WAAA,CAAY,OAA4B,GAC9D,EAAA;AACI,EAAM,MAAA,OAAA,GAAU,MAAM,gBAAA,CAAiB,GAAG,CAAA,CAAA;AAE1C,EAAO,OAAA,CAAA;AAAA,sBAAA,EACa,MAAM,UAAU,CAAA;AAAA,kBAAA,EACpB,OAAO,CAAA;AAAA,qBAAA,EACJ,MAAM,UAAU,CAAA;AAAA,oBAAA,EACjB,MAAM,SAAS,CAAA;AAAA,KAAA,CAAA,CAAA;AAErC;;;;"}
|
11
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.d.ts
generated
vendored
Normal file
11
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* This function loads an SVG image into an HTMLImageElement.
|
||||
* The image can then be uploaded as texture to the GPU.
|
||||
* iOS has a bug where embedded fonts are not available immediately after the image loads,
|
||||
* so we wait an arbitrary amount of time before resolving the promise.
|
||||
* @param image - The image to load the SVG into
|
||||
* @param url - The url to load the SVG from
|
||||
* @param delay - Whether to delay the load
|
||||
* @returns - A promise that resolves when the image has loaded
|
||||
*/
|
||||
export declare function loadSVGImage(image: HTMLImageElement, url: string, delay: boolean): Promise<void>;
|
18
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.js
generated
vendored
Normal file
18
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function loadSVGImage(image, url, delay) {
|
||||
return new Promise(async (resolve) => {
|
||||
if (delay) {
|
||||
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
||||
}
|
||||
image.onload = () => {
|
||||
resolve();
|
||||
};
|
||||
image.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(url)}`;
|
||||
image.crossOrigin = "anonymous";
|
||||
});
|
||||
}
|
||||
|
||||
exports.loadSVGImage = loadSVGImage;
|
||||
//# sourceMappingURL=loadSVGImage.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadSVGImage.js","sources":["../../../../src/scene/text-html/utils/loadSVGImage.ts"],"sourcesContent":["/**\n * This function loads an SVG image into an HTMLImageElement.\n * The image can then be uploaded as texture to the GPU.\n * iOS has a bug where embedded fonts are not available immediately after the image loads,\n * so we wait an arbitrary amount of time before resolving the promise.\n * @param image - The image to load the SVG into\n * @param url - The url to load the SVG from\n * @param delay - Whether to delay the load\n * @returns - A promise that resolves when the image has loaded\n */\nexport function loadSVGImage(image: HTMLImageElement, url: string, delay: boolean)\n{\n return new Promise<void>(async (resolve) =>\n {\n // Safari has a known bug where embedded fonts are not available\n // immediately after the image loads, to compensate we wait an\n // arbitrary amount of time\n // @see https://bugs.webkit.org/show_bug.cgi?id=219770\n if (delay)\n {\n await new Promise<void>((resolve) => setTimeout(resolve, 100));\n }\n\n image.onload = () =>\n {\n resolve();\n };\n\n image.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(url)}`;\n image.crossOrigin = 'anonymous';\n });\n}\n"],"names":["resolve"],"mappings":";;;AAUgB,SAAA,YAAA,CAAa,KAAyB,EAAA,GAAA,EAAa,KACnE,EAAA;AACI,EAAO,OAAA,IAAI,OAAc,CAAA,OAAO,OAChC,KAAA;AAKI,IAAA,IAAI,KACJ,EAAA;AACI,MAAA,MAAM,IAAI,OAAc,CAAA,CAACA,aAAY,UAAWA,CAAAA,QAAAA,EAAS,GAAG,CAAC,CAAA,CAAA;AAAA,KACjE;AAEA,IAAA,KAAA,CAAM,SAAS,MACf;AACI,MAAQ,OAAA,EAAA,CAAA;AAAA,KACZ,CAAA;AAEA,IAAA,KAAA,CAAM,GAAM,GAAA,CAAA,gCAAA,EAAmC,kBAAmB,CAAA,GAAG,CAAC,CAAA,CAAA,CAAA;AACtE,IAAA,KAAA,CAAM,WAAc,GAAA,WAAA,CAAA;AAAA,GACvB,CAAA,CAAA;AACL;;;;"}
|
16
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.mjs
generated
vendored
Normal file
16
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
function loadSVGImage(image, url, delay) {
|
||||
return new Promise(async (resolve) => {
|
||||
if (delay) {
|
||||
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
||||
}
|
||||
image.onload = () => {
|
||||
resolve();
|
||||
};
|
||||
image.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(url)}`;
|
||||
image.crossOrigin = "anonymous";
|
||||
});
|
||||
}
|
||||
|
||||
export { loadSVGImage };
|
||||
//# sourceMappingURL=loadSVGImage.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/loadSVGImage.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadSVGImage.mjs","sources":["../../../../src/scene/text-html/utils/loadSVGImage.ts"],"sourcesContent":["/**\n * This function loads an SVG image into an HTMLImageElement.\n * The image can then be uploaded as texture to the GPU.\n * iOS has a bug where embedded fonts are not available immediately after the image loads,\n * so we wait an arbitrary amount of time before resolving the promise.\n * @param image - The image to load the SVG into\n * @param url - The url to load the SVG from\n * @param delay - Whether to delay the load\n * @returns - A promise that resolves when the image has loaded\n */\nexport function loadSVGImage(image: HTMLImageElement, url: string, delay: boolean)\n{\n return new Promise<void>(async (resolve) =>\n {\n // Safari has a known bug where embedded fonts are not available\n // immediately after the image loads, to compensate we wait an\n // arbitrary amount of time\n // @see https://bugs.webkit.org/show_bug.cgi?id=219770\n if (delay)\n {\n await new Promise<void>((resolve) => setTimeout(resolve, 100));\n }\n\n image.onload = () =>\n {\n resolve();\n };\n\n image.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(url)}`;\n image.crossOrigin = 'anonymous';\n });\n}\n"],"names":["resolve"],"mappings":";AAUgB,SAAA,YAAA,CAAa,KAAyB,EAAA,GAAA,EAAa,KACnE,EAAA;AACI,EAAO,OAAA,IAAI,OAAc,CAAA,OAAO,OAChC,KAAA;AAKI,IAAA,IAAI,KACJ,EAAA;AACI,MAAA,MAAM,IAAI,OAAc,CAAA,CAACA,aAAY,UAAWA,CAAAA,QAAAA,EAAS,GAAG,CAAC,CAAA,CAAA;AAAA,KACjE;AAEA,IAAA,KAAA,CAAM,SAAS,MACf;AACI,MAAQ,OAAA,EAAA,CAAA;AAAA,KACZ,CAAA;AAEA,IAAA,KAAA,CAAM,GAAM,GAAA,CAAA,gCAAA,EAAmC,kBAAmB,CAAA,GAAG,CAAC,CAAA,CAAA,CAAA;AACtE,IAAA,KAAA,CAAM,WAAc,GAAA,WAAA,CAAA;AAAA,GACvB,CAAA,CAAA;AACL;;;;"}
|
13
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.d.ts
generated
vendored
Normal file
13
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { HTMLTextRenderData } from '../HTMLTextRenderData';
|
||||
import type { Size } from '../../../maths/misc/Size';
|
||||
import type { HTMLTextStyle } from '../HtmlTextStyle';
|
||||
/**
|
||||
* Measures the HTML text without actually generating an image.
|
||||
* This is used to calculate the size of the text.
|
||||
* @param text - The text to measure
|
||||
* @param style - The style to use
|
||||
* @param fontStyleCSS - The font css to use
|
||||
* @param htmlTextRenderData - The HTMLTextRenderData to write the SVG to
|
||||
* @returns - The size of the text
|
||||
*/
|
||||
export declare function measureHtmlText(text: string, style: HTMLTextStyle, fontStyleCSS?: string, htmlTextRenderData?: HTMLTextRenderData): Size;
|
28
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.js
generated
vendored
Normal file
28
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var CanvasTextMetrics = require('../../text/canvas/CanvasTextMetrics.js');
|
||||
var HTMLTextRenderData = require('../HTMLTextRenderData.js');
|
||||
|
||||
"use strict";
|
||||
let tempHTMLTextRenderData;
|
||||
function measureHtmlText(text, style, fontStyleCSS, htmlTextRenderData) {
|
||||
htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData.HTMLTextRenderData());
|
||||
const { domElement, styleElement, svgRoot } = htmlTextRenderData;
|
||||
domElement.innerHTML = `<style>${style.cssStyle};</style><div style='padding:0'>${text}</div>`;
|
||||
domElement.setAttribute("style", "transform-origin: top left; display: inline-block");
|
||||
if (fontStyleCSS) {
|
||||
styleElement.textContent = fontStyleCSS;
|
||||
}
|
||||
document.body.appendChild(svgRoot);
|
||||
const contentBounds = domElement.getBoundingClientRect();
|
||||
svgRoot.remove();
|
||||
const descenderPadding = CanvasTextMetrics.CanvasTextMetrics.measureFont(style.fontStyle).descent;
|
||||
const doublePadding = style.padding * 2;
|
||||
return {
|
||||
width: contentBounds.width - doublePadding,
|
||||
height: contentBounds.height + descenderPadding - doublePadding
|
||||
};
|
||||
}
|
||||
|
||||
exports.measureHtmlText = measureHtmlText;
|
||||
//# sourceMappingURL=measureHtmlText.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"measureHtmlText.js","sources":["../../../../src/scene/text-html/utils/measureHtmlText.ts"],"sourcesContent":["import { CanvasTextMetrics } from '../../text/canvas/CanvasTextMetrics';\nimport { HTMLTextRenderData } from '../HTMLTextRenderData';\n\nimport type { Size } from '../../../maths/misc/Size';\nimport type { HTMLTextStyle } from '../HtmlTextStyle';\n\nlet tempHTMLTextRenderData: HTMLTextRenderData;\n\n/**\n * Measures the HTML text without actually generating an image.\n * This is used to calculate the size of the text.\n * @param text - The text to measure\n * @param style - The style to use\n * @param fontStyleCSS - The font css to use\n * @param htmlTextRenderData - The HTMLTextRenderData to write the SVG to\n * @returns - The size of the text\n */\nexport function measureHtmlText(\n text: string,\n style: HTMLTextStyle,\n fontStyleCSS?: string,\n htmlTextRenderData?: HTMLTextRenderData\n): Size\n{\n htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData());\n\n const { domElement, styleElement, svgRoot } = htmlTextRenderData;\n\n domElement.innerHTML = `<style>${style.cssStyle};</style><div style='padding:0'>${text}</div>`;\n\n domElement.setAttribute('style', 'transform-origin: top left; display: inline-block');\n\n if (fontStyleCSS)\n {\n styleElement.textContent = fontStyleCSS;\n }\n\n // Measure the contents using the shadow DOM\n document.body.appendChild(svgRoot);\n\n const contentBounds = domElement.getBoundingClientRect();\n\n svgRoot.remove();\n\n const descenderPadding = CanvasTextMetrics.measureFont(style.fontStyle).descent;\n\n // padding is included in the CSS calculation, so we need to remove it here\n const doublePadding = style.padding * 2;\n\n return {\n width: contentBounds.width - doublePadding,\n height: contentBounds.height + descenderPadding - doublePadding,\n };\n}\n"],"names":["HTMLTextRenderData","CanvasTextMetrics"],"mappings":";;;;;;AAMA,IAAI,sBAAA,CAAA;AAWG,SAAS,eACZ,CAAA,IAAA,EACA,KACA,EAAA,YAAA,EACA,kBAEJ,EAAA;AACI,EAAA,kBAAA,GAAqB,kBAAsB,IAAA,sBAAA,KAA2B,sBAAyB,GAAA,IAAIA,qCAAmB,EAAA,CAAA,CAAA;AAEtH,EAAA,MAAM,EAAE,UAAA,EAAY,YAAc,EAAA,OAAA,EAAY,GAAA,kBAAA,CAAA;AAE9C,EAAA,UAAA,CAAW,SAAY,GAAA,CAAA,OAAA,EAAU,KAAM,CAAA,QAAQ,mCAAmC,IAAI,CAAA,MAAA,CAAA,CAAA;AAEtF,EAAW,UAAA,CAAA,YAAA,CAAa,SAAS,mDAAmD,CAAA,CAAA;AAEpF,EAAA,IAAI,YACJ,EAAA;AACI,IAAA,YAAA,CAAa,WAAc,GAAA,YAAA,CAAA;AAAA,GAC/B;AAGA,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,OAAO,CAAA,CAAA;AAEjC,EAAM,MAAA,aAAA,GAAgB,WAAW,qBAAsB,EAAA,CAAA;AAEvD,EAAA,OAAA,CAAQ,MAAO,EAAA,CAAA;AAEf,EAAA,MAAM,gBAAmB,GAAAC,mCAAA,CAAkB,WAAY,CAAA,KAAA,CAAM,SAAS,CAAE,CAAA,OAAA,CAAA;AAGxE,EAAM,MAAA,aAAA,GAAgB,MAAM,OAAU,GAAA,CAAA,CAAA;AAEtC,EAAO,OAAA;AAAA,IACH,KAAA,EAAO,cAAc,KAAQ,GAAA,aAAA;AAAA,IAC7B,MAAA,EAAQ,aAAc,CAAA,MAAA,GAAS,gBAAmB,GAAA,aAAA;AAAA,GACtD,CAAA;AACJ;;;;"}
|
26
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.mjs
generated
vendored
Normal file
26
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.mjs
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { CanvasTextMetrics } from '../../text/canvas/CanvasTextMetrics.mjs';
|
||||
import { HTMLTextRenderData } from '../HTMLTextRenderData.mjs';
|
||||
|
||||
"use strict";
|
||||
let tempHTMLTextRenderData;
|
||||
function measureHtmlText(text, style, fontStyleCSS, htmlTextRenderData) {
|
||||
htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData());
|
||||
const { domElement, styleElement, svgRoot } = htmlTextRenderData;
|
||||
domElement.innerHTML = `<style>${style.cssStyle};</style><div style='padding:0'>${text}</div>`;
|
||||
domElement.setAttribute("style", "transform-origin: top left; display: inline-block");
|
||||
if (fontStyleCSS) {
|
||||
styleElement.textContent = fontStyleCSS;
|
||||
}
|
||||
document.body.appendChild(svgRoot);
|
||||
const contentBounds = domElement.getBoundingClientRect();
|
||||
svgRoot.remove();
|
||||
const descenderPadding = CanvasTextMetrics.measureFont(style.fontStyle).descent;
|
||||
const doublePadding = style.padding * 2;
|
||||
return {
|
||||
width: contentBounds.width - doublePadding,
|
||||
height: contentBounds.height + descenderPadding - doublePadding
|
||||
};
|
||||
}
|
||||
|
||||
export { measureHtmlText };
|
||||
//# sourceMappingURL=measureHtmlText.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/measureHtmlText.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"measureHtmlText.mjs","sources":["../../../../src/scene/text-html/utils/measureHtmlText.ts"],"sourcesContent":["import { CanvasTextMetrics } from '../../text/canvas/CanvasTextMetrics';\nimport { HTMLTextRenderData } from '../HTMLTextRenderData';\n\nimport type { Size } from '../../../maths/misc/Size';\nimport type { HTMLTextStyle } from '../HtmlTextStyle';\n\nlet tempHTMLTextRenderData: HTMLTextRenderData;\n\n/**\n * Measures the HTML text without actually generating an image.\n * This is used to calculate the size of the text.\n * @param text - The text to measure\n * @param style - The style to use\n * @param fontStyleCSS - The font css to use\n * @param htmlTextRenderData - The HTMLTextRenderData to write the SVG to\n * @returns - The size of the text\n */\nexport function measureHtmlText(\n text: string,\n style: HTMLTextStyle,\n fontStyleCSS?: string,\n htmlTextRenderData?: HTMLTextRenderData\n): Size\n{\n htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextRenderData());\n\n const { domElement, styleElement, svgRoot } = htmlTextRenderData;\n\n domElement.innerHTML = `<style>${style.cssStyle};</style><div style='padding:0'>${text}</div>`;\n\n domElement.setAttribute('style', 'transform-origin: top left; display: inline-block');\n\n if (fontStyleCSS)\n {\n styleElement.textContent = fontStyleCSS;\n }\n\n // Measure the contents using the shadow DOM\n document.body.appendChild(svgRoot);\n\n const contentBounds = domElement.getBoundingClientRect();\n\n svgRoot.remove();\n\n const descenderPadding = CanvasTextMetrics.measureFont(style.fontStyle).descent;\n\n // padding is included in the CSS calculation, so we need to remove it here\n const doublePadding = style.padding * 2;\n\n return {\n width: contentBounds.width - doublePadding,\n height: contentBounds.height + descenderPadding - doublePadding,\n };\n}\n"],"names":[],"mappings":";;;;AAMA,IAAI,sBAAA,CAAA;AAWG,SAAS,eACZ,CAAA,IAAA,EACA,KACA,EAAA,YAAA,EACA,kBAEJ,EAAA;AACI,EAAA,kBAAA,GAAqB,kBAAsB,IAAA,sBAAA,KAA2B,sBAAyB,GAAA,IAAI,kBAAmB,EAAA,CAAA,CAAA;AAEtH,EAAA,MAAM,EAAE,UAAA,EAAY,YAAc,EAAA,OAAA,EAAY,GAAA,kBAAA,CAAA;AAE9C,EAAA,UAAA,CAAW,SAAY,GAAA,CAAA,OAAA,EAAU,KAAM,CAAA,QAAQ,mCAAmC,IAAI,CAAA,MAAA,CAAA,CAAA;AAEtF,EAAW,UAAA,CAAA,YAAA,CAAa,SAAS,mDAAmD,CAAA,CAAA;AAEpF,EAAA,IAAI,YACJ,EAAA;AACI,IAAA,YAAA,CAAa,WAAc,GAAA,YAAA,CAAA;AAAA,GAC/B;AAGA,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,OAAO,CAAA,CAAA;AAEjC,EAAM,MAAA,aAAA,GAAgB,WAAW,qBAAsB,EAAA,CAAA;AAEvD,EAAA,OAAA,CAAQ,MAAO,EAAA,CAAA;AAEf,EAAA,MAAM,gBAAmB,GAAA,iBAAA,CAAkB,WAAY,CAAA,KAAA,CAAM,SAAS,CAAE,CAAA,OAAA,CAAA;AAGxE,EAAM,MAAA,aAAA,GAAgB,MAAM,OAAU,GAAA,CAAA,CAAA;AAEtC,EAAO,OAAA;AAAA,IACH,KAAA,EAAO,cAAc,KAAQ,GAAA,aAAA;AAAA,IAC7B,MAAA,EAAQ,aAAc,CAAA,MAAA,GAAS,gBAAmB,GAAA,aAAA;AAAA,GACtD,CAAA;AACJ;;;;"}
|
7
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.d.ts
generated
vendored
Normal file
7
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { HTMLTextStyle } from '../HtmlTextStyle';
|
||||
/**
|
||||
* Internally converts all of the style properties into CSS equivalents.
|
||||
* @param style
|
||||
* @returns The CSS style string, for setting `style` property of root HTMLElement.
|
||||
*/
|
||||
export declare function textStyleToCSS(style: HTMLTextStyle): string;
|
87
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.js
generated
vendored
Normal file
87
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
'use strict';
|
||||
|
||||
var Color = require('../../../color/Color.js');
|
||||
|
||||
"use strict";
|
||||
function textStyleToCSS(style) {
|
||||
const stroke = style._stroke;
|
||||
const fill = style._fill;
|
||||
const cssStyleString = [
|
||||
`color: ${Color.Color.shared.setValue(fill.color).toHex()}`,
|
||||
`font-size: ${style.fontSize}px`,
|
||||
`font-family: ${style.fontFamily}`,
|
||||
`font-weight: ${style.fontWeight}`,
|
||||
`font-style: ${style.fontStyle}`,
|
||||
`font-variant: ${style.fontVariant}`,
|
||||
`letter-spacing: ${style.letterSpacing}px`,
|
||||
`text-align: ${style.align}`,
|
||||
`padding: ${style.padding}px`,
|
||||
`white-space: ${style.whiteSpace === "pre" && style.wordWrap ? "pre-wrap" : style.whiteSpace}`,
|
||||
...style.lineHeight ? [`line-height: ${style.lineHeight}px`] : [],
|
||||
...style.wordWrap ? [
|
||||
`word-wrap: ${style.breakWords ? "break-all" : "break-word"}`,
|
||||
`max-width: ${style.wordWrapWidth}px`
|
||||
] : [],
|
||||
...stroke ? [strokeToCSS(stroke)] : [],
|
||||
...style.dropShadow ? [dropShadowToCSS(style.dropShadow)] : [],
|
||||
...style.cssOverrides
|
||||
].join(";");
|
||||
const cssStyles = [`div { ${cssStyleString} }`];
|
||||
tagStyleToCSS(style.tagStyles, cssStyles);
|
||||
return cssStyles.join(" ");
|
||||
}
|
||||
function dropShadowToCSS(dropShadowStyle) {
|
||||
const color = Color.Color.shared.setValue(dropShadowStyle.color).setAlpha(dropShadowStyle.alpha).toHexa();
|
||||
const x = Math.round(Math.cos(dropShadowStyle.angle) * dropShadowStyle.distance);
|
||||
const y = Math.round(Math.sin(dropShadowStyle.angle) * dropShadowStyle.distance);
|
||||
const position = `${x}px ${y}px`;
|
||||
if (dropShadowStyle.blur > 0) {
|
||||
return `text-shadow: ${position} ${dropShadowStyle.blur}px ${color}`;
|
||||
}
|
||||
return `text-shadow: ${position} ${color}`;
|
||||
}
|
||||
function strokeToCSS(stroke) {
|
||||
return [
|
||||
`-webkit-text-stroke-width: ${stroke.width}px`,
|
||||
`-webkit-text-stroke-color: ${Color.Color.shared.setValue(stroke.color).toHex()}`,
|
||||
`text-stroke-width: ${stroke.width}px`,
|
||||
`text-stroke-color: ${Color.Color.shared.setValue(stroke.color).toHex()}`,
|
||||
"paint-order: stroke"
|
||||
].join(";");
|
||||
}
|
||||
const templates = {
|
||||
fontSize: `font-size: {{VALUE}}px`,
|
||||
fontFamily: `font-family: {{VALUE}}`,
|
||||
fontWeight: `font-weight: {{VALUE}}`,
|
||||
fontStyle: `font-style: {{VALUE}}`,
|
||||
fontVariant: `font-variant: {{VALUE}}`,
|
||||
letterSpacing: `letter-spacing: {{VALUE}}px`,
|
||||
align: `text-align: {{VALUE}}`,
|
||||
padding: `padding: {{VALUE}}px`,
|
||||
whiteSpace: `white-space: {{VALUE}}`,
|
||||
lineHeight: `line-height: {{VALUE}}px`,
|
||||
wordWrapWidth: `max-width: {{VALUE}}px`
|
||||
};
|
||||
const transform = {
|
||||
fill: (value) => `color: ${Color.Color.shared.setValue(value).toHex()}`,
|
||||
breakWords: (value) => `word-wrap: ${value ? "break-all" : "break-word"}`,
|
||||
stroke: strokeToCSS,
|
||||
dropShadow: dropShadowToCSS
|
||||
};
|
||||
function tagStyleToCSS(tagStyles, out) {
|
||||
for (const i in tagStyles) {
|
||||
const tagStyle = tagStyles[i];
|
||||
const cssTagStyle = [];
|
||||
for (const j in tagStyle) {
|
||||
if (transform[j]) {
|
||||
cssTagStyle.push(transform[j](tagStyle[j]));
|
||||
} else if (templates[j]) {
|
||||
cssTagStyle.push(templates[j].replace("{{VALUE}}", tagStyle[j]));
|
||||
}
|
||||
}
|
||||
out.push(`${i} { ${cssTagStyle.join(";")} }`);
|
||||
}
|
||||
}
|
||||
|
||||
exports.textStyleToCSS = textStyleToCSS;
|
||||
//# sourceMappingURL=textStyleToCSS.js.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
85
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.mjs
generated
vendored
Normal file
85
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.mjs
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
import { Color } from '../../../color/Color.mjs';
|
||||
|
||||
"use strict";
|
||||
function textStyleToCSS(style) {
|
||||
const stroke = style._stroke;
|
||||
const fill = style._fill;
|
||||
const cssStyleString = [
|
||||
`color: ${Color.shared.setValue(fill.color).toHex()}`,
|
||||
`font-size: ${style.fontSize}px`,
|
||||
`font-family: ${style.fontFamily}`,
|
||||
`font-weight: ${style.fontWeight}`,
|
||||
`font-style: ${style.fontStyle}`,
|
||||
`font-variant: ${style.fontVariant}`,
|
||||
`letter-spacing: ${style.letterSpacing}px`,
|
||||
`text-align: ${style.align}`,
|
||||
`padding: ${style.padding}px`,
|
||||
`white-space: ${style.whiteSpace === "pre" && style.wordWrap ? "pre-wrap" : style.whiteSpace}`,
|
||||
...style.lineHeight ? [`line-height: ${style.lineHeight}px`] : [],
|
||||
...style.wordWrap ? [
|
||||
`word-wrap: ${style.breakWords ? "break-all" : "break-word"}`,
|
||||
`max-width: ${style.wordWrapWidth}px`
|
||||
] : [],
|
||||
...stroke ? [strokeToCSS(stroke)] : [],
|
||||
...style.dropShadow ? [dropShadowToCSS(style.dropShadow)] : [],
|
||||
...style.cssOverrides
|
||||
].join(";");
|
||||
const cssStyles = [`div { ${cssStyleString} }`];
|
||||
tagStyleToCSS(style.tagStyles, cssStyles);
|
||||
return cssStyles.join(" ");
|
||||
}
|
||||
function dropShadowToCSS(dropShadowStyle) {
|
||||
const color = Color.shared.setValue(dropShadowStyle.color).setAlpha(dropShadowStyle.alpha).toHexa();
|
||||
const x = Math.round(Math.cos(dropShadowStyle.angle) * dropShadowStyle.distance);
|
||||
const y = Math.round(Math.sin(dropShadowStyle.angle) * dropShadowStyle.distance);
|
||||
const position = `${x}px ${y}px`;
|
||||
if (dropShadowStyle.blur > 0) {
|
||||
return `text-shadow: ${position} ${dropShadowStyle.blur}px ${color}`;
|
||||
}
|
||||
return `text-shadow: ${position} ${color}`;
|
||||
}
|
||||
function strokeToCSS(stroke) {
|
||||
return [
|
||||
`-webkit-text-stroke-width: ${stroke.width}px`,
|
||||
`-webkit-text-stroke-color: ${Color.shared.setValue(stroke.color).toHex()}`,
|
||||
`text-stroke-width: ${stroke.width}px`,
|
||||
`text-stroke-color: ${Color.shared.setValue(stroke.color).toHex()}`,
|
||||
"paint-order: stroke"
|
||||
].join(";");
|
||||
}
|
||||
const templates = {
|
||||
fontSize: `font-size: {{VALUE}}px`,
|
||||
fontFamily: `font-family: {{VALUE}}`,
|
||||
fontWeight: `font-weight: {{VALUE}}`,
|
||||
fontStyle: `font-style: {{VALUE}}`,
|
||||
fontVariant: `font-variant: {{VALUE}}`,
|
||||
letterSpacing: `letter-spacing: {{VALUE}}px`,
|
||||
align: `text-align: {{VALUE}}`,
|
||||
padding: `padding: {{VALUE}}px`,
|
||||
whiteSpace: `white-space: {{VALUE}}`,
|
||||
lineHeight: `line-height: {{VALUE}}px`,
|
||||
wordWrapWidth: `max-width: {{VALUE}}px`
|
||||
};
|
||||
const transform = {
|
||||
fill: (value) => `color: ${Color.shared.setValue(value).toHex()}`,
|
||||
breakWords: (value) => `word-wrap: ${value ? "break-all" : "break-word"}`,
|
||||
stroke: strokeToCSS,
|
||||
dropShadow: dropShadowToCSS
|
||||
};
|
||||
function tagStyleToCSS(tagStyles, out) {
|
||||
for (const i in tagStyles) {
|
||||
const tagStyle = tagStyles[i];
|
||||
const cssTagStyle = [];
|
||||
for (const j in tagStyle) {
|
||||
if (transform[j]) {
|
||||
cssTagStyle.push(transform[j](tagStyle[j]));
|
||||
} else if (templates[j]) {
|
||||
cssTagStyle.push(templates[j].replace("{{VALUE}}", tagStyle[j]));
|
||||
}
|
||||
}
|
||||
out.push(`${i} { ${cssTagStyle.join(";")} }`);
|
||||
}
|
||||
}
|
||||
|
||||
export { textStyleToCSS };
|
||||
//# sourceMappingURL=textStyleToCSS.mjs.map
|
1
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/text-html/utils/textStyleToCSS.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user