@@ -112,6 +112,7 @@ const LAYOUT_ELEMENT_TEXT_STYLE_ALIGN_KEYS = ["left", "center", "right"];
112112const LAYOUT_ELEMENT_BASE_TYPES = [
113113 "folder" ,
114114 "container" ,
115+ "rect" ,
115116 "sprite" ,
116117 "text" ,
117118 "text-revealing" ,
@@ -387,8 +388,8 @@ const validateSceneItems = ({ items, path, errorFactory }) => {
387388 value : item ,
388389 allowedKeys :
389390 item ?. type === "scene"
390- ? [ "id" , "type" , "name" , "position" , "sections" ]
391- : [ "id" , "type" , "name" , "position" ] ,
391+ ? [ "id" , "type" , "name" , "description" , " position", "sections" ]
392+ : [ "id" , "type" , "name" , "description" , " position"] ,
392393 path : itemPath ,
393394 errorFactory,
394395 } ) ;
@@ -425,6 +426,13 @@ const validateSceneItems = ({ items, path, errorFactory }) => {
425426 ) ;
426427 }
427428
429+ if ( item . description !== undefined && ! isString ( item . description ) ) {
430+ return invalidFromErrorFactory (
431+ errorFactory ,
432+ `${ itemPath } .description must be a string when provided` ,
433+ ) ;
434+ }
435+
428436 {
429437 const result = validateOptionalPosition ( {
430438 value : item . position ,
@@ -2121,6 +2129,47 @@ const validateLayoutElementStyle = ({ style, path, errorFactory }) => {
21212129 }
21222130} ;
21232131
2132+ const validateLayoutElementBorder = ( { border, path, errorFactory } ) => {
2133+ {
2134+ const result = validateAllowedKeys ( {
2135+ value : border ,
2136+ allowedKeys : [ "color" , "alpha" , "width" ] ,
2137+ path,
2138+ errorFactory,
2139+ } ) ;
2140+ if ( result ?. valid === false ) {
2141+ return result ;
2142+ }
2143+ }
2144+
2145+ if ( border . color !== undefined && ! isString ( border . color ) ) {
2146+ return invalidFromErrorFactory (
2147+ errorFactory ,
2148+ `${ path } .color must be a string when provided` ,
2149+ ) ;
2150+ }
2151+
2152+ if (
2153+ border . alpha !== undefined &&
2154+ ( ! isFiniteNumber ( border . alpha ) || border . alpha < 0 || border . alpha > 1 )
2155+ ) {
2156+ return invalidFromErrorFactory (
2157+ errorFactory ,
2158+ `${ path } .alpha must be a finite number between 0 and 1 when provided` ,
2159+ ) ;
2160+ }
2161+
2162+ if (
2163+ border . width !== undefined &&
2164+ ( ! isFiniteNumber ( border . width ) || border . width < 0 )
2165+ ) {
2166+ return invalidFromErrorFactory (
2167+ errorFactory ,
2168+ `${ path } .width must be a finite number greater than or equal to 0 when provided` ,
2169+ ) ;
2170+ }
2171+ } ;
2172+
21242173const validateLayoutElementData = ( {
21252174 data,
21262175 path,
@@ -2144,6 +2193,8 @@ const validateLayoutElementData = ({
21442193 "scaleY" ,
21452194 "rotation" ,
21462195 "opacity" ,
2196+ "fill" ,
2197+ "border" ,
21472198 "text" ,
21482199 "style" ,
21492200 "displaySpeed" ,
@@ -2273,6 +2324,13 @@ const validateLayoutElementData = ({
22732324 }
22742325 }
22752326
2327+ if ( data . fill !== undefined && ! isString ( data . fill ) ) {
2328+ return invalidFromErrorFactory (
2329+ errorFactory ,
2330+ `${ path } .fill must be a string when provided` ,
2331+ ) ;
2332+ }
2333+
22762334 if (
22772335 data . direction !== undefined &&
22782336 data . direction !== "horizontal" &&
@@ -2314,6 +2372,26 @@ const validateLayoutElementData = ({
23142372 }
23152373 }
23162374
2375+ if ( data . border !== undefined ) {
2376+ if ( ! isPlainObject ( data . border ) ) {
2377+ return invalidFromErrorFactory (
2378+ errorFactory ,
2379+ `${ path } .border must be an object when provided` ,
2380+ ) ;
2381+ }
2382+
2383+ {
2384+ const result = validateLayoutElementBorder ( {
2385+ border : data . border ,
2386+ path : `${ path } .border` ,
2387+ errorFactory,
2388+ } ) ;
2389+ if ( result ?. valid === false ) {
2390+ return result ;
2391+ }
2392+ }
2393+ }
2394+
23172395 if ( data . click !== undefined && ! isPlainObject ( data . click ) ) {
23182396 return invalidFromErrorFactory (
23192397 errorFactory ,
@@ -2357,6 +2435,8 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
23572435 "scaleY" ,
23582436 "rotation" ,
23592437 "opacity" ,
2438+ "fill" ,
2439+ "border" ,
23602440 "text" ,
23612441 "style" ,
23622442 "displaySpeed" ,
@@ -2630,7 +2710,6 @@ const validateLayoutItems = ({ items, path, errorFactory }) => {
26302710 return result ;
26312711 }
26322712 }
2633-
26342713 }
26352714 }
26362715} ;
@@ -4085,7 +4164,7 @@ const validateSceneCreateData = ({ data, errorFactory }) => {
40854164 {
40864165 const result = validateAllowedKeys ( {
40874166 value : data ,
4088- allowedKeys : [ "name" , "type" , "position" ] ,
4167+ allowedKeys : [ "name" , "description" , " type", "position" ] ,
40894168 path : "payload.data" ,
40904169 errorFactory,
40914170 } ) ;
@@ -4101,6 +4180,13 @@ const validateSceneCreateData = ({ data, errorFactory }) => {
41014180 ) ;
41024181 }
41034182
4183+ if ( data . description !== undefined && ! isString ( data . description ) ) {
4184+ return invalidFromErrorFactory (
4185+ errorFactory ,
4186+ "payload.data.description must be a string when provided" ,
4187+ ) ;
4188+ }
4189+
41044190 if (
41054191 data . type !== undefined &&
41064192 data . type !== "scene" &&
@@ -4128,7 +4214,7 @@ const validateSceneUpdateData = ({ data, errorFactory }) => {
41284214 {
41294215 const result = validateAllowedKeys ( {
41304216 value : data ,
4131- allowedKeys : [ "name" , "position" ] ,
4217+ allowedKeys : [ "name" , "description" , " position"] ,
41324218 path : "payload.data" ,
41334219 errorFactory,
41344220 } ) ;
@@ -4138,9 +4224,10 @@ const validateSceneUpdateData = ({ data, errorFactory }) => {
41384224 }
41394225
41404226 const hasName = data . name !== undefined ;
4227+ const hasDescription = data . description !== undefined ;
41414228 const hasPosition = data . position !== undefined ;
41424229
4143- if ( ! hasName && ! hasPosition ) {
4230+ if ( ! hasName && ! hasDescription && ! hasPosition ) {
41444231 return invalidFromErrorFactory (
41454232 errorFactory ,
41464233 "payload.data must include at least one updatable field" ,
@@ -4154,6 +4241,13 @@ const validateSceneUpdateData = ({ data, errorFactory }) => {
41544241 ) ;
41554242 }
41564243
4244+ if ( hasDescription && ! isString ( data . description ) ) {
4245+ return invalidFromErrorFactory (
4246+ errorFactory ,
4247+ "payload.data.description must be a string when provided" ,
4248+ ) ;
4249+ }
4250+
41574251 if ( hasPosition ) {
41584252 {
41594253 const result = validateOptionalPosition ( {
@@ -6055,7 +6149,6 @@ const validateLayoutCreateData = ({ data, errorFactory }) => {
60556149 return result ;
60566150 }
60576151 }
6058-
60596152 }
60606153} ;
60616154
@@ -6095,7 +6188,6 @@ const validateLayoutUpdateData = ({ data, errorFactory }) => {
60956188 "payload.data.layoutType must be 'normal', 'dialogue', 'nvl', or 'choice' when provided" ,
60966189 ) ;
60976190 }
6098-
60996191} ;
61006192
61016193const validateControlCreateData = ( { data, errorFactory } ) => {
@@ -7326,6 +7418,10 @@ const COMMAND_DEFINITIONS = [
73267418 name : payload . data . name ,
73277419 } ;
73287420
7421+ if ( payload . data . description !== undefined ) {
7422+ nextScene . description = payload . data . description ;
7423+ }
7424+
73297425 if ( nextScene . type === "scene" ) {
73307426 nextScene . sections = createEmptyNestedCollection ( ) ;
73317427 }
@@ -7395,6 +7491,10 @@ const COMMAND_DEFINITIONS = [
73957491 nextScene . name = payload . data . name ;
73967492 }
73977493
7494+ if ( payload . data . description !== undefined ) {
7495+ nextScene . description = payload . data . description ;
7496+ }
7497+
73987498 if ( payload . data . position !== undefined ) {
73997499 nextScene . position = {
74007500 ...( isPlainObject ( nextScene . position ) ? nextScene . position : { } ) ,
0 commit comments