@kteneyck/cesium-timeline-react 0.1.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/dist/cesium-timeline-react.js +1195 -0
- package/dist/cesium-timeline-react.umd.cjs +22 -0
- package/dist/index.d.ts +132 -0
- package/package.json +60 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(et,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("cesium"),require("@kteneyck/cesium-timeline-core")):typeof define=="function"&&define.amd?define(["exports","react","cesium","@kteneyck/cesium-timeline-core"],o):(et=typeof globalThis<"u"?globalThis:et||self,o(et.CesiumTimelineReact={},et.React,et.Cesium,et.CesiumTimelineCore))})(this,(function(et,o,Jt,y){"use strict";function Nt(x){const M=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const S in x)if(S!=="default"){const i=Object.getOwnPropertyDescriptor(x,S);Object.defineProperty(M,S,i.get?i:{enumerable:!0,get:()=>x[S]})}}return M.default=x,Object.freeze(M)}const j=Nt(Jt);var Et={exports:{}},xt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var jt;function Xt(){if(jt)return xt;jt=1;var x=Symbol.for("react.transitional.element"),M=Symbol.for("react.fragment");function S(i,R,P){var V=null;if(P!==void 0&&(V=""+P),R.key!==void 0&&(V=""+R.key),"key"in R){P={};for(var N in R)N!=="key"&&(P[N]=R[N])}else P=R;return R=P.ref,{$$typeof:x,type:i,key:V,ref:R!==void 0?R:null,props:P}}return xt.Fragment=M,xt.jsx=S,xt.jsxs=S,xt}var vt={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var At;function Yt(){return At||(At=1,process.env.NODE_ENV!=="production"&&(function(){function x(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case Z:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case T:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case v:return"Portal";case p:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case b:var f=e.render;return e=e.displayName,e||(e=f.displayName||f.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case lt:return f=e.displayName||null,f!==null?f:x(e.type)||"Memo";case Y:f=e._payload,e=e._init;try{return x(e(f))}catch{}}return null}function M(e){return""+e}function S(e){try{M(e);var f=!1}catch{f=!0}if(f){f=console;var w=f.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return w.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),M(e)}}function i(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Y)return"<...>";try{var f=x(e);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function R(){var e=I.A;return e===null?null:e.getOwner()}function P(){return Error("react-stack-top-frame")}function V(e){if(a.call(e,"key")){var f=Object.getOwnPropertyDescriptor(e,"key").get;if(f&&f.isReactWarning)return!1}return e.key!==void 0}function N(e,f){function w(){ot||(ot=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",f))}w.isReactWarning=!0,Object.defineProperty(e,"key",{get:w,configurable:!0})}function H(){var e=x(this.type);return B[e]||(B[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function A(e,f,w,L,nt,ft){var O=w.ref;return e={$$typeof:K,type:e,key:f,props:w,_owner:L},(O!==void 0?O:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:H}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:nt}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ft}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function U(e,f,w,L,nt,ft){var O=f.children;if(O!==void 0)if(L)if(X(O)){for(L=0;L<O.length;L++)rt(O[L]);Object.freeze&&Object.freeze(O)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else rt(O);if(a.call(f,"key")){O=x(e);var ut=Object.keys(f).filter(function(l){return l!=="key"});L=0<ut.length?"{key: someKey, "+ut.join(": ..., ")+": ...}":"{key: someKey}",it[O+L]||(ut=0<ut.length?"{"+ut.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,L,O,ut,O),it[O+L]=!0)}if(O=null,w!==void 0&&(S(w),O=""+w),V(f)&&(S(f.key),O=""+f.key),"key"in f){w={};for(var Q in f)Q!=="key"&&(w[Q]=f[Q])}else w=f;return O&&N(w,typeof e=="function"?e.displayName||e.name||"Unknown":e),A(e,O,w,R(),nt,ft)}function rt(e){$(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===Y&&(e._payload.status==="fulfilled"?$(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function $(e){return typeof e=="object"&&e!==null&&e.$$typeof===K}var tt=o,K=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),lt=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),I=tt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,a=Object.prototype.hasOwnProperty,X=Array.isArray,W=console.createTask?console.createTask:function(){return null};tt={react_stack_bottom_frame:function(e){return e()}};var ot,B={},F=tt.react_stack_bottom_frame.bind(tt,P)(),ct=W(i(P)),it={};vt.Fragment=k,vt.jsx=function(e,f,w){var L=1e4>I.recentlyCreatedOwnerStacks++;return U(e,f,w,!1,L?Error("react-stack-top-frame"):F,L?W(i(e)):ct)},vt.jsxs=function(e,f,w){var L=1e4>I.recentlyCreatedOwnerStacks++;return U(e,f,w,!0,L?Error("react-stack-top-frame"):F,L?W(i(e)):ct)}})()),vt}var Ct;function zt(){return Ct||(Ct=1,process.env.NODE_ENV==="production"?Et.exports=Xt():Et.exports=Yt()),Et.exports}var u=zt();const Wt=520,Bt=()=>u.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"currentColor","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"0",width:"4",height:"16",rx:"1"}),u.jsx("rect",{x:"9",y:"0",width:"4",height:"16",rx:"1"})]}),St=()=>u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"3,5 7,9 11,5"})}),kt=()=>u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("polyline",{points:"3,9 7,5 11,9"})}),Lt=({currentTime:x,isPlaying:M,multiplier:S,dateTimeFormat:i,isLive:R,hasStartTime:P,hasEndTime:V,onPlayPause:N,onJumpToStart:H,onRewind:A,onFastForward:U,onJumpToEnd:rt,onJumpToLive:$,onResetSpeed:tt,onDateTimeClick:K,theme:v,swimLanesVisible:k,onToggleSwimLanes:C})=>{const Z=S<0,E=S>1,p=S===1,b=Math.abs(S),D=o.useRef(null),[T,lt]=o.useState(!1);o.useEffect(()=>{const a=D.current;if(!a)return;const X=new ResizeObserver(([W])=>{lt(W.contentRect.width<Wt)});return X.observe(a),()=>X.disconnect()},[]);const Y={background:"none",border:"1px solid transparent",cursor:"pointer",fontSize:"16px",padding:"0",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"32px",width:"32px",height:"32px",borderRadius:"4px",transition:"background-color 0.15s, color 0.15s",fontFamily:"system-ui, -apple-system, sans-serif",flexShrink:0,lineHeight:1},G=a=>({...Y,color:a?v.buttonActiveColor:v.buttonColor,borderColor:a?`${v.buttonActiveColor}33`:"transparent"}),z=(a,X)=>{a.currentTarget.style.backgroundColor=X?`${v.buttonActiveColor}22`:v.buttonHoverColor+"44"},I=a=>{a.currentTarget.style.backgroundColor="transparent"};return u.jsxs("div",{ref:D,style:{display:T?"flex":"grid",gridTemplateColumns:T?void 0:"1fr auto 1fr",alignItems:"center",padding:"6px 16px",backgroundColor:v.controlBarBackground,borderBottom:`1px solid ${v.controlBarBorder}`,fontFamily:"system-ui, -apple-system, sans-serif"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[u.jsx("div",{onClick:K,title:K?"Click to jump to a date/time":void 0,style:{color:v.labelColor,fontFamily:"monospace",lineHeight:1.15,cursor:K?"pointer":"default",borderRadius:"4px",padding:"2px 4px",transition:"background 0.15s"},onMouseEnter:a=>{K&&(a.currentTarget.style.background=v.buttonHoverColor+"44")},onMouseLeave:a=>a.currentTarget.style.background="transparent",children:(()=>{const{timeFormat:a,dateFormat:X}=y.splitForDisplay(i);return u.jsxs(u.Fragment,{children:[a&&u.jsx("div",{style:{fontSize:"2em",fontWeight:"bold",letterSpacing:"0.02em"},children:y.formatDateTime(x,a)}),X&&u.jsx("div",{style:{fontSize:"1.15em",letterSpacing:"0.03em",color:v.buttonActiveColor},children:y.formatDateTime(x,X)})]})})()}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"},children:[u.jsx("button",{onClick:$,style:{...Y,fontSize:"11px",fontWeight:"bold",letterSpacing:"0.05em",width:"52px",minWidth:"52px",height:"20px",borderRadius:"3px",color:R?v.controlBarBackground:v.buttonActiveColor,backgroundColor:R?v.buttonActiveColor:"transparent",borderColor:v.buttonActiveColor,opacity:R?1:.55},onMouseEnter:a=>{a.currentTarget.style.opacity="1"},onMouseLeave:a=>{a.currentTarget.style.opacity=R?"1":"0.55"},title:R?"Currently live":"Jump to live (now)",children:R?"● LIVE":"LIVE"}),u.jsx("div",{style:{height:"20px",display:"flex",alignItems:"center"},children:!p&&u.jsx("button",{onClick:()=>tt(),style:{...Y,fontSize:"11px",color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}44`,width:"52px",minWidth:"52px",height:"20px"},onMouseEnter:a=>z(a,!0),onMouseLeave:I,title:"Reset to 1× speed",children:Z?`◀ ${b}×`:`${b}× ▶`})})]})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",...T?{flex:1,justifyContent:"center"}:{}},children:[P&&u.jsx("button",{onClick:H,style:G(!1),onMouseEnter:a=>z(a,!1),onMouseLeave:I,title:"Jump to start",children:"⏮"}),u.jsx("button",{onClick:A,style:{...G(Z),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>z(a,Z),onMouseLeave:I,title:Z?`Reverse ${b}× — click to speed up, press play to stop`:"Rewind",children:Z?u.jsxs(u.Fragment,{children:[u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[b,"×"]}),"◀◀"]}):"◀◀"}),u.jsx("button",{onClick:()=>N(!M),style:{...Y,color:v.buttonActiveColor,fontSize:"18px",width:"40px",minWidth:"40px",height:"40px",borderColor:`${v.buttonActiveColor}55`,borderRadius:"50%",paddingLeft:M?"0":"2px"},onMouseEnter:a=>z(a,!0),onMouseLeave:I,title:M?"Pause":Z?"Play (reset to 1×)":"Play",children:M?u.jsx(Bt,{}):"▶"}),u.jsx("button",{onClick:U,style:{...G(E),width:"64px",minWidth:"64px",gap:"3px"},onMouseEnter:a=>z(a,E),onMouseLeave:I,title:E?`${b}× speed — click to increase, click again at max to reset`:"Fast forward",children:E?u.jsxs(u.Fragment,{children:["▶▶",u.jsxs("span",{style:{fontSize:"11px",fontWeight:"bold"},children:[b,"×"]})]}):"▶▶"}),V&&u.jsx("button",{onClick:rt,style:G(!1),onMouseEnter:a=>z(a,!1),onMouseLeave:I,title:"Jump to end",children:"⏭"})]}),!T&&u.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:C!=null&&k!=null&&u.jsx("button",{onClick:C,style:{...Y,color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}33`},onMouseEnter:a=>z(a,k),onMouseLeave:I,title:k?"Collapse swim lanes":"Expand swim lanes",children:k?u.jsx(St,{}):u.jsx(kt,{})})}),T&&C!=null&&k!=null&&u.jsx("button",{onClick:C,style:{...Y,color:v.buttonActiveColor,borderColor:`${v.buttonActiveColor}33`,marginLeft:"4px"},onMouseEnter:a=>z(a,k),onMouseLeave:I,title:k?"Collapse swim lanes":"Expand swim lanes",children:k?u.jsx(St,{}):u.jsx(kt,{})})]})},yt=o.forwardRef((x,M)=>{const{currentTime:S,defaultStartMs:i,defaultEndMs:R,theme:P,maxTicks:V,onTimeChange:N,onDragStart:H,onDragEnd:A,swimLanes:U,showSwimLanes:rt,onSwimLaneItemClick:$,onSwimLaneItemHover:tt,onSwimLaneItemDoubleClick:K,onSwimLaneItemContextMenu:v,onSwimLaneReorder:k}=x,C=o.useRef(null),Z=o.useRef(P),E=o.useRef(V),p=o.useRef(i),b=o.useRef(R),D=o.useRef(j.JulianDate.toDate(S).getTime());o.useEffect(()=>{Z.current=P},[P]),o.useEffect(()=>{E.current=V},[V]);const T=o.useRef(U??[]),lt=o.useRef(rt??(U!=null&&U.length>0)),Y=o.useRef(0),G=o.useRef(null),z=o.useRef(null),I=o.useRef($),a=o.useRef(tt),X=o.useRef(K),W=o.useRef(v),ot=o.useRef(k);o.useEffect(()=>{I.current=$},[$]),o.useEffect(()=>{a.current=tt},[tt]),o.useEffect(()=>{X.current=K},[K]),o.useEffect(()=>{W.current=v},[v]),o.useEffect(()=>{ot.current=k},[k]),o.useEffect(()=>{T.current=U??[],l()},[U]),o.useEffect(()=>{lt.current=rt??(U!=null&&U.length>0),l()},[rt,U]);const B=o.useRef(null),F=o.useRef(null),ct=o.useRef(!1),it=o.useRef(0),e=o.useRef("none"),f=o.useRef(0),w=o.useRef(0),L=o.useRef(0),nt=o.useRef("none"),ft=o.useRef(0),O=o.useRef(0),ut=(t,n)=>Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),Q=o.useCallback(()=>({startMs:p.current,endMs:b.current,currentMs:D.current,theme:Z.current,maxTicks:E.current,swimLanes:T.current,showSwimLanes:lt.current,scrollTop:Y.current,reorderState:z.current}),[]);o.useImperativeHandle(M,()=>({zoomTo(t,n,r){const c=Math.max(y.MIN_SPAN_MS,Math.min(y.MAX_SPAN_MS,n-t)),s=(t+n)/2;p.current=s-c/2,b.current=s+c/2,r!==void 0&&(D.current=r),l()},getVisibleRange(){return{startMs:p.current,endMs:b.current}},startFollow(t){if(it.current=t,F.current!==null)return;ct.current=!0;let n=performance.now();const r=()=>{const c=performance.now(),s=c-n;n=c;const h=s*it.current;p.current+=h,b.current+=h,D.current+=h,l(),F.current=requestAnimationFrame(r)};F.current=requestAnimationFrame(r)},stopFollow(){ct.current=!1,F.current!==null&&(cancelAnimationFrame(F.current),F.current=null)},correctFollow(t){if(!ct.current)return;const n=t-D.current;D.current=t,p.current+=n,b.current+=n},appendSwimLane(t){T.current=[...T.current,t],l()},updateSwimLane(t,n){T.current=T.current.map(r=>r.id===t?{...r,...n,id:r.id}:r),l()},removeSwimLane(t){T.current=T.current.filter(n=>n.id!==t),l()},reorderSwimLanes(t){const n=new Map(T.current.map(c=>[c.id,c])),r=[];for(const c of t){const s=n.get(c);s&&r.push(s)}T.current=r,l()}}));const l=o.useCallback(()=>{const t=C.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const r=t.getBoundingClientRect(),c=r.width,s=r.height;if(c===0||s===0)return;const h=window.devicePixelRatio||1,m=Math.round(c*h),g=Math.round(s*h);(t.width!==m||t.height!==g)&&(t.width=m,t.height=g),n.save(),n.scale(h,h);const J=y.drawTimeline(n,c,s,Q());J!==Y.current&&(Y.current=J),n.restore()},[Q]);o.useLayoutEffect(()=>{l();const t=C.current;if(!t)return;const n=new ResizeObserver(()=>l());return n.observe(t),()=>n.disconnect()},[l]),o.useEffect(()=>{if(ct.current)return;const t=j.JulianDate.toDate(S).getTime();D.current!==t&&(D.current=t,l())},[S,l]);const ht=o.useCallback(t=>{if(B.current!==null)return;const n=()=>{const r=C.current,c=b.current-p.current,s=t*c*.01;if(p.current+=s,b.current+=s,r){const h=r.getBoundingClientRect(),m=Math.max(0,Math.min(h.width,w.current-h.left)),g=p.current+m/h.width*(b.current-p.current);D.current=g,N(j.JulianDate.fromDate(new Date(g)))}l(),B.current=requestAnimationFrame(n)};B.current=requestAnimationFrame(n)},[l,N]),at=o.useCallback(()=>{B.current!==null&&(cancelAnimationFrame(B.current),B.current=null)},[]),st=o.useCallback((t,n,r,c)=>y.hitTestSwimLane(t,n,r,c,Q()),[Q]),gt=o.useCallback((t,n,r)=>y.hitTestLaneLabel(t,n,r,Q()),[Q]),pt=o.useCallback((t,n)=>y.isInSwimLaneRegion(t,n,Q()),[Q]),Tt=o.useCallback(t=>{t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top;if(t.button===0&&ot.current){const s=gt(r,c,n.height);if(s){const m=T.current.findIndex(g=>g.id===s.id);z.current={dragging:!0,dragLaneId:s.id,dragStartY:t.clientY,currentY:t.clientY,insertIndex:m},t.currentTarget.style.cursor="grabbing";return}}if(t.button===0&&pt(c,n.height)){const s=(D.current-p.current)/(b.current-p.current)*n.width;if(!(Math.abs(r-s)<=10)&&st(r,c,n.width,n.height)){L.current=performance.now();return}}if(t.button===0){e.current="scrub",w.current=t.clientX,t.currentTarget.style.cursor="grabbing",H==null||H();const s=p.current+r/n.width*(b.current-p.current);D.current=s,l(),N(j.JulianDate.fromDate(new Date(s)))}else if(t.button===1)e.current="slide",f.current=t.clientX;else if(t.button===2){if(W.current&&pt(c,n.height))return;e.current="zoom",f.current=t.clientX}},[l,N,H,gt,pt,st]);o.useEffect(()=>{const t=r=>{const c=z.current;if(c&&c.dragging){c.currentY=r.clientY;const g=C.current;if(g){const J=g.getBoundingClientRect(),q=r.clientY-J.top;let Rt=-Y.current;const _t=T.current;let Pt=_t.length;for(let wt=0;wt<_t.length;wt++){const Ft=_t[wt].height??y.DEFAULT_LANE_HEIGHT,Gt=Rt+Ft/2;if(q<Gt){Pt=wt;break}Rt+=Ft+y.LANE_GAP}c.insertIndex=Pt}l();return}if(e.current==="none")return;const s=C.current;if(!s)return;const h=s.getBoundingClientRect(),m=h.width;if(e.current==="scrub"){w.current=r.clientX;const g=r.clientX-h.left,J=m*.08;g<J?ht(-1):g>m-J?ht(1):at();const q=Math.max(0,Math.min(m,g)),dt=p.current+q/m*(b.current-p.current);D.current=dt,l(),N(j.JulianDate.fromDate(new Date(dt)))}else if(e.current==="slide"){const g=f.current-r.clientX;if(f.current=r.clientX,g!==0){const J=g/m*(b.current-p.current);p.current+=J,b.current+=J,l()}}else if(e.current==="zoom"){const g=f.current-r.clientX;f.current=r.clientX,g!==0&&mt(Math.pow(1.01,g))}},n=()=>{var c;const r=z.current;if(r&&r.dragging){const s=Math.abs(r.currentY-r.dragStartY),h=T.current,m=h.findIndex(g=>g.id===r.dragLaneId);if(s>5&&m>=0&&r.insertIndex!==m&&r.insertIndex!==m+1){const g=[...h],[J]=g.splice(m,1),q=r.insertIndex>m?r.insertIndex-1:r.insertIndex;g.splice(q,0,J),T.current=g,(c=ot.current)==null||c.call(ot,g.map(dt=>dt.id))}z.current=null,C.current&&(C.current.style.cursor="default"),l();return}at(),e.current="none",C.current&&(C.current.style.cursor="default"),A==null||A()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}},[l,N,A,ht,at]);const mt=o.useCallback(t=>{const n=y.zoomRange(p.current,b.current,t);p.current=n.startMs,b.current=n.endMs,l()},[l]),bt=o.useCallback(t=>{t.preventDefault();const n=C.current;if(!n)return;const r=n.getBoundingClientRect(),c=t.clientY-r.top,s=lt.current,h=T.current;if(s&&h.length>0){const m=Math.max(0,r.height-y.TICK_AREA_HEIGHT);if(c>=0&&c<m){let g=0;for(const q of h)g+=(q.height??y.DEFAULT_LANE_HEIGHT)+y.LANE_GAP;const J=Math.max(0,g-m);if(J>0){Y.current=Math.max(0,Math.min(J,Y.current+t.deltaY*y.SWIM_LANE_SCROLL_SPEED)),l();return}}}mt(Math.pow(1.05,t.deltaY>0?-1:1))},[mt,l]);o.useEffect(()=>{const t=C.current;if(t)return t.addEventListener("wheel",bt,{passive:!1}),()=>t.removeEventListener("wheel",bt)},[bt]),o.useEffect(()=>{const t=C.current;if(!t)return;const n=s=>{s.preventDefault();const h=t.getBoundingClientRect();if(s.touches.length===1){const m=s.touches[0].clientX-h.left,g=Math.max(0,Math.min(h.width,m)),J=p.current+g/h.width*(b.current-p.current);nt.current="scrub",ft.current=s.touches[0].clientX,w.current=s.touches[0].clientX,D.current=J,l(),H==null||H(),N(j.JulianDate.fromDate(new Date(J)))}else s.touches.length>=2&&(nt.current="pinch",O.current=ut(s.touches[0],s.touches[1]))},r=s=>{s.preventDefault();const h=t.getBoundingClientRect();if(nt.current==="scrub"&&s.touches.length>=1){const m=s.touches[0].clientX-h.left,g=h.width*.08;if(w.current=s.touches[0].clientX,m<g)ht(-1);else if(m>h.width-g)ht(1);else{at();const J=Math.max(0,Math.min(h.width,m)),q=p.current+J/h.width*(b.current-p.current);D.current=q,l(),N(j.JulianDate.fromDate(new Date(q)))}}else if(nt.current==="slide"&&s.touches.length>=1){const m=ft.current-s.touches[0].clientX;if(ft.current=s.touches[0].clientX,m!==0){const g=m/h.width*(b.current-p.current);p.current+=g,b.current+=g,l()}}else if(nt.current==="pinch"&&s.touches.length>=2){const m=ut(s.touches[0],s.touches[1]);m>0&&O.current>0&&mt(O.current/m),O.current=m}},c=s=>{at(),nt.current==="scrub"&&(A==null||A()),s.touches.length===0?nt.current="none":s.touches.length===1&&(nt.current="slide",ft.current=s.touches[0].clientX)};return t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("touchmove",r,{passive:!1}),t.addEventListener("touchend",c,{passive:!1}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",r),t.removeEventListener("touchend",c)}},[l,H,A,N,mt,ht,at]);const Mt=o.useCallback(t=>{var m,g,J;if(e.current!=="none")return;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=(D.current-p.current)/(b.current-p.current)*n.width,h=Math.abs(r-s)<=10;if(pt(c,n.height)){const q=st(r,c,n.width,n.height),dt=G.current;if(q)t.currentTarget.style.cursor=h?"grab":"pointer",(!dt||dt.item.id!==q.item.id||dt.lane.id!==q.lane.id)&&(G.current=q,(m=a.current)==null||m.call(a,{laneId:q.lane.id,item:q.item,originalEvent:t.nativeEvent}),l());else if(dt&&(G.current=null,(g=a.current)==null||g.call(a,null),l()),h)t.currentTarget.style.cursor="grab";else{const Rt=gt(r,c,n.height);t.currentTarget.style.cursor=Rt&&ot.current?"grab":"default"}return}G.current&&(G.current=null,(J=a.current)==null||J.call(a,null),l()),t.currentTarget.style.cursor=h?"grab":"default"},[l,st,pt,gt]),Dt=o.useCallback(t=>{var m;if(performance.now()-L.current>300)return;const r=t.currentTarget.getBoundingClientRect(),c=t.clientX-r.left,s=t.clientY-r.top,h=st(c,s,r.width,r.height);h&&((m=I.current)==null||m.call(I,{laneId:h.lane.id,item:h.item,originalEvent:t.nativeEvent}))},[st]),d=o.useCallback(t=>{var h;const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=st(r,c,n.width,n.height);s&&((h=X.current)==null||h.call(X,{laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent}))},[st]),_=o.useCallback(t=>{const n=t.currentTarget.getBoundingClientRect(),r=t.clientX-n.left,c=t.clientY-n.top,s=st(r,c,n.width,n.height);s&&W.current?(t.preventDefault(),W.current({laneId:s.lane.id,item:s.item,originalEvent:t.nativeEvent})):t.preventDefault()},[st]);return o.useEffect(()=>()=>{B.current!==null&&cancelAnimationFrame(B.current),F.current!==null&&cancelAnimationFrame(F.current)},[]),u.jsx("canvas",{ref:C,style:{width:"100%",flex:1,minHeight:0,display:"block",cursor:"default"},onMouseDown:Tt,onMouseMove:Mt,onClick:Dt,onDoubleClick:d,onMouseLeave:()=>{var t;G.current&&(G.current=null,(t=a.current)==null||t.call(a,null),l()),e.current==="none"&&C.current&&(C.current.style.cursor="default")},onContextMenu:_})});yt.displayName="TimelineCanvas";const Ot=[2,4,8,16,32,100,1],It=[1,2,4,8,16,32,100],Ht=({startTime:x,endTime:M,currentTime:S,clock:i,onTimeChange:R,onPlayPause:P,onMultiplierChange:V,height:N,showControls:H=!0,enableDrag:A=!0,dateTimeFormat:U,onDateTimeClick:rt,jumpToTime:$,maxTicks:tt,ffSpeeds:K=Ot,rwSpeeds:v=It,theme:k,className:C,swimLanes:Z,showSwimLanes:E,onShowSwimLanesChange:p,swimLaneTransition:b="animated",onSwimLaneItemClick:D,onSwimLaneItemHover:T,onSwimLaneItemDoubleClick:lt,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:G})=>{const z=()=>Date.now(),I=x?j.JulianDate.toDate(y.toJulianDate(x)).getTime():z()-432e5,a=M?j.JulianDate.toDate(y.toJulianDate(M)).getTime():z()+12*3600*1e3,[X,W]=o.useState(()=>y.toJulianDate(S??x??j.JulianDate.fromDate(new Date))),[ot,B]=o.useState((i==null?void 0:i.shouldAnimate)??!1),[F,ct]=o.useState((i==null?void 0:i.multiplier)??1),[it,e]=o.useState(E??!0);o.useEffect(()=>{E!=null&&e(E)},[E]);const f=()=>{const d=!it;e(d),p==null||p(d)},w=Z!=null&&Z.length>0,L=o.useRef(null),[nt,ft]=o.useState(0);o.useEffect(()=>{const d=L.current;if(!d)return;const _=new ResizeObserver(([t])=>ft(t.borderBoxSize[0].blockSize));return _.observe(d),()=>_.disconnect()},[H]);const ut=w&&!it?`${nt+y.TICK_AREA_HEIGHT}px`:N!=null?`${N}px`:"100%",Q=o.useRef(!1),l=o.useRef(null),ht={...y.defaultTheme,...k};o.useEffect(()=>{if(!i)return;const d=()=>{if(!Q.current){const _=j.JulianDate.clone(i.currentTime);if(W(_),B(i.shouldAnimate),ct(i.multiplier),l.current){const{startMs:t,endMs:n}=l.current.getVisibleRange(),r=n-t,c=j.JulianDate.toDate(_).getTime(),s=c-t;s<=r*.1?l.current.zoomTo(c-r*.1,c+r*.9,c):s>=r*.9&&l.current.zoomTo(c-r*.9,c+r*.1,c)}}};return i.onTick.addEventListener(d),()=>{i.onTick.removeEventListener(d)}},[i]),o.useEffect(()=>{if(i)return;const d=setInterval(()=>{if(Q.current)return;const _=j.JulianDate.fromDate(new Date);if(W(_),l.current){const{startMs:t,endMs:n}=l.current.getVisibleRange(),r=n-t,c=j.JulianDate.toDate(_).getTime(),s=c-t;s<=r*.1?l.current.zoomTo(c-r*.1,c+r*.9,c):s>=r*.9&&l.current.zoomTo(c-r*.9,c+r*.1,c)}},1e3);return()=>clearInterval(d)},[i]),o.useEffect(()=>{if(!$)return;const d=y.toJulianDate($);if(st(d),l.current){const{startMs:_,endMs:t}=l.current.getVisibleRange(),n=t-_,r=j.JulianDate.toDate(d).getTime();l.current.zoomTo(r-n/2,r+n/2)}},[$]);const at=(d,_=!0)=>{i&&(i.multiplier=d,_&&(i.shouldAnimate=!0)),ct(d),_&&B(!0),V==null||V(d)},st=d=>{W(d),i&&(i.currentTime=j.JulianDate.clone(d)),R==null||R(d)},gt=d=>{d&&F<0&&at(1,!1),i&&(i.shouldAnimate=d),B(d),P==null||P(d)},pt=()=>{const d=K.length>0?K:Ot,_=F>1?F:1,t=d.indexOf(_),n=d[t<0||t===d.length-1?0:t+1];at(n)},Tt=()=>{const d=v.length>0?v:It,_=F<0?Math.abs(F):0,t=d.indexOf(_),n=-d[t<0||t===d.length-1?0:t+1];at(n)},mt=()=>{var _;const d=y.toJulianDate(x??j.JulianDate.fromDate(new Date(I)));i&&(i.currentTime=j.JulianDate.clone(d)),W(d),(_=l.current)==null||_.zoomTo(I,a)},bt=()=>{var _;const d=y.toJulianDate(M??j.JulianDate.fromDate(new Date(a)));i&&(i.currentTime=j.JulianDate.clone(d)),W(d),(_=l.current)==null||_.zoomTo(I,a)},Mt=()=>{var t;const d=j.JulianDate.fromDate(new Date);i&&(i.currentTime=j.JulianDate.clone(d)),W(d),at(1);const _=Date.now();(t=l.current)==null||t.zoomTo(_-12*3600*1e3,_+12*3600*1e3)},Dt=Math.abs(j.JulianDate.toDate(X).getTime()-Date.now())<1e4;return u.jsxs("div",{className:C,style:{width:"100%",height:ut,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"system-ui, -apple-system, sans-serif",transition:b==="animated"?"height 0.2s ease":void 0},children:[H&&u.jsx("div",{ref:L,children:u.jsx(Lt,{currentTime:X,isPlaying:ot,multiplier:F,isLive:Dt,hasStartTime:x!=null,hasEndTime:M!=null,onPlayPause:gt,onJumpToStart:mt,onRewind:Tt,onFastForward:pt,onJumpToEnd:bt,onJumpToLive:Mt,onResetSpeed:()=>at(1),onDateTimeClick:rt,dateTimeFormat:U,theme:ht,swimLanesVisible:w?it:void 0,onToggleSwimLanes:w?f:void 0})}),A!==!1&&u.jsx(yt,{ref:l,currentTime:X,defaultStartMs:I,defaultEndMs:a,theme:ht,maxTicks:tt,onTimeChange:st,onDragStart:()=>{Q.current=!0},onDragEnd:()=>{Q.current=!1},swimLanes:Z,showSwimLanes:it,onSwimLaneItemClick:D,onSwimLaneItemHover:T,onSwimLaneItemDoubleClick:lt,onSwimLaneItemContextMenu:Y,onSwimLaneReorder:G})]})},Ut=({startTime:x,endTime:M,currentTime:S,width:i,height:R,tickInterval:P,showLabels:V,snapToTicks:N,enableDrag:H,theme:A,onTimeChange:U,onVisibleRangeChange:rt,onDragStart:$,onDragEnd:tt})=>{const K=o.useMemo(()=>y.generateTicks(x,M,P,i),[x,M,P,i]),v=o.useMemo(()=>y.timeToPosition(S,x,M,i),[S,x,M,i]),k=o.useRef(null),C=E=>{if(!H)return;const p=E.currentTarget.getBoundingClientRect(),b=E.clientX-p.left,D=Math.max(0,Math.min(i,b));if(!(Math.abs(D-v)<=10)){let B=D;N&&(B=y.snapToTick(D,K,10));const F=new Date(x).getTime(),ct=new Date(M).getTime();U(j.JulianDate.fromDate(new Date(F+B/i*(ct-F))));return}$==null||$();const lt=E.clientX,Y=new Date(S).getTime(),G=new Date(x).getTime(),I=(new Date(M).getTime()-G)/i;let a=0,X=!1;const W=B=>{a=B.clientX-lt,X=!0,k.current||(k.current=requestAnimationFrame(()=>{if(X){const F=Y+a*I;U(j.JulianDate.fromDate(new Date(F))),X=!1}k.current=null}))},ot=()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ot),k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),tt==null||tt()};document.addEventListener("mousemove",W),document.addEventListener("mouseup",ot)},Z=E=>{E.preventDefault();const p=E.shiftKey?E.deltaY:E.deltaX!==0?E.deltaX:E.deltaY;if(Math.abs(p)<1)return;const b=new Date(x).getTime(),D=new Date(M).getTime(),T=p/i*(D-b)*.5;rt==null||rt(j.JulianDate.fromDate(new Date(b+T)),j.JulianDate.fromDate(new Date(D+T)))};return u.jsxs("svg",{width:"100%",height:R,style:{backgroundColor:A.backgroundColor,display:"block",cursor:"default"},onMouseDown:C,onWheel:Z,children:[u.jsx("rect",{width:i,height:R,fill:A.backgroundColor}),K.map((E,p)=>u.jsxs("g",{children:[u.jsx("line",{x1:E.position,y1:R-(E.isMajor?A.majorTickHeight:A.minorTickHeight),x2:E.position,y2:R,stroke:E.isMajor?A.majorTickColor:A.tickColor,strokeWidth:"1"}),V&&E.isMajor&&E.label&&u.jsx("text",{x:E.position,y:R-A.majorTickHeight-5,textAnchor:"middle",fill:A.labelColor,fontSize:A.fontSize,fontFamily:"monospace",children:E.label})]},p)),u.jsx("line",{x1:v,y1:0,x2:v,y2:R,stroke:A.indicatorColor,strokeWidth:A.indicatorLineWidth,pointerEvents:"none"}),H&&u.jsx("rect",{x:Math.max(0,v-10),y:0,width:20,height:R,fill:"transparent",style:{cursor:"ew-resize"},pointerEvents:"visiblePainted"}),u.jsx("circle",{cx:v,cy:5,r:4,fill:A.indicatorColor,pointerEvents:"none"})]})};Object.defineProperty(et,"TICK_AREA_HEIGHT",{enumerable:!0,get:()=>y.TICK_AREA_HEIGHT}),et.Timeline=Ht,et.TimelineCanvas=yt,et.TimelineControls=Lt,et.TimelineSVG=Ut,Object.keys(y).forEach(x=>{x!=="default"&&!Object.prototype.hasOwnProperty.call(et,x)&&Object.defineProperty(et,x,{enumerable:!0,get:()=>y[x]})}),Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as Cesium from 'cesium';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { SwimLane } from '@kteneyck/cesium-timeline-core';
|
|
4
|
+
import { SwimLaneEventInfo } from '@kteneyck/cesium-timeline-core';
|
|
5
|
+
import { TICK_AREA_HEIGHT } from '@kteneyck/cesium-timeline-core';
|
|
6
|
+
import { TickInterval } from '@kteneyck/cesium-timeline-core';
|
|
7
|
+
import { TimelineTheme } from '@kteneyck/cesium-timeline-core';
|
|
8
|
+
|
|
9
|
+
/** React-specific controls props (uses Cesium.JulianDate for currentTime). */
|
|
10
|
+
export declare interface ControlsProps {
|
|
11
|
+
currentTime: Cesium.JulianDate;
|
|
12
|
+
isPlaying: boolean;
|
|
13
|
+
multiplier: number;
|
|
14
|
+
dateTimeFormat?: string;
|
|
15
|
+
onDateTimeClick?: () => void;
|
|
16
|
+
onPlayPause: (isPlaying: boolean) => void;
|
|
17
|
+
onJumpToStart: () => void;
|
|
18
|
+
onRewind: () => void;
|
|
19
|
+
onFastForward: () => void;
|
|
20
|
+
onJumpToEnd: () => void;
|
|
21
|
+
onJumpToLive: () => void;
|
|
22
|
+
onResetSpeed: () => void;
|
|
23
|
+
isLive: boolean;
|
|
24
|
+
hasStartTime: boolean;
|
|
25
|
+
hasEndTime: boolean;
|
|
26
|
+
theme: TimelineTheme;
|
|
27
|
+
swimLanesVisible?: boolean;
|
|
28
|
+
onToggleSwimLanes?: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { TICK_AREA_HEIGHT }
|
|
32
|
+
|
|
33
|
+
export declare const Timeline: default_2.FC<TimelineProps>;
|
|
34
|
+
|
|
35
|
+
export declare const TimelineCanvas: default_2.ForwardRefExoticComponent<TimelineCanvasProps & default_2.RefAttributes<TimelineCanvasHandle>>;
|
|
36
|
+
|
|
37
|
+
export declare interface TimelineCanvasHandle {
|
|
38
|
+
/** Reposition the visible window. Pass `currentMs` to atomically update the needle too (avoids jitter). */
|
|
39
|
+
zoomTo(startMs: number, endMs: number, currentMs?: number): void;
|
|
40
|
+
getVisibleRange(): {
|
|
41
|
+
startMs: number;
|
|
42
|
+
endMs: number;
|
|
43
|
+
};
|
|
44
|
+
/** Start a smooth RAF-based follow scroll at the given rate (clock multiplier). */
|
|
45
|
+
startFollow(rate: number): void;
|
|
46
|
+
/** Stop the follow scroll. */
|
|
47
|
+
stopFollow(): void;
|
|
48
|
+
/** Correct accumulated drift while follow scroll is active (called from onTick). */
|
|
49
|
+
correctFollow(currentMs: number): void;
|
|
50
|
+
/** Append a swim lane. */
|
|
51
|
+
appendSwimLane(lane: SwimLane): void;
|
|
52
|
+
/** Update a swim lane by id. */
|
|
53
|
+
updateSwimLane(id: string, updates: Partial<SwimLane>): void;
|
|
54
|
+
/** Remove a swim lane by id. */
|
|
55
|
+
removeSwimLane(id: string): void;
|
|
56
|
+
/** Reorder swim lanes to match the given id order. */
|
|
57
|
+
reorderSwimLanes(orderedIds: string[]): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare interface TimelineCanvasProps {
|
|
61
|
+
currentTime: Cesium.JulianDate;
|
|
62
|
+
defaultStartMs: number;
|
|
63
|
+
defaultEndMs: number;
|
|
64
|
+
theme: TimelineTheme;
|
|
65
|
+
maxTicks?: number;
|
|
66
|
+
onTimeChange: (time: Cesium.JulianDate) => void;
|
|
67
|
+
onDragStart?: () => void;
|
|
68
|
+
onDragEnd?: () => void;
|
|
69
|
+
swimLanes?: SwimLane[];
|
|
70
|
+
showSwimLanes?: boolean;
|
|
71
|
+
onSwimLaneItemClick?: (info: SwimLaneEventInfo) => void;
|
|
72
|
+
onSwimLaneItemHover?: (info: SwimLaneEventInfo | null) => void;
|
|
73
|
+
onSwimLaneItemDoubleClick?: (info: SwimLaneEventInfo) => void;
|
|
74
|
+
onSwimLaneItemContextMenu?: (info: SwimLaneEventInfo) => void;
|
|
75
|
+
onSwimLaneReorder?: (orderedLaneIds: string[]) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export declare const TimelineControls: default_2.FC<ControlsProps>;
|
|
79
|
+
|
|
80
|
+
export declare interface TimelineProps {
|
|
81
|
+
startTime?: Cesium.JulianDate | Date;
|
|
82
|
+
endTime?: Cesium.JulianDate | Date;
|
|
83
|
+
currentTime?: Cesium.JulianDate | Date;
|
|
84
|
+
clock?: Cesium.Clock;
|
|
85
|
+
onTimeChange?: (time: Cesium.JulianDate) => void;
|
|
86
|
+
onPlayPause?: (isPlaying: boolean) => void;
|
|
87
|
+
onMultiplierChange?: (multiplier: number) => void;
|
|
88
|
+
height?: number;
|
|
89
|
+
showControls?: boolean;
|
|
90
|
+
enableDrag?: boolean;
|
|
91
|
+
dateTimeFormat?: string;
|
|
92
|
+
onDateTimeClick?: () => void;
|
|
93
|
+
jumpToTime?: Cesium.JulianDate | Date;
|
|
94
|
+
maxTicks?: number;
|
|
95
|
+
ffSpeeds?: number[];
|
|
96
|
+
rwSpeeds?: number[];
|
|
97
|
+
theme?: Partial<TimelineTheme>;
|
|
98
|
+
className?: string;
|
|
99
|
+
swimLanes?: SwimLane[];
|
|
100
|
+
showSwimLanes?: boolean;
|
|
101
|
+
onShowSwimLanesChange?: (visible: boolean) => void;
|
|
102
|
+
swimLaneTransition?: 'animated' | 'instant';
|
|
103
|
+
onSwimLaneItemClick?: (info: SwimLaneEventInfo) => void;
|
|
104
|
+
onSwimLaneItemHover?: (info: SwimLaneEventInfo | null) => void;
|
|
105
|
+
onSwimLaneItemDoubleClick?: (info: SwimLaneEventInfo) => void;
|
|
106
|
+
onSwimLaneItemContextMenu?: (info: SwimLaneEventInfo) => void;
|
|
107
|
+
onSwimLaneReorder?: (orderedLaneIds: string[]) => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export declare const TimelineSVG: default_2.FC<TimelineSVGProps>;
|
|
111
|
+
|
|
112
|
+
declare interface TimelineSVGProps {
|
|
113
|
+
startTime: Cesium.JulianDate | Date;
|
|
114
|
+
endTime: Cesium.JulianDate | Date;
|
|
115
|
+
currentTime: Cesium.JulianDate | Date;
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
tickInterval: TickInterval | number;
|
|
119
|
+
showLabels: boolean;
|
|
120
|
+
snapToTicks: boolean;
|
|
121
|
+
enableDrag: boolean;
|
|
122
|
+
theme: TimelineTheme;
|
|
123
|
+
onTimeChange: (time: Cesium.JulianDate) => void;
|
|
124
|
+
onVisibleRangeChange?: (start: Cesium.JulianDate, end: Cesium.JulianDate) => void;
|
|
125
|
+
onDragStart?: () => void;
|
|
126
|
+
onDragEnd?: () => void;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
export * from "@kteneyck/cesium-timeline-core";
|
|
131
|
+
|
|
132
|
+
export { }
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kteneyck/cesium-timeline-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React timeline component for Cesium with clock integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "kteneyck",
|
|
7
|
+
"keywords": ["cesium", "timeline", "react", "cesiumjs", "gis", "3d", "geospatial"],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Hive-Space/cesium-timeline.git",
|
|
11
|
+
"directory": "packages/react"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/Hive-Space/cesium-timeline#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/Hive-Space/cesium-timeline/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./dist/cesium-timeline-react.umd.cjs",
|
|
22
|
+
"module": "./dist/cesium-timeline-react.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/cesium-timeline-react.js",
|
|
27
|
+
"require": "./dist/cesium-timeline-react.umd.cjs",
|
|
28
|
+
"types": "./dist/index.d.ts"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "vite build",
|
|
36
|
+
"test": "vitest"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"cesium": "^1.100.0",
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-dom": "^19.0.0",
|
|
42
|
+
"@types/react": ">=18",
|
|
43
|
+
"@types/react-dom": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@kteneyck/cesium-timeline-core": "0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/react": "19.0.1",
|
|
50
|
+
"@types/react-dom": "19.0.1",
|
|
51
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
52
|
+
"cesium": "^1.100.0",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0",
|
|
55
|
+
"typescript": "^5.9.0",
|
|
56
|
+
"vite": "^6.0.0",
|
|
57
|
+
"vite-plugin-dts": "^4.0.0",
|
|
58
|
+
"vitest": "^4.0.0"
|
|
59
|
+
}
|
|
60
|
+
}
|