@pictogrammers/components 0.5.5 → 0.5.7
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.
package/package.json
CHANGED
|
@@ -1412,6 +1412,28 @@ export default class PgInputPixelEditor extends HTMLElement {
|
|
|
1412
1412
|
});
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
+
/**
|
|
1416
|
+
* Draw pixel.
|
|
1417
|
+
* @param grid 2d grid of colors
|
|
1418
|
+
* @param layer Layer to apply the pixel.
|
|
1419
|
+
*/
|
|
1420
|
+
drawGrid(grid: number[][], layer = this.#layer) {
|
|
1421
|
+
grid.forEach((row, y) => {
|
|
1422
|
+
row.forEach((color, x) => {
|
|
1423
|
+
this.#setPixel(x, y, color, layer);
|
|
1424
|
+
});
|
|
1425
|
+
})
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Draw a single pixel.
|
|
1430
|
+
*/
|
|
1431
|
+
drawPixel(x: number, y: number, color: number, layer = this.#layer) {
|
|
1432
|
+
this.#setPixel(x, y, color, layer);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
// todo: add other draw commands
|
|
1436
|
+
|
|
1415
1437
|
/**
|
|
1416
1438
|
* Flatten layers, always merges to lowest layer
|
|
1417
1439
|
* Note 0 is the lowest layer.
|
|
@@ -57,5 +57,11 @@ export default class PgModalConfirm extends PgOverlay {
|
|
|
57
57
|
if (changes.message) {
|
|
58
58
|
this.$message.textContent = this.message;
|
|
59
59
|
}
|
|
60
|
+
if (changes.okay) {
|
|
61
|
+
this.$okay.textContent = this.okay;
|
|
62
|
+
}
|
|
63
|
+
if (changes.cancel) {
|
|
64
|
+
this.$cancel.textContent = this.cancel;
|
|
65
|
+
}
|
|
60
66
|
}
|
|
61
67
|
}
|
package/pg/overlay/overlay.ts
CHANGED
|
@@ -3,9 +3,13 @@ import { Component, Prop } from '@pictogrammers/element';
|
|
|
3
3
|
const layers: Set<HTMLElement> = new Set();
|
|
4
4
|
const promises: Map<HTMLElement, (value: any) => void> = new Map();
|
|
5
5
|
|
|
6
|
+
type OmitByPrefix<T, Prefix extends string> = {
|
|
7
|
+
[K in keyof T as K extends `${Prefix}${string}` ? never : K]: T[K];
|
|
8
|
+
};
|
|
9
|
+
|
|
6
10
|
@Component()
|
|
7
11
|
export default class PgOverlay extends HTMLElement {
|
|
8
|
-
static open<T extends typeof PgOverlay>(this: T, props: Partial<Omit<InstanceType<T>, keyof PgOverlay>>): Promise<any> {
|
|
12
|
+
static open<T extends typeof PgOverlay>(this: T, props: Partial<OmitByPrefix<Omit<InstanceType<T>, keyof PgOverlay>, '$'>>): Promise<any> {
|
|
9
13
|
var ele = document.createElement(this.name);
|
|
10
14
|
props && Object.assign(ele, props);
|
|
11
15
|
document.body.appendChild(ele);
|