@lvl99dotcom/paintcanvas 0.0.0-stage → 0.2.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 (284) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +131 -2
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +5 -0
  5. package/dist/lib/brushes/BrushTipCache/index.d.ts +32 -0
  6. package/dist/lib/brushes/BrushTipCache/index.js +60 -0
  7. package/dist/lib/brushes/StrokeEngine/index.d.ts +171 -0
  8. package/dist/lib/brushes/StrokeEngine/index.js +324 -0
  9. package/dist/lib/brushes/StrokePath/index.d.ts +53 -0
  10. package/dist/lib/brushes/StrokePath/index.js +161 -0
  11. package/dist/lib/brushes/StrokeSampler/index.d.ts +55 -0
  12. package/dist/lib/brushes/StrokeSampler/index.js +75 -0
  13. package/dist/lib/brushes/authors/index.d.ts +55 -0
  14. package/dist/lib/brushes/authors/index.js +60 -0
  15. package/dist/lib/brushes/configRanges/index.d.ts +52 -0
  16. package/dist/lib/brushes/configRanges/index.js +206 -0
  17. package/dist/lib/brushes/index.d.ts +5 -0
  18. package/dist/lib/brushes/index.js +19 -0
  19. package/dist/lib/brushes/params/index.d.ts +108 -0
  20. package/dist/lib/brushes/params/index.js +139 -0
  21. package/dist/lib/brushes/presetFile/index.d.ts +32 -0
  22. package/dist/lib/brushes/presetFile/index.js +55 -0
  23. package/dist/lib/brushes/presets/drawing/brush-pen.js +3 -0
  24. package/dist/lib/brushes/presets/drawing/felt-pen.js +3 -0
  25. package/dist/lib/brushes/presets/drawing/index.d.ts +13 -0
  26. package/dist/lib/brushes/presets/drawing/index.js +88 -0
  27. package/dist/lib/brushes/presets/drawing/pencil-2b.js +3 -0
  28. package/dist/lib/brushes/presets/drawing/pencil-hb.js +3 -0
  29. package/dist/lib/brushes/presets/painting/grass.js +3 -0
  30. package/dist/lib/brushes/presets/painting/hair.js +3 -0
  31. package/dist/lib/brushes/presets/painting/index.d.ts +18 -0
  32. package/dist/lib/brushes/presets/painting/index.js +118 -0
  33. package/dist/lib/brushes/presets/painting/splatter.js +3 -0
  34. package/dist/lib/brushes/presets/painting/textured-paint.js +3 -0
  35. package/dist/lib/brushes/presets/painting/watery-paint.js +3 -0
  36. package/dist/lib/brushes/presets/round/index.d.ts +9 -0
  37. package/dist/lib/brushes/presets/round/index.js +44 -0
  38. package/dist/lib/brushes/presets/round/round.js +3 -0
  39. package/dist/lib/brushes/presets/round/soft-round.js +3 -0
  40. package/dist/lib/brushes/presets/sized/index.d.ts +20 -0
  41. package/dist/lib/brushes/presets/sized/index.js +30 -0
  42. package/dist/lib/brushes/presets/sketching/index.d.ts +14 -0
  43. package/dist/lib/brushes/presets/sketching/index.js +107 -0
  44. package/dist/lib/brushes/presets/square/index.d.ts +7 -0
  45. package/dist/lib/brushes/presets/square/index.js +22 -0
  46. package/dist/lib/brushes/presets/square/square.js +3 -0
  47. package/dist/lib/brushes/shapeImage/index.d.ts +40 -0
  48. package/dist/lib/brushes/shapeImage/index.js +61 -0
  49. package/dist/lib/brushes/types/index.d.ts +243 -0
  50. package/dist/lib/brushes/types/index.js +20 -0
  51. package/dist/lib/classes/BackgroundWork/index.d.ts +55 -0
  52. package/dist/lib/classes/BackgroundWork/index.js +97 -0
  53. package/dist/lib/classes/BrushSettings/index.d.ts +91 -0
  54. package/dist/lib/classes/BrushSettings/index.js +152 -0
  55. package/dist/lib/classes/CustomPresets/index.d.ts +53 -0
  56. package/dist/lib/classes/CustomPresets/index.js +71 -0
  57. package/dist/lib/classes/ExternalSheets/index.d.ts +64 -0
  58. package/dist/lib/classes/ExternalSheets/index.js +112 -0
  59. package/dist/lib/classes/GestureTracker/index.d.ts +62 -0
  60. package/dist/lib/classes/GestureTracker/index.js +122 -0
  61. package/dist/lib/classes/History/index.d.ts +83 -0
  62. package/dist/lib/classes/History/index.js +126 -0
  63. package/dist/lib/classes/HistoryGuard/index.d.ts +58 -0
  64. package/dist/lib/classes/HistoryGuard/index.js +97 -0
  65. package/dist/lib/classes/InputSettings/index.d.ts +74 -0
  66. package/dist/lib/classes/InputSettings/index.js +101 -0
  67. package/dist/lib/classes/KeyboardShortcuts/index.d.ts +48 -0
  68. package/dist/lib/classes/KeyboardShortcuts/index.js +137 -0
  69. package/dist/lib/classes/Layer/index.d.ts +86 -0
  70. package/dist/lib/classes/Layer/index.js +111 -0
  71. package/dist/lib/classes/LayerAutosave/index.d.ts +180 -0
  72. package/dist/lib/classes/LayerAutosave/index.js +346 -0
  73. package/dist/lib/classes/LayerStack/index.d.ts +177 -0
  74. package/dist/lib/classes/LayerStack/index.js +394 -0
  75. package/dist/lib/classes/PaintCanvas/index.d.ts +537 -0
  76. package/dist/lib/classes/PaintCanvas/index.js +965 -0
  77. package/dist/lib/classes/StrokeLog/index.d.ts +149 -0
  78. package/dist/lib/classes/StrokeLog/index.js +257 -0
  79. package/dist/lib/classes/Viewport/index.d.ts +108 -0
  80. package/dist/lib/classes/Viewport/index.js +194 -0
  81. package/dist/lib/document/index.d.ts +17 -0
  82. package/dist/lib/document/index.js +25 -0
  83. package/dist/lib/document/schema.d.ts +132 -0
  84. package/dist/lib/document/schema.js +110 -0
  85. package/dist/lib/i18n/index.d.ts +94 -0
  86. package/dist/lib/i18n/index.js +182 -0
  87. package/dist/lib/image/index.d.ts +90 -0
  88. package/dist/lib/image/index.js +147 -0
  89. package/dist/lib/messages/PatchSender/index.d.ts +75 -0
  90. package/dist/lib/messages/PatchSender/index.js +125 -0
  91. package/dist/lib/messages/index.d.ts +26 -0
  92. package/dist/lib/messages/index.js +59 -0
  93. package/dist/lib/messages/schema.d.ts +1775 -0
  94. package/dist/lib/messages/schema.js +192 -0
  95. package/dist/lib/presets/index.d.ts +32 -0
  96. package/dist/lib/presets/index.js +35 -0
  97. package/dist/lib/presets/schema.d.ts +753 -0
  98. package/dist/lib/presets/schema.js +181 -0
  99. package/dist/lib/rendering/BrushTip/index.d.ts +63 -0
  100. package/dist/lib/rendering/BrushTip/index.js +112 -0
  101. package/dist/lib/rendering/checkerboard/index.d.ts +22 -0
  102. package/dist/lib/rendering/checkerboard/index.js +31 -0
  103. package/dist/lib/rendering/compositing/index.d.ts +64 -0
  104. package/dist/lib/rendering/compositing/index.js +124 -0
  105. package/dist/lib/rendering/cursor/index.d.ts +14 -0
  106. package/dist/lib/rendering/cursor/index.js +39 -0
  107. package/dist/lib/rendering/cursors/index.d.ts +18 -0
  108. package/dist/lib/rendering/cursors/index.js +23 -0
  109. package/dist/lib/rendering/maskOutline/index.d.ts +22 -0
  110. package/dist/lib/rendering/maskOutline/index.js +78 -0
  111. package/dist/lib/rendering/outline/index.d.ts +36 -0
  112. package/dist/lib/rendering/outline/index.js +120 -0
  113. package/dist/lib/rendering/sample/index.d.ts +55 -0
  114. package/dist/lib/rendering/sample/index.js +83 -0
  115. package/dist/lib/rendering/screenshot/index.d.ts +67 -0
  116. package/dist/lib/rendering/screenshot/index.js +96 -0
  117. package/dist/lib/rendering/transformBox/index.d.ts +10 -0
  118. package/dist/lib/rendering/transformBox/index.js +57 -0
  119. package/dist/lib/selection/Lasso/index.d.ts +70 -0
  120. package/dist/lib/selection/Lasso/index.js +156 -0
  121. package/dist/lib/selection/Selection/index.d.ts +86 -0
  122. package/dist/lib/selection/Selection/index.js +228 -0
  123. package/dist/lib/selection/geometry/index.d.ts +37 -0
  124. package/dist/lib/selection/geometry/index.js +57 -0
  125. package/dist/lib/storage/index.d.ts +63 -0
  126. package/dist/lib/storage/index.js +114 -0
  127. package/dist/lib/transform/Transformer/index.d.ts +124 -0
  128. package/dist/lib/transform/Transformer/index.js +286 -0
  129. package/dist/lib/transform/geometry/index.d.ts +95 -0
  130. package/dist/lib/transform/geometry/index.js +258 -0
  131. package/dist/lib/utils/array/index.d.ts +10 -0
  132. package/dist/lib/utils/array/index.js +21 -0
  133. package/dist/lib/utils/gestures/index.d.ts +35 -0
  134. package/dist/lib/utils/gestures/index.js +81 -0
  135. package/dist/lib/utils/navigation/index.d.ts +51 -0
  136. package/dist/lib/utils/navigation/index.js +59 -0
  137. package/dist/lib/utils/random/index.d.ts +18 -0
  138. package/dist/lib/utils/random/index.js +27 -0
  139. package/dist/lib/utils/shortcuts/index.d.ts +74 -0
  140. package/dist/lib/utils/shortcuts/index.js +189 -0
  141. package/dist/lib/validation/validators.generated.d.ts +27 -0
  142. package/dist/lib/validation/validators.generated.js +19826 -0
  143. package/dist/locales/en-GB.js +188 -0
  144. package/dist/locales/en-US.js +188 -0
  145. package/dist/locales/fr.js +188 -0
  146. package/dist/locales/ja.js +188 -0
  147. package/dist/locales/ko.js +188 -0
  148. package/dist/locales/zh-Hans.js +188 -0
  149. package/dist/locales/zh-Hant.js +188 -0
  150. package/dist/package.js +3 -0
  151. package/dist/testing/app.d.ts +7 -0
  152. package/dist/testing/app.js +16 -0
  153. package/dist/testing/elements.d.ts +42 -0
  154. package/dist/testing/elements.js +58 -0
  155. package/dist/testing/fakeCanvas.d.ts +21 -0
  156. package/dist/testing/fakeCanvas.js +26 -0
  157. package/dist/testing/layerStore.d.ts +26 -0
  158. package/dist/testing/layerStore.js +43 -0
  159. package/dist/testing/locks.d.ts +15 -0
  160. package/dist/testing/locks.js +41 -0
  161. package/dist/testing/recordingCanvas.d.ts +14 -0
  162. package/dist/testing/recordingCanvas.js +28 -0
  163. package/dist/testing/recordingContext.d.ts +10 -0
  164. package/dist/testing/recordingContext.js +19 -0
  165. package/dist/ui/ChangeController/index.d.ts +40 -0
  166. package/dist/ui/ChangeController/index.js +62 -0
  167. package/dist/ui/base/index.d.ts +69 -0
  168. package/dist/ui/base/index.js +94 -0
  169. package/dist/ui/elements/PaintCanvas/index.d.ts +249 -0
  170. package/dist/ui/elements/PaintCanvas/index.js +584 -0
  171. package/dist/ui/elements/PaintCanvas/style.js +3 -0
  172. package/dist/ui/elements/PcBrushConfig/index.d.ts +130 -0
  173. package/dist/ui/elements/PcBrushConfig/index.js +463 -0
  174. package/dist/ui/elements/PcBrushConfig/style.js +3 -0
  175. package/dist/ui/elements/PcBrushMenu/index.d.ts +121 -0
  176. package/dist/ui/elements/PcBrushMenu/index.js +362 -0
  177. package/dist/ui/elements/PcBrushMenu/style.js +3 -0
  178. package/dist/ui/elements/PcBrushTest/index.d.ts +71 -0
  179. package/dist/ui/elements/PcBrushTest/index.js +136 -0
  180. package/dist/ui/elements/PcBrushTest/style.js +3 -0
  181. package/dist/ui/elements/PcButton/index.d.ts +57 -0
  182. package/dist/ui/elements/PcButton/index.js +124 -0
  183. package/dist/ui/elements/PcButtonGroup/index.d.ts +44 -0
  184. package/dist/ui/elements/PcButtonGroup/index.js +93 -0
  185. package/dist/ui/elements/PcCanvas/index.d.ts +356 -0
  186. package/dist/ui/elements/PcCanvas/index.js +1004 -0
  187. package/dist/ui/elements/PcCanvas/style.js +3 -0
  188. package/dist/ui/elements/PcCanvasMap/index.d.ts +96 -0
  189. package/dist/ui/elements/PcCanvasMap/index.js +187 -0
  190. package/dist/ui/elements/PcCanvasMap/style.js +3 -0
  191. package/dist/ui/elements/PcContextMenu/index.d.ts +72 -0
  192. package/dist/ui/elements/PcContextMenu/index.js +148 -0
  193. package/dist/ui/elements/PcDialog/index.d.ts +63 -0
  194. package/dist/ui/elements/PcDialog/index.js +114 -0
  195. package/dist/ui/elements/PcIcon/index.d.ts +36 -0
  196. package/dist/ui/elements/PcIcon/index.js +43 -0
  197. package/dist/ui/elements/PcIconToggle/index.d.ts +46 -0
  198. package/dist/ui/elements/PcIconToggle/index.js +87 -0
  199. package/dist/ui/elements/PcInfoTip/index.d.ts +40 -0
  200. package/dist/ui/elements/PcInfoTip/index.js +95 -0
  201. package/dist/ui/elements/PcInputSettings/index.d.ts +69 -0
  202. package/dist/ui/elements/PcInputSettings/index.js +150 -0
  203. package/dist/ui/elements/PcLayerItem/index.d.ts +221 -0
  204. package/dist/ui/elements/PcLayerItem/index.js +561 -0
  205. package/dist/ui/elements/PcLayerItem/style.js +3 -0
  206. package/dist/ui/elements/PcLayersMenu/index.d.ts +108 -0
  207. package/dist/ui/elements/PcLayersMenu/index.js +208 -0
  208. package/dist/ui/elements/PcLayersMenu/style.js +3 -0
  209. package/dist/ui/elements/PcMatch/index.d.ts +31 -0
  210. package/dist/ui/elements/PcMatch/index.js +58 -0
  211. package/dist/ui/elements/PcPanel/index.d.ts +43 -0
  212. package/dist/ui/elements/PcPanel/index.js +51 -0
  213. package/dist/ui/elements/PcPopover/index.d.ts +48 -0
  214. package/dist/ui/elements/PcPopover/index.js +86 -0
  215. package/dist/ui/elements/PcSlider/index.d.ts +57 -0
  216. package/dist/ui/elements/PcSlider/index.js +88 -0
  217. package/dist/ui/elements/PcStats/index.d.ts +54 -0
  218. package/dist/ui/elements/PcStats/index.js +141 -0
  219. package/dist/ui/elements/PcThemePicker/index.d.ts +56 -0
  220. package/dist/ui/elements/PcThemePicker/index.js +134 -0
  221. package/dist/ui/elements/PcToast/index.d.ts +58 -0
  222. package/dist/ui/elements/PcToast/index.js +110 -0
  223. package/dist/ui/elements/PcToggleCheckbox/index.d.ts +37 -0
  224. package/dist/ui/elements/PcToggleCheckbox/index.js +105 -0
  225. package/dist/ui/elements/PcToolSettings/index.d.ts +128 -0
  226. package/dist/ui/elements/PcToolSettings/index.js +543 -0
  227. package/dist/ui/elements/PcToolSettings/style.js +3 -0
  228. package/dist/ui/elements/PcToolbar/index.d.ts +71 -0
  229. package/dist/ui/elements/PcToolbar/index.js +190 -0
  230. package/dist/ui/elements/PcToolbar/style.js +3 -0
  231. package/dist/ui/icons/images/brush.js +3 -0
  232. package/dist/ui/icons/images/circle-mask.js +3 -0
  233. package/dist/ui/icons/images/clipboard.js +3 -0
  234. package/dist/ui/icons/images/cursor.js +3 -0
  235. package/dist/ui/icons/images/eraser.js +3 -0
  236. package/dist/ui/icons/images/eyedropper.js +3 -0
  237. package/dist/ui/icons/images/flip-horizontal.js +3 -0
  238. package/dist/ui/icons/images/flip-vertical.js +3 -0
  239. package/dist/ui/icons/images/focus-pen.js +3 -0
  240. package/dist/ui/icons/images/freehand-mask.js +3 -0
  241. package/dist/ui/icons/images/hidden.js +3 -0
  242. package/dist/ui/icons/images/layers.js +3 -0
  243. package/dist/ui/icons/images/linked.js +3 -0
  244. package/dist/ui/icons/images/locked.js +3 -0
  245. package/dist/ui/icons/images/moon.js +3 -0
  246. package/dist/ui/icons/images/pan.js +3 -0
  247. package/dist/ui/icons/images/polygon-mask.js +3 -0
  248. package/dist/ui/icons/images/pressure.js +3 -0
  249. package/dist/ui/icons/images/randomise.js +3 -0
  250. package/dist/ui/icons/images/rectangle-mask.js +3 -0
  251. package/dist/ui/icons/images/redo.js +3 -0
  252. package/dist/ui/icons/images/rotate-90-left.js +3 -0
  253. package/dist/ui/icons/images/rotate-90-right.js +3 -0
  254. package/dist/ui/icons/images/smoothing-bezier-cubic.js +3 -0
  255. package/dist/ui/icons/images/smoothing-bezier-quad.js +3 -0
  256. package/dist/ui/icons/images/smoothing-linear.js +3 -0
  257. package/dist/ui/icons/images/star.js +3 -0
  258. package/dist/ui/icons/images/sun.js +3 -0
  259. package/dist/ui/icons/images/tilt.js +3 -0
  260. package/dist/ui/icons/images/undo.js +3 -0
  261. package/dist/ui/icons/images/unlinked.js +3 -0
  262. package/dist/ui/icons/images/unlocked.js +3 -0
  263. package/dist/ui/icons/images/visible.js +3 -0
  264. package/dist/ui/icons/images/zoom-in.js +3 -0
  265. package/dist/ui/icons/images/zoom-out.js +3 -0
  266. package/dist/ui/icons/images/zoom.js +3 -0
  267. package/dist/ui/icons/index.d.ts +42 -0
  268. package/dist/ui/icons/index.js +130 -0
  269. package/dist/ui/index.d.ts +21 -0
  270. package/dist/ui/index.js +22 -0
  271. package/dist/ui/layout/index.d.ts +88 -0
  272. package/dist/ui/layout/index.js +96 -0
  273. package/dist/ui/styles/index.d.ts +13 -0
  274. package/dist/ui/styles/index.js +195 -0
  275. package/dist/ui/tokens/index.d.ts +29 -0
  276. package/dist/ui/tokens/index.js +114 -0
  277. package/locales/en-GB.json +186 -0
  278. package/locales/en-US.json +186 -0
  279. package/locales/fr.json +186 -0
  280. package/locales/ja.json +186 -0
  281. package/locales/ko.json +186 -0
  282. package/locales/zh-Hans.json +186 -0
  283. package/locales/zh-Hant.json +186 -0
  284. package/package.json +97 -3
