@premiate/strapi-plugin-maplibre-field 1.0.6

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.

Potentially problematic release.


This version of @premiate/strapi-plugin-maplibre-field might be problematic. Click here for more details.

Files changed (47) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/LICENSE +23 -0
  3. package/README.md +781 -0
  4. package/dist/_chunks/de-CGU2cyif.mjs +16 -0
  5. package/dist/_chunks/de-Dq_t3Z6M.js +16 -0
  6. package/dist/_chunks/en-BxxNWf9i.mjs +16 -0
  7. package/dist/_chunks/en-CgSPA-1L.js +16 -0
  8. package/dist/_chunks/es-B_cPv3G5.mjs +16 -0
  9. package/dist/_chunks/es-Sgja1XAa.js +16 -0
  10. package/dist/_chunks/fr-B3JIzyzo.js +16 -0
  11. package/dist/_chunks/fr-Dw5wEoDC.mjs +16 -0
  12. package/dist/_chunks/index-BF5T-kqa.mjs +171 -0
  13. package/dist/_chunks/index-BNnkn7JG.mjs +1778 -0
  14. package/dist/_chunks/index-CGJogtZr.js +1799 -0
  15. package/dist/_chunks/index-nbk0hg-O.js +170 -0
  16. package/dist/_chunks/it-BgWDIXzn.js +16 -0
  17. package/dist/_chunks/it-CoUEVPt6.mjs +16 -0
  18. package/dist/admin/index.js +3 -0
  19. package/dist/admin/index.mjs +4 -0
  20. package/dist/admin/src/components/Initializer.d.ts +6 -0
  21. package/dist/admin/src/components/MapInput/basemap-control.d.ts +8 -0
  22. package/dist/admin/src/components/MapInput/credits-control.d.ts +10 -0
  23. package/dist/admin/src/components/MapInput/geocoder-control.d.ts +20 -0
  24. package/dist/admin/src/components/MapInput/index.d.ts +19 -0
  25. package/dist/admin/src/components/MapInput/layer-control.d.ts +18 -0
  26. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  27. package/dist/admin/src/hooks/usePluginConfig.d.ts +2 -0
  28. package/dist/admin/src/index.d.ts +16 -0
  29. package/dist/admin/src/mutations/mutateEditViewHook.d.ts +30 -0
  30. package/dist/admin/src/services/poi-service.d.ts +160 -0
  31. package/dist/admin/src/utils/getTrad.d.ts +2 -0
  32. package/dist/admin/src/utils/pluginId.d.ts +2 -0
  33. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  34. package/dist/server/index.js +107 -0
  35. package/dist/server/index.mjs +108 -0
  36. package/dist/server/src/bootstrap.d.ts +2 -0
  37. package/dist/server/src/config/index.d.ts +61 -0
  38. package/dist/server/src/config/schema.d.ts +58 -0
  39. package/dist/server/src/controllers/config.d.ts +7 -0
  40. package/dist/server/src/controllers/index.d.ts +8 -0
  41. package/dist/server/src/destroy.d.ts +5 -0
  42. package/dist/server/src/index.d.ts +85 -0
  43. package/dist/server/src/register.d.ts +5 -0
  44. package/dist/server/src/routes/index.d.ts +9 -0
  45. package/dist/server/src/types/config.d.ts +26 -0
  46. package/logo.png +0 -0
  47. package/package.json +99 -0
