@meframe/core 0.5.18 → 0.5.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontManager.d.ts","sourceRoot":"","sources":["../../../../src/stages/compose/font-system/FontManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,oBAAoB,EAAa,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"FontManager.d.ts","sourceRoot":"","sources":["../../../../src/stages/compose/font-system/FontManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,oBAAoB,EAAa,MAAM,SAAS,CAAC;AAiBvF,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAsC;IAEvD,aAAa,CACX,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,GACtB,oBAAoB;IAgBvB,OAAO,CAAC,gBAAgB;IAkCxB,UAAU,IAAI,IAAI;CAGnB;AAID,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,GACtB,oBAAoB,CAEtB;AAED,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
|
@@ -7,14 +7,6 @@ const SYSTEM_FONT_FALLBACKS = {
|
|
|
7
7
|
"ar-SA": '-apple-system, BlinkMacSystemFont, "Arabic UI Text", "Geeza Pro", sans-serif',
|
|
8
8
|
other: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif'
|
|
9
9
|
};
|
|
10
|
-
const PREFERRED_FONTS = {
|
|
11
|
-
"zh-CN": "dtjinbu",
|
|
12
|
-
"en-US": "dtjinbu",
|
|
13
|
-
"ja-JP": "dtjinbu",
|
|
14
|
-
"ko-KR": "dtjinbu",
|
|
15
|
-
"ar-SA": "dtjinbu",
|
|
16
|
-
other: "dtjinbu"
|
|
17
|
-
};
|
|
18
10
|
function quoteFontFamily(fontFamily) {
|
|
19
11
|
const escaped = fontFamily.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
20
12
|
return `"${escaped}"`;
|
|
@@ -36,7 +28,7 @@ class FontManager {
|
|
|
36
28
|
}
|
|
37
29
|
createFontConfig(locale, templateName, fontFamilyName) {
|
|
38
30
|
const template = getTemplate(templateName);
|
|
39
|
-
const fontFamily = fontFamilyName ? `${quoteFontFamily(fontFamilyName)}, ${SYSTEM_FONT_FALLBACKS[locale]}` :
|
|
31
|
+
const fontFamily = fontFamilyName ? `${quoteFontFamily(fontFamilyName)}, ${SYSTEM_FONT_FALLBACKS[locale]}` : SYSTEM_FONT_FALLBACKS[locale];
|
|
40
32
|
const textStyle = {
|
|
41
33
|
fontSize: template.textStyle?.fontSize || 40,
|
|
42
34
|
fontWeight: template.textStyle?.fontWeight || 400,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontManager.js","sources":["../../../../src/stages/compose/font-system/FontManager.ts"],"sourcesContent":["import type { LocaleCode, FontConfig, SerializedFontConfig, TextStyle } from './types';\nimport { getTemplate } from './font-templates';\n\nconst SYSTEM_FONT_FALLBACKS: Record<LocaleCode, string> = {\n 'zh-CN': '-apple-system, BlinkMacSystemFont, \"PingFang SC\", \"Microsoft YaHei\", sans-serif',\n 'en-US': '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif',\n 'ja-JP': '-apple-system, BlinkMacSystemFont, \"Hiragino Sans\", \"Yu Gothic\", sans-serif',\n 'ko-KR': '-apple-system, BlinkMacSystemFont, \"Apple SD Gothic Neo\", \"Malgun Gothic\", sans-serif',\n 'ar-SA': '-apple-system, BlinkMacSystemFont, \"Arabic UI Text\", \"Geeza Pro\", sans-serif',\n other: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif',\n};\n\
|
|
1
|
+
{"version":3,"file":"FontManager.js","sources":["../../../../src/stages/compose/font-system/FontManager.ts"],"sourcesContent":["import type { LocaleCode, FontConfig, SerializedFontConfig, TextStyle } from './types';\nimport { getTemplate } from './font-templates';\n\nconst SYSTEM_FONT_FALLBACKS: Record<LocaleCode, string> = {\n 'zh-CN': '-apple-system, BlinkMacSystemFont, \"PingFang SC\", \"Microsoft YaHei\", sans-serif',\n 'en-US': '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif',\n 'ja-JP': '-apple-system, BlinkMacSystemFont, \"Hiragino Sans\", \"Yu Gothic\", sans-serif',\n 'ko-KR': '-apple-system, BlinkMacSystemFont, \"Apple SD Gothic Neo\", \"Malgun Gothic\", sans-serif',\n 'ar-SA': '-apple-system, BlinkMacSystemFont, \"Arabic UI Text\", \"Geeza Pro\", sans-serif',\n other: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif',\n};\n\nfunction quoteFontFamily(fontFamily: string): string {\n const escaped = fontFamily.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return `\"${escaped}\"`;\n}\n\nexport class FontManager {\n private fontCache: Map<string, FontConfig> = new Map();\n\n getFontConfig(\n locale: LocaleCode,\n templateName: string,\n fontFamilyName?: string\n ): SerializedFontConfig {\n const cacheKey = `${locale}-${templateName}-${fontFamilyName || 'default'}`;\n\n let config = this.fontCache.get(cacheKey);\n if (!config) {\n config = this.createFontConfig(locale, templateName, fontFamilyName);\n this.fontCache.set(cacheKey, config);\n }\n\n return {\n textStyle: { ...config.textStyle },\n containerStyle: config.containerStyle ? { ...config.containerStyle } : undefined,\n globalPosition: config.globalPosition ? { ...config.globalPosition } : undefined,\n };\n }\n\n private createFontConfig(\n locale: LocaleCode,\n templateName: string,\n fontFamilyName?: string\n ): FontConfig {\n const template = getTemplate(templateName);\n\n const fontFamily = fontFamilyName\n ? `${quoteFontFamily(fontFamilyName)}, ${SYSTEM_FONT_FALLBACKS[locale]}`\n : SYSTEM_FONT_FALLBACKS[locale];\n\n const textStyle: TextStyle = {\n fontSize: template.textStyle?.fontSize || 40,\n fontWeight: template.textStyle?.fontWeight || 400,\n fontFamily: fontFamilyName ? fontFamily : template.textStyle?.fontFamily || fontFamily,\n fill: template.textStyle?.fill || 'rgb(255, 255, 255)',\n strokeColor: template.textStyle?.strokeColor,\n strokeWidth: template.textStyle?.strokeWidth,\n letterSpacing: template.textStyle?.letterSpacing || 0,\n lineHeight: template.textStyle?.lineHeight || 1.2,\n paintOrder: template.textStyle?.paintOrder,\n strokeLinejoin: template.textStyle?.strokeLinejoin,\n strokeLinecap: template.textStyle?.strokeLinecap,\n };\n\n return {\n familyName: fontFamily,\n locales: [locale],\n textStyle,\n containerStyle: template.containerStyle,\n globalPosition: template.globalPosition,\n };\n }\n\n clearCache(): void {\n this.fontCache.clear();\n }\n}\n\nconst fontManagerInstance = new FontManager();\n\nexport function getFontConfig(\n locale: LocaleCode,\n templateName: string,\n fontFamilyName?: string\n): SerializedFontConfig {\n return fontManagerInstance.getFontConfig(locale, templateName, fontFamilyName);\n}\n\nexport function clearFontCache(): void {\n fontManagerInstance.clearCache();\n}\n"],"names":[],"mappings":";AAGA,MAAM,wBAAoD;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT;AAEA,SAAS,gBAAgB,YAA4B;AACnD,QAAM,UAAU,WAAW,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAK;AACrE,SAAO,IAAI,OAAO;AACpB;AAEO,MAAM,YAAY;AAAA,EACf,gCAAyC,IAAA;AAAA,EAEjD,cACE,QACA,cACA,gBACsB;AACtB,UAAM,WAAW,GAAG,MAAM,IAAI,YAAY,IAAI,kBAAkB,SAAS;AAEzE,QAAI,SAAS,KAAK,UAAU,IAAI,QAAQ;AACxC,QAAI,CAAC,QAAQ;AACX,eAAS,KAAK,iBAAiB,QAAQ,cAAc,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
|
|
2
2
|
"name": "@meframe/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.19",
|
|
4
4
|
"description": "Next generation media processing framework based on WebCodecs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,27 +43,6 @@
|
|
|
43
43
|
"LICENSE",
|
|
44
44
|
"CHANGELOG.md"
|
|
45
45
|
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"dev": "vite",
|
|
48
|
-
"build": "tsc && vite build && pnpm build:workers && pnpm build:node-cjs",
|
|
49
|
-
"build:workers": "vite build --config vite.worker.config.ts && node scripts/generate-worker-manifest.js",
|
|
50
|
-
"build:node-cjs": "node scripts/generate-node-cjs.js",
|
|
51
|
-
"preview": "vite preview",
|
|
52
|
-
"prepublishOnly": "npm run lint && npm run type-check && npm run build",
|
|
53
|
-
"test": "vitest run",
|
|
54
|
-
"test:watch": "vitest",
|
|
55
|
-
"test:coverage": "vitest run --coverage",
|
|
56
|
-
"test:ui": "vitest --ui",
|
|
57
|
-
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
58
|
-
"test:e2e": "playwright test --project=chromium",
|
|
59
|
-
"test:e2e:ui": "playwright test --project=chromium --ui",
|
|
60
|
-
"test:e2e:debug": "playwright test --project=chromium --debug",
|
|
61
|
-
"lint": "eslint src --ignore-pattern '**/__tests__' --ignore-pattern '**/*.test.ts' --ignore-pattern '**/*.spec.ts' --ignore-pattern '**/*.worker.ts'",
|
|
62
|
-
"lint:fix": "eslint src --fix --ignore-pattern '**/__tests__' --ignore-pattern '**/*.test.ts' --ignore-pattern '**/*.spec.ts' --ignore-pattern '**/*.worker.ts'",
|
|
63
|
-
"type-check": "tsc --noEmit",
|
|
64
|
-
"clean": "rm -rf dist coverage",
|
|
65
|
-
"playwright:install": "playwright install chromium"
|
|
66
|
-
},
|
|
67
46
|
"dependencies": {
|
|
68
47
|
"mp4-muxer": "^5.2.2",
|
|
69
48
|
"mp4box": "^0.5.2",
|
|
@@ -116,5 +95,25 @@
|
|
|
116
95
|
"publishConfig": {
|
|
117
96
|
"access": "public",
|
|
118
97
|
"registry": "https://registry.npmjs.org/"
|
|
98
|
+
},
|
|
99
|
+
"scripts": {
|
|
100
|
+
"dev": "vite",
|
|
101
|
+
"build": "tsc && vite build && pnpm build:workers && pnpm build:node-cjs",
|
|
102
|
+
"build:workers": "vite build --config vite.worker.config.ts && node scripts/generate-worker-manifest.js",
|
|
103
|
+
"build:node-cjs": "node scripts/generate-node-cjs.js",
|
|
104
|
+
"preview": "vite preview",
|
|
105
|
+
"test": "vitest run",
|
|
106
|
+
"test:watch": "vitest",
|
|
107
|
+
"test:coverage": "vitest run --coverage",
|
|
108
|
+
"test:ui": "vitest --ui",
|
|
109
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
110
|
+
"test:e2e": "playwright test --project=chromium",
|
|
111
|
+
"test:e2e:ui": "playwright test --project=chromium --ui",
|
|
112
|
+
"test:e2e:debug": "playwright test --project=chromium --debug",
|
|
113
|
+
"lint": "eslint src --ignore-pattern '**/__tests__' --ignore-pattern '**/*.test.ts' --ignore-pattern '**/*.spec.ts' --ignore-pattern '**/*.worker.ts'",
|
|
114
|
+
"lint:fix": "eslint src --fix --ignore-pattern '**/__tests__' --ignore-pattern '**/*.test.ts' --ignore-pattern '**/*.spec.ts' --ignore-pattern '**/*.worker.ts'",
|
|
115
|
+
"type-check": "tsc --noEmit",
|
|
116
|
+
"clean": "rm -rf dist coverage",
|
|
117
|
+
"playwright:install": "playwright install chromium"
|
|
119
118
|
}
|
|
120
|
-
}
|
|
119
|
+
}
|