feat: upgrade to net9.0 and add TileJSON and Mapbox styles

This commit is contained in:
2025-01-13 16:01:22 +01:00
parent f65245c36d
commit 1d94420120
12 changed files with 3387 additions and 3473 deletions

View File

@@ -3,22 +3,25 @@
"isRoot": true,
"tools": {
"fable": {
"version": "4.1.4",
"version": "4.24.0",
"commands": [
"fable"
]
],
"rollForward": false
},
"fantomas": {
"version": "6.1.1",
"version": "7.0.0",
"commands": [
"fantomas"
]
],
"rollForward": false
},
"femto": {
"version": "0.18.0",
"version": "0.21.0",
"commands": [
"femto"
]
],
"rollForward": false
}
}
}

View File

@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM mcr.microsoft.com/dotnet/sdk:9.0
# Add keys and sources lists
RUN apt-get update && apt-get install -y ca-certificates gnupg
@@ -16,15 +16,6 @@ RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Install dotnet tools
RUN dotnet tool install fable -g
# Trouble brewing
RUN rm /etc/ssl/openssl.cnf
# add dotnet tools to path to pick up fake and paket installation
ENV PATH="/root/.dotnet/tools:${PATH}"
# Copy endpoint specific user settings into container to specify
# .NET Core should be used as the runtime.
COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json

View File

@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include=".build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" Version="6.1.0" />
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.0" />
<PackageReference Include="Fake.IO.FileSystem" Version="6.1.0" />
<PackageReference Include="Farmer" Version="1.9.1" />
<PackageReference Include="Fake.Core.Target" Version="6.1.3" />
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.3" />
<PackageReference Include="Fake.IO.FileSystem" Version="6.1.3" />
<PackageReference Include="Farmer" Version="1.9.10" />
</ItemGroup>
</Project>

6669
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,10 +9,11 @@
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/gitlab": "^13.2.1",
"@semantic-release/gitlab": "^13.2.3",
"semantic-release-dotnet": "^1.0.0"
},
"dependencies": {
"ol": "^10.1.0"
"ol": "^10.3.1",
"ol-mapbox-style": "^12.4.0"
}
}

View File

@@ -2,55 +2,56 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<IsPackable>true</IsPackable>
<PackageId>Fable.OpenLayers</PackageId>
<Authors/>
<Company/>
<Authors />
<Company />
<Version>2.17.5</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="Types.fs"/>
<Compile Include="Interop.fs"/>
<Compile Include="Event.fs"/>
<Compile Include="Observable.fs"/>
<Compile Include="Object.fs"/>
<Compile Include="Collection.fs"/>
<Compile Include="Proj4.fs"/>
<Compile Include="Proj.fs"/>
<Compile Include="Animation.fs"/>
<Compile Include="Ol.fs"/>
<Compile Include="Geom.fs"/>
<Compile Include="Coordinate.fs"/>
<Compile Include="Sphere.fs"/>
<Compile Include="Image.fs"/>
<Compile Include="Style.fs"/>
<Compile Include="Feature.fs"/>
<Compile Include="WebGL.fs"/>
<Compile Include="Render.fs"/>
<Compile Include="Renderer.fs"/>
<Compile Include="Format.fs"/>
<Compile Include="TileGrid.fs"/>
<Compile Include="Source.fs"/>
<Compile Include="Layer.fs"/>
<Compile Include="View.fs"/>
<Compile Include="Overlay.fs"/>
<Compile Include="Control.fs"/>
<Compile Include="Interaction.fs"/>
<Compile Include="Map.fs"/>
<Compile Include="Types.fs" />
<Compile Include="Interop.fs" />
<Compile Include="Event.fs" />
<Compile Include="Observable.fs" />
<Compile Include="Object.fs" />
<Compile Include="Collection.fs" />
<Compile Include="Proj4.fs" />
<Compile Include="Proj.fs" />
<Compile Include="Animation.fs" />
<Compile Include="Ol.fs" />
<Compile Include="Geom.fs" />
<Compile Include="Coordinate.fs" />
<Compile Include="Sphere.fs" />
<Compile Include="Image.fs" />
<Compile Include="Style.fs" />
<Compile Include="Feature.fs" />
<Compile Include="WebGL.fs" />
<Compile Include="Render.fs" />
<Compile Include="Renderer.fs" />
<Compile Include="Format.fs" />
<Compile Include="TileGrid.fs" />
<Compile Include="Source.fs" />
<Compile Include="Layer.fs" />
<Compile Include="View.fs" />
<Compile Include="Overlay.fs" />
<Compile Include="Control.fs" />
<Compile Include="Interaction.fs" />
<Compile Include="Mapbox.fs" />
<Compile Include="Map.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fable.Browser.Dom" Version="2.17.0"/>
<PackageReference Include="Fable.Browser.WebGL" Version="1.3.0"/>
<PackageReference Include="Fable.Core" Version="4.3.0"/>
<PackageReference Include="Fable.Browser.Dom" Version="2.18.0" />
<PackageReference Include="Fable.Browser.WebGL" Version="1.3.0" />
<PackageReference Include="Fable.Core" Version="4.3.0" />
</ItemGroup>
<PropertyGroup>
<NpmDependencies>
<NpmPackage Name="ol" Version="gte 10.1.0" ResolutionStrategy="Max"/>
<NpmPackage Name="ol" Version="gte 10.1.0" ResolutionStrategy="Max" />
</NpmDependencies>
</PropertyGroup>
<ItemGroup>
<Content Include="*.fsproj; *.fs" PackagePath="fable/"/>
<Content Include="*.fsproj; *.fs" PackagePath="fable/" />
</ItemGroup>
</Project>
</Project>

