@ohmygame/level-editor 0.0.0-stage → 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/.ohmygame-plugin/plugin.json +42 -0
- package/LICENSE +201 -0
- package/README.md +43 -2
- package/assets/icon.svg +1 -0
- package/locales/en.json +9 -0
- package/locales/zh-CN.json +9 -0
- package/package.json +27 -4
- package/panel/dom.js +79 -0
- package/panel/i18n.js +225 -0
- package/panel/index.html +15 -0
- package/panel/inspector.js +156 -0
- package/panel/main.js +1697 -0
- package/panel/new-map.js +112 -0
- package/panel/palette.js +196 -0
- package/panel/render.js +321 -0
- package/panel/style.css +137 -0
- package/panel/tmj.js +901 -0
- package/skills/level-maps/SKILL.md +28 -0
package/panel/style.css
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* The Levels panel fills its whole panel: a toolbar, the map, a sidebar with
|
|
2
|
+
layers, the tileset and the selected object, and a status line. Colours
|
|
3
|
+
come from the app's tokens, so it follows the light and dark themes. */
|
|
4
|
+
html { scrollbar-gutter: auto; height: 100%; }
|
|
5
|
+
body { padding: 0; height: 100%; overflow: hidden; }
|
|
6
|
+
#app { height: 100%; }
|
|
7
|
+
[hidden] { display: none !important; }
|
|
8
|
+
|
|
9
|
+
.app {
|
|
10
|
+
display: flex; flex-direction: column; height: 100%; min-height: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.toolbar {
|
|
14
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3);
|
|
15
|
+
padding: var(--space-2) var(--space-3);
|
|
16
|
+
border-bottom: 1px solid var(--color-border);
|
|
17
|
+
}
|
|
18
|
+
.toolbar .group { display: flex; align-items: center; gap: 2px; min-width: 0; }
|
|
19
|
+
.toolbar .group.file { gap: var(--space-2); flex: 1 1 260px; }
|
|
20
|
+
.toolbar .group.end { margin-left: auto; gap: var(--space-2); }
|
|
21
|
+
.map-select { flex: 1 1 auto; min-width: 120px; max-width: 360px; }
|
|
22
|
+
|
|
23
|
+
.icon-button::part(button) { width: 30px; padding: 0; }
|
|
24
|
+
.icon-button[data-pressed]::part(button) { background: var(--color-selected); color: var(--color-text); }
|
|
25
|
+
.icon { flex: none; display: block; }
|
|
26
|
+
|
|
27
|
+
.zoom-label {
|
|
28
|
+
min-width: 48px; height: 30px; padding: 0 var(--space-1); border: 0; border-radius: var(--radius-md);
|
|
29
|
+
background: transparent; color: var(--color-text-secondary); font: inherit; font-size: var(--text-sm);
|
|
30
|
+
font-variant-numeric: tabular-nums; cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
.zoom-label:hover { background: var(--color-hover); color: var(--color-text); }
|
|
33
|
+
|
|
34
|
+
.dirty {
|
|
35
|
+
display: inline-flex; align-items: center; gap: var(--space-1);
|
|
36
|
+
color: var(--color-text-secondary); font-size: var(--text-sm); white-space: nowrap;
|
|
37
|
+
}
|
|
38
|
+
.dirty::before {
|
|
39
|
+
content: ""; width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--color-warning);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.notices { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2) var(--space-3) 0; }
|
|
43
|
+
|
|
44
|
+
.workspace {
|
|
45
|
+
flex: 1 1 auto; min-height: 0;
|
|
46
|
+
display: grid; grid-template-columns: minmax(0, 1fr) 288px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
|
|
50
|
+
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
|
|
51
|
+
.map-canvas[data-cursor="brush"], .map-canvas[data-cursor="eraser"], .map-canvas[data-cursor="fill"],
|
|
52
|
+
.map-canvas[data-cursor="rect"], .map-canvas[data-cursor="point"] { cursor: crosshair; }
|
|
53
|
+
.map-canvas[data-cursor="eyedropper"] { cursor: copy; }
|
|
54
|
+
.map-canvas[data-cursor="select"] { cursor: default; }
|
|
55
|
+
.map-canvas[data-cursor="grab"] { cursor: grab; }
|
|
56
|
+
.map-canvas[data-cursor="grabbing"] { cursor: grabbing; }
|
|
57
|
+
.stage-message {
|
|
58
|
+
position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-4);
|
|
59
|
+
color: var(--color-text-secondary); text-align: center; pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.side {
|
|
63
|
+
min-height: 0; overflow-y: auto; overscroll-behavior: contain;
|
|
64
|
+
border-left: 1px solid var(--color-border);
|
|
65
|
+
display: flex; flex-direction: column;
|
|
66
|
+
}
|
|
67
|
+
.side-section { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
|
|
68
|
+
.side-section + .side-section { border-top: 1px solid var(--color-border); }
|
|
69
|
+
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 30px; }
|
|
70
|
+
.section-head h2 {
|
|
71
|
+
margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-secondary);
|
|
72
|
+
}
|
|
73
|
+
.section-actions { display: flex; gap: 0; }
|
|
74
|
+
.note { margin: 0; color: var(--color-text-secondary); font-size: var(--text-sm); }
|
|
75
|
+
|
|
76
|
+
.layer-list { display: flex; flex-direction: column; gap: 1px; max-height: 240px; overflow-y: auto; }
|
|
77
|
+
.layer-row {
|
|
78
|
+
display: flex; align-items: center; gap: var(--space-1); min-height: 28px;
|
|
79
|
+
padding: 0 var(--space-2) 0 var(--space-1);
|
|
80
|
+
border-radius: var(--radius-sm); cursor: default; user-select: none;
|
|
81
|
+
}
|
|
82
|
+
.layer-row:hover { background: var(--color-hover); }
|
|
83
|
+
.layer-row[aria-selected="true"] { background: var(--color-selected); }
|
|
84
|
+
.layer-row[data-hidden] .layer-name, .layer-row[data-hidden] .layer-kind { opacity: 0.45; }
|
|
85
|
+
.layer-eye {
|
|
86
|
+
display: grid; place-items: center; width: 24px; height: 24px; flex: none; padding: 0;
|
|
87
|
+
border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-secondary); cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
.layer-eye:hover:not(:disabled) { background: var(--color-selected); color: var(--color-text); }
|
|
90
|
+
.layer-eye:disabled { cursor: default; opacity: 0.6; }
|
|
91
|
+
.layer-kind { display: grid; place-items: center; color: var(--color-text-tertiary); }
|
|
92
|
+
.layer-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
93
|
+
.layer-lock { display: inline-flex; flex: none; color: var(--color-text-secondary); }
|
|
94
|
+
.layer-rename { flex: 1 1 auto; height: 24px; min-width: 0; }
|
|
95
|
+
|
|
96
|
+
.tileset-tabs omg-tabs::part(list) { gap: 2px; }
|
|
97
|
+
.tileset-tabs omg-tabs { margin-bottom: calc(-1 * var(--space-4)); }
|
|
98
|
+
.palette-scroll {
|
|
99
|
+
max-height: 320px; overflow: auto; border-radius: var(--radius-sm);
|
|
100
|
+
background: var(--color-stage); box-shadow: inset 0 0 0 1px var(--color-border);
|
|
101
|
+
}
|
|
102
|
+
.palette-canvas { display: block; cursor: pointer; touch-action: none; }
|
|
103
|
+
|
|
104
|
+
.inspector { display: flex; flex-direction: column; gap: var(--space-3); }
|
|
105
|
+
.object-id { display: flex; justify-content: space-between; }
|
|
106
|
+
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
|
|
107
|
+
.subhead { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-secondary); }
|
|
108
|
+
.property-list { display: flex; flex-direction: column; gap: var(--space-2); }
|
|
109
|
+
.property-list:empty { display: none; }
|
|
110
|
+
.property-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr) auto; gap: var(--space-1); align-items: center; }
|
|
111
|
+
.property-type { font-size: var(--text-sm); color: var(--color-text-secondary); padding: 0 var(--space-1); }
|
|
112
|
+
.inspector-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; }
|
|
113
|
+
|
|
114
|
+
.status {
|
|
115
|
+
display: flex; align-items: center; gap: var(--space-4); min-height: 26px; padding: 0 var(--space-3);
|
|
116
|
+
border-top: 1px solid var(--color-border);
|
|
117
|
+
color: var(--color-text-secondary); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap;
|
|
118
|
+
}
|
|
119
|
+
.status-cell { min-width: 120px; }
|
|
120
|
+
.status-layer { overflow: hidden; text-overflow: ellipsis; }
|
|
121
|
+
.status-message { flex: 1 1 auto; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; }
|
|
122
|
+
.status-size { margin-left: auto; }
|
|
123
|
+
|
|
124
|
+
.empty-state { flex: 1 1 auto; display: grid; place-items: center; padding: var(--space-6); }
|
|
125
|
+
|
|
126
|
+
.dialog-fields { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
127
|
+
omg-dialog::part(panel) { max-width: 440px; }
|
|
128
|
+
|
|
129
|
+
.probe { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
|
|
130
|
+
|
|
131
|
+
/* A narrow panel puts the sidebar under the map. */
|
|
132
|
+
@media (max-width: 640px) {
|
|
133
|
+
.workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(200px, 1fr) minmax(0, 42%); }
|
|
134
|
+
.side { border-left: 0; border-top: 1px solid var(--color-border); }
|
|
135
|
+
.status-layer, .status-size { display: none; }
|
|
136
|
+
}
|
|
137
|
+
.add-layer::part(button) { width: 30px; padding: 0; color: var(--color-text); }
|