@pictogrammers/components 0.4.8 → 0.5.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 (191) hide show
  1. package/package.json +1 -1
  2. package/pg/annoy/annoy.css +1 -1
  3. package/pg/button/button.css +5 -4
  4. package/pg/buttonLink/buttonLink.css +1 -1
  5. package/pg/buttonMenu/__examples__/basic/basic.ts +2 -2
  6. package/pg/buttonMenu/buttonMenu.ts +4 -1
  7. package/pg/cardUser/cardUser.css +1 -1
  8. package/pg/database/__examples__/basic/basic.ts +0 -1
  9. package/pg/grid/__examples__/basic/basic.ts +1 -4
  10. package/pg/grid/grid.css +1 -1
  11. package/pg/header/header.css +1 -1
  12. package/pg/icon/__examples__/basic/basic.ts +1 -1
  13. package/pg/inputCheck/__examples__/basic/basic.ts +1 -1
  14. package/pg/inputCheck/inputCheck.css +5 -0
  15. package/pg/inputCheck/inputCheck.ts +4 -0
  16. package/pg/inputCheckList/__examples__/basic/basic.ts +1 -1
  17. package/pg/inputFileLocal/inputFileLocal.css +1 -1
  18. package/pg/inputNumber/README.md +27 -0
  19. package/pg/inputNumber/__examples__/basic/basic.html +9 -0
  20. package/pg/inputNumber/__examples__/basic/basic.ts +30 -0
  21. package/pg/inputNumber/inputNumber.css +34 -0
  22. package/pg/inputNumber/inputNumber.html +1 -0
  23. package/pg/inputNumber/inputNumber.spec.ts +59 -0
  24. package/pg/inputNumber/inputNumber.ts +63 -0
  25. package/pg/inputPixelEditor/README.md +211 -29
  26. package/pg/inputPixelEditor/__examples__/basic/basic.css +8 -0
  27. package/pg/inputPixelEditor/__examples__/basic/basic.html +29 -7
  28. package/pg/inputPixelEditor/__examples__/basic/basic.ts +274 -13
  29. package/pg/inputPixelEditor/__examples__/basic/constants.ts +62 -0
  30. package/pg/inputPixelEditor/inputPixelEditor.css +37 -2
  31. package/pg/inputPixelEditor/inputPixelEditor.html +22 -0
  32. package/pg/inputPixelEditor/inputPixelEditor.ts +822 -82
  33. package/pg/inputPixelEditor/utils/bitmapToMask.ts +22 -8
  34. package/pg/inputPixelEditor/utils/blobToImage.ts +11 -0
  35. package/pg/inputPixelEditor/utils/canvasToPngBuffer.ts +12 -0
  36. package/pg/inputPixelEditor/utils/constants.ts +55 -1
  37. package/pg/inputPixelEditor/utils/crc32.ts +116 -0
  38. package/pg/inputPixelEditor/utils/diffMap.ts +32 -0
  39. package/pg/inputPixelEditor/utils/generateGradient.ts +112 -0
  40. package/pg/inputPixelEditor/utils/getEllipsePixels.ts +131 -19
  41. package/pg/inputPixelEditor/utils/getFloodFill.ts +83 -0
  42. package/pg/inputPixelEditor/utils/getGridColorIndexes.ts +13 -0
  43. package/pg/inputPixelEditor/utils/getOutline.ts +92 -0
  44. package/pg/inputPixelEditor/utils/inputMode.ts +7 -1
  45. package/pg/inputPixelEditor/utils/pixelSizes.ts +47 -0
  46. package/pg/inputPixelEditor/utils/pngMetadata.ts +487 -0
  47. package/pg/inputSelect/inputSelect.css +4 -4
  48. package/pg/inputText/inputText.css +14 -7
  49. package/pg/inputText/inputText.ts +5 -1
  50. package/pg/json/README.md +59 -0
  51. package/pg/json/__examples__/basic/basic.html +4 -0
  52. package/pg/json/__examples__/basic/basic.ts +31 -0
  53. package/pg/json/json.css +9 -0
  54. package/pg/json/json.html +1 -0
  55. package/pg/json/json.ts +124 -0
  56. package/pg/jsonArray/README.md +3 -0
  57. package/pg/jsonArray/jsonArray.css +15 -0
  58. package/pg/jsonArray/jsonArray.html +7 -0
  59. package/pg/jsonArray/jsonArray.ts +55 -0
  60. package/pg/jsonBoolean/README.md +3 -0
  61. package/pg/jsonBoolean/jsonBoolean.css +27 -0
  62. package/pg/jsonBoolean/jsonBoolean.html +5 -0
  63. package/pg/jsonBoolean/jsonBoolean.ts +69 -0
  64. package/pg/jsonNumber/README.md +3 -0
  65. package/pg/jsonNumber/jsonNumber.css +21 -0
  66. package/pg/jsonNumber/jsonNumber.html +5 -0
  67. package/pg/jsonNumber/jsonNumber.ts +42 -0
  68. package/pg/jsonObject/README.md +3 -0
  69. package/pg/jsonObject/jsonObject.css +11 -0
  70. package/pg/jsonObject/jsonObject.html +5 -0
  71. package/pg/jsonObject/jsonObject.ts +55 -0
  72. package/pg/jsonString/README.md +3 -0
  73. package/pg/jsonString/jsonString.css +21 -0
  74. package/pg/jsonString/jsonString.html +5 -0
  75. package/pg/jsonString/jsonString.ts +42 -0
  76. package/pg/menu/menu.ts +6 -5
  77. package/pg/menuItem/README.md +13 -2
  78. package/pg/menuItem/menuItem.css +17 -22
  79. package/pg/menuItem/menuItem.ts +8 -3
  80. package/pg/menuItemIcon/__examples__/basic/basic.html +1 -1
  81. package/pg/menuItemIcon/__examples__/basic/basic.ts +7 -0
  82. package/pg/menuItemIcon/menuItemIcon.css +18 -15
  83. package/pg/menuItemIcon/menuItemIcon.ts +8 -4
  84. package/pg/modal/README.md +29 -0
  85. package/pg/modal/__examples__/basic/basic.html +4 -0
  86. package/pg/modal/__examples__/basic/basic.ts +42 -0
  87. package/pg/modal/index.ts +3 -0
  88. package/pg/modal/modal.css +40 -0
  89. package/pg/modal/modal.html +9 -0
  90. package/pg/modal/modal.ts +14 -0
  91. package/pg/modification/__examples__/basic/basic.ts +1 -1
  92. package/pg/overlayMenu/overlayMenu.ts +6 -2
  93. package/pg/overlaySelectMenu/overlaySelectMenu.ts +6 -0
  94. package/pg/overlaySubMenu/overlaySubMenu.ts +6 -2
  95. package/pg/scroll/__examples__/basic/basic.ts +1 -1
  96. package/pg/search/search.css +1 -1
  97. package/pg/table/README.md +108 -0
  98. package/pg/table/__examples__/basic/basic.css +0 -0
  99. package/pg/table/__examples__/basic/basic.html +10 -0
  100. package/pg/table/__examples__/basic/basic.ts +111 -0
  101. package/pg/table/table.css +20 -0
  102. package/pg/table/table.html +6 -0
  103. package/pg/table/table.ts +86 -0
  104. package/pg/tableCellButtonIcon/README.md +3 -0
  105. package/pg/tableCellButtonIcon/tableCellButtonIcon.css +16 -0
  106. package/pg/tableCellButtonIcon/tableCellButtonIcon.html +5 -0
  107. package/pg/tableCellButtonIcon/tableCellButtonIcon.ts +34 -0
  108. package/pg/tableCellCheck/README.md +3 -0
  109. package/pg/tableCellCheck/tableCellCheck.css +15 -0
  110. package/pg/tableCellCheck/tableCellCheck.html +3 -0
  111. package/pg/tableCellCheck/tableCellCheck.ts +43 -0
  112. package/pg/tableCellNumber/README.md +3 -0
  113. package/pg/tableCellNumber/tableCellNumber.css +11 -0
  114. package/pg/tableCellNumber/tableCellNumber.html +3 -0
  115. package/pg/tableCellNumber/tableCellNumber.ts +40 -0
  116. package/pg/tableCellText/README.md +3 -0
  117. package/pg/tableCellText/tableCellText.css +11 -0
  118. package/pg/tableCellText/tableCellText.html +3 -0
  119. package/pg/tableCellText/tableCellText.ts +62 -0
  120. package/pg/tableColumn/README.md +3 -0
  121. package/pg/tableColumn/tableColumn.css +12 -0
  122. package/pg/tableColumn/tableColumn.html +1 -0
  123. package/pg/tableColumn/tableColumn.ts +29 -0
  124. package/pg/tableRow/README.md +3 -0
  125. package/pg/tableRow/tableRow.css +11 -0
  126. package/pg/tableRow/tableRow.html +1 -0
  127. package/pg/tableRow/tableRow.ts +77 -0
  128. package/pg/tabs/tabs.css +1 -1
  129. package/pg/tree/README.md +10 -4
  130. package/pg/tree/__examples__/basic/basic.html +1 -0
  131. package/pg/tree/__examples__/basic/basic.ts +6 -1
  132. package/pg/tree/tree.css +1 -0
  133. package/pg/treeItem/treeItem.css +3 -3
  134. package/favicon.svg +0 -20
  135. package/index.html +0 -321
  136. package/main.js +0 -2
  137. package/main.js.LICENSE.txt +0 -10
  138. package/pgAnnoy.js +0 -1
  139. package/pgApp.js +0 -1
  140. package/pgAvatar.js +0 -1
  141. package/pgButton.js +0 -1
  142. package/pgButtonGroup.js +0 -1
  143. package/pgButtonLink.js +0 -1
  144. package/pgButtonMenu.js +0 -1
  145. package/pgButtonToggle.js +0 -1
  146. package/pgCard.js +0 -1
  147. package/pgCardUser.js +0 -1
  148. package/pgColor.js +0 -1
  149. package/pgDatabase.js +0 -1
  150. package/pgDropdown.js +0 -1
  151. package/pgGrid.js +0 -1
  152. package/pgHeader.js +0 -1
  153. package/pgIcon.js +0 -1
  154. package/pgInputCheck.js +0 -1
  155. package/pgInputCheckList.js +0 -1
  156. package/pgInputFileLocal.js +0 -1
  157. package/pgInputHexRgb.js +0 -1
  158. package/pgInputPixelEditor.js +0 -1
  159. package/pgInputRange.js +0 -1
  160. package/pgInputSelect.js +0 -1
  161. package/pgInputText.js +0 -1
  162. package/pgInputTextIcon.js +0 -1
  163. package/pgInputUserSelect.js +0 -1
  164. package/pgListTag.js +0 -1
  165. package/pgMarkdown.js +0 -2
  166. package/pgMarkdown.js.LICENSE.txt +0 -10
  167. package/pgMenu.js +0 -1
  168. package/pgMenuDivider.js +0 -1
  169. package/pgMenuIcon.js +0 -1
  170. package/pgMenuItem.js +0 -1
  171. package/pgMenuItemIcon.js +0 -1
  172. package/pgModalAlert.js +0 -1
  173. package/pgModification.js +0 -1
  174. package/pgNav.js +0 -1
  175. package/pgOverlay.js +0 -1
  176. package/pgOverlayContextMenu.js +0 -1
  177. package/pgOverlayMenu.js +0 -1
  178. package/pgOverlaySelectMenu.js +0 -1
  179. package/pgOverlaySubMenu.js +0 -1
  180. package/pgPicker.js +0 -1
  181. package/pgPreview.js +0 -1
  182. package/pgScroll.js +0 -1
  183. package/pgSearch.js +0 -1
  184. package/pgTab.js +0 -1
  185. package/pgTabs.js +0 -1
  186. package/pgToast.js +0 -1
  187. package/pgToasts.js +0 -1
  188. package/pgTooltip.js +0 -1
  189. package/pgTree.js +0 -1
  190. package/pgTreeButtonIcon.js +0 -1
  191. package/pgTreeItem.js +0 -1