@@ -0,0 +1,16 @@
1
+ const de = {
2
+ "maplibre-field.label": "Karte",
3
+ "maplibre-field.search": "Suchen Sie nach einem Ort oder einer Adresse",
4
+ "maplibre-field.description": "Eine Kartenkomponente, basierend auf MapLibre",
5
+ "maplibre-field.fields.address": "Adresse",
6
+ "maplibre-field.fields.longitude": "Längengrad",
7
+ "maplibre-field.fields.latitude": "Breitengrad",
8
+ "maplibre-field.geocoding.success": "Adresse erfolgreich aktualisiert",
9
+ "maplibre-field.geocoding.error": "Fehler beim Abrufen der Adresse. Bitte versuchen Sie es erneut.",
10
+ "maplibre-field.geocoding.no-results": "Keine Adresse für diesen Standort gefunden",
11
+ "maplibre-field.i18n.localized.label": "Lokalisierung für dieses Feld aktivieren",
12
+ "maplibre-field.i18n.localized.description": "Das Feld kann in jeder Sprache unterschiedliche Werte haben"
13
+ };
14
+ export {
15
+ de as default
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const de = {
4
+ "maplibre-field.label": "Karte",
5
+ "maplibre-field.search": "Suchen Sie nach einem Ort oder einer Adresse",
6
+ "maplibre-field.description": "Eine Kartenkomponente, basierend auf MapLibre",
7
+ "maplibre-field.fields.address": "Adresse",
8
+ "maplibre-field.fields.longitude": "Längengrad",
9
+ "maplibre-field.fields.latitude": "Breitengrad",
10
+ "maplibre-field.geocoding.success": "Adresse erfolgreich aktualisiert",
11
+ "maplibre-field.geocoding.error": "Fehler beim Abrufen der Adresse. Bitte versuchen Sie es erneut.",
12
+ "maplibre-field.geocoding.no-results": "Keine Adresse für diesen Standort gefunden",
13
+ "maplibre-field.i18n.localized.label": "Lokalisierung für dieses Feld aktivieren",
14
+ "maplibre-field.i18n.localized.description": "Das Feld kann in jeder Sprache unterschiedliche Werte haben"
15
+ };
16
+ exports.default = de;
@@ -0,0 +1,16 @@
1
+ const en = {
2
+ "maplibre-field.label": "Map",
3
+ "maplibre-field.search": "Search for a place or address on OpenStreetMap",
4
+ "maplibre-field.description": "A map custom field using MapLibre",
5
+ "maplibre-field.fields.address": "address",
6
+ "maplibre-field.fields.longitude": "longitude",
7
+ "maplibre-field.fields.latitude": "latitude",
8
+ "maplibre-field.geocoding.success": "Address updated successfully",
9
+ "maplibre-field.geocoding.error": "Failed to fetch address. Please try again.",
10
+ "maplibre-field.geocoding.no-results": "No address found for this location",
11
+ "maplibre-field.i18n.localized.label": "Enable localization for this field",
12
+ "maplibre-field.i18n.localized.description": "The field can have different values in each language"
13
+ };
14
+ export {
15
+ en as default
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const en = {
4
+ "maplibre-field.label": "Map",
5
+ "maplibre-field.search": "Search for a place or address on OpenStreetMap",
6
+ "maplibre-field.description": "A map custom field using MapLibre",
7
+ "maplibre-field.fields.address": "address",
8
+ "maplibre-field.fields.longitude": "longitude",
9
+ "maplibre-field.fields.latitude": "latitude",
10
+ "maplibre-field.geocoding.success": "Address updated successfully",
11
+ "maplibre-field.geocoding.error": "Failed to fetch address. Please try again.",
12
+ "maplibre-field.geocoding.no-results": "No address found for this location",
13
+ "maplibre-field.i18n.localized.label": "Enable localization for this field",
14
+ "maplibre-field.i18n.localized.description": "The field can have different values in each language"
15
+ };
16
+ exports.default = en;
@@ -0,0 +1,16 @@
1
+ const es = {
2
+ "maplibre-field.label": "Mapa",
3
+ "maplibre-field.search": "Buscar un lugar o dirección en OpenStreetMap",
4
+ "maplibre-field.description": "Un campo personalizado de mapa usando MapLibre",
5
+ "maplibre-field.fields.address": "dirección",
6
+ "maplibre-field.fields.longitude": "longitud",
7
+ "maplibre-field.fields.latitude": "latitud",
8
+ "maplibre-field.geocoding.success": "Dirección actualizada con éxito",
9
+ "maplibre-field.geocoding.error": "Error al obtener la dirección. Por favor, inténtelo de nuevo.",
10
+ "maplibre-field.geocoding.no-results": "No se encontró dirección para esta ubicación",
11
+ "maplibre-field.i18n.localized.label": "Activar localización para este campo",
12
+ "maplibre-field.i18n.localized.description": "El campo puede tener valores diferentes en cada idioma"
13
+ };
14
+ export {
15
+ es as default
16
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const es = {
4
+ "maplibre-field.label": "Mapa",
5
+ "maplibre-field.search": "Buscar un lugar o dirección en OpenStreetMap",
6
+ "maplibre-field.description": "Un campo personalizado de mapa usando MapLibre",
7
+ "maplibre-field.fields.address": "dirección",
8
+ "maplibre-field.fields.longitude": "longitud",
9
+ "maplibre-field.fields.latitude": "latitud",
10
+ "maplibre-field.geocoding.success": "Dirección actualizada con éxito",
11
+ "maplibre-field.geocoding.error": "Error al obtener la dirección. Por favor, inténtelo de nuevo.",
12
+ "maplibre-field.geocoding.no-results": "No se encontró dirección para esta ubicación",
13
+ "maplibre-field.i18n.localized.label": "Activar localización para este campo",
14
+ "maplibre-field.i18n.localized.description": "El campo puede tener valores diferentes en cada idioma"
15
+ };
16
+ exports.default = es;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fr = {
4
+ "maplibre-field.label": "Carte",
5
+ "maplibre-field.search": "Recherche d'un lieu ou d'une adresse",
6
+ "maplibre-field.description": "Un champ carte utilisant MapLibre",
7
+ "maplibre-field.fields.address": "adresse",
8
+ "maplibre-field.fields.longitude": "longitude",
9
+ "maplibre-field.fields.latitude": "latitude",
10
+ "maplibre-field.geocoding.success": "Adresse mise à jour avec succès",
11
+ "maplibre-field.geocoding.error": "Impossible de récupérer l'adresse. Veuillez réessayer.",
12
+ "maplibre-field.geocoding.no-results": "Aucune adresse trouvée pour cet emplacement",
13
+ "maplibre-field.i18n.localized.label": "Activer la localisation pour ce champ",
14
+ "maplibre-field.i18n.localized.description": "Le champ peut avoir des valeurs différentes dans chaque langue"
15
+ };
16
+ exports.default = fr;
@@ -0,0 +1,16 @@
1
+ const fr = {
2
+ "maplibre-field.label": "Carte",
3
+ "maplibre-field.search": "Recherche d'un lieu ou d'une adresse",
4
+ "maplibre-field.description": "Un champ carte utilisant MapLibre",
5
+ "maplibre-field.fields.address": "adresse",
6
+ "maplibre-field.fields.longitude": "longitude",
7
+ "maplibre-field.fields.latitude": "latitude",
8
+ "maplibre-field.geocoding.success": "Adresse mise à jour avec succès",
9
+ "maplibre-field.geocoding.error": "Impossible de récupérer l'adresse. Veuillez réessayer.",
10
+ "maplibre-field.geocoding.no-results": "Aucune adresse trouvée pour cet emplacement",
11
+ "maplibre-field.i18n.localized.label": "Activer la localisation pour ce champ",
12
+ "maplibre-field.i18n.localized.description": "Le champ peut avoir des valeurs différentes dans chaque langue"
13
+ };
14
+ export {
15
+ fr as default
16
+ };
@@ -0,0 +1,171 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { PinMap } from "@strapi/icons";
4
+ import { Flex } from "@strapi/design-system";
5
+ import { styled } from "styled-components";
6
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
+ const v = glob[path];
8
+ if (v) {
9
+ return typeof v === "function" ? v() : Promise.resolve(v);
10
+ }
11
+ return new Promise((_, reject) => {
12
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
13
+ reject.bind(
14
+ null,
15
+ new Error(
16
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
17
+ )
18
+ )
19
+ );
20
+ });
21
+ };
22
+ const name$1 = "@premiate/strapi-plugin-maplibre-field";
23
+ const strapi = {
24
+ name: "maplibre-field"
25
+ };
26
+ const pluginPkg = {
27
+ name: name$1,
28
+ strapi
29
+ };
30
+ const pluginId = pluginPkg.name.replace(/^(@[^/]+\/)?strapi-plugin-/i, "");
31
+ const Initializer = ({ setPlugin }) => {
32
+ const ref = useRef(false);
33
+ useEffect(() => {
34
+ if (!ref.current) {
35
+ setPlugin("maplibre-field");
36
+ ref.current = true;
37
+ }
38
+ }, [setPlugin]);
39
+ return null;
40
+ };
41
+ const IconBox = styled(Flex)`
42
+ /* Hard code color values */
43
+ /* to stay consistent between themes */
44
+ background-color: #f0f0ff; /* primary100 */
45
+ border: 1px solid #d9d8ff; /* primary200 */
46
+
47
+ svg > path {
48
+ fill: #4945ff; /* primary600 */
49
+ }
50
+ `;
51
+ const PluginIcon = () => {
52
+ return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(PinMap, {}) });
53
+ };
54
+ const mutateLayouts = (layouts) => {
55
+ return layouts.map((row) => {
56
+ return row.map((field) => {
57
+ const hasMapFieldEnabled = field.attribute?.pluginOptions?.["maplibre-field"]?.enabled;
58
+ if (!hasMapFieldEnabled) {
59
+ return field;
60
+ }
61
+ return {
62
+ ...field,
63
+ attribute: {
64
+ ...field.attribute,
65
+ customField: `plugin::${pluginId}.map`
66
+ }
67
+ };
68
+ });
69
+ });
70
+ };
71
+ const mutateEditViewHook = (editLayout) => {
72
+ if (!editLayout?.layout || !Array.isArray(editLayout.layout)) {
73
+ console.warn("maplibre-field: Invalid EditLayout structure received", editLayout);
74
+ return editLayout;
75
+ }
76
+ const mutatedLayout = mutateLayouts(editLayout.layout);
77
+ return {
78
+ ...editLayout,
79
+ layout: mutatedLayout
80
+ };
81
+ };
82
+ const prefixPluginTranslations = (trad, pluginId2) => {
83
+ if (!pluginId2) {
84
+ throw new TypeError("pluginId can't be empty");
85
+ }
86
+ return Object.keys(trad).reduce((acc, current) => {
87
+ acc[`${pluginId2}.${current}`] = trad[current];
88
+ return acc;
89
+ }, {});
90
+ };
91
+ const name = pluginPkg.strapi.name;
92
+ const index = {
93
+ register(app) {
94
+ app.customFields.register({
95
+ name: "map",
96
+ pluginId,
97
+ type: "json",
98
+ intlLabel: {
99
+ id: "maplibre-field.label",
100
+ defaultMessage: "Map"
101
+ },
102
+ intlDescription: {
103
+ id: "maplibre-field.description",
104
+ defaultMessage: "A map custom field using MapLibre"
105
+ },
106
+ icon: PluginIcon,
107
+ components: {
108
+ Input: async () => import(
109
+ /* webpackChunkName: "input-component" */
110
+ "./index-BNnkn7JG.mjs"
111
+ )
112
+ },
113
+ options: {
114
+ advanced: [
115
+ {
116
+ sectionTitle: null,
117
+ items: [
118
+ {
119
+ name: "options.pluginOptions.i18n.localized",
120
+ type: "checkbox",
121
+ intlLabel: {
122
+ id: "maplibre-field.i18n.localized.label",
123
+ defaultMessage: "Enable localization for this field"
124
+ },
125
+ description: {
126
+ id: "maplibre-field.i18n.localized.description",
127
+ defaultMessage: "The field can have different values in each language"
128
+ },
129
+ defaultValue: false
130
+ }
131
+ ]
132
+ }
133
+ ]
134
+ }
135
+ });
136
+ app.registerPlugin({
137
+ id: pluginId,
138
+ initializer: Initializer,
139
+ isReady: false,
140
+ name
141
+ });
142
+ },
143
+ bootstrap(app) {
144
+ app.registerHook(
145
+ "Admin/CM/pages/EditView/mutate-edit-view-layout",
146
+ mutateEditViewHook
147
+ );
148
+ },
149
+ async registerTrads({ locales }) {
150
+ const importedTrads = await Promise.all(
151
+ locales.map((locale) => {
152
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-CGU2cyif.mjs"), "./translations/en.json": () => import("./en-BxxNWf9i.mjs"), "./translations/es.json": () => import("./es-B_cPv3G5.mjs"), "./translations/fr.json": () => import("./fr-Dw5wEoDC.mjs"), "./translations/it.json": () => import("./it-CoUEVPt6.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
153
+ return {
154
+ data: prefixPluginTranslations(data, pluginId),
155
+ locale
156
+ };
157
+ }).catch(() => {
158
+ return {
159
+ data: {},
160
+ locale
161
+ };
162
+ });
163
+ })
164
+ );
165
+ return Promise.resolve(importedTrads);
166
+ }
167
+ };
168
+ export {
169
+ index as i,
170
+ pluginId as p
171
+ };