signalk-automation-plugin 0.0.1 → 0.0.2

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/public/index.html CHANGED
@@ -4,36 +4,63 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Signal K Automations</title>
7
- <link rel="stylesheet" href="style.css" />
7
+ <link rel="icon" href="icon.png" />
8
+ <link rel="stylesheet" href="style.css?v=20260915log" />
8
9
  </head>
9
10
  <body>
10
11
  <header>
11
- <h1>Automations</h1>
12
- <p class="meta" id="shaLine">Loading…</p>
12
+ <div class="header-main">
13
+ <h1>Automations</h1>
14
+ <p class="meta" id="shaLine">Loading…</p>
15
+ </div>
16
+ <div class="header-actions">
17
+ <button type="button" id="reloadAutos">Reload automations</button>
18
+ <form id="loginForm" class="login-form">
19
+ <input id="loginUser" name="username" autocomplete="username" placeholder="user" />
20
+ <input id="loginPass" name="password" type="password" autocomplete="current-password" placeholder="password" />
21
+ <button type="submit">Log in</button>
22
+ <span id="loginErr" class="error"></span>
23
+ </form>
24
+ <p id="loginWho" class="muted" hidden></p>
25
+ </div>
13
26
  </header>
14
- <main>
15
- <section>
27
+ <main class="split">
28
+ <aside>
16
29
  <h2>Automations</h2>
17
30
  <div id="autos"></div>
18
- </section>
19
- <section>
20
31
  <h2>Helpers</h2>
21
32
  <div id="helpers"></div>
22
- </section>
23
- <section>
24
- <h2>Live YAML</h2>
25
- <pre id="yaml" class="yaml"></pre>
26
- </section>
27
- <section>
28
- <h2>Git commits</h2>
29
- <p class="hint">Activate a commit to copy that tree into plugin data and reload. Invalid YAML is rejected; the previous live snapshot stays.</p>
30
- <div id="commits"></div>
31
- </section>
32
- <section id="detail" hidden>
33
- <h2 id="detailTitle">Runs</h2>
34
- <div id="traces"></div>
33
+ <h2>Zones</h2>
34
+ <div id="zones"></div>
35
+ <h2>Switches</h2>
36
+ <div id="switches"></div>
37
+ </aside>
38
+ <section class="pane">
39
+ <div id="yamlPane">
40
+ <div class="yaml-head">
41
+ <h2 id="yamlTitle">YAML</h2>
42
+ <button type="button" id="runAuto" hidden>Run</button>
43
+ <div class="git-bar" id="gitBar" hidden>
44
+ <label class="git-label">
45
+ Git
46
+ <select id="commitSelect"></select>
47
+ </label>
48
+ </div>
49
+ </div>
50
+ <pre id="yaml" class="yaml"></pre>
51
+ <div id="runLog" class="run-log" hidden>
52
+ <h2 id="runLogTitle">Run</h2>
53
+ <div id="runLogBody"></div>
54
+ </div>
55
+ </div>
56
+ <div id="gitDiff" class="git-diff" hidden>
57
+ <h2>Diff vs live</h2>
58
+ <pre id="diffView" class="diff"></pre>
59
+ <p class="hint" id="diffHint"></p>
60
+ <button class="primary" id="resetGit" type="button">Reset automation git to this version</button>
61
+ </div>
35
62
  </section>
36
63
  </main>
37
- <script src="app.js"></script>
64
+ <script src="app.js?v=20260915log"></script>
38
65
  </body>
39
66
  </html>
package/public/style.css CHANGED
@@ -9,32 +9,171 @@
9
9
  --fail: #e15b5b;
10
10
  --skip: #c9a227;
11
11
  --accent: #4d8fd6;
12
+ --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
12
13
  }
13
14
  * { box-sizing: border-box; }
15
+ html, body { height: 100%; }
14
16
  body {
15
17
  margin: 0;
18
+ display: flex;
19
+ flex-direction: column;
16
20
  font-family: ui-sans-serif, system-ui, sans-serif;
17
21
  background: var(--bg);
18
22
  color: var(--text);
19
23
  }
