@pictogrammers/components 0.4.9 → 0.5.1

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