@pinepaper.studio/mcp-server 1.0.0

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 (295) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +406 -0
  3. package/dist/__tests__/fixtures/index.d.ts +8 -0
  4. package/dist/__tests__/fixtures/index.d.ts.map +1 -0
  5. package/dist/__tests__/fixtures/index.js +8 -0
  6. package/dist/__tests__/fixtures/index.js.map +1 -0
  7. package/dist/__tests__/fixtures/mock-animations.d.ts +213 -0
  8. package/dist/__tests__/fixtures/mock-animations.d.ts.map +1 -0
  9. package/dist/__tests__/fixtures/mock-animations.js +96 -0
  10. package/dist/__tests__/fixtures/mock-animations.js.map +1 -0
  11. package/dist/__tests__/fixtures/mock-generators.d.ts +147 -0
  12. package/dist/__tests__/fixtures/mock-generators.d.ts.map +1 -0
  13. package/dist/__tests__/fixtures/mock-generators.js +90 -0
  14. package/dist/__tests__/fixtures/mock-generators.js.map +1 -0
  15. package/dist/__tests__/fixtures/mock-items.d.ts +157 -0
  16. package/dist/__tests__/fixtures/mock-items.d.ts.map +1 -0
  17. package/dist/__tests__/fixtures/mock-items.js +74 -0
  18. package/dist/__tests__/fixtures/mock-items.js.map +1 -0
  19. package/dist/__tests__/fixtures/mock-relations.d.ts +147 -0
  20. package/dist/__tests__/fixtures/mock-relations.d.ts.map +1 -0
  21. package/dist/__tests__/fixtures/mock-relations.js +90 -0
  22. package/dist/__tests__/fixtures/mock-relations.js.map +1 -0
  23. package/dist/browser/bridge.d.ts +127 -0
  24. package/dist/browser/bridge.d.ts.map +1 -0
  25. package/dist/browser/bridge.js +320 -0
  26. package/dist/browser/bridge.js.map +1 -0
  27. package/dist/browser/index.d.ts +8 -0
  28. package/dist/browser/index.d.ts.map +1 -0
  29. package/dist/browser/index.js +8 -0
  30. package/dist/browser/index.js.map +1 -0
  31. package/dist/browser/puppeteer-controller.d.ts +93 -0
  32. package/dist/browser/puppeteer-controller.d.ts.map +1 -0
  33. package/dist/browser/puppeteer-controller.js +280 -0
  34. package/dist/browser/puppeteer-controller.js.map +1 -0
  35. package/dist/cli.d.ts +8 -0
  36. package/dist/cli.d.ts.map +1 -0
  37. package/dist/cli.js +109 -0
  38. package/dist/cli.js.map +1 -0
  39. package/dist/i18n/i18n-manager.d.ts +88 -0
  40. package/dist/i18n/i18n-manager.d.ts.map +1 -0
  41. package/dist/i18n/i18n-manager.js +209 -0
  42. package/dist/i18n/i18n-manager.js.map +1 -0
  43. package/dist/i18n/index.d.ts +10 -0
  44. package/dist/i18n/index.d.ts.map +1 -0
  45. package/dist/i18n/index.js +10 -0
  46. package/dist/i18n/index.js.map +1 -0
  47. package/dist/i18n/locales/ar.d.ts +6 -0
  48. package/dist/i18n/locales/ar.d.ts.map +1 -0
  49. package/dist/i18n/locales/ar.js +106 -0
  50. package/dist/i18n/locales/ar.js.map +1 -0
  51. package/dist/i18n/locales/base.d.ts +17 -0
  52. package/dist/i18n/locales/base.d.ts.map +1 -0
  53. package/dist/i18n/locales/base.js +213 -0
  54. package/dist/i18n/locales/base.js.map +1 -0
  55. package/dist/i18n/locales/bn.d.ts +6 -0
  56. package/dist/i18n/locales/bn.d.ts.map +1 -0
  57. package/dist/i18n/locales/bn.js +106 -0
  58. package/dist/i18n/locales/bn.js.map +1 -0
  59. package/dist/i18n/locales/chp.d.ts +8 -0
  60. package/dist/i18n/locales/chp.d.ts.map +1 -0
  61. package/dist/i18n/locales/chp.js +11 -0
  62. package/dist/i18n/locales/chp.js.map +1 -0
  63. package/dist/i18n/locales/cr.d.ts +8 -0
  64. package/dist/i18n/locales/cr.d.ts.map +1 -0
  65. package/dist/i18n/locales/cr.js +11 -0
  66. package/dist/i18n/locales/cr.js.map +1 -0
  67. package/dist/i18n/locales/crg.d.ts +8 -0
  68. package/dist/i18n/locales/crg.d.ts.map +1 -0
  69. package/dist/i18n/locales/crg.js +11 -0
  70. package/dist/i18n/locales/crg.js.map +1 -0
  71. package/dist/i18n/locales/cs.d.ts +6 -0
  72. package/dist/i18n/locales/cs.d.ts.map +1 -0
  73. package/dist/i18n/locales/cs.js +106 -0
  74. package/dist/i18n/locales/cs.js.map +1 -0
  75. package/dist/i18n/locales/da.d.ts +6 -0
  76. package/dist/i18n/locales/da.d.ts.map +1 -0
  77. package/dist/i18n/locales/da.js +106 -0
  78. package/dist/i18n/locales/da.js.map +1 -0
  79. package/dist/i18n/locales/de.d.ts +6 -0
  80. package/dist/i18n/locales/de.d.ts.map +1 -0
  81. package/dist/i18n/locales/de.js +106 -0
  82. package/dist/i18n/locales/de.js.map +1 -0
  83. package/dist/i18n/locales/el.d.ts +6 -0
  84. package/dist/i18n/locales/el.d.ts.map +1 -0
  85. package/dist/i18n/locales/el.js +106 -0
  86. package/dist/i18n/locales/el.js.map +1 -0
  87. package/dist/i18n/locales/en.d.ts +6 -0
  88. package/dist/i18n/locales/en.d.ts.map +1 -0
  89. package/dist/i18n/locales/en.js +383 -0
  90. package/dist/i18n/locales/en.js.map +1 -0
  91. package/dist/i18n/locales/es.d.ts +6 -0
  92. package/dist/i18n/locales/es.d.ts.map +1 -0
  93. package/dist/i18n/locales/es.js +106 -0
  94. package/dist/i18n/locales/es.js.map +1 -0
  95. package/dist/i18n/locales/fa.d.ts +6 -0
  96. package/dist/i18n/locales/fa.d.ts.map +1 -0
  97. package/dist/i18n/locales/fa.js +106 -0
  98. package/dist/i18n/locales/fa.js.map +1 -0
  99. package/dist/i18n/locales/fi.d.ts +6 -0
  100. package/dist/i18n/locales/fi.d.ts.map +1 -0
  101. package/dist/i18n/locales/fi.js +106 -0
  102. package/dist/i18n/locales/fi.js.map +1 -0
  103. package/dist/i18n/locales/fil.d.ts +6 -0
  104. package/dist/i18n/locales/fil.d.ts.map +1 -0
  105. package/dist/i18n/locales/fil.js +383 -0
  106. package/dist/i18n/locales/fil.js.map +1 -0
  107. package/dist/i18n/locales/fr.d.ts +6 -0
  108. package/dist/i18n/locales/fr.d.ts.map +1 -0
  109. package/dist/i18n/locales/fr.js +106 -0
  110. package/dist/i18n/locales/fr.js.map +1 -0
  111. package/dist/i18n/locales/gu.d.ts +6 -0
  112. package/dist/i18n/locales/gu.d.ts.map +1 -0
  113. package/dist/i18n/locales/gu.js +106 -0
  114. package/dist/i18n/locales/gu.js.map +1 -0
  115. package/dist/i18n/locales/he.d.ts +6 -0
  116. package/dist/i18n/locales/he.d.ts.map +1 -0
  117. package/dist/i18n/locales/he.js +106 -0
  118. package/dist/i18n/locales/he.js.map +1 -0
  119. package/dist/i18n/locales/hi.d.ts +6 -0
  120. package/dist/i18n/locales/hi.d.ts.map +1 -0
  121. package/dist/i18n/locales/hi.js +106 -0
  122. package/dist/i18n/locales/hi.js.map +1 -0
  123. package/dist/i18n/locales/hu.d.ts +6 -0
  124. package/dist/i18n/locales/hu.d.ts.map +1 -0
  125. package/dist/i18n/locales/hu.js +106 -0
  126. package/dist/i18n/locales/hu.js.map +1 -0
  127. package/dist/i18n/locales/id.d.ts +6 -0
  128. package/dist/i18n/locales/id.d.ts.map +1 -0
  129. package/dist/i18n/locales/id.js +106 -0
  130. package/dist/i18n/locales/id.js.map +1 -0
  131. package/dist/i18n/locales/index.d.ts +110 -0
  132. package/dist/i18n/locales/index.d.ts.map +1 -0
  133. package/dist/i18n/locales/index.js +123 -0
  134. package/dist/i18n/locales/index.js.map +1 -0
  135. package/dist/i18n/locales/is.d.ts +6 -0
  136. package/dist/i18n/locales/is.d.ts.map +1 -0
  137. package/dist/i18n/locales/is.js +383 -0
  138. package/dist/i18n/locales/is.js.map +1 -0
  139. package/dist/i18n/locales/it.d.ts +6 -0
  140. package/dist/i18n/locales/it.d.ts.map +1 -0
  141. package/dist/i18n/locales/it.js +106 -0
  142. package/dist/i18n/locales/it.js.map +1 -0
  143. package/dist/i18n/locales/iu.d.ts +8 -0
  144. package/dist/i18n/locales/iu.d.ts.map +1 -0
  145. package/dist/i18n/locales/iu.js +11 -0
  146. package/dist/i18n/locales/iu.js.map +1 -0
  147. package/dist/i18n/locales/ja.d.ts +6 -0
  148. package/dist/i18n/locales/ja.d.ts.map +1 -0
  149. package/dist/i18n/locales/ja.js +106 -0
  150. package/dist/i18n/locales/ja.js.map +1 -0
  151. package/dist/i18n/locales/kn.d.ts +6 -0
  152. package/dist/i18n/locales/kn.d.ts.map +1 -0
  153. package/dist/i18n/locales/kn.js +106 -0
  154. package/dist/i18n/locales/kn.js.map +1 -0
  155. package/dist/i18n/locales/ko.d.ts +6 -0
  156. package/dist/i18n/locales/ko.d.ts.map +1 -0
  157. package/dist/i18n/locales/ko.js +106 -0
  158. package/dist/i18n/locales/ko.js.map +1 -0
  159. package/dist/i18n/locales/mic.d.ts +8 -0
  160. package/dist/i18n/locales/mic.d.ts.map +1 -0
  161. package/dist/i18n/locales/mic.js +11 -0
  162. package/dist/i18n/locales/mic.js.map +1 -0
  163. package/dist/i18n/locales/ml.d.ts +6 -0
  164. package/dist/i18n/locales/ml.d.ts.map +1 -0
  165. package/dist/i18n/locales/ml.js +106 -0
  166. package/dist/i18n/locales/ml.js.map +1 -0
  167. package/dist/i18n/locales/moh.d.ts +8 -0
  168. package/dist/i18n/locales/moh.d.ts.map +1 -0
  169. package/dist/i18n/locales/moh.js +11 -0
  170. package/dist/i18n/locales/moh.js.map +1 -0
  171. package/dist/i18n/locales/mr.d.ts +6 -0
  172. package/dist/i18n/locales/mr.d.ts.map +1 -0
  173. package/dist/i18n/locales/mr.js +106 -0
  174. package/dist/i18n/locales/mr.js.map +1 -0
  175. package/dist/i18n/locales/ms.d.ts +6 -0
  176. package/dist/i18n/locales/ms.d.ts.map +1 -0
  177. package/dist/i18n/locales/ms.js +106 -0
  178. package/dist/i18n/locales/ms.js.map +1 -0
  179. package/dist/i18n/locales/nl.d.ts +6 -0
  180. package/dist/i18n/locales/nl.d.ts.map +1 -0
  181. package/dist/i18n/locales/nl.js +106 -0
  182. package/dist/i18n/locales/nl.js.map +1 -0
  183. package/dist/i18n/locales/no.d.ts +6 -0
  184. package/dist/i18n/locales/no.d.ts.map +1 -0
  185. package/dist/i18n/locales/no.js +106 -0
  186. package/dist/i18n/locales/no.js.map +1 -0
  187. package/dist/i18n/locales/oj.d.ts +8 -0
  188. package/dist/i18n/locales/oj.d.ts.map +1 -0
  189. package/dist/i18n/locales/oj.js +11 -0
  190. package/dist/i18n/locales/oj.js.map +1 -0
  191. package/dist/i18n/locales/pa.d.ts +6 -0
  192. package/dist/i18n/locales/pa.d.ts.map +1 -0
  193. package/dist/i18n/locales/pa.js +106 -0
  194. package/dist/i18n/locales/pa.js.map +1 -0
  195. package/dist/i18n/locales/pl.d.ts +6 -0
  196. package/dist/i18n/locales/pl.d.ts.map +1 -0
  197. package/dist/i18n/locales/pl.js +106 -0
  198. package/dist/i18n/locales/pl.js.map +1 -0
  199. package/dist/i18n/locales/pt-BR.d.ts +6 -0
  200. package/dist/i18n/locales/pt-BR.d.ts.map +1 -0
  201. package/dist/i18n/locales/pt-BR.js +106 -0
  202. package/dist/i18n/locales/pt-BR.js.map +1 -0
  203. package/dist/i18n/locales/pt.d.ts +6 -0
  204. package/dist/i18n/locales/pt.d.ts.map +1 -0
  205. package/dist/i18n/locales/pt.js +106 -0
  206. package/dist/i18n/locales/pt.js.map +1 -0
  207. package/dist/i18n/locales/ro.d.ts +6 -0
  208. package/dist/i18n/locales/ro.d.ts.map +1 -0
  209. package/dist/i18n/locales/ro.js +106 -0
  210. package/dist/i18n/locales/ro.js.map +1 -0
  211. package/dist/i18n/locales/ru.d.ts +6 -0
  212. package/dist/i18n/locales/ru.d.ts.map +1 -0
  213. package/dist/i18n/locales/ru.js +106 -0
  214. package/dist/i18n/locales/ru.js.map +1 -0
  215. package/dist/i18n/locales/sv.d.ts +6 -0
  216. package/dist/i18n/locales/sv.d.ts.map +1 -0
  217. package/dist/i18n/locales/sv.js +106 -0
  218. package/dist/i18n/locales/sv.js.map +1 -0
  219. package/dist/i18n/locales/ta.d.ts +6 -0
  220. package/dist/i18n/locales/ta.d.ts.map +1 -0
  221. package/dist/i18n/locales/ta.js +106 -0
  222. package/dist/i18n/locales/ta.js.map +1 -0
  223. package/dist/i18n/locales/te.d.ts +6 -0
  224. package/dist/i18n/locales/te.d.ts.map +1 -0
  225. package/dist/i18n/locales/te.js +106 -0
  226. package/dist/i18n/locales/te.js.map +1 -0
  227. package/dist/i18n/locales/th.d.ts +6 -0
  228. package/dist/i18n/locales/th.d.ts.map +1 -0
  229. package/dist/i18n/locales/th.js +106 -0
  230. package/dist/i18n/locales/th.js.map +1 -0
  231. package/dist/i18n/locales/tl.d.ts +6 -0
  232. package/dist/i18n/locales/tl.d.ts.map +1 -0
  233. package/dist/i18n/locales/tl.js +106 -0
  234. package/dist/i18n/locales/tl.js.map +1 -0
  235. package/dist/i18n/locales/tr.d.ts +6 -0
  236. package/dist/i18n/locales/tr.d.ts.map +1 -0
  237. package/dist/i18n/locales/tr.js +106 -0
  238. package/dist/i18n/locales/tr.js.map +1 -0
  239. package/dist/i18n/locales/uk.d.ts +6 -0
  240. package/dist/i18n/locales/uk.d.ts.map +1 -0
  241. package/dist/i18n/locales/uk.js +106 -0
  242. package/dist/i18n/locales/uk.js.map +1 -0
  243. package/dist/i18n/locales/ur.d.ts +6 -0
  244. package/dist/i18n/locales/ur.d.ts.map +1 -0
  245. package/dist/i18n/locales/ur.js +383 -0
  246. package/dist/i18n/locales/ur.js.map +1 -0
  247. package/dist/i18n/locales/vi.d.ts +6 -0
  248. package/dist/i18n/locales/vi.d.ts.map +1 -0
  249. package/dist/i18n/locales/vi.js +106 -0
  250. package/dist/i18n/locales/vi.js.map +1 -0
  251. package/dist/i18n/locales/zh-CN.d.ts +6 -0
  252. package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
  253. package/dist/i18n/locales/zh-CN.js +106 -0
  254. package/dist/i18n/locales/zh-CN.js.map +1 -0
  255. package/dist/i18n/locales/zh-TW.d.ts +6 -0
  256. package/dist/i18n/locales/zh-TW.d.ts.map +1 -0
  257. package/dist/i18n/locales/zh-TW.js +106 -0
  258. package/dist/i18n/locales/zh-TW.js.map +1 -0
  259. package/dist/i18n/types.d.ts +101 -0
  260. package/dist/i18n/types.d.ts.map +1 -0
  261. package/dist/i18n/types.js +65 -0
  262. package/dist/i18n/types.js.map +1 -0
  263. package/dist/index.d.ts +20 -0
  264. package/dist/index.d.ts.map +1 -0
  265. package/dist/index.js +472 -0
  266. package/dist/index.js.map +1 -0
  267. package/dist/server/index.d.ts +39 -0
  268. package/dist/server/index.d.ts.map +1 -0
  269. package/dist/server/index.js +89 -0
  270. package/dist/server/index.js.map +1 -0
  271. package/dist/tools/definitions.d.ts +26 -0
  272. package/dist/tools/definitions.d.ts.map +1 -0
  273. package/dist/tools/definitions.js +785 -0
  274. package/dist/tools/definitions.js.map +1 -0
  275. package/dist/tools/handlers.d.ts +19 -0
  276. package/dist/tools/handlers.d.ts.map +1 -0
  277. package/dist/tools/handlers.js +477 -0
  278. package/dist/tools/handlers.js.map +1 -0
  279. package/dist/tools/index.d.ts +3 -0
  280. package/dist/tools/index.d.ts.map +1 -0
  281. package/dist/tools/index.js +3 -0
  282. package/dist/tools/index.js.map +1 -0
  283. package/dist/types/code-generator.d.ts +97 -0
  284. package/dist/types/code-generator.d.ts.map +1 -0
  285. package/dist/types/code-generator.js +545 -0
  286. package/dist/types/code-generator.js.map +1 -0
  287. package/dist/types/index.d.ts +3 -0
  288. package/dist/types/index.d.ts.map +1 -0
  289. package/dist/types/index.js +3 -0
  290. package/dist/types/index.js.map +1 -0
  291. package/dist/types/schemas.d.ts +707 -0
  292. package/dist/types/schemas.d.ts.map +1 -0
  293. package/dist/types/schemas.js +341 -0
  294. package/dist/types/schemas.js.map +1 -0
  295. package/package.json +81 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/browser/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA2BH,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAClB,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 +1,8 @@
