@nice2dev/ui-graphics 1.3.15 → 1.3.16

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 (294) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/animation/AnimatedPerson.js +470 -143
  3. package/dist/cjs/animation/AnimationEditor.js +289 -101
  4. package/dist/cjs/animation/Audience.js +83 -61
  5. package/dist/cjs/animation/BodyRenderer.js +69 -28
  6. package/dist/cjs/animation/animationHelper.js +281 -288
  7. package/dist/cjs/animation/characterTypes.js +200 -203
  8. package/dist/cjs/animation/choreoDSL.js +205 -219
  9. package/dist/cjs/animation/choreography.js +4 -32
  10. package/dist/cjs/animation/karaokeIntegration.js +68 -77
  11. package/dist/cjs/animation/lottieExport.js +108 -114
  12. package/dist/cjs/animation/motionPath.js +225 -248
  13. package/dist/cjs/animation/physics.js +227 -254
  14. package/dist/cjs/animation/rig/RigPlayer.js +53 -56
  15. package/dist/cjs/animation/rig/RiggedBody.js +71 -26
  16. package/dist/cjs/animation/rig/choreoRigBridge.js +72 -77
  17. package/dist/cjs/animation/rig/ik.js +13 -18
  18. package/dist/cjs/animation/rig/poseOps.js +34 -41
  19. package/dist/cjs/animation/rig/presets.js +64 -72
  20. package/dist/cjs/animation/rig/rigMath.js +25 -32
  21. package/dist/cjs/animation/rig/rigTypes.js +59 -63
  22. package/dist/cjs/animation/shapes/arms.js +31 -13
  23. package/dist/cjs/animation/shapes/eyes.js +129 -47
  24. package/dist/cjs/animation/shapes/hair.js +72 -45
  25. package/dist/cjs/animation/shapes/heads.js +131 -57
  26. package/dist/cjs/animation/shapes/headwear.js +47 -38
  27. package/dist/cjs/animation/shapes/legs.js +31 -13
  28. package/dist/cjs/animation/shapes/mouths.js +120 -44
  29. package/dist/cjs/animation/shapes/noses.js +80 -25
  30. package/dist/cjs/animation/shapes/outfits.js +101 -39
  31. package/dist/cjs/animation/shapes/torsos.js +15 -11
  32. package/dist/cjs/animation/spineExport.js +103 -121
  33. package/dist/cjs/core/LocalUI.js +108 -43
  34. package/dist/cjs/core/NiceBrushEngine.js +758 -552
  35. package/dist/cjs/core/collaboration.js +249 -251
  36. package/dist/cjs/core/colorBlindness.js +100 -115
  37. package/dist/cjs/core/dragDrop.js +155 -158
  38. package/dist/cjs/core/editorAsk.js +51 -41
  39. package/dist/cjs/core/fixes.js +140 -171
  40. package/dist/cjs/core/gridGuides.js +166 -201
  41. package/dist/cjs/core/historyVisual.js +156 -135
  42. package/dist/cjs/core/i18n.js +13 -14
  43. package/dist/cjs/core/integrations.js +238 -249
  44. package/dist/cjs/core/minimap.js +149 -151
  45. package/dist/cjs/core/plugins.js +98 -113
  46. package/dist/cjs/core/rtl.js +71 -83
  47. package/dist/cjs/core/shortcuts.js +196 -225
  48. package/dist/cjs/core/theme.js +142 -149
  49. package/dist/cjs/core/yjsCollaboration.js +232 -293
  50. package/dist/cjs/design/design-tools.js +12 -22
  51. package/dist/cjs/font/NiceFontEditor.js +877 -316
  52. package/dist/cjs/font/fontFormatUtils.js +388 -448
  53. package/dist/cjs/game/GameAsset2dEditor.js +1201 -392
  54. package/dist/cjs/game/GameAsset2dEditor.module.css.js +146 -5
  55. package/dist/cjs/game/gameAssetTypes.js +7 -16
  56. package/dist/cjs/game/gameAssetUtils.js +390 -413
  57. package/dist/cjs/game/useGameAssetEditor.js +820 -763
  58. package/dist/cjs/index.js +81 -84
  59. package/dist/cjs/nice2dev-ui-graphics.css +1 -1
  60. package/dist/cjs/node_modules/lib0/array.js +8 -70
  61. package/dist/cjs/node_modules/lib0/binary.js +3 -20
  62. package/dist/cjs/node_modules/lib0/broadcastchannel.js +24 -86
  63. package/dist/cjs/node_modules/lib0/buffer.js +15 -82
  64. package/dist/cjs/node_modules/lib0/conditions.js +3 -16
  65. package/dist/cjs/node_modules/lib0/decoding.js +108 -287
  66. package/dist/cjs/node_modules/lib0/dom.js +14 -44
  67. package/dist/cjs/node_modules/lib0/encoding.js +68 -418
  68. package/dist/cjs/node_modules/lib0/environment.js +26 -92
  69. package/dist/cjs/node_modules/lib0/error.js +5 -29
  70. package/dist/cjs/node_modules/lib0/function.js +27 -66
  71. package/dist/cjs/node_modules/lib0/iterator.js +8 -33
  72. package/dist/cjs/node_modules/lib0/logging.common.js +12 -22
  73. package/dist/cjs/node_modules/lib0/logging.js +32 -71
  74. package/dist/cjs/node_modules/lib0/map.js +16 -86
  75. package/dist/cjs/node_modules/lib0/math.js +3 -32
  76. package/dist/cjs/node_modules/lib0/number.js +4 -15
  77. package/dist/cjs/node_modules/lib0/object.js +14 -88
  78. package/dist/cjs/node_modules/lib0/observable.js +38 -78
  79. package/dist/cjs/node_modules/lib0/pair.js +3 -20
  80. package/dist/cjs/node_modules/lib0/prng.js +8 -77
  81. package/dist/cjs/node_modules/lib0/promise.js +6 -30
  82. package/dist/cjs/node_modules/lib0/random.js +8 -23
  83. package/dist/cjs/node_modules/lib0/schema.js +313 -687
  84. package/dist/cjs/node_modules/lib0/set.js +3 -10
  85. package/dist/cjs/node_modules/lib0/storage.js +20 -55
  86. package/dist/cjs/node_modules/lib0/string.js +17 -72
  87. package/dist/cjs/node_modules/lib0/symbol.js +2 -12
  88. package/dist/cjs/node_modules/lib0/time.js +2 -15
  89. package/dist/cjs/node_modules/lib0/trait/equality.js +3 -28
  90. package/dist/cjs/node_modules/lib0/url.js +4 -18
  91. package/dist/cjs/node_modules/lib0/webcrypto.js +2 -5
  92. package/dist/cjs/node_modules/y-protocols/auth.js +5 -19
  93. package/dist/cjs/node_modules/y-protocols/awareness.js +53 -116
  94. package/dist/cjs/node_modules/y-protocols/sync.js +16 -103
  95. package/dist/cjs/node_modules/y-websocket/src/y-websocket.js +77 -219
  96. package/dist/cjs/node_modules/yjs/dist/yjs.js +2128 -4868
  97. package/dist/cjs/photo/FilterThumb.js +37 -25
  98. package/dist/cjs/photo/NiceAITools.js +679 -467
  99. package/dist/cjs/photo/PhotoEditor.js +34 -20
  100. package/dist/cjs/photo/PhotoEditor.module.css.js +296 -5
  101. package/dist/cjs/photo/PhotoEditorCanvas.js +250 -91
  102. package/dist/cjs/photo/PhotoEditorLeftPanel.js +1086 -224
  103. package/dist/cjs/photo/PhotoEditorToolbar.js +135 -19
  104. package/dist/cjs/photo/photoEditorActions.js +89 -72
  105. package/dist/cjs/photo/photoEditorTypes.js +29 -32
  106. package/dist/cjs/photo/photoFilters.js +959 -985
  107. package/dist/cjs/photo/photoOverlays.js +899 -945
  108. package/dist/cjs/photo/photoSelection.js +427 -499
  109. package/dist/cjs/photo/usePhotoEditor.js +739 -741
  110. package/dist/cjs/pixel/HSVPicker.js +191 -175
  111. package/dist/cjs/pixel/PixelEditor.js +159 -48
  112. package/dist/cjs/pixel/PixelEditor.module.css.js +209 -5
  113. package/dist/cjs/pixel/PixelEditorCanvas.js +29 -16
  114. package/dist/cjs/pixel/PixelEditorMenuBar.js +160 -162
  115. package/dist/cjs/pixel/PixelEditorRightPanel.js +377 -45
  116. package/dist/cjs/pixel/PixelEditorStatusBar.js +47 -20
  117. package/dist/cjs/pixel/PixelEditorTimeline.js +106 -23
  118. package/dist/cjs/pixel/PixelEditorToolbar.js +99 -21
  119. package/dist/cjs/pixel/SpriteGeneratorPanel.js +483 -303
  120. package/dist/cjs/pixel/animalGeneratorPresets.js +776 -601
  121. package/dist/cjs/pixel/asepriteFormat.js +511 -560
  122. package/dist/cjs/pixel/buildingGeneratorPresets.js +693 -520
  123. package/dist/cjs/pixel/characterGeneratorPresets.js +644 -544
  124. package/dist/cjs/pixel/pixel-pro.js +52 -63
  125. package/dist/cjs/pixel/pixelEditorExports.js +388 -428
  126. package/dist/cjs/pixel/pixelEditorTypes.js +91 -108
  127. package/dist/cjs/pixel/pixelEditorUtils.js +519 -561
  128. package/dist/cjs/pixel/spriteGeneratorCore.js +206 -257
  129. package/dist/cjs/pixel/usePixelEditor.js +1321 -1343
  130. package/dist/cjs/texture/Nice3DTexturePainter.js +707 -440
  131. package/dist/cjs/ui/NiceUIDesigner.js +954 -527
  132. package/dist/cjs/vector/NiceSvgToCode.js +586 -446
  133. package/dist/cjs/vector/VectorEditor.js +290 -117
  134. package/dist/cjs/vector/VectorEditor.module.css.js +86 -5
  135. package/dist/cjs/vector/VectorEditorMenuBar.js +333 -275
  136. package/dist/cjs/vector/VectorEditorRightPanel.js +1094 -371
  137. package/dist/cjs/vector/VectorEditorShapeRenderer.js +198 -60
  138. package/dist/cjs/vector/VectorEditorStatusBar.js +39 -13
  139. package/dist/cjs/vector/useVectorEditor.js +848 -889
  140. package/dist/cjs/vector/vectorAnimation.js +110 -137
  141. package/dist/cjs/vector/vectorBooleanOps.js +398 -485
  142. package/dist/cjs/vector/vectorEditorExport.js +201 -203
  143. package/dist/cjs/vector/vectorEditorImport.js +173 -189
  144. package/dist/cjs/vector/vectorEditorTypes.js +42 -49
  145. package/dist/cjs/vector/vectorGradients.js +151 -174
  146. package/dist/cjs/vector/vectorIconExport.js +52 -59
  147. package/dist/cjs/vector/vectorIconImport.js +169 -219
  148. package/dist/esm/animation/AnimatedPerson.js +470 -141
  149. package/dist/esm/animation/AnimationEditor.js +290 -100
  150. package/dist/esm/animation/Audience.js +83 -59
  151. package/dist/esm/animation/BodyRenderer.js +71 -25
  152. package/dist/esm/animation/animationHelper.js +284 -287
  153. package/dist/esm/animation/characterTypes.js +204 -202
  154. package/dist/esm/animation/choreoDSL.js +212 -218
  155. package/dist/esm/animation/choreography.js +8 -31
  156. package/dist/esm/animation/karaokeIntegration.js +74 -76
  157. package/dist/esm/animation/lottieExport.js +112 -113
  158. package/dist/esm/animation/motionPath.js +235 -247
  159. package/dist/esm/animation/physics.js +235 -253
  160. package/dist/esm/animation/rig/RigPlayer.js +53 -54
  161. package/dist/esm/animation/rig/RiggedBody.js +71 -24
  162. package/dist/esm/animation/rig/choreoRigBridge.js +74 -76
  163. package/dist/esm/animation/rig/ik.js +14 -17
  164. package/dist/esm/animation/rig/poseOps.js +37 -40
  165. package/dist/esm/animation/rig/presets.js +70 -71
  166. package/dist/esm/animation/rig/rigMath.js +28 -31
  167. package/dist/esm/animation/rig/rigTypes.js +62 -62
  168. package/dist/esm/animation/shapes/arms.js +32 -12
  169. package/dist/esm/animation/shapes/eyes.js +135 -46
  170. package/dist/esm/animation/shapes/hair.js +80 -44
  171. package/dist/esm/animation/shapes/heads.js +140 -56
  172. package/dist/esm/animation/shapes/headwear.js +54 -37
  173. package/dist/esm/animation/shapes/legs.js +32 -12
  174. package/dist/esm/animation/shapes/mouths.js +127 -43
  175. package/dist/esm/animation/shapes/noses.js +87 -24
  176. package/dist/esm/animation/shapes/outfits.js +106 -38
  177. package/dist/esm/animation/shapes/torsos.js +16 -10
  178. package/dist/esm/animation/spineExport.js +106 -120
  179. package/dist/esm/core/LocalUI.js +111 -42
  180. package/dist/esm/core/NiceBrushEngine.js +761 -551
  181. package/dist/esm/core/collaboration.js +255 -250
  182. package/dist/esm/core/colorBlindness.js +106 -114
  183. package/dist/esm/core/dragDrop.js +157 -157
  184. package/dist/esm/core/editorAsk.js +53 -40
  185. package/dist/esm/core/fixes.js +145 -170
  186. package/dist/esm/core/gridGuides.js +178 -200
  187. package/dist/esm/core/historyVisual.js +158 -134
  188. package/dist/esm/core/i18n.js +15 -13
  189. package/dist/esm/core/integrations.js +244 -248
  190. package/dist/esm/core/minimap.js +151 -150
  191. package/dist/esm/core/plugins.js +102 -112
  192. package/dist/esm/core/rtl.js +77 -82
  193. package/dist/esm/core/shortcuts.js +200 -224
  194. package/dist/esm/core/theme.js +150 -148
  195. package/dist/esm/core/yjsCollaboration.js +240 -292
  196. package/dist/esm/design/design-tools.js +13 -21
  197. package/dist/esm/font/NiceFontEditor.js +880 -315
  198. package/dist/esm/font/fontFormatUtils.js +394 -447
  199. package/dist/esm/game/GameAsset2dEditor.js +1202 -391
  200. package/dist/esm/game/GameAsset2dEditor.module.css.js +146 -3
  201. package/dist/esm/game/gameAssetTypes.js +8 -15
  202. package/dist/esm/game/gameAssetUtils.js +408 -412
  203. package/dist/esm/game/useGameAssetEditor.js +821 -762
  204. package/dist/esm/index.js +332 -69
  205. package/dist/esm/nice2dev-ui-graphics.css +1 -1
  206. package/dist/esm/node_modules/lib0/array.js +15 -69
  207. package/dist/esm/node_modules/lib0/binary.js +14 -19
  208. package/dist/esm/node_modules/lib0/broadcastchannel.js +27 -85
  209. package/dist/esm/node_modules/lib0/buffer.js +20 -80
  210. package/dist/esm/node_modules/lib0/conditions.js +4 -15
  211. package/dist/esm/node_modules/lib0/decoding.js +128 -286
  212. package/dist/esm/node_modules/lib0/dom.js +20 -43
  213. package/dist/esm/node_modules/lib0/encoding.js +90 -415
  214. package/dist/esm/node_modules/lib0/environment.js +33 -91
  215. package/dist/esm/node_modules/lib0/error.js +8 -28
  216. package/dist/esm/node_modules/lib0/function.js +31 -65
  217. package/dist/esm/node_modules/lib0/iterator.js +11 -32
  218. package/dist/esm/node_modules/lib0/logging.common.js +22 -21
  219. package/dist/esm/node_modules/lib0/logging.js +44 -70
  220. package/dist/esm/node_modules/lib0/map.js +21 -85
  221. package/dist/esm/node_modules/lib0/math.js +9 -31
  222. package/dist/esm/node_modules/lib0/number.js +7 -14
  223. package/dist/esm/node_modules/lib0/object.js +26 -87
  224. package/dist/esm/node_modules/lib0/observable.js +40 -77
  225. package/dist/esm/node_modules/lib0/pair.js +5 -19
  226. package/dist/esm/node_modules/lib0/prng.js +15 -76
  227. package/dist/esm/node_modules/lib0/promise.js +7 -29
  228. package/dist/esm/node_modules/lib0/random.js +10 -22
  229. package/dist/esm/node_modules/lib0/schema.js +367 -686
  230. package/dist/esm/node_modules/lib0/set.js +4 -9
  231. package/dist/esm/node_modules/lib0/storage.js +23 -54
  232. package/dist/esm/node_modules/lib0/string.js +26 -71
  233. package/dist/esm/node_modules/lib0/symbol.js +3 -11
  234. package/dist/esm/node_modules/lib0/time.js +3 -14
  235. package/dist/esm/node_modules/lib0/trait/equality.js +5 -27
  236. package/dist/esm/node_modules/lib0/url.js +5 -17
  237. package/dist/esm/node_modules/lib0/webcrypto.js +3 -4
  238. package/dist/esm/node_modules/y-protocols/auth.js +7 -18
  239. package/dist/esm/node_modules/y-protocols/awareness.js +58 -115
  240. package/dist/esm/node_modules/y-protocols/sync.js +26 -102
  241. package/dist/esm/node_modules/y-websocket/src/y-websocket.js +82 -218
  242. package/dist/esm/node_modules/yjs/dist/yjs.js +2263 -4899
  243. package/dist/esm/photo/FilterThumb.js +37 -23
  244. package/dist/esm/photo/NiceAITools.js +685 -466
  245. package/dist/esm/photo/PhotoEditor.js +34 -18
  246. package/dist/esm/photo/PhotoEditor.module.css.js +296 -3
  247. package/dist/esm/photo/PhotoEditorCanvas.js +250 -89
  248. package/dist/esm/photo/PhotoEditorLeftPanel.js +1086 -222
  249. package/dist/esm/photo/PhotoEditorToolbar.js +135 -17
  250. package/dist/esm/photo/photoEditorActions.js +93 -71
  251. package/dist/esm/photo/photoEditorTypes.js +32 -31
  252. package/dist/esm/photo/photoFilters.js +967 -984
  253. package/dist/esm/photo/photoOverlays.js +913 -944
  254. package/dist/esm/photo/photoSelection.js +438 -498
  255. package/dist/esm/photo/usePhotoEditor.js +740 -740
  256. package/dist/esm/pixel/HSVPicker.js +192 -174
  257. package/dist/esm/pixel/PixelEditor.js +160 -47
  258. package/dist/esm/pixel/PixelEditor.module.css.js +209 -3
  259. package/dist/esm/pixel/PixelEditorCanvas.js +29 -14
  260. package/dist/esm/pixel/PixelEditorMenuBar.js +160 -160
  261. package/dist/esm/pixel/PixelEditorRightPanel.js +377 -43
  262. package/dist/esm/pixel/PixelEditorStatusBar.js +47 -18
  263. package/dist/esm/pixel/PixelEditorTimeline.js +106 -21
  264. package/dist/esm/pixel/PixelEditorToolbar.js +99 -19
  265. package/dist/esm/pixel/SpriteGeneratorPanel.js +483 -301
  266. package/dist/esm/pixel/animalGeneratorPresets.js +782 -600
  267. package/dist/esm/pixel/asepriteFormat.js +517 -559
  268. package/dist/esm/pixel/buildingGeneratorPresets.js +699 -519
  269. package/dist/esm/pixel/characterGeneratorPresets.js +650 -543
  270. package/dist/esm/pixel/pixel-pro.js +53 -62
  271. package/dist/esm/pixel/pixelEditorExports.js +397 -427
  272. package/dist/esm/pixel/pixelEditorTypes.js +103 -107
  273. package/dist/esm/pixel/pixelEditorUtils.js +551 -560
  274. package/dist/esm/pixel/spriteGeneratorCore.js +223 -256
  275. package/dist/esm/pixel/usePixelEditor.js +1322 -1342
  276. package/dist/esm/texture/Nice3DTexturePainter.js +709 -439
  277. package/dist/esm/ui/NiceUIDesigner.js +957 -526
  278. package/dist/esm/vector/NiceSvgToCode.js +589 -445
  279. package/dist/esm/vector/VectorEditor.js +291 -116
  280. package/dist/esm/vector/VectorEditor.module.css.js +86 -3
  281. package/dist/esm/vector/VectorEditorMenuBar.js +333 -273
  282. package/dist/esm/vector/VectorEditorRightPanel.js +1094 -369
  283. package/dist/esm/vector/VectorEditorShapeRenderer.js +199 -59
  284. package/dist/esm/vector/VectorEditorStatusBar.js +39 -11
  285. package/dist/esm/vector/useVectorEditor.js +849 -888
  286. package/dist/esm/vector/vectorAnimation.js +115 -136
  287. package/dist/esm/vector/vectorBooleanOps.js +401 -484
  288. package/dist/esm/vector/vectorEditorExport.js +207 -202
  289. package/dist/esm/vector/vectorEditorImport.js +174 -188
  290. package/dist/esm/vector/vectorEditorTypes.js +50 -48
  291. package/dist/esm/vector/vectorGradients.js +158 -173
  292. package/dist/esm/vector/vectorIconExport.js +53 -58
  293. package/dist/esm/vector/vectorIconImport.js +171 -218
  294. package/package.json +9 -15
