-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsql-formatter-src.html
More file actions
253 lines (227 loc) · 7.65 KB
/
sql-formatter-src.html
File metadata and controls
253 lines (227 loc) · 7.65 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
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SQL Formatter</title>
{{LHT_COMPONENTS_STYLE}}
<style>
:root {
color-scheme: light;
--page-bg: linear-gradient(180deg, #f7f3fb 0%, #fcfbfd 55%, #f3f6fb 100%);
--surface: rgba(255, 255, 255, 0.92);
--surface-border: #ddd4ea;
--surface-shadow: 0 18px 40px rgba(46, 34, 74, 0.08);
--text-main: #261f31;
--text-muted: #5b5469;
--accent: #2f7c6a;
--accent-strong: #236353;
--accent-alt: #4966d1;
--focus-ring: rgba(79, 101, 205, 0.22);
}
html, body {
min-height: 100%;
}
body {
margin: 0;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
color: var(--text-main);
background: var(--page-bg);
}
.app-shell {
max-width: 1360px;
margin: 0 auto;
padding: 24px 18px 40px;
}
.app-grid {
display: grid;
gap: 18px;
grid-template-columns: minmax(0, 1fr);
align-items: start;
}
.app-card {
border: 1px solid var(--surface-border);
border-radius: 22px;
background: var(--surface);
box-shadow: var(--surface-shadow);
backdrop-filter: blur(8px);
padding: 16px;
}
.app-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.app-card__title {
margin: 0;
font-size: 0.92rem;
line-height: 1.3;
}
.app-card__desc {
margin: 4px 0 0;
font-size: 0.82rem;
line-height: 1.45;
color: var(--text-muted);
}
.app-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 10px;
}
.app-mode-switch {
display: inline-flex;
align-items: center;
min-height: 2.75rem;
padding: 0 0.15rem;
}
.app-field {
display: block;
}
.app-field textarea,
.app-field md-outlined-text-field {
min-height: 10rem;
}
.app-output {
display: block;
}
.app-output #formatOutput {
min-height: 1lh;
padding-top: 0.78rem;
padding-right: 3.2rem;
overflow: auto;
}
.app-status {
margin: 10px 0 0;
font-size: 0.82rem;
color: var(--text-muted);
}
#formatMessage {
margin-top: 8px;
}
.app-divider {
margin: 24px 0 14px;
border: 0;
border-top: 1px solid #ddd7e8;
}
.app-footer {
display: flex;
flex-wrap: wrap;
gap: 10px 18px;
font-size: 0.86rem;
color: var(--text-muted);
}
.app-footer a {
display: inline-flex;
align-items: center;
gap: 0.45rem;
color: #3459c7;
text-underline-offset: 0.15em;
}
.app-footer svg {
width: 1rem;
height: 1rem;
flex: 0 0 auto;
}
@media (max-width: 720px) {
.app-shell {
padding-inline: 12px;
}
.app-card__header {
flex-direction: column;
}
.app-actions {
justify-content: flex-start;
}
}
</style>
</head>
<body class="md-page">
<main class="app-shell">
<lht-page-hero
title="SQL Formatter"
icon="S"
subtitle="SQL をその場で整形し、必要に応じて AST へ即切替できます。構文の確認、整形結果の比較、デバッグを 1 画面で素早く進められます。"
help-label="対象SQL"
help-wide
menu-home-href="./index.html"
menu-home-label="トップへ戻る">
<p>DML/DQL(SELECT, INSERT, UPDATE, DELETE)と DDL(CREATE TABLE, ALTER TABLE など)のフォーマットに対応しています。</p>
<p>左で SQL を入力し、右で AST またはフォーマット結果を確認します。Ctrl+Enter / Cmd+Enter で Parse を実行できます。</p>
</lht-page-hero>
<div class="app-grid">
<section class="app-card">
<div class="app-card__header">
<div>
<h2 class="app-card__title">SQL Input</h2>
</div>
<div class="app-actions">
<lht-switch-help
class="app-mode-switch"
switch-id="astModeSwitch"
label="AST"
help-label="出力モード"
help-wide>
<p>OFF のときは SQL Formatter の整形結果を表示します。</p>
<p>ON にすると AST を表示します。初期状態は Format です。</p>
</lht-switch-help>
</div>
</div>
<lht-text-field-help
class="app-field"
field-id="sqlInput"
label="SQL Input"
help-text="Apache Calcite ベースの DML/DQL と、ANSI SQL 風 DDL を主対象にしています。よくある方言は一部許容しますが、Oracle 専用構文を完全保証するものではありません。SQL を入力すると自動で再実行され、AST スイッチ切替時も自動更新されます。文法的に解釈できない場合や未対応構文が含まれる場合は、Formatted Output に元の SQL を表示し、下部に理由メッセージを出します。"
type="textarea"
placeholder="SQL を入力してください"></lht-text-field-help>
</section>
<section class="app-card">
<div class="app-card__header">
<div>
<h2 class="app-card__title">Formatted Output</h2>
</div>
</div>
<lht-preview-output
class="app-output"
preview-id="formatOutput"
copy-button-id="copyBtn"
copy-target-id="formatOutput"
preview-tag="pre"
placeholder="// formatted output will appear here"
copy-aria-label="Copy formatted output"></lht-preview-output>
<p id="status" class="app-status">idle</p>
<lht-error-alert id="formatMessage" variant="warning"></lht-error-alert>
</section>
</div>
<hr class="app-divider" />
<footer class="app-footer">
<a href="https://github.com/igapyon/sql-formatter" target="_blank" rel="noopener noreferrer">
<svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/>
</svg>
<span>GitHub</span>
</a>
<a href="./LICENSE" target="_blank" rel="noopener noreferrer">License</a>
<a href="https://igapyon.github.io/sql-formatter/" target="_blank" rel="noopener noreferrer">
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"/>
<path d="M3 12h18"/>
<path d="M12 3a14 14 0 0 1 0 18"/>
<path d="M12 3a14 14 0 0 0 0 18"/>
</svg>
<span>GitHub Pages</span>
</a>
</footer>
</main>
<lht-toast id="toast"></lht-toast>
{{MATERIAL_TEXT_FIELD_SCRIPT}}
{{LHT_COMPONENTS_SCRIPT}}
{{CALCITE_PARSER_SCRIPT}}
{{DDL_PARSER_SCRIPT}}
{{FORMATTER_SCRIPT}}
{{APP_SCRIPT}}
</body>
</html>