20
- header, main { max-width: 960px; margin: 0 auto; padding: 1rem 1.2rem; }
21
- h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
22
- h2 { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; }
23
- .meta, .hint, .muted { color: var(--muted); font-size: 0.9rem; }
24
- .card {
24
+ header {
25
+ display: flex;
26
+ gap: 1rem;
27
+ align-items: flex-end;
28
+ justify-content: flex-start;
29
+ flex-wrap: wrap;
30
+ padding: 0.85rem 1.1rem 0.7rem;
31
+ border-bottom: 1px solid var(--border);
32
+ }
33
+ .header-main { min-width: 12rem; }
34
+ h1 { margin: 0 0 0.2rem; font-size: 1.25rem; }
35
+ h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0.9rem 0 0.45rem; }
36
+ .yaml-head {
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: flex-start;
40
+ gap: 0.75rem;
41
+ flex-wrap: wrap;
42
+ margin: 0.9rem 0 0.45rem;
43
+ }
44
+ .yaml-head h2 { margin: 0; }
45
+ .meta, .hint, .muted { color: var(--muted); font-size: 0.85rem; }
46
+ .header-actions { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
47
+ .git-bar { display: flex; align-items: center; gap: 0.5rem; }
48
+ #reloadAutos { align-self: center; }
49
+ .login-form {
50
+ display: flex;
51
+ align-items: center;
52
+ gap: 0.4rem;
53
+ flex-wrap: wrap;
54
+ }
55
+ .login-form input {
56
+ font: inherit;
57
+ background: var(--card);
58
+ color: var(--text);
59
+ border: 1px solid var(--border);
60
+ border-radius: 6px;
61
+ padding: 0.3rem 0.5rem;
62
+ width: 8.5rem;
63
+ }
64
+ .git-label {
65
+ display: flex;
66
+ flex-direction: row;
67
+ align-items: center;
68
+ gap: 0.45rem;
69
+ font-size: 0.75rem;
70
+ text-transform: uppercase;
71
+ letter-spacing: 0.05em;
72
+ color: var(--muted);
73
+ }
74
+ select {
75
+ font: inherit;
76
+ text-transform: none;
77
+ letter-spacing: 0;
78
+ min-width: 16rem;
79
+ max-width: min(40rem, 90vw);
80
+ background: var(--card);
81
+ color: var(--text);
82
+ border: 1px solid var(--border);
83
+ border-radius: 6px;
84
+ padding: 0.35rem 0.5rem;
85
+ }
86
+ .split {
87
+ flex: 1;
88
+ min-height: 0;
89
+ display: grid;
90
+ grid-template-columns: minmax(16rem, 22rem) 1fr;
91
+ }
92
+ aside {
93
+ overflow: auto;
94
+ padding: 0.9rem 0.85rem 1.2rem;
95
+ border-right: 1px solid var(--border);
96
+ }
97
+ .pane {
98
+ overflow: auto;
99
+ padding: 0.9rem 1rem 1.4rem;
100
+ min-width: 0;
101
+ }
102
+ .card, .item {
25
103
  background: var(--card);
26
104
  border: 1px solid var(--border);
27
105
  border-radius: 8px;
28
- padding: 0.75rem 0.9rem;
29
- margin-bottom: 0.5rem;
106
+ padding: 0.65rem 0.75rem;
107
+ margin-bottom: 0.45rem;
30
108
  }
31
- .row { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
109
+ .item { cursor: pointer; width: 100%; text-align: left; color: inherit; font: inherit; display: block; }
110
+ .item:hover { border-color: #445468; }
111
+ .auto-switches {
112
+ display: flex;
113
+ align-items: center;
114
+ gap: 0.55rem;
115
+ flex-wrap: wrap;
116
+ }
117
+ .pwr {
118
+ display: inline-flex;
119
+ align-items: center;
120
+ gap: 0.35rem;
121
+ cursor: pointer;
122
+ user-select: none;
123
+ color: var(--muted);
124
+ font-size: 0.78rem;
125
+ font-weight: 600;
126
+ }
127
+ .pwr input { position: absolute; opacity: 0; width: 0; height: 0; }
128
+ .pwr-ui {
129
+ width: 2.1rem;
130
+ height: 1.15rem;
131
+ border-radius: 999px;
132
+ background: #2a3340;
133
+ border: 1px solid var(--border);
134
+ position: relative;
135
+ flex-shrink: 0;
136
+ }
137
+ .pwr-ui::after {
138
+ content: "";
139
+ position: absolute;
140
+ top: 1px;
141
+ left: 1px;
142
+ width: 0.95rem;
143
+ height: 0.95rem;
144
+ border-radius: 50%;
145
+ background: #c5d0db;
146
+ transition: transform 0.15s ease, background 0.15s ease;
147
+ }
148
+ .pwr.is-on { color: var(--ok); }
149
+ .pwr.is-on .pwr-ui { background: #1d3b2c; border-color: var(--ok); }
150
+ .pwr.is-on .pwr-ui::after { transform: translateX(0.9rem); background: var(--ok); }
151
+ .pwr-verbose.is-on { color: var(--skip); }
152
+ .pwr-verbose.is-on .pwr-ui { background: #3b341d; border-color: var(--skip); }
153
+ .pwr-verbose.is-on .pwr-ui::after { background: var(--skip); }
154
+ .run-path {
155
+ font-family: var(--mono);
156
+ font-size: 0.82rem;
157
+ line-height: 1.45;
158
+ background: #0c1015;
159
+ border: 1px solid var(--border);
160
+ border-radius: 8px;
161
+ padding: 0.7rem 0.85rem;
162
+ margin: 0.45rem 0 0;
163
+ white-space: pre-wrap;
164
+ word-break: break-word;
165
+ }
166
+ .clause { font-family: var(--mono); font-size: 0.82rem; margin-top: 0.15rem; }
167
+ .clause.pass { color: var(--ok); }
168
+ .clause.fail { color: var(--fail); }
169
+ .run-card { margin-top: 0.55rem; }
170
+ .row { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
32
171
  .name { font-weight: 600; }
33
172
  .badge {
34
- font-size: 0.75rem;
173
+ font-size: 0.72rem;
35
174
  text-transform: uppercase;
36
175
  letter-spacing: 0.04em;
37
- padding: 0.15rem 0.45rem;
176
+ padding: 0.12rem 0.4rem;
38
177
  border-radius: 4px;
39
178
  background: #2a3340;
40
179
  }
@@ -50,21 +189,57 @@ button, .toggle {
50
189
  cursor: pointer;
51
190
  }
52
191
  button.primary { background: var(--accent); border-color: var(--accent); color: #071018; }
53
- .yaml {
192
+ button.primary:disabled { opacity: 0.45; cursor: default; }
193
+ .yaml, .diff, .trace {
194
+ font-family: var(--mono);
195
+ font-size: 0.82rem;
196
+ line-height: 1.45;
54
197
  background: #0c1015;
55
198
  border: 1px solid var(--border);
56
199
  border-radius: 8px;
57
- padding: 0.8rem;
200
+ padding: 0.85rem 0.95rem;
58
201
  overflow: auto;
59
- max-height: 28rem;
60
- font-size: 0.8rem;
61
- white-space: pre-wrap;
202
+ white-space: pre;
203
+ tab-size: 2;
204
+ margin: 0;
62
205
  }
63
- .trace {
64
- font-family: ui-monospace, monospace;
65
- font-size: 0.8rem;
206
+ .yaml { min-height: 14rem; }
207
+ .run-log { margin-top: 0.9rem; }
208
+ .run-log h2 { margin-top: 0; }
209
+ .run-actions {
210
+ font-family: var(--mono);
211
+ font-size: 0.82rem;
212
+ line-height: 1.4;
213
+ background: #0c1015;
214
+ border: 1px solid var(--border);
215
+ border-radius: 8px;
216
+ padding: 0.7rem 0.85rem;
217
+ margin: 0.45rem 0 0;
66
218
  white-space: pre-wrap;
67
- margin: 0.4rem 0 0;
68
- color: #c5d0db;
219
+ word-break: break-word;
69
220
  }
221
+ .git-diff { margin-top: 1.1rem; }
222
+ .git-diff .primary { margin-top: 0.7rem; }
223
+ .trace { margin: 0.4rem 0 0; color: #c5d0db; white-space: pre-wrap; }
224
+ .switch-line {
225
+ font-family: var(--mono);
226
+ font-size: 0.78rem;
227
+ line-height: 1.35;
228
+ margin-bottom: 0.55rem;
229
+ word-break: break-word;
230
+ }
231
+ .tok-cmt { color: #6e7c8a; font-style: italic; }
232
+ .tok-key { color: #7eb8ff; }
233
+ .tok-str { color: #9ed89a; }
234
+ .tok-num { color: #e2c27a; }
235
+ .tok-bool { color: #d39be8; }
236
+ .diff-meta { color: #93a1b0; }
237
+ .diff-hunk { color: #7eb8ff; }
238
+ .diff-add { color: #3dba7a; }
239
+ .diff-del { color: #e15b5b; }
70
240
  .error { color: var(--fail); }
241
+ @media (max-width: 800px) {
242
+ .split { grid-template-columns: 1fr; }
243
+ aside { border-right: 0; border-bottom: 1px solid var(--border); max-height: 40vh; }
244
+ select { min-width: 0; width: 100%; }
245
+ }