@tileflow/interactions 0.1.0-alpha.2 → 0.1.0-alpha.4
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/README.md +28 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tileflow/interactions
|
|
2
2
|
|
|
3
3
|
Portable annotations, tooltips, popups, state, and interaction bindings for Tileflow maps.
|
|
4
4
|
|
|
@@ -10,10 +10,26 @@ The package has two boundaries:
|
|
|
10
10
|
Framework applications normally use `@tileflow/react`, `@tileflow/vue`, or `@tileflow/svelte`
|
|
11
11
|
instead of calling the MapLibre controller directly.
|
|
12
12
|
|
|
13
|
+
> Related packages and guides: [documentation index](https://raw.githubusercontent.com/tileflow/tileflow-sdk/main/llms.txt).
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @tileflow/interactions@alpha
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The root entry needs no MapLibre installation or browser. For live UI, install one framework adapter
|
|
22
|
+
and follow its worker, CSS, and asset-preparation guide:
|
|
23
|
+
[React](https://github.com/tileflow/tileflow-sdk/blob/main/packages/react/README.md),
|
|
24
|
+
[Vue](https://github.com/tileflow/tileflow-sdk/blob/main/packages/vue/README.md), or
|
|
25
|
+
[Svelte](https://github.com/tileflow/tileflow-sdk/blob/main/packages/svelte/README.md).
|
|
26
|
+
|
|
13
27
|
## Annotation model
|
|
14
28
|
|
|
29
|
+
<!-- docs:check -->
|
|
30
|
+
|
|
15
31
|
```ts
|
|
16
|
-
import type
|
|
32
|
+
import {type TileflowAnnotation, validateTileflowAnnotations} from '@tileflow/interactions';
|
|
17
33
|
|
|
18
34
|
const properties = [
|
|
19
35
|
{
|
|
@@ -27,6 +43,10 @@ const properties = [
|
|
|
27
43
|
popup: {content: {kind: 'view', name: 'property-card'}},
|
|
28
44
|
},
|
|
29
45
|
] satisfies TileflowAnnotation[];
|
|
46
|
+
|
|
47
|
+
const result = validateTileflowAnnotations(properties);
|
|
48
|
+
if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
|
|
49
|
+
console.log(result.annotations);
|
|
30
50
|
```
|
|
31
51
|
|
|
32
52
|
`text` and scalar `field` content are inserted as text. `view` is a small dispatch name for a
|
|
@@ -35,11 +55,13 @@ Custom tooltip views must remain brief and non-focusable; put buttons, links, fo
|
|
|
35
55
|
interactive content in a popup.
|
|
36
56
|
|
|
37
57
|
Every new annotation needs a stable `id`, singular `coordinate`, and non-empty `ariaLabel`.
|
|
38
|
-
Optional `data` must be recursively JSON-safe. Call `validateTileflowAnnotations` at an untrusted
|
|
58
|
+
Coordinates use `[longitude, latitude]`. Optional `data` must be recursively JSON-safe. Call `validateTileflowAnnotations` at an untrusted
|
|
39
59
|
boundary to receive atomic validation and structured JSON-Pointer diagnostics.
|
|
40
60
|
|
|
41
61
|
## Popup state
|
|
42
62
|
|
|
63
|
+
<!-- docs:check -->
|
|
64
|
+
|
|
43
65
|
```ts
|
|
44
66
|
import {
|
|
45
67
|
initialTileflowInteractionState,
|
|
@@ -59,6 +81,8 @@ adapters expose controlled and uncontrolled ownership without changing this seri
|
|
|
59
81
|
|
|
60
82
|
The first semantic runtime target is `domain: 'poi'`:
|
|
61
83
|
|
|
84
|
+
<!-- docs:check -->
|
|
85
|
+
|
|
62
86
|
```ts
|
|
63
87
|
import type {TileflowInteractionBinding} from '@tileflow/interactions';
|
|
64
88
|
|
|
@@ -91,5 +115,5 @@ objects and schedulers are injected at attach time, so both subpath imports rema
|
|
|
91
115
|
`createTileflowMapLibreInteractionCoordinator` joins them around one controlled or uncontrolled
|
|
92
116
|
popup state and commits the closing runtime before the opening runtime.
|
|
93
117
|
|
|
94
|
-
See [`docs/contracts/map-interactions.md`](
|
|
118
|
+
See [`docs/contracts/map-interactions.md`](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/map-interactions.md) for lifecycle,
|
|
95
119
|
accessibility, security, capture, and framework parity requirements.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/interactions",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Portable annotation and interaction contracts for Tileflow maps.",
|
|
6
6
|
"type": "module",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"zod": "^4.4.3"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"maplibre-gl": ">=
|
|
49
|
+
"maplibre-gl": ">=6.4.1 <7"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"maplibre-gl": {
|