View File

@@ -27,3 +27,4 @@ module Interop =
let inline mkRendererProp (key: string) (value: obj): RendererProp = unbox (key, value)
let inline mkGlRendererProp (key: string) (value: obj): GlRendererProp = unbox (key, value)
let inline mkGeometryProp (key: string) (value: obj): GeometryProp = unbox (key, value)
let inline mkTileJsonProp (key: string) (value: obj) : TileJsonProp = unbox (key, value)

20
src/Mapbox.fs Normal file
View File

@@ -0,0 +1,20 @@
namespace Fable.OpenLayers
open Browser.Types
open Fable.Core
open Fable.Core.JsInterop
open Fable.OpenLayers
open Fable.OpenLayers.Proj
open Microsoft.FSharp.Core
module Mapbox =
module Style =
[<Import("apply", "ol-mapbox-style")>]
let apply (map: string) (url: string) = jsNative
[<Import("applyStyle", "ol-mapbox-style")>]
let applyStyle (layer: Layer) (url: string) (options: obj) = jsNative
[<Import("applyBackground", "ol-mapbox-style")>]
let applyBackground (layer: Layer) (url: string) (options: obj) = jsNative

View File

@@ -64,6 +64,14 @@ module Source =
let opts = keyValueList CaseRules.LowerFirst options
createTileWMS opts
[<Import("default", "ol/source/TileJSON")>]
[<Emit("new TileJSON($1)")>]
let private createTileJSON (opts: obj) : TileImage = jsNative
let tileJSON (options: SourceProp seq) =
let opts = keyValueList CaseRules.LowerFirst options
createTileJSON opts
[<Import("default", "ol/source/Vector")>]
[<Emit("new Vector($1)")>]
let private createVectorSource (opts: obj): VectorSource = jsNative
@@ -113,6 +121,20 @@ type RasterOperation = obj -> obj
type CanvasFunction = Extent * Resolution * Size * Projection -> HTMLCanvasElement
type TileJsonConfig =
static member inline name (value: string) = Interop.mkTileJsonProp "name" value
static member inline description (value: string) = Interop.mkTileJsonProp "description" value
static member inline version (value: string) = Interop.mkTileJsonProp "version" value
static member inline attribution (value: string) = Interop.mkTileJsonProp "attribution" value
static member inline template (value: string) = Interop.mkTileJsonProp "template" value
static member inline scheme (value: string) = Interop.mkTileJsonProp "scheme" value
static member inline tiles (value: string[]) = Interop.mkTileJsonProp "tiles" value
static member inline grids (value: string[]) = Interop.mkTileJsonProp "grids" value
static member inline minzoom (value: float) = Interop.mkTileJsonProp "minzoom" value
static member inline maxzoom (value: float) = Interop.mkTileJsonProp "maxzoom" value
static member inline bounds (value: float[]) = Interop.mkTileJsonProp "bounds" value
static member inline center (value: float[]) = Interop.mkTileJsonProp "center" value
type source =
static member inline attributions (value: string) = Interop.mkSourceProp "attributions" value
static member inline attributions (value: string []) = Interop.mkSourceProp "attributions" value
@@ -189,6 +211,12 @@ type source =
static member inline ratio (value: float) = Interop.mkSourceProp "ratio" value
static member inline resolutions (value: float []) = Interop.mkSourceProp "resolutions" value
// TileJSON
static member inline jsonp (value: bool) = Interop.mkSourceProp "jsonp" value
static member inline tileJSON (value: TileJsonConfig seq) =
let opts = keyValueList CaseRules.LowerFirst value
Interop.mkSourceProp "tileJSON" opts
type cluster =
/// <summary>
/// Attributions
@@ -250,4 +278,4 @@ type cluster =
/// Whether to wrap the world horizontally
/// </summary>
/// <param name="value"></param>
static member inline wrapX (value: bool) = Interop.mkClusterSourceProp "wrapX" value
static member inline wrapX (value: bool) = Interop.mkClusterSourceProp "wrapX" value

