@botiverse/porthole 0.7.0 → 0.9.0
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 +9 -2
- package/THIRD_PARTY_NOTICES.md +421 -0
- package/dist/annotate/types.d.ts +40 -4
- package/dist/annotate/types.js +6 -1
- package/dist/annotate/validate.d.ts +10 -0
- package/dist/annotate/validate.js +24 -1
- package/dist/bridge/bounded-text.d.ts +34 -0
- package/dist/bridge/bounded-text.js +188 -0
- package/dist/bridge/bridge.d.ts +25 -5
- package/dist/bridge/bridge.js +311 -73
- package/dist/bridge/json-data.d.ts +28 -0
- package/dist/bridge/json-data.js +86 -0
- package/dist/bridge/navigation.d.ts +5 -0
- package/dist/bridge/navigation.js +7 -0
- package/dist/bridge/refusal.js +1 -0
- package/dist/bridge/types.d.ts +32 -1
- package/dist/check/page-source.js +1 -1
- package/dist/check/page.js +2 -0
- package/dist/compile/compile.d.ts +6 -0
- package/dist/compile/compile.js +3 -1
- package/dist/compile/policy.d.ts +38 -2
- package/dist/compile/policy.js +122 -7
- package/dist/config/capabilities.d.ts +23 -4
- package/dist/config/capabilities.js +12 -2
- package/dist/config/schema.d.ts +11 -0
- package/dist/config/validate.d.ts +8 -2
- package/dist/config/validate.js +28 -6
- package/dist/config/warnings.d.ts +20 -0
- package/dist/config/warnings.js +25 -0
- package/dist/conformance/behavior.js +46 -1
- package/dist/conformance/cookies.d.ts +15 -0
- package/dist/conformance/cookies.js +80 -0
- package/dist/conformance/harness/page.d.ts +1 -0
- package/dist/conformance/harness/page.js +9 -2
- package/dist/conformance/harness-source.js +1 -1
- package/dist/conformance/host-kit.js +5 -1
- package/dist/conformance/index.d.ts +10 -0
- package/dist/conformance/limits.js +38 -1
- package/dist/conformance/runtime.js +10 -0
- package/dist/conformance/served.d.ts +2 -0
- package/dist/conformance/served.js +737 -4
- package/dist/files/paths.js +4 -0
- package/dist/guide/gates.d.ts +7 -1
- package/dist/guide/gates.js +12 -0
- package/dist/guide/guide.js +2 -2
- package/dist/guide/runtime.js +11 -3
- package/dist/host/create-host.js +81 -39
- package/dist/host/pages-of-set.d.ts +43 -0
- package/dist/host/pages-of-set.js +196 -0
- package/dist/host/types.d.ts +8 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/mcp/adapter.js +11 -15
- package/dist/node/index.d.ts +36 -4
- package/dist/node/index.js +402 -101
- package/dist/platform/types.d.ts +9 -0
- package/dist/platform/web.js +8 -0
- package/dist/presets/presets.d.ts +16 -8
- package/dist/presets/presets.js +39 -8
- package/dist/protocol/live-data.d.ts +6 -2
- package/dist/protocol/live-data.js +20 -1
- package/dist/protocol/mcp-apps.d.ts +13 -2
- package/dist/protocol/mcp-apps.js +10 -2
- package/dist/protocol/message-text.d.ts +8 -0
- package/dist/protocol/message-text.js +29 -0
- package/dist/protocol/runtime-calls.js +3 -0
- package/dist/protocol/shell-adapter.js +16 -22
- package/dist/react/context-notice.d.ts +32 -0
- package/dist/react/context-notice.js +28 -0
- package/dist/react/dialog.js +62 -18
- package/dist/react/frame.d.ts +18 -3
- package/dist/react/frame.js +79 -2
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/runtime/contract.d.ts +9 -1
- package/dist/runtime/contract.js +31 -2
- package/dist/runtime/db.d.ts +41 -6
- package/dist/runtime/db.js +120 -16
- package/dist/runtime/declaration.d.ts +15 -1
- package/dist/runtime/declaration.js +184 -87
- package/dist/runtime/requests.js +27 -11
- package/dist/runtime/types.generated.js +1 -1
- package/dist/server/files.d.ts +5 -0
- package/dist/server/files.js +22 -7
- package/dist/server/host.d.ts +18 -1
- package/dist/server/host.js +132 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/peer.d.ts +4 -0
- package/dist/server/peer.js +19 -0
- package/dist/server/proxy.d.ts +6 -0
- package/dist/server/proxy.js +12 -3
- package/dist/server/server.js +113 -26
- package/dist/server/types.d.ts +6 -3
- package/dist/shell/annotate.d.ts +7 -2
- package/dist/shell/annotate.js +233 -15
- package/dist/shell/document.d.ts +8 -0
- package/dist/shell/document.js +3 -0
- package/dist/shell/runtime.js +361 -14
- package/docs/ADOPTING.md +119 -14
- package/docs/ARCHITECTURE.md +15 -4
- package/docs/DECISIONS.md +1610 -9
- package/docs/DESIGN.md +114 -30
- package/docs/THREAT_MODEL.md +652 -0
- package/package.json +14 -3
- package/src/annotate/types.ts +37 -5
- package/src/annotate/validate.ts +30 -1
- package/src/bridge/bounded-text.ts +240 -0
- package/src/bridge/bridge.ts +373 -84
- package/src/bridge/json-data.ts +95 -0
- package/src/bridge/navigation.ts +10 -0
- package/src/bridge/refusal.ts +1 -0
- package/src/bridge/types.ts +30 -1
- package/src/check/page.ts +2 -0
- package/src/compile/compile.ts +9 -1
- package/src/compile/policy.ts +130 -7
- package/src/config/capabilities.ts +22 -3
- package/src/config/schema.ts +11 -0
- package/src/config/validate.ts +43 -5
- package/src/config/warnings.ts +42 -0
- package/src/conformance/behavior.ts +54 -1
- package/src/conformance/cookies.ts +93 -0
- package/src/conformance/harness/page.ts +11 -2
- package/src/conformance/host-kit.ts +10 -1
- package/src/conformance/index.ts +10 -0
- package/src/conformance/limits.ts +39 -1
- package/src/conformance/runtime.ts +21 -0
- package/src/conformance/served.ts +888 -4
- package/src/files/paths.ts +4 -0
- package/src/guide/gates.ts +13 -1
- package/src/guide/guide.ts +3 -3
- package/src/guide/runtime.ts +12 -3
- package/src/host/create-host.ts +88 -38
- package/src/host/pages-of-set.ts +226 -0
- package/src/host/types.ts +15 -1
- package/src/index.ts +5 -0
- package/src/mcp/adapter.ts +16 -20
- package/src/node/index.ts +507 -116
- package/src/platform/types.ts +6 -0
- package/src/platform/web.ts +10 -0
- package/src/presets/presets.ts +60 -17
- package/src/protocol/live-data.ts +31 -3
- package/src/protocol/mcp-apps.ts +11 -2
- package/src/protocol/message-text.ts +36 -0
- package/src/protocol/runtime-calls.ts +3 -0
- package/src/protocol/shell-adapter.ts +27 -23
- package/src/react/context-notice.tsx +95 -0
- package/src/react/dialog.tsx +77 -17
- package/src/react/frame.tsx +107 -2
- package/src/react/index.ts +8 -1
- package/src/runtime/contract.ts +36 -2
- package/src/runtime/db.ts +140 -20
- package/src/runtime/declaration.ts +227 -89
- package/src/runtime/requests.ts +27 -11
- package/src/runtime/types.generated.ts +1 -1
- package/src/server/files.ts +29 -11
- package/src/server/host.ts +158 -3
- package/src/server/index.ts +1 -0
- package/src/server/peer.ts +21 -0
- package/src/server/proxy.ts +13 -3
- package/src/server/server.ts +139 -36
- package/src/server/types.ts +6 -3
- package/src/shell/annotate.ts +233 -15
- package/src/shell/document.ts +8 -0
- package/src/shell/runtime.ts +361 -14
- package/types/runtime/v1/context.d.ts +13 -2
package/README.md
CHANGED
|
@@ -112,6 +112,8 @@ width, light and dark, before anyone sees it, and tells the agent what broke in
|
|
|
112
112
|
CSP, Workers, local development, the agent's tools, conformance, troubleshooting.
|
|
113
113
|
- [Choosing egress](docs/ADOPTING.md#choosing-egress): what content may load (closed, library
|
|
114
114
|
CDNs, passive media from any https site), what each level opens and the risk it re-opens.
|
|
115
|
+
- [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md): what Porthole protects and from whom; for each
|
|
116
|
+
use, what it guarantees, what is left to you, and what isn't covered.
|
|
115
117
|
- [docs/DESIGN.md](docs/DESIGN.md): how it works. [docs/DECISIONS.md](docs/DECISIONS.md): why,
|
|
116
118
|
by P-number (the code cites them).
|
|
117
119
|
|
|
@@ -122,7 +124,7 @@ width, light and dark, before anyone sees it, and tells the agent what broke in
|
|
|
122
124
|
| `@botiverse/porthole` | `createHost`, `presets`, `defineDisplays`, `portholeClient`, `lintContent`, the tools (browser and server) |
|
|
123
125
|
| `@botiverse/porthole/react` | `PortholeProvider`, `PortholeFrame`, `PortholeView` |
|
|
124
126
|
| `@botiverse/porthole/server` | `createContentHost` (`routes`), `contentHostFor`, `prefixedName`, `d1TicketStore` (any runtime) |
|
|
125
|
-
| `@botiverse/porthole/node` | `nodeServer`, `nodeHost`, `nodeProbe` (Node's http server) |
|
|
127
|
+
| `@botiverse/porthole/node` | `nodeServer`, `nodeHost`, `nodeListener`, `nodeProbe` (Node's http server) |
|
|
126
128
|
| `@botiverse/porthole/mcp` | the MCP Apps adapter |
|
|
127
129
|
| `@botiverse/porthole/check` | `checkPage`, `playwrightDriver`, `cdpDriver`: the agent's pre-show check |
|
|
128
130
|
| `@botiverse/porthole/conformance` | `defineHostConformance`: the suite, against your app (Playwright) |
|
|
@@ -131,4 +133,9 @@ width, light and dark, before anyone sees it, and tells the agent what broke in
|
|
|
131
133
|
|
|
132
134
|
Apache-2.0. `/server` also serves copies of [Chart.js](https://www.chartjs.org) 4.5.1 (MIT) and
|
|
133
135
|
[D3](https://d3js.org) 7.9.0 (ISC) to live widgets (P079), each with its license beside it
|
|
134
|
-
(`/__porthole/lib/<name>@<version>/`), from `src/libraries/files.generated.ts
|
|
136
|
+
(`/__porthole/lib/<name>@<version>/`), from `src/libraries/files.generated.ts`; their notices,
|
|
137
|
+
and those of the packages their files bundle, are in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
138
|
+
|
|
139
|
+
Found a vulnerability? Report it privately, as
|
|
140
|
+
[SECURITY.md](https://github.com/botiverse/porthole/blob/main/SECURITY.md) says, never in a public
|
|
141
|
+
issue.
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@botiverse/porthole` is licensed under Apache-2.0 ([LICENSE](LICENSE)). It also ships
|
|
4
|
+
third-party code: the libraries `/server` serves to live widgets (P079), copied byte for byte
|
|
5
|
+
from their npm packages into `src/libraries/files.generated.ts` (and `dist/`), each served with
|
|
6
|
+
its own license beside it. Each library's file bundles the packages listed under it. Their
|
|
7
|
+
license texts follow, as the packages pnpm installs for it carry them (the library's authors
|
|
8
|
+
may have built its file from earlier releases of the same majors).
|
|
9
|
+
|
|
10
|
+
Generated by `scripts/notices.ts` from the installed packages (P097): do not edit.
|
|
11
|
+
|
|
12
|
+
## Chart.js 4.5.1
|
|
13
|
+
|
|
14
|
+
Served at `/__porthole/lib/chart.js@4.5.1/dist/chart.umd.min.js` (npm's `dist/chart.umd.min.js`), bundling:
|
|
15
|
+
|
|
16
|
+
- chart.js 4.5.1: MIT
|
|
17
|
+
- @kurkle/color 0.3.4: MIT
|
|
18
|
+
|
|
19
|
+
## D3 7.9.0
|
|
20
|
+
|
|
21
|
+
Served at `/__porthole/lib/d3@7.9.0/dist/d3.min.js` (npm's `dist/d3.min.js`), bundling:
|
|
22
|
+
|
|
23
|
+
- d3 7.9.0: ISC
|
|
24
|
+
- d3-array 3.2.4: ISC
|
|
25
|
+
- d3-axis 3.0.0: ISC
|
|
26
|
+
- d3-brush 3.0.0: ISC
|
|
27
|
+
- d3-chord 3.0.1: ISC
|
|
28
|
+
- d3-color 3.1.0: ISC
|
|
29
|
+
- d3-contour 4.0.2: ISC
|
|
30
|
+
- d3-delaunay 6.0.4: ISC
|
|
31
|
+
- d3-dispatch 3.0.1: ISC
|
|
32
|
+
- d3-drag 3.0.0: ISC
|
|
33
|
+
- d3-dsv 3.0.1: ISC
|
|
34
|
+
- d3-ease 3.0.1: BSD-3-Clause
|
|
35
|
+
- d3-fetch 3.0.1: ISC
|
|
36
|
+
- d3-force 3.0.0: ISC
|
|
37
|
+
- d3-format 3.1.2: ISC
|
|
38
|
+
- d3-geo 3.1.1: ISC
|
|
39
|
+
- d3-hierarchy 3.1.2: ISC
|
|
40
|
+
- d3-interpolate 3.0.1: ISC
|
|
41
|
+
- d3-path 3.1.0: ISC
|
|
42
|
+
- d3-polygon 3.0.1: ISC
|
|
43
|
+
- d3-quadtree 3.0.1: ISC
|
|
44
|
+
- d3-random 3.0.1: ISC
|
|
45
|
+
- d3-scale 4.0.2: ISC
|
|
46
|
+
- d3-scale-chromatic 3.1.0: ISC
|
|
47
|
+
- d3-selection 3.0.0: ISC
|
|
48
|
+
- d3-shape 3.2.0: ISC
|
|
49
|
+
- d3-time 3.1.0: ISC
|
|
50
|
+
- d3-time-format 4.1.0: ISC
|
|
51
|
+
- d3-timer 3.0.1: ISC
|
|
52
|
+
- d3-transition 3.0.1: ISC
|
|
53
|
+
- d3-zoom 3.0.0: ISC
|
|
54
|
+
- delaunator 5.1.0: ISC
|
|
55
|
+
- internmap 2.0.3: ISC
|
|
56
|
+
- robust-predicates 3.0.3: Unlicense
|
|
57
|
+
|
|
58
|
+
## License texts
|
|
59
|
+
|
|
60
|
+
### chart.js 4.5.1
|
|
61
|
+
|
|
62
|
+
````text
|
|
63
|
+
The MIT License (MIT)
|
|
64
|
+
|
|
65
|
+
Copyright (c) 2014-2024 Chart.js Contributors
|
|
66
|
+
|
|
67
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
68
|
+
|
|
69
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
70
|
+
|
|
71
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
72
|
+
````
|
|
73
|
+
|
|
74
|
+
### @kurkle/color 0.3.4
|
|
75
|
+
|
|
76
|
+
````text
|
|
77
|
+
The MIT License (MIT)
|
|
78
|
+
|
|
79
|
+
Copyright (c) 2018-2024 Jukka Kurkela
|
|
80
|
+
|
|
81
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
82
|
+
|
|
83
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
84
|
+
|
|
85
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
86
|
+
````
|
|
87
|
+
|
|
88
|
+
### d3 7.9.0, d3-array 3.2.4
|
|
89
|
+
|
|
90
|
+
````text
|
|
91
|
+
Copyright 2010-2023 Mike Bostock
|
|
92
|
+
|
|
93
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
94
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
95
|
+
and this permission notice appear in all copies.
|
|
96
|
+
|
|
97
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
98
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
99
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
100
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
101
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
102
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
103
|
+
THIS SOFTWARE.
|
|
104
|
+
````
|
|
105
|
+
|
|
106
|
+
### d3-axis 3.0.0, d3-brush 3.0.0, d3-chord 3.0.1, d3-dispatch 3.0.1, d3-drag 3.0.0, d3-force 3.0.0, d3-hierarchy 3.1.2, d3-interpolate 3.0.1, d3-polygon 3.0.1, d3-quadtree 3.0.1, d3-random 3.0.1, d3-scale 4.0.2, d3-selection 3.0.0, d3-time-format 4.1.0, d3-timer 3.0.1, d3-transition 3.0.1, d3-zoom 3.0.0
|
|
107
|
+
|
|
108
|
+
````text
|
|
109
|
+
Copyright 2010-2021 Mike Bostock
|
|
110
|
+
|
|
111
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
112
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
113
|
+
and this permission notice appear in all copies.
|
|
114
|
+
|
|
115
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
116
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
117
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
118
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
119
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
120
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
121
|
+
THIS SOFTWARE.
|
|
122
|
+
````
|
|
123
|
+
|
|
124
|
+
### d3-color 3.1.0, d3-shape 3.2.0, d3-time 3.1.0
|
|
125
|
+
|
|
126
|
+
````text
|
|
127
|
+
Copyright 2010-2022 Mike Bostock
|
|
128
|
+
|
|
129
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
130
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
131
|
+
and this permission notice appear in all copies.
|
|
132
|
+
|
|
133
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
134
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
135
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
136
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
137
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
138
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
139
|
+
THIS SOFTWARE.
|
|
140
|
+
````
|
|
141
|
+
|
|
142
|
+
### d3-contour 4.0.2
|
|
143
|
+
|
|
144
|
+
````text
|
|
145
|
+
Copyright 2012-2023 Mike Bostock
|
|
146
|
+
|
|
147
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
148
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
149
|
+
and this permission notice appear in all copies.
|
|
150
|
+
|
|
151
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
152
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
153
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
154
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
155
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
156
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
157
|
+
THIS SOFTWARE.
|
|
158
|
+
````
|
|
159
|
+
|
|
160
|
+
### d3-delaunay 6.0.4
|
|
161
|
+
|
|
162
|
+
````text
|
|
163
|
+
Copyright 2018-2021 Observable, Inc.
|
|
164
|
+
Copyright 2021 Mapbox
|
|
165
|
+
|
|
166
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
167
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
168
|
+
and this permission notice appear in all copies.
|
|
169
|
+
|
|
170
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
171
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
172
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
173
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
174
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
175
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
176
|
+
THIS SOFTWARE.
|
|
177
|
+
````
|
|
178
|
+
|
|
179
|
+
### d3-dsv 3.0.1
|
|
180
|
+
|
|
181
|
+
````text
|
|
182
|
+
Copyright 2013-2021 Mike Bostock
|
|
183
|
+
|
|
184
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
185
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
186
|
+
and this permission notice appear in all copies.
|
|
187
|
+
|
|
188
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
189
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
190
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
191
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
192
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
193
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
194
|
+
THIS SOFTWARE.
|
|
195
|
+
````
|
|
196
|
+
|
|
197
|
+
### d3-ease 3.0.1
|
|
198
|
+
|
|
199
|
+
````text
|
|
200
|
+
Copyright 2010-2021 Mike Bostock
|
|
201
|
+
Copyright 2001 Robert Penner
|
|
202
|
+
All rights reserved.
|
|
203
|
+
|
|
204
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
205
|
+
are permitted provided that the following conditions are met:
|
|
206
|
+
|
|
207
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
208
|
+
list of conditions and the following disclaimer.
|
|
209
|
+
|
|
210
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
211
|
+
this list of conditions and the following disclaimer in the documentation
|
|
212
|
+
and/or other materials provided with the distribution.
|
|
213
|
+
|
|
214
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
215
|
+
endorse or promote products derived from this software without specific prior
|
|
216
|
+
written permission.
|
|
217
|
+
|
|
218
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
219
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
220
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
221
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
222
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
223
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
224
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
225
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
226
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
227
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
228
|
+
````
|
|
229
|
+
|
|
230
|
+
### d3-fetch 3.0.1
|
|
231
|
+
|
|
232
|
+
````text
|
|
233
|
+
Copyright 2016-2021 Mike Bostock
|
|
234
|
+
|
|
235
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
236
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
237
|
+
and this permission notice appear in all copies.
|
|
238
|
+
|
|
239
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
240
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
241
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
242
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
243
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
244
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
245
|
+
THIS SOFTWARE.
|
|
246
|
+
````
|
|
247
|
+
|
|
248
|
+
### d3-format 3.1.2
|
|
249
|
+
|
|
250
|
+
````text
|
|
251
|
+
Copyright 2010-2026 Mike Bostock
|
|
252
|
+
|
|
253
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
254
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
255
|
+
and this permission notice appear in all copies.
|
|
256
|
+
|
|
257
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
258
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
259
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
260
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
261
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
262
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
263
|
+
THIS SOFTWARE.
|
|
264
|
+
````
|
|
265
|
+
|
|
266
|
+
### d3-geo 3.1.1
|
|
267
|
+
|
|
268
|
+
````text
|
|
269
|
+
Copyright 2010-2024 Mike Bostock
|
|
270
|
+
|
|
271
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
272
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
273
|
+
and this permission notice appear in all copies.
|
|
274
|
+
|
|
275
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
276
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
277
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
278
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
279
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
280
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
281
|
+
THIS SOFTWARE.
|
|
282
|
+
|
|
283
|
+
This license applies to GeographicLib, versions 1.12 and later.
|
|
284
|
+
|
|
285
|
+
Copyright 2008-2012 Charles Karney
|
|
286
|
+
|
|
287
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
288
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
289
|
+
the Software without restriction, including without limitation the rights to
|
|
290
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
291
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
292
|
+
subject to the following conditions:
|
|
293
|
+
|
|
294
|
+
The above copyright notice and this permission notice shall be included in all
|
|
295
|
+
copies or substantial portions of the Software.
|
|
296
|
+
|
|
297
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
298
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
299
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
300
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
301
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
302
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
303
|
+
````
|
|
304
|
+
|
|
305
|
+
### d3-path 3.1.0
|
|
306
|
+
|
|
307
|
+
````text
|
|
308
|
+
Copyright 2015-2022 Mike Bostock
|
|
309
|
+
|
|
310
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
311
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
312
|
+
and this permission notice appear in all copies.
|
|
313
|
+
|
|
314
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
315
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
316
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
317
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
318
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
319
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
320
|
+
THIS SOFTWARE.
|
|
321
|
+
````
|
|
322
|
+
|
|
323
|
+
### d3-scale-chromatic 3.1.0
|
|
324
|
+
|
|
325
|
+
````text
|
|
326
|
+
Copyright 2010-2024 Mike Bostock
|
|
327
|
+
|
|
328
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
329
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
330
|
+
and this permission notice appear in all copies.
|
|
331
|
+
|
|
332
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
333
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
334
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
335
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
336
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
337
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
338
|
+
THIS SOFTWARE.
|
|
339
|
+
|
|
340
|
+
Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes
|
|
341
|
+
|
|
342
|
+
Copyright 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University
|
|
343
|
+
|
|
344
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
345
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
346
|
+
License at
|
|
347
|
+
|
|
348
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
349
|
+
|
|
350
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
351
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
352
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
353
|
+
specific language governing permissions and limitations under the License.
|
|
354
|
+
````
|
|
355
|
+
|
|
356
|
+
### delaunator 5.1.0
|
|
357
|
+
|
|
358
|
+
````text
|
|
359
|
+
ISC License
|
|
360
|
+
|
|
361
|
+
Copyright (c) 2026, Mapbox
|
|
362
|
+
|
|
363
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
364
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
365
|
+
and this permission notice appear in all copies.
|
|
366
|
+
|
|
367
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
368
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
369
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
370
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
371
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
372
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
373
|
+
THIS SOFTWARE.
|
|
374
|
+
````
|
|
375
|
+
|
|
376
|
+
### internmap 2.0.3
|
|
377
|
+
|
|
378
|
+
````text
|
|
379
|
+
Copyright 2021 Mike Bostock
|
|
380
|
+
|
|
381
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
382
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
383
|
+
and this permission notice appear in all copies.
|
|
384
|
+
|
|
385
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
386
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
387
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
388
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
389
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
390
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
391
|
+
THIS SOFTWARE.
|
|
392
|
+
````
|
|
393
|
+
|
|
394
|
+
### robust-predicates 3.0.3
|
|
395
|
+
|
|
396
|
+
````text
|
|
397
|
+
This is free and unencumbered software released into the public domain.
|
|
398
|
+
|
|
399
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
400
|
+
distribute this software, either in source code form or as a compiled
|
|
401
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
402
|
+
means.
|
|
403
|
+
|
|
404
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
405
|
+
of this software dedicate any and all copyright interest in the
|
|
406
|
+
software to the public domain. We make this dedication for the benefit
|
|
407
|
+
of the public at large and to the detriment of our heirs and
|
|
408
|
+
successors. We intend this dedication to be an overt act of
|
|
409
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
410
|
+
software under copyright law.
|
|
411
|
+
|
|
412
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
413
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
414
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
415
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
416
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
417
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
418
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
419
|
+
|
|
420
|
+
For more information, please refer to <http://unlicense.org>
|
|
421
|
+
````
|
package/dist/annotate/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Annotations (P053): a person points at part of a display (an element, or text they select) to
|
|
3
|
-
* comment on it, and the host marks the anchors already made
|
|
3
|
+
* comment on it, and the host marks the anchors already made, each with a clickable marker and a
|
|
4
|
+
* number where it gives a count (P104). The host drives the shell with
|
|
4
5
|
* Porthole's own messages (`porthole/annotate.*`); the shell answers with anchors and where they
|
|
5
6
|
* are. An anchor is a set of W3C Web Annotation selectors, so it can be found again after the
|
|
6
7
|
* content changes; finding it is best-effort, and says so (`orphaned`).
|
|
@@ -40,7 +41,11 @@ export interface AnnotationAnchor {
|
|
|
40
41
|
/** A short description for the host to show ("h2#revenue Revenue grew 12%"); the content's. */
|
|
41
42
|
readonly label: string;
|
|
42
43
|
}
|
|
43
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* A box in the frame's viewport, CSS px: add the frame element's position to place it on the page.
|
|
46
|
+
* The page's word: the host clamps each it reports to the frame's viewport (P104), so one wholly
|
|
47
|
+
* outside is a box of no size on the nearest edge. A positioning hint only.
|
|
48
|
+
*/
|
|
44
49
|
export interface AnnotationRect {
|
|
45
50
|
readonly x: number;
|
|
46
51
|
readonly y: number;
|
|
@@ -54,10 +59,21 @@ export interface AnnotateMode {
|
|
|
54
59
|
/** Text, by selecting it: each settled selection is reported, and its clearing. */
|
|
55
60
|
readonly text?: boolean;
|
|
56
61
|
}
|
|
57
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* An anchor the host marks in the frame, under its own id. Everything here is sent into the
|
|
64
|
+
* frame, so the content can read it: give ids that say nothing (never a person's name or the
|
|
65
|
+
* comment's words).
|
|
66
|
+
*/
|
|
58
67
|
export interface AnnotationMark {
|
|
59
68
|
readonly id: string;
|
|
60
69
|
readonly anchor: AnnotationAnchor;
|
|
70
|
+
/**
|
|
71
|
+
* A marker (P104): with a count, the shell also draws a small bubble with this number (0 to
|
|
72
|
+
* `ANNOTATION_LIMITS.count`; above 99 it reads "99+", 0 draws the bubble alone) at the end of a
|
|
73
|
+
* text anchor and the top right of an element. The person can click it: the frame reports
|
|
74
|
+
* `activated`. The content can read the number; give one only where the page may know it.
|
|
75
|
+
*/
|
|
76
|
+
readonly count?: number;
|
|
61
77
|
}
|
|
62
78
|
/** Whether a mark's anchor was found in the content as it is now. */
|
|
63
79
|
export type AnchorState = "attached" | "orphaned";
|
|
@@ -83,10 +99,26 @@ export type AnnotationReport =
|
|
|
83
99
|
| {
|
|
84
100
|
readonly type: "cancelled";
|
|
85
101
|
}
|
|
86
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Where the marked anchors are now: every mark after `show`, the focused one after `focus`,
|
|
104
|
+
* every mark when the content changed one's state, and, while any mark has a `count`, once a
|
|
105
|
+
* scroll, a resize or a change of the content has settled, only the marks that moved since the
|
|
106
|
+
* host was last told, at most once a second (P104).
|
|
107
|
+
*/
|
|
87
108
|
| {
|
|
88
109
|
readonly type: "anchored";
|
|
89
110
|
readonly results: readonly AnchorResult[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The person clicked the marker of a mark the host shows with a `count` (P104); `rect` is the
|
|
114
|
+
* marker's box, to open the host's own UI beside it. The content can fake it for any mark the
|
|
115
|
+
* host shows with a count, and can tell a real one happened: open the host's own view of that
|
|
116
|
+
* mark, never act on it.
|
|
117
|
+
*/
|
|
118
|
+
| {
|
|
119
|
+
readonly type: "activated";
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly rect: AnnotationRect;
|
|
90
122
|
};
|
|
91
123
|
/** Porthole's own messages for annotations (own-prefixed, P002). */
|
|
92
124
|
export declare const ANNOTATE_METHODS: {
|
|
@@ -105,6 +137,8 @@ export declare const ANNOTATE_METHODS: {
|
|
|
105
137
|
readonly unselected: "porthole/annotate.unselected";
|
|
106
138
|
readonly cancelled: "porthole/annotate.cancelled";
|
|
107
139
|
readonly anchored: "porthole/annotate.anchored";
|
|
140
|
+
/** Frame → host: a mark's marker was clicked (P104). */
|
|
141
|
+
readonly activated: "porthole/annotate.activated";
|
|
108
142
|
};
|
|
109
143
|
/** The most of each part of an anchor or report the host takes. */
|
|
110
144
|
export declare const ANNOTATION_LIMITS: {
|
|
@@ -117,4 +151,6 @@ export declare const ANNOTATION_LIMITS: {
|
|
|
117
151
|
readonly id: 128;
|
|
118
152
|
readonly position: 50000000;
|
|
119
153
|
readonly coordinate: 10000000;
|
|
154
|
+
/** The largest `count` a mark's marker takes (P104). */
|
|
155
|
+
readonly count: 999;
|
|
120
156
|
};
|
package/dist/annotate/types.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Annotations (P053): a person points at part of a display (an element, or text they select) to
|
|
3
|
-
* comment on it, and the host marks the anchors already made
|
|
3
|
+
* comment on it, and the host marks the anchors already made, each with a clickable marker and a
|
|
4
|
+
* number where it gives a count (P104). The host drives the shell with
|
|
4
5
|
* Porthole's own messages (`porthole/annotate.*`); the shell answers with anchors and where they
|
|
5
6
|
* are. An anchor is a set of W3C Web Annotation selectors, so it can be found again after the
|
|
6
7
|
* content changes; finding it is best-effort, and says so (`orphaned`).
|
|
@@ -27,6 +28,8 @@ export const ANNOTATE_METHODS = {
|
|
|
27
28
|
unselected: "porthole/annotate.unselected",
|
|
28
29
|
cancelled: "porthole/annotate.cancelled",
|
|
29
30
|
anchored: "porthole/annotate.anchored",
|
|
31
|
+
/** Frame → host: a mark's marker was clicked (P104). */
|
|
32
|
+
activated: "porthole/annotate.activated",
|
|
30
33
|
};
|
|
31
34
|
/** The most of each part of an anchor or report the host takes. */
|
|
32
35
|
export const ANNOTATION_LIMITS = {
|
|
@@ -39,4 +42,6 @@ export const ANNOTATION_LIMITS = {
|
|
|
39
42
|
id: 128,
|
|
40
43
|
position: 50_000_000,
|
|
41
44
|
coordinate: 10_000_000,
|
|
45
|
+
/** The largest `count` a mark's marker takes (P104). */
|
|
46
|
+
count: 999,
|
|
42
47
|
};
|
|
@@ -3,6 +3,16 @@ import { type AnnotateMode, type AnnotationAnchor, type AnnotationMark, type Ann
|
|
|
3
3
|
export declare function parseAnchor(value: unknown): AnnotationAnchor | null;
|
|
4
4
|
/** A box in the frame's viewport; null unless every number is finite and sizes aren't negative. */
|
|
5
5
|
export declare function parseRect(value: unknown): AnnotationRect | null;
|
|
6
|
+
/**
|
|
7
|
+
* A box the frame reported, clamped to the frame's viewport (`width` by `height`, CSS px, P104):
|
|
8
|
+
* each side is held within it, so what overlaps the viewport keeps the part inside, and what lies
|
|
9
|
+
* wholly outside becomes a box of no size on the nearest edge. Where the viewport isn't known, a
|
|
10
|
+
* box of no size at the frame's corner. The page still chooses any point inside its own frame.
|
|
11
|
+
*/
|
|
12
|
+
export declare function clampRect(rect: AnnotationRect, viewport: {
|
|
13
|
+
readonly width: number;
|
|
14
|
+
readonly height: number;
|
|
15
|
+
} | undefined): AnnotationRect;
|
|
6
16
|
/** A report from the frame, checked; null if malformed (it is then dropped). */
|
|
7
17
|
export declare function parseReport(value: unknown): AnnotationReport | null;
|
|
8
18
|
/** What the host may start with: elements, text, or both (default both). */
|
|
@@ -82,6 +82,22 @@ export function parseRect(value) {
|
|
|
82
82
|
}
|
|
83
83
|
return { x, y, width, height };
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A box the frame reported, clamped to the frame's viewport (`width` by `height`, CSS px, P104):
|
|
87
|
+
* each side is held within it, so what overlaps the viewport keeps the part inside, and what lies
|
|
88
|
+
* wholly outside becomes a box of no size on the nearest edge. Where the viewport isn't known, a
|
|
89
|
+
* box of no size at the frame's corner. The page still chooses any point inside its own frame.
|
|
90
|
+
*/
|
|
91
|
+
export function clampRect(rect, viewport) {
|
|
92
|
+
const width = viewport !== undefined && Number.isFinite(viewport.width) ? viewport.width : 0;
|
|
93
|
+
const height = viewport !== undefined && Number.isFinite(viewport.height) ? viewport.height : 0;
|
|
94
|
+
const within = (value, most) => Math.min(Math.max(value, 0), Math.max(0, most));
|
|
95
|
+
const left = within(rect.x, width);
|
|
96
|
+
const top = within(rect.y, height);
|
|
97
|
+
const right = within(rect.x + rect.width, width);
|
|
98
|
+
const bottom = within(rect.y + rect.height, height);
|
|
99
|
+
return { x: left, y: top, width: right - left, height: bottom - top };
|
|
100
|
+
}
|
|
85
101
|
const markId = (value) => text(value, LIMITS.id, 1);
|
|
86
102
|
function results(value) {
|
|
87
103
|
if (!Array.isArray(value) || value.length > LIMITS.marks) {
|
|
@@ -126,6 +142,10 @@ export function parseReport(value) {
|
|
|
126
142
|
const checked = results(value.results);
|
|
127
143
|
return checked === null ? null : { type: "anchored", results: checked };
|
|
128
144
|
}
|
|
145
|
+
case "activated": {
|
|
146
|
+
const rect = parseRect(value.rect);
|
|
147
|
+
return !markId(value.id) || rect === null ? null : { type: "activated", id: value.id, rect };
|
|
148
|
+
}
|
|
129
149
|
default:
|
|
130
150
|
return null;
|
|
131
151
|
}
|
|
@@ -150,7 +170,10 @@ export function checkMarks(marks) {
|
|
|
150
170
|
if (!markId(mark?.id) || seen.has(mark.id) || anchor === null) {
|
|
151
171
|
throw new TypeError(`annotations.show: mark ${index} needs a unique id (1 to ${LIMITS.id} characters) and a valid anchor`);
|
|
152
172
|
}
|
|
173
|
+
if (mark.count !== undefined && !count(mark.count, LIMITS.count)) {
|
|
174
|
+
throw new TypeError(`annotations.show: mark ${index}'s count is a whole number from 0 to ${LIMITS.count}`);
|
|
175
|
+
}
|
|
153
176
|
seen.add(mark.id);
|
|
154
|
-
return { id: mark.id, anchor };
|
|
177
|
+
return { id: mark.id, anchor, ...(mark.count === undefined ? {} : { count: mark.count }) };
|
|
155
178
|
});
|
|
156
179
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What content said, as text a host can show (S05, P095), at a cost bounded whatever the frame
|
|
3
|
+
* sent. A frame's messages come structured-cloned, which keeps cycles and shared references (13
|
|
4
|
+
* objects each holding the next twice are 2^13 nodes written as a tree) and carries BigInt, Maps
|
|
5
|
+
* and nesting of any depth: `JSON.stringify` throws on the first and the second, and is
|
|
6
|
+
* exponential in the third.
|
|
7
|
+
*
|
|
8
|
+
* A string is as it is, cut. Anything else is written the way JSON writes it, with each object
|
|
9
|
+
* read once (`"[Circular]"` where it is inside itself, `"[Repeated]"` where it was written
|
|
10
|
+
* already), at most `nodes` values (`…` where it stops) and `depth` levels (`"[Object]"`,
|
|
11
|
+
* `"[Array]"` below), a boxed primitive as its value (as JSON does), a BigInt as `"5n"`
|
|
12
|
+
* (`"[BigInt]"` past 2,000 digits), a Date as its time, an Error as its name and message, any other
|
|
13
|
+
* object as its kind (`"[Map]"`), and anything that throws when read as `"[unreadable]"`; any of
|
|
14
|
+
* these but a boxed primitive and a Date means the text isn't `whole`. Every cut is `cutText`'s:
|
|
15
|
+
* no part of a sealed address's access is left at one. Never throws.
|
|
16
|
+
*/
|
|
17
|
+
export interface TextLimits {
|
|
18
|
+
/** The longest the text is. */
|
|
19
|
+
readonly chars: number;
|
|
20
|
+
/** The most values read. */
|
|
21
|
+
readonly nodes: number;
|
|
22
|
+
/** The deepest an object or array is read. */
|
|
23
|
+
readonly depth: number;
|
|
24
|
+
}
|
|
25
|
+
/** An error report's: read past what the bridge keeps (2,000 characters, after the scrub). */
|
|
26
|
+
export declare const REPORT_TEXT_LIMITS: TextLimits;
|
|
27
|
+
/** The text, and whether it is all of the value (nothing cut, stopped or left below the depth). */
|
|
28
|
+
export interface BoundedText {
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly whole: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** `value` as bounded text (above); with `indent`, as `JSON.stringify(value, null, indent)` lays it out. */
|
|
33
|
+
export declare function boundedText(value: unknown, limits?: TextLimits, indent?: number): string;
|
|
34
|
+
export declare function formatBounded(value: unknown, limits: TextLimits, indent?: number): BoundedText;
|