-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern_editor.html
More file actions
312 lines (270 loc) · 8.15 KB
/
Copy pathpattern_editor.html
File metadata and controls
312 lines (270 loc) · 8.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>三板斧模式规则编辑器 | Pattern Editor</title>
<link
href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&family=Noto+Sans+SC:wght@300;400;700&display=swap"
rel="stylesheet">
<style>
:root {
--primary: #c19a6b;
--primary-hover: #b0895a;
--bg: #1a1a1a;
--card-bg: #2a2a2a;
--text: #e0e0e0;
--text-dim: #a0a0a0;
--border: #3d3d3d;
--success: #4caf50;
--danger: #f44336;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Outfit', 'Noto Sans SC', sans-serif;
background-color: var(--bg);
color: var(--text);
margin: 0;
display: flex;
height: 100vh;
overflow: hidden;
}
/* Sidebar */
.sidebar {
width: 320px;
background: var(--card-bg);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
}
.sidebar-header {
padding: 20px;
border-bottom: 1px solid var(--border);
}
.sidebar-header h1 {
font-size: 1.2rem;
margin: 0;
color: var(--primary);
}
.category-tabs {
display: flex;
padding: 10px;
gap: 5px;
}
.tab-btn {
flex: 1;
padding: 8px;
background: #333;
border: none;
color: var(--text-dim);
cursor: pointer;
border-radius: 4px;
font-size: 0.85rem;
transition: all 0.3s;
}
.tab-btn.active {
background: var(--primary);
color: white;
}
.list-container {
flex: 1;
overflow-y: auto;
padding: 10px;
}
.pattern-item {
padding: 12px;
border-radius: 6px;
margin-bottom: 8px;
cursor: pointer;
transition: background 0.2s;
border: 1px solid transparent;
}
.pattern-item:hover {
background: #333;
}
.pattern-item.active {
background: #3d3d3d;
border-color: var(--primary);
}
.pattern-item .id {
font-size: 0.7rem;
color: var(--text-dim);
}
.pattern-item .title {
font-size: 0.95rem;
font-weight: 600;
margin-top: 2px;
}
/* Main Editor */
.main-editor {
flex: 1;
display: flex;
flex-direction: column;
padding: 40px;
overflow-y: auto;
}
.editor-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.btn-save {
background: var(--primary);
color: white;
border: none;
padding: 10px 24px;
border-radius: 25px;
cursor: pointer;
font-weight: 600;
transition: transform 0.2s;
}
.btn-save:hover {
transform: scale(1.05);
}
.form-group {
margin-bottom: 24px;
}
label {
display: block;
margin-bottom: 8px;
color: var(--text-dim);
font-size: 0.9rem;
}
input,
textarea {
width: 100%;
background: #333;
border: 1px solid var(--border);
color: var(--text);
padding: 12px;
border-radius: 8px;
font-family: inherit;
outline: none;
}
input:focus,
textarea:focus {
border-color: var(--primary);
}
textarea {
min-height: 200px;
line-height: 1.6;
resize: vertical;
}
.tags-input {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tag {
background: #444;
padding: 4px 10px;
border-radius: 15px;
font-size: 0.8rem;
display: flex;
align-items: center;
gap: 6px;
}
/* Helper Chips */
.condition-helper {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 10px;
padding: 15px;
background: #252525;
border-radius: 8px;
border: 1px dashed var(--border);
max-height: 200px;
overflow-y: auto;
}
.cond-chip {
background: #333;
color: var(--primary);
padding: 5px 12px;
border-radius: 20px;
font-size: 0.8rem;
cursor: pointer;
border: 1px solid var(--border);
transition: all 0.2s;
}
.cond-chip:hover {
background: var(--primary);
color: white;
border-color: var(--primary);
}
.tag-remove {
cursor: pointer;
opacity: 0.6;
}
.tag-remove:hover {
opacity: 1;
}
/* Welcome Screen */
.welcome {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #1e1e1e;
color: var(--text-dim);
}
</style>
</head>
<body>
<div class="sidebar">
<div class="sidebar-header">
<h1>🏮 模式规则编辑器</h1>
</div>
<div class="category-tabs">
<button class="tab-btn active" onclick="switchCategory('marriage')">婚姻</button>
<button class="tab-btn" onclick="switchCategory('academic')">学业</button>
<button class="tab-btn" onclick="switchCategory('wealth')">财富</button>
</div>
<div class="list-container" id="list-container">
<!-- Items injected by JS -->
</div>
</div>
<div class="main-editor" id="editor-container" style="display: none;">
<div class="editor-header">
<h2 id="edit-title-display">编辑模式</h2>
<button class="btn-save" onclick="generateCode()">📥 生成并保存代码</button>
</div>
<div class="form-group">
<label>模式 ID (不可修改)</label>
<input type="text" id="p-id" readonly style="opacity: 0.5;">
</div>
<div class="form-group">
<label>模式标题 (主标题)</label>
<input type="text" id="p-title">
</div>
<div class="form-group">
<label>判断条件 (英文逗号分隔,支持 "!" 前缀)</label>
<input type="text" id="p-conditions">
<div id="condition-helper" class="condition-helper">
<!-- Chips injected here -->
</div>
<p style="font-size: 0.8rem; color: var(--text-dim); margin-top: 5px;">
💡 <b>提示</b>: 点击上方的蓝色标签即可添加条件。例如点击“+ 男命”将添加 <code>isMale</code>。
</p>
</div>
<div class="form-group">
<label>分析断语 (Narrative)</label>
<textarea id="p-narrative"></textarea>
</div>
<div id="save-status" style="margin-top: 10px; font-size: 0.9rem;"></div>
</div>
<div class="welcome" id="welcome-screen">
<p>🏮 请从左侧选择一个模式进行编辑</p>
</div>
<!-- Load Data Files (Temporarily for GUI context) -->
<script src="js/pattern_engine.js"></script>
<script src="js/formulas/marriage_patterns.js"></script>
<script src="js/formulas/academic_patterns.js"></script>
<script src="js/formulas/wealth_patterns.js"></script>
<script src="js/pattern_editor.js"></script>
</body>
</html>