signalk-symbol-manager 0.5.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/LICENSE +201 -0
- package/README.md +304 -0
- package/docs/screenshots/1_symbol-manager.png +0 -0
- package/docs/screenshots/2_symbol-manager.png +0 -0
- package/docs/screenshots/3_symbol-manager.png +0 -0
- package/package.json +91 -0
- package/plugin/index.js +110 -0
- package/plugin/provider.js +35 -0
- package/plugin/routes.js +110 -0
- package/plugin/sanitize.js +212 -0
- package/plugin/service.js +256 -0
- package/plugin/store.js +214 -0
- package/plugin/symbolKey.js +78 -0
- package/plugin/templates.js +35 -0
- package/plugin/types.js +25 -0
- package/public/assets/index-BgjEY8_m.css +1 -0
- package/public/assets/index-D4uaQ2Hh.js +544 -0
- package/public/assets/preview-background-D-jM2AV2.png +0 -0
- package/public/assets/symbol-manager-icon-512x512.png +0 -0
- package/public/assets/symbol-manager.png +0 -0
- package/public/index.html +13 -0
- package/templates/svg/blank.svg +3 -0
- package/templates/svg/flag.svg +12 -0
- package/templates/svg/poi.svg +15 -0
- package/templates/svg/waypoint.svg +16 -0
- package/templates/templates.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Joel Kozikowski
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Signal K Symbol Manager
|
|
2
|
+
|
|
3
|
+
Create and manage a library of symbols for your charts. Waypoints, note markers, etc.
|
|
4
|
+
|
|
5
|
+
Symbol Manager is a plugin for your Signal K server that acts as both a "symbol resource provider" as well as a web app for building and managing a library of
|
|
6
|
+
custom SVG symbols — note markers, waypoints, map pins, flags, status icons —
|
|
7
|
+
that symbol-aware Signal K apps (like Freeboard-SK) can display on your charts
|
|
8
|
+
and dashboards.
|
|
9
|
+
|
|
10
|
+
You can:
|
|
11
|
+
|
|
12
|
+
- start from a built-in template (POI / Flag / Waypoint / Blank) or upload an
|
|
13
|
+
existing SVG file,
|
|
14
|
+
- edit the symbol in a lightweight visual editor — shapes, text, colors,
|
|
15
|
+
outlines, opacity, layering,
|
|
16
|
+
- set the anchor point and display scale that map apps use to place the
|
|
17
|
+
symbol on a chart,
|
|
18
|
+
- preview the symbol against a sample chart background at the size it will
|
|
19
|
+
actually appear,
|
|
20
|
+
- **replace** the built-in icons in consumer apps by giving your symbol the
|
|
21
|
+
same id as the one they ship with.
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Signal K Server 2.x with the resource provider API.
|
|
26
|
+
- Node.js 22.5 or newer (the plugin uses Node's built-in SQLite).
|
|
27
|
+
- A symbol-aware consumer app. **Freeboard-SK** is the reference consumer app.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Installing
|
|
31
|
+
|
|
32
|
+
Install through the Signal K Server **Appstore** (search for *Symbol
|
|
33
|
+
Manager*) and restart the server, then enable the plugin in the **Plugin
|
|
34
|
+
Config** screen. There is nothing to configure — the plugin is ready to use
|
|
35
|
+
as soon as it's enabled.
|
|
36
|
+
|
|
37
|
+
## Opening the Symbol Manager
|
|
38
|
+
|
|
39
|
+
After the plugin is enabled, open the Signal K admin UI and choose
|
|
40
|
+
**Webapps → Symbol Manager**. The library is empty the first time you open
|
|
41
|
+
it.
|
|
42
|
+
|
|
43
|
+
The library lives in your Signal K data directory and is *not* tracked by
|
|
44
|
+
git — your symbols are yours.
|
|
45
|
+
|
|
46
|
+
## The library list
|
|
47
|
+
|
|
48
|
+
The main screen lists every symbol in your library, with its thumbnail,
|
|
49
|
+
name, description, roles, tags, and per-row actions:
|
|
50
|
+
|
|
51
|
+
| Action | What it does |
|
|
52
|
+
|-------------|-----------------------------------------------------------------------------|
|
|
53
|
+
| **Edit** | Open the visual editor on this symbol. |
|
|
54
|
+
| **Duplicate** | Copy the symbol. A dialog asks for the new **id** and **namespace** — keep the id and change the namespace to make an alternate of the original under `namespace:id`. |
|
|
55
|
+
| **Delete** | Remove the symbol from the library (and its SVG file from disk). |
|
|
56
|
+
|
|
57
|
+
Across the top:
|
|
58
|
+
|
|
59
|
+
- **Refresh** — re-fetch the list from the server.
|
|
60
|
+
- **Upload SVG** — see *Direct upload* below.
|
|
61
|
+
- **New** — start a new symbol from a template.
|
|
62
|
+
|
|
63
|
+
## Creating a symbol from a template
|
|
64
|
+
|
|
65
|
+
**New** opens the template picker:
|
|
66
|
+
|
|
67
|
+
| Template | What it gives you |
|
|
68
|
+
|--------------|--------------------------------------------------------------------------|
|
|
69
|
+
| **POI** | A "Point of Interest" symbol. Apps like Freeboard-SK use this as the note-marker shape (the colored "tag" with a hole). The fill color of the body is editable. Has a defined "body area" — any shape you import drops into it automatically. |
|
|
70
|
+
| **Flag** | A flag-on-a-staff marker. The anchor sits at the base of the staff. |
|
|
71
|
+
| **Waypoint** | A classic map-pin teardrop with a center dot. |
|
|
72
|
+
| **Blank** | An empty 48×48 canvas — build a symbol from scratch. |
|
|
73
|
+
|
|
74
|
+
Pick one and the editor opens with the template's default shape, default
|
|
75
|
+
roles, and (for map-marker templates) a sensible default scale and anchor.
|
|
76
|
+
|
|
77
|
+
## The editor
|
|
78
|
+
|
|
79
|
+
The editor has three areas:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
┌──────────────────────────┬─────────────────────┐
|
|
83
|
+
│ toolbar │ Preview │
|
|
84
|
+
├──────────────────────────┤ (chart sample) │
|
|
85
|
+
│ │ │
|
|
86
|
+
│ canvas │ ─────────────── │
|
|
87
|
+
│ (drawing area, with │ Properties │
|
|
88
|
+
│ chequerboard back- │ (symbol-wide or │
|
|
89
|
+
│ ground showing the │ per-shape, de- │
|
|
90
|
+
│ SVG bounds) │ pending on what │
|
|
91
|
+
│ │ is selected) │
|
|
92
|
+
└──────────────────────────┴─────────────────────┘
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Toolbar
|
|
96
|
+
|
|
97
|
+
| Button | What it does |
|
|
98
|
+
|--------|--------------------------------------------------------------------|
|
|
99
|
+
| ▭ | Adds a rectangle |
|
|
100
|
+
| ◯ | Adds a circle |
|
|
101
|
+
| ╱ | Adds a line |
|
|
102
|
+
| → | Adds an arrow |
|
|
103
|
+
| T | Adds a text box |
|
|
104
|
+
| ⬠ | Polygon / polyline (see *Drawing polygons*). |
|
|
105
|
+
| Import | Add another SVG file as a shape inside the symbol. |
|
|
106
|
+
| ↶ Undo | Undo the last change (also Cmd/Ctrl-Z). |
|
|
107
|
+
| Zoom | Slider — zooms the editor view only (does not change the symbol). |
|
|
108
|
+
|
|
109
|
+
### Selecting and editing shapes
|
|
110
|
+
|
|
111
|
+
- **Click** a shape to select it. Its properties appear on the right.
|
|
112
|
+
- **Click again** in the same spot to cycle through shapes stacked on top of
|
|
113
|
+
each other — useful when one shape is hidden behind another.
|
|
114
|
+
- **Drag** a selected shape to move it; drag its handles to resize or
|
|
115
|
+
rotate.
|
|
116
|
+
- **Backspace** / **Delete** removes the selected shape.
|
|
117
|
+
- **Cmd/Ctrl-Z** undoes the last change.
|
|
118
|
+
|
|
119
|
+
### Drawing polygons
|
|
120
|
+
|
|
121
|
+
Click **⬠** button, then:
|
|
122
|
+
|
|
123
|
+
1. Click each vertex on the canvas. A dashed rubber-band line follows the
|
|
124
|
+
cursor.
|
|
125
|
+
2. **Double-click** to finish as an open polyline (good for tracks /
|
|
126
|
+
strokes).
|
|
127
|
+
3. Or **click the start point** (highlighted with a small circle) to close
|
|
128
|
+
the shape — a closed polygon takes a fill color.
|
|
129
|
+
4. **Esc** cancels the drawing.
|
|
130
|
+
|
|
131
|
+
### Setting the anchor
|
|
132
|
+
|
|
133
|
+
The blue ⊕ marker on the canvas is the **anchor point** — the pixel that
|
|
134
|
+
consumer apps will place at the actual chart location. Drag the marker to
|
|
135
|
+
move the anchor; the X/Y fields update as you drag. The marker is editor-only
|
|
136
|
+
and is not written into the saved SVG. Instead, it is saved to "Map-marker metadata"
|
|
137
|
+
property of the symbol.
|
|
138
|
+
|
|
139
|
+
### Importing another SVG into the symbol
|
|
140
|
+
|
|
141
|
+
**Import** prompts for an SVG file, sanitizes it, and drops it onto the
|
|
142
|
+
canvas as a new shape group. When you're working on a **POI** template, the
|
|
143
|
+
import is automatically scaled and centered into the POI's "body area".
|
|
144
|
+
For any other template, the import drops in at half size, centered. After import you can
|
|
145
|
+
move and scale it like any other shape, and a **Fit into POI body** button
|
|
146
|
+
in the right-hand panel re-runs the auto-fit any time.
|
|
147
|
+
|
|
148
|
+
### Zooming and panning
|
|
149
|
+
|
|
150
|
+
- The **Zoom** slider shows the view percentage. The minimum zoom is the
|
|
151
|
+
size at which the whole symbol fills the editor (typically a few hundred
|
|
152
|
+
percent); the maximum is 3000%.
|
|
153
|
+
- When zoomed in, scrollbars appear inside the canvas frame. Drag them to
|
|
154
|
+
pan.
|
|
155
|
+
- **Shift + click-drag** anywhere on the canvas pans the view.
|
|
156
|
+
- **Mouse wheel / two-finger trackpad scroll** also pans (vertical wheel by
|
|
157
|
+
default, **Shift + wheel** to pan horizontally).
|
|
158
|
+
- Zoom changes only how the editor *looks*. The saved symbol is unaffected.
|
|
159
|
+
|
|
160
|
+
### Shape properties
|
|
161
|
+
|
|
162
|
+
Selecting a shape shows controls for that shape:
|
|
163
|
+
|
|
164
|
+
- **Text** field and **Font** picker (for text shapes).
|
|
165
|
+
- **X / Y / W / H** in source pixels.
|
|
166
|
+
- **Fill** and **Outline** color pickers (with a *none* button for
|
|
167
|
+
transparent fill), and **Outline width**.
|
|
168
|
+
- **Opacity** slider, 0–100 %.
|
|
169
|
+
- **Bring forward** / **Send backward** for stacking order.
|
|
170
|
+
- **Fit into POI body** (only on the POI template).
|
|
171
|
+
- **Delete shape**.
|
|
172
|
+
|
|
173
|
+
### Symbol-wide properties
|
|
174
|
+
|
|
175
|
+
With nothing selected, the panel shows whole-symbol metadata. Click anywhere
|
|
176
|
+
in the editor that is outside of the symbol to show the symbol-wide properties:
|
|
177
|
+
|
|
178
|
+
- **Id** - The identifier used by the consumer app (e.g. Freeboard SK)
|
|
179
|
+
- **Namespace** - Used to distinguish symbols with the same **Id**
|
|
180
|
+
- **Name** - Human readable name
|
|
181
|
+
- **Description** - Human readable description
|
|
182
|
+
- **Roles** - checkboxes describing what the symbol is *for*. The ones
|
|
183
|
+
tagged with a **chart** badge (`note`, `waypoint`, `map-marker`) mean the
|
|
184
|
+
symbol will be placed on a chart, which makes **Scale** and **Anchor**
|
|
185
|
+
required.
|
|
186
|
+
- **Tags** - free-form keywords for search / filtering.
|
|
187
|
+
- **Map-marker metadata** - **Scale** and **Anchor (X, Y)**. The fieldset
|
|
188
|
+
turns amber and is labelled *required* when any chart-role checkbox is
|
|
189
|
+
ticked.
|
|
190
|
+
- **GPX mapping** - optional **GPX Type** and **GPX Sym** free-form text.
|
|
191
|
+
These record how the symbol maps to the `<type>` and `<sym>` fields of a
|
|
192
|
+
GPX waypoint, so a symbol-aware app can pick this symbol when importing a
|
|
193
|
+
GPX file (or write these values back when exporting). Leave them blank if
|
|
194
|
+
the symbol has no GPX equivalent.
|
|
195
|
+
|
|
196
|
+
### Preview
|
|
197
|
+
|
|
198
|
+
The preview pane shows the symbol against a sample nautical chart
|
|
199
|
+
background, at the displayed size a consumer app will use:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
displayed width = source SVG width × scale
|
|
203
|
+
displayed height = source SVG height × scale
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The **Scale** slider edits the symbol's scale metadata directly (it's not
|
|
207
|
+
just a preview zoom). The *reset* link puts it back to the default (0.65,
|
|
208
|
+
matching Freeboard's POI scale).
|
|
209
|
+
|
|
210
|
+
### View / edit SVG source
|
|
211
|
+
|
|
212
|
+
The **View / edit SVG source** link drops down a textarea with the raw SVG
|
|
213
|
+
for the current canvas. You can hand-edit and click **Sanitize & apply to
|
|
214
|
+
canvas** to push your edits back into the editor. The text is sanitized
|
|
215
|
+
first, so any script / external reference / disallowed element is stripped
|
|
216
|
+
before it lands on the canvas.
|
|
217
|
+
|
|
218
|
+
### Saving
|
|
219
|
+
|
|
220
|
+
**Save** sanitizes the SVG, validates that map-marker symbols have a scale
|
|
221
|
+
and anchor, and writes the symbol to the library.
|
|
222
|
+
|
|
223
|
+
## Direct upload (bypassing the editor)
|
|
224
|
+
|
|
225
|
+
The visual editor handles a focused set of SVG features. If you have a
|
|
226
|
+
complex SVG (gradients, filters, embedded fonts, intricate paths) that the
|
|
227
|
+
editor would normalize away, use **Upload SVG** from the library list to
|
|
228
|
+
add the file directly. You'll be asked to fill in the metadata (and, for
|
|
229
|
+
map-marker symbols, scale and anchor) in a small form. The file is sanitized
|
|
230
|
+
and stored as-is, with no editor round-trip.
|
|
231
|
+
|
|
232
|
+
## Symbol references and overriding default icons
|
|
233
|
+
|
|
234
|
+
This is how custom symbols **replace** the built-in icons in consumer apps.
|
|
235
|
+
|
|
236
|
+
Every symbol has a **namespace** and an **id**, saved internally as
|
|
237
|
+
`namespace:id` — for example `user:dive-site`. The Symbol Manager stores
|
|
238
|
+
all symbols under the namespace **`user`** by default.
|
|
239
|
+
|
|
240
|
+
Consumer apps that support symbol resources can ask the Signal K server
|
|
241
|
+
for a symbol either way:
|
|
242
|
+
|
|
243
|
+
| Lookup kind | Example | Returns |
|
|
244
|
+
|--------------|--------------------------------------------------------|--------------------------------------------------------|
|
|
245
|
+
| Qualified | `user:dive-site` | Always your `user:dive-site` symbol. |
|
|
246
|
+
| Unqualified | `dive-site` | The single symbol with that id, **regardless of namespace**. |
|
|
247
|
+
|
|
248
|
+
That second form is what makes overrides work. Consumer apps typically ship
|
|
249
|
+
default icons under their own namespace (e.g. Freeboard-SK ships
|
|
250
|
+
`dive-site`, `anchor`, `mooring`, etc.). When the app asks the Signal K
|
|
251
|
+
server for `dive-site` *without* a namespace and the Symbol Manager has
|
|
252
|
+
**exactly one** symbol with id `dive-site`, the server returns yours — so
|
|
253
|
+
your custom drawing appears on the chart in place of the app's built-in
|
|
254
|
+
one.
|
|
255
|
+
|
|
256
|
+
**To replace a built-in icon:**
|
|
257
|
+
|
|
258
|
+
1. Find the id the consumer app uses (Freeboard's POI types are documented
|
|
259
|
+
in its own docs — e.g. `dive-site`, `anchor`, `mooring`, `marina`,
|
|
260
|
+
`restaurant`, …).
|
|
261
|
+
2. In the Symbol Manager, create a new symbol with the **same id**.
|
|
262
|
+
Leave the namespace as `user` (default).
|
|
263
|
+
3. Save. The consumer app picks up your symbol the next time it asks for
|
|
264
|
+
that id.
|
|
265
|
+
|
|
266
|
+
A few notes:
|
|
267
|
+
|
|
268
|
+
- The override only works for **unqualified** lookups. If the consumer app
|
|
269
|
+
hard-codes the qualified `built-in:dive-site` form, your `user:dive-site`
|
|
270
|
+
symbol will not replace it. Most consumer apps that support overrides use
|
|
271
|
+
the unqualified form on purpose.
|
|
272
|
+
- If you create the *same* id under two different namespaces, the
|
|
273
|
+
unqualified lookup becomes ambiguous and the server returns an error
|
|
274
|
+
instead of guessing. Pick one namespace per id.
|
|
275
|
+
- The id must match `[A-Za-z0-9_-]+` — letters, digits, underscores, and
|
|
276
|
+
dashes only.
|
|
277
|
+
|
|
278
|
+
## Where things are stored
|
|
279
|
+
|
|
280
|
+
Symbols and the SQLite metadata index live under your Signal K plugin data
|
|
281
|
+
directory:
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
<signalk-data-dir>/plugin-config-data/signalk-symbol-manager/
|
|
285
|
+
symbols.sqlite # metadata index
|
|
286
|
+
assets/<namespace>/<id>.svg # the SVG files themselves
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
To back up your library, copy that directory. To start fresh, stop the
|
|
290
|
+
server, delete it, and restart.
|
|
291
|
+
|
|
292
|
+
## Limitations
|
|
293
|
+
|
|
294
|
+
- The visual editor is intentionally small and focused on map-marker
|
|
295
|
+
symbols. For anything that would tax it, use **Upload SVG**.
|
|
296
|
+
- Symbol creation, edits, and deletes go through the manager UI and require
|
|
297
|
+
Signal K **admin** access. Reading symbols is public if your server
|
|
298
|
+
allows read-only resource access.
|
|
299
|
+
- The plugin does not generate native S-57 / ENC chart-portrayal catalogs —
|
|
300
|
+
that's a future enhancement.
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
|
|
304
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "signalk-symbol-manager",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Create and manage chart symbols (icons for waypoints, notes, etc.)",
|
|
5
|
+
"main": "plugin/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build:server": "tsc -p tsconfig.json",
|
|
9
|
+
"build:web": "vite build",
|
|
10
|
+
"build": "npm run build:server && npm run build:web",
|
|
11
|
+
"watch:server": "tsc -p tsconfig.json -w",
|
|
12
|
+
"watch:web": "vite build --watch",
|
|
13
|
+
"clean": "rm -rf plugin public/index.html public/assets",
|
|
14
|
+
"test": "npm run build:server && node --test test/*.test.js",
|
|
15
|
+
"prepare": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"signalk-node-server-plugin",
|
|
19
|
+
"signalk-webapp",
|
|
20
|
+
"signalk-category-chart-plotters",
|
|
21
|
+
"signalk-category-chart-utility",
|
|
22
|
+
"signalk",
|
|
23
|
+
"symbols",
|
|
24
|
+
"icons",
|
|
25
|
+
"svg",
|
|
26
|
+
"resource-provider",
|
|
27
|
+
"freeboard"
|
|
28
|
+
],
|
|
29
|
+
"signalk": {
|
|
30
|
+
"appIcon": "assets/symbol-manager.png",
|
|
31
|
+
"displayName": "Chart Symbol Manager",
|
|
32
|
+
"screenshots": [
|
|
33
|
+
"./docs/screenshots/1_symbol-manager.png",
|
|
34
|
+
"./docs/screenshots/2_symbol-manager.png",
|
|
35
|
+
"./docs/screenshots/3_symbol-manager.png"
|
|
36
|
+
],
|
|
37
|
+
"appstore": {
|
|
38
|
+
"displayName": "Chart Symbol Manager",
|
|
39
|
+
"categories": [
|
|
40
|
+
"chart-plotters",
|
|
41
|
+
"utilities"
|
|
42
|
+
],
|
|
43
|
+
"author": "Joel Kozikowski",
|
|
44
|
+
"description": "Chart marker SVG editor with symbol provider"
|
|
45
|
+
},
|
|
46
|
+
"webapp": {
|
|
47
|
+
"name": "Chart Symbol Manager",
|
|
48
|
+
"description": "Chart marker SVG editor with symbol provider",
|
|
49
|
+
"location": "/signalk-symbol-manager/"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"plugin",
|
|
54
|
+
"public",
|
|
55
|
+
"templates",
|
|
56
|
+
"assets",
|
|
57
|
+
"docs/screenshots",
|
|
58
|
+
"README.md",
|
|
59
|
+
"LICENSE"
|
|
60
|
+
],
|
|
61
|
+
"author": "Joel Kozikowski",
|
|
62
|
+
"license": "Apache-2.0",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "git+https://github.com/joelkoz/signalk-symbol-manager.git"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/joelkoz/signalk-symbol-manager/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/joelkoz/signalk-symbol-manager#readme",
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=22.5.0"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@xmldom/xmldom": "^0.9.6"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@signalk/server-api": "^2.10.1",
|
|
79
|
+
"@types/express": "^4.17.21",
|
|
80
|
+
"@types/node": "^22.5.0",
|
|
81
|
+
"@types/react": "^18.3.3",
|
|
82
|
+
"@types/react-dom": "^18.3.0",
|
|
83
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
84
|
+
"fabric": "^6.0.2",
|
|
85
|
+
"react": "^18.3.1",
|
|
86
|
+
"react-dom": "^18.3.1",
|
|
87
|
+
"react-tag-input-component": "^2.0.2",
|
|
88
|
+
"typescript": "^5.5.4",
|
|
89
|
+
"vite": "^5.4.2"
|
|
90
|
+
}
|
|
91
|
+
}
|