1
+ /**
2
+ * PinePaper Browser Module
3
+ *
4
+ * Exports for browser-side usage of PinePaper MCP tools.
5
+ */
6
+ export { PinePaperBridge, PinePaperStudioHandler, createBridge, createStudioHandler, type BridgeMessage, type BridgeConfig, } from './bridge.js';
7
+ export { PinePaperBrowserController, getBrowserController, resetBrowserController, type BrowserControllerConfig, type ExecuteResult, } from './puppeteer-controller.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,GACnB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PinePaper Browser Module
3
+ *
4
+ * Exports for browser-side usage of PinePaper MCP tools.
5
+ */
6
+ export { PinePaperBridge, PinePaperStudioHandler, createBridge, createStudioHandler, } from './bridge.js';
7
+ export { PinePaperBrowserController, getBrowserController, resetBrowserController, } from './puppeteer-controller.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * PinePaper Puppeteer Controller
3
+ *
4
+ * Controls a real browser instance running PinePaper Studio.
5
+ * Executes code directly via page.evaluate() and provides screenshots.
6
+ */
7
+ export interface BrowserControllerConfig {
8
+ /** PinePaper Studio URL (default: https://pinepaper.studio) */
9
+ studioUrl?: string;
10
+ /** Whether to run browser in headless mode (default: false for visibility) */
11
+ headless?: boolean;
12
+ /** Browser viewport width (default: 1280) */
13
+ viewportWidth?: number;
14
+ /** Browser viewport height (default: 800) */
15
+ viewportHeight?: number;
16
+ /** Timeout for page operations in ms (default: 30000) */
17
+ timeout?: number;
18
+ }
19
+ export interface ExecuteResult {
20
+ success: boolean;
21
+ result?: unknown;
22
+ error?: string;
23
+ screenshot?: string;
24
+ }
25
+ /**
26
+ * Controls PinePaper Studio via Puppeteer.
27
+ *
28
+ * This controller:
29
+ * 1. Launches a browser and navigates to PinePaper Studio
30
+ * 2. Executes JavaScript code directly in the page context
31
+ * 3. Captures screenshots to show results
32
+ */
33
+ export declare class PinePaperBrowserController {
34
+ private browser;
35
+ private page;
36
+ private config;
37
+ private isConnected;
38
+ constructor(config?: BrowserControllerConfig);
39
+ /**
40
+ * Check if connected to browser
41
+ */
42
+ get connected(): boolean;
43
+ /**
44
+ * Get current studio URL
45
+ */
46
+ get studioUrl(): string;
47
+ /**
48
+ * Launch browser and navigate to PinePaper Studio
49
+ */
50
+ connect(): Promise<void>;
51
+ /**
52
+ * Disconnect and close browser
53
+ */
54
+ disconnect(): Promise<void>;
55
+ /**
56
+ * Execute JavaScript code in PinePaper Studio
57
+ */
58
+ executeCode(code: string, takeScreenshot?: boolean): Promise<ExecuteResult>;
59
+ /**
60
+ * Take a screenshot of the current canvas
61
+ */
62
+ takeScreenshot(): Promise<string | undefined>;
63
+ /**
64
+ * Get the current page URL
65
+ */
66
+ getCurrentUrl(): Promise<string | undefined>;
67
+ /**
68
+ * Navigate to a different URL
69
+ */
70
+ navigateTo(url: string): Promise<void>;
71
+ /**
72
+ * Reload the page
73
+ */
74
+ reload(): Promise<void>;
75
+ /**
76
+ * Refresh the page and wait for PinePaper to be ready again.
77
+ * This is the most reliable way to get a clean canvas.
78
+ */
79
+ refreshPage(): Promise<void>;
80
+ /**
81
+ * Check if PinePaper API is available
82
+ */
83
+ checkPinePaperReady(): Promise<boolean>;
84
+ }
85
+ /**
86
+ * Get or create the global browser controller instance
87
+ */
88
+ export declare function getBrowserController(config?: BrowserControllerConfig): PinePaperBrowserController;
89
+ /**
90
+ * Reset the global controller (for testing)
91
+ */
92
+ export declare function resetBrowserController(): void;
93
+ //# sourceMappingURL=puppeteer-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puppeteer-controller.d.ts","sourceRoot":"","sources":["../../src/browser/puppeteer-controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;GAOG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,GAAE,uBAA4B;IAgBhD;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAwD9B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,UAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IA6C9E;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA6BnD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIlD;;OAEG;IACG,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5C;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BlC;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;CAiB9C;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,CAAC,EAAE,uBAAuB,GAC/B,0BAA0B,CAK5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAK7C"}
@@ -0,0 +1,280 @@
1
+ /**
2
+ * PinePaper Puppeteer Controller
3
+ *
4
+ * Controls a real browser instance running PinePaper Studio.
5
+ * Executes code directly via page.evaluate() and provides screenshots.
6
+ */
7
+ // =============================================================================
8
+ // BROWSER CONTROLLER CLASS
9
+ // =============================================================================
10
+ /**
11
+ * Controls PinePaper Studio via Puppeteer.
12
+ *
13
+ * This controller:
14
+ * 1. Launches a browser and navigates to PinePaper Studio
15
+ * 2. Executes JavaScript code directly in the page context
16
+ * 3. Captures screenshots to show results
17
+ */
18
+ export class PinePaperBrowserController {
19
+ browser = null;
20
+ page = null;
21
+ config;
22
+ isConnected = false;
23
+ constructor(config = {}) {
24
+ // Ensure URL points to /editor where the code console and API are available
25
+ let studioUrl = config.studioUrl || 'https://pinepaper.studio';
26
+ if (!studioUrl.includes('/editor')) {
27
+ studioUrl = studioUrl.replace(/\/$/, '') + '/editor';
28
+ }
29
+ this.config = {
30
+ studioUrl,
31
+ headless: config.headless ?? false, // Default to visible browser
32
+ viewportWidth: config.viewportWidth || 1280,
33
+ viewportHeight: config.viewportHeight || 800,
34
+ timeout: config.timeout || 30000,
35
+ };
36
+ }
37
+ /**
38
+ * Check if connected to browser
39
+ */
40
+ get connected() {
41
+ return this.isConnected && this.page !== null;
42
+ }
43
+ /**
44
+ * Get current studio URL
45
+ */
46
+ get studioUrl() {
47
+ return this.config.studioUrl;
48
+ }
49
+ /**
50
+ * Launch browser and navigate to PinePaper Studio
51
+ */
52
+ async connect() {
53
+ if (this.isConnected) {
54
+ console.error('[PinePaper] Already connected');
55
+ return;
56
+ }
57
+ try {
58
+ // Dynamic import to avoid issues when puppeteer isn't installed
59
+ const puppeteer = await import('puppeteer');
60
+ console.error('[PinePaper] Launching browser...');
61
+ this.browser = await puppeteer.default.launch({
62
+ headless: this.config.headless,
63
+ args: [
64
+ '--no-sandbox',
65
+ '--disable-setuid-sandbox',
66
+ `--window-size=${this.config.viewportWidth},${this.config.viewportHeight}`,
67
+ ],
68
+ });
69
+ this.page = await this.browser.newPage();
70
+ await this.page.setViewport({
71
+ width: this.config.viewportWidth,
72
+ height: this.config.viewportHeight,
73
+ });
74
+ console.error(`[PinePaper] Navigating to ${this.config.studioUrl}...`);
75
+ await this.page.goto(this.config.studioUrl, {
76
+ waitUntil: 'networkidle2',
77
+ timeout: this.config.timeout,
78
+ });
79
+ // Wait for PinePaper to be ready (check for app object)
80
+ console.error('[PinePaper] Waiting for PinePaper Studio to initialize...');
81
+ await this.page.waitForFunction(() => {
82
+ // Check if PinePaper's global app or API is available
83
+ return (typeof window.app !== 'undefined' ||
84
+ typeof window.pinepaper !== 'undefined' ||
85
+ typeof window.paper !== 'undefined');
86
+ }, { timeout: this.config.timeout });
87
+ this.isConnected = true;
88
+ console.error('[PinePaper] Connected to PinePaper Studio');
89
+ }
90
+ catch (error) {
91
+ await this.disconnect();
92
+ throw new Error(`Failed to connect to PinePaper Studio: ${error instanceof Error ? error.message : 'Unknown error'}`);
93
+ }
94
+ }
95
+ /**
96
+ * Disconnect and close browser
97
+ */
98
+ async disconnect() {
99
+ if (this.browser) {
100
+ try {
101
+ await this.browser.close();
102
+ }
103
+ catch {
104
+ // Ignore errors during cleanup
105
+ }
106
+ }
107
+ this.browser = null;
108
+ this.page = null;
109
+ this.isConnected = false;
110
+ console.error('[PinePaper] Disconnected from browser');
111
+ }
112
+ /**
113
+ * Execute JavaScript code in PinePaper Studio
114
+ */
115
+ async executeCode(code, takeScreenshot = true) {
116
+ if (!this.page || !this.isConnected) {
117
+ return {
118
+ success: false,
119
+ error: 'Not connected to PinePaper Studio. Call connect() first.',
120
+ };
121
+ }
122
+ try {
123
+ // Execute the code in page context
124
+ const result = await this.page.evaluate((codeToRun) => {
125
+ try {
126
+ // eslint-disable-next-line no-eval
127
+ const evalResult = eval(codeToRun);
128
+ // Handle promises
129
+ if (evalResult instanceof Promise) {
130
+ return evalResult.then((r) => ({ success: true, result: r }));
131
+ }
132
+ return { success: true, result: evalResult };
133
+ }
134
+ catch (e) {
135
+ return {
136
+ success: false,
137
+ error: e instanceof Error ? e.message : 'Execution error',
138
+ };
139
+ }
140
+ }, code);
141
+ // Take screenshot if requested
142
+ let screenshot;
143
+ if (takeScreenshot && result.success) {
144
+ screenshot = await this.takeScreenshot();
145
+ }
146
+ return {
147
+ ...result,
148
+ screenshot,
149
+ };
150
+ }
151
+ catch (error) {
152
+ return {
153
+ success: false,
154
+ error: error instanceof Error ? error.message : 'Unknown execution error',
155
+ };
156
+ }
157
+ }
158
+ /**
159
+ * Take a screenshot of the current canvas
160
+ */
161
+ async takeScreenshot() {
162
+ if (!this.page) {
163
+ return undefined;
164
+ }
165
+ try {
166
+ // Try to capture just the canvas element, fallback to full page
167
+ const canvasElement = await this.page.$('canvas');
168
+ if (canvasElement) {
169
+ const screenshot = await canvasElement.screenshot({
170
+ encoding: 'base64',
171
+ type: 'png',
172
+ });
173
+ return screenshot;
174
+ }
175
+ // Fallback to full page
176
+ const screenshot = await this.page.screenshot({
177
+ encoding: 'base64',
178
+ type: 'png',
179
+ fullPage: false,
180
+ });
181
+ return screenshot;
182
+ }
183
+ catch {
184
+ return undefined;
185
+ }
186
+ }
187
+ /**
188
+ * Get the current page URL
189
+ */
190
+ async getCurrentUrl() {
191
+ return this.page?.url();
192
+ }
193
+ /**
194
+ * Navigate to a different URL
195
+ */
196
+ async navigateTo(url) {
197
+ if (!this.page) {
198
+ throw new Error('Not connected to browser');
199
+ }
200
+ await this.page.goto(url, {
201
+ waitUntil: 'networkidle2',
202
+ timeout: this.config.timeout,
203
+ });
204
+ }
205
+ /**
206
+ * Reload the page
207
+ */
208
+ async reload() {
209
+ if (!this.page) {
210
+ throw new Error('Not connected to browser');
211
+ }
212
+ await this.page.reload({
213
+ waitUntil: 'networkidle2',
214
+ timeout: this.config.timeout,
215
+ });
216
+ }
217
+ /**
218
+ * Refresh the page and wait for PinePaper to be ready again.
219
+ * This is the most reliable way to get a clean canvas.
220
+ */
221
+ async refreshPage() {
222
+ if (!this.page) {
223
+ throw new Error('Not connected to browser');
224
+ }
225
+ console.error('[PinePaper] Refreshing page...');
226
+ await this.page.reload({
227
+ waitUntil: 'networkidle2',
228
+ timeout: this.config.timeout,
229
+ });
230
+ // Wait for PinePaper to be ready again
231
+ console.error('[PinePaper] Waiting for PinePaper Studio to reinitialize...');
232
+ await this.page.waitForFunction(() => {
233
+ return (typeof window.app !== 'undefined' ||
234
+ typeof window.pinepaper !== 'undefined' ||
235
+ typeof window.paper !== 'undefined');
236
+ }, { timeout: this.config.timeout });
237
+ console.error('[PinePaper] Page refreshed and ready');
238
+ }
239
+ /**
240
+ * Check if PinePaper API is available
241
+ */
242
+ async checkPinePaperReady() {
243
+ if (!this.page) {
244
+ return false;
245
+ }
246
+ try {
247
+ return await this.page.evaluate(() => {
248
+ return (typeof window.app !== 'undefined' ||
249
+ typeof window.pinepaper !== 'undefined' ||
250
+ typeof window.paper !== 'undefined');
251
+ });
252
+ }
253
+ catch {
254
+ return false;
255
+ }
256
+ }
257
+ }
258
+ // =============================================================================
259
+ // SINGLETON INSTANCE
260
+ // =============================================================================
261
+ let globalController = null;
262
+ /**
263
+ * Get or create the global browser controller instance
264
+ */
265
+ export function getBrowserController(config) {
266
+ if (!globalController) {
267
+ globalController = new PinePaperBrowserController(config);
268
+ }
269
+ return globalController;
270
+ }
271
+ /**
272
+ * Reset the global controller (for testing)
273
+ */
274
+ export function resetBrowserController() {
275
+ if (globalController) {
276
+ globalController.disconnect().catch(() => { });
277
+ globalController = null;
278
+ }
279
+ }
280
+ //# sourceMappingURL=puppeteer-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puppeteer-controller.js","sourceRoot":"","sources":["../../src/browser/puppeteer-controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IAC7B,OAAO,GAAmB,IAAI,CAAC;IAC/B,IAAI,GAAgB,IAAI,CAAC;IACzB,MAAM,CAAoC;IAC1C,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,SAAkC,EAAE;QAC9C,4EAA4E;QAC5E,IAAI,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,0BAA0B,CAAC;QAC/D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;QACvD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS;YACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK,EAAE,6BAA6B;YACjE,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,IAAI;YAC3C,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,GAAG;YAC5C,O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f,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACnC,OAAO,CACL,OAAQ,MAAc,CAAC,GAAG,KAAK,WAAW;oBAC1C,OAAQ,MAAc,CAAC,SAAS,KAAK,WAAW;oBAChD,OAAQ,MAAc,CAAC,KAAK,KAAK,WAAW,CAC7C,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAED,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,IAAI,gBAAgB,GAAsC,IAAI,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAgC;IAEhC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,IAAI,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,IAAI,gBAAgB,EAAE,CAAC;QACrB,gBAAgB,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC9C,gBAAgB,GAAG,IAAI,CAAC;IAC1B,CAAC;AACH,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * PinePaper MCP Server CLI
4
+ *
5
+ * Entry point for running the MCP server from command line.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
package/dist/cli.js ADDED
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * PinePaper MCP Server CLI
4
+ *
5
+ * Entry point for running the MCP server from command line.
6
+ */
7
+ import { createServer } from './index.js';
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ const VERSION = '1.0.0';
10
+ async function main() {
11
+ const args = process.argv.slice(2);
12
+ // Handle help flag
13
+ if (args.includes('--help') || args.includes('-h')) {
14
+ console.log(`
15
+ PinePaper MCP Server v${VERSION}
16
+
17
+ Create animated graphics with AI using the Model Context Protocol.
18
+
19
+ USAGE:
20
+ pinepaper-mcp [options]
21
+
22
+ OPTIONS:
23
+ --help, -h Show this help message
24
+ --version, -v Show version number
25
+
26
+ CONFIGURATION:
27
+ Add to your Claude Desktop config (claude_desktop_config.json):
28
+
29
+ {
30
+ "mcpServers": {
31
+ "pinepaper": {
32
+ "command": "npx",
33
+ "args": ["-y", "@pinepaper/mcp-server"]
34
+ }
35
+ }
36
+ }
37
+
38
+ TOOLS:
39
+ Item Creation:
40
+ - pinepaper_create_item Create text, shapes, graphics
41
+ - pinepaper_modify_item Modify item properties
42
+ - pinepaper_delete_item Remove items
43
+
44
+ Relations (Animation):
45
+ - pinepaper_add_relation Create behavior relationships
46
+ - pinepaper_remove_relation Remove relationships
47
+ - pinepaper_query_relations Query existing relations
48
+
49
+ Animation:
50
+ - pinepaper_animate Simple loop animations
51
+ - pinepaper_keyframe_animate Timed keyframe animations
52
+ - pinepaper_play_timeline Control playback
53
+
54
+ Generators:
55
+ - pinepaper_execute_generator Run background generators
56
+ - pinepaper_list_generators List available generators
57
+
58
+ Effects:
59
+ - pinepaper_apply_effect Apply visual effects
60
+
61
+ Query:
62
+ - pinepaper_get_items Get canvas items
63
+ - pinepaper_get_relation_stats Get relation statistics
64
+
65
+ Canvas:
66
+ - pinepaper_set_background_color Set background
67
+ - pinepaper_set_canvas_size Set dimensions
68
+
69
+ Export:
70
+ - pinepaper_export_svg Export as animated SVG
71
+ - pinepaper_export_training_data Export LLM training pairs
72
+
73
+ DOCUMENTATION:
74
+ https://pinepaper.studio/docs/mcp
75
+
76
+ SUPPORT:
77
+ https://github.com/pinepaper/mcp-server/issues
78
+ `);
79
+ process.exit(0);
80
+ }
81
+ // Handle version flag
82
+ if (args.includes('--version') || args.includes('-v')) {
83
+ console.log(VERSION);
84
+ process.exit(0);
85
+ }
86
+ // Start the server
87
+ try {
88
+ const server = await createServer();
89
+ const transport = new StdioServerTransport();
90
+ console.error('╔═══════════════════════════════════════════════════╗');
91
+ console.error('║ PinePaper MCP Server v' + VERSION + ' ║');
92
+ console.error('╠═══════════════════════════════════════════════════╣');
93
+ console.error('║ Create animated graphics with AI ║');
94
+ console.error('║ https://pinepaper.studio ║');
95
+ console.error('╚═══════════════════════════════════════════════════╝');
96
+ console.error('');
97
+ console.error('Server starting on stdio transport...');
98
+ await server.connect(transport);
99
+ console.error('✓ Server connected and ready');
100
+ console.error('');
101
+ console.error('Waiting for tool calls...');
102
+ }
103
+ catch (error) {
104
+ console.error('Failed to start server:', error);
105
+ process.exit(1);
106
+ }
107
+ }
108
+ main();
109
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,mBAAmB;IACnB,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC;wBACQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * i18n Manager
3
+ *
4
+ * Handles internationalization for the PinePaper MCP Server.
5
+ * Supports all 41 locales from PinePaper Studio.
6
+ */
7
+ import { SupportedLocale, TranslationKeys, TranslationFunction } from './types.js';
8
+ export interface I18nConfig {
9
+ defaultLocale?: SupportedLocale;
10
+ fallbackLocale?: SupportedLocale;
11
+ loadPath?: string;
12
+ }
13
+ export declare class I18nManager {
14
+ private currentLocale;
15
+ private fallbackLocale;
16
+ private translations;
17
+ private loadedLocales;
18
+ constructor(config?: I18nConfig);
19
+ /**
20
+ * Load translations for a locale
21
+ */
22
+ loadLocale(locale: SupportedLocale): Promise<void>;
23
+ /**
24
+ * Set the current locale
25
+ */
26
+ setLocale(locale: SupportedLocale): Promise<void>;
27
+ /**
28
+ * Get the current locale
29
+ */
30
+ getLocale(): SupportedLocale;
31
+ /**
32
+ * Check if current locale is RTL
33
+ */
34
+ isRTL(): boolean;
35
+ /**
36
+ * Get translation for a key
37
+ */
38
+ t(key: string, params?: Record<string, string | number>): string;
39
+ /**
40
+ * Get a translation function bound to current locale
41
+ */
42
+ getTranslationFunction(): TranslationFunction;
43
+ /**
44
+ * Get all translations for current locale
45
+ */
46
+ getTranslations(): TranslationKeys | undefined;
47
+ /**
48
+ * Get tool description in current locale
49
+ */
50
+ getToolDescription(toolName: string): string;
51
+ /**
52
+ * Get tool name in current locale
53
+ */
54
+ getToolName(toolName: string): string;
55
+ /**
56
+ * Get error message in current locale
57
+ */
58
+ getError(errorKey: string, params?: Record<string, string | number>): string;
59
+ /**
60
+ * Get success message in current locale
61
+ */
62
+ getSuccess(successKey: string, params?: Record<string, string | number>): string;
63
+ /**
64
+ * Detect locale from Accept-Language header
65
+ */
66
+ static detectLocale(acceptLanguage?: string): SupportedLocale;
67
+ /**
68
+ * Get nested value from object
69
+ */
70
+ private getNestedValue;
71
+ /**
72
+ * Interpolate parameters into translation string
73
+ */
74
+ private interpolate;
75
+ }
76
+ /**
77
+ * Get the singleton i18n manager instance
78
+ */
79
+ export declare function getI18n(): I18nManager;
80
+ /**
81
+ * Initialize i18n with a specific locale
82
+ */
83
+ export declare function initI18n(locale?: SupportedLocale): Promise<I18nManager>;
84
+ /**
85
+ * Shorthand translation function
86
+ */
87
+ export declare function t(key: string, params?: Record<string, string | number>): string;
88
+ //# sourceMappingURL=i18n-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-manager.d.ts","sourceRoot":"","sources":["../../src/i18n/i18n-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,EAIf,eAAe,EACf,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,UAAU;IACzB,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,YAAY,CAAoD;IACxE,OAAO,CAAC,aAAa,CAAmC;gBAE5C,MAAM,GAAE,UAAe;IAKnC;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvD;;OAEG;IACH,SAAS,IAAI,eAAe;IAI5B;;OAEG;IACH,KAAK,IAAI,OAAO;IAIhB;;OAEG;IACH,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM;IA4BhE;;OAEG;IACH,sBAAsB,IAAI,mBAAmB;IAK7C;;OAEG;IACH,eAAe,IAAI,eAAe,GAAG,SAA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