pixi-watchface-engine 0.1.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.
- package/API.md +796 -0
- package/LICENSE +21 -0
- package/README.md +257 -0
- package/dist/EventBus.d.ts +73 -0
- package/dist/EventBus.d.ts.map +1 -0
- package/dist/WatchfaceEngine.d.ts +43 -0
- package/dist/WatchfaceEngine.d.ts.map +1 -0
- package/dist/elements/BaseElement.d.ts +49 -0
- package/dist/elements/BaseElement.d.ts.map +1 -0
- package/dist/elements/ElementRegistry.d.ts +12 -0
- package/dist/elements/ElementRegistry.d.ts.map +1 -0
- package/dist/elements/FillMask.d.ts +10 -0
- package/dist/elements/FillMask.d.ts.map +1 -0
- package/dist/elements/ImageElement.d.ts +21 -0
- package/dist/elements/ImageElement.d.ts.map +1 -0
- package/dist/elements/ShapeElement.d.ts +42 -0
- package/dist/elements/ShapeElement.d.ts.map +1 -0
- package/dist/elements/TextElement.d.ts +43 -0
- package/dist/elements/TextElement.d.ts.map +1 -0
- package/dist/elements/index.d.ts +10 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35005 -0
- package/dist/managers/ElementManager.d.ts +19 -0
- package/dist/managers/ElementManager.d.ts.map +1 -0
- package/dist/managers/InteractionManager.d.ts +21 -0
- package/dist/managers/InteractionManager.d.ts.map +1 -0
- package/dist/managers/SerializationManager.d.ts +20 -0
- package/dist/managers/SerializationManager.d.ts.map +1 -0
- package/dist/managers/ZOrderManager.d.ts +14 -0
- package/dist/managers/ZOrderManager.d.ts.map +1 -0
- package/dist/managers/index.d.ts +6 -0
- package/dist/managers/index.d.ts.map +1 -0
- package/dist/plugins/AutosavePlugin.d.ts +18 -0
- package/dist/plugins/AutosavePlugin.d.ts.map +1 -0
- package/dist/plugins/GridPlugin.d.ts +28 -0
- package/dist/plugins/GridPlugin.d.ts.map +1 -0
- package/dist/plugins/KeyboardShortcutsPlugin.d.ts +10 -0
- package/dist/plugins/KeyboardShortcutsPlugin.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +8 -0
- package/dist/plugins/Plugin.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +14 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/UndoRedoPlugin.d.ts +22 -0
- package/dist/plugins/UndoRedoPlugin.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/selection/MarqueeSelect.d.ts +15 -0
- package/dist/selection/MarqueeSelect.d.ts.map +1 -0
- package/dist/selection/SelectionBox.d.ts +23 -0
- package/dist/selection/SelectionBox.d.ts.map +1 -0
- package/dist/selection/SelectionManager.d.ts +51 -0
- package/dist/selection/SelectionManager.d.ts.map +1 -0
- package/dist/selection/TransformController.d.ts +24 -0
- package/dist/selection/TransformController.d.ts.map +1 -0
- package/dist/selection/TransformHandle.d.ts +12 -0
- package/dist/selection/TransformHandle.d.ts.map +1 -0
- package/dist/selection/index.d.ts +7 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/math.d.ts +5 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/uid.d.ts +2 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pixi Watchface Engine Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Pixi Watchface Editor Engine
|
|
2
|
+
|
|
3
|
+
A standalone PixiJS v8 watchface editor library with a visual editor, plugin system, and intuitive developer API. Framework-agnostic (works with Svelte, React, vanilla JS).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Visual Editor** — Click, drag, resize, rotate watchface elements
|
|
8
|
+
- 🔌 **Plugin System** — Grid, autosave, undo/redo, keyboard shortcuts
|
|
9
|
+
- 📦 **Rich Elements** — Text, images, shapes (line, circle, rectangle, arc)
|
|
10
|
+
- ⚙️ **Fill Percentage** — Configurable fill direction for shape elements
|
|
11
|
+
- ✏️ **Reactive Properties** — Setting `element.x = 500` auto-updates the canvas
|
|
12
|
+
- 🔄 **Full Serialization** — Export/import watchfaces as JSON
|
|
13
|
+
- ⌨️ **Keyboard Shortcuts** — Cmd/Ctrl-aware (macOS/Windows), copy/paste, undo/redo
|
|
14
|
+
- 🎯 **Z-Ordering** — Bring to front, send to back
|
|
15
|
+
- 📋 **Multi-Select** — Click, Shift+Click, drag-to-select marquee
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
WatchfaceEngine,
|
|
22
|
+
TextElement,
|
|
23
|
+
ShapeElement,
|
|
24
|
+
GridPlugin,
|
|
25
|
+
UndoRedoPlugin,
|
|
26
|
+
KeyboardShortcutsPlugin,
|
|
27
|
+
} from 'pixi-watchface-engine';
|
|
28
|
+
|
|
29
|
+
const engine = new WatchfaceEngine();
|
|
30
|
+
await engine.init(document.getElementById('canvas')!, {
|
|
31
|
+
width: 400,
|
|
32
|
+
height: 400,
|
|
33
|
+
background: 0x1a1a2e,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Register plugins
|
|
37
|
+
engine.plugins.register(new GridPlugin({ snapEnabled: true }));
|
|
38
|
+
engine.plugins.register(new UndoRedoPlugin());
|
|
39
|
+
engine.plugins.register(new KeyboardShortcutsPlugin());
|
|
40
|
+
|
|
41
|
+
// Add elements
|
|
42
|
+
const text = new TextElement('12:00', 150, 170, { fontSize: 48 });
|
|
43
|
+
engine.elements.add(text);
|
|
44
|
+
|
|
45
|
+
const battery = ShapeElement.rectangle(160, 350, 80, 12);
|
|
46
|
+
battery.fillPercentage = 75;
|
|
47
|
+
battery.foregroundColor = 0x00ff88;
|
|
48
|
+
engine.elements.add(battery);
|
|
49
|
+
|
|
50
|
+
// Reactive updates
|
|
51
|
+
text.x = 160; // Auto-updates canvas
|
|
52
|
+
battery.fillPercentage = 50;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Elements
|
|
56
|
+
|
|
57
|
+
### TextElement
|
|
58
|
+
```typescript
|
|
59
|
+
const text = new TextElement('Hello', x, y, {
|
|
60
|
+
fontFamily: 'Arial',
|
|
61
|
+
fontSize: 24,
|
|
62
|
+
fontWeight: 'bold',
|
|
63
|
+
align: 'center',
|
|
64
|
+
color: 0xffffff,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### ImageElement
|
|
69
|
+
```typescript
|
|
70
|
+
const image = new ImageElement('/assets/logo.png', x, y);
|
|
71
|
+
image.width = 100;
|
|
72
|
+
image.height = 100;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### ShapeElement
|
|
76
|
+
```typescript
|
|
77
|
+
ShapeElement.line(x1, y1, x2, y2);
|
|
78
|
+
ShapeElement.circle(cx, cy, radius);
|
|
79
|
+
ShapeElement.rectangle(x, y, width, height);
|
|
80
|
+
ShapeElement.arc(cx, cy, radius, startAngle, endAngle);
|
|
81
|
+
|
|
82
|
+
// Shape properties
|
|
83
|
+
shape.foregroundColor = 0xffffff;
|
|
84
|
+
shape.backgroundColor = 0x333333;
|
|
85
|
+
shape.fillPercentage = 75; // 0-100
|
|
86
|
+
shape.fillDirection = 'left-to-right'; // or right-to-left, top-to-bottom, bottom-to-top
|
|
87
|
+
shape.strokeWidth = 2; // for lines and arcs
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Selection & Transformation
|
|
91
|
+
|
|
92
|
+
**Programmatically:**
|
|
93
|
+
```typescript
|
|
94
|
+
engine.selection.select(element);
|
|
95
|
+
engine.selection.selectAll();
|
|
96
|
+
engine.selection.deleteSelected();
|
|
97
|
+
engine.selection.copySelected();
|
|
98
|
+
engine.selection.pasteClipboard();
|
|
99
|
+
engine.selection.nudgeSelected(dx, dy);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**User interactions:**
|
|
103
|
+
- Click to select
|
|
104
|
+
- Shift+Click to toggle
|
|
105
|
+
- Drag to select multiple (marquee)
|
|
106
|
+
- Drag element to move
|
|
107
|
+
- Drag corner handle to resize
|
|
108
|
+
- Drag rotation handle to rotate
|
|
109
|
+
- Ctrl/Cmd+C/V for copy/paste
|
|
110
|
+
- Delete/Backspace to delete
|
|
111
|
+
- Arrow keys to nudge
|
|
112
|
+
- Ctrl/Cmd+Z/Shift+Z for undo/redo
|
|
113
|
+
|
|
114
|
+
## Z-Ordering
|
|
115
|
+
```typescript
|
|
116
|
+
engine.zOrder.bringToFront(element);
|
|
117
|
+
engine.zOrder.sendToBack(element);
|
|
118
|
+
engine.zOrder.moveForward(element);
|
|
119
|
+
engine.zOrder.moveBackward(element);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Serialization
|
|
123
|
+
```typescript
|
|
124
|
+
// Export
|
|
125
|
+
const json = engine.serialization.serialize();
|
|
126
|
+
localStorage.setItem('watchface', json);
|
|
127
|
+
|
|
128
|
+
// Import
|
|
129
|
+
await engine.serialization.deserialize(json);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Plugins
|
|
133
|
+
|
|
134
|
+
### GridPlugin
|
|
135
|
+
```typescript
|
|
136
|
+
engine.plugins.register(new GridPlugin({
|
|
137
|
+
cellSize: 20,
|
|
138
|
+
color: 0x444444,
|
|
139
|
+
opacity: 0.3,
|
|
140
|
+
snapEnabled: false,
|
|
141
|
+
visible: true,
|
|
142
|
+
}));
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### AutosavePlugin
|
|
146
|
+
```typescript
|
|
147
|
+
engine.plugins.register(new AutosavePlugin({
|
|
148
|
+
intervalMs: 30000,
|
|
149
|
+
onSave: async (json) => { /* save */ },
|
|
150
|
+
}));
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### UndoRedoPlugin
|
|
154
|
+
```typescript
|
|
155
|
+
engine.plugins.register(new UndoRedoPlugin({ maxHistory: 100 }));
|
|
156
|
+
const ur = engine.plugins.get('undoredo');
|
|
157
|
+
ur.undo();
|
|
158
|
+
ur.redo();
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### KeyboardShortcutsPlugin
|
|
162
|
+
```typescript
|
|
163
|
+
engine.plugins.register(new KeyboardShortcutsPlugin());
|
|
164
|
+
// Automatically handles Cmd on macOS, Ctrl elsewhere
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Custom Plugins
|
|
168
|
+
```typescript
|
|
169
|
+
class MyPlugin implements Plugin {
|
|
170
|
+
readonly name = 'my-plugin';
|
|
171
|
+
init(engine: WatchfaceEngine) { /* setup */ }
|
|
172
|
+
destroy() { /* cleanup */ }
|
|
173
|
+
update?(deltaTime: number) { /* per-frame */ }
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Events
|
|
178
|
+
```typescript
|
|
179
|
+
engine.eventBus.on('element:added', ({ element }) => {});
|
|
180
|
+
engine.eventBus.on('element:changed', ({ element, property, oldValue, newValue }) => {});
|
|
181
|
+
engine.eventBus.on('selection:changed', ({ selected }) => {});
|
|
182
|
+
engine.eventBus.on('interaction:dragMove', ({ elements, dx, dy }) => {});
|
|
183
|
+
engine.eventBus.on('state:saved', ({ json }) => {});
|
|
184
|
+
engine.eventBus.on('state:loaded', ({ json }) => {});
|
|
185
|
+
engine.eventBus.on('action:performed', ({ action }) => {});
|
|
186
|
+
// ... and more
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## API Reference
|
|
190
|
+
|
|
191
|
+
### WatchfaceEngine
|
|
192
|
+
```typescript
|
|
193
|
+
app: Application;
|
|
194
|
+
eventBus: EventBus;
|
|
195
|
+
elements: ElementManager;
|
|
196
|
+
selection: SelectionManager;
|
|
197
|
+
plugins: PluginManager;
|
|
198
|
+
serialization: SerializationManager;
|
|
199
|
+
zOrder: ZOrderManager;
|
|
200
|
+
|
|
201
|
+
async init(container: HTMLDivElement, options: WatchfaceEngineOptions): Promise<void>;
|
|
202
|
+
destroy(): void;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Element Properties
|
|
206
|
+
```typescript
|
|
207
|
+
// All elements have
|
|
208
|
+
x: number;
|
|
209
|
+
y: number;
|
|
210
|
+
rotation: number; // radians
|
|
211
|
+
zIndex: number;
|
|
212
|
+
visible: boolean;
|
|
213
|
+
interactable: boolean; // false = not selectable
|
|
214
|
+
opacity: number; // 0-1
|
|
215
|
+
width: number; // element-specific
|
|
216
|
+
height: number; // element-specific
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Engine Options
|
|
220
|
+
```typescript
|
|
221
|
+
interface WatchfaceEngineOptions {
|
|
222
|
+
width: number;
|
|
223
|
+
height: number;
|
|
224
|
+
background?: string | number;
|
|
225
|
+
selectionHandleColor?: number;
|
|
226
|
+
selectionHandleFillColor?: number;
|
|
227
|
+
selectionHandleSize?: number;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Svelte Integration
|
|
232
|
+
|
|
233
|
+
```svelte
|
|
234
|
+
<script lang="ts">
|
|
235
|
+
import { WatchfaceEngine, TextElement, ShapeElement } from 'pixi-watchface-engine';
|
|
236
|
+
|
|
237
|
+
let canvasContainer: HTMLDivElement;
|
|
238
|
+
|
|
239
|
+
onMount(async () => {
|
|
240
|
+
const engine = new WatchfaceEngine();
|
|
241
|
+
await engine.init(canvasContainer, { width: 400, height: 400 });
|
|
242
|
+
|
|
243
|
+
const text = new TextElement('Hello', 100, 100);
|
|
244
|
+
engine.elements.add(text);
|
|
245
|
+
});
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
<div bind:this={canvasContainer} class="canvas"></div>
|
|
249
|
+
|
|
250
|
+
<style>
|
|
251
|
+
.canvas { width: 400px; height: 400px; }
|
|
252
|
+
</style>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { BaseElement } from './elements/BaseElement.ts';
|
|
2
|
+
import type { UndoableAction } from './types.ts';
|
|
3
|
+
export interface EngineEventMap {
|
|
4
|
+
'engine:ready': void;
|
|
5
|
+
'engine:destroy': void;
|
|
6
|
+
'element:added': {
|
|
7
|
+
element: BaseElement;
|
|
8
|
+
};
|
|
9
|
+
'element:removed': {
|
|
10
|
+
element: BaseElement;
|
|
11
|
+
};
|
|
12
|
+
'element:changed': {
|
|
13
|
+
element: BaseElement;
|
|
14
|
+
property: string;
|
|
15
|
+
oldValue: unknown;
|
|
16
|
+
newValue: unknown;
|
|
17
|
+
};
|
|
18
|
+
'element:zChanged': {
|
|
19
|
+
element: BaseElement;
|
|
20
|
+
oldZ: number;
|
|
21
|
+
newZ: number;
|
|
22
|
+
};
|
|
23
|
+
'selection:changed': {
|
|
24
|
+
selected: BaseElement[];
|
|
25
|
+
};
|
|
26
|
+
'selection:cleared': void;
|
|
27
|
+
'interaction:dragStart': {
|
|
28
|
+
element: BaseElement;
|
|
29
|
+
position: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
'interaction:dragMove': {
|
|
35
|
+
elements: BaseElement[];
|
|
36
|
+
dx: number;
|
|
37
|
+
dy: number;
|
|
38
|
+
};
|
|
39
|
+
'interaction:dragEnd': {
|
|
40
|
+
elements: BaseElement[];
|
|
41
|
+
};
|
|
42
|
+
'interaction:resizeStart': {
|
|
43
|
+
element: BaseElement;
|
|
44
|
+
};
|
|
45
|
+
'interaction:resizeEnd': {
|
|
46
|
+
element: BaseElement;
|
|
47
|
+
};
|
|
48
|
+
'interaction:rotateStart': {
|
|
49
|
+
element: BaseElement;
|
|
50
|
+
};
|
|
51
|
+
'interaction:rotateEnd': {
|
|
52
|
+
element: BaseElement;
|
|
53
|
+
};
|
|
54
|
+
'action:performed': {
|
|
55
|
+
action: UndoableAction;
|
|
56
|
+
};
|
|
57
|
+
'state:saved': {
|
|
58
|
+
json: string;
|
|
59
|
+
};
|
|
60
|
+
'state:loaded': {
|
|
61
|
+
json: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
type Handler<T> = T extends void ? () => void : (data: T) => void;
|
|
65
|
+
export declare class EventBus {
|
|
66
|
+
private listeners;
|
|
67
|
+
on<K extends keyof EngineEventMap>(event: K, handler: Handler<EngineEventMap[K]>): () => void;
|
|
68
|
+
emit<K extends keyof EngineEventMap>(event: K, ...args: EngineEventMap[K] extends void ? [] : [EngineEventMap[K]]): void;
|
|
69
|
+
off<K extends keyof EngineEventMap>(event: K, handler: Handler<EngineEventMap[K]>): void;
|
|
70
|
+
removeAllListeners(): void;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=EventBus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../src/EventBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,IAAI,CAAC;IACrB,gBAAgB,EAAE,IAAI,CAAC;IAEvB,eAAe,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAC1C,iBAAiB,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;IAC5C,iBAAiB,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACpG,kBAAkB,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzE,mBAAmB,EAAE;QAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;KAAE,CAAC;IACjD,mBAAmB,EAAE,IAAI,CAAC;IAE1B,uBAAuB,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACtF,sBAAsB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Ac,CAAC,CAAC,CAAC,CAAC,GAClC,IAAI;IAIP,kBAAkB,IAAI,IAAI;CAG3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Application, Container } from 'pixi.js';
|
|
2
|
+
import { EventBus } from './EventBus.ts';
|
|
3
|
+
import { ElementManager } from './managers/ElementManager.ts';
|
|
4
|
+
import { ZOrderManager } from './managers/ZOrderManager.ts';
|
|
5
|
+
import { SerializationManager } from './managers/SerializationManager.ts';
|
|
6
|
+
import { SelectionManager } from './selection/SelectionManager.ts';
|
|
7
|
+
import { PluginManager } from './plugins/PluginManager.ts';
|
|
8
|
+
export interface WatchfaceEngineOptions {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
background?: string | number;
|
|
12
|
+
selectionHandleColor?: number;
|
|
13
|
+
selectionHandleFillColor?: number;
|
|
14
|
+
selectionHandleSize?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class WatchfaceEngine {
|
|
17
|
+
readonly app: Application;
|
|
18
|
+
readonly eventBus: EventBus;
|
|
19
|
+
readonly elements: ElementManager;
|
|
20
|
+
readonly selection: SelectionManager;
|
|
21
|
+
readonly plugins: PluginManager;
|
|
22
|
+
readonly serialization: SerializationManager;
|
|
23
|
+
readonly zOrder: ZOrderManager;
|
|
24
|
+
private backgroundLayer;
|
|
25
|
+
private elementsLayer;
|
|
26
|
+
private selectionLayer;
|
|
27
|
+
private overlayLayer;
|
|
28
|
+
private interaction;
|
|
29
|
+
private _options;
|
|
30
|
+
private _initialized;
|
|
31
|
+
/** @internal Used by UndoRedoPlugin to suppress action recording during undo/redo */
|
|
32
|
+
_suppressActions: boolean;
|
|
33
|
+
constructor();
|
|
34
|
+
init(container: HTMLDivElement, options: WatchfaceEngineOptions): Promise<void>;
|
|
35
|
+
get options(): Readonly<WatchfaceEngineOptions>;
|
|
36
|
+
get initialized(): boolean;
|
|
37
|
+
getBackgroundLayer(): Container;
|
|
38
|
+
getElementsLayer(): Container;
|
|
39
|
+
getSelectionLayer(): Container;
|
|
40
|
+
getOverlayLayer(): Container;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=WatchfaceEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WatchfaceEngine.d.ts","sourceRoot":"","sources":["../src/WatchfaceEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,qBAAa,eAAe;IAC1B,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,WAAW,CAAqB;IAExC,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,YAAY,CAAS;IAE7B,qFAAqF;IACrF,gBAAgB,UAAS;;IAqBnB,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CrF,IAAI,OAAO,IAAI,QAAQ,CAAC,sBAAsB,CAAC,CAE9C;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,kBAAkB,IAAI,SAAS;IAI/B,gBAAgB,IAAI,SAAS;IAI7B,iBAAiB,IAAI,SAAS;IAI9B,eAAe,IAAI,SAAS;IAI5B,OAAO,IAAI,IAAI;CAUhB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import type { EventBus } from '../EventBus.ts';
|
|
3
|
+
import type { ElementType, SerializedElement } from '../types.ts';
|
|
4
|
+
export interface EngineRef {
|
|
5
|
+
eventBus: EventBus;
|
|
6
|
+
_suppressActions: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class BaseElement {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly type: ElementType;
|
|
11
|
+
protected readonly container: Container;
|
|
12
|
+
protected engine: EngineRef | null;
|
|
13
|
+
private _x;
|
|
14
|
+
private _y;
|
|
15
|
+
private _rotation;
|
|
16
|
+
private _zIndex;
|
|
17
|
+
private _visible;
|
|
18
|
+
private _interactable;
|
|
19
|
+
private _opacity;
|
|
20
|
+
constructor(type: ElementType, id?: string);
|
|
21
|
+
get x(): number;
|
|
22
|
+
set x(value: number);
|
|
23
|
+
get y(): number;
|
|
24
|
+
set y(value: number);
|
|
25
|
+
get rotation(): number;
|
|
26
|
+
set rotation(value: number);
|
|
27
|
+
get zIndex(): number;
|
|
28
|
+
set zIndex(value: number);
|
|
29
|
+
get visible(): boolean;
|
|
30
|
+
set visible(value: boolean);
|
|
31
|
+
get interactable(): boolean;
|
|
32
|
+
set interactable(value: boolean);
|
|
33
|
+
get opacity(): number;
|
|
34
|
+
set opacity(value: number);
|
|
35
|
+
abstract get width(): number;
|
|
36
|
+
abstract set width(value: number);
|
|
37
|
+
abstract get height(): number;
|
|
38
|
+
abstract set height(value: number);
|
|
39
|
+
protected emitChange(property: string, oldValue: unknown, newValue: unknown): void;
|
|
40
|
+
/** @internal Called by ElementManager when added to engine */
|
|
41
|
+
_attach(engine: EngineRef): void;
|
|
42
|
+
/** @internal Called by ElementManager when removed from engine */
|
|
43
|
+
_detach(): void;
|
|
44
|
+
getDisplayObject(): Container;
|
|
45
|
+
toJSON(): SerializedElement;
|
|
46
|
+
abstract applyJSON(data: SerializedElement): void;
|
|
47
|
+
protected abstract redraw(): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=BaseElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseElement.d.ts","sourceRoot":"","sources":["../../src/elements/BaseElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,8BAAsB,WAAW;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAA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,MAAM,EAAE,SAAS,GAAG,IAAI;IAIhC,kEAAkE;IAClE,OAAO,IAAI,IAAI;IAIf,gBAAgB,IAAI,SAAS;IAI7B,MAAM,IAAI,iBAAiB;IAkB3B,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAEjD,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;CAClC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BaseElement } from './BaseElement.ts';
|
|
2
|
+
import type { SerializedElement } from '../types.ts';
|
|
3
|
+
export interface ElementConstructor {
|
|
4
|
+
fromJSON(data: SerializedElement): BaseElement;
|
|
5
|
+
}
|
|
6
|
+
export declare class ElementRegistry {
|
|
7
|
+
private registry;
|
|
8
|
+
register(type: string, ctor: ElementConstructor): void;
|
|
9
|
+
get(type: string): ElementConstructor | undefined;
|
|
10
|
+
has(type: string): boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ElementRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElementRegistry.d.ts","sourceRoot":"","sources":["../../src/elements/ElementRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,WAAW,CAAC;CAChD;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAyC;IAEzD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAItD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIjD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Graphics } from 'pixi.js';
|
|
2
|
+
import type { Bounds, FillDirection } from '../types.ts';
|
|
3
|
+
export declare class FillMask {
|
|
4
|
+
private maskGraphics;
|
|
5
|
+
constructor();
|
|
6
|
+
getMaskGraphics(): Graphics;
|
|
7
|
+
update(bounds: Bounds, fillPercentage: number, direction: FillDirection): void;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=FillMask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FillMask.d.ts","sourceRoot":"","sources":["../../src/elements/FillMask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGzD,qBAAa,QAAQ;IACnB,OAAO,CAAC,YAAY,CAAW;;IAM/B,eAAe,IAAI,QAAQ;IAI3B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI;IA6B9E,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseElement } from './BaseElement.ts';
|
|
2
|
+
import type { SerializedElement } from '../types.ts';
|
|
3
|
+
export declare class ImageElement extends BaseElement {
|
|
4
|
+
private sprite;
|
|
5
|
+
private _src;
|
|
6
|
+
private _loaded;
|
|
7
|
+
constructor(src: string, x: number, y: number);
|
|
8
|
+
private loadTexture;
|
|
9
|
+
get src(): string;
|
|
10
|
+
set src(value: string);
|
|
11
|
+
get loaded(): boolean;
|
|
12
|
+
get width(): number;
|
|
13
|
+
set width(value: number);
|
|
14
|
+
get height(): number;
|
|
15
|
+
set height(value: number);
|
|
16
|
+
protected redraw(): void;
|
|
17
|
+
toJSON(): SerializedElement;
|
|
18
|
+
applyJSON(data: SerializedElement): void;
|
|
19
|
+
static fromJSON(data: SerializedElement): ImageElement;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ImageElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageElement.d.ts","sourceRoot":"","sources":["../../src/elements/ImageElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAS;gBAEZ,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;YAW/B,WAAW;IAUzB,IAAI,GAAG,IAAI,MAAM,CAAsB;IACvC,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAOpB;IAED,IAAI,MAAM,IAAI,OAAO,CAAyB;IAE9C,IAAa,KAAK,IAAI,MAAM,CAA8B;IAC1D,IAAa,KAAK,CAAC,KAAK,EAAE,MAAM,EAK/B;IAED,IAAa,MAAM,IAAI,MAAM,CAA+B;IAC5D,IAAa,MAAM,CAAC,KAAK,EAAE,MAAM,EAKhC;cAEkB,MAAM,IAAI,IAAI;IAIxB,MAAM,IAAI,iBAAiB;IAO3B,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAajD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,YAAY;CASvD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseElement } from './BaseElement.ts';
|
|
2
|
+
import type { Bounds, FillDirection, SerializedElement, ShapeType } from '../types.ts';
|
|
3
|
+
export declare class ShapeElement extends BaseElement {
|
|
4
|
+
private bgGraphics;
|
|
5
|
+
private fgGraphics;
|
|
6
|
+
private fillMask;
|
|
7
|
+
private _shapeType;
|
|
8
|
+
private _foregroundColor;
|
|
9
|
+
private _backgroundColor;
|
|
10
|
+
private _fillPercentage;
|
|
11
|
+
private _fillDirection;
|
|
12
|
+
private _strokeWidth;
|
|
13
|
+
private _shapeParams;
|
|
14
|
+
private constructor();
|
|
15
|
+
static line(x1: number, y1: number, x2: number, y2: number): ShapeElement;
|
|
16
|
+
static circle(x: number, y: number, radius: number): ShapeElement;
|
|
17
|
+
static rectangle(x: number, y: number, width: number, height: number): ShapeElement;
|
|
18
|
+
static arc(x: number, y: number, radius: number, startAngle: number, endAngle: number): ShapeElement;
|
|
19
|
+
get shapeType(): ShapeType;
|
|
20
|
+
get foregroundColor(): number;
|
|
21
|
+
set foregroundColor(value: number);
|
|
22
|
+
get backgroundColor(): number;
|
|
23
|
+
set backgroundColor(value: number);
|
|
24
|
+
get fillPercentage(): number;
|
|
25
|
+
set fillPercentage(value: number);
|
|
26
|
+
get fillDirection(): FillDirection;
|
|
27
|
+
set fillDirection(value: FillDirection);
|
|
28
|
+
get strokeWidth(): number;
|
|
29
|
+
set strokeWidth(value: number);
|
|
30
|
+
get width(): number;
|
|
31
|
+
set width(value: number);
|
|
32
|
+
get height(): number;
|
|
33
|
+
set height(value: number);
|
|
34
|
+
getLocalBounds(): Bounds;
|
|
35
|
+
protected redraw(): void;
|
|
36
|
+
private drawShape;
|
|
37
|
+
private updateMask;
|
|
38
|
+
toJSON(): SerializedElement;
|
|
39
|
+
applyJSON(data: SerializedElement): void;
|
|
40
|
+
static fromJSON(data: SerializedElement): ShapeElement;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ShapeElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeElement.d.ts","sourceRoot":"","sources":["../../src/elements/ShapeElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM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,aAAa,CAAgC;IAClE,IAAI,aAAa,CAAC,KAAK,EAAE,aAAa,EAMrC;IAED,IAAI,WAAW,IAAI,MAAM,CAA8B;IACvD,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAM5B;IAED,IAAa,KAAK,IAAI,MAAM,CAE3B;IACD,IAAa,KAAK,CAAC,KAAK,EAAE,MAAM,EAmB/B;IAED,IAAa,MAAM,IAAI,MAAM,CAE5B;IACD,IAAa,MAAM,CAAC,KAAK,EAAE,MAAM,EAmBhC;IAED,cAAc,IAAI,MAAM;cAwBL,MAAM,IAAI,IAAI;IASjC,OAAO,CAAC,SAAS;IA+BjB,OAAO,CAAC,UAAU;IAKT,MAAM,IAAI,iBAAiB;IAa3B,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAejD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,YAAY;CAkBvD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type TextStyleFontWeight } from 'pixi.js';
|
|
2
|
+
import { BaseElement } from './BaseElement.ts';
|
|
3
|
+
import type { SerializedElement } from '../types.ts';
|
|
4
|
+
export interface TextElementStyle {
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
fontWeight?: TextStyleFontWeight;
|
|
8
|
+
align?: TextStyleAlign;
|
|
9
|
+
color?: number;
|
|
10
|
+
}
|
|
11
|
+
type TextStyleAlign = 'left' | 'center' | 'right';
|
|
12
|
+
export declare class TextElement extends BaseElement {
|
|
13
|
+
private pixiText;
|
|
14
|
+
private _text;
|
|
15
|
+
private _fontFamily;
|
|
16
|
+
private _fontSize;
|
|
17
|
+
private _fontWeight;
|
|
18
|
+
private _align;
|
|
19
|
+
private _color;
|
|
20
|
+
constructor(text: string, x: number, y: number, style?: TextElementStyle);
|
|
21
|
+
get text(): string;
|
|
22
|
+
set text(value: string);
|
|
23
|
+
get fontFamily(): string;
|
|
24
|
+
set fontFamily(value: string);
|
|
25
|
+
get fontSize(): number;
|
|
26
|
+
set fontSize(value: number);
|
|
27
|
+
get fontWeight(): TextStyleFontWeight;
|
|
28
|
+
set fontWeight(value: TextStyleFontWeight);
|
|
29
|
+
get align(): TextStyleAlign;
|
|
30
|
+
set align(value: TextStyleAlign);
|
|
31
|
+
get color(): number;
|
|
32
|
+
set color(value: number);
|
|
33
|
+
get width(): number;
|
|
34
|
+
set width(value: number);
|
|
35
|
+
get height(): number;
|
|
36
|
+
set height(value: number);
|
|
37
|
+
protected redraw(): void;
|
|
38
|
+
toJSON(): SerializedElement;
|
|
39
|
+
applyJSON(data: SerializedElement): void;
|
|
40
|
+
static fromJSON(data: SerializedElement): TextElement;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=TextElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextElement.d.ts","sourceRoot":"","sources":["../../src/elements/TextElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEX,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,gBAAgB;IAyBxE,IAAI,IAAI,IAAI,MAAM,CAAuB;IACzC,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAMrB;IAED,IAAI,UAAU,IAAI,MAAM,CAA6B;IACrD,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAM3B;IAED,IAAI,QAAQ,IAAI,MAAM,CAA2B;IACjD,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED,IAAI,UAAU,IAAI,mBAAmB,CAA6B;IAClE,IAAI,UAAU,CAAC,KAAK,EAAE,mBAAmB,EAMxC;IAED,IAAI,KAAK,IAAI,cAAc,CAAwB;IACnD,IAAI,KAAK,CAAC,KAAK,EAAE,cAAc,EAM9B;IAED,IAAI,KAAK,IAAI,MAAM,CAAwB;IAC3C,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAMtB;IAED,IAAa,KAAK,IAAI,MAAM,CAAgC;IAC5D,IAAa,KAAK,CAAC,KAAK,EAAE,MAAM,EAK/B;IAED,IAAa,MAAM,IAAI,MAAM,CAAiC;IAC9D,IAAa,MAAM,CAAC,KAAK,EAAE,MAAM,EAKhC;cAEkB,MAAM,IAAI,IAAI;IAIxB,MAAM,IAAI,iBAAiB;IAY3B,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAgBjD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,WAAW;CAetD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BaseElement } from './BaseElement.ts';
|
|
2
|
+
export type { EngineRef } from './BaseElement.ts';
|
|
3
|
+
export { TextElement } from './TextElement.ts';
|
|
4
|
+
export type { TextElementStyle } from './TextElement.ts';
|
|
5
|
+
export { ImageElement } from './ImageElement.ts';
|
|
6
|
+
export { ShapeElement } from './ShapeElement.ts';
|
|
7
|
+
export { FillMask } from './FillMask.ts';
|
|
8
|
+
export { ElementRegistry } from './ElementRegistry.ts';
|
|
9
|
+
export type { ElementConstructor } from './ElementRegistry.ts';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { WatchfaceEngine } from './WatchfaceEngine.ts';
|
|
2
|
+
export type { WatchfaceEngineOptions } from './WatchfaceEngine.ts';
|
|
3
|
+
export { BaseElement } from './elements/BaseElement.ts';
|
|
4
|
+
export { TextElement } from './elements/TextElement.ts';
|
|
5
|
+
export type { TextElementStyle } from './elements/TextElement.ts';
|
|
6
|
+
export { ImageElement } from './elements/ImageElement.ts';
|
|
7
|
+
export { ShapeElement } from './elements/ShapeElement.ts';
|
|
8
|
+
export { FillMask } from './elements/FillMask.ts';
|
|
9
|
+
export { ElementRegistry } from './elements/ElementRegistry.ts';
|
|
10
|
+
export type { Plugin } from './plugins/Plugin.ts';
|
|
11
|
+
export { PluginManager } from './plugins/PluginManager.ts';
|
|
12
|
+
export { GridPlugin } from './plugins/GridPlugin.ts';
|
|
13
|
+
export type { GridPluginOptions } from './plugins/GridPlugin.ts';
|
|
14
|
+
export { AutosavePlugin } from './plugins/AutosavePlugin.ts';
|
|
15
|
+
export type { AutosavePluginOptions } from './plugins/AutosavePlugin.ts';
|
|
16
|
+
export { UndoRedoPlugin } from './plugins/UndoRedoPlugin.ts';
|
|
17
|
+
export type { UndoRedoPluginOptions } from './plugins/UndoRedoPlugin.ts';
|
|
18
|
+
export { KeyboardShortcutsPlugin } from './plugins/KeyboardShortcutsPlugin.ts';
|
|
19
|
+
export { ElementManager } from './managers/ElementManager.ts';
|
|
20
|
+
export { ZOrderManager } from './managers/ZOrderManager.ts';
|
|
21
|
+
export { SelectionManager } from './selection/SelectionManager.ts';
|
|
22
|
+
export { SerializationManager } from './managers/SerializationManager.ts';
|
|
23
|
+
export type { FillDirection, ShapeType, ElementType, SerializedElement, WatchfaceState, UndoableAction, HandleConfig, Bounds, } from './types.ts';
|
|
24
|
+
export { EventBus } from './EventBus.ts';
|
|
25
|
+
export type { EngineEventMap } from './EventBus.ts';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,M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