@rpgjs/client 5.0.0-alpha.23 → 5.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RpgClientEngine.d.ts +35 -115
- package/dist/components/gui/mobile/index.d.ts +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +2 -2
- package/dist/index12.js +2 -2
- package/dist/index14.js +1 -2
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +4 -4
- package/dist/index16.js.map +1 -1
- package/dist/index17.js.map +1 -1
- package/dist/index2.js +85 -159
- package/dist/index2.js.map +1 -1
- package/dist/index20.js.map +1 -1
- package/dist/index22.js +1 -1
- package/dist/index25.js +2 -2
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +2 -3
- package/dist/index26.js.map +1 -1
- package/dist/index28.js +2 -2
- package/dist/index28.js.map +1 -1
- package/dist/index3.js +1 -1
- package/dist/index31.js +2622 -42
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +88 -2607
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +64 -107
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +12 -62
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +24 -18
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +87 -19
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +20 -74
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +18 -35
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +137 -20
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +1 -1
- package/dist/index40.js +9 -133
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +3 -41
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +536 -1
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +30 -183
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +9 -501
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +6 -334
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +325 -30
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +3680 -67
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +75 -10
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +186 -6
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +499 -3685
- package/dist/index50.js.map +1 -1
- package/dist/index53.js +1 -1
- package/dist/index8.js +6 -1
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +1 -2
- package/dist/index9.js.map +1 -1
- package/package.json +9 -9
- package/src/Gui/Gui.ts +0 -1
- package/src/RpgClientEngine.ts +106 -176
- package/src/components/character.ce +2 -3
- package/src/components/gui/mobile/index.ts +1 -1
- package/src/components/gui/mobile/mobile.ce +73 -88
- package/src/components/prebuilt/light-halo.ce +2 -71
- package/src/components/scenes/canvas.ce +0 -10
- package/src/components/scenes/event-layer.ce +1 -0
- package/src/module.ts +6 -1
- package/dist/Game/TransitionManager.d.ts +0 -56
- package/src/Game/TransitionManager.ts +0 -75
package/dist/index39.js
CHANGED
|
@@ -1,24 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { useProps, useDefineProps, h, Text, computed } from 'canvasengine';
|
|
2
|
+
import { parseDynamicValue } from './index51.js';
|
|
3
|
+
|
|
4
|
+
function component($$props) {
|
|
5
|
+
useProps($$props);
|
|
6
|
+
const defineProps = useDefineProps($$props);
|
|
7
|
+
var __assign = (this && this.__assign) || function () {
|
|
8
|
+
__assign = Object.assign || function(t) {
|
|
9
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
+
s = arguments[i];
|
|
11
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
+
t[p] = s[p];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
var object = defineProps().object;
|
|
19
|
+
var component = object._component;
|
|
20
|
+
var parseNumericStyleValue = function (value, object) {
|
|
21
|
+
if (value === undefined || value === null) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'number') {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'string') {
|
|
28
|
+
// Check if it contains dynamic references
|
|
29
|
+
if (value.includes('{')) {
|
|
30
|
+
// Parse dynamic value and convert to number
|
|
31
|
+
var parsed_1 = parseDynamicValue(value, object);
|
|
32
|
+
return computed(function () {
|
|
33
|
+
var str = parsed_1();
|
|
34
|
+
var num = parseFloat(str);
|
|
35
|
+
return isNaN(num) ? 0 : num;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Simple string number, convert directly
|
|
40
|
+
var num = parseFloat(value);
|
|
41
|
+
return isNaN(num) ? undefined : num;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
};
|
|
46
|
+
var getComponentStyle = function (component) {
|
|
47
|
+
if (!component.style) {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
var style = component.style;
|
|
51
|
+
var result = {};
|
|
52
|
+
// Map fill to color (shortcut property)
|
|
53
|
+
// fill can be a string (hex color) or a dynamic string
|
|
54
|
+
if (style.fill !== undefined) {
|
|
55
|
+
if (typeof style.fill === 'string' && style.fill.includes('{')) {
|
|
56
|
+
result.color = parseDynamicValue(style.fill, object);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
result.color = style.fill;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Map fontSize to size (shortcut property)
|
|
63
|
+
// fontSize can be number or string (with dynamic references)
|
|
64
|
+
if (style.fontSize !== undefined) {
|
|
65
|
+
var fontSizeValue = parseNumericStyleValue(style.fontSize, object);
|
|
66
|
+
if (fontSizeValue !== undefined) {
|
|
67
|
+
result.size = fontSizeValue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Map fontFamily (shortcut property)
|
|
71
|
+
if (style.fontFamily !== undefined) {
|
|
72
|
+
if (typeof style.fontFamily === 'string' && style.fontFamily.includes('{')) {
|
|
73
|
+
result.fontFamily = parseDynamicValue(style.fontFamily, object);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
result.fontFamily = style.fontFamily;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Build style object for PixiJS Text properties
|
|
80
|
+
var textStyle = {};
|
|
81
|
+
// Font style properties
|
|
82
|
+
if (style.fontStyle !== undefined) {
|
|
83
|
+
if (typeof style.fontStyle === 'string' && style.fontStyle.includes('{')) {
|
|
84
|
+
textStyle.fontStyle = parseDynamicValue(style.fontStyle, object);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
textStyle.fontStyle = style.fontStyle;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (style.fontWeight !== undefined) {
|
|
91
|
+
if (typeof style.fontWeight === 'string' && style.fontWeight.includes('{')) {
|
|
92
|
+
textStyle.fontWeight = parseDynamicValue(style.fontWeight, object);
|
|
93
|
+
}
|
|
94
|
+
else if (typeof style.fontWeight === 'number') {
|
|
95
|
+
textStyle.fontWeight = style.fontWeight;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
textStyle.fontWeight = style.fontWeight;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Stroke properties
|
|
102
|
+
if (style.stroke !== undefined) {
|
|
103
|
+
if (typeof style.stroke === 'string' && style.stroke.includes('{')) {
|
|
104
|
+
textStyle.stroke = parseDynamicValue(style.stroke, object);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
textStyle.stroke = style.stroke;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Opacity (can be number or string)
|
|
111
|
+
if (style.opacity !== undefined) {
|
|
112
|
+
var opacityValue = parseNumericStyleValue(style.opacity, object);
|
|
113
|
+
if (opacityValue !== undefined) {
|
|
114
|
+
textStyle.opacity = opacityValue;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Word wrap
|
|
118
|
+
if (style.wordWrap !== undefined) {
|
|
119
|
+
textStyle.wordWrap = style.wordWrap;
|
|
120
|
+
}
|
|
121
|
+
// Text alignment
|
|
122
|
+
if (style.align !== undefined) {
|
|
123
|
+
if (typeof style.align === 'string' && style.align.includes('{')) {
|
|
124
|
+
textStyle.align = parseDynamicValue(style.align, object);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
textStyle.align = style.align;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Only add style prop if there are style properties
|
|
131
|
+
if (Object.keys(textStyle).length > 0) {
|
|
132
|
+
result.style = textStyle;
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
21
135
|
};
|
|
136
|
+
let $this = h(Text, { text: parseDynamicValue(component.value, object), ...getComponentStyle(component) });
|
|
137
|
+
return $this
|
|
138
|
+
}
|
|
22
139
|
|
|
23
|
-
export {
|
|
140
|
+
export { component as default };
|
|
24
141
|
//# sourceMappingURL=index39.js.map
|
package/dist/index39.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index39.js","sources":["../src/presets/faceset.ts"],"sourcesContent":["/**\n * Creates a faceset preset for character expressions\n * \n * This preset allows you to define multiple facial expressions for a character,\n * where each expression corresponds to a specific frame position (frameX, frameY)\n * within a single faceset texture. Each expression is defined by its position\n * in the faceset grid.\n * \n * @param options - Object containing the faceset configuration\n * @param framesWidth - Number of frames horizontally in the faceset texture\n * @param framesHeight - Number of frames vertically in the faceset texture\n * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]\n * @returns Faceset configuration with animations for each expression\n * \n * @example\n * ```typescript\n * const faceset = FacesetPreset({\n * id: \"facesetId\",\n * image: \"faceset.png\",\n * width: 1024,\n * height: 1024,\n * }, 4, 2, {\n * happy: [0, 0],\n * sad: [1, 0],\n * angry: [2, 0],\n * surprised: [3, 0]\n * });\n * ```\n */\nexport const FacesetPreset = (\n options: any,\n framesWidth: number, \n framesHeight: number,\n expressions: Record<string, [number, number]>,\n) => {\n \n const textures: Record<string, any> = {};\n \n // Create texture configuration for each expression\n Object.keys(expressions).forEach((expressionName) => {\n const [frameX, frameY] = expressions[expressionName];\n textures[expressionName] = {\n animations: () => [\n [{ \n time: 0, \n frameX: frameX, \n frameY: frameY \n }]\n ],\n };\n });\n \n return {\n ...options,\n framesWidth,\n framesHeight,\n textures\n };\n};\n "],"names":[],"mappings":"AA6BO,MAAM,aAAA,GAAgB,CACzB,OAAA,EACA,WAAA,EACA,cACA,WAAA,KACC;AAED,EAAA,MAAM,WAAgC,EAAC;AAGvC,EAAA,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACjD,IAAA,MAAM,CAAC,MAAA,EAAQ,MAAM,CAAA,GAAI,YAAY,cAAc,CAAA;AACnD,IAAA,QAAA,CAAS,cAAc,CAAA,GAAI;AAAA,MACvB,YAAY,MAAM;AAAA,QACd,CAAC;AAAA,UACG,IAAA,EAAM,CAAA;AAAA,UACN,MAAA;AAAA,UACA;AAAA,SACH;AAAA;AACL,KACJ;AAAA,EACJ,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACH,GAAG,OAAA;AAAA,IACH,WAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index39.js","sources":["../src/components/dynamics/text.ce"],"sourcesContent":["<Text text={@parseDynamicValue(@component.@value, @object)} ...getComponentStyle(component) />\n\n<script>\nimport { computed } from \"canvasengine\";\nimport { parseDynamicValue } from \"./parse-value\";\n\nconst { object } = defineProps();\nconst component = object._component;\n\n/**\n * Parses a numeric style value that can be a number or a string\n * \n * If the value is a string, it may contain dynamic references like {hp}\n * which need to be parsed using parseDynamicValue. If it's a number,\n * it's returned as-is wrapped in a computed.\n * \n * @param value - Numeric value (number or string)\n * @param object - Object to resolve dynamic references from\n * @returns Computed signal with the numeric value\n */\nconst parseNumericStyleValue = (value, object) => {\n if (value === undefined || value === null) {\n return undefined;\n }\n \n if (typeof value === 'number') {\n return value;\n }\n \n if (typeof value === 'string') {\n // Check if it contains dynamic references\n if (value.includes('{')) {\n // Parse dynamic value and convert to number\n const parsed = parseDynamicValue(value, object);\n return computed(() => {\n const str = parsed();\n const num = parseFloat(str);\n return isNaN(num) ? 0 : num;\n });\n } else {\n // Simple string number, convert directly\n const num = parseFloat(value);\n return isNaN(num) ? undefined : num;\n }\n }\n \n return value;\n};\n\n/**\n * Maps component style properties to Canvas Engine Text component props\n * \n * Converts TextComponentOptions from the server to the format expected\n * by the Canvas Engine Text component. Supports all text styling properties\n * including fill, fontSize, fontFamily, fontStyle, fontWeight, stroke,\n * opacity, wordWrap, and align. Also supports dynamic values (number | string)\n * for numeric properties like fontSize and opacity.\n * \n * @param component - Component definition with style property\n * @returns Object with Text component props\n * \n * @example\n * ```ts\n * // Component with style\n * const component = {\n * style: {\n * fill: '#000000',\n * fontSize: 20,\n * fontFamily: 'Arial',\n * fontWeight: 'bold'\n * }\n * };\n * \n * const props = getComponentStyle(component);\n * // Returns: { color: '#000000', size: 20, fontFamily: 'Arial', style: { fontWeight: 'bold' } }\n * \n * // Component with dynamic fontSize\n * const component2 = {\n * style: {\n * fill: '#000000',\n * fontSize: '{hp}', // Will be resolved from object.hp\n * opacity: '0.8'\n * }\n * };\n * ```\n */\nconst getComponentStyle = (component) => {\n if (!component.style) {\n return {};\n }\n\n const style = component.style;\n const result = {};\n\n // Map fill to color (shortcut property)\n // fill can be a string (hex color) or a dynamic string\n if (style.fill !== undefined) {\n if (typeof style.fill === 'string' && style.fill.includes('{')) {\n result.color = parseDynamicValue(style.fill, object);\n } else {\n result.color = style.fill;\n }\n }\n\n // Map fontSize to size (shortcut property)\n // fontSize can be number or string (with dynamic references)\n if (style.fontSize !== undefined) {\n const fontSizeValue = parseNumericStyleValue(style.fontSize, object);\n if (fontSizeValue !== undefined) {\n result.size = fontSizeValue;\n }\n }\n\n // Map fontFamily (shortcut property)\n if (style.fontFamily !== undefined) {\n if (typeof style.fontFamily === 'string' && style.fontFamily.includes('{')) {\n result.fontFamily = parseDynamicValue(style.fontFamily, object);\n } else {\n result.fontFamily = style.fontFamily;\n }\n }\n\n // Build style object for PixiJS Text properties\n const textStyle = {};\n\n // Font style properties\n if (style.fontStyle !== undefined) {\n if (typeof style.fontStyle === 'string' && style.fontStyle.includes('{')) {\n textStyle.fontStyle = parseDynamicValue(style.fontStyle, object);\n } else {\n textStyle.fontStyle = style.fontStyle;\n }\n }\n\n if (style.fontWeight !== undefined) {\n if (typeof style.fontWeight === 'string' && style.fontWeight.includes('{')) {\n textStyle.fontWeight = parseDynamicValue(style.fontWeight, object);\n } else if (typeof style.fontWeight === 'number') {\n textStyle.fontWeight = style.fontWeight;\n } else {\n textStyle.fontWeight = style.fontWeight;\n }\n }\n\n // Stroke properties\n if (style.stroke !== undefined) {\n if (typeof style.stroke === 'string' && style.stroke.includes('{')) {\n textStyle.stroke = parseDynamicValue(style.stroke, object);\n } else {\n textStyle.stroke = style.stroke;\n }\n }\n\n // Opacity (can be number or string)\n if (style.opacity !== undefined) {\n const opacityValue = parseNumericStyleValue(style.opacity, object);\n if (opacityValue !== undefined) {\n textStyle.opacity = opacityValue;\n }\n }\n\n // Word wrap\n if (style.wordWrap !== undefined) {\n textStyle.wordWrap = style.wordWrap;\n }\n\n // Text alignment\n if (style.align !== undefined) {\n if (typeof style.align === 'string' && style.align.includes('{')) {\n textStyle.align = parseDynamicValue(style.align, object);\n } else {\n textStyle.align = style.align;\n }\n }\n\n // Only add style prop if there are style properties\n if (Object.keys(textStyle).length >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,MAAM,CAAC;AACpE,QAAQ;AACR,aAAa;AACb,YAAY,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK;AACzC,QAAQ;AACR,IAAI;AACJ;AACA,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3C,QAAQ,MAAM,CAAC,KAAK,GAAG,SAAS;AAChC,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB;AACA,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,iBAAiB,CAAC,SAAS,CAAC,EAAE;AACjH,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index4.js
CHANGED
package/dist/index40.js
CHANGED
|
@@ -1,139 +1,15 @@
|
|
|
1
|
-
import { useProps, useDefineProps, h,
|
|
2
|
-
import {
|
|
1
|
+
import { useProps, useDefineProps, signal, mount, h, Container, Button, Joystick } from 'canvasengine';
|
|
2
|
+
import { inject } from './index6.js';
|
|
3
3
|
|
|
4
4
|
function component($$props) {
|
|
5
5
|
useProps($$props);
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
|
-
var object = defineProps().object;
|
|
19
|
-
var component = object._component;
|
|
20
|
-
var parseNumericStyleValue = function (value, object) {
|
|
21
|
-
if (value === undefined || value === null) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
if (typeof value === 'number') {
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
if (typeof value === 'string') {
|
|
28
|
-
// Check if it contains dynamic references
|
|
29
|
-
if (value.includes('{')) {
|
|
30
|
-
// Parse dynamic value and convert to number
|
|
31
|
-
var parsed_1 = parseDynamicValue(value, object);
|
|
32
|
-
return computed(function () {
|
|
33
|
-
var str = parsed_1();
|
|
34
|
-
var num = parseFloat(str);
|
|
35
|
-
return isNaN(num) ? 0 : num;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// Simple string number, convert directly
|
|
40
|
-
var num = parseFloat(value);
|
|
41
|
-
return isNaN(num) ? undefined : num;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return value;
|
|
45
|
-
};
|
|
46
|
-
var getComponentStyle = function (component) {
|
|
47
|
-
if (!component.style) {
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
var style = component.style;
|
|
51
|
-
var result = {};
|
|
52
|
-
// Map fill to color (shortcut property)
|
|
53
|
-
// fill can be a string (hex color) or a dynamic string
|
|
54
|
-
if (style.fill !== undefined) {
|
|
55
|
-
if (typeof style.fill === 'string' && style.fill.includes('{')) {
|
|
56
|
-
result.color = parseDynamicValue(style.fill, object);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
result.color = style.fill;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// Map fontSize to size (shortcut property)
|
|
63
|
-
// fontSize can be number or string (with dynamic references)
|
|
64
|
-
if (style.fontSize !== undefined) {
|
|
65
|
-
var fontSizeValue = parseNumericStyleValue(style.fontSize, object);
|
|
66
|
-
if (fontSizeValue !== undefined) {
|
|
67
|
-
result.size = fontSizeValue;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Map fontFamily (shortcut property)
|
|
71
|
-
if (style.fontFamily !== undefined) {
|
|
72
|
-
if (typeof style.fontFamily === 'string' && style.fontFamily.includes('{')) {
|
|
73
|
-
result.fontFamily = parseDynamicValue(style.fontFamily, object);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
result.fontFamily = style.fontFamily;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Build style object for PixiJS Text properties
|
|
80
|
-
var textStyle = {};
|
|
81
|
-
// Font style properties
|
|
82
|
-
if (style.fontStyle !== undefined) {
|
|
83
|
-
if (typeof style.fontStyle === 'string' && style.fontStyle.includes('{')) {
|
|
84
|
-
textStyle.fontStyle = parseDynamicValue(style.fontStyle, object);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
textStyle.fontStyle = style.fontStyle;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (style.fontWeight !== undefined) {
|
|
91
|
-
if (typeof style.fontWeight === 'string' && style.fontWeight.includes('{')) {
|
|
92
|
-
textStyle.fontWeight = parseDynamicValue(style.fontWeight, object);
|
|
93
|
-
}
|
|
94
|
-
else if (typeof style.fontWeight === 'number') {
|
|
95
|
-
textStyle.fontWeight = style.fontWeight;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
textStyle.fontWeight = style.fontWeight;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Stroke properties
|
|
102
|
-
if (style.stroke !== undefined) {
|
|
103
|
-
if (typeof style.stroke === 'string' && style.stroke.includes('{')) {
|
|
104
|
-
textStyle.stroke = parseDynamicValue(style.stroke, object);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
textStyle.stroke = style.stroke;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// Opacity (can be number or string)
|
|
111
|
-
if (style.opacity !== undefined) {
|
|
112
|
-
var opacityValue = parseNumericStyleValue(style.opacity, object);
|
|
113
|
-
if (opacityValue !== undefined) {
|
|
114
|
-
textStyle.opacity = opacityValue;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Word wrap
|
|
118
|
-
if (style.wordWrap !== undefined) {
|
|
119
|
-
textStyle.wordWrap = style.wordWrap;
|
|
120
|
-
}
|
|
121
|
-
// Text alignment
|
|
122
|
-
if (style.align !== undefined) {
|
|
123
|
-
if (typeof style.align === 'string' && style.align.includes('{')) {
|
|
124
|
-
textStyle.align = parseDynamicValue(style.align, object);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
textStyle.align = style.align;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// Only add style prop if there are style properties
|
|
131
|
-
if (Object.keys(textStyle).length > 0) {
|
|
132
|
-
result.style = textStyle;
|
|
133
|
-
}
|
|
134
|
-
return result;
|
|
135
|
-
};
|
|
136
|
-
let $this = h(Text, { text: parseDynamicValue(component.value, object), ...getComponentStyle(component) });
|
|
6
|
+
useDefineProps($$props);
|
|
7
|
+
var controlsInstance = signal(null);
|
|
8
|
+
mount(function (element) {
|
|
9
|
+
var control = inject('KeyboardControls');
|
|
10
|
+
controlsInstance.set(control);
|
|
11
|
+
});
|
|
12
|
+
let $this = h(Container, { justifyContent: 'space-between', alignItems: 'flex-end', width: '100%', height: '100%' }, [h(Container, { justifyContent: 'flex-start', alignItems: 'flex-end', gap: 20 }, h(Container, { display: 'flex', direction: 'column', gap: 20, margin: 50 }, [h(Button, { text: 'A', shape: 'circle', width: 70, height: 70, controls: controlsInstance, controlName: 'action', style: { backgroundColor: { normal: "#2ecc71", hover: "#27ae60", pressed: "#229954", disabled: "#7f8c8d" }, text: { fontSize: 24, fontFamily: "Arial Bold", color: "#ffffff" } } }), h(Button, { text: 'B', shape: 'circle', width: 70, height: 70, controls: controlsInstance, controlName: 'back', style: { backgroundColor: { normal: "#e74c3c", hover: "#c0392b", pressed: "#a93226", disabled: "#7f8c8d" }, text: { fontSize: 24, fontFamily: "Arial Bold", color: "#ffffff" } } })])), h(Container, { margin: 100, alignItems: 'flex-end' }, h(Container, null, h(Joystick, { controls: controlsInstance, outerColor: '#34495e', innerColor: '#3498db' })))]);
|
|
137
13
|
return $this
|
|
138
14
|
}
|
|
139
15
|
|
package/dist/index40.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index40.js","sources":["../src/components/dynamics/text.ce"],"sourcesContent":["<Text text={@parseDynamicValue(@component.@value, @object)} ...getComponentStyle(component) />\n\n<script>\nimport { computed } from \"canvasengine\";\nimport { parseDynamicValue } from \"./parse-value\";\n\nconst { object } = defineProps();\nconst component = object._component;\n\n/**\n * Parses a numeric style value that can be a number or a string\n * \n * If the value is a string, it may contain dynamic references like {hp}\n * which need to be parsed using parseDynamicValue. If it's a number,\n * it's returned as-is wrapped in a computed.\n * \n * @param value - Numeric value (number or string)\n * @param object - Object to resolve dynamic references from\n * @returns Computed signal with the numeric value\n */\nconst parseNumericStyleValue = (value, object) => {\n if (value === undefined || value === null) {\n return undefined;\n }\n \n if (typeof value === 'number') {\n return value;\n }\n \n if (typeof value === 'string') {\n // Check if it contains dynamic references\n if (value.includes('{')) {\n // Parse dynamic value and convert to number\n const parsed = parseDynamicValue(value, object);\n return computed(() => {\n const str = parsed();\n const num = parseFloat(str);\n return isNaN(num) ? 0 : num;\n });\n } else {\n // Simple string number, convert directly\n const num = parseFloat(value);\n return isNaN(num) ? undefined : num;\n }\n }\n \n return value;\n};\n\n/**\n * Maps component style properties to Canvas Engine Text component props\n * \n * Converts TextComponentOptions from the server to the format expected\n * by the Canvas Engine Text component. Supports all text styling properties\n * including fill, fontSize, fontFamily, fontStyle, fontWeight, stroke,\n * opacity, wordWrap, and align. Also supports dynamic values (number | string)\n * for numeric properties like fontSize and opacity.\n * \n * @param component - Component definition with style property\n * @returns Object with Text component props\n * \n * @example\n * ```ts\n * // Component with style\n * const component = {\n * style: {\n * fill: '#000000',\n * fontSize: 20,\n * fontFamily: 'Arial',\n * fontWeight: 'bold'\n * }\n * };\n * \n * const props = getComponentStyle(component);\n * // Returns: { color: '#000000', size: 20, fontFamily: 'Arial', style: { fontWeight: 'bold' } }\n * \n * // Component with dynamic fontSize\n * const component2 = {\n * style: {\n * fill: '#000000',\n * fontSize: '{hp}', // Will be resolved from object.hp\n * opacity: '0.8'\n * }\n * };\n * ```\n */\nconst getComponentStyle = (component) => {\n if (!component.style) {\n return {};\n }\n\n const style = component.style;\n const result = {};\n\n // Map fill to color (shortcut property)\n // fill can be a string (hex color) or a dynamic string\n if (style.fill !== undefined) {\n if (typeof style.fill === 'string' && style.fill.includes('{')) {\n result.color = parseDynamicValue(style.fill, object);\n } else {\n result.color = style.fill;\n }\n }\n\n // Map fontSize to size (shortcut property)\n // fontSize can be number or string (with dynamic references)\n if (style.fontSize !== undefined) {\n const fontSizeValue = parseNumericStyleValue(style.fontSize, object);\n if (fontSizeValue !== undefined) {\n result.size = fontSizeValue;\n }\n }\n\n // Map fontFamily (shortcut property)\n if (style.fontFamily !== undefined) {\n if (typeof style.fontFamily === 'string' && style.fontFamily.includes('{')) {\n result.fontFamily = parseDynamicValue(style.fontFamily, object);\n } else {\n result.fontFamily = style.fontFamily;\n }\n }\n\n // Build style object for PixiJS Text properties\n const textStyle = {};\n\n // Font style properties\n if (style.fontStyle !== undefined) {\n if (typeof style.fontStyle === 'string' && style.fontStyle.includes('{')) {\n textStyle.fontStyle = parseDynamicValue(style.fontStyle, object);\n } else {\n textStyle.fontStyle = style.fontStyle;\n }\n }\n\n if (style.fontWeight !== undefined) {\n if (typeof style.fontWeight === 'string' && style.fontWeight.includes('{')) {\n textStyle.fontWeight = parseDynamicValue(style.fontWeight, object);\n } else if (typeof style.fontWeight === 'number') {\n textStyle.fontWeight = style.fontWeight;\n } else {\n textStyle.fontWeight = style.fontWeight;\n }\n }\n\n // Stroke properties\n if (style.stroke !== undefined) {\n if (typeof style.stroke === 'string' && style.stroke.includes('{')) {\n textStyle.stroke = parseDynamicValue(style.stroke, object);\n } else {\n textStyle.stroke = style.stroke;\n }\n }\n\n // Opacity (can be number or string)\n if (style.opacity !== undefined) {\n const opacityValue = parseNumericStyleValue(style.opacity, object);\n if (opacityValue !== undefined) {\n textStyle.opacity = opacityValue;\n }\n }\n\n // Word wrap\n if (style.wordWrap !== undefined) {\n textStyle.wordWrap = style.wordWrap;\n }\n\n // Text alignment\n if (style.align !== undefined) {\n if (typeof style.align === 'string' && style.align.includes('{')) {\n textStyle.align = parseDynamicValue(style.align, object);\n } else {\n textStyle.align = style.align;\n }\n }\n\n // Only add style prop if there are style properties\n if (Object.keys(textStyle).length > 0) {\n result.style = textStyle;\n }\n\n return result;\n}\n</script>"],"names":[],"mappings":";;;AAOqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,QAAQ,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,YAAY;AAC9D,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,EAAE;AAC5C,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;AAC5B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3B,QAAQ;AACR,QAAQ,OAAO,CAAC;AAChB,IAAI,CAAC;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AAC1C,CAAC;AACD,IAAI,MAAM,GAAG,WAAW,EAAE,CAAC,MAAM;AACjC,IAAI,SAAS,GAAG,MAAM,CAAC,UAAU;AACjC,IAAI,sBAAsB,GAAG,UAAU,KAAK,EAAE,MAAM,EAAE;AACtD,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;AAC/C,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,IAAI,OAAO,KAAK,KA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CAAC,GAAG,CAAC,EAAE;AAC1E,YAAY,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;AACpE,QAAQ;AACR,aAAa;AACb,YAAY,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK;AACzC,QAAQ;AACR,IAAI;AACJ;AACA,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3C,QAAQ,MAAM,CAAC,KAAK,GAAG,SAAS;AAChC,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB;AACA,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,iBAAiB,CAAC,SAAS,CAAC,EAAE;AACjH,QAAQ,OAAO;AACf,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"index40.js","sources":["../src/components/gui/mobile/mobile.ce"],"sourcesContent":["<Container justifyContent=\"space-between\" alignItems=\"flex-end\" width=\"100%\" height=\"100%\">\n <!-- Gamepad buttons A and B (left side) -->\n <Container justifyContent=\"flex-start\" alignItems=\"flex-end\" gap={20}>\n <Container display=\"flex\" direction=\"column\" gap={20} margin={50}>\n <!-- Button B (top) -->\n \n <!-- Button A (bottom) -->\n <Button \n text=\"A\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"action\"\n style={{\n backgroundColor: {\n normal: \"#2ecc71\",\n hover: \"#27ae60\",\n pressed: \"#229954\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n <Button \n text=\"B\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"back\"\n style={{\n backgroundColor: {\n normal: \"#e74c3c\",\n hover: \"#c0392b\",\n pressed: \"#a93226\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n </Container>\n </Container>\n \n <Container margin={100} alignItems=\"flex-end\">\n <Container>\n <Joystick \n controls={controlsInstance}\n outerColor=\"#34495e\"\n innerColor=\"#3498db\"\n />\n </Container>\n </Container>\n</Container>\n\n<script>\n import { signal, mount } from 'canvasengine'\n import { Button } from 'canvasengine'\n import { inject } from '../../../core/inject'\n import { RpgClientEngine } from '../../../RpgClientEngine'\n import { Direction } from '@rpgjs/common'\n\n\n const controlsInstance = signal(null)\n\n mount((element) => {\n const control = inject('KeyboardControls')\n controlsInstance.set(control)\n })\n</script>"],"names":[],"mappings":";;;AASqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAA4B,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC;AAC3C,KAAK,CAAC,UAAU,OAAO,EAAE;AACzB,IAAI,IAAI,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAC5C,IAAI,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC;AACjC,CAAC,CAAC;AACF,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAA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
import { inject } from './index6.js';
|
|
4
|
-
import { RpgClientEngine } from './index2.js';
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
useProps($$props);
|
|
8
|
-
useDefineProps($$props);
|
|
9
|
-
var lastDirection = null;
|
|
10
|
-
var client = inject(RpgClientEngine);
|
|
11
|
-
var onChange = function (event) {
|
|
12
|
-
var control = inject('KeyboardControls');
|
|
13
|
-
if (lastDirection !== event.direction) {
|
|
14
|
-
if (lastDirection !== null) {
|
|
15
|
-
control.applyControl(lastDirection, true);
|
|
16
|
-
}
|
|
17
|
-
lastDirection = event.direction;
|
|
18
|
-
control.applyControl(lastDirection);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var onEnd = function () {
|
|
22
|
-
var control = inject('KeyboardControls');
|
|
23
|
-
if (lastDirection !== null) {
|
|
24
|
-
control.applyControl(lastDirection, false);
|
|
25
|
-
lastDirection = null;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var onButtonAClick = function () {
|
|
29
|
-
if (client) {
|
|
30
|
-
client.processAction({ action: 'action' });
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var onButtonBClick = function () {
|
|
34
|
-
if (client) {
|
|
35
|
-
client.processAction({ action: 'back' });
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
let $this = h(Container, { justifyContent: 'space-between', alignItems: 'flex-end', width: '100%', height: '100%' }, [h(Container, { justifyContent: 'flex-start', alignItems: 'flex-end', margin: 100, gap: 20 }, [h(Button, { text: 'A', width: 60, height: 60, style: { backgroundColor: { normal: '#4CAF50', hover: '#45a049', pressed: '#3d8b40' }, border: { color: '#2e7d32', width: 3, radius: 30 }, text: { color: '#ffffff', fontSize: 24, fontFamily: 'Arial' } }, click: onButtonAClick }), h(Button, { text: 'B', width: 60, height: 60, style: { backgroundColor: { normal: '#f44336', hover: '#da190b', pressed: '#c62828' }, border: { color: '#b71c1c', width: 3, radius: 30 }, text: { color: '#ffffff', fontSize: 24, fontFamily: 'Arial' } }, click: onButtonBClick })]), h(Container, { margin: 100 }, h(Joystick, { onChange, onEnd }))]);
|
|
39
|
-
return $this
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { component as default };
|
|
4
|
+
export { __name };
|
|
43
5
|
//# sourceMappingURL=index41.js.map
|
package/dist/index41.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index41.js","sources":["
|
|
1
|
+
{"version":3,"file":"index41.js","sources":["../../../node_modules/.pnpm/@signe+sync@2.6.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\nexport {\n __name\n};\n//# sourceMappingURL=chunk-7QVYU63E.js.map"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc;AAClC,IAAC,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;;;;","x_google_ignoreList":[0]}
|