@vectoriahq/quac 0.21.0 → 0.22.0-next.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.
- package/dist/generate/normalizedProject.d.ts +14 -0
- package/dist/generate/normalizedProject.js +17 -0
- package/dist/generate/stacCatalogue.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/model/QgsProject.d.ts +5 -0
- package/dist/parse/parseLayers.js +21 -0
- package/package.json +1 -1
- package/src/schema/quac.schema.json +5 -0
|
@@ -58,6 +58,11 @@ export declare const QUAC_ICON_FIELD = "quac:icon";
|
|
|
58
58
|
* it: text that may hold HTML markup.
|
|
59
59
|
*/
|
|
60
60
|
export declare const QUAC_ADDED_MESSAGE_FIELD = "quac:added_message";
|
|
61
|
+
/**
|
|
62
|
+
* The key a Collection takes for its map tip: HTML holding QGIS expressions
|
|
63
|
+
* between `[%` and `%]`, which a reader fills in for a feature.
|
|
64
|
+
*/
|
|
65
|
+
export declare const QUAC_MAP_TIP_FIELD = "quac:map_tip";
|
|
61
66
|
/**
|
|
62
67
|
* The key a Collection takes for the area and distance units its source gives
|
|
63
68
|
* `$area`, `$length` and `$perimeter` in: `{ area_unit, distance_unit }`, each
|
|
@@ -217,6 +222,8 @@ export interface NormalizedLayer {
|
|
|
217
222
|
icon?: string | null;
|
|
218
223
|
/** Emitted as `quac:added_message`: the message shown once a feature is added, as the source wrote it. */
|
|
219
224
|
addedMessage?: string | null;
|
|
225
|
+
/** Emitted as `quac:map_tip`: the template of the layer's map tip, as the source wrote it. */
|
|
226
|
+
mapTip?: string | null;
|
|
220
227
|
/** Emitted as `quac:locks` where it locks an edit. */
|
|
221
228
|
locks?: LayerLocks;
|
|
222
229
|
/** Emitted as `quac:filters` where the source sets one up. */
|
|
@@ -374,6 +381,13 @@ export declare function readCollectionIcon(collection: StacCollection | null | u
|
|
|
374
381
|
* judges safe.
|
|
375
382
|
*/
|
|
376
383
|
export declare function readCollectionAddedMessage(collection: StacCollection | null | undefined): string | null;
|
|
384
|
+
/**
|
|
385
|
+
* The template of a Collection's map tip (`quac:map_tip`), as the source wrote
|
|
386
|
+
* it, or null where it gives none. It is HTML holding QGIS expressions between
|
|
387
|
+
* `[%` and `%]`, which the application fills in for a feature and shows only as
|
|
388
|
+
* far as it judges safe.
|
|
389
|
+
*/
|
|
390
|
+
export declare function readCollectionMapTip(collection: StacCollection | null | undefined): string | null;
|
|
377
391
|
/**
|
|
378
392
|
* Reads `quac:locks` back off a Collection: the edits it locks, each `true` or
|
|
379
393
|
* `{ expression }`. A member that is neither, or an expression that is blank,
|
|
@@ -63,6 +63,11 @@ export const QUAC_ICON_FIELD = 'quac:icon';
|
|
|
63
63
|
* it: text that may hold HTML markup.
|
|
64
64
|
*/
|
|
65
65
|
export const QUAC_ADDED_MESSAGE_FIELD = 'quac:added_message';
|
|
66
|
+
/**
|
|
67
|
+
* The key a Collection takes for its map tip: HTML holding QGIS expressions
|
|
68
|
+
* between `[%` and `%]`, which a reader fills in for a feature.
|
|
69
|
+
*/
|
|
70
|
+
export const QUAC_MAP_TIP_FIELD = 'quac:map_tip';
|
|
66
71
|
/**
|
|
67
72
|
* The key a Collection takes for the area and distance units its source gives
|
|
68
73
|
* `$area`, `$length` and `$perimeter` in: `{ area_unit, distance_unit }`, each
|
|
@@ -275,6 +280,8 @@ function buildCollection(layer, defaultProviders, folder) {
|
|
|
275
280
|
collection[QUAC_ICON_FIELD] = layer.icon;
|
|
276
281
|
if (layer.addedMessage)
|
|
277
282
|
collection[QUAC_ADDED_MESSAGE_FIELD] = layer.addedMessage;
|
|
283
|
+
if (layer.mapTip)
|
|
284
|
+
collection[QUAC_MAP_TIP_FIELD] = layer.mapTip;
|
|
278
285
|
if (layer.formOrder)
|
|
279
286
|
collection[QUAC_FORM_ORDER_FIELD] = layer.formOrder;
|
|
280
287
|
// Source-declaring vendor fields (`quac:wfs_*`), copied verbatim so a consumer reads the source structurally rather than by
|
|
@@ -566,6 +573,16 @@ export function readCollectionAddedMessage(collection) {
|
|
|
566
573
|
const message = collection?.[QUAC_ADDED_MESSAGE_FIELD];
|
|
567
574
|
return typeof message === 'string' && message.trim() !== '' ? message : null;
|
|
568
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* The template of a Collection's map tip (`quac:map_tip`), as the source wrote
|
|
578
|
+
* it, or null where it gives none. It is HTML holding QGIS expressions between
|
|
579
|
+
* `[%` and `%]`, which the application fills in for a feature and shows only as
|
|
580
|
+
* far as it judges safe.
|
|
581
|
+
*/
|
|
582
|
+
export function readCollectionMapTip(collection) {
|
|
583
|
+
const template = collection?.[QUAC_MAP_TIP_FIELD];
|
|
584
|
+
return typeof template === 'string' && template.trim() !== '' ? template : null;
|
|
585
|
+
}
|
|
569
586
|
const LOCKED_EDITS = ['add', 'attributes', 'geometry', 'delete'];
|
|
570
587
|
/**
|
|
571
588
|
* Reads `quac:locks` back off a Collection: the edits it locks, each `true` or
|
|
@@ -429,6 +429,7 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
|
|
|
429
429
|
legendImage: layer.legendImage,
|
|
430
430
|
icon: layer.icon,
|
|
431
431
|
addedMessage: layer.addedMessage,
|
|
432
|
+
mapTip: layer.mapTip,
|
|
432
433
|
locks: combineLocks(layer.locks ?? {}, wfsTransactionLocks(layer.id, context.wfsTransactionLayers)),
|
|
433
434
|
filters: context.filtersByCollectionId.get(layer.id),
|
|
434
435
|
vendorFields: buildVendorFields(layer, context.measurement),
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
|
|
|
36
36
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
|
|
37
37
|
export type { StacPmtilesSource } from './model/stacPmtiles.ts';
|
|
38
38
|
export type { StacCompanionData } from './generate/stacCatalogue.ts';
|
|
39
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
39
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
40
40
|
export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
41
41
|
export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
|
|
42
42
|
export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
|
|
|
24
24
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|
|
25
25
|
export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
|
|
26
26
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
|
|
27
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
27
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
28
28
|
export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
|
|
29
29
|
export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
|
|
30
30
|
export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
|
|
@@ -306,6 +306,11 @@ export interface LayerEntry {
|
|
|
306
306
|
* none.
|
|
307
307
|
*/
|
|
308
308
|
addedMessage?: string | null;
|
|
309
|
+
/**
|
|
310
|
+
* The layer's HTML map tip, from `<mapTip>`, as written and unfilled. Null
|
|
311
|
+
* or absent where Enable Map Tips is off or the template is blank.
|
|
312
|
+
*/
|
|
313
|
+
mapTip?: string | null;
|
|
309
314
|
/**
|
|
310
315
|
* The address of each field's icon, from the layer's `quac_icon_<field>`
|
|
311
316
|
* variables. Fields with none are absent.
|
|
@@ -125,6 +125,7 @@ function parseMapLayer(maplayer, notes, photoSettings) {
|
|
|
125
125
|
fieldEditRules: parseFieldEditRules(maplayer, note),
|
|
126
126
|
icon: parseLayerIcon(maplayer),
|
|
127
127
|
addedMessage: parseAddedMessage(maplayer),
|
|
128
|
+
mapTip: parseMapTip(maplayer),
|
|
128
129
|
fieldIcons: parseFieldIcons(maplayer),
|
|
129
130
|
fieldControls: parseFieldControls(maplayer),
|
|
130
131
|
formLayout: parseFormLayout(maplayer),
|
|
@@ -1042,6 +1043,26 @@ function parseAddedMessage(maplayer) {
|
|
|
1042
1043
|
const value = readLayerVariable(maplayer, ADDED_MESSAGE_VARIABLE);
|
|
1043
1044
|
return value === null || value.trim() === '' ? null : value;
|
|
1044
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Reads a vector layer's HTML Map Tip (Layer Properties › Display) from
|
|
1048
|
+
* `<mapTip>`, as written: HTML holding QGIS expressions between `[%` and
|
|
1049
|
+
* `%]`, left unfilled. Null where Enable Map Tips is off, which QGIS saves as
|
|
1050
|
+
* an `enabled` other than `1`, where the template is blank, and for a layer
|
|
1051
|
+
* that is not a vector layer. A missing `enabled` is on, as
|
|
1052
|
+
* `QgsVectorLayer::readSymbology` reads it (`src/core/vector/qgsvectorlayer.cpp`,
|
|
1053
|
+
* `qgis/QGIS@master`, read 2026-11-30). This is the map tip of the layer's
|
|
1054
|
+
* current style; another named style's own is not read.
|
|
1055
|
+
*/
|
|
1056
|
+
function parseMapTip(maplayer) {
|
|
1057
|
+
if (maplayer.getAttribute('type') !== 'vector')
|
|
1058
|
+
return null;
|
|
1059
|
+
const node = directChild(maplayer, 'mapTip');
|
|
1060
|
+
const template = node?.textContent ?? '';
|
|
1061
|
+
if (!node || template.trim() === '')
|
|
1062
|
+
return null;
|
|
1063
|
+
const enabled = node.getAttribute('enabled');
|
|
1064
|
+
return enabled === null || enabled.trim() === '1' ? template : null;
|
|
1065
|
+
}
|
|
1045
1066
|
/** The start of the name of a layer variable that chooses a field's control: `quac_control_condition`. */
|
|
1046
1067
|
const FIELD_CONTROL_VARIABLE_PREFIX = 'quac_control_';
|
|
1047
1068
|
/**
|
package/package.json
CHANGED
|
@@ -296,6 +296,11 @@
|
|
|
296
296
|
"type": "string",
|
|
297
297
|
"minLength": 1
|
|
298
298
|
},
|
|
299
|
+
"quac:map_tip": {
|
|
300
|
+
"description": "The template of the card shown for a feature on the map: HTML holding QGIS expressions between [% and %], which a reader fills in for the feature. Written from a QGIS vector layer's HTML Map Tip while Enable Map Tips is ticked.",
|
|
301
|
+
"type": "string",
|
|
302
|
+
"minLength": 1
|
|
303
|
+
},
|
|
299
304
|
"quac:primary_key": {
|
|
300
305
|
"description": "The names of the fields whose values identify a feature in the layer's data, its primary key. Written from QGIS, which gives a layer's primary key, where every field of the key is among the columns.",
|
|
301
306
|
"type": "array",
|