@arcgis/core 4.33.0-next.20250311 → 4.33.0-next.20250312
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{bc988b9d3990380be907.js → 0a98dc3ea67ce97a6e7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{eacab4bd6eb58e545f73.js → 11f9d7cd95891596b716.js} +1 -1
- package/assets/esri/core/workers/chunks/{5b1b93665c93955491c4.js → 3ee2cf2db08164cde43c.js} +44 -44
- package/assets/esri/core/workers/chunks/4d95cc85f4b73e857b1f.js +1 -0
- package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +1 -0
- package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +1 -0
- package/assets/esri/core/workers/chunks/add0770399a63b7635b5.js +1 -0
- package/assets/esri/core/workers/chunks/b2f8702a9f54fff23ad9.js +1 -0
- package/assets/esri/core/workers/chunks/b8b8425e8b1246cdc86d.js +1 -0
- package/assets/esri/core/workers/chunks/{0137c17f15d79134b4ca.js → d0ad20548eb4786b7750.js} +36 -36
- package/assets/esri/core/workers/chunks/d0fbd4c6bffe0cb98d14.js +1 -0
- package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +1 -0
- package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +1 -0
- package/assets/esri/core/workers/chunks/fc7ce48c7b31a4665a9b.js +1 -0
- package/chunks/DefaultMaterial.glsl.js +21 -21
- package/chunks/Pattern.glsl.js +23 -25
- package/chunks/RealisticTree.glsl.js +12 -12
- package/chunks/Terrain.glsl.js +27 -27
- package/core/LRUCache.js +1 -1
- package/core/MemCache.js +1 -1
- package/geometry/support/ShortArray.js +5 -0
- package/interfaces.d.ts +18 -4
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -77
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/widgets/support/goToUtils.js +1 -1
- package/assets/esri/core/workers/chunks/3bbf7f89bc37c01b453b.js +0 -1
- package/assets/esri/core/workers/chunks/40f2c8022fd583c43f42.js +0 -1
- package/assets/esri/core/workers/chunks/4f2bb248dd258b493663.js +0 -1
- package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +0 -1
- package/assets/esri/core/workers/chunks/54b115ecf446b4095d3e.js +0 -1
- package/assets/esri/core/workers/chunks/5a536de1ecae424bad05.js +0 -1
- package/assets/esri/core/workers/chunks/7ca9230681d05ef89059.js +0 -1
- package/assets/esri/core/workers/chunks/840c02610d845114ace7.js +0 -1
- package/assets/esri/core/workers/chunks/a4228101f709f0bb9a3d.js +0 -1
- package/assets/esri/core/workers/chunks/ffd28a9b1d8db3a731f4.js +0 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +0 -5
package/chunks/Terrain.glsl.js
CHANGED
|
@@ -2,42 +2,42 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{translate as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as o,i as a}from"./vec32.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{OverlayContent as l}from"../views/3d/terrain/OverlayContent.js";import{TransparencyMode as t}from"../views/3d/terrain/TransparencyMode.js";import{addLinearDepth as n,addNearFar as s,ForwardLinearDepth as c}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as d}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as v}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{NormalAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{
|
|
5
|
+
import{translate as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as o,i as a}from"./vec32.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{OverlayContent as l}from"../views/3d/terrain/OverlayContent.js";import{TransparencyMode as t}from"../views/3d/terrain/TransparencyMode.js";import{addLinearDepth as n,addNearFar as s,ForwardLinearDepth as c}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as d}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as v}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{NormalAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexTangent as f}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js";import{OutputDepth as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as h}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientOcclusion as u}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as b,addAmbientBoostFactor as C,addLightingGlobalFactor as y}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightDirection as x,addMainLightIntensity as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as j}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PBRMode as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapDraw as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayMode as T,OverlayTerrain as z}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{OverlayTerrainPassParameters as P,TerrainTexture as M}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js";import{addProjViewLocalOrigin as $,addViewNormal as N,addCameraPosition as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3BindUniform as W}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{glsl as V,If as A}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4DrawUniform as F}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{Texture2DBindUniform as U}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{VertexAttribute as _}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as B}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as H}from"../webscene/support/AlphaCutoff.js";class I extends P{}function k(r){const i=new B,{attributes:P,vertex:I,fragment:k,varyings:G}=i,{output:R,pbrMode:J,overlayMode:K,tileBorders:Q,spherical:X,transparencyMode:Y,screenSizePerspective:Z}=r;i.include(g,r),i.include(p,r);const ee=()=>{i.include(j,r),I.code.add(V`vec3 getNormal() {
|
|
6
6
|
float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y);
|
|
7
7
|
vec3 n = vec3(normalCompressed + vec2(normalCompressed.x >= 0.0 ? 1.0 : -1.0,
|
|
8
8
|
normalCompressed.y >= 0.0 ? 1.0 : -1.0) * min(z, 0.0), z);
|
|
9
9
|
return normalize(n);
|
|
10
|
-
}`)}
|
|
10
|
+
}`)};$(I,r),P.add(_.POSITION,"vec3"),i.include(v,r);const re=Y===t.InvisibleWithDraped||Y===t.Invisible,oe=K!==T.Disabled,ae=oe&&re;switch(R){case d.ColorEmission:case d.Color:{i.include(M,r),i.include(b,r),oe&&(r.pbrMode=J===S.Simplified?S.TerrainWithWater:S.Water,i.include(z,r),r.pbrMode=J);const t=K===T.EnabledWithWater;t&&i.include(f,r),G.add("vnormal","vec3"),G.add("vpos","vec3",{invariant:!0}),G.add("vup","vec3"),ee(),Z&&N(I);const n=r.receiveShadows&&!r.renderOccluded;n&&i.include(c,r),Z&&(G.add("screenSizeDistanceToCamera","float"),G.add("screenSizeCosAngle","float")),I.main.add(V`
|
|
11
11
|
vpos = position;
|
|
12
12
|
vec3 positionWorld = position + localOrigin;
|
|
13
13
|
gl_Position = transformPosition(proj, view, vpos);
|
|
14
14
|
vnormal = getNormal();
|
|
15
15
|
vup = getLocalUp(position, localOrigin);
|
|
16
|
-
${
|
|
16
|
+
${A(t,V`forwardVertexTangent(vnormal);`)}
|
|
17
17
|
|
|
18
18
|
vec2 uv = getUV0();
|
|
19
19
|
forwardTextureCoordinatesWithTransform(uv);
|
|
20
|
-
${
|
|
21
|
-
${
|
|
22
|
-
${
|
|
20
|
+
${A(oe,"setOverlayVTC(uv);")}
|
|
21
|
+
${A(Q,"forwardTextureCoordinates();")}
|
|
22
|
+
${A(Z,V`vec3 viewPos = (view * vec4(vpos, 1.0)).xyz;
|
|
23
23
|
screenSizeDistanceToCamera = length(viewPos);
|
|
24
24
|
vec3 viewSpaceNormal = (viewNormal * vec4(normalize(positionWorld), 1.0)).xyz;
|
|
25
25
|
screenSizeCosAngle = abs(viewSpaceNormal.z);`)}
|
|
26
|
-
${
|
|
26
|
+
${A(n,"forwardLinearDepth();")}`),i.fragment.include(m,r),i.include(b,r),i.include(u,r),i.include(L,r),D(k,r),C(k),y(k),k.uniforms.add(I.uniforms.get("localOrigin"),new W("viewDirection",(({camera:e})=>o(q,a(q,e.viewMatrix[12],e.viewMatrix[13],e.viewMatrix[14]))))),t&&k.uniforms.add(new U("ovWaterTex",(e=>e.overlay?.getTexture(l.WaterNormal))),new F("view",(({origin:r},{camera:o})=>e(E,o.viewMatrix,r))));const s=.2;k.code.add(V`float lum(vec3 c) {
|
|
27
27
|
return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
28
|
-
}`),
|
|
28
|
+
}`),x(k),O(k),k.main.add(V`
|
|
29
29
|
vec3 normal = normalize(vnormal);
|
|
30
30
|
float vndl = dot(normal, mainLightDirection);
|
|
31
31
|
|
|
32
32
|
float additionalAmbientScale = smoothstep(0.0, 1.0, clamp(vndl*2.5, 0.0, 1.0));
|
|
33
|
-
float shadow = ${n?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":
|
|
33
|
+
float shadow = ${n?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":X?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
|
|
34
34
|
|
|
35
35
|
float ssao = evaluateAmbientOcclusionInverse();
|
|
36
36
|
vec4 tileColor = getTileColor();
|
|
37
37
|
|
|
38
|
-
${
|
|
38
|
+
${A(oe,V`vec4 overlayColorOpaque = getOverlayColor(ovColorTex, vtcOverlay);
|
|
39
39
|
vec4 overlayColor = overlayOpacity * overlayColorOpaque;
|
|
40
|
-
${
|
|
40
|
+
${A(re,`if (overlayColor.a < ${V.float(H)}) { discard; }`)}
|
|
41
41
|
vec4 groundColor = tileColor;
|
|
42
42
|
tileColor = tileColor * (1.0 - overlayColor.a) + overlayColor;`)}
|
|
43
43
|
|
|
@@ -58,8 +58,8 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
58
58
|
|
|
59
59
|
vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
|
|
60
60
|
|
|
61
|
-
${
|
|
62
|
-
${
|
|
61
|
+
${J===S.Simplified||J===S.TerrainWithWater?V`fragColor = vec4(evaluatePBRSimplifiedLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:V`fragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`}
|
|
62
|
+
${A(t,V`vec4 overlayWaterMask = getOverlayColor(ovWaterTex, vtcOverlay);
|
|
63
63
|
float waterNormalLength = length(overlayWaterMask);
|
|
64
64
|
if (waterNormalLength > 0.95) {
|
|
65
65
|
mat3 tbnMatrix = mat3(tbnTangent, tbnBiTangent, vnormal);
|
|
@@ -71,7 +71,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
71
71
|
// un-gamma the ground color to mix in linear space
|
|
72
72
|
fragColor = mix(groundColor, waterColorNonLinear, waterColorLinear.w) * opacity;
|
|
73
73
|
}`)}
|
|
74
|
-
${
|
|
74
|
+
${A(Z,V`float perspectiveScale = screenSizePerspectiveScaleFloat(1.0, screenSizeCosAngle, screenSizeDistanceToCamera, vec4(0.0));
|
|
75
75
|
if (perspectiveScale <= 0.25) {
|
|
76
76
|
fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), perspectiveScale * 4.0);
|
|
77
77
|
} else if (perspectiveScale <= 0.5) {
|
|
@@ -81,7 +81,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
81
81
|
} else {
|
|
82
82
|
fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), (perspectiveScale - 0.5) * 2.0);
|
|
83
83
|
}`)}
|
|
84
|
-
${
|
|
84
|
+
${A(r.visualizeNormals,X?V`
|
|
85
85
|
vec3 localUp = normalize(vpos + localOrigin);
|
|
86
86
|
vec3 right = normalize(cross(vec3(0.0, 0.0, 1.0), localUp));
|
|
87
87
|
vec3 forward = normalize(cross(localUp, right));
|
|
@@ -90,26 +90,26 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
90
90
|
fragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);`:V`
|
|
91
91
|
vec3 tNormal = normalize(normal);
|
|
92
92
|
fragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);`)}
|
|
93
|
-
${
|
|
93
|
+
${A(Q,V`vec2 dVuv = fwidth(vuv0);
|
|
94
94
|
vec2 edgeFactors = smoothstep(vec2(0.0), 1.5 * dVuv, min(vuv0, 1.0 - vuv0));
|
|
95
95
|
float edgeFactor = 1.0 - min(edgeFactors.x, edgeFactors.y);
|
|
96
96
|
fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`)}
|
|
97
|
-
fragColor = applySlice(fragColor, vpos);`)}break;case d.Depth:
|
|
98
|
-
${
|
|
99
|
-
gl_Position = transformPosition(proj, view, position);`),k.main.add(`${
|
|
100
|
-
${
|
|
97
|
+
fragColor = applySlice(fragColor, vpos);`)}break;case d.Depth:ae&&i.include(z,r),I.main.add(V`
|
|
98
|
+
${A(ae,"setOverlayVTC(getUV0());")}
|
|
99
|
+
gl_Position = transformPosition(proj, view, position);`),k.main.add(`${A(ae,`if (getCombinedOverlayColor().a < ${V.float(H)}) discard;`)}`);break;case d.Shadow:case d.ShadowHighlight:case d.ShadowExcludeHighlight:case d.ViewshedShadow:i.include(w,r),n(i),s(i),I.main.add(V`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),k.main.add(V`outputDepth(linearDepth);`);break;case d.Normal:ae&&i.include(z,r),G.add("vnormal","vec3"),N(I),ee(),I.main.add(V`
|
|
100
|
+
${A(ae,"setOverlayVTC(getUV0());")}
|
|
101
101
|
gl_Position = transformPosition(proj, view, position);
|
|
102
102
|
vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);`),k.main.add(V`
|
|
103
|
-
${
|
|
103
|
+
${A(ae,`if (getCombinedOverlayColor().a < ${V.float(H)}) discard;`)}
|
|
104
104
|
vec3 normal = normalize(vnormal);
|
|
105
105
|
if (gl_FrontFacing == false) {
|
|
106
106
|
normal = -normal;
|
|
107
107
|
}
|
|
108
|
-
fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case d.Highlight:
|
|
109
|
-
${
|
|
110
|
-
gl_Position = transformPosition(proj, view, position);`),i.include(
|
|
111
|
-
${
|
|
108
|
+
fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case d.Highlight:oe&&i.include(z,r),I.main.add(V`
|
|
109
|
+
${A(oe,"setOverlayVTC(getUV0());")}
|
|
110
|
+
gl_Position = transformPosition(proj, view, position);`),i.include(h,r),k.main.add(V`
|
|
111
|
+
${A(oe,V`
|
|
112
112
|
vec2 overlayHighlightTexel = getAllOverlayHighlightValuesEncoded();
|
|
113
113
|
calculateOcclusionAndOutputHighlightOverlay(overlayHighlightTexel);`,"calculateOcclusionAndOutputHighlight();")}
|
|
114
|
-
`)}if(
|
|
115
|
-
setOverlayVTC(getUV0());`),k.main.add(V`fragColor = getOverlayColorTexel();`);else{const e=
|
|
114
|
+
`)}if(R===d.ObjectAndLayerIdColor)if(oe)r.pbrMode=S.Disabled,i.include(z,r),r.pbrMode=J,I.main.add(V`gl_Position = transformPosition(proj, view, position);
|
|
115
|
+
setOverlayVTC(getUV0());`),k.main.add(V`fragColor = getOverlayColorTexel();`);else{const e=Y===t.Opaque;I.main.add(V`${A(e,"gl_Position = transformPosition(proj, view, position);")}`),k.main.add(V`fragColor = vec4(0.0);`)}return i}const E=r(),q=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:I,build:k},Symbol.toStringTag,{value:"Module"}));export{I as T,G as a,k as b};
|
package/core/LRUCache.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MemCacheStorage as t}from"./MemCache.js";class e{constructor(e,s){this._storage=new t,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this)
|
|
5
|
+
import{MemCacheStorage as t}from"./MemCache.js";class e{constructor(e,s){this.removeFunc=s,this._storage=new t,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(t,e,s=1){this._storage.put(this,t,e,s,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}export{e as LRUCache};
|
package/core/MemCache.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
const t=-3,i=t-1;var s;!function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"}(s||(s={}));class e{constructor(t,i,s,e=0){this.name=t,this._storage=i,this.removeFunc=s,this._defaultPriority=e,this.id=`${r++}${_}`,this.size=0,this._hit=0,this._miss=0,this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get storageSize(){return this._storage.size}getSize(t){return this._storage.getSize(this,t)}set maxSize(t){this._storage.setMaxSize(this,t)}resetHitRate(){this._hit=this._miss=0}put(t,i,s=this._defaultPriority){this._storage.put(this,t,i,i.cachedMemory,s)}pop(t){const i=this._storage.pop(this,t);return void 0===i?++this._miss:++this._hit,i}get(t){const i=this._storage.get(this,t);return void 0===i?++this._miss:++this._hit,i}peek(t){return this._storage.peek(this,t)}updateSize(t,i){this._storage.updateSize(this,t,i,i.cachedMemory)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class h{get size(){return this._size}constructor(t=10485760){this._maxSize=t,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._users=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._users.clear()}register(t){this._users.set(t.id.slice(0,-1),t)}deregister(t){this.clear(t),this._sizeLimits.delete(t),this._users.delete(t.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,i){const s=this._db.get(t.id+i);return s?.size??0}put(e,h,r,_,n){h=e.id+h;const a=this._db.get(h);if(a&&(this._size-=a.size,e.size-=a.size,this._db.delete(h),a.entry!==r&&this._notifyRemove(h,a.entry,a.size,s.ALL)),_>this._maxSize)return void this._notifyRemove(h,r,_,s.ALL);if(void 0===r)return void console.warn("Refusing to cache undefined entry ");if(!_||_<0)return console.warn(`Refusing to cache entry with size ${_} for key ${h}`),void this._notifyRemove(h,r,0,s.ALL);const c=1+Math.max(n,i)-t;this._db.set(h,new o(r,_,c)),this._size+=_,e.size+=_,this._checkSize()}updateSize(t,i,e,h){i=t.id+i;const r=this._db.get(i);if(r&&r.entry===e){for(this._size-=r.size,t.size-=r.size;h>this._maxSize;){const t=this._notifyRemove(i,e,h,s.SOME);if(!(null!=t&&t>0))return void this._db.delete(i);h=t}r.size=h,this._size+=h,t.size+=h,this._checkSize()}}pop(t,i){i=t.id+i;const s=this._db.get(i);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(i),++this._hit,s.entry;++this._miss}get(t,i){i=t.id+i;const s=this._db.get(i);if(void 0!==s)return this._db.delete(i),s.lives=s.lifetime,this._db.set(i,s),++this._hit,s.entry;++this._miss}peek(t,i){const s=this._db.get(t.id+i);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const i={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},s={},e=new Array;this._db.forEach(((t,i)=>{const h=t.lifetime;e[h]=(e[h]||0)+t.size,this._users.forEach((e=>{const{id:h,name:r}=e;if(i.startsWith(h)){const i=s[r]||0;s[r]=i+t.size}}))}));const h={};this._users.forEach((t=>{const i=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const e=s[i]||0;s[i]=e,h[i]=Math.round(100*t.hitRate)+"%"}else h[i]="0%"}));const r=Object.keys(s);r.sort(((t,i)=>s[i]-s[t])),r.forEach((t=>i[t]=Math.round(s[t]/2**20)+"MB / "+h[t]));for(let o=e.length-1;o>=0;--o){const s=e[o];s&&(i["Priority "+(o+t-1)]=Math.round(s/this._size*100)+"%")}return i}resetStats(){this._hit=this._miss=0,this._users.forEach((t=>t.resetHitRate()))}clear(t){const i=t.id;this._db.forEach(((t,e)=>{e.startsWith(i)&&(this._size-=t.size,this._db.delete(e),this._notifyRemove(e,t.entry,t.size,s.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,i)=>this._notifyRemove(i,t.entry,t.size,s.ALL))),this._users.forEach((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,i,s,e){const h=this._users.get(t.split(_)[0])?.removeFunc,r=h?.(i,e,s);return"number"==typeof r?r:null}_checkSize(){this._sizeLimits.forEach(((t,i)=>this._checkSizeLimits(t,i))),this._checkSizeLimits(this.maxSize)}setMaxSize(t,i){null==i||i<=0?this._sizeLimits.delete(t):this._sizeLimits.set(t,i)}_checkSizeLimits(t,i){const s=i??this;if(s.size<=t)return;const e=i?.id;let h=!0;for(;h;){h=!1;for(const[r,o]of this._db)if(0===o.lifetime&&(!e||r.startsWith(e))){const e=i??this._users.get(r.split(_)[0]);if(this._purgeItem(r,o,e),s.size<=.9*t)return;h||=this._db.has(r)}}for(const[r,o]of this._db)if(!e||r.startsWith(e)){const e=i??this._users.get(r.split(_)[0]);if(this._purgeItem(r,o,e),s.size<=.9*t)return}}_purgeItem(t,i,e){if(this._db.delete(t),i.lives<=1){this._size-=i.size,e&&(e.size-=i.size);const h=this._notifyRemove(t,i.entry,i.size,s.SOME);null!=h&&h>0&&(this._size+=h,e&&(e.size+=h),i.lives=i.lifetime,i.size=h,this._db.set(t,i))}else--i.lives,this._db.set(t,i)}}let r=0;class o{constructor(t,i,s){this.entry=t,this.size=i,this.lifetime=s,this.lives=s}}const _=":";export{e as MemCache,h as MemCacheStorage,t as MinPriority,i as NoPriority,s as RemoveMode};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{nativeArrayMaxSize as r}from"../../core/typedArrayUtil.js";function n(n){return Array.isArray(n)?n.length<r?n:new Int16Array(n):n.length<r?Array.from(n):n}function t(n){return n<=r?new Array(n):new Int16Array(n)}export{n as compactShortArray,t as newShortArray};
|
package/interfaces.d.ts
CHANGED
|
@@ -98103,6 +98103,17 @@ declare namespace __esri {
|
|
|
98103
98103
|
duration?: number;
|
|
98104
98104
|
maxDuration?: number;
|
|
98105
98105
|
easing?: | "linear"
|
|
98106
|
+
| "ease"
|
|
98107
|
+
| "ease-in"
|
|
98108
|
+
| "ease-out"
|
|
98109
|
+
| "ease-in-out"
|
|
98110
|
+
| "cubic-in"
|
|
98111
|
+
| "cubic-out"
|
|
98112
|
+
| "cubic-in-out"
|
|
98113
|
+
| "expo-in"
|
|
98114
|
+
| "expo-out"
|
|
98115
|
+
| "expo-in-out"
|
|
98116
|
+
| "quad-in-out-coast"
|
|
98106
98117
|
| "in-cubic"
|
|
98107
98118
|
| "out-cubic"
|
|
98108
98119
|
| "in-out-cubic"
|
|
@@ -98110,10 +98121,6 @@ declare namespace __esri {
|
|
|
98110
98121
|
| "out-expo"
|
|
98111
98122
|
| "in-out-expo"
|
|
98112
98123
|
| "in-out-coast-quad"
|
|
98113
|
-
| "ease"
|
|
98114
|
-
| "ease-in"
|
|
98115
|
-
| "ease-out"
|
|
98116
|
-
| "ease-in-out"
|
|
98117
98124
|
| MapViewEasingFunction;
|
|
98118
98125
|
pickClosestTarget?: boolean;
|
|
98119
98126
|
signal?: AbortSignal | nullish;
|
|
@@ -99122,6 +99129,13 @@ declare namespace __esri {
|
|
|
99122
99129
|
duration?: number;
|
|
99123
99130
|
maxDuration?: number;
|
|
99124
99131
|
easing?: | "linear"
|
|
99132
|
+
| "cubic-in"
|
|
99133
|
+
| "cubic-out"
|
|
99134
|
+
| "cubic-in-out"
|
|
99135
|
+
| "expo-in"
|
|
99136
|
+
| "expo-out"
|
|
99137
|
+
| "expo-in-out"
|
|
99138
|
+
| "quad-in-out-coast"
|
|
99125
99139
|
| "in-cubic"
|
|
99126
99140
|
| "out-cubic"
|
|
99127
99141
|
| "in-out-cubic"
|