@equinor/fusion-framework-cli 4.1.0 → 5.0.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.0.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-cli@4.1.0...@equinor/fusion-framework-cli@5.0.0) (2023-02-13)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - **utils/observable:** `useObservableInputState` and `useObservableSelectorState` now return full state, not only value
11
+
12
+ ### Bug Fixes
13
+
14
+ - **utils/observable:** rename `next` to `value`from `useObservableState` ([4a08445](https://github.com/equinor/fusion-framework/commit/4a08445645af2488666564c2da716d32aa5e88c0))
15
+ - **utils/observable:** when subject in useObservableState reset state ([9c5c041](https://github.com/equinor/fusion-framework/commit/9c5c041d3d8c0b01bd507ea7f672711d9f5cb653))
16
+
6
17
  ## [4.1.0](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-cli@4.0.4...@equinor/fusion-framework-cli@4.1.0) (2023-02-09)
7
18
 
8
19
  ### Features
@@ -434,7 +434,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
434
434
  * LICENSE.md file in the root directory of this source tree.
435
435
  *
436
436
  * @license MIT
437
- */function gf(){return gf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gf.apply(this,arguments)}function kA(t,e){return Bk({basename:e==null?void 0:e.basename,history:lk({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||AA(),routes:F8(t)}).initialize()}function AA(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=gf({},e,{errors:TA(e.errors)})),e}function TA(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,i]of e)if(i&&i.__type==="RouteErrorResponse")r[n]=new op(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){let o=new Error(i.message);o.stack="",r[n]=o}else r[n]=i;return r}var T4;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmitImpl="useSubmitImpl",t.UseFetcher="useFetcher"})(T4||(T4={}));var I4;(function(t){t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(I4||(I4={}));const IA=(t,e,r)=>{I.useEffect(()=>{const n=t.subscribe(e);return n.add(r),()=>n.unsubscribe()},[t,e])},MA=(t,e,r)=>{I.useLayoutEffect(()=>{const n=t.subscribe(e);return n.add(r),()=>n.unsubscribe()},[t,e])};function lp(t,e){var r;const n=(r=e==null?void 0:e.initial)!==null&&r!==void 0?r:t.value,[i,o]=I.useState(n),[a,s]=I.useState(null),[c,l]=I.useState(!1);return MA(t,I.useMemo(()=>({next:o,error:s,complete:()=>l(!0)}),[]),e==null?void 0:e.teardown),{next:i,error:a,complete:c}}const yf=({error:t})=>Gr(D9,{children:[Gr("div",{style:{marginTop:20,border:"1px solid"},children:[Y("h4",{style:{backgroundColor:"rgb(153, 0, 37)",color:"white",padding:10,margin:0},children:t.message}),Y("section",{style:{padding:10},children:t.stack&&Y("pre",{children:t.stack})})]}),t.cause&&Y(yf,{error:t.cause})]}),PA=t=>{const{appKey:e}=t,r=rh(),n=I.useRef(null),i=I.useRef(document.createElement("div")),[o,a]=I.useState(!1),[s,c]=I.useState(),l=lp(r.modules.app.current$).next;return I.useEffect(()=>{r.modules.app.setCurrentApp(e)},[e]),I.useEffect(()=>{a(!0),c(void 0);const d=new _n;return d.add(l==null?void 0:l.initialize().subscribe({next:({manifest:h,script:u,config:f})=>{const[m]=window.location.pathname.match(/\/?apps\/[a-z|-]+(\/)?/g)??[""];i.current=document.createElement("div");const v=u.renderApp??u.default;d.add(v(i.current,{fusion:r,env:{basename:m,config:f,manifest:h}}))},complete:()=>{a(!1)},error:h=>{c(h)}})),()=>d.unsubscribe()},[l,i]),I.useEffect(()=>{const d=n.current,h=i.current;if(h&&d)return d.appendChild(h),()=>{try{d.removeChild(h)}catch(u){console.error(u)}}},[n.current,i.current]),s?s.cause instanceof qi?Gr("div",{children:[Y("h2",{children:"🔥 Failed to load application manifest 🤬"}),Y("h3",{children:s.cause.type}),Y(yf,{error:s}),";"]}):Gr("div",{children:[Y("h2",{children:"🔥 Failed to load application 🤬"}),Y(yf,{error:s}),";"]}):o?Y(C8,{text:"Loading Application"}):Y("section",{ref:n})},RA=()=>{const t=rh().modules.app;if(!t)throw Error("Current framework does not have AppModule configured");return{currentApp:lp(t.current$).next,setCurrentApp:I.useMemo(()=>t.setCurrentApp.bind(t),[t]),clearCurrentApp:I.useMemo(()=>t.clearCurrentApp.bind(t),[t])}};class ch extends CustomEvent{constructor(e){super(ch.eventName,e)}}ch.eventName="select";class Ja extends CustomEvent{constructor(e){super(Ja.eventName,e)}}Ja.eventName="fwc-searchabledropdown-controller-connect";var Js;class U8 extends Qe{constructor(){super(...arguments),this.resolverCallbacks=[],Js.set(this,void 0)}createRenderRoot(){return this}connectResolver(e){ia(this,Js,e,"f"),this.resolverCallbacks.forEach(r=>{r(e)})}removeResolver(){this.resolverCallbacks.forEach(e=>{e()})}connectedCallback(){super.connectedCallback(),this.addEventListener(Ja.eventName,this.handleElementConnect)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Ja.eventName,this.handleElementConnect)}handleElementConnect(e){const{disconnectedCallback:r,updateResolver:n}=e.detail;r(()=>{this.resolverCallbacks.filter(i=>i!==n)}),ye(this,Js,"f")&&n(ye(this,Js,"f")),this.resolverCallbacks.push(n),e.preventDefault(),e.stopPropagation()}}Js=new WeakMap;/**
437
+ */function gf(){return gf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gf.apply(this,arguments)}function kA(t,e){return Bk({basename:e==null?void 0:e.basename,history:lk({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||AA(),routes:F8(t)}).initialize()}function AA(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=gf({},e,{errors:TA(e.errors)})),e}function TA(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,i]of e)if(i&&i.__type==="RouteErrorResponse")r[n]=new op(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){let o=new Error(i.message);o.stack="",r[n]=o}else r[n]=i;return r}var T4;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmitImpl="useSubmitImpl",t.UseFetcher="useFetcher"})(T4||(T4={}));var I4;(function(t){t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(I4||(I4={}));const IA=(t,e,r)=>{I.useEffect(()=>{const n=t.subscribe(e);return n.add(r),()=>n.unsubscribe()},[t,e])},MA=(t,e,r)=>{I.useLayoutEffect(()=>{const n=t.subscribe(e);return n.add(r),()=>n.unsubscribe()},[t,e])};function lp(t,e){const[r]=I.useState(e==null?void 0:e.initial),[n,i]=I.useState(r),[o,a]=I.useState(null),[s,c]=I.useState(!1),l=I.useCallback(()=>{a(null),i(r),c(!1)},[i,a,c,r]);I.useLayoutEffect(()=>{const h=t.value;return h&&i(h),l},[i,l,t]);const d=I.useMemo(()=>({next:i,error:a,complete:()=>c(!0)}),[i,a,c]);return MA(t,d,e==null?void 0:e.teardown),{value:n,error:o,complete:s}}const yf=({error:t})=>Gr(D9,{children:[Gr("div",{style:{marginTop:20,border:"1px solid"},children:[Y("h4",{style:{backgroundColor:"rgb(153, 0, 37)",color:"white",padding:10,margin:0},children:t.message}),Y("section",{style:{padding:10},children:t.stack&&Y("pre",{children:t.stack})})]}),t.cause&&Y(yf,{error:t.cause})]}),PA=t=>{const{appKey:e}=t,r=rh(),n=I.useRef(null),i=I.useRef(document.createElement("div")),[o,a]=I.useState(!1),[s,c]=I.useState(),{value:l}=lp(I.useMemo(()=>r.modules.app.current$,[r.modules.app]));return I.useEffect(()=>{r.modules.app.setCurrentApp(e)},[e]),I.useEffect(()=>{a(!0),c(void 0);const d=new _n;return d.add(l==null?void 0:l.initialize().subscribe({next:({manifest:h,script:u,config:f})=>{const[m]=window.location.pathname.match(/\/?apps\/[a-z|-]+(\/)?/g)??[""];i.current=document.createElement("div");const v=u.renderApp??u.default;d.add(v(i.current,{fusion:r,env:{basename:m,config:f,manifest:h}}))},complete:()=>{a(!1)},error:h=>{c(h)}})),()=>d.unsubscribe()},[l,i]),I.useEffect(()=>{const d=n.current,h=i.current;if(h&&d)return d.appendChild(h),()=>{try{d.removeChild(h)}catch(u){console.error(u)}}},[n.current,i.current]),s?s.cause instanceof qi?Gr("div",{children:[Y("h2",{children:"🔥 Failed to load application manifest 🤬"}),Y("h3",{children:s.cause.type}),Y(yf,{error:s}),";"]}):Gr("div",{children:[Y("h2",{children:"🔥 Failed to load application 🤬"}),Y(yf,{error:s}),";"]}):o?Y(C8,{text:"Loading Application"}):Y("section",{ref:n})},RA=()=>{const t=rh().modules.app;if(!t)throw Error("Current framework does not have AppModule configured");const e=I.useMemo(()=>t.current$,[t]),{value:r}=lp(e);return{currentApp:r,setCurrentApp:I.useMemo(()=>t.setCurrentApp.bind(t),[t]),clearCurrentApp:I.useMemo(()=>t.clearCurrentApp.bind(t),[t])}};class ch extends CustomEvent{constructor(e){super(ch.eventName,e)}}ch.eventName="select";class Ja extends CustomEvent{constructor(e){super(Ja.eventName,e)}}Ja.eventName="fwc-searchabledropdown-controller-connect";var Js;class U8 extends Qe{constructor(){super(...arguments),this.resolverCallbacks=[],Js.set(this,void 0)}createRenderRoot(){return this}connectResolver(e){ia(this,Js,e,"f"),this.resolverCallbacks.forEach(r=>{r(e)})}removeResolver(){this.resolverCallbacks.forEach(e=>{e()})}connectedCallback(){super.connectedCallback(),this.addEventListener(Ja.eventName,this.handleElementConnect)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Ja.eventName,this.handleElementConnect)}handleElementConnect(e){const{disconnectedCallback:r,updateResolver:n}=e.detail;r(()=>{this.resolverCallbacks.filter(i=>i!==n)}),ye(this,Js,"f")&&n(ye(this,Js,"f")),this.resolverCallbacks.push(n),e.preventDefault(),e.stopPropagation()}}Js=new WeakMap;/**
438
438
  * @license
439
439
  * Copyright 2017 Google LLC
440
440
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1717,7 +1717,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1717
1717
  .list-scroll {
1718
1718
  max-height: ${this.dropdownHeight};
1719
1719
  }
1720
- </style>`}}Ut.shadowRootOptions=Object.assign({},Object.assign(Qe.shadowRootOptions,{delegatesFocus:!0}));Ut.styles=[KU];y([x()],Ut.prototype,"label",void 0);y([x()],Ut.prototype,"placeholder",void 0);y([x()],Ut.prototype,"variant",void 0);y([x()],Ut.prototype,"leadingIcon",void 0);y([x({attribute:!1,state:!0})],Ut.prototype,"trailingIcon",void 0);y([x()],Ut.prototype,"meta",void 0);y([x()],Ut.prototype,"value",void 0);y([x()],Ut.prototype,"graphic",void 0);y([x()],Ut.prototype,"initialText",void 0);y([x()],Ut.prototype,"multiple",void 0);y([x()],Ut.prototype,"dropdownHeight",void 0);y([x()],Ut.prototype,"autofocus",void 0);y([Nt("fwc-textinput")],Ut.prototype,"textInputElement",void 0);const WU="fwc-searchable-dropdown";let J4=class extends Ut{};J4=y([Ue(WU)],J4);const YU=bn(Ut,"fwc-searchable-dropdown",{events:{onSelect:"select",onDropdownClosed:"dropdownClosed"}}),QU=bn(U8,"fwc-searchable-dropdown-provider"),XU=t=>{const e=I.useRef(null);return I.useEffect(()=>{const r=e==null?void 0:e.current;if(r&&t)return e.current.connectResolver(t),()=>{r.removeResolver()}},[e,t]),e},JU=({children:t,...e})=>{const r=XU(e.resolver);return Y(QU,{ref:r,children:t})},ZU=({children:t,...e})=>Y(YU,{...e,children:t}),Z4=bn(up,fh),eB=o8(t=>a8({root:{width:"100%",margin:"0",color:t.colors.text.static_icons__default.getVariable("color")},icon:{display:"flex",justifyContent:"center",alignItems:"center",width:"35px",fontWeight:400},closeBtn:{width:"100%",height:"100%",background:"none",border:"1px solid transparent",borderRadius:"var(--mdc-shape-small, 4px)",color:t.colors.interactive.primary__resting.getVariable("color"),padding:0,"&:hover":{borderColor:t.colors.interactive.primary__resting.getVariable("color")}},context:{display:"flex",justifyContent:"space-between",alignItems:"stretch"},titleBlock:{flex:"1 1 auto",display:"flex",flexDirection:"column",alignItems:"flex-start",fontSize:"0.9em",border:"1px solid transparent",borderRadius:"var(--mdc-shape-small, 4px)",padding:"0.25em","&:hover":{borderColor:t.colors.interactive.primary__resting.getVariable("color")}},title:{fontSize:"1em",fontWeight:"bold"},subTitle:{fontSize:"0.8em",fontStyle:"italic"}}),{name:"fusion-header-context-selector"}),eg={id:"temp-dev-id",title:"Select Context",subTitle:"Context",graphic:"list",isDisabled:!0},tB=({children:t,onSelect:e,previewItem:r,onClearContext:n,...i})=>{const o=r?Object.assign(eg,r):eg,a=I.useRef(null),[s,c]=I.useState(o),[l,d]=I.useState(!1),h=eB(),u=I.useCallback(v=>{const w=v.nativeEvent.detail.selected[0];c(w),d(!1),e&&e(v)},[c,e]),f=I.useCallback(v=>{c(o),n&&n(v)},[o,n]),m=I.useCallback(v=>{var w,g;v.key==="Escape"&&d(!1),(v.key===" "||v.key==="Enter")&&(((w=v.target)==null?void 0:w.className.indexOf("titleBlock"))>0?d(!0):((g=v.target)==null?void 0:g.className.indexOf("closeBtn"))>0&&f(v),v.stopPropagation(),v.preventDefault())},[f]);return I.useEffect(()=>(window.addEventListener("keyup",m),()=>{window.removeEventListener("keyup",m)}),[m]),I.useEffect(()=>{const v=a.current;return v&&v.addEventListener("dropdownClosed",()=>{d(!1)}),()=>{v&&v.removeEventListener("dropdownClosed",()=>null)}},[a]),Y("div",{ref:a,className:h.root,children:s&&!l?Gr("div",{className:h.context,onKeyUp:()=>m,children:[Y("div",{className:h.icon,children:s.graphic&&Y(Z4,{icon:s.graphic})}),Gr("div",{tabIndex:0,className:h.titleBlock,onClick:()=>d(!0),children:[Y("span",{className:h.title,children:s.title}),Y("span",{className:h.subTitle,children:s.subTitle})]}),Y("div",{className:h.icon,children:s&&!s.isDisabled&&Y("button",{className:uf(h.closeBtn),onClick:f,children:Y(Z4,{icon:"close"})})})]}):Y(ZU,{...i,onSelect:u,children:t})})},tg=t=>t.map(e=>({id:e.id,title:e.title,subTitle:e.type.id,graphic:e.type.id==="OrgChart"?"list":void 0})),rg=t=>Object.assign({id:"no-such-item",title:"Change me"},t),rB=[],nB=()=>{const t=rh(),e=lp(t.modules.context.currentContext$).next,r=I.useMemo(()=>e?tg([e]):rB,[e]),[n,i]=I.useState(null),{currentApp:o}=RA(),a=I.useMemo(()=>(o==null?void 0:o.instance$)||Wi,[o]),s=I.useCallback(u=>{const f=u.context;f&&i(f)},[i]),c=I.useCallback(()=>i(null),[i]);IA(a,s,c);const l=I.useMemo(()=>({searchQuery:async u=>{if(!n)return[];const f=3;if(u.length<f)return[rg({id:"min-length",title:`Type ${f-u.length} more chars to search`,isDisabled:!0})];try{const m=await n.queryContextAsync(u);return m.length?tg(m):[rg({id:"no-results",title:"No results found",isDisabled:!0})]}catch{return console.log("ContextResolver query was cancelled"),[]}},initialResult:r}),[n,r]),d=I.useCallback(u=>{var f;(f=u.nativeEvent.detail)!=null&&f.selected.length&&t.modules.context.contextClient.setCurrentContext(u.nativeEvent.detail.selected[0].id)},[t]),h=I.useCallback(()=>{var u,f;(f=(u=t==null?void 0:t.modules)==null?void 0:u.context)==null||f.clearCurrentContext()},[t]);return[l,d,h]},iB=()=>{const[t,e,r]=nB();return Y(JU,{resolver:t,children:Y(tB,{id:"context-selector-header",placeholder:"Search for context",initialText:"Start typing to search",dropdownHeight:"300px",variant:"header",onSelect:e,autofocus:!0,onClearContext:r})})},oB=({scale:t=1})=>Gr("svg",{width:"50",height:"35",viewBox:"0 0 50 35",fill:"none",style:{transform:`scale(${t})`},children:[Y("path",{d:"M0 2V23.1776L7.05405 16.1235V7.05405H16.1235L23.1776 0H2C0.895431 0 0 0.89543 0 2Z",transform:"translate(50 17.5) scale(0.92727 1.06779) rotate(135)",fill:"url(#paint0_linear)"}),Y("path",{d:"M0 2V23.1776L7.05405 16.1235V7.05405H16.1235L23.1776 0H2C0.895431 0 0 0.89543 0 2Z",transform:"translate(0 17.5) scale(0.92727 1.06779) rotate(-45)",fill:"url(#paint1_linear)"}),Y("path",{d:"M9.61965 36.6972L2.60087 29.6784L1.96135 22.3809L8.42623 22.9069L9.61965 36.6972Z",transform:"translate(33.8887 34.9863) scale(0.92727 -1.06779) rotate(45)",fill:"#990025"}),Y("path",{d:"M7.05434 7.05434L0 0L1.21096 13.8183L7.68846 14.3818L7.05434 7.05434Z",transform:"translate(33.8887 34.9863) scale(0.92727 -1.06779) rotate(45)",fill:"#990025"}),Y("path",{d:"M0 0L2.49398 29.5715L9.61965 36.6972L7.01878 7.01878L0 0Z",transform:"translate(33.8887 0.015625) scale(0.92727 1.06779) rotate(45)",fill:"#FF1243"}),Gr("defs",{children:[Gr("linearGradient",{id:"paint0_linear",x2:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(-13.5478 9.01983 -12.9578 -13.5478 18.0677 6.77391)",children:[Y("stop",{offset:"0.508287",stopColor:"#DC002E"}),Y("stop",{offset:"0.508387",stopColor:"#FF1243"})]}),Gr("linearGradient",{id:"paint1_linear",x2:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(-13.5478 9.01983 -12.9578 -13.5478 18.0677 6.77391)",children:[Y("stop",{offset:"0.508287",stopColor:"#DC002E"}),Y("stop",{offset:"0.508387",stopColor:"#FF1243"})]})]})]});/**
1720
+ </style>`}}Ut.shadowRootOptions=Object.assign({},Object.assign(Qe.shadowRootOptions,{delegatesFocus:!0}));Ut.styles=[KU];y([x()],Ut.prototype,"label",void 0);y([x()],Ut.prototype,"placeholder",void 0);y([x()],Ut.prototype,"variant",void 0);y([x()],Ut.prototype,"leadingIcon",void 0);y([x({attribute:!1,state:!0})],Ut.prototype,"trailingIcon",void 0);y([x()],Ut.prototype,"meta",void 0);y([x()],Ut.prototype,"value",void 0);y([x()],Ut.prototype,"graphic",void 0);y([x()],Ut.prototype,"initialText",void 0);y([x()],Ut.prototype,"multiple",void 0);y([x()],Ut.prototype,"dropdownHeight",void 0);y([x()],Ut.prototype,"autofocus",void 0);y([Nt("fwc-textinput")],Ut.prototype,"textInputElement",void 0);const WU="fwc-searchable-dropdown";let J4=class extends Ut{};J4=y([Ue(WU)],J4);const YU=bn(Ut,"fwc-searchable-dropdown",{events:{onSelect:"select",onDropdownClosed:"dropdownClosed"}}),QU=bn(U8,"fwc-searchable-dropdown-provider"),XU=t=>{const e=I.useRef(null);return I.useEffect(()=>{const r=e==null?void 0:e.current;if(r&&t)return e.current.connectResolver(t),()=>{r.removeResolver()}},[e,t]),e},JU=({children:t,...e})=>{const r=XU(e.resolver);return Y(QU,{ref:r,children:t})},ZU=({children:t,...e})=>Y(YU,{...e,children:t}),Z4=bn(up,fh),eB=o8(t=>a8({root:{width:"100%",margin:"0",color:t.colors.text.static_icons__default.getVariable("color")},icon:{display:"flex",justifyContent:"center",alignItems:"center",width:"35px",fontWeight:400},closeBtn:{width:"100%",height:"100%",background:"none",border:"1px solid transparent",borderRadius:"var(--mdc-shape-small, 4px)",color:t.colors.interactive.primary__resting.getVariable("color"),padding:0,"&:hover":{borderColor:t.colors.interactive.primary__resting.getVariable("color")}},context:{display:"flex",justifyContent:"space-between",alignItems:"stretch"},titleBlock:{flex:"1 1 auto",display:"flex",flexDirection:"column",alignItems:"flex-start",fontSize:"0.9em",border:"1px solid transparent",borderRadius:"var(--mdc-shape-small, 4px)",padding:"0.25em","&:hover":{borderColor:t.colors.interactive.primary__resting.getVariable("color")}},title:{fontSize:"1em",fontWeight:"bold"},subTitle:{fontSize:"0.8em",fontStyle:"italic"}}),{name:"fusion-header-context-selector"}),eg={id:"temp-dev-id",title:"Select Context",subTitle:"Context",graphic:"list",isDisabled:!0},tB=({children:t,onSelect:e,previewItem:r,onClearContext:n,...i})=>{const o=r?Object.assign(eg,r):eg,a=I.useRef(null),[s,c]=I.useState(o),[l,d]=I.useState(!1),h=eB(),u=I.useCallback(v=>{const w=v.nativeEvent.detail.selected[0];c(w),d(!1),e&&e(v)},[c,e]),f=I.useCallback(v=>{c(o),n&&n(v)},[o,n]),m=I.useCallback(v=>{var w,g;v.key==="Escape"&&d(!1),(v.key===" "||v.key==="Enter")&&(((w=v.target)==null?void 0:w.className.indexOf("titleBlock"))>0?d(!0):((g=v.target)==null?void 0:g.className.indexOf("closeBtn"))>0&&f(v),v.stopPropagation(),v.preventDefault())},[f]);return I.useEffect(()=>(window.addEventListener("keyup",m),()=>{window.removeEventListener("keyup",m)}),[m]),I.useEffect(()=>{const v=a.current;return v&&v.addEventListener("dropdownClosed",()=>{d(!1)}),()=>{v&&v.removeEventListener("dropdownClosed",()=>null)}},[a]),Y("div",{ref:a,className:h.root,children:s&&!l?Gr("div",{className:h.context,onKeyUp:()=>m,children:[Y("div",{className:h.icon,children:s.graphic&&Y(Z4,{icon:s.graphic})}),Gr("div",{tabIndex:0,className:h.titleBlock,onClick:()=>d(!0),children:[Y("span",{className:h.title,children:s.title}),Y("span",{className:h.subTitle,children:s.subTitle})]}),Y("div",{className:h.icon,children:s&&!s.isDisabled&&Y("button",{className:uf(h.closeBtn),onClick:f,children:Y(Z4,{icon:"close"})})})]}):Y(ZU,{...i,onSelect:u,children:t})})},tg=t=>t.map(e=>({id:e.id,title:e.title,subTitle:e.type.id,graphic:e.type.id==="OrgChart"?"list":void 0})),rg=t=>Object.assign({id:"no-such-item",title:"Change me"},t),rB=[],nB=()=>{const t=rh(),{value:e}=lp(I.useMemo(()=>t.modules.context.currentContext$,[t.modules.context])),r=I.useMemo(()=>e?tg([e]):rB,[e]),[n,i]=I.useState(null),{currentApp:o}=RA(),a=I.useMemo(()=>(o==null?void 0:o.instance$)||Wi,[o]),s=I.useCallback(u=>{const f=u.context;f&&i(f)},[i]),c=I.useCallback(()=>i(null),[i]);IA(a,s,c);const l=I.useMemo(()=>({searchQuery:async u=>{if(!n)return[];const f=3;if(u.length<f)return[rg({id:"min-length",title:`Type ${f-u.length} more chars to search`,isDisabled:!0})];try{const m=await n.queryContextAsync(u);return m.length?tg(m):[rg({id:"no-results",title:"No results found",isDisabled:!0})]}catch{return console.log("ContextResolver query was cancelled"),[]}},initialResult:r}),[n,r]),d=I.useCallback(u=>{var f;(f=u.nativeEvent.detail)!=null&&f.selected.length&&t.modules.context.contextClient.setCurrentContext(u.nativeEvent.detail.selected[0].id)},[t]),h=I.useCallback(()=>{var u,f;(f=(u=t==null?void 0:t.modules)==null?void 0:u.context)==null||f.clearCurrentContext()},[t]);return[l,d,h]},iB=()=>{const[t,e,r]=nB();return Y(JU,{resolver:t,children:Y(tB,{id:"context-selector-header",placeholder:"Search for context",initialText:"Start typing to search",dropdownHeight:"300px",variant:"header",onSelect:e,autofocus:!0,onClearContext:r})})},oB=({scale:t=1})=>Gr("svg",{width:"50",height:"35",viewBox:"0 0 50 35",fill:"none",style:{transform:`scale(${t})`},children:[Y("path",{d:"M0 2V23.1776L7.05405 16.1235V7.05405H16.1235L23.1776 0H2C0.895431 0 0 0.89543 0 2Z",transform:"translate(50 17.5) scale(0.92727 1.06779) rotate(135)",fill:"url(#paint0_linear)"}),Y("path",{d:"M0 2V23.1776L7.05405 16.1235V7.05405H16.1235L23.1776 0H2C0.895431 0 0 0.89543 0 2Z",transform:"translate(0 17.5) scale(0.92727 1.06779) rotate(-45)",fill:"url(#paint1_linear)"}),Y("path",{d:"M9.61965 36.6972L2.60087 29.6784L1.96135 22.3809L8.42623 22.9069L9.61965 36.6972Z",transform:"translate(33.8887 34.9863) scale(0.92727 -1.06779) rotate(45)",fill:"#990025"}),Y("path",{d:"M7.05434 7.05434L0 0L1.21096 13.8183L7.68846 14.3818L7.05434 7.05434Z",transform:"translate(33.8887 34.9863) scale(0.92727 -1.06779) rotate(45)",fill:"#990025"}),Y("path",{d:"M0 0L2.49398 29.5715L9.61965 36.6972L7.01878 7.01878L0 0Z",transform:"translate(33.8887 0.015625) scale(0.92727 1.06779) rotate(45)",fill:"#FF1243"}),Gr("defs",{children:[Gr("linearGradient",{id:"paint0_linear",x2:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(-13.5478 9.01983 -12.9578 -13.5478 18.0677 6.77391)",children:[Y("stop",{offset:"0.508287",stopColor:"#DC002E"}),Y("stop",{offset:"0.508387",stopColor:"#FF1243"})]}),Gr("linearGradient",{id:"paint1_linear",x2:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(-13.5478 9.01983 -12.9578 -13.5478 18.0677 6.77391)",children:[Y("stop",{offset:"0.508287",stopColor:"#DC002E"}),Y("stop",{offset:"0.508387",stopColor:"#FF1243"})]})]})]});/**
1721
1721
  * @license
1722
1722
  * Copyright 2021 Google LLC
1723
1723
  * SPDX-LIcense-Identifier: Apache-2.0
@@ -20,7 +20,7 @@
20
20
  };
21
21
  </script>
22
22
 
23
- <script type="module" crossorigin src="/assets/index-401310fa.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-fe8c8f11.js"></script>
24
24
 
25
25
  <body>
26
26
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-cli",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "keywords": [
5
5
  "Fusion",
6
6
  "Fusion Framework",
@@ -24,8 +24,8 @@
24
24
  "prepack": "yarn build"
25
25
  },
26
26
  "dependencies": {
27
- "@equinor/fusion-framework-app": "^6.0.3",
28
- "@equinor/fusion-observable": "^6.0.0",
27
+ "@equinor/fusion-framework-app": "^6.0.4",
28
+ "@equinor/fusion-observable": "^7.0.0",
29
29
  "@vitejs/plugin-react": "^3.0.0",
30
30
  "commander": "^10.0.0",
31
31
  "express": "^4.18.2",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@equinor/fusion-framework-app": "^6.0.2",
40
- "@equinor/fusion-framework-module-context": "^2.0.3",
41
- "@equinor/fusion-framework-react": "^3.2.0",
42
- "@equinor/fusion-query": "^2.0.3",
40
+ "@equinor/fusion-framework-module-context": "^2.0.4",
41
+ "@equinor/fusion-framework-react": "^4.0.0",
42
+ "@equinor/fusion-query": "^2.0.4",
43
43
  "@equinor/fusion-react-button": "^0.6.1",
44
44
  "@equinor/fusion-react-context-selector": "^0.3.0",
45
45
  "@equinor/fusion-react-icon": "^0.2.15",
@@ -55,5 +55,5 @@
55
55
  "react-router-dom": "^6.4.3",
56
56
  "typescript": "^4.9.3"
57
57
  },
58
- "gitHead": "be1aeed5b4f683fd06e9822ba99113e27a011918"
58
+ "gitHead": "5c04abe62f8da3121c3b54bbab8c6703fcfbb7f6"
59
59
  }