@vuu-ui/vuu-shell 0.5.10 → 0.5.12
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/LICENSE +201 -0
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +7 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +7 -0
- package/index.css +2 -0
- package/index.css.map +7 -0
- package/package.json +14 -10
- package/src/ShellContextProvider.tsx +0 -60
- package/src/app-header/AppHeader.css +0 -6
- package/src/app-header/AppHeader.tsx +0 -33
- package/src/app-header/index.ts +0 -1
- package/src/app-palette/AppPalette.tsx +0 -56
- package/src/app-palette/index.ts +0 -1
- package/src/feature/ErrorBoundary.jsx +0 -31
- package/src/feature/Feature.tsx +0 -52
- package/src/feature/Loader.tsx +0 -2
- package/src/feature/css-module-loader.ts +0 -6
- package/src/feature/index.ts +0 -1
- package/src/get-layout-history.js +0 -12
- package/src/index.ts +0 -5
- package/src/login/LoginPanel.css +0 -24
- package/src/login/LoginPanel.tsx +0 -63
- package/src/login/index.ts +0 -2
- package/src/login/login-utils.ts +0 -21
- package/src/shell.css +0 -15
- package/src/shell.tsx +0 -171
- package/src/shellTypes.ts +0 -18
- package/src/use-force-render.js +0 -6
- package/src/use-layout-config.js +0 -55
- package/src/user-profile/UserPanel.css +0 -26
- package/src/user-profile/UserPanel.tsx +0 -81
- package/src/user-profile/UserProfile.css +0 -3
- package/src/user-profile/UserProfile.tsx +0 -47
- package/src/user-profile/index.ts +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2015 UBS
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var ge=Object.create;var E=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var xe=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Se=(t,e)=>{for(var o in e)E(t,o,{get:e[o],enumerable:!0})},z=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ye(e))!Ce.call(t,n)&&n!==o&&E(t,n,{get:()=>e[n],enumerable:!(r=ve(e,n))||r.enumerable});return t};var F=(t,e,o)=>(o=t!=null?ge(xe(t)):{},z(e||!t||!t.__esModule?E(o,"default",{value:t,enumerable:!0}):o,t)),Pe=t=>z(E({},"__esModule",{value:!0}),t);var Ue={};Se(Ue,{Feature:()=>A,LoginPanel:()=>we,Shell:()=>De,ShellContextProvider:()=>O,getAuthDetailsFromCookies:()=>be,logout:()=>B,redirectToLogin:()=>Z,useShellContext:()=>Re});module.exports=Pe(Ue);var H=F(require("react")),K=require("@vuu-ui/vuu-layout");var _=F(require("react")),S=require("react/jsx-runtime"),M=class extends _.default.Component{constructor(e){super(e),this.state={errorMessage:null}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidCatch(e,o){console.log(e,o)}render(){return this.state.errorMessage?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("h1",{children:"Something went wrong."}),(0,S.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var G=require("react/jsx-runtime"),q=()=>(0,G.jsx)("div",{className:"hwLoader",children:"loading"});var W=async t=>{let e=new CSSStyleSheet;return fetch(t).then(o=>o.text()).then(o=>e.replace(o))};var N=require("react/jsx-runtime");function Le({url:t,css:e,params:o,...r}){e&&W(e).then(s=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,s]});let n=H.default.lazy(()=>import(t));return(0,N.jsx)(M,{children:(0,N.jsx)(H.Suspense,{fallback:(0,N.jsx)(q,{}),children:(0,N.jsx)(n,{...r,...o})})})}var A=H.default.memo(Le);A.displayName="Feature";(0,K.registerComponent)("Feature",A,"view");var I=require("react"),X=require("@salt-ds/core"),b=require("@heswell/salt-lab");var g=require("react/jsx-runtime"),Q="vuuLoginPanel",we=({onSubmit:t})=>{let[e,o]=(0,I.useState)(""),[r,n]=(0,I.useState)(""),s=()=>{t(e,r)},a=(l,c)=>{o(c)},m=(l,c)=>{n(c)},i=e.trim()!==""&&r.trim()!=="";return(0,g.jsxs)("div",{className:Q,children:[(0,g.jsx)(b.FormField,{label:"Username",style:{width:200},children:(0,g.jsx)(b.Input,{value:e,id:"text-username",onChange:a})}),(0,g.jsx)(b.FormField,{label:"Password",style:{width:200},children:(0,g.jsx)(b.Input,{type:"password",value:r,id:"text-password",onChange:m})}),(0,g.jsx)(X.Button,{className:`${Q}-login`,disabled:!i,onClick:s,variant:"cta",children:"Login"})]})};var Y=t=>{var e;return(e=document.cookie.split("; ").find(o=>o.startsWith(`${t}=`)))==null?void 0:e.split("=")[1]},be=()=>{let t=Y("vuu-username"),e=Y("vuu-auth-token");return[t,e]},Z=(t="/login.html")=>{window.location.href=t},B=t=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Z(t)};var ce=require("@vuu-ui/vuu-data"),d=require("react");var v=require("react"),ke=(t,e)=>{let[o,r]=(0,v.useState)(e),n=i=>{r(i)},s=(0,v.useCallback)(async(i="latest")=>{fetch(`api/vui/${t.username}/${i}`,{}).then(l=>l.ok?l.json():e).then(n).catch(()=>{n(e)})},[e,t.username]);(0,v.useEffect)(()=>{s()},[s]);let a=(0,v.useCallback)(i=>{fetch(`api/vui/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}).then(l=>l.ok?l.json():e)},[e,t]),m=(0,v.useCallback)(i=>{s(i)},[s]);return[o,a,m]},j=ke;var D=require("react"),T=require("react/jsx-runtime"),Ne={},V=(0,D.createContext)(Ne),He=({children:t,context:e,inheritedContext:o})=>{let r={...o,...e};return(0,T.jsx)(V.Provider,{value:r,children:t})},O=({children:t,value:e})=>(0,T.jsx)(V.Consumer,{children:o=>(0,T.jsx)(He,{context:e,inheritedContext:o,children:t})}),Re=()=>(0,D.useContext)(V);var pe=F(require("classnames")),u=require("@vuu-ui/vuu-layout");var L=require("react"),se=require("@salt-ds/core"),ae=require("@heswell/salt-lab"),ie=require("@salt-ds/icons");var f=require("react"),te=require("@vuu-ui/vuu-utils");var ee=async t=>await fetch(`api/vui/${t.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var oe=require("@salt-ds/icons"),re=require("@salt-ds/core"),U=require("@heswell/salt-lab");var y=require("react/jsx-runtime"),Ee=({lastUpdate:t},{lastUpdate:e})=>e===t?0:e<t?-1:1,Me=t=>(0,y.jsx)(U.ListItem,{...t}),ne=(0,f.forwardRef)(function({loginUrl:e,onNavigate:o,user:r,layoutId:n="latest"},s){let[a,m]=(0,f.useState)([]);(0,f.useEffect)(()=>{async function x(){let C=await ee(r);console.log({history:C});let k=C.filter(w=>w.id!=="latest").sort(Ee).map(({id:w,lastUpdate:R})=>({lastUpdate:R,id:w,label:`Saved at ${(0,te.formatDate)(new Date(R),"kk:mm:ss")}`}));console.log({sortedHistory:k}),m(k)}x()},[r]);let i=(0,f.useCallback)((x,C)=>{C&&o(C.id)},[o]),l=(0,f.useCallback)(()=>{B(e)},[e]),c=a.length===0?[]:n==="latest"?a[0]:a.find(x=>x.id===n);return console.log({selected:c}),(0,y.jsxs)("div",{className:"vuuUserPanel",ref:s,children:[(0,y.jsx)(U.List,{ListItem:Me,className:"vuuUserPanel-history",onSelect:i,selected:c,source:a}),(0,y.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,y.jsxs)(re.Button,{"aria-label":"logout",onClick:l,children:[(0,y.jsx)(oe.ExportIcon,{})," Logout"]})})]})});var P=require("react/jsx-runtime"),le=({layoutId:t,loginUrl:e,onNavigate:o,user:r})=>{let[n,s]=(0,L.useState)(!1),a=(0,L.useRef)(!1),m=(0,L.useRef)(null),i=(0,L.useCallback)(()=>{s(c=>a.current=!c),requestAnimationFrame(()=>{a.current||requestAnimationFrame(()=>{m.current.focus()})})},[]);return(0,P.jsx)("div",{className:"vuuUserProfile",children:(0,P.jsxs)(ae.DropdownBase,{placement:"bottom-end",onCancel:i,children:[(0,P.jsx)(se.Button,{ref:m,variant:"secondary",children:(0,P.jsx)(ie.UserSolidIcon,{})}),(0,P.jsx)(ne,{layoutId:t,loginUrl:e,onNavigate:c=>{s(!1),o(c)},user:r})]})})};var $=require("react/jsx-runtime"),ue=({layoutId:t,loginUrl:e,onNavigate:o,user:r,...n})=>(0,$.jsx)("header",{className:"hwAppHeader",...n,children:(0,$.jsx)(le,{layoutId:t,loginUrl:e,onNavigate:o,user:r})});var p=require("react/jsx-runtime"),Te={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},De=({children:t,className:e,defaultLayout:o=Te,leftSidePanel:r,loginUrl:n,serverUrl:s,user:a,...m})=>{let i=(0,d.useRef)(null),[l,c]=(0,d.useState)(!1),x=(0,d.useRef)("latest"),[C,k,w]=j(a,o),R=(0,d.useCallback)(h=>{k(h)},[k]),me=h=>{var J;let fe=h.target;(J=i.current)!=null&&J.contains(fe)||c(!l)},de=(0,d.useCallback)(h=>{x.current=h,w(h)},[w]);(0,d.useEffect)(()=>{s&&a.token&&(0,ce.connectToServer)(s,a.token)},[s,a.token]);let he=()=>{let h=[];return r&&h.push((0,p.jsx)(u.Drawer,{onClick:me,open:l,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,p.jsx)(u.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:i,style:{height:"100%"},children:r},"app-palette")},"left-panel")),h};return(0,p.jsxs)(O,{value:void 0,children:[(0,p.jsx)(u.LayoutProvider,{layout:C,onLayoutChange:R,children:(0,p.jsx)(u.DraggableLayout,{className:(0,pe.default)("vuuShell",e),...m,children:(0,p.jsxs)(u.FlexboxLayout,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[(0,p.jsx)(ue,{layoutId:x.current,loginUrl:n,user:a,onNavigate:de}),(0,p.jsx)(u.Chest,{style:{flex:1},children:he().concat((0,p.jsx)(u.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})})}),t]})};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/vuu-shell/src/index.ts", "../../../packages/vuu-shell/src/feature/Feature.tsx", "../../../packages/vuu-shell/src/feature/ErrorBoundary.jsx", "../../../packages/vuu-shell/src/feature/Loader.tsx", "../../../packages/vuu-shell/src/feature/css-module-loader.ts", "../../../packages/vuu-shell/src/login/LoginPanel.tsx", "../../../packages/vuu-shell/src/login/login-utils.ts", "../../../packages/vuu-shell/src/shell.tsx", "../../../packages/vuu-shell/src/use-layout-config.js", "../../../packages/vuu-shell/src/ShellContextProvider.tsx", "../../../packages/vuu-shell/src/user-profile/UserProfile.tsx", "../../../packages/vuu-shell/src/user-profile/UserPanel.tsx", "../../../packages/vuu-shell/src/get-layout-history.js", "../../../packages/vuu-shell/src/app-header/AppHeader.tsx"],
|
|
4
|
+
"sourcesContent": ["export * from \"./feature\";\nexport * from \"./login\";\nexport * from \"./shell\";\nexport * from \"./shellTypes\";\nexport * from \"./ShellContextProvider\";\n", "import React, { Suspense } from \"react\";\nimport { registerComponent } from \"@vuu-ui/vuu-layout\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\nimport { Loader } from \"./Loader\";\nimport { importCSS } from \"./css-module-loader\";\n\nexport interface FeatureProps<Params extends object | undefined = undefined> {\n height?: number;\n url: string;\n css?: string;\n width?: number;\n params: Params;\n}\n\n// const RawFeature = <Params extends object | undefined>({\nfunction RawFeature<Params extends object | undefined>({\n url,\n css,\n params,\n ...props\n}: FeatureProps<Params>) {\n if (css) {\n // import(/* @vite-ignore */ css, { assert: { type: \"css\" } }).then(\n // (cssModule) => {\n // document.adoptedStyleSheets = [\n // ...document.adoptedStyleSheets,\n // cssModule.default,\n // ];\n // }\n // );\n // Polyfill until vite build supports import assertions\n // Note: already fully supported in esbuild, so vite dev\n importCSS(css).then((styleSheet) => {\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n styleSheet,\n ];\n });\n }\n const LazyFeature = React.lazy(() => import(/* @vite-ignore */ url));\n return (\n <ErrorBoundary>\n <Suspense fallback={<Loader />}>\n <LazyFeature {...props} {...params} />\n </Suspense>\n </ErrorBoundary>\n );\n}\n\nexport const Feature = React.memo(RawFeature);\nFeature.displayName = \"Feature\";\nregisterComponent(\"Feature\", Feature, \"view\");\n", "import React from 'react';\n// TODO\nexport class ErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { errorMessage: null };\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { errorMessage: error.message };\n }\n\n componentDidCatch(error, errorInfo) {\n // You can also log the error to an error reporting service\n console.log(error, errorInfo);\n }\n\n render() {\n if (this.state.errorMessage) {\n return (\n <>\n <h1>Something went wrong.</h1>\n <p>{this.state.errorMessage}</p>\n </>\n );\n }\n\n return this.props.children;\n }\n}\n", "// TODO\nexport const Loader = () => <div className=\"hwLoader\">loading</div>;\n", "export const importCSS = async (path: string) => {\n const container = new CSSStyleSheet();\n return fetch(path)\n .then((x) => x.text())\n .then((x) => container.replace(x));\n};\n", "import { ChangeEvent, HTMLAttributes, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { FormField, Input } from \"@heswell/salt-lab\";\n\nimport \"./LoginPanel.css\";\n\nconst classBase = \"vuuLoginPanel\";\n\nexport interface LoginPanelProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n onSubmit: (username: string, password: string) => void;\n}\n\nexport const LoginPanel = ({ onSubmit }: LoginPanelProps) => {\n const [username, setUserName] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n\n const login = () => {\n onSubmit(username, password);\n };\n\n const handleUsername = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setUserName(value);\n };\n\n const handlePassword = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setPassword(value);\n };\n\n const dataIsValid = username.trim() !== \"\" && password.trim() !== \"\";\n\n return (\n <div className={classBase}>\n <FormField label=\"Username\" style={{ width: 200 }}>\n <Input value={username} id=\"text-username\" onChange={handleUsername} />\n </FormField>\n\n <FormField label=\"Password\" style={{ width: 200 }}>\n <Input\n type=\"password\"\n value={password}\n id=\"text-password\"\n onChange={handlePassword}\n />\n </FormField>\n\n <Button\n className={`${classBase}-login`}\n disabled={!dataIsValid}\n onClick={login}\n variant=\"cta\"\n >\n Login\n </Button>\n </div>\n );\n};\n", "const getCookieValue = (name: string) =>\n document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n\nexport const getAuthDetailsFromCookies = () => {\n const username = getCookieValue(\"vuu-username\");\n const token = getCookieValue(\"vuu-auth-token\");\n return [username, token];\n};\n\nexport const redirectToLogin = (loginUrl = \"/login.html\") => {\n window.location.href = loginUrl;\n};\n\nexport const logout = (loginUrl?: string) => {\n document.cookie = \"vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie = \"vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n redirectToLogin(loginUrl);\n};\n", "import { connectToServer } from \"@vuu-ui/vuu-data\";\nimport {\n HTMLAttributes,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport useLayoutConfig from \"./use-layout-config\";\nimport { ShellContextProvider } from \"./ShellContextProvider\";\nimport cx from \"classnames\";\n\nimport {\n Chest,\n DraggableLayout,\n Drawer,\n FlexboxLayout as Flexbox,\n LayoutProvider,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { AppHeader } from \"./app-header\";\n// import { AppPalette } from \"./app-palette\";\n\nimport { LayoutJSON } from \"@vuu-ui/vuu-layout/src/layout-reducer\";\nimport \"./shell.css\";\n\nexport type VuuUser = {\n username: string;\n token: string;\n};\n\nconst warningLayout = {\n type: \"View\",\n props: {\n style: { height: \"calc(100% - 6px)\" },\n },\n children: [\n {\n props: {\n className: \"vuuShell-warningPlaceholder\",\n },\n type: \"Placeholder\",\n },\n ],\n};\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n defaultLayout?: LayoutJSON;\n leftSidePanel?: ReactElement;\n loginUrl?: string;\n // paletteConfig: any;\n serverUrl?: string;\n user: VuuUser;\n}\n\nexport const Shell = ({\n children,\n className,\n defaultLayout = warningLayout,\n leftSidePanel,\n loginUrl,\n serverUrl,\n user,\n ...htmlAttributes\n}: ShellProps) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const layoutId = useRef(\"latest\");\n\n const [layout, setLayoutConfig, loadLayoutById] = useLayoutConfig(\n user,\n defaultLayout\n );\n\n const handleLayoutChange = useCallback(\n (layout) => {\n setLayoutConfig(layout);\n },\n [setLayoutConfig]\n );\n\n const handleDrawerClick = (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n };\n\n const handleNavigate = useCallback(\n (id) => {\n layoutId.current = id;\n loadLayoutById(id);\n },\n [loadLayoutById]\n );\n\n useEffect(() => {\n if (serverUrl && user.token) {\n connectToServer(serverUrl, user.token);\n }\n }, [serverUrl, user.token]);\n\n const getDrawers = () => {\n const drawers: ReactElement[] = [];\n if (leftSidePanel) {\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n }\n\n return drawers;\n };\n\n return (\n // ShellContext TBD\n <ShellContextProvider value={undefined}>\n <LayoutProvider layout={layout} onLayoutChange={handleLayoutChange}>\n <DraggableLayout\n className={cx(\"vuuShell\", className)}\n {...htmlAttributes}\n >\n <Flexbox\n className=\"App\"\n style={{ flexDirection: \"column\", height: \"100%\", width: \"100%\" }}\n >\n <AppHeader\n layoutId={layoutId.current}\n loginUrl={loginUrl}\n user={user}\n onNavigate={handleNavigate}\n />\n <Chest style={{ flex: 1 }}>\n {getDrawers().concat(\n <DraggableLayout\n dropTarget\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </Chest>\n </Flexbox>\n </DraggableLayout>\n </LayoutProvider>\n {children}\n </ShellContextProvider>\n );\n};\n", "import { useCallback, useEffect, useState } from \"react\";\n\nconst useLayoutConfig = (user, defaultLayout) => {\n const [layout, _setLayout] = useState(defaultLayout);\n\n const setLayout = (layout) => {\n _setLayout(layout);\n };\n\n const load = useCallback(\n async (id = \"latest\") => {\n fetch(`api/vui/${user.username}/${id}`, {})\n .then((response) => {\n return response.ok ? response.json() : defaultLayout;\n })\n .then(setLayout)\n .catch(() => {\n // TODO we should set a layout with a warning here\n setLayout(defaultLayout);\n });\n },\n [defaultLayout, user.username]\n );\n\n useEffect(() => {\n load();\n }, [load]);\n\n const saveData = useCallback(\n (data) => {\n fetch(`api/vui/${user.username}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n }).then((response) => {\n return response.ok ? response.json() : defaultLayout;\n });\n // .then((data) => console.log(data));\n },\n [defaultLayout, user]\n );\n\n const loadLayoutById = useCallback(\n (id) => {\n load(id);\n },\n [load]\n );\n\n return [layout, saveData, loadLayoutById];\n};\n\nexport default useLayoutConfig;\n", "import { MenuRpcResponse } from \"@vuu-ui/vuu-data\";\nimport { ColumnDescriptor } from \"@vuu-ui/vuu-datagrid-types\";\nimport { createContext, ReactElement, ReactNode, useContext } from \"react\";\n\nexport interface ShellContextProps {\n getDefaultColumnConfig?: (\n tableName: string,\n columnName: string\n ) => Partial<ColumnDescriptor>;\n handleRpcResponse?: (response: MenuRpcResponse) => void;\n}\n\nconst defaultConfig = {};\n\nconst ShellContext = createContext<ShellContextProps>(defaultConfig);\n\nexport interface ShellProviderProps {\n children: ReactNode;\n value: ShellContextProps;\n}\n\nconst Provider = ({\n children,\n context,\n inheritedContext,\n}: {\n children: ReactNode;\n context?: ShellContextProps;\n inheritedContext?: ShellContextProps;\n}) => {\n // TODO functions provided at multiple levels must be merged\n const mergedContext = {\n ...inheritedContext,\n ...context,\n };\n return (\n <ShellContext.Provider value={mergedContext}>\n {children}\n </ShellContext.Provider>\n );\n};\n\nexport const ShellContextProvider = ({\n children,\n value,\n}: ShellProviderProps): ReactElement => {\n return (\n <ShellContext.Consumer>\n {(context) => (\n <Provider context={value} inheritedContext={context}>\n {children}\n </Provider>\n )}\n </ShellContext.Consumer>\n );\n};\n\nexport const useShellContext = () => {\n return useContext(ShellContext);\n};\n", "import React, { useCallback, useRef, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { DropdownBase } from \"@heswell/salt-lab\";\nimport { UserSolidIcon } from \"@salt-ds/icons\";\nimport { UserPanel } from \"./UserPanel\";\n\nimport \"./UserProfile.css\";\n\nexport const UserProfile = ({ layoutId, loginUrl, onNavigate, user }) => {\n const [open, setOpen] = useState(false);\n const openRef = useRef(false);\n const buttonRef = useRef(null);\n\n const toggle = useCallback(() => {\n setOpen((isOpen) => {\n return (openRef.current = !isOpen);\n });\n requestAnimationFrame(() => {\n if (!openRef.current) {\n requestAnimationFrame(() => {\n buttonRef.current.focus();\n });\n }\n });\n }, []);\n\n const handleNavigate = (id) => {\n setOpen(false);\n onNavigate(id);\n };\n\n return (\n <div className=\"vuuUserProfile\">\n <DropdownBase placement=\"bottom-end\" onCancel={toggle}>\n <Button ref={buttonRef} variant=\"secondary\">\n <UserSolidIcon />\n </Button>\n <UserPanel\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={handleNavigate}\n user={user}\n />\n </DropdownBase>\n </div>\n );\n};\n", "import React, { forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { formatDate } from \"@vuu-ui/vuu-utils\";\nimport { logout } from \"../login\";\nimport { getLayoutHistory } from \"../get-layout-history\";\nimport { ExportIcon } from \"@salt-ds/icons\";\nimport { Button } from \"@salt-ds/core\";\nimport { List, ListItem } from \"@heswell/salt-lab\";\n\nimport \"./UserPanel.css\";\n\nconst byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {\n return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;\n};\n\nconst HistoryListItem = (props) => {\n return <ListItem {...props} />;\n};\n\nexport const UserPanel = forwardRef(function UserPanel(\n { loginUrl, onNavigate, user, layoutId = \"latest\" },\n forwardedRef\n) {\n const [history, setHistory] = useState([]);\n\n useEffect(() => {\n async function getHistory() {\n const history = await getLayoutHistory(user);\n console.log({ history });\n const sortedHistory = history\n .filter((item) => item.id !== \"latest\")\n .sort(byLastUpdate)\n .map(({ id, lastUpdate }) => ({\n lastUpdate,\n id,\n label: `Saved at ${formatDate(new Date(lastUpdate), \"kk:mm:ss\")}`,\n }));\n console.log({ sortedHistory });\n setHistory(sortedHistory);\n }\n\n getHistory();\n }, [user]);\n\n const handleHisorySelected = useCallback(\n (evt, selected) => {\n if (selected) {\n onNavigate(selected.id);\n }\n },\n [onNavigate]\n );\n\n const handleLogout = useCallback(() => {\n logout(loginUrl);\n }, [loginUrl]);\n\n const selected =\n history.length === 0\n ? []\n : layoutId === \"latest\"\n ? history[0]\n : history.find((i) => i.id === layoutId);\n console.log({ selected });\n\n return (\n <div className=\"vuuUserPanel\" ref={forwardedRef}>\n <List\n ListItem={HistoryListItem}\n className=\"vuuUserPanel-history\"\n onSelect={handleHisorySelected}\n selected={selected}\n source={history}\n />\n <div className=\"vuuUserPanel-buttonBar\">\n <Button aria-label=\"logout\" onClick={handleLogout}>\n <ExportIcon /> Logout\n </Button>\n </div>\n </div>\n );\n});\n", "export const getLayoutHistory = async (user) => {\n const history = await fetch(`api/vui/${user.username}`, {})\n .then((response) => {\n return response.ok ? response.json() : null;\n })\n .catch(() => {\n // TODO we should set a layout with a warning here\n console.log(`error getting history`);\n });\n\n return history;\n};\n", "import { HTMLAttributes } from \"react\";\nimport { VuuUser } from \"../shell\";\nimport { UserProfile } from \"../user-profile\";\nimport \"./AppHeader.css\";\n\nexport interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {\n layoutId: string;\n loginUrl?: string;\n onNavigate: (id: string) => void;\n user: VuuUser;\n}\n\nexport const AppHeader = ({\n layoutId,\n loginUrl,\n onNavigate,\n user,\n ...htmlAttributes\n}: AppHeaderProps) => {\n return (\n <header className=\"hwAppHeader\" {...htmlAttributes}>\n {/* <ToggleButton onChange={toggleColorScheme}>\n theme\n </ToggleButton> */}\n <UserProfile\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={onNavigate}\n user={user}\n />\n </header>\n );\n};\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,EAAA,eAAAC,GAAA,UAAAC,GAAA,yBAAAC,EAAA,8BAAAC,GAAA,WAAAC,EAAA,oBAAAC,EAAA,oBAAAC,KAAA,eAAAC,GAAAV,ICAA,IAAAW,EAAgC,oBAChCC,EAAkC,8BCDlC,IAAAC,EAAkB,oBAqBVC,EAAA,6BAnBKC,EAAN,cAA4B,EAAAC,QAAM,SAAU,CACjD,YAAYC,EAAO,CACjB,MAAMA,CAAK,EACX,KAAK,MAAQ,CAAE,aAAc,IAAK,CACpC,CAEA,OAAO,yBAAyBC,EAAO,CAErC,MAAO,CAAE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Eb,mBAAC,QACC,UAAU,mBACV,GAAG,iBAEH,IAAKD,EACL,MAAO,CAAE,OAAQ,MAAO,EAEvB,SAAAL,GAJG,aAKN,GAjBI,YAkBN,CACF,EAGKqB,CACT,EAEA,SAEE,QAACC,EAAA,CAAqB,MAAO,OAC3B,oBAAC,kBAAe,OAAQb,EAAQ,eAAgBI,EAC9C,mBAAC,mBACC,aAAW,GAAAU,SAAG,WAAYzB,CAAS,EAClC,GAAGM,EAEJ,oBAAC,EAAAoB,cAAA,CACC,UAAU,MACV,MAAO,CAAE,cAAe,SAAU,OAAQ,OAAQ,MAAO,MAAO,EAEhE,oBAACC,GAAA,CACC,SAAUjB,EAAS,QACnB,SAAUP,EACV,KAAME,EACN,WAAYe,GACd,KACA,OAAC,SAAM,MAAO,CAAE,KAAM,CAAE,EACrB,SAAAE,GAAW,EAAE,UACZ,OAAC,mBACC,WAAU,GAEV,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAO,GADnC,cAEN,CACF,EACF,GACF,EACF,EACF,EACCvB,GACH,CAEJ",
|
|
6
|
+
"names": ["src_exports", "__export", "Feature", "LoginPanel", "Shell", "ShellContextProvider", "getAuthDetailsFromCookies", "logout", "redirectToLogin", "useShellContext", "__toCommonJS", "import_react", "import_vuu_layout", "import_react", "import_jsx_runtime", "ErrorBoundary", "React", "props", "error", "errorInfo", "import_jsx_runtime", "Loader", "importCSS", "path", "container", "x", "import_jsx_runtime", "RawFeature", "url", "css", "params", "props", "importCSS", "styleSheet", "LazyFeature", "React", "ErrorBoundary", "Loader", "Feature", "import_react", "import_core", "import_salt_lab", "import_jsx_runtime", "classBase", "LoginPanel", "onSubmit", "username", "setUserName", "password", "setPassword", "login", "handleUsername", "_event", "value", "handlePassword", "dataIsValid", "getCookieValue", "name", "_a", "row", "getAuthDetailsFromCookies", "username", "token", "redirectToLogin", "loginUrl", "logout", "import_vuu_data", "import_react", "import_react", "useLayoutConfig", "user", "defaultLayout", "layout", "_setLayout", "setLayout", "load", "id", "response", "saveData", "data", "loadLayoutById", "use_layout_config_default", "import_react", "import_jsx_runtime", "defaultConfig", "ShellContext", "Provider", "children", "context", "inheritedContext", "mergedContext", "ShellContextProvider", "value", "useShellContext", "import_classnames", "import_vuu_layout", "import_react", "import_core", "import_salt_lab", "import_icons", "import_react", "import_vuu_utils", "getLayoutHistory", "user", "response", "import_icons", "import_core", "import_salt_lab", "import_jsx_runtime", "byLastUpdate", "l1", "l2", "HistoryListItem", "props", "UserPanel", "loginUrl", "onNavigate", "user", "layoutId", "forwardedRef", "history", "setHistory", "getHistory", "getLayoutHistory", "sortedHistory", "item", "id", "lastUpdate", "handleHisorySelected", "evt", "selected", "handleLogout", "logout", "i", "import_jsx_runtime", "UserProfile", "layoutId", "loginUrl", "onNavigate", "user", "open", "setOpen", "openRef", "buttonRef", "toggle", "isOpen", "UserPanel", "id", "import_jsx_runtime", "AppHeader", "layoutId", "loginUrl", "onNavigate", "user", "htmlAttributes", "UserProfile", "import_jsx_runtime", "warningLayout", "Shell", "children", "className", "defaultLayout", "leftSidePanel", "loginUrl", "serverUrl", "user", "htmlAttributes", "paletteView", "open", "setOpen", "layoutId", "layout", "setLayoutConfig", "loadLayoutById", "use_layout_config_default", "handleLayoutChange", "handleDrawerClick", "e", "_a", "target", "handleNavigate", "id", "getDrawers", "drawers", "ShellContextProvider", "cx", "Flexbox", "AppHeader"]
|
|
7
|
+
}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import E,{Suspense as ae}from"react";import{registerComponent as ie}from"@vuu-ui/vuu-layout";import oe from"react";import{Fragment as re,jsx as N,jsxs as ne}from"react/jsx-runtime";var x=class extends oe.Component{constructor(e){super(e),this.state={errorMessage:null}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidCatch(e,o){console.log(e,o)}render(){return this.state.errorMessage?ne(re,{children:[N("h1",{children:"Something went wrong."}),N("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as se}from"react/jsx-runtime";var H=()=>se("div",{className:"hwLoader",children:"loading"});var R=async t=>{let e=new CSSStyleSheet;return fetch(t).then(o=>o.text()).then(o=>e.replace(o))};import{jsx as C}from"react/jsx-runtime";function le({url:t,css:e,params:o,...r}){e&&R(e).then(n=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,n]});let i=E.lazy(()=>import(t));return C(x,{children:C(ae,{fallback:C(H,{}),children:C(i,{...r,...o})})})}var M=E.memo(le);M.displayName="Feature";ie("Feature",M,"view");import{useState as T}from"react";import{Button as ue}from"@salt-ds/core";import{FormField as D,Input as U}from"@heswell/salt-lab";import{jsx as v,jsxs as ce}from"react/jsx-runtime";var F="vuuLoginPanel",ht=({onSubmit:t})=>{let[e,o]=T(""),[r,i]=T(""),n=()=>{t(e,r)},s=(l,u)=>{o(u)},c=(l,u)=>{i(u)},a=e.trim()!==""&&r.trim()!=="";return ce("div",{className:F,children:[v(D,{label:"Username",style:{width:200},children:v(U,{value:e,id:"text-username",onChange:s})}),v(D,{label:"Password",style:{width:200},children:v(U,{type:"password",value:r,id:"text-password",onChange:c})}),v(ue,{className:`${F}-login`,disabled:!a,onClick:n,variant:"cta",children:"Login"})]})};var A=t=>{var e;return(e=document.cookie.split("; ").find(o=>o.startsWith(`${t}=`)))==null?void 0:e.split("=")[1]},vt=()=>{let t=A("vuu-username"),e=A("vuu-auth-token");return[t,e]},pe=(t="/login.html")=>{window.location.href=t},I=t=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",pe(t)};import{connectToServer as Fe}from"@vuu-ui/vuu-data";import{useCallback as K,useEffect as Ae,useRef as Q,useState as Ie}from"react";import{useCallback as L,useEffect as me,useState as de}from"react";var he=(t,e)=>{let[o,r]=de(e),i=a=>{r(a)},n=L(async(a="latest")=>{fetch(`api/vui/${t.username}/${a}`,{}).then(l=>l.ok?l.json():e).then(i).catch(()=>{i(e)})},[e,t.username]);me(()=>{n()},[n]);let s=L(a=>{fetch(`api/vui/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(l=>l.ok?l.json():e)},[e,t]),c=L(a=>{n(a)},[n]);return[o,s,c]},B=he;import{createContext as fe,useContext as ge}from"react";import{jsx as w}from"react/jsx-runtime";var ve={},b=fe(ve),ye=({children:t,context:e,inheritedContext:o})=>{let r={...o,...e};return w(b.Provider,{value:r,children:t})},V=({children:t,value:e})=>w(b.Consumer,{children:o=>w(ye,{context:e,inheritedContext:o,children:t})}),Nt=()=>ge(b);import Be from"classnames";import{Chest as Ve,DraggableLayout as X,Drawer as Oe,FlexboxLayout as $e,LayoutProvider as Je,View as ze}from"@vuu-ui/vuu-layout";import{useCallback as Re,useRef as _,useState as Ee}from"react";import{Button as Me}from"@salt-ds/core";import{DropdownBase as Te}from"@heswell/salt-lab";import{UserSolidIcon as De}from"@salt-ds/icons";import{forwardRef as xe,useCallback as $,useEffect as Ce,useState as Se}from"react";import{formatDate as Pe}from"@vuu-ui/vuu-utils";var O=async t=>await fetch(`api/vui/${t.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});import{ExportIcon as Le}from"@salt-ds/icons";import{Button as we}from"@salt-ds/core";import{List as be,ListItem as ke}from"@heswell/salt-lab";import{jsx as S,jsxs as J}from"react/jsx-runtime";var Ne=({lastUpdate:t},{lastUpdate:e})=>e===t?0:e<t?-1:1,He=t=>S(ke,{...t}),z=xe(function({loginUrl:e,onNavigate:o,user:r,layoutId:i="latest"},n){let[s,c]=Se([]);Ce(()=>{async function m(){let d=await O(r);console.log({history:d});let g=d.filter(f=>f.id!=="latest").sort(Ne).map(({id:f,lastUpdate:y})=>({lastUpdate:y,id:f,label:`Saved at ${Pe(new Date(y),"kk:mm:ss")}`}));console.log({sortedHistory:g}),c(g)}m()},[r]);let a=$((m,d)=>{d&&o(d.id)},[o]),l=$(()=>{I(e)},[e]),u=s.length===0?[]:i==="latest"?s[0]:s.find(m=>m.id===i);return console.log({selected:u}),J("div",{className:"vuuUserPanel",ref:n,children:[S(be,{ListItem:He,className:"vuuUserPanel-history",onSelect:a,selected:u,source:s}),S("div",{className:"vuuUserPanel-buttonBar",children:J(we,{"aria-label":"logout",onClick:l,children:[S(Le,{})," Logout"]})})]})});import{jsx as P,jsxs as Ue}from"react/jsx-runtime";var q=({layoutId:t,loginUrl:e,onNavigate:o,user:r})=>{let[i,n]=Ee(!1),s=_(!1),c=_(null),a=Re(()=>{n(u=>s.current=!u),requestAnimationFrame(()=>{s.current||requestAnimationFrame(()=>{c.current.focus()})})},[]);return P("div",{className:"vuuUserProfile",children:Ue(Te,{placement:"bottom-end",onCancel:a,children:[P(Me,{ref:c,variant:"secondary",children:P(De,{})}),P(z,{layoutId:t,loginUrl:e,onNavigate:u=>{n(!1),o(u)},user:r})]})})};import{jsx as G}from"react/jsx-runtime";var W=({layoutId:t,loginUrl:e,onNavigate:o,user:r,...i})=>G("header",{className:"hwAppHeader",...i,children:G(q,{layoutId:t,loginUrl:e,onNavigate:o,user:r})});import{jsx as h,jsxs as Y}from"react/jsx-runtime";var _e={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},ko=({children:t,className:e,defaultLayout:o=_e,leftSidePanel:r,loginUrl:i,serverUrl:n,user:s,...c})=>{let a=Q(null),[l,u]=Ie(!1),m=Q("latest"),[d,g,f]=B(s,o),y=K(p=>{g(p)},[g]),Z=p=>{var k;let te=p.target;(k=a.current)!=null&&k.contains(te)||u(!l)},j=K(p=>{m.current=p,f(p)},[f]);Ae(()=>{n&&s.token&&Fe(n,s.token)},[n,s.token]);let ee=()=>{let p=[];return r&&p.push(h(Oe,{onClick:Z,open:l,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:h(ze,{className:"vuuShell-palette",id:"vw-app-palette",ref:a,style:{height:"100%"},children:r},"app-palette")},"left-panel")),p};return Y(V,{value:void 0,children:[h(Je,{layout:d,onLayoutChange:y,children:h(X,{className:Be("vuuShell",e),...c,children:Y($e,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[h(W,{layoutId:m.current,loginUrl:i,user:s,onNavigate:j}),h(Ve,{style:{flex:1},children:ee().concat(h(X,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})})}),t]})};export{M as Feature,ht as LoginPanel,ko as Shell,V as ShellContextProvider,vt as getAuthDetailsFromCookies,I as logout,pe as redirectToLogin,Nt as useShellContext};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/vuu-shell/src/feature/Feature.tsx", "../../../packages/vuu-shell/src/feature/ErrorBoundary.jsx", "../../../packages/vuu-shell/src/feature/Loader.tsx", "../../../packages/vuu-shell/src/feature/css-module-loader.ts", "../../../packages/vuu-shell/src/login/LoginPanel.tsx", "../../../packages/vuu-shell/src/login/login-utils.ts", "../../../packages/vuu-shell/src/shell.tsx", "../../../packages/vuu-shell/src/use-layout-config.js", "../../../packages/vuu-shell/src/ShellContextProvider.tsx", "../../../packages/vuu-shell/src/user-profile/UserProfile.tsx", "../../../packages/vuu-shell/src/user-profile/UserPanel.tsx", "../../../packages/vuu-shell/src/get-layout-history.js", "../../../packages/vuu-shell/src/app-header/AppHeader.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { Suspense } from \"react\";\nimport { registerComponent } from \"@vuu-ui/vuu-layout\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\nimport { Loader } from \"./Loader\";\nimport { importCSS } from \"./css-module-loader\";\n\nexport interface FeatureProps<Params extends object | undefined = undefined> {\n height?: number;\n url: string;\n css?: string;\n width?: number;\n params: Params;\n}\n\n// const RawFeature = <Params extends object | undefined>({\nfunction RawFeature<Params extends object | undefined>({\n url,\n css,\n params,\n ...props\n}: FeatureProps<Params>) {\n if (css) {\n // import(/* @vite-ignore */ css, { assert: { type: \"css\" } }).then(\n // (cssModule) => {\n // document.adoptedStyleSheets = [\n // ...document.adoptedStyleSheets,\n // cssModule.default,\n // ];\n // }\n // );\n // Polyfill until vite build supports import assertions\n // Note: already fully supported in esbuild, so vite dev\n importCSS(css).then((styleSheet) => {\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n styleSheet,\n ];\n });\n }\n const LazyFeature = React.lazy(() => import(/* @vite-ignore */ url));\n return (\n <ErrorBoundary>\n <Suspense fallback={<Loader />}>\n <LazyFeature {...props} {...params} />\n </Suspense>\n </ErrorBoundary>\n );\n}\n\nexport const Feature = React.memo(RawFeature);\nFeature.displayName = \"Feature\";\nregisterComponent(\"Feature\", Feature, \"view\");\n", "import React from 'react';\n// TODO\nexport class ErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { errorMessage: null };\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { errorMessage: error.message };\n }\n\n componentDidCatch(error, errorInfo) {\n // You can also log the error to an error reporting service\n console.log(error, errorInfo);\n }\n\n render() {\n if (this.state.errorMessage) {\n return (\n <>\n <h1>Something went wrong.</h1>\n <p>{this.state.errorMessage}</p>\n </>\n );\n }\n\n return this.props.children;\n }\n}\n", "// TODO\nexport const Loader = () => <div className=\"hwLoader\">loading</div>;\n", "export const importCSS = async (path: string) => {\n const container = new CSSStyleSheet();\n return fetch(path)\n .then((x) => x.text())\n .then((x) => container.replace(x));\n};\n", "import { ChangeEvent, HTMLAttributes, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { FormField, Input } from \"@heswell/salt-lab\";\n\nimport \"./LoginPanel.css\";\n\nconst classBase = \"vuuLoginPanel\";\n\nexport interface LoginPanelProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n onSubmit: (username: string, password: string) => void;\n}\n\nexport const LoginPanel = ({ onSubmit }: LoginPanelProps) => {\n const [username, setUserName] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n\n const login = () => {\n onSubmit(username, password);\n };\n\n const handleUsername = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setUserName(value);\n };\n\n const handlePassword = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setPassword(value);\n };\n\n const dataIsValid = username.trim() !== \"\" && password.trim() !== \"\";\n\n return (\n <div className={classBase}>\n <FormField label=\"Username\" style={{ width: 200 }}>\n <Input value={username} id=\"text-username\" onChange={handleUsername} />\n </FormField>\n\n <FormField label=\"Password\" style={{ width: 200 }}>\n <Input\n type=\"password\"\n value={password}\n id=\"text-password\"\n onChange={handlePassword}\n />\n </FormField>\n\n <Button\n className={`${classBase}-login`}\n disabled={!dataIsValid}\n onClick={login}\n variant=\"cta\"\n >\n Login\n </Button>\n </div>\n );\n};\n", "const getCookieValue = (name: string) =>\n document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n\nexport const getAuthDetailsFromCookies = () => {\n const username = getCookieValue(\"vuu-username\");\n const token = getCookieValue(\"vuu-auth-token\");\n return [username, token];\n};\n\nexport const redirectToLogin = (loginUrl = \"/login.html\") => {\n window.location.href = loginUrl;\n};\n\nexport const logout = (loginUrl?: string) => {\n document.cookie = \"vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie = \"vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n redirectToLogin(loginUrl);\n};\n", "import { connectToServer } from \"@vuu-ui/vuu-data\";\nimport {\n HTMLAttributes,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport useLayoutConfig from \"./use-layout-config\";\nimport { ShellContextProvider } from \"./ShellContextProvider\";\nimport cx from \"classnames\";\n\nimport {\n Chest,\n DraggableLayout,\n Drawer,\n FlexboxLayout as Flexbox,\n LayoutProvider,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { AppHeader } from \"./app-header\";\n// import { AppPalette } from \"./app-palette\";\n\nimport { LayoutJSON } from \"@vuu-ui/vuu-layout/src/layout-reducer\";\nimport \"./shell.css\";\n\nexport type VuuUser = {\n username: string;\n token: string;\n};\n\nconst warningLayout = {\n type: \"View\",\n props: {\n style: { height: \"calc(100% - 6px)\" },\n },\n children: [\n {\n props: {\n className: \"vuuShell-warningPlaceholder\",\n },\n type: \"Placeholder\",\n },\n ],\n};\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n defaultLayout?: LayoutJSON;\n leftSidePanel?: ReactElement;\n loginUrl?: string;\n // paletteConfig: any;\n serverUrl?: string;\n user: VuuUser;\n}\n\nexport const Shell = ({\n children,\n className,\n defaultLayout = warningLayout,\n leftSidePanel,\n loginUrl,\n serverUrl,\n user,\n ...htmlAttributes\n}: ShellProps) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const layoutId = useRef(\"latest\");\n\n const [layout, setLayoutConfig, loadLayoutById] = useLayoutConfig(\n user,\n defaultLayout\n );\n\n const handleLayoutChange = useCallback(\n (layout) => {\n setLayoutConfig(layout);\n },\n [setLayoutConfig]\n );\n\n const handleDrawerClick = (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n };\n\n const handleNavigate = useCallback(\n (id) => {\n layoutId.current = id;\n loadLayoutById(id);\n },\n [loadLayoutById]\n );\n\n useEffect(() => {\n if (serverUrl && user.token) {\n connectToServer(serverUrl, user.token);\n }\n }, [serverUrl, user.token]);\n\n const getDrawers = () => {\n const drawers: ReactElement[] = [];\n if (leftSidePanel) {\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n }\n\n return drawers;\n };\n\n return (\n // ShellContext TBD\n <ShellContextProvider value={undefined}>\n <LayoutProvider layout={layout} onLayoutChange={handleLayoutChange}>\n <DraggableLayout\n className={cx(\"vuuShell\", className)}\n {...htmlAttributes}\n >\n <Flexbox\n className=\"App\"\n style={{ flexDirection: \"column\", height: \"100%\", width: \"100%\" }}\n >\n <AppHeader\n layoutId={layoutId.current}\n loginUrl={loginUrl}\n user={user}\n onNavigate={handleNavigate}\n />\n <Chest style={{ flex: 1 }}>\n {getDrawers().concat(\n <DraggableLayout\n dropTarget\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </Chest>\n </Flexbox>\n </DraggableLayout>\n </LayoutProvider>\n {children}\n </ShellContextProvider>\n );\n};\n", "import { useCallback, useEffect, useState } from \"react\";\n\nconst useLayoutConfig = (user, defaultLayout) => {\n const [layout, _setLayout] = useState(defaultLayout);\n\n const setLayout = (layout) => {\n _setLayout(layout);\n };\n\n const load = useCallback(\n async (id = \"latest\") => {\n fetch(`api/vui/${user.username}/${id}`, {})\n .then((response) => {\n return response.ok ? response.json() : defaultLayout;\n })\n .then(setLayout)\n .catch(() => {\n // TODO we should set a layout with a warning here\n setLayout(defaultLayout);\n });\n },\n [defaultLayout, user.username]\n );\n\n useEffect(() => {\n load();\n }, [load]);\n\n const saveData = useCallback(\n (data) => {\n fetch(`api/vui/${user.username}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n }).then((response) => {\n return response.ok ? response.json() : defaultLayout;\n });\n // .then((data) => console.log(data));\n },\n [defaultLayout, user]\n );\n\n const loadLayoutById = useCallback(\n (id) => {\n load(id);\n },\n [load]\n );\n\n return [layout, saveData, loadLayoutById];\n};\n\nexport default useLayoutConfig;\n", "import { MenuRpcResponse } from \"@vuu-ui/vuu-data\";\nimport { ColumnDescriptor } from \"@vuu-ui/vuu-datagrid-types\";\nimport { createContext, ReactElement, ReactNode, useContext } from \"react\";\n\nexport interface ShellContextProps {\n getDefaultColumnConfig?: (\n tableName: string,\n columnName: string\n ) => Partial<ColumnDescriptor>;\n handleRpcResponse?: (response: MenuRpcResponse) => void;\n}\n\nconst defaultConfig = {};\n\nconst ShellContext = createContext<ShellContextProps>(defaultConfig);\n\nexport interface ShellProviderProps {\n children: ReactNode;\n value: ShellContextProps;\n}\n\nconst Provider = ({\n children,\n context,\n inheritedContext,\n}: {\n children: ReactNode;\n context?: ShellContextProps;\n inheritedContext?: ShellContextProps;\n}) => {\n // TODO functions provided at multiple levels must be merged\n const mergedContext = {\n ...inheritedContext,\n ...context,\n };\n return (\n <ShellContext.Provider value={mergedContext}>\n {children}\n </ShellContext.Provider>\n );\n};\n\nexport const ShellContextProvider = ({\n children,\n value,\n}: ShellProviderProps): ReactElement => {\n return (\n <ShellContext.Consumer>\n {(context) => (\n <Provider context={value} inheritedContext={context}>\n {children}\n </Provider>\n )}\n </ShellContext.Consumer>\n );\n};\n\nexport const useShellContext = () => {\n return useContext(ShellContext);\n};\n", "import React, { useCallback, useRef, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { DropdownBase } from \"@heswell/salt-lab\";\nimport { UserSolidIcon } from \"@salt-ds/icons\";\nimport { UserPanel } from \"./UserPanel\";\n\nimport \"./UserProfile.css\";\n\nexport const UserProfile = ({ layoutId, loginUrl, onNavigate, user }) => {\n const [open, setOpen] = useState(false);\n const openRef = useRef(false);\n const buttonRef = useRef(null);\n\n const toggle = useCallback(() => {\n setOpen((isOpen) => {\n return (openRef.current = !isOpen);\n });\n requestAnimationFrame(() => {\n if (!openRef.current) {\n requestAnimationFrame(() => {\n buttonRef.current.focus();\n });\n }\n });\n }, []);\n\n const handleNavigate = (id) => {\n setOpen(false);\n onNavigate(id);\n };\n\n return (\n <div className=\"vuuUserProfile\">\n <DropdownBase placement=\"bottom-end\" onCancel={toggle}>\n <Button ref={buttonRef} variant=\"secondary\">\n <UserSolidIcon />\n </Button>\n <UserPanel\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={handleNavigate}\n user={user}\n />\n </DropdownBase>\n </div>\n );\n};\n", "import React, { forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { formatDate } from \"@vuu-ui/vuu-utils\";\nimport { logout } from \"../login\";\nimport { getLayoutHistory } from \"../get-layout-history\";\nimport { ExportIcon } from \"@salt-ds/icons\";\nimport { Button } from \"@salt-ds/core\";\nimport { List, ListItem } from \"@heswell/salt-lab\";\n\nimport \"./UserPanel.css\";\n\nconst byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {\n return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;\n};\n\nconst HistoryListItem = (props) => {\n return <ListItem {...props} />;\n};\n\nexport const UserPanel = forwardRef(function UserPanel(\n { loginUrl, onNavigate, user, layoutId = \"latest\" },\n forwardedRef\n) {\n const [history, setHistory] = useState([]);\n\n useEffect(() => {\n async function getHistory() {\n const history = await getLayoutHistory(user);\n console.log({ history });\n const sortedHistory = history\n .filter((item) => item.id !== \"latest\")\n .sort(byLastUpdate)\n .map(({ id, lastUpdate }) => ({\n lastUpdate,\n id,\n label: `Saved at ${formatDate(new Date(lastUpdate), \"kk:mm:ss\")}`,\n }));\n console.log({ sortedHistory });\n setHistory(sortedHistory);\n }\n\n getHistory();\n }, [user]);\n\n const handleHisorySelected = useCallback(\n (evt, selected) => {\n if (selected) {\n onNavigate(selected.id);\n }\n },\n [onNavigate]\n );\n\n const handleLogout = useCallback(() => {\n logout(loginUrl);\n }, [loginUrl]);\n\n const selected =\n history.length === 0\n ? []\n : layoutId === \"latest\"\n ? history[0]\n : history.find((i) => i.id === layoutId);\n console.log({ selected });\n\n return (\n <div className=\"vuuUserPanel\" ref={forwardedRef}>\n <List\n ListItem={HistoryListItem}\n className=\"vuuUserPanel-history\"\n onSelect={handleHisorySelected}\n selected={selected}\n source={history}\n />\n <div className=\"vuuUserPanel-buttonBar\">\n <Button aria-label=\"logout\" onClick={handleLogout}>\n <ExportIcon /> Logout\n </Button>\n </div>\n </div>\n );\n});\n", "export const getLayoutHistory = async (user) => {\n const history = await fetch(`api/vui/${user.username}`, {})\n .then((response) => {\n return response.ok ? response.json() : null;\n })\n .catch(() => {\n // TODO we should set a layout with a warning here\n console.log(`error getting history`);\n });\n\n return history;\n};\n", "import { HTMLAttributes } from \"react\";\nimport { VuuUser } from \"../shell\";\nimport { UserProfile } from \"../user-profile\";\nimport \"./AppHeader.css\";\n\nexport interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {\n layoutId: string;\n loginUrl?: string;\n onNavigate: (id: string) => void;\n user: VuuUser;\n}\n\nexport const AppHeader = ({\n layoutId,\n loginUrl,\n onNavigate,\n user,\n ...htmlAttributes\n}: AppHeaderProps) => {\n return (\n <header className=\"hwAppHeader\" {...htmlAttributes}>\n {/* <ToggleButton onChange={toggleColorScheme}>\n theme\n </ToggleButton> */}\n <UserProfile\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={onNavigate}\n user={user}\n />\n </header>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,GAAS,YAAAC,OAAgB,QAChC,OAAS,qBAAAC,OAAyB,qBCDlC,OAAOC,OAAW,QAqBV,mBAAAC,GACE,OAAAC,EADF,QAAAC,OAAA,oBAnBD,IAAMC,EAAN,cAA4BJ,GAAM,SAAU,CACjD,YAAYK,EAAO,CACjB,MAAMA,CAAK,EACX,KAAK,MAAQ,CAAE,aAAc,IAAK,CACpC,CAEA,OAAO,yBAAyBC,EAAO,CAErC,MAAO,CAAE,aAAcA,EAAM,OAAQ,CACvC,CAEA,kBAAkBA,EAAOC,EAAW,CAElC,QAAQ,IAAID,EAAOC,CAAS,CAC9B,CAEA,QAAS,CACP,OAAI,KAAK,MAAM,aAEXJ,GAAAF,GAAA,CACE,UAAAC,EAAC,MAAG,iCAAqB,EACzBA,EAA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,OAAQ,MAAO,GADnC,cAEN,CACF,EACF,GACF,EACF,EACF,EACClC,GACH,CAEJ",
|
|
6
|
+
"names": ["React", "Suspense", "registerComponent", "React", "Fragment", "jsx", "jsxs", "ErrorBoundary", "props", "error", "errorInfo", "jsx", "Loader", "importCSS", "path", "container", "x", "jsx", "RawFeature", "url", "css", "params", "props", "importCSS", "styleSheet", "LazyFeature", "React", "ErrorBoundary", "Suspense", "Loader", "Feature", "registerComponent", "useState", "Button", "FormField", "Input", "jsx", "jsxs", "classBase", "LoginPanel", "onSubmit", "username", "setUserName", "useState", "password", "setPassword", "login", "handleUsername", "_event", "value", "handlePassword", "dataIsValid", "FormField", "Input", "Button", "getCookieValue", "name", "_a", "row", "getAuthDetailsFromCookies", "username", "token", "redirectToLogin", "loginUrl", "logout", "connectToServer", "useCallback", "useEffect", "useRef", "useState", "useCallback", "useEffect", "useState", "useLayoutConfig", "user", "defaultLayout", "layout", "_setLayout", "setLayout", "load", "id", "response", "saveData", "data", "loadLayoutById", "use_layout_config_default", "createContext", "useContext", "jsx", "defaultConfig", "ShellContext", "Provider", "children", "context", "inheritedContext", "mergedContext", "ShellContextProvider", "value", "useShellContext", "cx", "Chest", "DraggableLayout", "Drawer", "Flexbox", "LayoutProvider", "View", "useCallback", "useRef", "useState", "Button", "DropdownBase", "UserSolidIcon", "forwardRef", "useCallback", "useEffect", "useState", "formatDate", "getLayoutHistory", "user", "response", "ExportIcon", "Button", "List", "ListItem", "jsx", "jsxs", "byLastUpdate", "l1", "l2", "HistoryListItem", "props", "ListItem", "UserPanel", "forwardRef", "loginUrl", "onNavigate", "user", "layoutId", "forwardedRef", "history", "setHistory", "useState", "useEffect", "getHistory", "getLayoutHistory", "sortedHistory", "item", "id", "lastUpdate", "formatDate", "handleHisorySelected", "useCallback", "evt", "selected", "handleLogout", "logout", "i", "List", "Button", "ExportIcon", "jsx", "jsxs", "UserProfile", "layoutId", "loginUrl", "onNavigate", "user", "open", "setOpen", "useState", "openRef", "useRef", "buttonRef", "toggle", "useCallback", "isOpen", "DropdownBase", "Button", "UserSolidIcon", "UserPanel", "id", "jsx", "AppHeader", "layoutId", "loginUrl", "onNavigate", "user", "htmlAttributes", "UserProfile", "jsx", "jsxs", "warningLayout", "Shell", "children", "className", "defaultLayout", "leftSidePanel", "loginUrl", "serverUrl", "user", "htmlAttributes", "paletteView", "useRef", "open", "setOpen", "useState", "layoutId", "layout", "setLayoutConfig", "loadLayoutById", "use_layout_config_default", "handleLayoutChange", "useCallback", "handleDrawerClick", "e", "_a", "target", "handleNavigate", "id", "useEffect", "connectToServer", "getDrawers", "drawers", "Drawer", "View", "ShellContextProvider", "LayoutProvider", "DraggableLayout", "cx", "Flexbox", "AppHeader", "Chest"]
|
|
7
|
+
}
|
package/index.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.vuuLoginPanel{--hwTextInput-border: solid 1px #ccc;--hwTextInput-height: 28px;--hwTextInput-padding: 0 12px;--hwTextInput-width: 100%;--login-row-height: 60px;align-content:center;align-items:center;border:solid 1px lightgray;display:flex;flex-direction:column;gap:24px;justify-content:center;justify-items:center;margin:0 auto;padding:48px 48px 24px;width:fit-content}.vuuLoginPanel-login{grid-column:2/3;align-self:end;justify-self:end}.vuuUserPanel{background-color:#fff;display:flex;flex-direction:column;max-height:400px;padding:12px}vuuUserPanel-history{flex:1 1 auto}.vuuUserPanel-buttonBar{--saltButton-width: 100%;align-items:flex-end;border-top:1px solid var(--surface3);display:flex;flex:0 0 32px;justify-content:flex-start}.btn-logout{--hwButton-icon-left: 12px;--hwButton-padding: 0 6px 0 24px;padding-left:24px}.vuuUserProfile{--svg-icon: var(--svg-user)}.hwAppHeader{justify-content:flex-end;display:flex;height:40px;border-bottom:solid 1px #ccc}.vuuShell{background-color:var(--salt-container-primary-background, ivory);height:var(--vuuShell-height, 100vh);width:var(--vuuShell-width, 100vw)}.vuuShell-palette{--vuuView-border: none;--vuuView-margin: 0}.vuuShell-warningPlaceholder{background-color:var(--salt-container-background-high);height:100%}
|
|
2
|
+
/*# sourceMappingURL=index.css.map */
|
package/index.css.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/vuu-shell/src/login/LoginPanel.css", "../../../packages/vuu-shell/src/user-profile/UserPanel.css", "../../../packages/vuu-shell/src/user-profile/UserProfile.css", "../../../packages/vuu-shell/src/app-header/AppHeader.css", "../../../packages/vuu-shell/src/shell.css"],
|
|
4
|
+
"sourcesContent": [".vuuLoginPanel {\n --hwTextInput-border: solid 1px #ccc;\n --hwTextInput-height: 28px;\n --hwTextInput-padding: 0 12px;\n --hwTextInput-width: 100%;\n --login-row-height: 60px;\n align-content: center;\n align-items: center;\n border: solid 1px lightgray;\n display: flex;\n flex-direction: column;\n gap: 24px;\n justify-content: center;\n justify-items: center;\n margin: 0 auto;\n padding: 48px 48px 24px 48px;\n width: fit-content;\n}\n\n.vuuLoginPanel-login {\n grid-column: 2/3;\n align-self: end;\n justify-self: end;\n}\n", ".vuuUserPanel {\n background-color: white;\n display: flex;\n flex-direction: column;\n max-height: 400px;\n padding: 12px;\n}\n\nvuuUserPanel-history {\n flex: 1 1 auto;\n}\n\n.vuuUserPanel-buttonBar {\n --saltButton-width: 100%;\n align-items: flex-end;\n border-top: 1px solid var(--surface3);\n display: flex;\n flex: 0 0 32px;\n justify-content: flex-start;\n}\n\n.btn-logout {\n --hwButton-icon-left: 12px;\n --hwButton-padding: 0 6px 0 24px;\n padding-left: 24px;\n}\n", ".vuuUserProfile {\n --svg-icon: var(--svg-user);\n}\n", ".hwAppHeader {\n justify-content: flex-end;\n display: flex;\n height: 40px;\n border-bottom: solid 1px #ccc;\n}\n", ".vuuShell {\n background-color: var(--salt-container-primary-background, ivory);\n height: var(--vuuShell-height, 100vh);\n width: var(--vuuShell-width, 100vw);\n}\n\n.vuuShell-palette {\n --vuuView-border: none;\n --vuuView-margin: 0;\n}\n\n.vuuShell-warningPlaceholder {\n background-color: var(--salt-container-background-high);\n height: 100%;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,eACE,qCACA,2BACA,8BACA,0BACA,yBACA,qBACA,mBACA,2BACA,aACA,sBACA,SACA,uBACA,qBAbF,qCAgBE,kBAGF,qBACE,gBACA,eACA,iBCtBF,cACE,sBACA,aACA,sBACA,iBAJF,aAQA,qBACE,cAGF,wBACE,yBACA,qBACA,qCACA,aACA,cACA,2BAGF,YACE,2BACA,iCACA,kBCxBF,gBACE,4BCDF,aACE,yBACA,aACA,YACA,6BCJF,UACE,iEACA,qCACA,mCAGF,kBACE,uBACA,oBAGF,6BACE,uDACA",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuu-ui/vuu-shell",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "VUU UI Shell",
|
|
5
|
-
"main": "src/index.ts",
|
|
6
5
|
"author": "heswell",
|
|
7
6
|
"license": "Apache-2.0",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "node ../../scripts/run-build.mjs"
|
|
10
|
-
},
|
|
11
7
|
"peerDependencies": {
|
|
12
8
|
"@salt-ds/core": "1.0.0",
|
|
13
9
|
"@salt-ds/icons": "1.0.0",
|
|
14
10
|
"@heswell/salt-lab": "1.0.0-alpha.0",
|
|
15
|
-
"@vuu-ui/vuu-data": "0.5.
|
|
16
|
-
"@vuu-ui/vuu-layout": "0.5.
|
|
17
|
-
"@vuu-ui/vuu-utils": "0.5.
|
|
11
|
+
"@vuu-ui/vuu-data": "0.5.12",
|
|
12
|
+
"@vuu-ui/vuu-layout": "0.5.12",
|
|
13
|
+
"@vuu-ui/vuu-utils": "0.5.12",
|
|
18
14
|
"classnames": "^2.2.6",
|
|
19
15
|
"react": "^17.0.2",
|
|
20
16
|
"react-dom": "^17.0.2"
|
|
21
|
-
}
|
|
22
|
-
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"cjs",
|
|
20
|
+
"esm",
|
|
21
|
+
"index.css",
|
|
22
|
+
"index.css.map"
|
|
23
|
+
],
|
|
24
|
+
"module": "esm/index.js",
|
|
25
|
+
"main": "cjs/index.js"
|
|
26
|
+
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { MenuRpcResponse } from "@vuu-ui/vuu-data";
|
|
2
|
-
import { ColumnDescriptor } from "@vuu-ui/vuu-datagrid-types";
|
|
3
|
-
import { createContext, ReactElement, ReactNode, useContext } from "react";
|
|
4
|
-
|
|
5
|
-
export interface ShellContextProps {
|
|
6
|
-
getDefaultColumnConfig?: (
|
|
7
|
-
tableName: string,
|
|
8
|
-
columnName: string
|
|
9
|
-
) => Partial<ColumnDescriptor>;
|
|
10
|
-
handleRpcResponse?: (response: MenuRpcResponse) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const defaultConfig = {};
|
|
14
|
-
|
|
15
|
-
const ShellContext = createContext<ShellContextProps>(defaultConfig);
|
|
16
|
-
|
|
17
|
-
export interface ShellProviderProps {
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
value: ShellContextProps;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const Provider = ({
|
|
23
|
-
children,
|
|
24
|
-
context,
|
|
25
|
-
inheritedContext,
|
|
26
|
-
}: {
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
context?: ShellContextProps;
|
|
29
|
-
inheritedContext?: ShellContextProps;
|
|
30
|
-
}) => {
|
|
31
|
-
// TODO functions provided at multiple levels must be merged
|
|
32
|
-
const mergedContext = {
|
|
33
|
-
...inheritedContext,
|
|
34
|
-
...context,
|
|
35
|
-
};
|
|
36
|
-
return (
|
|
37
|
-
<ShellContext.Provider value={mergedContext}>
|
|
38
|
-
{children}
|
|
39
|
-
</ShellContext.Provider>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const ShellContextProvider = ({
|
|
44
|
-
children,
|
|
45
|
-
value,
|
|
46
|
-
}: ShellProviderProps): ReactElement => {
|
|
47
|
-
return (
|
|
48
|
-
<ShellContext.Consumer>
|
|
49
|
-
{(context) => (
|
|
50
|
-
<Provider context={value} inheritedContext={context}>
|
|
51
|
-
{children}
|
|
52
|
-
</Provider>
|
|
53
|
-
)}
|
|
54
|
-
</ShellContext.Consumer>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const useShellContext = () => {
|
|
59
|
-
return useContext(ShellContext);
|
|
60
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
import { VuuUser } from "../shell";
|
|
3
|
-
import { UserProfile } from "../user-profile";
|
|
4
|
-
import "./AppHeader.css";
|
|
5
|
-
|
|
6
|
-
export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
layoutId: string;
|
|
8
|
-
loginUrl?: string;
|
|
9
|
-
onNavigate: (id: string) => void;
|
|
10
|
-
user: VuuUser;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const AppHeader = ({
|
|
14
|
-
layoutId,
|
|
15
|
-
loginUrl,
|
|
16
|
-
onNavigate,
|
|
17
|
-
user,
|
|
18
|
-
...htmlAttributes
|
|
19
|
-
}: AppHeaderProps) => {
|
|
20
|
-
return (
|
|
21
|
-
<header className="hwAppHeader" {...htmlAttributes}>
|
|
22
|
-
{/* <ToggleButton onChange={toggleColorScheme}>
|
|
23
|
-
theme
|
|
24
|
-
</ToggleButton> */}
|
|
25
|
-
<UserProfile
|
|
26
|
-
layoutId={layoutId}
|
|
27
|
-
loginUrl={loginUrl}
|
|
28
|
-
onNavigate={onNavigate}
|
|
29
|
-
user={user}
|
|
30
|
-
/>
|
|
31
|
-
</header>
|
|
32
|
-
);
|
|
33
|
-
};
|
package/src/app-header/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AppHeader';
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import cx from "classnames";
|
|
3
|
-
import {
|
|
4
|
-
ComponentRegistry,
|
|
5
|
-
isRegistered,
|
|
6
|
-
Palette,
|
|
7
|
-
PaletteItem,
|
|
8
|
-
} from "@vuu-ui/vuu-layout";
|
|
9
|
-
|
|
10
|
-
const getPaletteItems = (config) => {
|
|
11
|
-
const paletteItems = [];
|
|
12
|
-
|
|
13
|
-
config.forEach((configItem) => {
|
|
14
|
-
const { label, items = [] } = configItem;
|
|
15
|
-
paletteItems.push(
|
|
16
|
-
<div key={label} data-header>
|
|
17
|
-
{label}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
items.forEach((paletteItem, i) => {
|
|
21
|
-
const { component, type, props, ...args } = paletteItem;
|
|
22
|
-
if (component) {
|
|
23
|
-
paletteItems.push(
|
|
24
|
-
<PaletteItem {...args} key={i}>
|
|
25
|
-
{component}
|
|
26
|
-
</PaletteItem>
|
|
27
|
-
);
|
|
28
|
-
} else if (type && isRegistered(type)) {
|
|
29
|
-
const Component = ComponentRegistry[type];
|
|
30
|
-
paletteItems.push(
|
|
31
|
-
<PaletteItem {...args} key={i}>
|
|
32
|
-
{React.createElement(Component, {
|
|
33
|
-
...props,
|
|
34
|
-
key: i,
|
|
35
|
-
})}
|
|
36
|
-
</PaletteItem>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return paletteItems;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const AppPalette = ({ className, config, ...props }) => {
|
|
46
|
-
return (
|
|
47
|
-
<Palette
|
|
48
|
-
className={cx("TableList", className)}
|
|
49
|
-
orientation="vertical"
|
|
50
|
-
collapsibleHeaders
|
|
51
|
-
{...props}
|
|
52
|
-
>
|
|
53
|
-
{getPaletteItems(config)}
|
|
54
|
-
</Palette>
|
|
55
|
-
);
|
|
56
|
-
};
|
package/src/app-palette/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AppPalette';
|