@honua/app-platform 0.1.12 → 0.1.14

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.
Files changed (238) hide show
  1. package/columnar/apache-arrow.d.ts +17 -0
  2. package/columnar/apache-arrow.d.ts.map +1 -0
  3. package/columnar/apache-arrow.js +1036 -0
  4. package/columnar/batch-cache-conformance.d.ts +66 -0
  5. package/columnar/batch-cache-conformance.d.ts.map +1 -0
  6. package/columnar/batch-cache-conformance.js +317 -0
  7. package/columnar/batch-cache-indexeddb.d.ts +31 -0
  8. package/columnar/batch-cache-indexeddb.d.ts.map +1 -0
  9. package/columnar/batch-cache-indexeddb.js +148 -0
  10. package/columnar/batch-cache.d.ts +298 -0
  11. package/columnar/batch-cache.d.ts.map +1 -0
  12. package/columnar/batch-cache.js +757 -0
  13. package/columnar/geoarrow-aggregate.d.ts +178 -0
  14. package/columnar/geoarrow-aggregate.d.ts.map +1 -0
  15. package/columnar/geoarrow-aggregate.js +976 -0
  16. package/columnar/geoarrow-patch.d.ts +382 -0
  17. package/columnar/geoarrow-patch.d.ts.map +1 -0
  18. package/columnar/geoarrow-patch.js +1656 -0
  19. package/columnar/geoarrow-reproject.d.ts +22 -0
  20. package/columnar/geoarrow-reproject.d.ts.map +1 -0
  21. package/columnar/geoarrow-reproject.js +119 -0
  22. package/columnar/geoarrow-serialization.d.ts +68 -0
  23. package/columnar/geoarrow-serialization.d.ts.map +1 -0
  24. package/columnar/geoarrow-serialization.js +331 -0
  25. package/columnar/geoarrow-types.d.ts +271 -0
  26. package/columnar/geoarrow-types.d.ts.map +1 -0
  27. package/columnar/geoarrow-types.js +15 -0
  28. package/columnar/geoarrow.d.ts +52 -0
  29. package/columnar/geoarrow.d.ts.map +1 -0
  30. package/columnar/geoarrow.js +1469 -0
  31. package/columnar/index.d.ts +43 -0
  32. package/columnar/index.d.ts.map +1 -0
  33. package/columnar/index.js +29 -0
  34. package/columnar/operators.d.ts +70 -0
  35. package/columnar/operators.d.ts.map +1 -0
  36. package/columnar/operators.js +307 -0
  37. package/columnar/result.d.ts +369 -0
  38. package/columnar/result.d.ts.map +1 -0
  39. package/columnar/result.js +815 -0
  40. package/columnar/telemetry.d.ts +152 -0
  41. package/columnar/telemetry.d.ts.map +1 -0
  42. package/columnar/telemetry.js +265 -0
  43. package/columnar/transfer.d.ts +28 -0
  44. package/columnar/transfer.d.ts.map +1 -0
  45. package/columnar/transfer.js +669 -0
  46. package/columnar/types.d.ts +175 -0
  47. package/columnar/types.d.ts.map +1 -0
  48. package/columnar/types.js +22 -0
  49. package/columnar/worker.d.ts +157 -0
  50. package/columnar/worker.d.ts.map +1 -0
  51. package/columnar/worker.js +1059 -0
  52. package/contract/pmtiles.d.ts +6 -5
  53. package/contract/pmtiles.d.ts.map +1 -1
  54. package/contract/pmtiles.js +30 -5
  55. package/contract/source.d.ts.map +1 -1
  56. package/contract/source.js +11 -8
  57. package/controls/catalog.d.ts.map +1 -1
  58. package/controls/catalog.js +110 -0
  59. package/controls/index.d.ts +1 -1
  60. package/controls/index.js +1 -1
  61. package/controls/types.d.ts +1 -1
  62. package/controls/types.js +1 -1
  63. package/core/client.d.ts.map +1 -1
  64. package/core/client.js +87 -19
  65. package/core/deprecation-notice.d.ts +28 -0
  66. package/core/deprecation-notice.d.ts.map +1 -0
  67. package/core/deprecation-notice.js +22 -0
  68. package/core/esri-geojson.d.ts.map +1 -1
  69. package/core/esri-geojson.js +14 -8
  70. package/core/optional-grpc-peer.d.ts +15 -0
  71. package/core/optional-grpc-peer.d.ts.map +1 -0
  72. package/core/optional-grpc-peer.js +60 -0
  73. package/esri-compat/basemap-gallery.d.ts +2 -0
  74. package/esri-compat/basemap-gallery.d.ts.map +1 -1
  75. package/esri-compat/basemap-gallery.js +12 -0
  76. package/esri-compat/basemap.d.ts +4 -0
  77. package/esri-compat/basemap.d.ts.map +1 -1
  78. package/esri-compat/basemap.js +70 -0
  79. package/esri-compat/bookmarks.d.ts +2 -0
  80. package/esri-compat/bookmarks.d.ts.map +1 -1
  81. package/esri-compat/bookmarks.js +12 -0
  82. package/esri-compat/controls.d.ts +18 -0
  83. package/esri-compat/controls.d.ts.map +1 -1
  84. package/esri-compat/controls.js +120 -57
  85. package/esri-compat/directions.d.ts +4 -0
  86. package/esri-compat/directions.d.ts.map +1 -1
  87. package/esri-compat/directions.js +30 -20
  88. package/esri-compat/editor.d.ts +4 -0
  89. package/esri-compat/editor.d.ts.map +1 -1
  90. package/esri-compat/editor.js +16 -0
  91. package/esri-compat/esri-config.d.ts +2 -1
  92. package/esri-compat/esri-config.d.ts.map +1 -1
  93. package/esri-compat/feature-effect.d.ts +23 -0
  94. package/esri-compat/feature-effect.d.ts.map +1 -0
  95. package/esri-compat/feature-effect.js +12 -0
  96. package/esri-compat/feature-form.d.ts +6 -0
  97. package/esri-compat/feature-form.d.ts.map +1 -1
  98. package/esri-compat/feature-form.js +63 -0
  99. package/esri-compat/feature-layer.d.ts +21 -2
  100. package/esri-compat/feature-layer.d.ts.map +1 -1
  101. package/esri-compat/feature-layer.js +172 -1
  102. package/esri-compat/feature-table.d.ts +5 -0
  103. package/esri-compat/feature-table.d.ts.map +1 -1
  104. package/esri-compat/feature-table.js +23 -0
  105. package/esri-compat/identity-manager.d.ts +1 -1
  106. package/esri-compat/identity-manager.js +1 -1
  107. package/esri-compat/legend.d.ts +2 -0
  108. package/esri-compat/legend.d.ts.map +1 -1
  109. package/esri-compat/legend.js +98 -0
  110. package/esri-compat/locator.d.ts +1 -1
  111. package/esri-compat/locator.js +1 -1
  112. package/esri-compat/map-view-mount.d.ts +1 -0
  113. package/esri-compat/map-view-mount.d.ts.map +1 -1
  114. package/esri-compat/map-view-mount.js +46 -25
  115. package/esri-compat/map-view.d.ts +13 -0
  116. package/esri-compat/map-view.d.ts.map +1 -1
  117. package/esri-compat/map-view.js +94 -8
  118. package/esri-compat/map.d.ts +5 -1
  119. package/esri-compat/map.d.ts.map +1 -1
  120. package/esri-compat/map.js +10 -0
  121. package/esri-compat/measurement.d.ts +2 -0
  122. package/esri-compat/measurement.d.ts.map +1 -1
  123. package/esri-compat/measurement.js +14 -0
  124. package/esri-compat/point.d.ts +7 -0
  125. package/esri-compat/point.d.ts.map +1 -1
  126. package/esri-compat/point.js +33 -3
  127. package/esri-compat/popup.d.ts +2 -0
  128. package/esri-compat/popup.d.ts.map +1 -1
  129. package/esri-compat/popup.js +12 -0
  130. package/esri-compat/portal.d.ts +1 -1
  131. package/esri-compat/portal.js +1 -1
  132. package/esri-compat/print.d.ts +3 -0
  133. package/esri-compat/print.d.ts.map +1 -1
  134. package/esri-compat/print.js +15 -0
  135. package/esri-compat/search.d.ts +4 -0
  136. package/esri-compat/search.d.ts.map +1 -1
  137. package/esri-compat/search.js +25 -28
  138. package/esri-compat/sketch.d.ts +2 -0
  139. package/esri-compat/sketch.d.ts.map +1 -1
  140. package/esri-compat/sketch.js +12 -0
  141. package/esri-compat/widget-host.d.ts +46 -17
  142. package/esri-compat/widget-host.d.ts.map +1 -1
  143. package/esri-compat/widget-host.js +84 -20
  144. package/esri-compat/widget-shell-hosts.d.ts +61 -0
  145. package/esri-compat/widget-shell-hosts.d.ts.map +1 -0
  146. package/esri-compat/widget-shell-hosts.js +76 -0
  147. package/kernel/renderer.d.ts +82 -0
  148. package/kernel/renderer.js +1 -0
  149. package/offline/conflict-resolution.d.ts +183 -0
  150. package/offline/conflict-resolution.d.ts.map +1 -0
  151. package/offline/conflict-resolution.js +286 -0
  152. package/offline/credential-screen.d.ts +34 -0
  153. package/offline/credential-screen.d.ts.map +1 -0
  154. package/offline/credential-screen.js +78 -0
  155. package/offline/digest.d.ts +15 -0
  156. package/offline/digest.d.ts.map +1 -0
  157. package/offline/digest.js +58 -0
  158. package/offline/edit-queue.d.ts +403 -0
  159. package/offline/edit-queue.d.ts.map +1 -0
  160. package/offline/edit-queue.js +1807 -0
  161. package/offline/edit-replay.d.ts +116 -0
  162. package/offline/edit-replay.d.ts.map +1 -0
  163. package/offline/edit-replay.js +392 -0
  164. package/offline/fetch-handler.d.ts +12 -0
  165. package/offline/fetch-handler.d.ts.map +1 -0
  166. package/offline/fetch-handler.js +65 -0
  167. package/offline/index.d.ts +52 -0
  168. package/offline/index.d.ts.map +1 -0
  169. package/offline/index.js +34 -0
  170. package/offline/indexeddb.d.ts +135 -0
  171. package/offline/indexeddb.d.ts.map +1 -0
  172. package/offline/indexeddb.js +888 -0
  173. package/offline/memory-store.d.ts +17 -0
  174. package/offline/memory-store.d.ts.map +1 -0
  175. package/offline/memory-store.js +183 -0
  176. package/offline/quota.d.ts +161 -0
  177. package/offline/quota.d.ts.map +1 -0
  178. package/offline/quota.js +370 -0
  179. package/offline/read-gate.d.ts +175 -0
  180. package/offline/read-gate.d.ts.map +1 -0
  181. package/offline/read-gate.js +252 -0
  182. package/offline/read-resource.d.ts +99 -0
  183. package/offline/read-resource.d.ts.map +1 -0
  184. package/offline/read-resource.js +156 -0
  185. package/offline/read.d.ts +50 -0
  186. package/offline/read.d.ts.map +1 -0
  187. package/offline/read.js +65 -0
  188. package/offline/region.d.ts +29 -0
  189. package/offline/region.d.ts.map +1 -0
  190. package/offline/region.js +1007 -0
  191. package/offline/replay-conflict.d.ts +183 -0
  192. package/offline/replay-conflict.d.ts.map +1 -0
  193. package/offline/replay-conflict.js +482 -0
  194. package/offline/selection.d.ts +140 -0
  195. package/offline/selection.d.ts.map +1 -0
  196. package/offline/selection.js +391 -0
  197. package/offline/snapshot.d.ts +132 -0
  198. package/offline/snapshot.d.ts.map +1 -0
  199. package/offline/snapshot.js +312 -0
  200. package/offline/status.d.ts +136 -0
  201. package/offline/status.d.ts.map +1 -0
  202. package/offline/status.js +479 -0
  203. package/offline/store-conformance.d.ts +48 -0
  204. package/offline/store-conformance.d.ts.map +1 -0
  205. package/offline/store-conformance.js +233 -0
  206. package/offline/tile-protocol.d.ts +81 -0
  207. package/offline/tile-protocol.d.ts.map +1 -0
  208. package/offline/tile-protocol.js +119 -0
  209. package/offline/types.d.ts +349 -0
  210. package/offline/types.d.ts.map +1 -0
  211. package/offline/types.js +75 -0
  212. package/package.json +14 -2
  213. package/realtime/odata-delta.d.ts +1 -1
  214. package/realtime/odata-delta.d.ts.map +1 -1
  215. package/realtime/odata-delta.js +38 -10
  216. package/scene-workspace/index.d.ts +2 -2
  217. package/scene-workspace/index.d.ts.map +1 -1
  218. package/scene-workspace/index.js +1 -1
  219. package/scene-workspace/scene-discovery.d.ts +111 -91
  220. package/scene-workspace/scene-discovery.d.ts.map +1 -1
  221. package/scene-workspace/scene-discovery.js +340 -92
  222. package/scene-workspace/scene-view.d.ts +6 -6
  223. package/scene-workspace/scene-view.d.ts.map +1 -1
  224. package/scene-workspace/scene-view.js +32 -6
  225. package/web-components/elements.d.ts +34 -0
  226. package/web-components/elements.d.ts.map +1 -1
  227. package/web-components/elements.js +82 -8
  228. package/web-components/index.d.ts +2 -0
  229. package/web-components/index.d.ts.map +1 -1
  230. package/web-components/index.js +3 -1
  231. package/web-components/map-chrome.d.ts +103 -0
  232. package/web-components/map-chrome.d.ts.map +1 -0
  233. package/web-components/map-chrome.js +325 -0
  234. package/web-components/widget-shell.d.ts +68 -0
  235. package/web-components/widget-shell.d.ts.map +1 -0
  236. package/web-components/widget-shell.js +224 -0
  237. package/widget-capabilities.d.ts +67 -0
  238. package/widget-capabilities.js +152 -0
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Pure helpers behind sketch snapping, histogram bins, form expressions,
3
+ * multi-feature edits, and elevation samples.
4
+ */
5
+ export function snapVertex(pointer, vertices, enabled, tolerance = 1) {
6
+ if (!enabled || vertices.length === 0)
7
+ return { ...pointer };
8
+ let nearest = vertices[0];
9
+ let nearestDistance = distance(pointer, nearest);
10
+ for (const vertex of vertices.slice(1)) {
11
+ const candidate = distance(pointer, vertex);
12
+ if (candidate < nearestDistance) {
13
+ nearest = vertex;
14
+ nearestDistance = candidate;
15
+ }
16
+ }
17
+ return nearestDistance <= tolerance ? { x: nearest.x, y: nearest.y } : { ...pointer };
18
+ }
19
+ function distance(a, b) {
20
+ return Math.hypot(a.x - b.x, a.y - b.y);
21
+ }
22
+ export function histogramBins(values, stats, classes, method) {
23
+ if (classes < 1)
24
+ throw new Error("histogram classes must be at least 1");
25
+ assertStats(values, stats);
26
+ const breaks = method === "quantile" ? quantileEdges(values, classes) : equalIntervalEdges(stats.min, stats.max, classes);
27
+ const bins = [];
28
+ for (let index = 0; index < breaks.length - 1; index += 1) {
29
+ const min = breaks[index] ?? stats.min;
30
+ const max = breaks[index + 1] ?? stats.max;
31
+ const last = index === breaks.length - 2;
32
+ const value = values.filter((item) => (last ? item >= min && item <= max : item >= min && item < max)).length;
33
+ bins.push({ label: `${min}–${max}`, min, max, value });
34
+ }
35
+ return bins;
36
+ }
37
+ export function histogramRangeFilter(min, max) {
38
+ return `value >= ${min} AND value <= ${max}`;
39
+ }
40
+ function assertStats(values, stats) {
41
+ const count = values.length;
42
+ const sum = values.reduce((total, value) => total + value, 0);
43
+ const min = values.length === 0 ? Number.NaN : Math.min(...values);
44
+ const max = values.length === 0 ? Number.NaN : Math.max(...values);
45
+ const average = count === 0 ? Number.NaN : sum / count;
46
+ if (stats.count !== count ||
47
+ stats.sum !== sum ||
48
+ stats.min !== min ||
49
+ stats.max !== max ||
50
+ stats.average !== average) {
51
+ throw new Error("histogram statistics do not match the feature values");
52
+ }
53
+ }
54
+ function equalIntervalEdges(min, max, classes) {
55
+ const width = classes === 0 ? 0 : (max - min) / classes;
56
+ return Array.from({ length: classes + 1 }, (_, index) => min + width * index);
57
+ }
58
+ function quantileEdges(values, classes) {
59
+ const sorted = [...values].sort((a, b) => a - b);
60
+ if (sorted.length === 0)
61
+ return [0, 0];
62
+ const edges = [sorted[0] ?? 0];
63
+ for (let index = 1; index < classes; index += 1) {
64
+ const position = (index * (sorted.length - 1)) / classes;
65
+ const lower = Math.floor(position);
66
+ const upper = Math.ceil(position);
67
+ const weight = position - lower;
68
+ const left = sorted[lower] ?? sorted[0] ?? 0;
69
+ const right = sorted[upper] ?? left;
70
+ edges.push(left + (right - left) * weight);
71
+ }
72
+ edges.push(sorted[sorted.length - 1] ?? edges[0] ?? 0);
73
+ return edges;
74
+ }
75
+ export function evaluateFormExpressions(fields, feature) {
76
+ const hidden = [];
77
+ const values = {};
78
+ const errors = [];
79
+ for (const field of fields) {
80
+ if (field.visibleExpression) {
81
+ const visible = evaluateExpression(field.visibleExpression, feature.attributes ?? {}, field.name, errors);
82
+ if (visible === false)
83
+ hidden.push(field.name);
84
+ }
85
+ if (field.valueExpression) {
86
+ const value = evaluateExpression(field.valueExpression, feature.attributes ?? {}, field.name, errors);
87
+ if (value !== undefined &&
88
+ !errors.some((error) => error.field === field.name && error.message.includes(field.valueExpression ?? ""))) {
89
+ values[field.name] = value;
90
+ }
91
+ }
92
+ }
93
+ return { hidden, values, errors };
94
+ }
95
+ function evaluateExpression(expression, attributes, field, errors) {
96
+ const call = expression.match(/^([A-Za-z_][A-Za-z0-9_]*)\(/);
97
+ if (call && call[1] !== "Number") {
98
+ errors.push({ field, message: `unknown function ${call[1]} in ${expression}` });
99
+ return undefined;
100
+ }
101
+ const equality = expression.match(/^\$feature\.([A-Za-z0-9_]+)\s*==\s*'([^']*)'$/);
102
+ if (equality)
103
+ return attributes[equality[1] ?? ""] === equality[2];
104
+ const sum = expression.match(/^\$feature\.([A-Za-z0-9_]+)\s*\+\s*\$feature\.([A-Za-z0-9_]+)$/);
105
+ if (sum)
106
+ return Number(attributes[sum[1] ?? ""]) + Number(attributes[sum[2] ?? ""]);
107
+ const reference = expression.match(/^\$feature\.([A-Za-z0-9_]+)$/);
108
+ if (reference)
109
+ return attributes[reference[1] ?? ""];
110
+ errors.push({ field, message: `unsupported expression ${expression}` });
111
+ return undefined;
112
+ }
113
+ export async function applyToFeatures(features, change, applyEdits) {
114
+ const applied = [];
115
+ const rejected = [];
116
+ for (const feature of features) {
117
+ const update = { attributes: { ...(feature.attributes ?? {}), ...change } };
118
+ const result = await applyEdits({ update });
119
+ if (result.error || result.reason)
120
+ rejected.push({ feature, reason: result.reason ?? result.error ?? "rejected" });
121
+ else
122
+ applied.push(update);
123
+ }
124
+ return { applied, rejected };
125
+ }
126
+ export function sampleElevations(line, terrain, spacing = 1) {
127
+ if (!terrain)
128
+ return { samples: [], error: "terrain-missing" };
129
+ const densified = densify(line, spacing);
130
+ return {
131
+ samples: densified.map((position) => ({
132
+ position,
133
+ elevation: terrain.elevationAt(position[0], position[1]),
134
+ })),
135
+ };
136
+ }
137
+ function densify(line, spacing) {
138
+ if (line.length === 0)
139
+ return [];
140
+ const points = [line[0]];
141
+ for (let index = 1; index < line.length; index += 1) {
142
+ const start = line[index - 1];
143
+ const end = line[index];
144
+ const length = Math.hypot(end[0] - start[0], end[1] - start[1]);
145
+ const steps = Math.max(1, Math.ceil(length / spacing));
146
+ for (let step = 1; step <= steps; step += 1) {
147
+ const t = step / steps;
148
+ points.push([start[0] + (end[0] - start[0]) * t, start[1] + (end[1] - start[1]) * t]);
149
+ }
150
+ }
151
+ return points;
152
+ }