@tileflow/dev 0.1.0-alpha.25 → 0.1.0-alpha.27

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.
@@ -0,0 +1,129 @@
1
+ # Author recolorable and adaptable icons
2
+
3
+ Use SDF for a monochrome silhouette whose fill and halo vary by map. Keep multicolor artwork as
4
+ fixed-color RGBA. Ordinary filenames and icon IDs stay unchanged.
5
+
6
+ In an icon directory already selected by your map, place `tileflow.icons.json` beside `health.svg`:
7
+
8
+ ```json
9
+ {
10
+ "schemaVersion": 1,
11
+ "icons": {
12
+ "health": {
13
+ "representation": "sdf",
14
+ "defaults": {"color": "#c43d35", "haloColor": "#ffffff", "haloWidth": 1, "haloBlur": 0}
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ Only explicitly declared SDF assets are converted. Omitted entries, or `representation: "rgba"`,
21
+ preserve fixed-color rendering. SDF uses the source alpha silhouette; source RGB does not define its
22
+ default color. `defaults.color` is required. Omitted halo fields become transparent, zero width and
23
+ zero blur. Unknown IDs, duplicate JSON keys, unknown fields and invalid colors fail preparation.
24
+
25
+ The generated cell remains 24 × 24 logical pixels at both densities. Within that cell, the source
26
+ silhouette needs six fully transparent pixels on every side. Tileflow rejects edge-touching,
27
+ empty, or insufficiently defined silhouettes instead of adding padding or shrinking artwork.
28
+ Author opaque silhouettes with antialiased edges; gradients and translucent artwork should remain
29
+ RGBA. Thin shapes without a resolved interior fail verification. Generation rasterizes 1x and 2x
30
+ independently and encodes distance in white-RGB alpha. SDF is for symbol icons, not patterns.
31
+
32
+ For existing artwork, expand the source canvas explicitly before declaring SDF. A drawing bounded
33
+ by `viewBox="0 0 15 15"` fits the profile when its outer SVG uses `width="24" height="24"`
34
+ and `viewBox="-7.5 -7.5 30 30"`: the drawing occupies at most the central 12px. Review fine details
35
+ at the intended map size; use `icon.size` to choose the displayed size. Keep the original source for
36
+ fixed-color use. A transparent margin does not make an excessively thin silhouette suitable.
37
+
38
+ ## Keep each symbol layer homogeneous
39
+
40
+ One package may contain RGBA and SDF icons. Every icon selectable by one symbol layer, including
41
+ fallbacks, must use the same representation. Tileflow checks the effective composition after all
42
+ local overrides. It does not split layers or alter collision priority, coupled labels or IDs.
43
+
44
+ An unbounded selection such as a POI icon read from feature data can select any effective icon ID.
45
+ It therefore requires a homogeneous inventory. To use a mixed package, select one fixed icon or
46
+ an explicit `expr.match`/`expr.case` expression whose possible outputs and fallback are homogeneous.
47
+ Sampling the current feature data does not prove this condition.
48
+
49
+ `tileflow validate`, `tileflow dev`, `tileflow build`, framework preparation and Capture use the
50
+ same check. `TF_ICON_REPRESENTATION_MIXED` identifies the layer and image-selection path. Replace
51
+ the conflicting override, align all selectable representations, or bound the selection explicitly.
52
+ Compiled SDF admission rejects legacy token templates and function objects with
53
+ `TF_ICON_SELECTION_UNPROVEN`; rebuild using expression-based image selection.
54
+ Development reports an invalid generation and retains its last valid artifact until recovery.
55
+
56
+ ## Style each map independently
57
+
58
+ Use the existing `styles.<category>.icon` fields: `color`, `haloColor`, `haloWidth`, and `haloBlur`.
59
+ Theme tokens, explicit `fixed(...)` values and supported data, zoom and feature-state expressions
60
+ compile to native MapLibre paint. Feature state is supported in paint, not image selection.
61
+ Keep halo width within 0–2 logical pixels and blur within 0–1. Dynamic halo expressions must prove
62
+ these bounds; use `expr.min`/`expr.max` around unconstrained feature values. Otherwise compilation
63
+ reports `TF_ICON_HALO_BOUNDS`.
64
+
65
+ An omitted paint property uses that selected icon's declared default, including missing-ID
66
+ fallbacks. An override replaces only its property. It does not edit the shared revision or another
67
+ map. Image IDs remain stable; recoloring does not generate image variants. Existing size, opacity,
68
+ rotation and anchor controls retain their native semantics.
69
+
70
+ ## Fit a background around text
71
+
72
+ Declare optional `layout` beside the representation. It applies to RGBA and SDF independently.
73
+ For a 24px background whose central region can stretch, use this sidecar entry:
74
+
75
+ ```json
76
+ {
77
+ "schemaVersion": 1,
78
+ "icons": {
79
+ "price": {
80
+ "representation": "rgba",
81
+ "layout": {
82
+ "stretchX": [[9, 15]],
83
+ "stretchY": [[9, 15]],
84
+ "content": [7, 7, 17, 17]
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ Coordinates use the generated logical cell, not the original SVG viewBox. Each stretch interval
92
+ is `[start, end]`; `content` is `[left, top, right, bottom]`. Use positive, ordered, non-overlapping
93
+ integer ranges inside the cell. Each configured axis must overlap its content area. Put corners,
94
+ borders and pointers outside stretch regions. Tileflow scales metadata for the 2x index, verifies
95
+ both densities and rejects layout on patterns. SDF backgrounds still need the six-pixel guard.
96
+
97
+ Enable the existing map `icon.textFit` control (`width`, `height` or `both`) and set
98
+ `icon.textFitPadding` in top/right/bottom/left order. For centered price labels, also set
99
+ `text.anchor: 'center'` and `text.offset: [0, 0]`; the POI defaults place labels beside icons.
100
+ This style fragment belongs inside the selected category's `styles` entry:
101
+
102
+ ```ts
103
+ {
104
+ icon: {image: fixed('price', {reason: 'Price background'}), textFit: 'both', textFitPadding: [4, 6, 4, 6]},
105
+ text: {anchor: 'center', offset: [0, 0]},
106
+ }
107
+ ```
108
+
109
+ Import `fixed` from `@tileflow/core`. The same layer retains label coupling, collision priority and
110
+ interaction identity. Text fitting does not happen merely because an asset has metadata. Explicit
111
+ new local artwork replaces the shared asset's layout; omitted metadata never inherits stale bounds.
112
+
113
+ ## Inspect and distribute the result
114
+
115
+ Packages with SDF appearance or layout use `tileflow-icon-package-v2`; composition receipts use
116
+ `tileflow-icon-composition-v2` when an effective winner has either capability. Paired sprite JSON entries contain
117
+ `sdf: true` and verified `tileflow` appearance metadata. Defaults and layout participate in revision identity
118
+ and diffs even when pixel hashes match. Metadata-free RGBA packages and receipts keep their v1 identity.
119
+ Old readers reject v2; upgrade every producing and consuming package together.
120
+
121
+ `tileflow icons list --json` includes `appearances` and `layouts` for effective icons. Diff reports show default appearance;
122
+ downloadable PNGs remain the original distance fields. Bare MapLibre consumes the standard sprite
123
+ and compiled paint without a recoloring adapter. Capture uses the same prepared assets.
124
+
125
+ Hosted admission, Dashboard and Static Maps require coordinated Platform adoption. Additional
126
+ Static Maps symbols use asset defaults and retain adjacent icon/label layout; base-map symbols use
127
+ compiled map paint and text fitting. Device support
128
+ requires separate Native qualification. This contract does not provide independently parameterized
129
+ multicolor SVG, COLRv1, `textFitWidth`/`textFitHeight` metadata or an icon editor.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/dev",
3
- "version": "0.1.0-alpha.25",
3
+ "version": "0.1.0-alpha.27",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Node development utilities for Tileflow configs and builds.",
6
6
  "type": "module",
@@ -90,7 +90,7 @@
90
90
  "dependencies": {
91
91
  "@mapbox/vector-tile": "3.0.0",
92
92
  "@maplibre/maplibre-gl-style-spec": "24.8.5",
93
- "@tileflow/core": ">=0.1.0-alpha.26 <0.1.0-beta.0",
93
+ "@tileflow/core": ">=0.1.0-alpha.29 <0.1.0-beta.0",
94
94
  "chokidar": "4.0.3",
95
95
  "fflate": "0.8.3",
96
96
  "fontkit": "2.0.4",
@@ -102,7 +102,7 @@
102
102
  "three": "0.185.1"
103
103
  },
104
104
  "devDependencies": {
105
- "@tileflow/maps": "0.1.0-alpha.4"
105
+ "@tileflow/maps": "0.1.0-alpha.6"
106
106
  },
107
107
  "optionalDependencies": {
108
108
  "sharp": "0.35.4"