@@ -1,115 +1,303 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var ui = require('@nice2dev/ui');
5
- var uiCore = require('@nice2dev/ui-core');
6
- var React = require('react');
7
- var i18n = require('../core/i18n.js');
8
- var AnimatedPerson = require('./AnimatedPerson.js');
9
- var characterTypes = require('./characterTypes.js');
10
-
11
- const STORAGE_KEY = 'nice2dev.animation-editor.character';
12
- /* ---------- helpers ---------- */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const ui = require("@nice2dev/ui");
5
+ const uiCore = require("@nice2dev/ui-core");
6
+ const React = require("react");
7
+ const i18n = require("../core/i18n.js");
8
+ const AnimatedPerson = require("./AnimatedPerson.js");
9
+ const characterTypes = require("./characterTypes.js");
10
+ const STORAGE_KEY = "nice2dev.animation-editor.character";
13
11
  function clampPalette(colors) {
14
- const c = (colors || []).slice(0, 3);
15
- if (c.length === 0) {
16
- c.push('var(--anim-default-black, #000000)');
17
- }
18
- while (c.length < 3) {
19
- c.push(c[c.length - 1]);
20
- }
21
- return c;
12
+ const c = (colors || []).slice(0, 3);
13
+ if (c.length === 0) {
14
+ c.push("var(--anim-default-black, #000000)");
15
+ }
16
+ while (c.length < 3) {
17
+ c.push(c[c.length - 1]);
18
+ }
19
+ return c;
22
20
  }