View File

@@ -44,6 +44,7 @@ type EasingFunction = float -> float
[<Erase>] type RendererProp = interface end
[<Erase>] type GlRendererProp = interface end
[<Erase>] type GeometryProp = interface end
[<Erase>] type TileJsonProp = interface end
[<AutoOpen>]
module Options =
@@ -157,4 +158,3 @@ module State =
mapId: unit
renderTargets: unit
}

View File

@@ -1,16 +1,16 @@
{
"version": 1,
"dependencies": {
"net8.0": {
"net9.0": {
"Fable.Browser.Dom": {
"type": "Direct",
"requested": "[2.17.0, )",
"resolved": "2.17.0",
"contentHash": "3hwWkRkAszcvzsWC5k/PHW5E5on9ZnU80GOjjE9jz3FLXZESZxHm/19PHU7d7j4FbYzaajGe9IZuNvSXdbtJEg==",
"requested": "[2.18.0, )",
"resolved": "2.18.0",
"contentHash": "usu19HS3yRIPvzQ//Yj+Dp6SkJ1fkVUVOREaeDR4iLXGTKl0UqR1nPT1tEBX2GGMefj7dVrmG0dbONirOlVFBw==",
"dependencies": {
"FSharp.Core": "4.7.2",
"Fable.Browser.Blob": "1.4.0",
"Fable.Browser.Event": "1.6.0",
"Fable.Browser.Event": "1.7.0",
"Fable.Browser.WebStorage": "1.3.0",
"Fable.Core": "3.2.8"
}
@@ -35,9 +35,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.300, )",
"resolved": "8.0.300",
"contentHash": "Jv44fV7TNglyMku89lQcA4Q6mFKLyHb2bs1Yb72nvSVc+cHplEnoZ4XQUaaTLJGUTx/iMqcrkYGtaLzkkIhpaA=="
"requested": "[9.0.100, )",
"resolved": "9.0.100",
"contentHash": "ye8yagHGsH08H2Twno5GRWkSbrMtxK/SWiHuPcF+3nODpW65/VJ8RO0aWxp8n9+KQbmahg90wAEL3TEXjF0r6A=="
},
"Fable.Browser.Blob": {
"type": "Transitive",
@@ -50,8 +50,8 @@
},
"Fable.Browser.Event": {
"type": "Transitive",
"resolved": "1.6.0",
"contentHash": "0oog9V+AT4LRmfgFHRljTiBL+kT0HHbATxFMd6kUDDIXYwZmT4EU/ykbeAMmHtpLEwUnt3u6OpxlxZ1WiRnkIw==",
"resolved": "1.7.0",
"contentHash": "x+wqXQK0l4VlCnELDp68GC/mZAx6NbicDxYPliyAoNq8RPNDeR3R782icNwI5YmA+ufq11XvG6w1JjsL/ldy7w==",
"dependencies": {
"FSharp.Core": "4.7.2",
"Fable.Browser.Gamepad": "1.3.0",

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />