@meframe/core 0.0.19 → 0.0.20

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.
Files changed (55) hide show
  1. package/dist/config/types.d.ts +4 -0
  2. package/dist/config/types.d.ts.map +1 -1
  3. package/dist/model/types.d.ts +18 -0
  4. package/dist/model/types.d.ts.map +1 -1
  5. package/dist/model/types.js.map +1 -1
  6. package/dist/orchestrator/CompositionPlanner.d.ts +1 -0
  7. package/dist/orchestrator/CompositionPlanner.d.ts.map +1 -1
  8. package/dist/orchestrator/CompositionPlanner.js +36 -10
  9. package/dist/orchestrator/CompositionPlanner.js.map +1 -1
  10. package/dist/orchestrator/Orchestrator.d.ts.map +1 -1
  11. package/dist/orchestrator/Orchestrator.js +2 -1
  12. package/dist/orchestrator/Orchestrator.js.map +1 -1
  13. package/dist/stages/compose/LayerRenderer.d.ts +4 -7
  14. package/dist/stages/compose/LayerRenderer.d.ts.map +1 -1
  15. package/dist/stages/compose/VideoComposer.d.ts +1 -0
  16. package/dist/stages/compose/VideoComposer.d.ts.map +1 -1
  17. package/dist/stages/compose/font-system/FontManager.d.ts +11 -0
  18. package/dist/stages/compose/font-system/FontManager.d.ts.map +1 -0
  19. package/dist/stages/compose/font-system/FontManager.js +69 -0
  20. package/dist/stages/compose/font-system/FontManager.js.map +1 -0
  21. package/dist/stages/compose/font-system/font-templates.d.ts +12 -0
  22. package/dist/stages/compose/font-system/font-templates.d.ts.map +1 -0
  23. package/dist/stages/compose/font-system/font-templates.js +384 -0
  24. package/dist/stages/compose/font-system/font-templates.js.map +1 -0
  25. package/dist/stages/compose/font-system/index.d.ts +5 -0
  26. package/dist/stages/compose/font-system/index.d.ts.map +1 -0
  27. package/dist/stages/compose/font-system/types.d.ts +60 -0
  28. package/dist/stages/compose/font-system/types.d.ts.map +1 -0
  29. package/dist/stages/compose/instructions.d.ts +50 -0
  30. package/dist/stages/compose/instructions.d.ts.map +1 -1
  31. package/dist/stages/compose/text-renderers/animation-utils.d.ts +16 -0
  32. package/dist/stages/compose/text-renderers/animation-utils.d.ts.map +1 -0
  33. package/dist/stages/compose/text-renderers/basic-text-renderer.d.ts +5 -0
  34. package/dist/stages/compose/text-renderers/basic-text-renderer.d.ts.map +1 -0
  35. package/dist/stages/compose/text-renderers/character-ktv-renderer.d.ts +4 -0
  36. package/dist/stages/compose/text-renderers/character-ktv-renderer.d.ts.map +1 -0
  37. package/dist/stages/compose/text-renderers/index.d.ts +6 -0
  38. package/dist/stages/compose/text-renderers/index.d.ts.map +1 -0
  39. package/dist/stages/compose/text-renderers/word-by-word-renderer.d.ts +4 -0
  40. package/dist/stages/compose/text-renderers/word-by-word-renderer.d.ts.map +1 -0
  41. package/dist/stages/compose/text-renderers/word-fancy-renderer.d.ts +4 -0
  42. package/dist/stages/compose/text-renderers/word-fancy-renderer.d.ts.map +1 -0
  43. package/dist/stages/compose/text-utils/index.d.ts +4 -0
  44. package/dist/stages/compose/text-utils/index.d.ts.map +1 -0
  45. package/dist/stages/compose/text-utils/locale-detector.d.ts +5 -0
  46. package/dist/stages/compose/text-utils/locale-detector.d.ts.map +1 -0
  47. package/dist/stages/compose/text-utils/text-metrics.d.ts +3 -0
  48. package/dist/stages/compose/text-utils/text-metrics.d.ts.map +1 -0
  49. package/dist/stages/compose/text-utils/text-wrapper.d.ts +4 -0
  50. package/dist/stages/compose/text-utils/text-wrapper.d.ts.map +1 -0
  51. package/dist/stages/compose/types.d.ts +51 -1
  52. package/dist/stages/compose/types.d.ts.map +1 -1
  53. package/dist/workers/stages/compose/video-compose.worker.js +838 -78
  54. package/dist/workers/stages/compose/video-compose.worker.js.map +1 -1
  55. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"VideoComposer.d.ts","sourceRoot":"","sources":["../../../src/stages/compose/VideoComposer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAGjB,MAAM,SAAS,CAAC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;IACtB,aAAa,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C,WAAW,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACxC,YAAY,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAEjC,OAAO,CAAC,GAAG,CAAoC;IAC/C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAyB;gBAEpC,MAAM,EAAE,kBAAkB;IAgCtC,OAAO,CAAC,aAAa;IAwBrB,aAAa,CAAC,YAAY,CAAC,EAAE,kBAAkB,GAAG,cAAc;IAqC1D,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAqE7D,iBAAiB,CACrB,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,cAAc,EACzB,UAAU,EAAE,gBAAgB,GAC3B,OAAO,CAAC,aAAa,CAAC;IAWzB,OAAO,CAAC,WAAW;YAaL,iBAAiB;YAWjB,SAAS;IAkBvB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAuBvD,OAAO,IAAI,IAAI;CAGhB"}
@@ -0,0 +1,11 @@
1
+ import { LocaleCode, SerializedFontConfig } from './types';
2
+
3
+ export declare class FontManager {
4
+ private fontCache;
5
+ getFontConfig(locale: LocaleCode, templateName: string, fontFamilyName?: string): SerializedFontConfig;
6
+ private createFontConfig;
7
+ clearCache(): void;
8
+ }
9
+ export declare function getFontConfig(locale: LocaleCode, templateName: string, fontFamilyName?: string): SerializedFontConfig;
10
+ export declare function clearFontCache(): void;
11
+ //# sourceMappingURL=FontManager.d.ts.map
@@ -0,0 +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;AAqBvF,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"}
@@ -0,0 +1,69 @@
1
+ import { getTemplate } from "./font-templates.js";
2
+ const SYSTEM_FONT_FALLBACKS = {
3
+ "zh-CN": '-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',
4
+ "en-US": '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif',
5
+ "ja-JP": '-apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif',
6
+ "ko-KR": '-apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif',
7
+ "ar-SA": '-apple-system, BlinkMacSystemFont, "Arabic UI Text", "Geeza Pro", sans-serif',
8
+ other: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif'
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
+ class FontManager {
19
+ fontCache = /* @__PURE__ */ new Map();
20
+ getFontConfig(locale, templateName, fontFamilyName) {
21
+ const cacheKey = `${locale}-${templateName}-${fontFamilyName || "default"}`;
22
+ let config = this.fontCache.get(cacheKey);
23
+ if (!config) {
24
+ config = this.createFontConfig(locale, templateName, fontFamilyName);
25
+ this.fontCache.set(cacheKey, config);
26
+ }
27
+ return {
28
+ textStyle: { ...config.textStyle },
29
+ containerStyle: config.containerStyle ? { ...config.containerStyle } : void 0,
30
+ globalPosition: config.globalPosition ? { ...config.globalPosition } : void 0
31
+ };
32
+ }
33
+ createFontConfig(locale, templateName, fontFamilyName) {
34
+ const template = getTemplate(templateName);
35
+ const fontFamily = fontFamilyName ? `${fontFamilyName}, ${SYSTEM_FONT_FALLBACKS[locale]}` : `${PREFERRED_FONTS[locale]}, ${SYSTEM_FONT_FALLBACKS[locale]}`;
36
+ const textStyle = {
37
+ fontSize: template.textStyle?.fontSize || 40,
38
+ fontWeight: template.textStyle?.fontWeight || 400,
39
+ fontFamily: template.textStyle?.fontFamily || fontFamily,
40
+ fill: template.textStyle?.fill || "rgb(255, 255, 255)",
41
+ stroke: template.textStyle?.stroke,
42
+ strokeWidth: template.textStyle?.strokeWidth,
43
+ letterSpacing: template.textStyle?.letterSpacing || 0,
44
+ lineHeight: template.textStyle?.lineHeight || 1.2,
45
+ paintOrder: template.textStyle?.paintOrder,
46
+ strokeLinejoin: template.textStyle?.strokeLinejoin,
47
+ strokeLinecap: template.textStyle?.strokeLinecap
48
+ };
49
+ return {
50
+ familyName: fontFamily,
51
+ locales: [locale],
52
+ textStyle,
53
+ containerStyle: template.containerStyle,
54
+ globalPosition: template.globalPosition
55
+ };
56
+ }
57
+ clearCache() {
58
+ this.fontCache.clear();
59
+ }
60
+ }
61
+ const fontManagerInstance = new FontManager();
62
+ function getFontConfig(locale, templateName, fontFamilyName) {
63
+ return fontManagerInstance.getFontConfig(locale, templateName, fontFamilyName);
64
+ }
65
+ export {
66
+ FontManager,
67
+ getFontConfig
68
+ };
69
+ //# sourceMappingURL=FontManager.js.map
@@ -0,0 +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\nconst PREFERRED_FONTS: Record<LocaleCode, string> = {\n 'zh-CN': 'dtjinbu',\n 'en-US': 'dtjinbu',\n 'ja-JP': 'dtjinbu',\n 'ko-KR': 'dtjinbu',\n 'ar-SA': 'dtjinbu',\n other: 'dtjinbu',\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 ? `${fontFamilyName}, ${SYSTEM_FONT_FALLBACKS[locale]}`\n : `${PREFERRED_FONTS[locale]}, ${SYSTEM_FONT_FALLBACKS[locale]}`;\n\n const textStyle: TextStyle = {\n fontSize: template.textStyle?.fontSize || 40,\n fontWeight: template.textStyle?.fontWeight || 400,\n fontFamily: template.textStyle?.fontFamily || fontFamily,\n fill: template.textStyle?.fill || 'rgb(255, 255, 255)',\n stroke: template.textStyle?.stroke,\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,MAAM,kBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,YAAY;AAAA,EACf,gCAAyC,IAAA;AAAA,EAEjD,cACE,QACA,cACA,gBACsB;AACtB,UAAM,WAAW,GAAG,MAAM,IAAI,YAAY,IAAI,kBAAkB,SAAS;AAEzE,QA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AACtB,SAAO,oBAAoB,cAAc,QAAQ,cAAc,cAAc;AAC/E;"}
@@ -0,0 +1,12 @@
1
+ import { TextStyle, ContainerStyle, GlobalPositionStyle } from './types';
2
+
3
+ export interface FontTemplate {
4
+ name: string;
5
+ textStyle?: Partial<TextStyle>;
6
+ containerStyle?: Partial<ContainerStyle>;
7
+ globalPosition?: Partial<GlobalPositionStyle>;
8
+ }
9
+ export declare function mergeFontTemplates(...templates: FontTemplate[]): FontTemplate;
10
+ export declare const FONT_TEMPLATES: Record<string, FontTemplate>;
11
+ export declare function getTemplate(templateName: string): FontTemplate;
12
+ //# sourceMappingURL=font-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-templates.d.ts","sourceRoot":"","sources":["../../../../src/stages/compose/font-system/font-templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC/C;AAED,wBAAgB,kBAAkB,CAAC,GAAG,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,CAgB7E;AAqVD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA6DvD,CAAC;AAEF,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY,CA0B9D"}
@@ -0,0 +1,384 @@
1
+ function mergeFontTemplates(...templates) {
2
+ const merged = { name: "merged" };
3
+ for (const template of templates) {
4
+ if (template.textStyle) {
5
+ merged.textStyle = { ...merged.textStyle, ...template.textStyle };
6
+ }
7
+ if (template.containerStyle) {
8
+ merged.containerStyle = { ...merged.containerStyle, ...template.containerStyle };
9
+ }
10
+ if (template.globalPosition) {
11
+ merged.globalPosition = { ...merged.globalPosition, ...template.globalPosition };
12
+ }
13
+ }
14
+ return merged;
15
+ }
16
+ const normal30 = {
17
+ name: "normal-30",
18
+ textStyle: { fontSize: 30 }
19
+ };
20
+ const normal40 = {
21
+ name: "normal-40",
22
+ textStyle: { fontSize: 40 }
23
+ };
24
+ const normal50 = {
25
+ name: "normal-50",
26
+ textStyle: { fontSize: 50 }
27
+ };
28
+ const normal60 = {
29
+ name: "normal-60",
30
+ textStyle: { fontSize: 60 }
31
+ };
32
+ const normal80 = {
33
+ name: "normal-80",
34
+ textStyle: { fontSize: 80 }
35
+ };
36
+ const bold40 = {
37
+ name: "bold-40",
38
+ textStyle: { fontWeight: "bold", fontSize: 40 }
39
+ };
40
+ const bold50 = {
41
+ name: "bold-50",
42
+ textStyle: { fontWeight: "bold", fontSize: 50 }
43
+ };
44
+ const bold60 = {
45
+ name: "bold-60",
46
+ textStyle: { fontWeight: "bold", letterSpacing: "0.05em", fontSize: 60 }
47
+ };
48
+ const fillBlack = {
49
+ name: "fill-black",
50
+ textStyle: { fill: "rgb(0, 0, 0)" }
51
+ };
52
+ const fillWhite = {
53
+ name: "fill-white",
54
+ textStyle: { fill: "rgb(255, 255, 255)" }
55
+ };
56
+ const fillYellow = {
57
+ name: "fill-yellow",
58
+ textStyle: { fill: "rgb(255, 215, 0)" }
59
+ };
60
+ const fillRed = {
61
+ name: "fill-red",
62
+ textStyle: { fill: "rgb(255, 77, 77)" }
63
+ };
64
+ const fillPink = {
65
+ name: "fill-pink",
66
+ textStyle: { fill: "rgb(255, 192, 203)" }
67
+ };
68
+ const strokeBlack = {
69
+ name: "stroke-black",
70
+ textStyle: {
71
+ paintOrder: "stroke",
72
+ strokeLinejoin: "round",
73
+ strokeLinecap: "round",
74
+ stroke: "rgb(0, 0, 0)"
75
+ }
76
+ };
77
+ const strokeWhite = {
78
+ name: "stroke-white",
79
+ textStyle: {
80
+ paintOrder: "stroke",
81
+ strokeLinejoin: "round",
82
+ strokeLinecap: "round",
83
+ stroke: "rgb(255, 255, 255)"
84
+ }
85
+ };
86
+ const strokeYellow = {
87
+ name: "stroke-yellow",
88
+ textStyle: {
89
+ paintOrder: "stroke",
90
+ strokeLinejoin: "round",
91
+ strokeLinecap: "round",
92
+ stroke: "rgb(255, 215, 0)"
93
+ }
94
+ };
95
+ const stroke0 = {
96
+ name: "stroke-0",
97
+ textStyle: { strokeWidth: 0 }
98
+ };
99
+ const stroke2 = {
100
+ name: "stroke-2",
101
+ textStyle: { strokeWidth: 2 }
102
+ };
103
+ const stroke4 = {
104
+ name: "stroke-4",
105
+ textStyle: { strokeWidth: 4 }
106
+ };
107
+ const stroke6 = {
108
+ name: "stroke-6",
109
+ textStyle: { strokeWidth: 6 }
110
+ };
111
+ const stroke8 = {
112
+ name: "stroke-8",
113
+ textStyle: { strokeWidth: 8 }
114
+ };
115
+ const stroke16 = {
116
+ name: "stroke-16",
117
+ textStyle: { strokeWidth: 16 }
118
+ };
119
+ const strokeBlack4 = mergeFontTemplates(strokeBlack, stroke4);
120
+ strokeBlack4.name = "stroke-black-4";
121
+ const strokeBlack6 = mergeFontTemplates(strokeBlack, stroke6);
122
+ strokeBlack6.name = "stroke-black-6";
123
+ const strokeBlack8 = mergeFontTemplates(strokeBlack, stroke8);
124
+ strokeBlack8.name = "stroke-black-8";
125
+ const strokeBlack16 = mergeFontTemplates(strokeBlack, stroke16);
126
+ strokeBlack16.name = "stroke-black-16";
127
+ const strokeWhite4 = mergeFontTemplates(strokeWhite, stroke4);
128
+ strokeWhite4.name = "stroke-white-4";
129
+ const strokeWhite8 = mergeFontTemplates(strokeWhite, stroke8);
130
+ strokeWhite8.name = "stroke-white-8";
131
+ const strokeYellow4 = mergeFontTemplates(strokeYellow, stroke4);
132
+ strokeYellow4.name = "stroke-yellow-4";
133
+ const strokeYellow8 = mergeFontTemplates(strokeYellow, stroke8);
134
+ strokeYellow8.name = "stroke-yellow-8";
135
+ const containerFull = {
136
+ name: "container-full",
137
+ containerStyle: { width: "100%" }
138
+ };
139
+ const container60 = {
140
+ name: "container-60",
141
+ containerStyle: { width: "60%" }
142
+ };
143
+ const container80 = {
144
+ name: "container-80",
145
+ containerStyle: { width: "80%" }
146
+ };
147
+ const container95 = {
148
+ name: "container-95",
149
+ containerStyle: { width: "95%" }
150
+ };
151
+ const container98 = {
152
+ name: "container-98",
153
+ containerStyle: { width: "98%" }
154
+ };
155
+ const containerBlack = {
156
+ name: "container-black",
157
+ containerStyle: {
158
+ backgroundColor: "black",
159
+ padding: "10px 10px 4px 10px",
160
+ borderRadius: 10,
161
+ width: "80%"
162
+ }
163
+ };
164
+ const containerWhite = {
165
+ name: "container-white",
166
+ containerStyle: {
167
+ backgroundColor: "white",
168
+ padding: "10px 10px 4px 10px",
169
+ borderRadius: 10,
170
+ width: "80%"
171
+ }
172
+ };
173
+ const containerYellow = {
174
+ name: "container-yellow",
175
+ containerStyle: {
176
+ backgroundColor: "yellow",
177
+ padding: "10px 10px 4px 10px",
178
+ borderRadius: 10,
179
+ width: "80%"
180
+ }
181
+ };
182
+ const containerBlackOpacity40 = {
183
+ name: "container-black-opacity-40",
184
+ containerStyle: {
185
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
186
+ padding: "10px 10px 4px 10px",
187
+ borderRadius: 10,
188
+ width: "80%"
189
+ }
190
+ };
191
+ const globalCenter = {
192
+ name: "global-center",
193
+ globalPosition: {
194
+ display: "flex",
195
+ alignItems: "center",
196
+ justifyContent: "center"
197
+ }
198
+ };
199
+ const globalHorizontalCenter = {
200
+ name: "global-horizontal-center",
201
+ globalPosition: {
202
+ display: "flex",
203
+ justifyContent: "center"
204
+ }
205
+ };
206
+ const globalTop5 = {
207
+ name: "global-top-5",
208
+ globalPosition: {
209
+ position: "absolute",
210
+ top: "5%"
211
+ }
212
+ };
213
+ const globalTop10 = {
214
+ name: "global-top-10",
215
+ globalPosition: {
216
+ position: "absolute",
217
+ top: "10%"
218
+ }
219
+ };
220
+ const globalTop20 = {
221
+ name: "global-top-20",
222
+ globalPosition: {
223
+ position: "absolute",
224
+ top: "20%"
225
+ }
226
+ };
227
+ const globalTop70 = {
228
+ name: "global-top-70",
229
+ globalPosition: {
230
+ position: "absolute",
231
+ top: "70%"
232
+ }
233
+ };
234
+ const globalTop80 = {
235
+ name: "global-top-80",
236
+ globalPosition: {
237
+ position: "absolute",
238
+ top: "80%"
239
+ }
240
+ };
241
+ const globalBottom5 = {
242
+ name: "global-bottom-5",
243
+ globalPosition: {
244
+ position: "absolute",
245
+ bottom: "5%"
246
+ }
247
+ };
248
+ const globalBottom10 = {
249
+ name: "global-bottom-10",
250
+ globalPosition: {
251
+ position: "absolute",
252
+ bottom: "10%"
253
+ }
254
+ };
255
+ const globalBottom15 = {
256
+ name: "global-bottom-15",
257
+ globalPosition: {
258
+ position: "absolute",
259
+ bottom: "15%"
260
+ }
261
+ };
262
+ const yellowText = mergeFontTemplates(normal40, fillYellow, strokeBlack8);
263
+ yellowText.name = "yellowText";
264
+ const whiteText = mergeFontTemplates(normal40, fillWhite, strokeBlack8);
265
+ whiteText.name = "whiteText";
266
+ const blackText = mergeFontTemplates(normal40, fillBlack, strokeWhite8);
267
+ blackText.name = "blackText";
268
+ const baseSubtitle = mergeFontTemplates(normal40, fillWhite, strokeBlack8, globalTop70);
269
+ baseSubtitle.name = "baseSubtitle";
270
+ const baseSubtitleCenter = mergeFontTemplates(
271
+ normal50,
272
+ fillWhite,
273
+ strokeBlack16,
274
+ globalCenter,
275
+ container60
276
+ );
277
+ baseSubtitleCenter.name = "baseSubtitleCenter";
278
+ const yellowSubtitle = mergeFontTemplates(yellowText, globalTop70);
279
+ yellowSubtitle.name = "yellowSubtitle";
280
+ const whiteSubtitle = mergeFontTemplates(whiteText, globalTop70);
281
+ whiteSubtitle.name = "whiteSubtitle";
282
+ const blackSubtitle = mergeFontTemplates(blackText, globalTop70);
283
+ blackSubtitle.name = "blackSubtitle";
284
+ const subtitleBackgroundBlack = mergeFontTemplates(
285
+ normal40,
286
+ fillWhite,
287
+ globalTop70,
288
+ containerBlack
289
+ );
290
+ subtitleBackgroundBlack.name = "subtitleBackgroundBlack";
291
+ const title = mergeFontTemplates(yellowText, bold50, globalTop5, container95);
292
+ title.name = "title";
293
+ const subtitle = mergeFontTemplates(normal30, fillWhite, strokeBlack8, globalTop5, container80);
294
+ subtitle.name = "subtitle";
295
+ const FONT_TEMPLATES = {
296
+ "normal-30": normal30,
297
+ "normal-40": normal40,
298
+ "normal-50": normal50,
299
+ "normal-60": normal60,
300
+ "normal-80": normal80,
301
+ "bold-40": bold40,
302
+ "bold-50": bold50,
303
+ "bold-60": bold60,
304
+ "fill-black": fillBlack,
305
+ "fill-white": fillWhite,
306
+ "fill-yellow": fillYellow,
307
+ "fill-red": fillRed,
308
+ "fill-pink": fillPink,
309
+ "stroke-black": strokeBlack,
310
+ "stroke-white": strokeWhite,
311
+ "stroke-yellow": strokeYellow,
312
+ "stroke-0": stroke0,
313
+ "stroke-2": stroke2,
314
+ "stroke-4": stroke4,
315
+ "stroke-6": stroke6,
316
+ "stroke-8": stroke8,
317
+ "stroke-16": stroke16,
318
+ "stroke-black-4": strokeBlack4,
319
+ "stroke-black-6": strokeBlack6,
320
+ "stroke-black-8": strokeBlack8,
321
+ "stroke-black-16": strokeBlack16,
322
+ "stroke-white-4": strokeWhite4,
323
+ "stroke-white-8": strokeWhite8,
324
+ "stroke-yellow-4": strokeYellow4,
325
+ "stroke-yellow-8": strokeYellow8,
326
+ "container-full": containerFull,
327
+ "container-60": container60,
328
+ "container-80": container80,
329
+ "container-95": container95,
330
+ "container-98": container98,
331
+ "container-black": containerBlack,
332
+ "container-white": containerWhite,
333
+ "container-yellow": containerYellow,
334
+ "container-black-opacity-40": containerBlackOpacity40,
335
+ "global-center": globalCenter,
336
+ "global-horizontal-center": globalHorizontalCenter,
337
+ "global-top-5": globalTop5,
338
+ "global-top-10": globalTop10,
339
+ "global-top-20": globalTop20,
340
+ "global-top-70": globalTop70,
341
+ "global-top-80": globalTop80,
342
+ "global-bottom-5": globalBottom5,
343
+ "global-bottom-10": globalBottom10,
344
+ "global-bottom-15": globalBottom15,
345
+ yellowText,
346
+ whiteText,
347
+ blackText,
348
+ baseSubtitle,
349
+ baseSubtitleCenter,
350
+ yellowSubtitle,
351
+ whiteSubtitle,
352
+ blackSubtitle,
353
+ subtitleBackgroundBlack,
354
+ title,
355
+ subtitle
356
+ };
357
+ function getTemplate(templateName) {
358
+ const templateNames = templateName.split(" ").filter(Boolean);
359
+ const templates = templateNames.map((name) => FONT_TEMPLATES[name]).filter((t) => t !== void 0);
360
+ if (templates.length === 0) {
361
+ return {
362
+ name: "default",
363
+ textStyle: {
364
+ fontSize: 40,
365
+ fontWeight: 400,
366
+ fontFamily: "Arial, sans-serif",
367
+ fill: "rgb(255, 255, 255)",
368
+ stroke: "rgb(0, 0, 0)",
369
+ strokeWidth: 4,
370
+ lineHeight: 1.2
371
+ }
372
+ };
373
+ }
374
+ if (templates.length === 1) {
375
+ return templates[0];
376
+ }
377
+ return mergeFontTemplates(...templates);
378
+ }
379
+ export {
380
+ FONT_TEMPLATES,
381
+ getTemplate,
382
+ mergeFontTemplates
383
+ };
384
+ //# sourceMappingURL=font-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-templates.js","sources":["../../../../src/stages/compose/font-system/font-templates.ts"],"sourcesContent":["import type { TextStyle, ContainerStyle, GlobalPositionStyle } from './types';\n\nexport interface FontTemplate {\n name: string;\n textStyle?: Partial<TextStyle>;\n containerStyle?: Partial<ContainerStyle>;\n globalPosition?: Partial<GlobalPositionStyle>;\n}\n\nexport function mergeFontTemplates(...templates: FontTemplate[]): FontTemplate {\n const merged: FontTemplate = { name: 'merged' };\n\n for (const template of templates) {\n if (template.textStyle) {\n merged.textStyle = { ...merged.textStyle, ...template.textStyle };\n }\n if (template.containerStyle) {\n merged.containerStyle = { ...merged.containerStyle, ...template.containerStyle };\n }\n if (template.globalPosition) {\n merged.globalPosition = { ...merged.globalPosition, ...template.globalPosition };\n }\n }\n\n return merged;\n}\n\nconst normal30: FontTemplate = {\n name: 'normal-30',\n textStyle: { fontSize: 30 },\n};\n\nconst normal40: FontTemplate = {\n name: 'normal-40',\n textStyle: { fontSize: 40 },\n};\n\nconst normal50: FontTemplate = {\n name: 'normal-50',\n textStyle: { fontSize: 50 },\n};\n\nconst normal60: FontTemplate = {\n name: 'normal-60',\n textStyle: { fontSize: 60 },\n};\n\nconst normal80: FontTemplate = {\n name: 'normal-80',\n textStyle: { fontSize: 80 },\n};\n\nconst bold40: FontTemplate = {\n name: 'bold-40',\n textStyle: { fontWeight: 'bold', fontSize: 40 },\n};\n\nconst bold50: FontTemplate = {\n name: 'bold-50',\n textStyle: { fontWeight: 'bold', fontSize: 50 },\n};\n\nconst bold60: FontTemplate = {\n name: 'bold-60',\n textStyle: { fontWeight: 'bold', letterSpacing: '0.05em', fontSize: 60 },\n};\n\nconst fillBlack: FontTemplate = {\n name: 'fill-black',\n textStyle: { fill: 'rgb(0, 0, 0)' },\n};\n\nconst fillWhite: FontTemplate = {\n name: 'fill-white',\n textStyle: { fill: 'rgb(255, 255, 255)' },\n};\n\nconst fillYellow: FontTemplate = {\n name: 'fill-yellow',\n textStyle: { fill: 'rgb(255, 215, 0)' },\n};\n\nconst fillRed: FontTemplate = {\n name: 'fill-red',\n textStyle: { fill: 'rgb(255, 77, 77)' },\n};\n\nconst fillPink: FontTemplate = {\n name: 'fill-pink',\n textStyle: { fill: 'rgb(255, 192, 203)' },\n};\n\nconst strokeBlack: FontTemplate = {\n name: 'stroke-black',\n textStyle: {\n paintOrder: 'stroke',\n strokeLinejoin: 'round',\n strokeLinecap: 'round',\n stroke: 'rgb(0, 0, 0)',\n },\n};\n\nconst strokeWhite: FontTemplate = {\n name: 'stroke-white',\n textStyle: {\n paintOrder: 'stroke',\n strokeLinejoin: 'round',\n strokeLinecap: 'round',\n stroke: 'rgb(255, 255, 255)',\n },\n};\n\nconst strokeYellow: FontTemplate = {\n name: 'stroke-yellow',\n textStyle: {\n paintOrder: 'stroke',\n strokeLinejoin: 'round',\n strokeLinecap: 'round',\n stroke: 'rgb(255, 215, 0)',\n },\n};\n\nconst stroke0: FontTemplate = {\n name: 'stroke-0',\n textStyle: { strokeWidth: 0 },\n};\n\nconst stroke2: FontTemplate = {\n name: 'stroke-2',\n textStyle: { strokeWidth: 2 },\n};\n\nconst stroke4: FontTemplate = {\n name: 'stroke-4',\n textStyle: { strokeWidth: 4 },\n};\n\nconst stroke6: FontTemplate = {\n name: 'stroke-6',\n textStyle: { strokeWidth: 6 },\n};\n\nconst stroke8: FontTemplate = {\n name: 'stroke-8',\n textStyle: { strokeWidth: 8 },\n};\n\nconst stroke16: FontTemplate = {\n name: 'stroke-16',\n textStyle: { strokeWidth: 16 },\n};\n\nconst strokeBlack4 = mergeFontTemplates(strokeBlack, stroke4);\nstrokeBlack4.name = 'stroke-black-4';\n\nconst strokeBlack6 = mergeFontTemplates(strokeBlack, stroke6);\nstrokeBlack6.name = 'stroke-black-6';\n\nconst strokeBlack8 = mergeFontTemplates(strokeBlack, stroke8);\nstrokeBlack8.name = 'stroke-black-8';\n\nconst strokeBlack16 = mergeFontTemplates(strokeBlack, stroke16);\nstrokeBlack16.name = 'stroke-black-16';\n\nconst strokeWhite4 = mergeFontTemplates(strokeWhite, stroke4);\nstrokeWhite4.name = 'stroke-white-4';\n\nconst strokeWhite8 = mergeFontTemplates(strokeWhite, stroke8);\nstrokeWhite8.name = 'stroke-white-8';\n\nconst strokeYellow4 = mergeFontTemplates(strokeYellow, stroke4);\nstrokeYellow4.name = 'stroke-yellow-4';\n\nconst strokeYellow8 = mergeFontTemplates(strokeYellow, stroke8);\nstrokeYellow8.name = 'stroke-yellow-8';\n\nconst containerFull: FontTemplate = {\n name: 'container-full',\n containerStyle: { width: '100%' },\n};\n\nconst container60: FontTemplate = {\n name: 'container-60',\n containerStyle: { width: '60%' },\n};\n\nconst container80: FontTemplate = {\n name: 'container-80',\n containerStyle: { width: '80%' },\n};\n\nconst container95: FontTemplate = {\n name: 'container-95',\n containerStyle: { width: '95%' },\n};\n\nconst container98: FontTemplate = {\n name: 'container-98',\n containerStyle: { width: '98%' },\n};\n\nconst containerBlack: FontTemplate = {\n name: 'container-black',\n containerStyle: {\n backgroundColor: 'black',\n padding: '10px 10px 4px 10px',\n borderRadius: 10,\n width: '80%',\n },\n};\n\nconst containerWhite: FontTemplate = {\n name: 'container-white',\n containerStyle: {\n backgroundColor: 'white',\n padding: '10px 10px 4px 10px',\n borderRadius: 10,\n width: '80%',\n },\n};\n\nconst containerYellow: FontTemplate = {\n name: 'container-yellow',\n containerStyle: {\n backgroundColor: 'yellow',\n padding: '10px 10px 4px 10px',\n borderRadius: 10,\n width: '80%',\n },\n};\n\nconst containerBlackOpacity40: FontTemplate = {\n name: 'container-black-opacity-40',\n containerStyle: {\n backgroundColor: 'rgba(0, 0, 0, 0.4)',\n padding: '10px 10px 4px 10px',\n borderRadius: 10,\n width: '80%',\n },\n};\n\nconst globalCenter: FontTemplate = {\n name: 'global-center',\n globalPosition: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n};\n\nconst globalHorizontalCenter: FontTemplate = {\n name: 'global-horizontal-center',\n globalPosition: {\n display: 'flex',\n justifyContent: 'center',\n },\n};\n\nconst globalTop5: FontTemplate = {\n name: 'global-top-5',\n globalPosition: {\n position: 'absolute',\n top: '5%',\n },\n};\n\nconst globalTop10: FontTemplate = {\n name: 'global-top-10',\n globalPosition: {\n position: 'absolute',\n top: '10%',\n },\n};\n\nconst globalTop20: FontTemplate = {\n name: 'global-top-20',\n globalPosition: {\n position: 'absolute',\n top: '20%',\n },\n};\n\nconst globalTop70: FontTemplate = {\n name: 'global-top-70',\n globalPosition: {\n position: 'absolute',\n top: '70%',\n },\n};\n\nconst globalTop80: FontTemplate = {\n name: 'global-top-80',\n globalPosition: {\n position: 'absolute',\n top: '80%',\n },\n};\n\nconst globalBottom5: FontTemplate = {\n name: 'global-bottom-5',\n globalPosition: {\n position: 'absolute',\n bottom: '5%',\n },\n};\n\nconst globalBottom10: FontTemplate = {\n name: 'global-bottom-10',\n globalPosition: {\n position: 'absolute',\n bottom: '10%',\n },\n};\n\nconst globalBottom15: FontTemplate = {\n name: 'global-bottom-15',\n globalPosition: {\n position: 'absolute',\n bottom: '15%',\n },\n};\n\nconst yellowText = mergeFontTemplates(normal40, fillYellow, strokeBlack8);\nyellowText.name = 'yellowText';\n\nconst whiteText = mergeFontTemplates(normal40, fillWhite, strokeBlack8);\nwhiteText.name = 'whiteText';\n\nconst blackText = mergeFontTemplates(normal40, fillBlack, strokeWhite8);\nblackText.name = 'blackText';\n\nconst baseSubtitle = mergeFontTemplates(normal40, fillWhite, strokeBlack8, globalTop70);\nbaseSubtitle.name = 'baseSubtitle';\n\nconst baseSubtitleCenter = mergeFontTemplates(\n normal50,\n fillWhite,\n strokeBlack16,\n globalCenter,\n container60\n);\nbaseSubtitleCenter.name = 'baseSubtitleCenter';\n\nconst yellowSubtitle = mergeFontTemplates(yellowText, globalTop70);\nyellowSubtitle.name = 'yellowSubtitle';\n\nconst whiteSubtitle = mergeFontTemplates(whiteText, globalTop70);\nwhiteSubtitle.name = 'whiteSubtitle';\n\nconst blackSubtitle = mergeFontTemplates(blackText, globalTop70);\nblackSubtitle.name = 'blackSubtitle';\n\nconst subtitleBackgroundBlack = mergeFontTemplates(\n normal40,\n fillWhite,\n globalTop70,\n containerBlack\n);\nsubtitleBackgroundBlack.name = 'subtitleBackgroundBlack';\n\nconst title = mergeFontTemplates(yellowText, bold50, globalTop5, container95);\ntitle.name = 'title';\n\nconst subtitle = mergeFontTemplates(normal30, fillWhite, strokeBlack8, globalTop5, container80);\nsubtitle.name = 'subtitle';\n\nexport const FONT_TEMPLATES: Record<string, FontTemplate> = {\n 'normal-30': normal30,\n 'normal-40': normal40,\n 'normal-50': normal50,\n 'normal-60': normal60,\n 'normal-80': normal80,\n 'bold-40': bold40,\n 'bold-50': bold50,\n 'bold-60': bold60,\n 'fill-black': fillBlack,\n 'fill-white': fillWhite,\n 'fill-yellow': fillYellow,\n 'fill-red': fillRed,\n 'fill-pink': fillPink,\n 'stroke-black': strokeBlack,\n 'stroke-white': strokeWhite,\n 'stroke-yellow': strokeYellow,\n 'stroke-0': stroke0,\n 'stroke-2': stroke2,\n 'stroke-4': stroke4,\n 'stroke-6': stroke6,\n 'stroke-8': stroke8,\n 'stroke-16': stroke16,\n 'stroke-black-4': strokeBlack4,\n 'stroke-black-6': strokeBlack6,\n 'stroke-black-8': strokeBlack8,\n 'stroke-black-16': strokeBlack16,\n 'stroke-white-4': strokeWhite4,\n 'stroke-white-8': strokeWhite8,\n 'stroke-yellow-4': strokeYellow4,\n 'stroke-yellow-8': strokeYellow8,\n 'container-full': containerFull,\n 'container-60': container60,\n 'container-80': container80,\n 'container-95': container95,\n 'container-98': container98,\n 'container-black': containerBlack,\n 'container-white': containerWhite,\n 'container-yellow': containerYellow,\n 'container-black-opacity-40': containerBlackOpacity40,\n 'global-center': globalCenter,\n 'global-horizontal-center': globalHorizontalCenter,\n 'global-top-5': globalTop5,\n 'global-top-10': globalTop10,\n 'global-top-20': globalTop20,\n 'global-top-70': globalTop70,\n 'global-top-80': globalTop80,\n 'global-bottom-5': globalBottom5,\n 'global-bottom-10': globalBottom10,\n 'global-bottom-15': globalBottom15,\n yellowText,\n whiteText,\n blackText,\n baseSubtitle,\n baseSubtitleCenter,\n yellowSubtitle,\n whiteSubtitle,\n blackSubtitle,\n subtitleBackgroundBlack,\n title,\n subtitle,\n};\n\nexport function getTemplate(templateName: string): FontTemplate {\n const templateNames = templateName.split(' ').filter(Boolean);\n const templates = templateNames\n .map((name) => FONT_TEMPLATES[name])\n .filter((t): t is FontTemplate => t !== undefined);\n\n if (templates.length === 0) {\n return {\n name: 'default',\n textStyle: {\n fontSize: 40,\n fontWeight: 400,\n fontFamily: 'Arial, sans-serif',\n fill: 'rgb(255, 255, 255)',\n stroke: 'rgb(0, 0, 0)',\n strokeWidth: 4,\n lineHeight: 1.2,\n },\n };\n }\n\n if (templates.length === 1) {\n return templates[0]!;\n }\n\n return mergeFontTemplates(...templates);\n}\n"],"names":[],"mappings":"AASO,SAAS,sBAAsB,WAAyC;AAC7E,QAAM,SAAuB,EAAE,MAAM,SAAA;AAErC,aAAW,YAAY,WAAW;AAChC,QAAI,SAAS,WAAW;AACtB,aAAO,YAAY,EAAE,GAAG,OAAO,WAAW,GAAG,SAAS,UAAA;AAAA,IACxD;AACA,QAAI,SAAS,gBAAgB;AAC3B,aAAO,iBAAiB,EAAE,GAAG,OAAO,gBAAgB,GAAG,SAAS,eAAA;AAAA,IAClE;AACA,QAAI,SAAS,gBAAgB;AAC3B,aAAO,iBAAiB,EAAE,GAAG,OAAO,gBAAgB,GAAG,SAAS,eAAA;AAAA,IAClE;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,WAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW,EAAE,UAAU,GAAA;AACzB;AAEA,MAAM,WAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW,EAAE,UAAU,GAAA;AACzB;AAEA,MAAM,WAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW,EAAE,UAAU,GAAA;AACzB;AAEA,MAAM,WAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW,EAAE,UAAU,GAAA;AACzB;AAEA,MAAM,WAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW,EAAE,UAAU,GAAA;AACzB;AAEA,MAAM,SAAuB;AAAA,EAC3B,MAAM;AAAA,EACN,WAAW,EAAE,YAAY,QAAQ,UAAU,GAAA;AAC7C;AAEA,MAAM,SAAuB;AAAA,EAC3B,MAAM;AAAA,EACN,WAAW,EAAE,YAAY,QAAQ,UAAU,GAAA;AAC7C;AAEA,MAAM,SAAuB;AAAA,EAC3B,MAAM;AAAA,EACN,WAAW,EAAE,YAAY,QAAQ,eAAe,UAAU,UAAU,GAAA;AACtE;A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YAAY;AAAA,MAAA;AAAA,IACd;AAAA,EAEJ;AAEA,MAAI,UAAU,WAAW,GAAG;AAC1B,WAAO,UAAU,CAAC;AAAA,EACpB;AAEA,SAAO,mBAAmB,GAAG,SAAS;AACxC;"}
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './FontManager';
3
+ export * from './font-templates';
4
+ export { getFontConfig, clearFontCache } from './FontManager';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stages/compose/font-system/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,60 @@
1
+ export type LocaleCode = 'zh-CN' | 'en-US' | 'ja-JP' | 'ko-KR' | 'ar-SA' | 'other';
2
+ export interface TextStyle {
3
+ fontSize: number;
4
+ fontWeight: string | number;
5
+ fontFamily: string;
6
+ fill: string;
7
+ stroke?: string;
8
+ strokeWidth?: number;
9
+ letterSpacing?: string | number;
10
+ lineHeight?: number;
11
+ paintOrder?: string;
12
+ strokeLinejoin?: CanvasLineJoin;
13
+ strokeLinecap?: CanvasLineCap;
14
+ }
15
+ export interface ContainerStyle {
16
+ width?: string;
17
+ backgroundColor?: string;
18
+ padding?: string;
19
+ borderRadius?: number;
20
+ }
21
+ export interface GlobalPositionStyle {
22
+ position?: 'absolute';
23
+ top?: string;
24
+ bottom?: string;
25
+ left?: string;
26
+ right?: string;
27
+ display?: string;
28
+ alignItems?: string;
29
+ justifyContent?: string;
30
+ }
31
+ export interface FontConfig {
32
+ familyName: string;
33
+ url?: string;
34
+ locales: LocaleCode[];
35
+ textStyle: TextStyle;
36
+ containerStyle?: ContainerStyle;
37
+ globalPosition?: GlobalPositionStyle;
38
+ }
39
+ export interface SerializedFontConfig {
40
+ textStyle: TextStyle;
41
+ containerStyle?: ContainerStyle;
42
+ globalPosition?: GlobalPositionStyle;
43
+ }
44
+ export interface TextAnimationConfig {
45
+ type: 'none' | 'fade' | 'wordByWord' | 'characterKTV' | 'wordByWordFancy' | 'wordByWordSlideUp';
46
+ glowColor?: string;
47
+ glowIntensity?: number;
48
+ transitionFrames?: number;
49
+ highlightColor?: string;
50
+ highlightTextStyle?: TextStyle;
51
+ enlargeScale?: number;
52
+ slideDistance?: number;
53
+ fadeDuration?: number;
54
+ }
55
+ export interface WordTiming {
56
+ text: string;
57
+ startFrame: number;
58
+ endFrame: number;
59
+ }
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/stages/compose/font-system/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnF,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WA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