@graphenedata/cli 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/app.css CHANGED
@@ -112,27 +112,25 @@ html {
112
112
  }
113
113
 
114
114
  body {
115
+ display: flex;
116
+ margin: 0;
117
+ min-height: 100vh;
115
118
  font-family: "Inter", var(--ui-font-family);
116
119
  line-height: 1.7;
117
- margin: 0;
118
120
  color: var(--base-heading);
119
- min-height: 100vh;
120
- display: flex;
121
121
  }
122
122
 
123
123
  nav {
124
- flex: 0 0 200px;
125
- height: 100vh;
126
- padding-top: 1rem;
124
+ width: 200px;
125
+ flex-shrink: 0;
126
+ padding: 32px 0 16px 0px;
127
127
  border-right: 1px solid var(--base-200);
128
- background: #fbfbfd;
129
128
  }
130
129
 
131
130
  main {
132
131
  flex: 1;
133
- max-width: none;
134
- padding: 2.5rem 3rem 3.5rem;
135
- margin: 0 auto;
132
+ min-width: 0;
133
+ padding: 20px 48px 80px;
136
134
  }
137
135
 
138
136
  /* Default border color */
@@ -1,7 +1,12 @@
1
1
  <script>
2
- import navData from 'virtual:nav'
3
-
2
+ /** @type {string} */
4
3
  export let currentFile = ''
4
+ /** @type {string[]} */
5
+ export let files = []
6
+ /** @type {((href: string) => void) | undefined} */
7
+ export let onNavigate = undefined
8
+ /** @type {string} */
9
+ export let baseRoute = ''
5
10
 
6
11
  let tree = []
7
12
  let flatNodes = []
@@ -9,16 +14,17 @@
9
14
  let treeSignature = ''
10
15
  let lastCurrent = ''
11
16
 
12
- $: normalizedFiles = (navData || [])
17
+ $: normalizedFiles = (files || [])
13
18
  .map((file) => file.replace(/^\.\//, '').replace(/\\/g, '/'))
14
19
 
15
- $: normalizedCurrent = deriveCurrentFile()
20
+
21
+ $: normalizedCurrent = deriveCurrentFile(currentFile, normalizedFiles, baseRoute)
16
22
  $: currentRoute = normalizedCurrent ? pathToRoute(normalizedCurrent) : '/'
17
23
 
18
- function deriveCurrentFile () {
24
+ function deriveCurrentFile (_currentFile, _normalizedFiles, _baseRoute) {
19
25
  let fromProp = normalizeFilePath(currentFile)
20
26
  let route = getLocationRoute()
21
- if (route) {
27
+ if (route && normalizedFiles) {
22
28
  let match = normalizedFiles.find((file) => pathToRoute(file) === route)
23
29
  if (match) return match
24
30
  }
@@ -190,8 +196,16 @@
190
196
 
191
197
  function pathToRoute (path) {
192
198
  let clean = path.replace(/\.md$/, '')
193
- if (!clean || clean === 'index') return '/'
194
- return '/' + clean
199
+ let prefix = baseRoute ? '/' + baseRoute : ''
200
+ if (!clean || clean === 'index') return prefix || '/'
201
+ return prefix + '/' + clean
202
+ }
203
+
204
+ function handleLinkClick (event, href) {
205
+ if (!onNavigate) return
206
+ if (href.startsWith('http') || href.startsWith('//')) return
207
+ event.preventDefault()
208
+ onNavigate(href)
195
209
  }
196
210
  </script>
197
211
 
@@ -221,6 +235,7 @@
221
235
  href={node.route}
222
236
  class={node.route === currentRoute ? 'active' : ''}
223
237
  aria-current={node.route === currentRoute ? 'page' : undefined}
238
+ on:click={(e) => handleLinkClick(e, node.route)}
224
239
  >
225
240
  {node.label}
226
241
  </a>
@@ -235,6 +250,7 @@
235
250
  href={node.route}
236
251
  class={node.path === normalizedCurrent ? 'active' : ''}
237
252
  aria-current={node.path === normalizedCurrent ? 'page' : undefined}
253
+ on:click={(e) => handleLinkClick(e, node.route)}
238
254
  >
239
255
  <span>{node.label}</span>
240
256
  </a>
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import navData from 'virtual:nav'
3
+ import NavSidebar from './NavSidebar.svelte'
4
+
5
+ export let currentFile = ''
6
+ </script>
7
+
8
+ <NavSidebar files={navData} {currentFile} />
@@ -81,7 +81,7 @@ async function runNode (n: QueryNode) {
81
81
  let response = await fetch('/_api/query', {
82
82
  method: 'POST',
83
83
  headers: {'Content-Type': 'application/json'},
84
- body: JSON.stringify({params, gsql, hashes, routePath: getRoutePath()}),
84
+ body: JSON.stringify({params, gsql, hashes, routePath: getRoutePath(), repoId: window.$GRAPHENE?.repoId}),
85
85
  })
86
86
  let hash = response.headers.get('ETag') || ''
87
87
 
package/dist/ui/web.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {getErrors} from './internal/telemetry.ts'
2
2
  import './app.css'
3
3
  import {isLoading} from './internal/queryEngine.ts'
4
- import NavSidebar from './internal/NavSidebar.svelte'
4
+ import NavSidebar from './internal/NavSidebarHMR.svelte'
5
5
 
6
6
  import Area from './components/Area.svelte'
7
7
  import AreaChart from './components/AreaChart.svelte'
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "cli.ts",
4
4
  "type": "module",
5
5
  "author": "Graphene Systems Inc",
6
- "version": "0.0.10",
6
+ "version": "0.0.11",
7
7
  "license": "Elastic-2.0",
8
8
  "engines": {
9
9
  "node": ">=16"