23
21
  function ColorInputs({ value, onChange }) {
24
- var _a;
25
- const base = clampPalette(value);
26
- const count = Math.min(3, Math.max(1, (_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 1));
27
- const view = base.slice(0, count);
28
- return (jsxRuntime.jsxs("div", { className: "ntd-ae-color-inputs", children: [jsxRuntime.jsx("div", { className: "ntd-ae-colors", children: view.map((col, i) => (jsxRuntime.jsxs("label", { className: "ntd-ae-color-label", children: ["C", i + 1, jsxRuntime.jsx(ui.NiceColorPicker, { value: col, onChange: (color) => {
29
- const next = [...view];
30
- next[i] = color;
31
- onChange(next);
32
- } })] }, i))) }), jsxRuntime.jsxs("div", { className: "ntd-ae-color-btns", children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", disabled: count <= 1, onClick: () => onChange(view.slice(0, Math.max(1, count - 1))), children: "-" }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", disabled: count >= 3, onClick: () => onChange([...view, view[view.length - 1] || 'var(--anim-default-black, #000000)']), children: "+" })] })] }));
22
+ const base = clampPalette(value);
23
+ const count = Math.min(3, Math.max(1, value?.length ?? 1));
24
+ const view = base.slice(0, count);
25
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-color-inputs", children: [
26
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ntd-ae-colors", children: view.map((col, i) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "ntd-ae-color-label", children: [
27
+ "C",
28
+ i + 1,
29
+ /* @__PURE__ */ jsxRuntime.jsx(
30
+ ui.NiceColorPicker,
31
+ {
32
+ value: col,
33
+ onChange: (color) => {
34
+ const next = [...view];
35
+ next[i] = color;
36
+ onChange(next);
37
+ }
38
+ }
39
+ )
40
+ ] }, i)) }),
41
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-color-btns", children: [
42
+ /* @__PURE__ */ jsxRuntime.jsx(
43
+ ui.NiceButton,
44
+ {
45
+ variant: "ghost",
46
+ size: "sm",
47
+ disabled: count <= 1,
48
+ onClick: () => onChange(view.slice(0, Math.max(1, count - 1))),
49
+ children: "-"
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsxRuntime.jsx(
53
+ ui.NiceButton,
54
+ {
55
+ variant: "ghost",
56
+ size: "sm",
57
+ disabled: count >= 3,
58
+ onClick: () => onChange([...view, view[view.length - 1] || "var(--anim-default-black, #000000)"]),
59
+ children: "+"
60
+ }
61
+ )
62
+ ] })
63
+ ] });
33
64
  }