@@ -4,7 +4,10 @@ The `pg-input-pixel-editor` component is used to edit images. Tailored for pen o
4
4
 
5
5
  ```typescript
6
6
  import '@pictogrammers/components/pgInputPixelEditor';
7
- import { PgInputPixelEditor } from '@pictogrammers/components/pgInputPixelEditor';
7
+ import PgInputPixelEditor, {
8
+ InputMode,
9
+ LayerType,
10
+ } from '@pictogrammers/components/pgInputPixelEditor';
8
11
  ```
9
12
 
10
13
  ```html
@@ -23,10 +26,18 @@ import { PgInputPixelEditor } from '@pictogrammers/components/pgInputPixelEditor
23
26
 
24
27
  ## Events
25
28
 
26
- | Events | Tested | Description |
27
- | ---------- | -------- | ----------- |
28
- | `change` | | `{ detail: { value }` |
29
- | `input` | | `{ detail: { value }` |
29
+ | Events | Tested | Description |
30
+ | ----------- | -------- | ----------- |
31
+ | `change` | | `{ detail: { value }` |
32
+ | `reference` | | `{ detail: { id, callback } }` |
33
+
34
+ ```typescript
35
+ this.$input.addEventListener('reference', (e: any) => {
36
+ const { id, callback } = e.detail;
37
+ // async request
38
+ // callback(file: File)
39
+ });
40
+ ```
30
41
 
31
42
  ## Methods
32
43
 
@@ -34,32 +45,61 @@ See usage for each method below.
34
45
 
35
46
  | Method | Tested | Description |
36
47
  | ---------- | -------- | ----------- |
37
- | `save(options)` | - | Save file. |
38
- | `open(json)` | - | Open file. |
48
+ | `getJson(options)` | - | Get JSON file. |
49
+ | `getData()` | - | Get layer data. |
50
+ | `setJson(json)` | - | Set JSON file. |
51
+ | `reset()` | - | Reset canvas and data. |
52
+ | `getExportCanvas()` | - | Get new canvas of export. |
53
+ | `await getExportPng(options, meta)` | - | Get image. |
39
54
  | `undo()` | - | Undo. |
40
55
  | `hasUndo()` | - | Has undo |
41
56
  | `hasRedo()` | - | Has redo |
42
57
  | `redo()` | - | Redo. |
43
- | `selectLayer()` | - | Select layer. |
58
+ | `getHistory()` | - | History list. |
59
+ | `inputModeSelectRectangle()` | - | Input Mode Select Rectangle |
60
+ | `inputModeSelectEllipse()` | - | Input Mode Select Ellipse |
61
+ | `inputModeSelectLasso()` | - | Input Mode Lasso |
62
+ | `inputModeSelectMagicWand()` | - | Input Mode Magic Wand |
63
+ | `inputModePixel()` | - | Input Mode Pixel |
64
+ | `inputModeStamp(stamp)` | - | Input Mode Stamp |
65
+ | `inputModeLine()` | - | Input Mode Line |
66
+ | `inputModeRectangle()` | - | Input Mode Rectangle |
67
+ | `inputModeRectangleOutline()` | - | Input Mode Rectangle Outline |
68
+ | `inputModeEllipse()` | - | Input Mode Ellipse |
69
+ | `inputModeEllipseOutline()` | - | Input Mode Ellipse Outline |
70
+ | `selectLayer(index)` | - | Select layer. |
44
71
  | `getLayers()` | - | Get layer array. |
45
72
  | `addLayer(option)` | - | Add layer. |
46
73
  | `removeLayer(index)` | - | Remove layer. |
47
74
  | `flattenLayers(layerIndexes)` | - | Flatten layers. |
48
- | `moveLayer(startIndex, endIndex)` | - | Move layer. |
75
+ | `getColor()` | - | Get selected color |
49
76
  | `getColors()` | - | Get colors. |
77
+ | `getLayerColorIndexes()` | - | Get selected layer colors. |
78
+ | `selectColor(index)` | - | Select color. |
79
+ | `setColor(index, r, g, b, a)` | - | Set Color. |
50
80
  | `addColor(r, g, b, a)` | - | Add color. |
51
81
  | `removeColor(index)` | - | Remove color. |
52
82
  | `moveColor(startIndex, endIndex)` | - | Move index. |
53
83
  | `rotateClockwise()` | - | Rotate. |
54
84
  | `rotateCounterclockwise()` | - | Rotate. |
55
85
  | `move(x, y[, layer])` | - | Move. |
56
- | `flipHorizontal()` | - | Flip horizontal. |
57
- | `flipVertical()` | - | Flip vertical. |
86
+ | `getSelection()` | - | Get selection pixels. |
87
+ | `clearSelection()` | - | Clear selection. |
88
+ | `moveSelection(x, y)` | - | Move selection. |
89
+ | `flipHorizontal()` | - | Flip horizontal selection. |
90
+ | `flipVertical()` | - | Flip vertical selection. |
58
91
  | `invert()` | - | Invert layer. |
92
+ | `outline()` | - | Outline layer with selected color. |
93
+ | `glow()` | - | Glow layer with selected color. |
94
+ | `drawPixels([[x, y, color], ...])` | - | Draw pixels. Color optional. |
95
+ | `drawRectangle(x, y, width, height, isOutline)` | - | Draw rectangle |
96
+ | `drawEllipse(x, y, width, height, isOutline)` | - | Draw ellipse. |
97
+ | `drawLine()` | - | Draw line. |
98
+ | `flush()` | - | Flush changes to history. |
59
99
 
60
- ### `save(options)` Method
100
+ ### `getJson(options)` Method
61
101
 
62
- The save method allows getting the JSON representation of the current editor.
102
+ The `getJson` method allows getting the JSON representation of the current editor. Optionally this can snapshot the entire undo history. To get only data by layer call `getData()`.
63
103
 
64
104
  ```typescript
65
105
  @Part() $editor: PgInputPixelEditor;
@@ -73,7 +113,7 @@ handleSave() {
73
113
  }
74
114
  ```
75
115
 
76
- ### `open(json)` Method
116
+ ### `setJson(json)` Method
77
117
 
78
118
  The open method allows loading json for previously created images.
79
119
 
@@ -88,11 +128,26 @@ handleOpen() {
88
128
  }
89
129
  ```
90
130
 
131
+ ## Events
132
+
133
+ ### `change`
134
+
135
+ ### `selectLayer`
136
+
137
+ Using `InputMode.Cursor` individual pixels can be clicked on to select the layer. Note, selecting a layer does not automatically select it. The event must be handled.
138
+
139
+ ```typescript
140
+ this.$input.addEventListener('selectlayer', (e: any) => {
141
+ const { color, index } = e.detail;
142
+ this.selectLayers([index]);
143
+ })
144
+ ```
145
+
91
146
  ## JSON Format
92
147
 
93
148
  - `width` - Image width.
94
149
  - `height` - Image width.
95
- - `transparent` - Render transparent background.
150
+ - `transparent` - Override the transparent color. This has no impact on the exported background.
96
151
 
97
152
  A complete JSON storage for a 10x10 image.
98
153
 
@@ -100,33 +155,160 @@ A complete JSON storage for a 10x10 image.
100
155
  {
101
156
  "width": 10,
102
157
  "height": 10,
103
- "transparent": true,
158
+ "gridSize": 10,
159
+ "transparent": null,
104
160
  "colors": [
105
161
  [0, 0, 0, 0],
106
- [0, 0, 0, 1]
162
+ [0, 0, 0, 1],
163
+ [255, 255, 255, 1]
107
164
  ],
108
165
  "layers": [
109
166
  {
110
167
  "name": "Layer 1",
111
- "export": true,
168
+ "exclude": false,
112
169
  "locked": false,
113
- "visible": true,
170
+ "hidden": false,
171
+ "type": "pixel",
114
172
  "opacity": 1
115
173
  }
116
174
  ],
117
175
  "data": [
118
176
  [
119
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
120
- [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
121
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
122
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
123
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
124
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
125
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
126
- [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
127
- [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
128
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
177
+ [{ "color": 1, "path": "M...Z" }],
178
+ [{ "color": 2, "path": "M...Z" }]
129
179
  ]
180
+ ],
181
+ "history": []
182
+ }
183
+ ```
184
+
185
+ ## Layer Type
186
+
187
+ There are currently 6 differnet layer types.
188
+
189
+ - `pixel` - Raster artboard of pixels.
190
+ - `color: 0` - colorIndex
191
+ - `path: ''` - pixels
192
+ - `reference`
193
+ - `id: 'uuid'` - uuid of frame
194
+ - `position: [x, y]`
195
+ - `pattern` - Repeat an existing frame
196
+ - `id: 'uuid'` - uuid of frame
197
+ - `position: [x, y]` - required
198
+ - `size: [x, y]` - optional, size to clip at
199
+ - `offset [x, y]` - optional, offset pattern
200
+ - `linear` - Linear gradient.
201
+ - `start: [x, y]`
202
+ - `end: [x, y]`
203
+ - `path: ''` - optional, mask
204
+ - `stops: [[stop, colorIndex], [stop, colorIndex]]`
205
+ - `dither: 'bayer4' | 'bayer8', 'bayer16'`
206
+ - `radial` - Radial gradients.
207
+ - `start: [x, y]`
208
+ - `end: [x, y]`
209
+ - `transform: [1, 0, 0, 0.5, 0, 0]` to create ellipses
210
+ - `stops: [[stop, colorIndex], [stop, colorIndex]]`
211
+ - `dither: 'bayer4' | 'bayer8' | 'bayer16'`
212
+ - `text` - Text, maybe???
213
+ - `id: 'uuid'` - file uuid
214
+ - `value: ''` - string
215
+
216
+ ### Layer `pixel` Type
217
+
218
+ The most common layer type.
219
+
220
+ ```json
221
+ {
222
+ "data": [
223
+ [
224
+ { "color": 1, "path": "M...Z" },
225
+ { "color": 2, "path": "M...Z" }
226
+ ]
227
+ ]
228
+ }
229
+ ```
230
+
231
+ ### Layer `reference` Type
232
+
233
+ Using an existing canvas in a design can be done with a reference layer.
234
+
235
+ ```json
236
+ {
237
+ "data": [
238
+ [{ "id": "uuid", "position": [0, 0] }]
239
+ ]
240
+ }
241
+ ```
242
+
243
+ ### Layer `pattern` Type
244
+
245
+ Using an existing canvas, but in a repeating pattern.
246
+
247
+ ```json
248
+ {
249
+ "data": [
250
+ [{ "id": "uuid", "position": [0, 0], "size": [100, 100] }],
251
+ [{ "id": "uuid", "position": [0, 0], "offset": [0, -2] }]
252
+ ]
253
+ }
254
+ ```
255
+
256
+ ### Layer `linear` / `radial` Type
257
+
258
+ Linear and radial gradient between 2 points. Both allow a mask to be applied.
259
+
260
+ ```json
261
+ {
262
+ "data": [
263
+ [{ "id": "uuid", "start": [0, 0], "end": [100, 100] }],
264
+ [{ "id": "uuid", "start": [0, 0], "end": [100, 0], "stops": [] }]
130
265
  ]
131
266
  }
132
267
  ```
268
+
269
+ ### Layer `text` Type
270
+
271
+ Pull down a known font and use it as a reference.
272
+
273
+ ```json
274
+ {
275
+ "data": [
276
+ [{ "id": "uuid", "value": "Hello World!", "position": [0, 0] }],
277
+ [{ "id": "uuid", "value": "Hello World!", "position": [0, 0], "wrap": 100 }]
278
+ ]
279
+ }
280
+ ```
281
+
282
+ If a `id` is not found in the current file it will call the `reference` event. This event will need to return the found file to the `callback`. This could slow down initial project load.
283
+
284
+ ```typescript
285
+ this.$input.addEventListener('reference', (e: any) => {
286
+ const { id, callback } = e.detail;
287
+ if (id === 'uuid') {
288
+ callback(file);
289
+ }
290
+ });
291
+ ```
292
+
293
+ ## History
294
+
295
+ The history list contains every change made to the canvas. All feature insert an entry into history. Pens and pattern tools will group as to cut down history entries.
296
+
297
+ Note: Calling the `draw*()` commands programatically will group into a single history item. To create multiple entries call `flush()`.
298
+
299
+ - Undo a change
300
+ - Redo an undo
301
+ - Timeline - Commonly used to generate progression clips. `getHistoryGif({ delay: 0.05 })` for instance generates a gif with 0.05 second delay between each change.
302
+
303
+ ### History Format
304
+
305
+ For plugins or tools generating timelines the `getHistory()` returns an array with all entries. Note the `getHistoryPng(index)` is very CPU intensive and will recreate every change up to the index.
306
+
307
+ ```json
308
+ [ // history
309
+ [ // history item
310
+ {}, // group
311
+ {}
312
+ ]
313
+ ]
314
+ ```
@@ -24,6 +24,14 @@ label {
24
24
  }
25
25
 
26
26
  h3 {
27
+ display: flex;
27
28
  margin: 0.25rem 0;
28
29
  font-size: 1.125rem;
30
+ align-items: center;
31
+ }
32
+
33
+ [part=addColor],
34
+ [part=addLayer] {
35
+ vertical-align: middle;
36
+ margin-left: 0.5rem;
29
37
  }
@@ -29,10 +29,23 @@
29
29
  <button part="reset">Reset</button>
30
30
  <button part="clear">Clear</button>
31
31
  <button part="invert">Invert</button>
32
+ <button part="outline">Outline</button>
33
+ <button part="glow">Glow</button>
34
+ |
35
+ <button part="undo">Undo</button>
36
+ <button part="redo">Redo</button>
32
37
  |
33
38
  <button part="save">Save</button>
34
39
  <button part="open">Open</button>
35
40
  </div>
41
+ <div>
42
+ <h3>Selection Tools</h3>
43
+ <button part="cursor">Cursor</button>
44
+ <button part="selectRectangle">Select Rectangle</button>
45
+ <button part="selectEllipse">Select Circle</button>
46
+ <button part="selectLasso">Select Lasso</button>
47
+ <button part="selectMagic">Select Magic Wand</button>
48
+ </div>
36
49
  <div>
37
50
  <h3>Drawing Tools</h3>
38
51
  <button part="modePixel">Pixel</button>
@@ -43,20 +56,29 @@
43
56
  <button part="modeEllipseOutline">Ellipse Outline</button>
44
57
  </div>
45
58
  <div>
46
- <h3>Color Tools</h3>
47
- <button part="addColor">Add Color</button>
48
- <pre part="colors"></pre>
59
+ Stamps:
60
+ <button part="modeStamp1" data-stamp="1">1 Pixel</button>
61
+ <button part="modeStamp2" data-stamp="3-circle">3 Pixel Circle</button>
62
+ <button part="modeStamp3" data-stamp="3-square">3 Pixel Square</button>
63
+ <button part="modeStamp4" data-stamp="heart">Heart</button>
64
+ </div>
65
+ <div>
66
+ <h3>Color Tools <button part="addColor">Add Color</button></h3>
67
+ <pg-table part="colors"></pg-table>
49
68
  </div>
50
69
  <div>
51
- <h3>Layer Tools</h3>
52
- <button part="addLayer">Add Layer</button>
53
- <pre part="layers"></pre>
70
+ <h3>Layer Tools&nbsp;<small>(inversed, lower index is a higher layer)</small></h3>
71
+ <div>
72
+ <button part="addLayer">Add Pixel Layer</button>
73
+ <button part="addLayerReference">Add Reference Layer</button>
74
+ </div>
75
+ <pg-table part="layers"></table>
54
76
  </div>
55
77
  <div>
56
78
  <h3>Example Tools</h3>
57
79
  <input part="file" type="file" />
58
80
  <button part="saveSvg">Save SVG</button>
59
- <button part="savePng">Save Image</button>
81
+ <button part="savePng">Save PNG</button>
60
82
  </div>
61
83
  <div part="debug"></div>
62
84
  <pre part="output" contenteditable></pre>