@@ -0,0 +1,188 @@
1
+ // locales/zh-Hant.json
2
+ var zh_Hant_default = {
3
+ "common.cancel": "取消",
4
+ "common.close": "關閉",
5
+ "common.dismiss": "關閉",
6
+ "common.save": "儲存",
7
+ "common.delete": "刪除",
8
+ "common.clear": "清除",
9
+ "common.copy": "拷貝",
10
+ "common.paste": "貼上",
11
+ "common.undo": "復原",
12
+ "common.redo": "重做",
13
+ "common.off": "關",
14
+ "common.moreInformation": "更多資訊",
15
+ "common.width": "寬度",
16
+ "common.height": "高度",
17
+ "common.opacity": "不透明度",
18
+ "tool.brush": "筆刷",
19
+ "tool.eraser": "橡皮擦",
20
+ "tool.move": "移動、縮放和旋轉",
21
+ "tool.rectangleLasso": "矩形選取",
22
+ "tool.circleLasso": "橢圓選取",
23
+ "tool.polygonLasso": "多邊形選取",
24
+ "tool.freeformLasso": "自由選取",
25
+ "tool.pan": "手形工具",
26
+ "tool.zoom": "縮放",
27
+ "tool.colourSample": "滴管",
28
+ "tool.withShortcut": "{tool}({shortcut})",
29
+ "toolbar.label": "工具",
30
+ "toolbar.currentColour": "目前顏色",
31
+ "toolbar.layers": "圖層",
32
+ "toolbar.menu": "選單",
33
+ "toolbar.undoWithShortcut": "復原({shortcut})",
34
+ "toolbar.redoWithShortcut": "重做({shortcut})",
35
+ "toolSettings.settings": "{tool}設定",
36
+ "toolSettings.presets": "{tool}預設",
37
+ "toolSettings.configure": "詳細設定",
38
+ "toolSettings.constrainProportions": "維持比例",
39
+ "toolSettings.pressure": "壓力感應",
40
+ "toolSettings.tilt": "傾斜",
41
+ "toolSettings.focusPen": "僅限觸控筆模式",
42
+ "toolSettings.focusPenHint": "僅限觸控筆模式:只有觸控筆可以繪圖",
43
+ "toolSettings.flipHorizontal": "水平翻轉",
44
+ "toolSettings.flipVertical": "垂直翻轉",
45
+ "toolSettings.rotateLeft": "向左旋轉90°",
46
+ "toolSettings.rotateRight": "向右旋轉90°",
47
+ "toolSettings.maskSettings": "遮罩設定",
48
+ "toolSettings.zoomIn": "放大",
49
+ "toolSettings.zoomOut": "縮小",
50
+ "toolSettings.pointSample": "單點取色",
51
+ "toolSettings.areaSample": "區域平均取色",
52
+ "brushMenu.presets": "{tool}預設",
53
+ "brushMenu.size": "{tool}大小",
54
+ "brushMenu.dragToResize": "左右拖曳以調整大小",
55
+ "brushMenu.newPreset": "新預設",
56
+ "brushMenu.create": "建立",
57
+ "brushMenu.import": "匯入",
58
+ "brushMenu.export": "匯出",
59
+ "presets.myPresets": "我的預設",
60
+ "presets.unknownAuthor": "未知",
61
+ "presets.deleteConfirm": "要刪除「{name}」嗎?此動作無法復原。",
62
+ "presets.deleted": "已刪除「{name}」",
63
+ "presets.deleteFailed": "無法刪除「{name}」",
64
+ "presets.saved": "已將「{name}」儲存到我的預設",
65
+ "presets.saveFailed": "無法儲存「{name}」",
66
+ "presets.replaceConfirm": "已有名為「{name}」的預設。要取代嗎?",
67
+ "presets.imported.one": "已匯入 {count} 個筆刷預設",
68
+ "presets.imported.other": "已匯入 {count} 個筆刷預設",
69
+ "presets.fileIncompatible": "不相容的筆刷預設 JSON 檔案",
70
+ "presets.fileReadFailed": "無法讀取筆刷預設 JSON 檔案",
71
+ "presets.exportFailed": "匯出筆刷預設 JSON 檔案時發生錯誤",
72
+ "presets.nothingToExport": "沒有可匯出的筆刷預設",
73
+ "brushConfig.brushTitle": "筆刷詳細設定",
74
+ "brushConfig.eraserTitle": "橡皮擦詳細設定",
75
+ "brushConfig.presetName": "預設名稱",
76
+ "brushConfig.shape": "形狀",
77
+ "brushConfig.upload": "上傳",
78
+ "brushConfig.paste": "貼上",
79
+ "brushConfig.rotation": "旋轉",
80
+ "brushConfig.offsetX": "X 位移",
81
+ "brushConfig.offsetY": "Y 位移",
82
+ "brushConfig.spacing": "間距",
83
+ "brushConfig.sampleRate": "取樣率",
84
+ "brushConfig.smoothing": "平滑",
85
+ "brushConfig.smoothingLinear": "直線",
86
+ "brushConfig.smoothingQuadratic": "二次曲線",
87
+ "brushConfig.smoothingCubic": "三次曲線",
88
+ "brushConfig.randomise": "隨機",
89
+ "brushConfig.deletePreset": "刪除預設…",
90
+ "brushConfig.shapeFailed": "無法使用此筆刷形狀",
91
+ "brushConfig.test": "試畫",
92
+ "brushConfig.testArea": "筆刷試畫區域",
93
+ "shape.notPng": "筆刷形狀必須是 PNG 影像",
94
+ "shape.tooLarge": "筆刷形狀影像最大為 2 MB",
95
+ "shape.readFailed": "無法讀取筆刷形狀影像",
96
+ "shape.noPngToPaste": "沒有可貼上的 PNG 影像",
97
+ "layers.label": "圖層",
98
+ "layers.new": "新增圖層",
99
+ "layers.defaultName": "圖層 {number}",
100
+ "layers.name": "圖層名稱",
101
+ "layers.visible": "顯示",
102
+ "layers.alphaLock": "鎖定透明像素",
103
+ "layers.blendMode": "混合模式",
104
+ "layers.actions": "圖層動作",
105
+ "layers.reorder": "調整{name}的順序:拖曳,或按下以顯示動作",
106
+ "layers.duplicate": "複製",
107
+ "layers.createMask": "建立遮罩",
108
+ "layers.moveUp": "上移",
109
+ "layers.moveDown": "下移",
110
+ "layers.moveToTop": "移到最上層",
111
+ "layers.moveToBottom": "移到最下層",
112
+ "layers.mergeDown": "向下合併…",
113
+ "layers.mergeDownConfirm": "確定要將此圖層與下方圖層合併嗎?",
114
+ "layers.mergeLayer": "合併圖層",
115
+ "layers.clearConfirm": "要清除「{name}」上的所有影像嗎?",
116
+ "layers.deleteConfirm": "要刪除「{name}」嗎?",
117
+ "blendMode.normal": "正常",
118
+ "blendMode.screen": "濾色",
119
+ "blendMode.lighten": "變亮",
120
+ "blendMode.multiply": "色彩增值",
121
+ "blendMode.darken": "變暗",
122
+ "blendMode.overlay": "覆蓋",
123
+ "canvas.label": "繪圖畫布",
124
+ "canvas.map": "畫布導覽",
125
+ "canvas.loading": "正在載入畫布…",
126
+ "inputSettings.title": "操作",
127
+ "inputSettings.scrollPan": "捲動或雙指滑動以平移",
128
+ "inputSettings.touchPan": "雙指拖曳以平移",
129
+ "inputSettings.pinchZoom": "雙指撥動以縮放",
130
+ "inputSettings.modifierScrollZoom": "{key} + 捲動以縮放",
131
+ "inputSettings.focusPen": "僅限觸控筆模式:手指和手掌不會繪圖",
132
+ "inputSettings.gestures": "觸控手勢",
133
+ "inputSettings.language": "語言",
134
+ "gesture.tap2": "雙指點一下",
135
+ "gesture.tap3": "三指點一下",
136
+ "gesture.swipeUp3": "三指向上滑動",
137
+ "gesture.swipeDown3": "三指向下滑動",
138
+ "gesture.swipeLeft3": "三指向左滑動",
139
+ "gesture.swipeRight3": "三指向右滑動",
140
+ "gesture.swipeIn3": "三指捏合",
141
+ "gesture.swipeOut3": "三指張開",
142
+ "toolSettings.selectAll": "全選",
143
+ "toolSettings.invertSelection": "反轉選取範圍",
144
+ "toolSettings.deselect": "取消選取",
145
+ "toolSettings.percent": "百分比",
146
+ "toolSettings.reset": "重設",
147
+ "brushMenu.importFile": "匯入預設檔案",
148
+ "brushConfig.name": "名稱",
149
+ "brushConfig.snapToPixelGrid": "對齊像素格線",
150
+ "brushConfig.addToPresets": "加入預設",
151
+ "brushConfig.variation": "{param}:{source}",
152
+ "layers.mergeDownTitle": "向下合併",
153
+ "layers.clear": "清除…",
154
+ "layers.delete": "刪除…",
155
+ "layers.clearTitle": "清除圖層",
156
+ "layers.deleteTitle": "刪除圖層",
157
+ "toolSettings.angle": "角度",
158
+ "layout.tools": "工具",
159
+ "layout.toolSettings": "工具設定",
160
+ "layout.panels": "面板",
161
+ "layout.status": "狀態",
162
+ "layout.canvas": "畫布",
163
+ "layout.show": "顯示{name}",
164
+ "layout.hide": "隱藏{name}",
165
+ "layout.new": "{name}(有新內容)",
166
+ "brushConfig.newPresetName": "新筆刷",
167
+ "language.en-US": "English (United States)",
168
+ "language.en-GB": "English (United Kingdom)",
169
+ "language.ja": "日本語",
170
+ "language.ko": "한국어",
171
+ "language.zh-Hans": "简体中文",
172
+ "language.zh-Hant": "繁體中文",
173
+ "language.fr": "Français",
174
+ "autosave.elsewhere": "你已在另一個視窗中繪畫",
175
+ "autosave.elsewhereMessage": "此畫作已在另一個視窗或分頁中開啟,一次只能在一個視窗中繪畫。選擇「在此繪畫」即可在此視窗繼續(另一個視窗將停止)。",
176
+ "autosave.takeOver": "在此繪畫",
177
+ "autosave.failed": "無法在此瀏覽器中儲存畫作",
178
+ "stats.label": "畫布詳細資料",
179
+ "stats.size": "畫布:{width} × {height} 像素",
180
+ "stats.zoom": "縮放:{zoom}",
181
+ "stats.colour": "顏色:{colour}",
182
+ "stats.stored": "已儲存:{size}",
183
+ "theme.label": "主題",
184
+ "theme.light": "淺色",
185
+ "theme.dark": "深色",
186
+ "theme.auto": "自動"
187
+ };
188
+ export { zh_Hant_default as default };
@@ -0,0 +1,3 @@
1
+ // package.json
2
+ var version = "0.2.0";
3
+ export { version };
@@ -0,0 +1,7 @@
1
+ import PaintCanvas from "../lib/classes/PaintCanvas";
2
+ /** The handle of the author of presets made in apps from `createApp` */
3
+ export declare const TEST_HANDLE = "ada.example";
4
+ /**
5
+ * Create a canvas whose canvases record drawing calls (jsdom cannot draw), with "Ada" as the author of new presets.
6
+ */
7
+ export declare const createApp: () => PaintCanvas;
@@ -0,0 +1,16 @@
1
+ import PaintCanvas from "../lib/classes/PaintCanvas/index.js";
2
+ import { createRecordingCanvasFactory } from "./recordingCanvas.js";
3
+ // src/testing/app.ts
4
+ /** The handle of the author of presets made in apps from `createApp` */
5
+ var TEST_HANDLE = "ada.example";
6
+ /**
7
+ * Create a canvas whose canvases record drawing calls (jsdom cannot draw), with "Ada" as the author of new presets.
8
+ */
9
+ var createApp = () => new PaintCanvas({
10
+ createCanvas: createRecordingCanvasFactory().factory,
11
+ presetAuthor: () => ({
12
+ name: "Ada",
13
+ handle: TEST_HANDLE
14
+ })
15
+ });
16
+ export { TEST_HANDLE, createApp };
@@ -0,0 +1,42 @@
1
+ import type { LitElement } from "lit";
2
+ /**
3
+ * Create a custom element, set its properties, add it to the page and wait for it to render.
4
+ *
5
+ * @example
6
+ * const button = await mount<PcButton>("pc-button", { variant: "cancel" });
7
+ */
8
+ export declare const mount: <T extends LitElement>(tag: string, properties?: Partial<T>, content?: string) => Promise<T>;
9
+ /**
10
+ * Find an element in a custom element's shadow root (throws if missing).
11
+ */
12
+ export declare const shadow: <T extends Element = HTMLElement>(host: Element, selector: string) => T;
13
+ /**
14
+ * Collect the custom events of a type an element fires.
15
+ */
16
+ export declare const events: <T = unknown>(target: EventTarget, type: string) => T[];
17
+ /**
18
+ * Find an element in a custom element's shadow root (throws if missing). Same as `shadow`.
19
+ */
20
+ export declare const query: <T extends Element = HTMLElement>(host: Element, selector: string) => T;
21
+ /**
22
+ * Find all matching elements in a custom element's shadow root.
23
+ */
24
+ export declare const queryAll: <T extends Element = HTMLElement>(host: Element, selector: string) => T[];
25
+ /**
26
+ * Create a pointer-like event (jsdom has no PointerEvent), bubbling and cancelable.
27
+ */
28
+ export declare const pointerEvent: (type: string, x: number, y: number, { pointerId, ...init }?: MouseEventInit & {
29
+ pointerId?: number;
30
+ }) => MouseEvent & {
31
+ pointerId: number;
32
+ };
33
+ /**
34
+ * Describe a `pc-toast` event's detail as "kind: message", to check both at once.
35
+ *
36
+ * @example
37
+ * toastText({ message: "Saved", kind: "success" }); // "success: Saved"
38
+ */
39
+ export declare const toastText: (detail: string | {
40
+ message: string;
41
+ kind?: string;
42
+ }) => string;
@@ -0,0 +1,58 @@
1
+ // src/testing/elements.ts
2
+ /**
3
+ * Create a custom element, set its properties, add it to the page and wait for it to render.
4
+ *
5
+ * @example
6
+ * const button = await mount<PcButton>("pc-button", { variant: "cancel" });
7
+ */
8
+ var mount = async (tag, properties = {}, content = "") => {
9
+ const element = document.createElement(tag);
10
+ Object.assign(element, properties);
11
+ element.innerHTML = content;
12
+ document.body.append(element);
13
+ await element.updateComplete;
14
+ return element;
15
+ };
16
+ /**
17
+ * Find an element in a custom element's shadow root (throws if missing).
18
+ */
19
+ var shadow = (host, selector) => {
20
+ const found = host.shadowRoot?.querySelector(selector);
21
+ if (!found) throw new Error(`No ${selector} in ${host.tagName}`);
22
+ return found;
23
+ };
24
+ /**
25
+ * Collect the custom events of a type an element fires.
26
+ */
27
+ var events = (target, type) => {
28
+ const details = [];
29
+ target.addEventListener(type, (event) => details.push(event.detail));
30
+ return details;
31
+ };
32
+ /**
33
+ * Find an element in a custom element's shadow root (throws if missing). Same as `shadow`.
34
+ */
35
+ var query = shadow;
36
+ /**
37
+ * Find all matching elements in a custom element's shadow root.
38
+ */
39
+ var queryAll = (host, selector) => [...host.shadowRoot?.querySelectorAll(selector) ?? []];
40
+ /**
41
+ * Create a pointer-like event (jsdom has no PointerEvent), bubbling and cancelable.
42
+ */
43
+ var pointerEvent = (type, x, y, { pointerId = 1, ...init } = {}) => Object.assign(new MouseEvent(type, {
44
+ clientX: x,
45
+ clientY: y,
46
+ bubbles: true,
47
+ cancelable: true,
48
+ composed: true,
49
+ ...init
50
+ }), { pointerId });
51
+ /**
52
+ * Describe a `pc-toast` event's detail as "kind: message", to check both at once.
53
+ *
54
+ * @example
55
+ * toastText({ message: "Saved", kind: "success" }); // "success: Saved"
56
+ */
57
+ var toastText = (detail) => typeof detail === "string" ? `info: ${detail}` : `${detail.kind ?? "info"}: ${detail.message}`;
58
+ export { events, mount, pointerEvent, query, queryAll, shadow, toastText };
@@ -0,0 +1,21 @@
1
+ import { vi } from "vitest";
2
+ import type { CanvasFactory } from "../lib/classes/Layer";
3
+ /** Fake 2D context recording the calls layers make */
4
+ export interface FakeContext {
5
+ clearRect: ReturnType<typeof vi.fn>;
6
+ drawImage: ReturnType<typeof vi.fn>;
7
+ /** Returns transparent pixels unless replaced */
8
+ getImageData: ReturnType<typeof vi.fn>;
9
+ save: ReturnType<typeof vi.fn>;
10
+ restore: ReturnType<typeof vi.fn>;
11
+ }
12
+ /**
13
+ * Create a canvas factory that returns fake canvases (jsdom has no `OffscreenCanvas`).
14
+ *
15
+ * @param hasContext - set to false to simulate a canvas without a 2D context
16
+ */
17
+ export declare const createFakeCanvasFactory: (hasContext?: boolean) => CanvasFactory;
18
+ /**
19
+ * Get the fake context of a fake canvas.
20
+ */
21
+ export declare const fakeContext: (canvas: OffscreenCanvas) => FakeContext;
@@ -0,0 +1,26 @@
1
+ import { vi } from "vitest";
2
+ // src/testing/fakeCanvas.ts
3
+ /**
4
+ * Create a canvas factory that returns fake canvases (jsdom has no `OffscreenCanvas`).
5
+ *
6
+ * @param hasContext - set to false to simulate a canvas without a 2D context
7
+ */
8
+ var createFakeCanvasFactory = (hasContext = true) => (width, height) => {
9
+ const context = {
10
+ clearRect: vi.fn(),
11
+ drawImage: vi.fn(),
12
+ getImageData: vi.fn((_x, _y, w, h) => ({ data: new Uint8ClampedArray(w * h * 4) })),
13
+ save: vi.fn(),
14
+ restore: vi.fn()
15
+ };
16
+ return {
17
+ width,
18
+ height,
19
+ getContext: () => hasContext ? context : null
20
+ };
21
+ };
22
+ /**
23
+ * Get the fake context of a fake canvas.
24
+ */
25
+ var fakeContext = (canvas) => canvas.getContext("2d");
26
+ export { createFakeCanvasFactory, fakeContext };
@@ -0,0 +1,26 @@
1
+ import type { LayerStoreLike, SavedDrawing, SavedDrawingWithImages } from "../lib/storage";
2
+ /**
3
+ * A layer store kept in memory, recording each save. Set `loadError` or `saveError` to make loading or saving fail.
4
+ *
5
+ * @example
6
+ * const store = new MemoryLayerStore("test");
7
+ * canvas.useLayerStore(store, { locks: null });
8
+ */
9
+ export declare class MemoryLayerStore implements LayerStoreLike {
10
+ readonly name: string;
11
+ /** The saved drawing and its layer images, if any */
12
+ saved?: SavedDrawingWithImages;
13
+ /** Each save: the drawing and the images that changed */
14
+ readonly saves: {
15
+ drawing: SavedDrawing;
16
+ images: Map<string, Blob>;
17
+ }[];
18
+ /** Thrown by `load` when set */
19
+ loadError?: Error;
20
+ /** Thrown by `save` when set */
21
+ saveError?: Error;
22
+ constructor(name?: string, saved?: SavedDrawingWithImages);
23
+ load(): Promise<SavedDrawingWithImages | undefined>;
24
+ save(drawing: SavedDrawing, images: ReadonlyMap<string, Blob>): Promise<void>;
25
+ clear(): Promise<void>;
26
+ }
@@ -0,0 +1,43 @@
1
+ // src/testing/layerStore.ts
2
+ /**
3
+ * A layer store kept in memory, recording each save. Set `loadError` or `saveError` to make loading or saving fail.
4
+ *
5
+ * @example
6
+ * const store = new MemoryLayerStore("test");
7
+ * canvas.useLayerStore(store, { locks: null });
8
+ */
9
+ var MemoryLayerStore = class {
10
+ name;
11
+ /** The saved drawing and its layer images, if any */
12
+ saved;
13
+ /** Each save: the drawing and the images that changed */
14
+ saves = [];
15
+ /** Thrown by `load` when set */
16
+ loadError;
17
+ /** Thrown by `save` when set */
18
+ saveError;
19
+ constructor(name = "test", saved) {
20
+ this.name = name;
21
+ this.saved = saved;
22
+ }
23
+ async load() {
24
+ if (this.loadError) throw this.loadError;
25
+ return this.saved;
26
+ }
27
+ async save(drawing, images) {
28
+ if (this.saveError) throw this.saveError;
29
+ this.saves.push({
30
+ drawing,
31
+ images: new Map(images)
32
+ });
33
+ const kept = new Map([...this.saved?.images ?? [], ...images].filter(([id]) => drawing.layers.some((layer) => layer.id === id)));
34
+ this.saved = {
35
+ drawing,
36
+ images: kept
37
+ };
38
+ }
39
+ async clear() {
40
+ this.saved = void 0;
41
+ }
42
+ };
43
+ export { MemoryLayerStore };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Fake Web Locks shared by any number of pretend windows: `ifAvailable` requests get no lock while another holds it,
3
+ * and `steal` takes it, failing the holder's request with an `AbortError`. A lock is let go when its callback's
4
+ * promise settles. With `failing`, every request fails (as on a page where locks can't be used).
5
+ *
6
+ * @example
7
+ * const { locks, isHeld } = createFakeLocks();
8
+ * new LayerAutosave(canvas, store, { locks }).start();
9
+ * isHeld("paintcanvas:test"); // true
10
+ */
11
+ export declare const createFakeLocks: (failing?: boolean) => {
12
+ locks: LockManager;
13
+ /** Whether a lock is held */
14
+ isHeld: (name: string) => boolean;
15
+ };
@@ -0,0 +1,41 @@
1
+ // src/testing/locks.ts
2
+ /**
3
+ * Fake Web Locks shared by any number of pretend windows: `ifAvailable` requests get no lock while another holds it,
4
+ * and `steal` takes it, failing the holder's request with an `AbortError`. A lock is let go when its callback's
5
+ * promise settles. With `failing`, every request fails (as on a page where locks can't be used).
6
+ *
7
+ * @example
8
+ * const { locks, isHeld } = createFakeLocks();
9
+ * new LayerAutosave(canvas, store, { locks }).start();
10
+ * isHeld("paintcanvas:test"); // true
11
+ */
12
+ var createFakeLocks = (failing = false) => {
13
+ /** Fails the request holding each lock, by name */
14
+ const holders = /* @__PURE__ */ new Map();
15
+ const request = (name, options, callback) => new Promise((resolve, reject) => {
16
+ if (failing) {
17
+ reject(new DOMException("Locks can't be used", "SecurityError"));
18
+ return;
19
+ }
20
+ const holder = holders.get(name);
21
+ if (holder && !options.steal) {
22
+ resolve(callback(null));
23
+ return;
24
+ }
25
+ holder?.(new DOMException("The lock was stolen", "AbortError"));
26
+ holders.set(name, reject);
27
+ Promise.resolve(callback({
28
+ name,
29
+ mode: "exclusive"
30
+ })).then((value) => {
31
+ if (holders.get(name) === reject) holders.delete(name);
32
+ resolve(value);
33
+ }, reject);
34
+ });
35
+ return {
36
+ locks: { request },
37
+ /** Whether a lock is held */
38
+ isHeld: (name) => holders.has(name)
39
+ };
40
+ };
41
+ export { createFakeLocks };
@@ -0,0 +1,14 @@
1
+ import type { CanvasFactory } from "../lib/classes/Layer";
2
+ import { type Recorded } from "./recordingContext";
3
+ /** A fake canvas whose 2D context records calls */
4
+ export interface RecordingCanvas {
5
+ canvas: OffscreenCanvas;
6
+ calls: Recorded[];
7
+ }
8
+ /**
9
+ * Create a canvas factory whose canvases each keep one recording context (reading image data returns transparent pixels). Created canvases are listed in order.
10
+ */
11
+ export declare const createRecordingCanvasFactory: () => {
12
+ factory: CanvasFactory;
13
+ created: RecordingCanvas[];
14
+ };
@@ -0,0 +1,28 @@
1
+ import { createRecordingContext } from "./recordingContext.js";
2
+ // src/testing/recordingCanvas.ts
3
+ /**
4
+ * Create a canvas factory whose canvases each keep one recording context (reading image data returns transparent pixels). Created canvases are listed in order.
5
+ */
6
+ var createRecordingCanvasFactory = () => {
7
+ const created = [];
8
+ const factory = (width, height) => {
9
+ const { ctx, calls } = createRecordingContext();
10
+ ctx.getImageData = (_x, _y, w, h) => ({ data: new Uint8ClampedArray(w * h * 4) });
11
+ calls.length = 0;
12
+ const canvas = {
13
+ width,
14
+ height,
15
+ getContext: () => ctx
16
+ };
17
+ created.push({
18
+ canvas,
19
+ calls
20
+ });
21
+ return canvas;
22
+ };
23
+ return {
24
+ factory,
25
+ created
26
+ };
27
+ };
28
+ export { createRecordingCanvasFactory };
@@ -0,0 +1,10 @@
1
+ import type { DrawingContext } from "../lib/rendering/compositing";
2
+ /** A recorded drawing call or property change */
3
+ export type Recorded = [name: string, ...args: unknown[]];
4
+ /**
5
+ * Create a fake 2D context that records every method call and property assignment, in order.
6
+ */
7
+ export declare const createRecordingContext: () => {
8
+ ctx: DrawingContext;
9
+ calls: Recorded[];
10
+ };
@@ -0,0 +1,19 @@
1
+ // src/testing/recordingContext.ts
2
+ /**
3
+ * Create a fake 2D context that records every method call and property assignment, in order.
4
+ */
5
+ var createRecordingContext = () => {
6
+ const calls = [];
7
+ return {
8
+ ctx: new Proxy({}, {
9
+ get: (target, name) => name in target ? target[name] : (...args) => void calls.push([name, ...args]),
10
+ set: (target, name, value) => {
11
+ target[name] = value;
12
+ calls.push([`set:${name}`, value]);
13
+ return true;
14
+ }
15
+ }),
16
+ calls
17
+ };
18
+ };
19
+ export { createRecordingContext };
@@ -0,0 +1,40 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from "lit";
2
+ /**
3
+ * Re-renders a Lit component whenever any of the given state objects dispatch a `change` event, first telling
4
+ * `onChange` (if given) which one changed.
5
+ *
6
+ * The targets are re-read before every update, so replaced state objects (e.g. new layers after a canvas resize) are picked up.
7
+ *
8
+ * @example
9
+ * class MyElement extends LitElement {
10
+ * private changes = new ChangeController(this, () => [this.app, this.app?.layers]);
11
+ * }
12
+ */
13
+ export default class ChangeController implements ReactiveController {
14
+ private readonly host;
15
+ private readonly getTargets;
16
+ private subscribed;
17
+ private readonly notify?;
18
+ private readonly onChange;
19
+ constructor(host: ReactiveControllerHost, getTargets: () => (EventTarget | undefined)[], onChange?: (target: EventTarget) => void);
20
+ /**
21
+ * Subscribe to the current targets, replacing any previous subscriptions.
22
+ */
23
+ refresh(): void;
24
+ /**
25
+ * Subscribe when the component connects.
26
+ */
27
+ hostConnected(): void;
28
+ /**
29
+ * Re-subscribe before each update in case targets were replaced.
30
+ */
31
+ hostUpdate(): void;
32
+ /**
33
+ * Unsubscribe when the component disconnects.
34
+ */
35
+ hostDisconnected(): void;
36
+ /**
37
+ * Remove all subscriptions.
38
+ */
39
+ private unsubscribe;
40
+ }