@fieldia/map 0.0.0-stage → 0.14.1

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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -2
  3. package/package.json +37 -3
  4. package/src/index.d.mts +6 -0
  5. package/src/index.d.ts +6 -0
  6. package/src/index.js +22 -0
  7. package/src/index.js.map +1 -0
  8. package/src/index.mjs +6 -0
  9. package/src/index.mjs.map +1 -0
  10. package/src/lib/area.d.mts +3 -0
  11. package/src/lib/area.d.ts +3 -0
  12. package/src/lib/area.js +591 -0
  13. package/src/lib/area.js.map +1 -0
  14. package/src/lib/area.mjs +588 -0
  15. package/src/lib/area.mjs.map +1 -0
  16. package/src/lib/geo.d.mts +72 -0
  17. package/src/lib/geo.d.ts +72 -0
  18. package/src/lib/geo.js +149 -0
  19. package/src/lib/geo.js.map +1 -0
  20. package/src/lib/geo.mjs +134 -0
  21. package/src/lib/geo.mjs.map +1 -0
  22. package/src/lib/kinds.d.mts +35 -0
  23. package/src/lib/kinds.d.ts +35 -0
  24. package/src/lib/kinds.js +127 -0
  25. package/src/lib/kinds.js.map +1 -0
  26. package/src/lib/kinds.mjs +124 -0
  27. package/src/lib/kinds.mjs.map +1 -0
  28. package/src/lib/labels.d.mts +62 -0
  29. package/src/lib/labels.d.ts +62 -0
  30. package/src/lib/labels.js +226 -0
  31. package/src/lib/labels.js.map +1 -0
  32. package/src/lib/labels.mjs +221 -0
  33. package/src/lib/labels.mjs.map +1 -0
  34. package/src/lib/leaflet-css.d.mts +2 -0
  35. package/src/lib/leaflet-css.d.ts +2 -0
  36. package/src/lib/leaflet-css.js +34 -0
  37. package/src/lib/leaflet-css.js.map +1 -0
  38. package/src/lib/leaflet-css.mjs +31 -0
  39. package/src/lib/leaflet-css.mjs.map +1 -0
  40. package/src/lib/leaflet.d.mts +15 -0
  41. package/src/lib/leaflet.d.ts +15 -0
  42. package/src/lib/leaflet.js +76 -0
  43. package/src/lib/leaflet.js.map +1 -0
  44. package/src/lib/leaflet.mjs +72 -0
  45. package/src/lib/leaflet.mjs.map +1 -0
  46. package/src/lib/map-core.d.mts +49 -0
  47. package/src/lib/map-core.d.ts +49 -0
  48. package/src/lib/map-core.js +312 -0
  49. package/src/lib/map-core.js.map +1 -0
  50. package/src/lib/map-core.mjs +308 -0
  51. package/src/lib/map-core.mjs.map +1 -0
  52. package/src/lib/place.d.mts +3 -0
  53. package/src/lib/place.d.ts +3 -0
  54. package/src/lib/place.js +363 -0
  55. package/src/lib/place.js.map +1 -0
  56. package/src/lib/place.mjs +360 -0
  57. package/src/lib/place.mjs.map +1 -0
  58. package/src/lib/providers.d.mts +152 -0
  59. package/src/lib/providers.d.ts +152 -0
  60. package/src/lib/providers.js +408 -0
  61. package/src/lib/providers.js.map +1 -0
  62. package/src/lib/providers.mjs +401 -0
  63. package/src/lib/providers.mjs.map +1 -0
  64. package/src/lib/search-box.d.mts +30 -0
  65. package/src/lib/search-box.d.ts +30 -0
  66. package/src/lib/search-box.js +155 -0
  67. package/src/lib/search-box.js.map +1 -0
  68. package/src/lib/search-box.mjs +152 -0
  69. package/src/lib/search-box.mjs.map +1 -0
  70. package/src/lib/settings.d.mts +19 -0
  71. package/src/lib/settings.d.ts +19 -0
  72. package/src/lib/settings.js +3 -0
  73. package/src/lib/settings.js.map +1 -0
  74. package/src/lib/settings.mjs +2 -0
  75. package/src/lib/settings.mjs.map +1 -0
  76. package/src/lib/styles.d.mts +11 -0
  77. package/src/lib/styles.d.ts +11 -0
  78. package/src/lib/styles.js +130 -0
  79. package/src/lib/styles.js.map +1 -0
  80. package/src/lib/styles.mjs +125 -0
  81. package/src/lib/styles.mjs.map +1 -0
  82. package/src/lib/widgets.d.mts +14 -0
  83. package/src/lib/widgets.d.ts +14 -0
  84. package/src/lib/widgets.js +21 -0
  85. package/src/lib/widgets.js.map +1 -0
  86. package/src/lib/widgets.mjs +18 -0
  87. package/src/lib/widgets.mjs.map +1 -0
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchBox = searchBox;
4
+ const map_core_1 = require("./map-core");
5
+ function searchBox(options) {
6
+ const { document: doc, labels } = options;
7
+ const element = doc.createElement('div');
8
+ element.className = 'fd-map-search';
9
+ const input = doc.createElement('input');
10
+ input.className = 'fd-input';
11
+ input.id = options.id;
12
+ input.type = 'text';
13
+ input.placeholder = labels.search;
14
+ input.autocomplete = 'off';
15
+ input.spellcheck = false;
16
+ input.enterKeyHint = 'search';
17
+ const listId = `${options.id}-places`;
18
+ input.setAttribute('role', 'combobox');
19
+ input.setAttribute('aria-autocomplete', 'list');
20
+ input.setAttribute('aria-expanded', 'false');
21
+ input.setAttribute('aria-controls', listId);
22
+ const list = doc.createElement('ul');
23
+ list.className = 'fd-map-results';
24
+ list.id = listId;
25
+ list.setAttribute('role', 'listbox');
26
+ list.setAttribute('aria-label', labels.search);
27
+ list.hidden = true;
28
+ element.append(input, list);
29
+ let places = [];
30
+ let active = -1;
31
+ let asking = null;
32
+ let timer;
33
+ function close() {
34
+ list.hidden = true;
35
+ input.setAttribute('aria-expanded', 'false');
36
+ input.removeAttribute('aria-activedescendant');
37
+ active = -1;
38
+ }
39
+ function mark(index) {
40
+ active = index;
41
+ [...list.children].forEach((option, i) => option.setAttribute('aria-selected', String(i === index)));
42
+ const chosen = list.children[index];
43
+ if (chosen) {
44
+ input.setAttribute('aria-activedescendant', chosen.id);
45
+ chosen.scrollIntoView?.({ block: 'nearest' });
46
+ }
47
+ else
48
+ input.removeAttribute('aria-activedescendant');
49
+ }
50
+ function choose(place) {
51
+ input.value = place.label;
52
+ close();
53
+ options.say(null);
54
+ options.pick(place);
55
+ }
56
+ function show(found) {
57
+ places = found;
58
+ list.replaceChildren(...found.map((place, i) => {
59
+ const option = doc.createElement('li');
60
+ option.id = `${listId}-${i}`;
61
+ option.setAttribute('role', 'option');
62
+ option.setAttribute('aria-selected', 'false');
63
+ // The place on one line, where it is on the next, as a map's own search shows them.
64
+ const name = doc.createElement('span');
65
+ name.className = 'fd-map-result-name';
66
+ name.textContent = place.label;
67
+ option.append(name);
68
+ if (place.detail) {
69
+ const detail = doc.createElement('span');
70
+ detail.className = 'fd-map-result-detail';
71
+ detail.textContent = place.detail;
72
+ option.append(detail);
73
+ }
74
+ // Picked on the press, the box keeping its focus.
75
+ option.addEventListener('mousedown', (event) => event.preventDefault());
76
+ option.addEventListener('click', () => choose(place));
77
+ return option;
78
+ }));
79
+ const any = found.length > 0;
80
+ list.hidden = !any;
81
+ input.setAttribute('aria-expanded', String(any));
82
+ active = -1;
83
+ options.say(any ? null : labels.noResults);
84
+ }
85
+ function run() {
86
+ clearTimeout(timer);
87
+ const text = input.value.trim();
88
+ asking?.abort();
89
+ if (text.length < (options.asYouType ? 2 : 1)) {
90
+ close();
91
+ options.say(null);
92
+ return;
93
+ }
94
+ const mine = (asking = new AbortController());
95
+ options.say(labels.searching);
96
+ options
97
+ .search({ text, near: options.near(), zoom: options.zoom?.(), locale: options.locale, signal: mine.signal })
98
+ .then((found) => mine === asking && show(found))
99
+ .catch((error) => {
100
+ if (mine !== asking || error.name === 'AbortError')
101
+ return;
102
+ close();
103
+ options.say(labels.searchFailed, 'error');
104
+ // The reader is told to try again; the developer, why it failed.
105
+ (0, map_core_1.warnOnce)(`The address search failed: ${error.message}`);
106
+ });
107
+ }
108
+ input.addEventListener('input', () => {
109
+ if (!options.asYouType) {
110
+ close();
111
+ return;
112
+ }
113
+ clearTimeout(timer);
114
+ timer = setTimeout(run, 250);
115
+ });
116
+ input.addEventListener('keydown', (event) => {
117
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
118
+ if (list.hidden)
119
+ return;
120
+ event.preventDefault();
121
+ const step = event.key === 'ArrowDown' ? 1 : -1;
122
+ mark((active + step + places.length) % places.length);
123
+ }
124
+ else if (event.key === 'Enter') {
125
+ // Never the form's own Enter.
126
+ event.preventDefault();
127
+ // Enter takes the place chosen with the arrows, or the first: the one nearest and likeliest.
128
+ if (!list.hidden && places.length)
129
+ choose(places[Math.max(active, 0)]);
130
+ else
131
+ run();
132
+ }
133
+ else if (event.key === 'Escape') {
134
+ if (!list.hidden) {
135
+ event.preventDefault();
136
+ close();
137
+ }
138
+ else if (input.value) {
139
+ event.preventDefault();
140
+ input.value = '';
141
+ options.say(null);
142
+ }
143
+ }
144
+ });
145
+ input.addEventListener('blur', () => close());
146
+ return {
147
+ element,
148
+ input,
149
+ destroy() {
150
+ clearTimeout(timer);
151
+ asking?.abort();
152
+ },
153
+ };
154
+ }
155
+ //# sourceMappingURL=search-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-box.js","sourceRoot":"","sources":["../../../../../libs/map/src/lib/search-box.ts"],"names":[],"mappings":";;AA6BA,8BAsJC;AAhLD,yCAAsC;AA0BtC,SAAgB,SAAS,CAAC,OAAyB;IACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC;IAC7B,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACtB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;IAC3B,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;IACzB,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC9B,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,SAAS,CAAC;IACtC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU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,152 @@
1
+ import { warnOnce } from './map-core.mjs';
2
+ export function searchBox(options) {
3
+ const { document: doc, labels } = options;
4
+ const element = doc.createElement('div');
5
+ element.className = 'fd-map-search';
6
+ const input = doc.createElement('input');
7
+ input.className = 'fd-input';
8
+ input.id = options.id;
9
+ input.type = 'text';
10
+ input.placeholder = labels.search;
11
+ input.autocomplete = 'off';
12
+ input.spellcheck = false;
13
+ input.enterKeyHint = 'search';
14
+ const listId = `${options.id}-places`;
15
+ input.setAttribute('role', 'combobox');
16
+ input.setAttribute('aria-autocomplete', 'list');
17
+ input.setAttribute('aria-expanded', 'false');
18
+ input.setAttribute('aria-controls', listId);
19
+ const list = doc.createElement('ul');
20
+ list.className = 'fd-map-results';
21
+ list.id = listId;
22
+ list.setAttribute('role', 'listbox');
23
+ list.setAttribute('aria-label', labels.search);
24
+ list.hidden = true;
25
+ element.append(input, list);
26
+ let places = [];
27
+ let active = -1;
28
+ let asking = null;
29
+ let timer;
30
+ function close() {
31
+ list.hidden = true;
32
+ input.setAttribute('aria-expanded', 'false');
33
+ input.removeAttribute('aria-activedescendant');
34
+ active = -1;
35
+ }
36
+ function mark(index) {
37
+ active = index;
38
+ [...list.children].forEach((option, i) => option.setAttribute('aria-selected', String(i === index)));
39
+ const chosen = list.children[index];
40
+ if (chosen) {
41
+ input.setAttribute('aria-activedescendant', chosen.id);
42
+ chosen.scrollIntoView?.({ block: 'nearest' });
43
+ }
44
+ else
45
+ input.removeAttribute('aria-activedescendant');
46
+ }
47
+ function choose(place) {
48
+ input.value = place.label;
49
+ close();
50
+ options.say(null);
51
+ options.pick(place);
52
+ }
53
+ function show(found) {
54
+ places = found;
55
+ list.replaceChildren(...found.map((place, i) => {
56
+ const option = doc.createElement('li');
57
+ option.id = `${listId}-${i}`;
58
+ option.setAttribute('role', 'option');
59
+ option.setAttribute('aria-selected', 'false');
60
+ // The place on one line, where it is on the next, as a map's own search shows them.
61
+ const name = doc.createElement('span');
62
+ name.className = 'fd-map-result-name';
63
+ name.textContent = place.label;
64
+ option.append(name);
65
+ if (place.detail) {
66
+ const detail = doc.createElement('span');
67
+ detail.className = 'fd-map-result-detail';
68
+ detail.textContent = place.detail;
69
+ option.append(detail);
70
+ }
71
+ // Picked on the press, the box keeping its focus.
72
+ option.addEventListener('mousedown', (event) => event.preventDefault());
73
+ option.addEventListener('click', () => choose(place));
74
+ return option;
75
+ }));
76
+ const any = found.length > 0;
77
+ list.hidden = !any;
78
+ input.setAttribute('aria-expanded', String(any));
79
+ active = -1;
80
+ options.say(any ? null : labels.noResults);
81
+ }
82
+ function run() {
83
+ clearTimeout(timer);
84
+ const text = input.value.trim();
85
+ asking?.abort();
86
+ if (text.length < (options.asYouType ? 2 : 1)) {
87
+ close();
88
+ options.say(null);
89
+ return;
90
+ }
91
+ const mine = (asking = new AbortController());
92
+ options.say(labels.searching);
93
+ options
94
+ .search({ text, near: options.near(), zoom: options.zoom?.(), locale: options.locale, signal: mine.signal })
95
+ .then((found) => mine === asking && show(found))
96
+ .catch((error) => {
97
+ if (mine !== asking || error.name === 'AbortError')
98
+ return;
99
+ close();
100
+ options.say(labels.searchFailed, 'error');
101
+ // The reader is told to try again; the developer, why it failed.
102
+ warnOnce(`The address search failed: ${error.message}`);
103
+ });
104
+ }
105
+ input.addEventListener('input', () => {
106
+ if (!options.asYouType) {
107
+ close();
108
+ return;
109
+ }
110
+ clearTimeout(timer);
111
+ timer = setTimeout(run, 250);
112
+ });
113
+ input.addEventListener('keydown', (event) => {
114
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
115
+ if (list.hidden)
116
+ return;
117
+ event.preventDefault();
118
+ const step = event.key === 'ArrowDown' ? 1 : -1;
119
+ mark((active + step + places.length) % places.length);
120
+ }
121
+ else if (event.key === 'Enter') {
122
+ // Never the form's own Enter.
123
+ event.preventDefault();
124
+ // Enter takes the place chosen with the arrows, or the first: the one nearest and likeliest.
125
+ if (!list.hidden && places.length)
126
+ choose(places[Math.max(active, 0)]);
127
+ else
128
+ run();
129
+ }
130
+ else if (event.key === 'Escape') {
131
+ if (!list.hidden) {
132
+ event.preventDefault();
133
+ close();
134
+ }
135
+ else if (input.value) {
136
+ event.preventDefault();
137
+ input.value = '';
138
+ options.say(null);
139
+ }
140
+ }
141
+ });
142
+ input.addEventListener('blur', () => close());
143
+ return {
144
+ element,
145
+ input,
146
+ destroy() {
147
+ clearTimeout(timer);
148
+ asking?.abort();
149
+ },
150
+ };
151
+ }
152
+ //# sourceMappingURL=search-box.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-box.mjs","sourceRoot":"","sources":["../../../../../libs/map/src/lib/search-box.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA0BtC,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC;IAC7B,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACtB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;IAC3B,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;IACzB,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC9B,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,SAAS,CAAC;IACtC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvC,KAAK,CAAC,YAAY,CAAC,mBAAmB,EAAE,MA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{ MapLabels } from './labels.mjs';
4
+ import type { AddressSearch, MapProvider, ReverseSearch } from './providers.mjs';
5
+ /** What every map of an app shares: given once to `mapWidgets`. */
6
+ export interface MapSettings {
7
+ provider: MapProvider;
8
+ /** The app's own address search, instead of the provider's. */
9
+ search?: AddressSearch;
10
+ /** The app's own naming of a point, instead of the provider's. */
11
+ reverse?: ReverseSearch;
12
+ /** Whether the app's own search may run for each pause in typing (it may unless false). */
13
+ searchAsYouType?: boolean;
14
+ /** Where an empty map opens, and how close. */
15
+ center?: LatLng;
16
+ zoom?: number;
17
+ /** The app's own words over the maps', by language. */
18
+ labels?: Partial<Record<Locale, Partial<MapLabels>>>;
19
+ }
@@ -0,0 +1,19 @@
1
+ import type { Locale } from '@fieldia/core';
2
+ import type { LatLng } from './geo';
3
+ import type { MapLabels } from './labels';
4
+ import type { AddressSearch, MapProvider, ReverseSearch } from './providers';
5
+ /** What every map of an app shares: given once to `mapWidgets`. */
6
+ export interface MapSettings {
7
+ provider: MapProvider;
8
+ /** The app's own address search, instead of the provider's. */
9
+ search?: AddressSearch;
10
+ /** The app's own naming of a point, instead of the provider's. */
11
+ reverse?: ReverseSearch;
12
+ /** Whether the app's own search may run for each pause in typing (it may unless false). */
13
+ searchAsYouType?: boolean;
14
+ /** Where an empty map opens, and how close. */
15
+ center?: LatLng;
16
+ zoom?: number;
17
+ /** The app's own words over the maps', by language. */
18
+ labels?: Partial<Record<Locale, Partial<MapLabels>>>;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../libs/map/src/lib/settings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","sourceRoot":"","sources":["../../../../../libs/map/src/lib/settings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The maps in Fieldia's colours: every colour a token, so a theme, a host's
3
+ * tokens and the dark scheme reach the map's buttons, search, shapes and
4
+ * grips. Fixed on purpose: the veil over the map that asks for two fingers
5
+ * or Ctrl (white words on a dark veil, as an image's caption has them).
6
+ */
7
+ export declare const MAP_CSS = "\n.fd-map-field { display: grid; gap: 8px; min-width: 0; }\n.fd-map-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }\n.fd-map-tools .fd-button { min-height: 32px; padding-inline: 10px; }\n.fd-map-tools .fd-button[aria-pressed=\"true\"] { background: var(--fd-accent-soft); border-color: var(--fd-accent); color: var(--fd-accent); }\n.fd-map-tools .fd-button svg { width: 16px; height: 16px; flex: none; }\n.fd-map-search { position: relative; flex: 1 1 220px; min-width: 0; }\n.fd-map-results {\n position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 1100; margin: 0; padding: 4px; list-style: none;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); max-height: 240px; overflow: auto;\n}\n.fd-map-results [role=\"option\"] { padding: 6px 8px; border-radius: 4px; cursor: pointer; line-height: 1.35; display: grid; gap: 1px; }\n.fd-map-result-name { color: var(--fd-text); font-weight: 600; overflow-wrap: anywhere; }\n.fd-map-result-detail { color: var(--fd-muted); font-size: 12.5px; overflow-wrap: anywhere; }\n.fd-map-results [role=\"option\"][aria-selected=\"true\"], .fd-map-results [role=\"option\"]:hover { background: var(--fd-accent-soft); }\n.fd-map-results .fd-map-results-note { padding: 6px 8px; color: var(--fd-muted); cursor: default; }\n.fd-map-box {\n position: relative; height: var(--fd-map-height, 280px); min-height: 160px; overflow: hidden; isolation: isolate;\n border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-fill);\n}\n.fd-map-box.leaflet-container:focus { outline: none; }\n.fd-map-box.leaflet-container[data-keys]:focus { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-map-box.leaflet-container { font: inherit; background: var(--fd-fill); }\n.fd-map-zoom { position: absolute; top: 8px; z-index: 1000; display: grid; gap: 4px; }\n.fd-map-zoom[data-side=\"right\"] { right: 8px; }\n.fd-map-zoom[data-side=\"left\"] { left: 8px; }\n.fd-map-zoom button {\n width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer; font: 600 18px/1 system-ui, sans-serif;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n}\n.fd-map-zoom button:hover { color: var(--fd-accent); border-color: var(--fd-accent); }\n.fd-map-zoom button:focus-visible, .fd-map-hint button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-map-credits {\n position: absolute; right: 0; bottom: 0; z-index: 1000; max-width: 72%; padding: 1px 6px; font-size: 11px; line-height: 1.5;\n background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text); border-top-left-radius: 4px;\n}\n.fd-map-credits a { color: inherit; }\n.fd-map-logo { position: absolute; left: 6px; bottom: 4px; z-index: 1000; display: inline-flex; align-items: center; text-decoration: none; }\n.fd-map-logo img { height: 18px; width: auto; display: block; }\n.fd-map-logo span {\n font: 700 12px/1.4 system-ui, sans-serif; padding: 0 5px; border-radius: 3px;\n background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text);\n}\n.fd-map-veil {\n position: absolute; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 16px; text-align: center;\n background: rgba(0, 0, 0, 0.5); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s;\n}\n.fd-map-veil[data-show] { opacity: 1; }\n.fd-map-crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 900; pointer-events: none; display: none; }\n.fd-map-crosshair::before, .fd-map-crosshair::after { content: \"\"; position: absolute; background: var(--fd-accent); box-shadow: 0 0 0 1px var(--fd-surface); }\n.fd-map-crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; }\n.fd-map-crosshair::after { top: 10px; left: 0; height: 2px; width: 22px; }\n.fd-map-box[data-keys]:focus .fd-map-crosshair { display: block; }\n.fd-map-hint {\n position: absolute; top: 8px; left: 8px; right: 52px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;\n padding: 6px 10px; font-size: 13px; line-height: 1.4; background: var(--fd-surface); color: var(--fd-text);\n border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);\n}\n.fd-map-box[data-side=\"left\"] .fd-map-hint { left: 52px; right: 8px; }\n.fd-map-hint p { margin: 0; flex: 1 1 180px; min-width: 0; }\n.fd-map-hint .fd-button { min-height: 28px; padding: 2px 10px; }\n.fd-map-coords { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }\n.fd-map-coords label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fd-muted); }\n.fd-map-coords .fd-input { width: 12ch; font-variant-numeric: tabular-nums; }\n.fd-map-coords .fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-map-note { margin: 0; font-size: 12.5px; color: var(--fd-muted); }\n.fd-map-note[data-tone=\"error\"] { color: var(--fd-error); }\n.fd-map-pin { width: 28px; height: 40px; }\n.fd-map-pin svg { display: block; width: 28px; height: 40px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }\n.fd-map-pin .fd-map-pin-body { fill: var(--fd-accent); stroke: var(--fd-surface); stroke-width: 1.5; }\n.fd-map-pin .fd-map-pin-dot { fill: var(--fd-surface); }\n.fd-map-pin:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 4px; }\npath.fd-map-shape { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.16; }\npath.fd-map-shape.fd-map-movable { cursor: move; }\npath.fd-map-accuracy { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 1; fill-opacity: 0.08; stroke-dasharray: 4 4; pointer-events: none; }\npath.fd-map-trace { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.08; stroke-dasharray: 6 5; pointer-events: none; }\n.fd-map-grip { width: 24px; height: 24px; display: grid; place-items: center; cursor: grab; }\n.fd-map-grip::after {\n content: \"\"; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;\n background: var(--fd-surface); border: 2px solid var(--fd-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n}\n.fd-map-grip[data-closes]::after { width: 18px; height: 18px; background: var(--fd-accent); border-color: var(--fd-surface); }\n.fd-map-grip:focus-visible { outline: none; }\n.fd-map-grip:focus-visible::after { box-shadow: 0 0 0 3px var(--fd-focus); }\n.fd-map-field select.fd-input { width: auto; max-width: 100%; }\n/* One finger scrolls the page past a map, as on any page; two move it. While a shape is drawn, the map takes every touch. */\n.fd-map-box.leaflet-container, .fd-map-box.leaflet-touch-drag.leaflet-touch-zoom { touch-action: pan-x pan-y; }\n.fd-map-box.leaflet-container[data-drawing] { touch-action: none; }\n.fd-map-box .leaflet-marker-draggable { touch-action: none; }\n.fd-map-grip-add::after { width: 10px; height: 10px; opacity: 0.7; }\n/* Each image overlaps the next by a pixel (leaflet.ts): drawn plainly over it, not added to it as Leaflet's own seam fix adds light. */\n.fd-map-box.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }\n";
8
+ /** The maps' own stylesheet, once per document: the tools, the search and the box are drawn before Leaflet has loaded. */
9
+ export declare function installMapStyles(doc: Document): void;
10
+ /** Leaflet's stylesheet, once per document, before the maps' own (which add to it): it comes with Leaflet. */
11
+ export declare function installLeafletStyles(doc: Document, css: string): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The maps in Fieldia's colours: every colour a token, so a theme, a host's
3
+ * tokens and the dark scheme reach the map's buttons, search, shapes and
4
+ * grips. Fixed on purpose: the veil over the map that asks for two fingers
5
+ * or Ctrl (white words on a dark veil, as an image's caption has them).
6
+ */
7
+ export declare const MAP_CSS = "\n.fd-map-field { display: grid; gap: 8px; min-width: 0; }\n.fd-map-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }\n.fd-map-tools .fd-button { min-height: 32px; padding-inline: 10px; }\n.fd-map-tools .fd-button[aria-pressed=\"true\"] { background: var(--fd-accent-soft); border-color: var(--fd-accent); color: var(--fd-accent); }\n.fd-map-tools .fd-button svg { width: 16px; height: 16px; flex: none; }\n.fd-map-search { position: relative; flex: 1 1 220px; min-width: 0; }\n.fd-map-results {\n position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 1100; margin: 0; padding: 4px; list-style: none;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); max-height: 240px; overflow: auto;\n}\n.fd-map-results [role=\"option\"] { padding: 6px 8px; border-radius: 4px; cursor: pointer; line-height: 1.35; display: grid; gap: 1px; }\n.fd-map-result-name { color: var(--fd-text); font-weight: 600; overflow-wrap: anywhere; }\n.fd-map-result-detail { color: var(--fd-muted); font-size: 12.5px; overflow-wrap: anywhere; }\n.fd-map-results [role=\"option\"][aria-selected=\"true\"], .fd-map-results [role=\"option\"]:hover { background: var(--fd-accent-soft); }\n.fd-map-results .fd-map-results-note { padding: 6px 8px; color: var(--fd-muted); cursor: default; }\n.fd-map-box {\n position: relative; height: var(--fd-map-height, 280px); min-height: 160px; overflow: hidden; isolation: isolate;\n border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-fill);\n}\n.fd-map-box.leaflet-container:focus { outline: none; }\n.fd-map-box.leaflet-container[data-keys]:focus { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-map-box.leaflet-container { font: inherit; background: var(--fd-fill); }\n.fd-map-zoom { position: absolute; top: 8px; z-index: 1000; display: grid; gap: 4px; }\n.fd-map-zoom[data-side=\"right\"] { right: 8px; }\n.fd-map-zoom[data-side=\"left\"] { left: 8px; }\n.fd-map-zoom button {\n width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer; font: 600 18px/1 system-ui, sans-serif;\n background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n}\n.fd-map-zoom button:hover { color: var(--fd-accent); border-color: var(--fd-accent); }\n.fd-map-zoom button:focus-visible, .fd-map-hint button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-map-credits {\n position: absolute; right: 0; bottom: 0; z-index: 1000; max-width: 72%; padding: 1px 6px; font-size: 11px; line-height: 1.5;\n background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text); border-top-left-radius: 4px;\n}\n.fd-map-credits a { color: inherit; }\n.fd-map-logo { position: absolute; left: 6px; bottom: 4px; z-index: 1000; display: inline-flex; align-items: center; text-decoration: none; }\n.fd-map-logo img { height: 18px; width: auto; display: block; }\n.fd-map-logo span {\n font: 700 12px/1.4 system-ui, sans-serif; padding: 0 5px; border-radius: 3px;\n background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text);\n}\n.fd-map-veil {\n position: absolute; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 16px; text-align: center;\n background: rgba(0, 0, 0, 0.5); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s;\n}\n.fd-map-veil[data-show] { opacity: 1; }\n.fd-map-crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 900; pointer-events: none; display: none; }\n.fd-map-crosshair::before, .fd-map-crosshair::after { content: \"\"; position: absolute; background: var(--fd-accent); box-shadow: 0 0 0 1px var(--fd-surface); }\n.fd-map-crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; }\n.fd-map-crosshair::after { top: 10px; left: 0; height: 2px; width: 22px; }\n.fd-map-box[data-keys]:focus .fd-map-crosshair { display: block; }\n.fd-map-hint {\n position: absolute; top: 8px; left: 8px; right: 52px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;\n padding: 6px 10px; font-size: 13px; line-height: 1.4; background: var(--fd-surface); color: var(--fd-text);\n border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);\n}\n.fd-map-box[data-side=\"left\"] .fd-map-hint { left: 52px; right: 8px; }\n.fd-map-hint p { margin: 0; flex: 1 1 180px; min-width: 0; }\n.fd-map-hint .fd-button { min-height: 28px; padding: 2px 10px; }\n.fd-map-coords { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }\n.fd-map-coords label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fd-muted); }\n.fd-map-coords .fd-input { width: 12ch; font-variant-numeric: tabular-nums; }\n.fd-map-coords .fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-map-note { margin: 0; font-size: 12.5px; color: var(--fd-muted); }\n.fd-map-note[data-tone=\"error\"] { color: var(--fd-error); }\n.fd-map-pin { width: 28px; height: 40px; }\n.fd-map-pin svg { display: block; width: 28px; height: 40px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }\n.fd-map-pin .fd-map-pin-body { fill: var(--fd-accent); stroke: var(--fd-surface); stroke-width: 1.5; }\n.fd-map-pin .fd-map-pin-dot { fill: var(--fd-surface); }\n.fd-map-pin:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 4px; }\npath.fd-map-shape { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.16; }\npath.fd-map-shape.fd-map-movable { cursor: move; }\npath.fd-map-accuracy { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 1; fill-opacity: 0.08; stroke-dasharray: 4 4; pointer-events: none; }\npath.fd-map-trace { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.08; stroke-dasharray: 6 5; pointer-events: none; }\n.fd-map-grip { width: 24px; height: 24px; display: grid; place-items: center; cursor: grab; }\n.fd-map-grip::after {\n content: \"\"; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;\n background: var(--fd-surface); border: 2px solid var(--fd-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n}\n.fd-map-grip[data-closes]::after { width: 18px; height: 18px; background: var(--fd-accent); border-color: var(--fd-surface); }\n.fd-map-grip:focus-visible { outline: none; }\n.fd-map-grip:focus-visible::after { box-shadow: 0 0 0 3px var(--fd-focus); }\n.fd-map-field select.fd-input { width: auto; max-width: 100%; }\n/* One finger scrolls the page past a map, as on any page; two move it. While a shape is drawn, the map takes every touch. */\n.fd-map-box.leaflet-container, .fd-map-box.leaflet-touch-drag.leaflet-touch-zoom { touch-action: pan-x pan-y; }\n.fd-map-box.leaflet-container[data-drawing] { touch-action: none; }\n.fd-map-box .leaflet-marker-draggable { touch-action: none; }\n.fd-map-grip-add::after { width: 10px; height: 10px; opacity: 0.7; }\n/* Each image overlaps the next by a pixel (leaflet.ts): drawn plainly over it, not added to it as Leaflet's own seam fix adds light. */\n.fd-map-box.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }\n";
8
+ /** The maps' own stylesheet, once per document: the tools, the search and the box are drawn before Leaflet has loaded. */
9
+ export declare function installMapStyles(doc: Document): void;
10
+ /** Leaflet's stylesheet, once per document, before the maps' own (which add to it): it comes with Leaflet. */
11
+ export declare function installLeafletStyles(doc: Document, css: string): void;
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAP_CSS = void 0;
4
+ exports.installMapStyles = installMapStyles;
5
+ exports.installLeafletStyles = installLeafletStyles;
6
+ /**
7
+ * The maps in Fieldia's colours: every colour a token, so a theme, a host's
8
+ * tokens and the dark scheme reach the map's buttons, search, shapes and
9
+ * grips. Fixed on purpose: the veil over the map that asks for two fingers
10
+ * or Ctrl (white words on a dark veil, as an image's caption has them).
11
+ */
12
+ exports.MAP_CSS = `
13
+ .fd-map-field { display: grid; gap: 8px; min-width: 0; }
14
+ .fd-map-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
15
+ .fd-map-tools .fd-button { min-height: 32px; padding-inline: 10px; }
16
+ .fd-map-tools .fd-button[aria-pressed="true"] { background: var(--fd-accent-soft); border-color: var(--fd-accent); color: var(--fd-accent); }
17
+ .fd-map-tools .fd-button svg { width: 16px; height: 16px; flex: none; }
18
+ .fd-map-search { position: relative; flex: 1 1 220px; min-width: 0; }
19
+ .fd-map-results {
20
+ position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 1100; margin: 0; padding: 4px; list-style: none;
21
+ background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);
22
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); max-height: 240px; overflow: auto;
23
+ }
24
+ .fd-map-results [role="option"] { padding: 6px 8px; border-radius: 4px; cursor: pointer; line-height: 1.35; display: grid; gap: 1px; }
25
+ .fd-map-result-name { color: var(--fd-text); font-weight: 600; overflow-wrap: anywhere; }
26
+ .fd-map-result-detail { color: var(--fd-muted); font-size: 12.5px; overflow-wrap: anywhere; }
27
+ .fd-map-results [role="option"][aria-selected="true"], .fd-map-results [role="option"]:hover { background: var(--fd-accent-soft); }
28
+ .fd-map-results .fd-map-results-note { padding: 6px 8px; color: var(--fd-muted); cursor: default; }
29
+ .fd-map-box {
30
+ position: relative; height: var(--fd-map-height, 280px); min-height: 160px; overflow: hidden; isolation: isolate;
31
+ border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-fill);
32
+ }
33
+ .fd-map-box.leaflet-container:focus { outline: none; }
34
+ .fd-map-box.leaflet-container[data-keys]:focus { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
35
+ .fd-map-box.leaflet-container { font: inherit; background: var(--fd-fill); }
36
+ .fd-map-zoom { position: absolute; top: 8px; z-index: 1000; display: grid; gap: 4px; }
37
+ .fd-map-zoom[data-side="right"] { right: 8px; }
38
+ .fd-map-zoom[data-side="left"] { left: 8px; }
39
+ .fd-map-zoom button {
40
+ width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer; font: 600 18px/1 system-ui, sans-serif;
41
+ background: var(--fd-surface); color: var(--fd-text); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);
42
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
43
+ }
44
+ .fd-map-zoom button:hover { color: var(--fd-accent); border-color: var(--fd-accent); }
45
+ .fd-map-zoom button:focus-visible, .fd-map-hint button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
46
+ .fd-map-credits {
47
+ position: absolute; right: 0; bottom: 0; z-index: 1000; max-width: 72%; padding: 1px 6px; font-size: 11px; line-height: 1.5;
48
+ background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text); border-top-left-radius: 4px;
49
+ }
50
+ .fd-map-credits a { color: inherit; }
51
+ .fd-map-logo { position: absolute; left: 6px; bottom: 4px; z-index: 1000; display: inline-flex; align-items: center; text-decoration: none; }
52
+ .fd-map-logo img { height: 18px; width: auto; display: block; }
53
+ .fd-map-logo span {
54
+ font: 700 12px/1.4 system-ui, sans-serif; padding: 0 5px; border-radius: 3px;
55
+ background: color-mix(in srgb, var(--fd-surface) 88%, transparent); color: var(--fd-text);
56
+ }
57
+ .fd-map-veil {
58
+ position: absolute; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 16px; text-align: center;
59
+ background: rgba(0, 0, 0, 0.5); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s;
60
+ }
61
+ .fd-map-veil[data-show] { opacity: 1; }
62
+ .fd-map-crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 900; pointer-events: none; display: none; }
63
+ .fd-map-crosshair::before, .fd-map-crosshair::after { content: ""; position: absolute; background: var(--fd-accent); box-shadow: 0 0 0 1px var(--fd-surface); }
64
+ .fd-map-crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; }
65
+ .fd-map-crosshair::after { top: 10px; left: 0; height: 2px; width: 22px; }
66
+ .fd-map-box[data-keys]:focus .fd-map-crosshair { display: block; }
67
+ .fd-map-hint {
68
+ position: absolute; top: 8px; left: 8px; right: 52px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
69
+ padding: 6px 10px; font-size: 13px; line-height: 1.4; background: var(--fd-surface); color: var(--fd-text);
70
+ border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
71
+ }
72
+ .fd-map-box[data-side="left"] .fd-map-hint { left: 52px; right: 8px; }
73
+ .fd-map-hint p { margin: 0; flex: 1 1 180px; min-width: 0; }
74
+ .fd-map-hint .fd-button { min-height: 28px; padding: 2px 10px; }
75
+ .fd-map-coords { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
76
+ .fd-map-coords label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fd-muted); }
77
+ .fd-map-coords .fd-input { width: 12ch; font-variant-numeric: tabular-nums; }
78
+ .fd-map-coords .fd-input[aria-invalid="true"] { border-color: var(--fd-error); }
79
+ .fd-map-note { margin: 0; font-size: 12.5px; color: var(--fd-muted); }
80
+ .fd-map-note[data-tone="error"] { color: var(--fd-error); }
81
+ .fd-map-pin { width: 28px; height: 40px; }
82
+ .fd-map-pin svg { display: block; width: 28px; height: 40px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }
83
+ .fd-map-pin .fd-map-pin-body { fill: var(--fd-accent); stroke: var(--fd-surface); stroke-width: 1.5; }
84
+ .fd-map-pin .fd-map-pin-dot { fill: var(--fd-surface); }
85
+ .fd-map-pin:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 4px; }
86
+ path.fd-map-shape { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.16; }
87
+ path.fd-map-shape.fd-map-movable { cursor: move; }
88
+ path.fd-map-accuracy { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 1; fill-opacity: 0.08; stroke-dasharray: 4 4; pointer-events: none; }
89
+ path.fd-map-trace { stroke: var(--fd-accent); fill: var(--fd-accent); stroke-width: 2; fill-opacity: 0.08; stroke-dasharray: 6 5; pointer-events: none; }
90
+ .fd-map-grip { width: 24px; height: 24px; display: grid; place-items: center; cursor: grab; }
91
+ .fd-map-grip::after {
92
+ content: ""; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;
93
+ background: var(--fd-surface); border: 2px solid var(--fd-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
94
+ }
95
+ .fd-map-grip[data-closes]::after { width: 18px; height: 18px; background: var(--fd-accent); border-color: var(--fd-surface); }
96
+ .fd-map-grip:focus-visible { outline: none; }
97
+ .fd-map-grip:focus-visible::after { box-shadow: 0 0 0 3px var(--fd-focus); }
98
+ .fd-map-field select.fd-input { width: auto; max-width: 100%; }
99
+ /* One finger scrolls the page past a map, as on any page; two move it. While a shape is drawn, the map takes every touch. */
100
+ .fd-map-box.leaflet-container, .fd-map-box.leaflet-touch-drag.leaflet-touch-zoom { touch-action: pan-x pan-y; }
101
+ .fd-map-box.leaflet-container[data-drawing] { touch-action: none; }
102
+ .fd-map-box .leaflet-marker-draggable { touch-action: none; }
103
+ .fd-map-grip-add::after { width: 10px; height: 10px; opacity: 0.7; }
104
+ /* Each image overlaps the next by a pixel (leaflet.ts): drawn plainly over it, not added to it as Leaflet's own seam fix adds light. */
105
+ .fd-map-box.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
106
+ `;
107
+ /** The maps' own stylesheet, once per document: the tools, the search and the box are drawn before Leaflet has loaded. */
108
+ function installMapStyles(doc) {
109
+ if (doc.getElementById('fieldia-map-styles'))
110
+ return;
111
+ const own = doc.createElement('style');
112
+ own.id = 'fieldia-map-styles';
113
+ own.textContent = exports.MAP_CSS;
114
+ // Before the page's own styles, so an app's rule for a map wins over these.
115
+ doc.head.prepend(own);
116
+ }
117
+ /** Leaflet's stylesheet, once per document, before the maps' own (which add to it): it comes with Leaflet. */
118
+ function installLeafletStyles(doc, css) {
119
+ if (doc.getElementById('fieldia-leaflet-styles'))
120
+ return;
121
+ const leaflet = doc.createElement('style');
122
+ leaflet.id = 'fieldia-leaflet-styles';
123
+ leaflet.textContent = css;
124
+ const own = doc.getElementById('fieldia-map-styles');
125
+ if (own)
126
+ own.before(leaflet);
127
+ else
128
+ doc.head.prepend(leaflet);
129
+ }
130
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../libs/map/src/lib/styles.ts"],"names":[],"mappings":";;;AAuGA,4CAOC;AAGD,oDAQC;AAzHD;;;;;GAKG;AACU,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FtB,CAAC;AAEF,0HAA0H;AAC1H,SAAgB,gBAAgB,CAAC,GAAa;IAC5C,IAAI,GAAG,CAAC,cAAc,CAAC,oBAAoB,CAAC;QAAE,OAAO;IACrD,MAAM,GAAG,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACvC,GAAG,CAAC,EAAE,GAAG,oBAAoB,CAAC;IAC9B,GAAG,CAAC,WAAW,GAAG,eAAO,CAAC;IAC1B,4EAA4E;IAC5E,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,8GAA8G;AAC9G,SAAgB,oBAAoB,CAAC,GAAa,EAAE,GAAW;IAC7D,IAAI,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC;QAAE,OAAO;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,GAAG,wBAAwB,CAAC;IACtC,OAAO,CAAC,WAAW,GAAG,GAAG,CAAC;IAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,GAAG;QAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;;QACxB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}