34
65
  function Row({ title, children }) {
35
- return (jsxRuntime.jsxs("div", { className: "ntd-ae-row", children: [jsxRuntime.jsx("div", { className: "ntd-ae-row-title", children: title }), jsxRuntime.jsx("div", { className: "ntd-ae-row-content", children: children })] }));
66
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-row", children: [
67
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ntd-ae-row-title", children: title }),
68
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ntd-ae-row-content", children })
69
+ ] });
36
70
  }
37
- function FeatureEditor({ title, feature, variants, onChange, }) {
38
- const options = variants.map((v) => ({ value: v, label: v }));
39
- return (jsxRuntime.jsxs(Row, { title: title, children: [jsxRuntime.jsx(ui.NiceSelect, { className: "ntd-ae-select", value: feature.variant, onChange: (val) => onChange({ ...feature, variant: val }), options: options }), jsxRuntime.jsx(ColorInputs, { value: feature.colors, onChange: (colors) => onChange({ ...feature, colors }) })] }));
71
+ function FeatureEditor({
72
+ title,
73
+ feature,
74
+ variants,
75
+ onChange
76
+ }) {
77
+ const options = variants.map((v) => ({ value: v, label: v }));
78
+ return /* @__PURE__ */ jsxRuntime.jsxs(Row, { title, children: [
79
+ /* @__PURE__ */ jsxRuntime.jsx(
80
+ ui.NiceSelect,
81
+ {
82
+ className: "ntd-ae-select",
83
+ value: feature.variant,
84
+ onChange: (val) => onChange({ ...feature, variant: val }),
85
+ options
86
+ }
87
+ ),
88
+ /* @__PURE__ */ jsxRuntime.jsx(ColorInputs, { value: feature.colors, onChange: (colors) => onChange({ ...feature, colors }) })
89
+ ] });
40
90
  }
41
- /* ---------- component ---------- */
42
- function NiceAnimationEditor({ initialConfig, onChange, storageKey = STORAGE_KEY, onNotify, showJsonPanel = true, showPreview = true, className, style, }) {
43
- var _a, _b;
44
- const { t } = i18n.useNiceTranslation();
45
- const [json, setJson] = React.useState('');
46
- const [cfg, setCfg] = React.useState(() => {
47
- if (initialConfig) {
48
- return initialConfig;
49
- }
50
- if (storageKey) {
51
- try {
52
- const saved = localStorage.getItem(storageKey);
53
- return saved ? JSON.parse(saved) : characterTypes.DEFAULT_CHARACTER;
54
- }
55
- catch (_a) {
56
- return characterTypes.DEFAULT_CHARACTER;
57
- }
58
- }
91
+ function NiceAnimationEditor({
92
+ initialConfig,
93
+ onChange,
94
+ storageKey = STORAGE_KEY,
95
+ onNotify,
96
+ showJsonPanel = true,
97
+ showPreview = true,
98
+ className,
99
+ style
100
+ }) {
101
+ const { t } = i18n.useNiceTranslation();
102
+ const [json, setJson] = React.useState("");
103
+ const [cfg, setCfg] = React.useState(() => {
104
+ if (initialConfig) {
105
+ return initialConfig;
106
+ }
107
+ if (storageKey) {
108
+ try {
109
+ const saved = localStorage.getItem(storageKey);
110
+ return saved ? JSON.parse(saved) : characterTypes.DEFAULT_CHARACTER;
111
+ } catch {
59
112
  return characterTypes.DEFAULT_CHARACTER;
113
+ }
114
+ }
115
+ return characterTypes.DEFAULT_CHARACTER;
116
+ });
117
+ React.useEffect(() => {
118
+ setJson(JSON.stringify(cfg, null, 2));
119
+ if (storageKey) {
120
+ try {
121
+ localStorage.setItem(storageKey, JSON.stringify(cfg));
122
+ } catch {
123
+ }
124
+ }
125
+ onChange?.(cfg);
126
+ }, [cfg, storageKey, onChange]);
127
+ const applyJson = () => {
128
+ try {
129
+ const parsed = JSON.parse(json);
130
+ setCfg(parsed);
131
+ onNotify?.(t("characterEditor.jsonApplied", "JSON applied"), "success");
132
+ } catch {
133
+ onNotify?.(t("characterEditor.invalidJson", "Invalid JSON"), "error");
134
+ }
135
+ };
136
+ const downloadJson = () => {
137
+ const blob = new Blob([JSON.stringify(cfg, null, 2)], { type: "application/json" });
138
+ const url = URL.createObjectURL(blob);
139
+ const a = document.createElement("a");
140
+ a.href = url;
141
+ a.download = `${cfg.name || "character"}.json`;
142
+ a.click();
143
+ URL.revokeObjectURL(url);
144
+ };
145
+ const randomizeColors = () => {
146
+ const rand = () => `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
147
+ const paint = (f) => ({ ...f, colors: [rand(), rand(), rand()] });
148
+ setCfg({
149
+ ...cfg,
150
+ face: paint(cfg.face),
151
+ hair: paint(cfg.hair),
152
+ eyes: paint(cfg.eyes),
153
+ nose: paint(cfg.nose),
154
+ mouth: paint(cfg.mouth),
155
+ outfit: paint(cfg.outfit),
156
+ headwear: paint(cfg.headwear),
157
+ prop: paint(cfg.prop)
60
158
  });
61
- React.useEffect(() => {
62
- setJson(JSON.stringify(cfg, null, 2));
63
- if (storageKey) {
64
- try {
65
- localStorage.setItem(storageKey, JSON.stringify(cfg));
66
- }
67
- catch (_a) {
68
- /* ignore */
69
- }
159
+ };
160
+ const updateFeature = (key, val) => {
161
+ setCfg((prev) => ({ ...prev, [key]: val }));
162
+ };
163
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `ntd-animation-editor ${className ?? ""}`, style, children: [
164
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-controls", children: [
165
+ /* @__PURE__ */ jsxRuntime.jsx(Row, { title: t("characterEditor.name", "Name"), children: /* @__PURE__ */ jsxRuntime.jsx(
166
+ ui.NiceTextInput,
167
+ {
168
+ className: "ntd-ae-input",
169
+ value: cfg.name || "",
170
+ onChange: (val) => setCfg({ ...cfg, name: val }),
171
+ placeholder: t("characterEditor.namePlaceholder", "Character name")
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ jsxRuntime.jsxs(Row, { title: t("characters.size", "Size"), children: [
175
+ /* @__PURE__ */ jsxRuntime.jsx(
176
+ ui.NiceSlider,
177
+ {
178
+ min: 140,
179
+ max: 300,
180
+ value: cfg.size ?? 180,
181
+ onChange: (val) => setCfg({ ...cfg, size: val })
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ntd-ae-size-value", children: [
185
+ cfg.size ?? 180,
186
+ "px"
187
+ ] })
188
+ ] }),
189
+ /* @__PURE__ */ jsxRuntime.jsx(
190
+ FeatureEditor,
191
+ {
192
+ title: t("characters.faceShape", "Face"),
193
+ feature: cfg.face,
194
+ variants: characterTypes.VARIANTS.face,
195
+ onChange: (v) => updateFeature("face", v)
196
+ }
197
+ ),
198
+ /* @__PURE__ */ jsxRuntime.jsx(
199
+ FeatureEditor,
200
+ {
201
+ title: t("characters.hairstyle", "Hair"),
202
+ feature: cfg.hair,
203
+ variants: characterTypes.VARIANTS.hair,
204
+ onChange: (v) => updateFeature("hair", v)
70
205
  }
71
- onChange === null || onChange === void 0 ? void 0 : onChange(cfg);
72
- }, [cfg, storageKey, onChange]);
73
- const applyJson = () => {
74
- try {
75
- const parsed = JSON.parse(json);
76
- setCfg(parsed);
77
- onNotify === null || onNotify === void 0 ? void 0 : onNotify(t('characterEditor.jsonApplied', 'JSON applied'), 'success');
206
+ ),
207
+ /* @__PURE__ */ jsxRuntime.jsx(
208
+ FeatureEditor,
209
+ {
210
+ title: t("characters.eyes", "Eyes"),
211
+ feature: cfg.eyes,
212
+ variants: characterTypes.VARIANTS.eyes,
213
+ onChange: (v) => updateFeature("eyes", v)
78
214
  }
79
- catch (_a) {
80
- onNotify === null || onNotify === void 0 ? void 0 : onNotify(t('characterEditor.invalidJson', 'Invalid JSON'), 'error');
215
+ ),
216
+ /* @__PURE__ */ jsxRuntime.jsx(
217
+ FeatureEditor,
218
+ {
219
+ title: t("characters.nose", "Nose"),
220
+ feature: cfg.nose,
221
+ variants: characterTypes.VARIANTS.nose,
222
+ onChange: (v) => updateFeature("nose", v)
81
223
  }
82
- };
83
- const downloadJson = () => {
84
- const blob = new Blob([JSON.stringify(cfg, null, 2)], { type: 'application/json' });
85
- const url = URL.createObjectURL(blob);
86
- const a = document.createElement('a');
87
- a.href = url;
88
- a.download = `${cfg.name || 'character'}.json`;
89
- a.click();
90
- URL.revokeObjectURL(url);
91
- };
92
- const randomizeColors = () => {
93
- const rand = () => `#${Math.floor(Math.random() * 0xffffff)
94
- .toString(16)
95
- .padStart(6, '0')}`;
96
- const paint = (f) => ({ ...f, colors: [rand(), rand(), rand()] });
97
- setCfg({
98
- ...cfg,
99
- face: paint(cfg.face),
100
- hair: paint(cfg.hair),
101
- eyes: paint(cfg.eyes),
102
- nose: paint(cfg.nose),
103
- mouth: paint(cfg.mouth),
104
- outfit: paint(cfg.outfit),
105
- headwear: paint(cfg.headwear),
106
- prop: paint(cfg.prop),
107
- });
108
- };
109
- const updateFeature = (key, val) => {
110
- setCfg((prev) => ({ ...prev, [key]: val }));
111
- };
112
- return (jsxRuntime.jsxs("div", { className: `ntd-animation-editor ${className !== null && className !== void 0 ? className : ''}`, style: style, children: [jsxRuntime.jsxs("div", { className: "ntd-ae-controls", children: [jsxRuntime.jsx(Row, { title: t('characterEditor.name', 'Name'), children: jsxRuntime.jsx(ui.NiceTextInput, { className: "ntd-ae-input", value: cfg.name || '', onChange: (val) => setCfg({ ...cfg, name: val }), placeholder: t('characterEditor.namePlaceholder', 'Character name') }) }), jsxRuntime.jsxs(Row, { title: t('characters.size', 'Size'), children: [jsxRuntime.jsx(ui.NiceSlider, { min: 140, max: 300, value: (_a = cfg.size) !== null && _a !== void 0 ? _a : 180, onChange: (val) => setCfg({ ...cfg, size: val }) }), jsxRuntime.jsxs("span", { className: "ntd-ae-size-value", children: [(_b = cfg.size) !== null && _b !== void 0 ? _b : 180, "px"] })] }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.faceShape', 'Face'), feature: cfg.face, variants: characterTypes.VARIANTS.face, onChange: (v) => updateFeature('face', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.hairstyle', 'Hair'), feature: cfg.hair, variants: characterTypes.VARIANTS.hair, onChange: (v) => updateFeature('hair', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.eyes', 'Eyes'), feature: cfg.eyes, variants: characterTypes.VARIANTS.eyes, onChange: (v) => updateFeature('eyes', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.nose', 'Nose'), feature: cfg.nose, variants: characterTypes.VARIANTS.nose, onChange: (v) => updateFeature('nose', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.mouth', 'Mouth'), feature: cfg.mouth, variants: characterTypes.VARIANTS.mouth, onChange: (v) => updateFeature('mouth', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.clothing', 'Outfit'), feature: cfg.outfit, variants: characterTypes.VARIANTS.outfit, onChange: (v) => updateFeature('outfit', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.headwear', 'Headwear'), feature: cfg.headwear, variants: characterTypes.VARIANTS.headwear, onChange: (v) => updateFeature('headwear', v) }), jsxRuntime.jsx(FeatureEditor, { title: t('characters.prop', 'Prop'), feature: cfg.prop, variants: characterTypes.VARIANTS.prop, onChange: (v) => updateFeature('prop', v) }), jsxRuntime.jsxs("div", { className: "ntd-ae-action-row", children: [jsxRuntime.jsxs(ui.NiceButton, { className: "ntd-ae-btn", variant: "ghost", onClick: randomizeColors, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "shuffle", size: 14 }), ' ', t('characterEditor.randomizeColors', 'Randomize colors')] }), jsxRuntime.jsxs(ui.NiceButton, { className: "ntd-ae-btn", variant: "ghost", onClick: downloadJson, children: [jsxRuntime.jsx(uiCore.NiceIcon, { name: "download", size: 14 }), " ", t('characters.downloadJson', 'Download JSON')] })] }), showJsonPanel && (jsxRuntime.jsxs("div", { className: "ntd-ae-json-panel", children: [jsxRuntime.jsx("div", { className: "ntd-ae-json-label", children: t('characterEditor.jsonSection', 'JSON') }), jsxRuntime.jsx(ui.NiceTextArea, { className: "ntd-ae-textarea", value: json, onChange: (val) => setJson(val) }), jsxRuntime.jsxs("div", { className: "ntd-ae-json-actions", children: [jsxRuntime.jsx(ui.NiceButton, { className: "ntd-ae-btn", variant: "primary", onClick: applyJson, children: t('characterEditor.applyJson', 'Apply JSON') }), jsxRuntime.jsx(ui.NiceButton, { className: "ntd-ae-btn", variant: "ghost", onClick: () => navigator.clipboard.writeText(JSON.stringify(cfg, null, 2)), children: t('characterEditor.copyToClipboard', 'Copy') })] })] }))] }), showPreview && (jsxRuntime.jsxs("div", { className: "ntd-ae-preview", children: [jsxRuntime.jsx("div", { className: "ntd-ae-preview-label", children: t('characterEditor.preview', 'Preview') }), jsxRuntime.jsx(AnimatedPerson, { character: cfg, score: 10, startPose: "idle" })] }))] }));
224
+ ),
225
+ /* @__PURE__ */ jsxRuntime.jsx(
226
+ FeatureEditor,
227
+ {
228
+ title: t("characters.mouth", "Mouth"),
229
+ feature: cfg.mouth,
230
+ variants: characterTypes.VARIANTS.mouth,
231
+ onChange: (v) => updateFeature("mouth", v)
232
+ }
233
+ ),
234
+ /* @__PURE__ */ jsxRuntime.jsx(
235
+ FeatureEditor,
236
+ {
237
+ title: t("characters.clothing", "Outfit"),
238
+ feature: cfg.outfit,
239
+ variants: characterTypes.VARIANTS.outfit,
240
+ onChange: (v) => updateFeature("outfit", v)
241
+ }
242
+ ),
243
+ /* @__PURE__ */ jsxRuntime.jsx(
244
+ FeatureEditor,
245
+ {
246
+ title: t("characters.headwear", "Headwear"),
247
+ feature: cfg.headwear,
248
+ variants: characterTypes.VARIANTS.headwear,
249
+ onChange: (v) => updateFeature("headwear", v)
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsxRuntime.jsx(
253
+ FeatureEditor,
254
+ {
255
+ title: t("characters.prop", "Prop"),
256
+ feature: cfg.prop,
257
+ variants: characterTypes.VARIANTS.prop,
258
+ onChange: (v) => updateFeature("prop", v)
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-action-row", children: [
262
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.NiceButton, { className: "ntd-ae-btn", variant: "ghost", onClick: randomizeColors, children: [
263
+ /* @__PURE__ */ jsxRuntime.jsx(uiCore.NiceIcon, { name: "shuffle", size: 14 }),
264
+ " ",
265
+ t("characterEditor.randomizeColors", "Randomize colors")
266
+ ] }),
267
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.NiceButton, { className: "ntd-ae-btn", variant: "ghost", onClick: downloadJson, children: [
268
+ /* @__PURE__ */ jsxRuntime.jsx(uiCore.NiceIcon, { name: "download", size: 14 }),
269
+ " ",
270
+ t("characters.downloadJson", "Download JSON")
271
+ ] })
272
+ ] }),
273
+ showJsonPanel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-json-panel", children: [
274
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ntd-ae-json-label", children: t("characterEditor.jsonSection", "JSON") }),
275
+ /* @__PURE__ */ jsxRuntime.jsx(
276
+ ui.NiceTextArea,
277
+ {
278
+ className: "ntd-ae-textarea",
279
+ value: json,
280
+ onChange: (val) => setJson(val)
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-json-actions", children: [
284
+ /* @__PURE__ */ jsxRuntime.jsx(ui.NiceButton, { className: "ntd-ae-btn", variant: "primary", onClick: applyJson, children: t("characterEditor.applyJson", "Apply JSON") }),
285
+ /* @__PURE__ */ jsxRuntime.jsx(
286
+ ui.NiceButton,
287
+ {
288
+ className: "ntd-ae-btn",
289
+ variant: "ghost",
290
+ onClick: () => navigator.clipboard.writeText(JSON.stringify(cfg, null, 2)),
291
+ children: t("characterEditor.copyToClipboard", "Copy")
292
+ }
293
+ )
294
+ ] })
295
+ ] })
296
+ ] }),
297
+ showPreview && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ntd-ae-preview", children: [
298
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ntd-ae-preview-label", children: t("characterEditor.preview", "Preview") }),
299
+ /* @__PURE__ */ jsxRuntime.jsx(AnimatedPerson.default, { character: cfg, score: 10, startPose: "idle" })
300
+ ] })
301
+ ] });
113
302
  }
114
-
115
303
  exports.NiceAnimationEditor = NiceAnimationEditor;
@@ -1,67 +1,89 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var ui = require('@nice2dev/ui');
5
- var React = require('react');
6
- var i18n = require('../core/i18n.js');
7
- var AnimatedPerson = require('./AnimatedPerson.js');
8
- var characterTypes = require('./characterTypes.js');
9
- var choreoDSL = require('./choreoDSL.js');
10
-
11
- const rnd = () => `#${Math.floor(Math.random() * 0xffffff)
12
- .toString(16)
13
- .padStart(6, '0')}`;
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const ui = require("@nice2dev/ui");
5
+ const React = require("react");
6
+ const i18n = require("../core/i18n.js");
7
+ const AnimatedPerson = require("./AnimatedPerson.js");
8
+ const characterTypes = require("./characterTypes.js");
9
+ const choreoDSL = require("./choreoDSL.js");
10
+ const rnd = () => `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
14
11
  function recolor(f, n) {
15
- const colors = new Array(Math.max(1, Math.min(3, n))).fill(0).map(rnd);
16
- return { ...f, colors };
12
+ const colors = new Array(Math.max(1, Math.min(3, n))).fill(0).map(rnd);
13
+ return { ...f, colors };
17
14
  }
18
15
  function makeAudience(n) {
19
- const arr = [];
20
- for (let i = 0; i < n; i++) {
21
- arr.push({
22
- ...characterTypes.DEFAULT_CHARACTER,
23
- name: `Fan ${i + 1}`,
24
- size: 150 + Math.round(Math.random() * 40) - 20,
25
- outfit: recolor(characterTypes.DEFAULT_CHARACTER.outfit, 3),
26
- hair: recolor(characterTypes.DEFAULT_CHARACTER.hair, 2),
27
- headwear: Math.random() < 0.3
28
- ? recolor(characterTypes.DEFAULT_CHARACTER.headwear, 2)
29
- : { variant: 'none', colors: ['var(--anim-stroke, #111)'] },
30
- prop: Math.random() < 0.25
31
- ? { variant: 'star', colors: [rnd(), rnd(), 'var(--anim-stroke, #111)'] }
32
- : { variant: 'none', colors: ['var(--anim-stroke, #111)'] },
33
- });
34
- }
35
- return arr;
16
+ const arr = [];
17
+ for (let i = 0; i < n; i++) {
18
+ arr.push({
19
+ ...characterTypes.DEFAULT_CHARACTER,
20
+ name: `Fan ${i + 1}`,
21
+ size: 150 + Math.round(Math.random() * 40) - 20,
22
+ outfit: recolor(characterTypes.DEFAULT_CHARACTER.outfit, 3),
23
+ hair: recolor(characterTypes.DEFAULT_CHARACTER.hair, 2),
24
+ headwear: Math.random() < 0.3 ? recolor(characterTypes.DEFAULT_CHARACTER.headwear, 2) : { variant: "none", colors: ["var(--anim-stroke, #111)"] },
25
+ prop: Math.random() < 0.25 ? { variant: "star", colors: [rnd(), rnd(), "var(--anim-stroke, #111)"] } : { variant: "none", colors: ["var(--anim-stroke, #111)"] }
26
+ });
27
+ }
28
+ return arr;
36
29
  }
37
- /** Grid of animated audience members with wave/cheer actions. */
38
30
  const NiceAudience = ({ count = 36, columns = 12 }) => {
39
- const { t } = i18n.useNiceTranslation();
40
- const people = React.useMemo(() => makeAudience(count), [count]);
41
- const refs = React.useRef([]);
42
- refs.current = [];
43
- const actors = () => refs.current.filter(Boolean);
44
- const cheer = async () => {
45
- const a = actors();
46
- if (!a.length) {
47
- return;
48
- }
49
- await choreoDSL.runRounds(a, [choreoDSL.seq().jump(250).celebrate(500), choreoDSL.seq().waveHand(600), choreoDSL.seq().danceB(450)], 60);
50
- };
51
- const wave = async () => {
52
- const a = actors();
53
- if (!a.length) {
54
- return;
55
- }
56
- await Promise.all(new Array(Math.ceil(a.length / columns))
57
- .fill(0)
58
- .map((_, row) => choreoDSL.runRounds(a.slice(row * columns, row * columns + columns), [choreoDSL.seq().waveHand(500)], 120 * row)));
59
- };
60
- return (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 8 }, children: [jsxRuntime.jsx("div", { style: {
61
- display: 'grid',
62
- gap: 8,
63
- gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
64
- }, children: people.map((c, i) => (jsxRuntime.jsx(AnimatedPerson, { character: c, score: 10, startPose: "idle", onReady: (fx) => (refs.current[i] = fx) }, i))) }), jsxRuntime.jsxs("div", { style: { display: 'flex', gap: 8 }, children: [jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: wave, children: t('audience.wave', 'Wave') }), jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: cheer, children: t('audience.cheer', 'Cheer') })] })] }));
31
+ const { t } = i18n.useNiceTranslation();
32
+ const people = React.useMemo(() => makeAudience(count), [count]);
33
+ const refs = React.useRef([]);
34
+ refs.current = [];
35
+ const actors = () => refs.current.filter(Boolean);
36
+ const cheer = async () => {
37
+ const a = actors();
38
+ if (!a.length) {
39
+ return;
40
+ }
41
+ await choreoDSL.runRounds(
42
+ a,
43
+ [choreoDSL.seq().jump(250).celebrate(500), choreoDSL.seq().waveHand(600), choreoDSL.seq().danceB(450)],
44
+ 60
45
+ );
46
+ };
47
+ const wave = async () => {
48
+ const a = actors();
49
+ if (!a.length) {
50
+ return;
51
+ }
52
+ await Promise.all(
53
+ new Array(Math.ceil(a.length / columns)).fill(0).map(
54
+ (_, row) => choreoDSL.runRounds(
55
+ a.slice(row * columns, row * columns + columns),
56
+ [choreoDSL.seq().waveHand(500)],
57
+ 120 * row
58
+ )
59
+ )
60
+ );
61
+ };
62
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
63
+ /* @__PURE__ */ jsxRuntime.jsx(
64
+ "div",
65
+ {
66
+ style: {
67
+ display: "grid",
68
+ gap: 8,
69
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
70
+ },
71
+ children: people.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(
72
+ AnimatedPerson.default,
73
+ {
74
+ character: c,
75
+ score: 10,
76
+ startPose: "idle",
77
+ onReady: (fx) => refs.current[i] = fx
78
+ },
79
+ i
80
+ ))
81
+ }
82
+ ),
83
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
84
+ /* @__PURE__ */ jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: wave, children: t("audience.wave", "Wave") }),
85
+ /* @__PURE__ */ jsxRuntime.jsx(ui.NiceButton, { variant: "ghost", size: "sm", onClick: cheer, children: t("audience.cheer", "Cheer") })
86
+ ] })
87
+ ] });
65
88
  };
66
-
67
- module.exports = NiceAudience;
89
+ exports.default = NiceAudience;