vis-core 0.33.4 → 0.33.6

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/dist/io.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ declare type DownloadProgress = {
2
+ percent: number;
3
+ transferredBytes: number;
4
+ totalBytes: number;
5
+ };
6
+
7
+ export declare const isGzip: (url: string) => boolean;
8
+
9
+ export declare const jsonFetch: <T = any>(url: string, onDownloadProgress?: (progress: DownloadProgress) => void, gzip?: (url: string) => boolean, options?: JsonFetchOptions) => Promise<{
10
+ res: T | undefined;
11
+ err: unknown;
12
+ }>;
13
+
14
+ export declare type JsonFetchCacheOptions = {
15
+ enabled?: boolean;
16
+ key?: string;
17
+ clone?: boolean;
18
+ };
19
+
20
+ export declare type JsonFetchOptions = {
21
+ cache?: boolean | JsonFetchCacheOptions;
22
+ };
23
+
24
+ export { }
package/dist/io.js ADDED
@@ -0,0 +1 @@
1
+ import{n as o,t as s}from"./jsonFetch-BQr9Uqag.js";export{s as isGzip,o as jsonFetch};
@@ -0,0 +1 @@
1
+ function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var r=s.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function n(e,n,s){return(n=t(n))in e?Object.defineProperty(e,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[n]=s,e}function s(e,t,n,s,r,i,o){try{var a=e[i](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,l,"next",e)}function l(e){s(o,r,i,a,l,"throw",e)}a(void 0)})}}var i,o,a,l=new class{constructor(e=32,t=67108864){n(this,"pending",/* @__PURE__ */new Map),n(this,"values",/* @__PURE__ */new Map),n(this,"bytes",0),n(this,"maxEntries",void 0),n(this,"maxBytes",void 0),this.maxEntries=e,this.maxBytes=t}load(e,t){const n=this.values.get(e);if(n)return this.values.delete(e),this.values.set(e,n),Promise.resolve(n);const s=this.pending.get(e);if(s)return s;const r=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===r&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===r&&this.pending.delete(e),t});return this.pending.set(e,r),r}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},u=e=>!(!e.endsWith(".gzip")&&!e.endsWith(".gz")),c=(i=r(function*(e,t,n=u){const s=yield window.fetch(e);if(!s.ok){try{var r;yield null===(r=s.body)||void 0===r?void 0:r.cancel()}catch(l){}throw new Error("Network response was not ok.")}let i=s;if(t)try{i=((e,t)=>{const n=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:n})},transform(e,r){s+=e.byteLength,t({percent:0===n?0:s/n,transferredBytes:s,totalBytes:n}),r.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:n})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:n,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(i,t)}catch(c){try{var o;yield null===(o=s.body)||void 0===o?void 0:o.cancel(c)}catch(h){}throw c}if(n(e)&&"gzip"!==i.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=i.body.pipeThrough(e);i=new Response(t)}const a=yield i.text();return{json:JSON.parse(a),bytes:2*a.length}}),function(e,t){return i.apply(this,arguments)}),h=(o=r(function*(e,t,n=u,s){const r=((e,t)=>{const n=null==t?void 0:t.cache;if(!1===n)return{enabled:!1,key:e,clone:!1};if(!0===n)return{enabled:!0,key:e,clone:!0};if(n&&"object"==typeof n){var s,r,i;const t=null===(s=n.enabled)||void 0===s||s;return{enabled:t,key:null!==(r=n.key)&&void 0!==r?r:e,clone:!!t&&(null===(i=n.clone)||void 0===i||i)}}return{enabled:!1,key:e,clone:!1}})(e,s),i=()=>c(e,t,n),o=r.enabled?l.load(r.key,i):i();try{const e=(yield o).json;return{res:r.enabled&&r.clone?structuredClone(e):e,err:void 0}}catch(a){return{res:void 0,err:a}}}),function(e,t){return o.apply(this,arguments)}),d=/^(?:[a-z]+:)?\/\//i,y=(a=r(function*(e,t){const{res:n,err:s}=yield h(((e,t="")=>d.test(e)?e:`${t.endsWith("/")?t.slice(0,-1):t}${e.startsWith("/")?e:`/${e}`}`)(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return n}),function(e,t){return a.apply(this,arguments)});export{n as a,r as i,h as n,y as r,u as t};
package/package.json CHANGED
@@ -1,12 +1,24 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.33.4",
3
+ "version": "0.33.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "prettier": "fe-stack/prettier.json",
7
7
  "types": "dist/index.d.ts",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./io": {
17
+ "types": "./dist/io.d.ts",
18
+ "import": "./dist/io.js",
19
+ "default": "./dist/io.js"
20
+ }
21
+ },
10
22
  "files": [
11
23
  "dist"
12
24
  ],
@@ -25,17 +37,17 @@
25
37
  "dependencies": {
26
38
  "@noble/curves": "^2.0.1",
27
39
  "@turf/turf": "^6.5.0",
40
+ "@types/d3-geo": "^3.0.2",
41
+ "@types/events": "^3.0.0",
42
+ "@types/geojson": "^7946.0.10",
28
43
  "@types/three": "0.186.0",
29
44
  "esus-lite": "^0.2.8",
30
45
  "events": "^3.3.0",
31
46
  "geojson-cn": "^0.2.5",
32
- "gl-draw": "0.19.4",
47
+ "gl-draw": "0.19.6",
33
48
  "three": "0.186.1"
34
49
  },
35
50
  "devDependencies": {
36
- "@types/d3-geo": "^3.0.2",
37
- "@types/events": "^3.0.0",
38
- "@types/geojson": "^7946.0.10",
39
51
  "@types/node": "^25.0.6",
40
52
  "fe-stack": "0.2.0",
41
53
  "terser": "^5.46.1",
@@ -46,7 +58,7 @@
46
58
  "scripts": {
47
59
  "prebuild": "pnpm --filter gl-draw run build",
48
60
  "build": "pnpm run generate:version && vite build",
49
- "test": "node --test ./test/*.test.mjs",
61
+ "test": "node --import ./test/helpers/visCoreSourceHook.mjs --test ./test/*.test.mjs",
50
62
  "test:dist": "pnpm run build && node --test ./test/packaging/*.test.mjs",
51
63
  "test:scene-document": "node --test ./test/sceneDocument.test.mjs",
52
64
  "test:scene-interactions": "node --test ./test/sceneInteractions.test.mjs",