@malloy-publisher/server 0.3.1 → 0.4.1

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.
Files changed (30) hide show
  1. package/dist/app/api-doc.yaml +140 -44
  2. package/dist/app/assets/{EnvironmentPage-CMNz23OH.js → EnvironmentPage-BW0WDIHv.js} +1 -1
  3. package/dist/app/assets/{HomePage-CIFBQm1O.js → HomePage-Dg3KqJ6Q.js} +1 -1
  4. package/dist/app/assets/{LightMode-230hA2MG.js → LightMode-CWfnd7K7.js} +1 -1
  5. package/dist/app/assets/MainPage-DDnYfzIk.js +2 -0
  6. package/dist/app/assets/ModelPage-DOACbTsK.js +2 -0
  7. package/dist/app/assets/PackagePage-4tYaVCFt.js +1 -0
  8. package/dist/app/assets/RenderedResult-CvrmYyr5.es-El82-Fnv.js +116 -0
  9. package/dist/app/assets/RouteError-3jz4UdKd.js +1 -0
  10. package/dist/app/assets/ThemeEditorPage-JOWkUiHa.js +1 -0
  11. package/dist/app/assets/ToggleButtonGroup-CmtgJ1bB.js +1 -0
  12. package/dist/app/assets/{index-BR3mOYNn.js → index-9jIrTEvL.js} +1 -1
  13. package/dist/app/assets/{index-CNMFq7Ua.js → index-BU0_UiMu.js} +1 -1
  14. package/dist/app/assets/{index-DplzDOL2.js → index-CYhW8lq5.js} +1 -1
  15. package/dist/app/assets/index-CqxPodI3.js +442 -0
  16. package/dist/app/assets/{index-B5_U5YBb.js → index-DP4T7js_.js} +1 -1
  17. package/dist/app/assets/index.es-DcmGg13s.js +106 -0
  18. package/dist/app/index.html +1 -1
  19. package/dist/package_load_worker.mjs +20 -1
  20. package/dist/server.mjs +981 -636
  21. package/package.json +3 -3
  22. package/dist/app/assets/MainPage-DBgaP8G6.js +0 -2
  23. package/dist/app/assets/MaterializationsPage-B5tdbpRJ.js +0 -1
  24. package/dist/app/assets/ModelPage-A6Kd1_wx.js +0 -2
  25. package/dist/app/assets/PackagePage-JUM3EcgJ.js +0 -1
  26. package/dist/app/assets/RenderedResult-mDE-4u8S.es-s0zwv__L.js +0 -116
  27. package/dist/app/assets/RouteError-BJAZkbpg.js +0 -1
  28. package/dist/app/assets/ThemeEditorPage-a0QNervK.js +0 -1
  29. package/dist/app/assets/index-JaIfCAcq.js +0 -443
  30. package/dist/app/assets/index.es-CB4dOn75.js +0 -106
@@ -1642,6 +1642,107 @@ paths:
1642
1642
  $ref: "#/components/responses/InternalServerError"
1643
1643
  "501":
1644
1644
  $ref: "#/components/responses/NotImplemented"
1645
+ put:
1646
+ tags:
1647
+ - models
1648
+ operationId: update-model-source
1649
+ summary: Write a dashboard file into the package
1650
+ description: |
1651
+ Writes the Malloy text of a dashboard file — `dashboards/<slug>.malloy`,
1652
+ the only paths this endpoint accepts — into the package, and reloads the
1653
+ package in place so the dashboard is served from the new text. This is
1654
+ the dashboard builder's save.
1655
+
1656
+ The text is compiled first, as the file, and refused with its problems
1657
+ when it does not compile; nothing is written. The write is atomic (a
1658
+ sibling temporary file renamed over the target). If the reload that
1659
+ follows fails to compile the package, the previous text is restored (or
1660
+ a new file removed) and the package reloaded again, so a save never
1661
+ leaves the package serving less than it did.
1662
+
1663
+ `expectedHash` is the SHA-256 (hex) of the text the caller opened, as
1664
+ `GET …/models/{path}` returned it in `sourceText`. When the file on disk
1665
+ no longer hashes to it, the write is refused with 409 and nothing is
1666
+ merged: the caller re-opens and reapplies its change. Omit it to CREATE
1667
+ the file: a file that already exists is then refused with 409 too, so an
1668
+ unconditional overwrite is not something a caller can ask for by leaving
1669
+ a field out. The check, the write, the reload and the restore all happen
1670
+ under one hold of the package lock, so two saves racing on one file
1671
+ cannot both pass the check, and a rollback cannot revert the other
1672
+ writer's text instead of its own.
1673
+
1674
+ A create answers 201 and an update 200; `created` in the body says the
1675
+ same thing.
1676
+
1677
+ Refused with 403 when `publisher.config.json` has `frozenConfig: true`.
1678
+ Like every write on this server, it is unauthenticated and meant to sit
1679
+ behind an authenticating gateway; see docs/security-posture.md.
1680
+ parameters:
1681
+ - name: environmentName
1682
+ in: path
1683
+ description: Name of the environment
1684
+ required: true
1685
+ schema:
1686
+ $ref: "#/components/schemas/IdentifierPattern"
1687
+ - name: packageName
1688
+ in: path
1689
+ description: Name of the package
1690
+ required: true
1691
+ schema:
1692
+ type: string
1693
+ - name: path
1694
+ in: path
1695
+ description: The dashboard file, `dashboards/<slug>.malloy`
1696
+ required: true
1697
+ schema:
1698
+ $ref: "#/components/schemas/PathPattern"
1699
+ - name: versionId
1700
+ in: query
1701
+ description: Version identifier for the package
1702
+ required: false
1703
+ schema:
1704
+ $ref: "#/components/schemas/VersionIdPattern"
1705
+ requestBody:
1706
+ required: true
1707
+ content:
1708
+ application/json:
1709
+ schema:
1710
+ $ref: "#/components/schemas/ModelSourceWriteRequest"
1711
+ responses:
1712
+ "200":
1713
+ description: The file was replaced and the package reloaded
1714
+ content:
1715
+ application/json:
1716
+ schema:
1717
+ $ref: "#/components/schemas/ModelSourceWriteResult"
1718
+ "201":
1719
+ description: The file did not exist and was created
1720
+ content:
1721
+ application/json:
1722
+ schema:
1723
+ $ref: "#/components/schemas/ModelSourceWriteResult"
1724
+ "400":
1725
+ $ref: "#/components/responses/BadRequest"
1726
+ "401":
1727
+ $ref: "#/components/responses/Unauthorized"
1728
+ "403":
1729
+ $ref: "#/components/responses/Forbidden"
1730
+ "404":
1731
+ $ref: "#/components/responses/NotFound"
1732
+ "409":
1733
+ description:
1734
+ The file changed since the caller opened it, or already exists and
1735
+ no `expectedHash` was sent
1736
+ content:
1737
+ application/json:
1738
+ schema:
1739
+ $ref: "#/components/schemas/Error"
1740
+ "500":
1741
+ $ref: "#/components/responses/InternalServerError"
1742
+ "501":
1743
+ $ref: "#/components/responses/NotImplemented"
1744
+ "503":
1745
+ $ref: "#/components/responses/ServiceUnavailable"
1645
1746
 
1646
1747
  /environments/{environmentName}/packages/{packageName}/models/{path}/query:
1647
1748
  post:
@@ -2362,48 +2463,6 @@ paths:
2362
2463
  "503":
2363
2464
  $ref: "#/components/responses/ServiceUnavailable"
2364
2465
 
2365
- /environments/{environmentName}/packages/materializations:
2366
- get:
2367
- tags:
2368
- - materializations
2369
- operationId: list-environment-materializations
2370
- summary: List all materializations in an environment
2371
- description:
2372
- Returns every materialization across all packages in the environment,
2373
- ordered by most recent first. Each item carries its `packageName`, so an
2374
- environment-scoped view can group or label by package. This is the
2375
- collection-level sibling of the per-package
2376
- `/packages/{packageName}/materializations` list; the literal
2377
- `materializations` segment is matched ahead of `{packageName}`, so
2378
- `materializations` cannot be used as a package name.
2379
- parameters:
2380
- - $ref: "#/components/parameters/environmentName"
2381
- - name: limit
2382
- in: query
2383
- required: false
2384
- schema:
2385
- type: integer
2386
- minimum: 1
2387
- description: Maximum number of materializations to return
2388
- - name: offset
2389
- in: query
2390
- required: false
2391
- schema:
2392
- type: integer
2393
- minimum: 0
2394
- description: Number of materializations to skip
2395
- responses:
2396
- "200":
2397
- description: List of materializations across the environment
2398
- content:
2399
- application/json:
2400
- schema:
2401
- type: array
2402
- items:
2403
- $ref: "#/components/schemas/Materialization"
2404
- "404":
2405
- $ref: "#/components/responses/NotFound"
2406
-
2407
2466
  /environments/{environmentName}/packages/{packageName}/materializations:
2408
2467
  post:
2409
2468
  tags:
@@ -3430,7 +3489,6 @@ components:
3430
3489
  when an embedding provider is configured. Absent when the server
3431
3490
  has no provider, because there is no index to describe.
3432
3491
 
3433
-
3434
3492
  PackageEmbeddingIndex:
3435
3493
  type: object
3436
3494
  readOnly: true
@@ -4921,7 +4979,9 @@ components:
4921
4979
  validates the chain AND the hostname against the real host (verified
4922
4980
  via SNI through the tunnel; requires the target's CA to be trusted by
4923
4981
  Node's bundled CA roots or NODE_EXTRA_CA_CERTS), `no-verify` encrypts without
4924
- verifying, and `disable` uses no TLS. Note `verify-full` trusts a
4982
+ verifying, and `disable` uses no TLS. A `storage=` build of a proxied
4983
+ source applies the same mode through its own tunnel, `verify-full`
4984
+ included. Note `verify-full` trusts a
4925
4985
  broader CA set than `verify-ca` here — ambient roots plus
4926
4986
  NODE_EXTRA_CA_CERTS, rather than the pinned NODE_EXTRA_CA_CERTS
4927
4987
  bundle that `verify-ca` uses — so it is intentionally not a strict
@@ -5533,6 +5593,42 @@ components:
5533
5593
  givens:
5534
5594
  $ref: "#/components/schemas/GivenValues"
5535
5595
 
5596
+ ModelSourceWriteRequest:
5597
+ type: object
5598
+ description: The text to write into a dashboard file
5599
+ required:
5600
+ - source
5601
+ properties:
5602
+ source:
5603
+ type: string
5604
+ description: The whole file's Malloy text
5605
+ expectedHash:
5606
+ type: string
5607
+ description:
5608
+ SHA-256 (hex) of the text the caller opened. Refused with 409 when
5609
+ the file on disk no longer hashes to it. Omit to create the file,
5610
+ which is then refused with 409 if it already exists.
5611
+
5612
+ ModelSourceWriteResult:
5613
+ type: object
5614
+ description: What a dashboard write left in the package
5615
+ required:
5616
+ - path
5617
+ - contentHash
5618
+ properties:
5619
+ resource:
5620
+ type: string
5621
+ description: Resource path to the model file that was written
5622
+ path:
5623
+ type: string
5624
+ description: The file written, relative to the package
5625
+ contentHash:
5626
+ type: string
5627
+ description: SHA-256 (hex) of the text as written; the next write's `expectedHash`
5628
+ created:
5629
+ type: boolean
5630
+ description: True when the file did not exist before
5631
+
5536
5632
  CompileResult:
5537
5633
  type: object
5538
5634
  description: Result of a Malloy source compilation check
@@ -1 +1 @@
1
- import{O as r,G as t,j as e,a5 as i,ag as o}from"./index-JaIfCAcq.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
1
+ import{Q as r,K as t,j as e,a7 as i,ai as o}from"./index-CqxPodI3.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
@@ -1 +1 @@
1
- import{O as t,j as o,Y as a}from"./index-JaIfCAcq.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{Q as t,j as o,f as a}from"./index-CqxPodI3.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -1 +1 @@
1
- import{c,j as s}from"./index-JaIfCAcq.js";const t=c(s.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),a=c(s.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"}));export{t as D,a as L};
1
+ import{c,j as s}from"./index-CqxPodI3.js";const t=c(s.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),a=c(s.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"}));export{t as D,a as L};
@@ -0,0 +1,2 @@
1
+ import{u as Pe,g as Ce,r as u,R as Ie,a as ze,c as S,j as t,s as z,B as Me,m as K,e as ne,b as le,d as ce,h as de,i as De,k as Q,l as pe,T as G,n as J,o as Te,p as Re,q as Be,t as ue,v as Le,w as oe,x as He,y as $e,z as Ne,A as W,C as $,M as Ae,P as Oe,D as We,E as Ve,S as Qe,F as Ue,G as A,I as N,H as Fe,J as he,K as fe,Q as Z,L as m,N as Xe,O as q,U as Ye,V as _e,$ as se,W as xe,X as me,Y as ge,Z as Ke,_ as Ge,a0 as Je}from"./index-CqxPodI3.js";import{D as Ze,L as qe}from"./LightMode-CWfnd7K7.js";function et(e,r,n,o,s){const[a,i]=u.useState(()=>s&&n?n(e).matches:o?o(e).matches:r);return ze(()=>{if(!n)return;const c=n(e),h=()=>{i(c.matches)};return h(),c.addEventListener("change",h),()=>{c.removeEventListener("change",h)}},[e,n]),a}const tt={...Ie},ye=tt.useSyncExternalStore;function rt(e,r,n,o,s){const a=u.useCallback(()=>r,[r]),i=u.useMemo(()=>{if(s&&n)return()=>n(e).matches;if(o!==null){const{matches:p}=o(e);return()=>p}return a},[a,e,o,s,n]),[c,h]=u.useMemo(()=>{if(n===null)return[a,()=>()=>{}];const p=n(e);return[()=>p.matches,x=>(p.addEventListener("change",x),()=>{p.removeEventListener("change",x)})]},[a,n,e]);return ye(h,c,i)}function be(e={}){const{themeId:r}=e;return function(o,s={}){let a=Pe();a&&r&&(a=a[r]||a);const i=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:c=!1,matchMedia:h=i?window.matchMedia:null,ssrMatchMedia:f=null,noSsr:p=!1}=Ce({name:"MuiUseMediaQuery",props:s,theme:a});let x=typeof o=="function"?o(a):o;return x=x.replace(/^@media( ?)/m,""),x.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
2
+ `)),(ye!==void 0?rt:et)(x,c,h,f,p)}}be();const nt=S(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),ot=z(Me,{name:"MuiBreadcrumbCollapsed"})(K(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:ne(e.palette.grey[200],.12)}:{backgroundColor:ne(e.palette.grey[600],.12)}}}))),st=z(nt)({width:24,height:16});function at(e){const{slots:r={},slotProps:n={},...o}=e,s=e;return t.jsx("li",{children:t.jsx(ot,{focusRipple:!0,...o,ownerState:s,children:t.jsx(st,{as:r.CollapsedIcon,ownerState:s,...n.collapsedIcon})})})}function it(e){return ce("MuiBreadcrumbs",e)}const lt=le("MuiBreadcrumbs",["root","ol","li","separator"]),ct=e=>{const{classes:r}=e;return pe({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},it,r)},dt=z(G,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${lt.li}`]:r.li},r.root]})({}),pt=z("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),ut=z("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ht(e,r,n,o){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(ut,{"aria-hidden":!0,className:r,ownerState:o,children:n},`separator-${i}`)):s.push(a),s),[])}const ft=u.forwardRef(function(r,n){const o=de({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:c={},slotProps:h={},expandText:f="Show path",itemsAfterCollapse:p=1,itemsBeforeCollapse:x=1,maxItems:y=8,separator:E="/",...H}=o,[M,P]=u.useState(!1),v={...o,component:i,expanded:M,expandText:f,itemsAfterCollapse:p,itemsBeforeCollapse:x,maxItems:y,separator:E},C=ct(v),D=De({elementType:c.CollapsedIcon,externalSlotProps:h.collapsedIcon,ownerState:v}),j=u.useRef(null),k=d=>{const w=()=>{P(!0);const b=j.current.querySelector("a[href],button,[tabindex]");b&&b.focus()};return x+p>=d.length?d:[...d.slice(0,x),t.jsx(at,{"aria-label":f,slots:{CollapsedIcon:c.CollapsedIcon},slotProps:{collapsedIcon:D},onClick:w},"ellipsis"),...d.slice(d.length-p,d.length)]},T=u.Children.toArray(s).filter(d=>u.isValidElement(d)).map((d,w)=>t.jsx("li",{className:C.li,children:d},`child-${w}`));return t.jsx(dt,{ref:n,component:i,color:"textSecondary",className:Q(C.root,a),ownerState:v,...H,children:t.jsx(pt,{className:C.ol,ref:j,ownerState:v,children:ht(M||y&&T.length<=y?T:k(T),C.separator,E,v)})})});function xt(e,r,n){const o=r.getBoundingClientRect(),s=n&&n.getBoundingClientRect(),a=ue(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const f=a.getComputedStyle(r);i=f.getPropertyValue("-webkit-transform")||f.getPropertyValue("transform")}let c=0,h=0;if(i&&i!=="none"&&typeof i=="string"){const f=i.split("(")[1].split(")")[0].split(",");c=parseInt(f[4],10),h=parseInt(f[5],10)}return e==="left"?s?`translateX(${s.right+c-o.left}px)`:`translateX(${a.innerWidth+c-o.left}px)`:e==="right"?s?`translateX(-${o.right-s.left-c}px)`:`translateX(-${o.left+o.width-c}px)`:e==="up"?s?`translateY(${s.bottom+h-o.top}px)`:`translateY(${a.innerHeight+h-o.top}px)`:s?`translateY(-${o.top-s.top+o.height-h}px)`:`translateY(-${o.top+o.height-h}px)`}function mt(e){return typeof e=="function"?e():e}function V(e,r,n){const o=mt(n),s=xt(e,r,o);s&&(r.style.webkitTransform=s,r.style.transform=s)}const gt=u.forwardRef(function(r,n){const o=J(),s={enter:o.transitions.easing.easeOut,exit:o.transitions.easing.sharp},a={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{addEndListener:i,appear:c=!0,children:h,container:f,direction:p="down",easing:x=s,in:y,onEnter:E,onEntered:H,onEntering:M,onExit:P,onExited:v,onExiting:C,style:D,timeout:j=a,TransitionComponent:k=Te,...T}=r,d=u.useRef(null),w=Re(Be(h),d,n),b=l=>g=>{l&&(g===void 0?l(d.current):l(d.current,g))},U=b((l,g)=>{V(p,l,f),He(l),E&&E(l,g)}),ee=b((l,g)=>{const L=oe({timeout:j,style:D,easing:x},{mode:"enter"});l.style.webkitTransition=o.transitions.create("-webkit-transform",{...L}),l.style.transition=o.transitions.create("transform",{...L}),l.style.webkitTransform="none",l.style.transform="none",M&&M(l,g)}),R=b(H),B=b(C),I=b(l=>{const g=oe({timeout:j,style:D,easing:x},{mode:"exit"});l.style.webkitTransition=o.transitions.create("-webkit-transform",g),l.style.transition=o.transitions.create("transform",g),V(p,l,f),P&&P(l)}),F=b(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),X=l=>{i&&i(d.current,l)},O=u.useCallback(()=>{d.current&&V(p,d.current,f)},[p,f]);return u.useEffect(()=>{if(y||p==="down"||p==="right")return;const l=Le(()=>{d.current&&V(p,d.current,f)}),g=ue(d.current);return g.addEventListener("resize",l),()=>{l.clear(),g.removeEventListener("resize",l)}},[p,y,f]),u.useEffect(()=>{y||O()},[y,O]),t.jsx(k,{nodeRef:d,onEnter:U,onEntered:R,onEntering:ee,onExit:I,onExited:F,onExiting:B,addEndListener:X,appear:c,in:y,timeout:j,...T,children:(l,{ownerState:g,...L})=>u.cloneElement(h,{ref:w,style:{visibility:l==="exited"&&!y?"hidden":void 0,...D,...h.props.style},...L})})});function yt(e){return ce("MuiDrawer",e)}le("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const ve=(e,r)=>{const{ownerState:n}=e;return[r.root,(n.variant==="permanent"||n.variant==="persistent")&&r.docked,r.modal]},bt=e=>{const{classes:r,anchor:n,variant:o}=e,s={root:["root",`anchor${$(n)}`],docked:[(o==="permanent"||o==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(n)}`,o!=="temporary"&&`paperAnchorDocked${$(n)}`]};return pe(s,yt,r)},vt=z(Ae,{name:"MuiDrawer",slot:"Root",overridesResolver:ve})(K(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),jt=z("div",{shouldForwardProp:We,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:ve})({flex:"0 0 auto"}),kt=z(Oe,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:n}=e;return[r.paper,r[`paperAnchor${$(n.anchor)}`],n.variant!=="temporary"&&r[`paperAnchorDocked${$(n.anchor)}`]]}})(K(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),je={left:"right",right:"left",top:"down",bottom:"up"};function wt(e){return["left","right"].includes(e)}function St({direction:e},r){return e==="rtl"&&wt(r)?je[r]:r}const Et=u.forwardRef(function(r,n){const o=de({props:r,name:"MuiDrawer"}),s=J(),a=$e(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:c="left",BackdropProps:h,children:f,className:p,elevation:x=16,hideBackdrop:y=!1,ModalProps:{BackdropProps:E,...H}={},onClose:M,open:P=!1,PaperProps:v={},SlideProps:C,TransitionComponent:D,transitionDuration:j=i,variant:k="temporary",slots:T={},slotProps:d={},...w}=o,b=u.useRef(!1);u.useEffect(()=>{b.current=!0},[]);const U=St({direction:a?"rtl":"ltr"},c),R={...o,anchor:c,elevation:x,open:P,variant:k,...w},B=bt(R),I={slots:{transition:D,...T},slotProps:{paper:v,transition:C,...d,backdrop:Ne(d.backdrop||{...h,...E},{transitionDuration:j})}},[F,X]=W("root",{ref:n,elementType:vt,className:Q(B.root,B.modal,p),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...I,...w,...H},additionalProps:{open:P,onClose:M,hideBackdrop:y,slots:{backdrop:I.slots.backdrop},slotProps:{backdrop:I.slotProps.backdrop}}}),[O,l]=W("paper",{elementType:kt,shouldForwardComponentProp:!0,className:Q(B.paper,v.className),ownerState:R,externalForwardedProps:I,additionalProps:{elevation:k==="temporary"?x:0,square:!0,...k==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[g,L]=W("docked",{elementType:jt,ref:n,className:Q(B.root,B.docked,p),ownerState:R,externalForwardedProps:I,additionalProps:w}),[Se,Ee]=W("transition",{elementType:gt,ownerState:R,externalForwardedProps:I,additionalProps:{in:P,direction:je[U],timeout:j,appear:b.current}}),te=t.jsx(O,{...l,children:f});if(k==="permanent")return t.jsx(g,{...L,children:te});const re=t.jsx(Se,{...Ee,children:te});return k==="persistent"?t.jsx(g,{...L,children:re}):t.jsx(F,{...X,children:re})}),Pt=be({themeId:Ve}),Ct=S([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),It=S(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),zt=S(t.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Mt=S(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),Dt=S(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Tt=S(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Rt=S(t.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Bt=S([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]);function _(e){return t.jsxs(Qe,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Lt={light:"dark",dark:"auto",auto:"light"},ae={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Ht(){const{mode:e,userChoice:r,setMode:n,allowUserToggle:o}=Ue();if(!o)return null;const s=r??e,a=Lt[s],i=s==="auto"?It:s==="dark"?Ze:qe;return t.jsx(A,{title:ae[s],children:t.jsx(N,{"aria-label":ae[s],onClick:()=>n(a),size:"small",children:t.jsx(i,{fontSize:"small"})})})}const ie="Visualization theme";function $t(){const e=Fe(),n=he().pathname.startsWith("/settings/theme");return t.jsx(A,{title:ie,children:t.jsx(N,{"aria-label":ie,onClick:()=>e("/settings/theme"),size:"small",color:n?"primary":"default",children:t.jsx(Bt,{fontSize:"small"})})})}function Y({label:e,onClick:r}){return t.jsx(Xe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,sx:n=>({backgroundColor:"background.paper",color:"text.primary",fontWeight:500,fontSize:"0.875rem",height:32,cursor:"pointer",borderRadius:"4px",maxWidth:320,"& .MuiChip-label":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function Nt(){const e=fe(),r=e["*"],n=Z();return!e.environmentName&&!e.packageName&&!r?null:t.jsx(m,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ft,{"aria-label":"breadcrumb",separator:t.jsx(zt,{sx:{fontSize:14,color:"text.secondary"}}),children:[e.environmentName&&t.jsx(Y,{label:e.environmentName,onClick:o=>n(`/${e.environmentName}/`,o)}),e.packageName&&t.jsx(Y,{label:e.packageName,onClick:o=>n(`/${e.environmentName}/${e.packageName}/`,o)}),r&&t.jsx(Y,{label:r,onClick:o=>n(`/${e.environmentName}/${e.packageName}/${r}`,o)})]})})}const At=260,Ot=64;function ke({isCollapsed:e,onToggleCollapse:r,logoHeader:n}){return t.jsxs(m,{sx:{height:"100dvh",width:e?Ot:At,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(Wt,{isCollapsed:e,onToggleCollapse:r,logoHeader:n}),t.jsxs(m,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Vt,{isCollapsed:e}),t.jsx(Qt,{isCollapsed:e})]}),t.jsx(Ut,{isCollapsed:e})]})}function Wt({isCollapsed:e,onToggleCollapse:r,logoHeader:n}){const o=Z();return n?t.jsxs(m,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[n,t.jsx(N,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(_,{fontSize:"small"})})]}):t.jsxs(m,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(m,{onClick:s=>o("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(m,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(G,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(A,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(N,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(_,{fontSize:"small"})})})]})}function Vt({isCollapsed:e}){const n=he().pathname==="/";return t.jsx(q,{sx:{py:0},children:t.jsx(we,{icon:t.jsx(Tt,{fontSize:"small"}),label:"Home",to:"/",selected:n,isCollapsed:e})})}function Qt({isCollapsed:e}){const{apiClients:r}=Ye(),n=fe(),{data:o}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=o?.data??[];return s.length===0?null:t.jsxs(m,{sx:{mt:1},children:[!e&&t.jsx(G,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(q,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(we,{icon:t.jsx(Dt,{fontSize:"small"}),label:i,to:`/${i}`,selected:n.environmentName===i,isCollapsed:e},i)})})]})}function Ut({isCollapsed:e}){const r=[{label:"Malloy Docs",href:se.docsHome,icon:t.jsx(Ct,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:se.publishing,icon:t.jsx(Rt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsx(q,{sx:{py:1},children:r.map(n=>t.jsx(Ft,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))})}function we({icon:e,label:r,to:n,selected:o,isCollapsed:s}){const a=Z(),i=t.jsxs(xe,{selected:o,onClick:c=>a(n,c),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(me,{sx:{minWidth:s?0:36,justifyContent:"center",color:o?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(ge,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(A,{title:r,placement:"right",children:t.jsx(m,{children:i})}):i}function Ft({label:e,href:r,icon:n,external:o,isCollapsed:s}){const a=t.jsxs(xe,{component:"a",href:r,target:o?"_blank":void 0,rel:o?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(me,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:n}),!s&&t.jsx(ge,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(A,{title:e,placement:"right",children:t.jsx(m,{children:a})}):a}function Xt({open:e,onClose:r,logoHeader:n}){return t.jsx(Et,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(ke,{isCollapsed:!1,onToggleCollapse:r,logoHeader:n})})}function Kt({headerProps:e}){const r=J(),n=Pt(r.breakpoints.up("md")),[o,s]=u.useState(!1),[a,i]=u.useState(!1);return u.useEffect(()=>{n&&o&&s(!1)},[n,o]),t.jsxs(m,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[n&&t.jsx(ke,{isCollapsed:a,onToggleCollapse:()=>i(c=>!c),logoHeader:e?.logoHeader}),t.jsxs(m,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(m,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:Ke.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(m,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(N,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(_,{fontSize:"small"})})}),t.jsx(m,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx(Nt,{})}),t.jsxs(m,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx($t,{}),t.jsx(Ht,{}),e?.endCap]})]}),t.jsx(m,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(u.Suspense,{fallback:t.jsx(Je,{}),children:t.jsx(Ge,{})})})]}),t.jsx(Xt,{open:o,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Kt as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-DcmGg13s.js","assets/index-CqxPodI3.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-CmtgJ1bB.js"])))=>i.map(i=>d[i]);
2
+ import{c as W,j as a,Q as f,r as x,a1 as v,H as b,J as $,a2 as k,L as i,a3 as m,a4 as y,a5 as _,a6 as L,a7 as j,a8 as N,a9 as R,aa as U,a0 as D,ab as F,K as I,U as S,ac as T,ad as w,ae as M,T as g,af as h,ag as O}from"./index-CqxPodI3.js";const A=W(a.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}));function E(e,s){const n=f();return x.useCallback((t,r)=>{const l=new URLSearchParams(t.givens).toString(),c=encodeURIComponent(e),d=encodeURIComponent(s),o=encodeURIComponent(t.dashboard);n(`/${c}/${d}/dashboards/${o}`+(l?`?${l}`:""),r)},[n,e,s])}function z({environmentName:e,packageName:s,dashboardName:n}){const{params:t,onGivensChange:r}=v(),l=E(e,s),c=b(),{pathname:d}=$(),o=x.useMemo(()=>k({environmentName:e,packageName:s,dashboardName:n}),[e,s,n]);return x.useEffect(()=>{const p=()=>void N(()=>import("./index.es-DcmGg13s.js"),__vite__mapDeps([0,1,2,3])),u=window.requestIdleCallback;if(u){const P=u(p);return()=>window.cancelIdleCallback?.(P)}const C=setTimeout(p,1500);return()=>clearTimeout(C)},[]),a.jsxs(i,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:()=>c(`/${e}/${s}`)}),a.jsx(y,{children:a.jsx(_,{label:"Edit",icon:a.jsx(A,{}),onClick:()=>c(`${d.replace(/\/$/,"")}/edit`)})}),a.jsx(L,{resourceUri:j({environmentName:e,packageName:s}),dashboard:n,givens:t,onGivensChange:r,onNavigate:l,onEvent:o,maxResultSize:1024*1024})]})}const Q=R.lazy(()=>N(()=>import("./index.es-DcmGg13s.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.DashboardEditor})));function V({environmentName:e,packageName:s,dashboardName:n}){const t=b(),{pathname:r}=$(),l=r.replace(/\/edit\/?$/,""),c=x.useMemo(()=>k({environmentName:e,packageName:s,dashboardName:n}),[e,s,n]);return a.jsxs(i,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:()=>t(`/${e}/${s}`)}),a.jsx(x.Suspense,{fallback:a.jsxs(U,{sx:{gap:2},children:[a.jsx(y,{}),a.jsx(D,{text:"Opening the builder…"})]}),children:a.jsx(Q,{environmentName:e,packageName:s,dashboardName:n,onExit:()=>t(l),onEvent:c})})]})}function q({environmentName:e,packageName:s,notebookPath:n}){const{params:t,onGivensChange:r}=v(),l=E(e,s),c=f();return a.jsxs(i,{sx:{p:3,maxWidth:1200,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:d=>c(`/${e}/${s}`,d)}),a.jsx(F,{resourceUri:j({environmentName:e,packageName:s,modelPath:n}),maxResultSize:1024*1024,givens:t,onGivensChange:r,onNavigate:c,onDrillNavigate:l})]})}function G(){const e=I(),s=e["*"],{server:n}=S(),t=f();if(!e.environmentName)return a.jsx("div",{children:a.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return a.jsx("div",{children:a.jsx("h2",{children:"Missing package name"})});const r={p:3,maxWidth:1200,mx:"auto"};if(s?.startsWith("dashboards/")&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const o=s.slice(11);return o.endsWith("/edit")?a.jsx(V,{environmentName:e.environmentName,packageName:e.packageName,dashboardName:o.slice(0,-5)}):a.jsx(z,{environmentName:e.environmentName,packageName:e.packageName,dashboardName:o})}if(s?.startsWith("data-apps/")&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const o=s.slice(10),p=j({environmentName:e.environmentName,packageName:e.packageName,modelPath:o});return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:u=>t(`/${e.environmentName}/${e.packageName}`,u)}),a.jsx(T,{resourceUri:p})]})}const l=j({environmentName:e.environmentName,packageName:e.packageName,modelPath:s});if(s?.endsWith(".malloy"))return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:o=>t(`/${e.environmentName}/${e.packageName}`,o)}),a.jsx(w,{resourceUri:l,runOnDemand:!0,maxResultSize:512*1024})]});if(s?.endsWith(".malloynb"))return a.jsx(q,{environmentName:e.environmentName,packageName:e.packageName,notebookPath:s});const c=/\.[^./]+$/.test(s??""),d=M({server:n,environmentName:e.environmentName,packageName:e.packageName,path:s??""});return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:o=>t(`/${e.environmentName}/${e.packageName}`,o)}),a.jsx(g,{variant:"h6",sx:{fontWeight:600},children:"Nothing to open at this path"}),a.jsxs(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[a.jsx(i,{component:"span",sx:{fontFamily:h},children:s})," ","does not name a"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloy"})," ","or"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloynb"})," ","file in package"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:e.packageName}),". This address opens"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloy"})," ","and"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloynb"})," ","files."]}),c&&a.jsxs(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:"public/"})," ","directory is served at ",a.jsx(O,{href:d,children:d}),"."]}),a.jsx(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its models, notebooks, and data apps."})]})}export{G as default};
@@ -0,0 +1 @@
1
+ import{K as r,Q as t,j as e,a7 as c,ah as o}from"./index-CqxPodI3.js";function h(){const{environmentName:a,packageName:s}=r(),n=t();if(a)if(s){const i=c({environmentName:a,packageName:s});return e.jsx(o,{onClickPackageFile:n,resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{h as default};
@@ -0,0 +1,116 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BU0_UiMu.js","assets/index-CqxPodI3.js","assets/index-DUqldpo0.css","assets/index-w_0OQJgZ.js"])))=>i.map(i=>d[i]);
2
+ import{j,L as oe,r as p,az as ce,F as ue,n as he,aA as me,ao as be,aB as H,a8 as J,aC as ye,aD as fe,aE as pe,aF as ge,aG as ae}from"./index-CqxPodI3.js";const v="publisher-drill";function ve(e,r){const t=new Set;let o;try{o=e.getMetadata()?.getAllFields()??[]}catch{return t}const l=new Set;for(const a of o)!a||r(a)||a.tag?.tag("hidden")===void 0&&l.add(a.tag?.text("label")??a.name);for(const a of o){if(!a||!r(a))continue;const n=a.tag?.text("label")??a.name;l.has(n)||t.add(n)}return t}function B(e){const r=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return r?r[1]:void 0}function we(e,r){if(r.size!==0)for(const t of e.querySelectorAll(".malloy-table")){const o=n=>n.closest(".malloy-table")===t,l=new Set;for(const n of t.querySelectorAll(".column-cell.th")){if(!o(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),f=B(n);f&&r.has(i)&&l.add(f)}if(l.size===0)continue;const a=new Set;for(const n of t.querySelectorAll(`.${v}[tabindex="0"]`)){if(!o(n))continue;const i=B(n);i&&(a.has(i)?n.tabIndex=-1:a.add(i))}for(const n of t.querySelectorAll(".column-cell.td")){if(!o(n))continue;const i=B(n),f=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&f&&l.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)a.add(i);else{const m=a.has(i);m||a.add(i),n.tabIndex=m?-1:0}n.setAttribute("role","button")}}}}function ke(e){const r=e.closest(".malloy-table"),t=B(e);return!r||!t?[]:Array.from(r.querySelectorAll(`.${v}`)).filter(o=>o.closest(".malloy-table")===r&&B(o)===t)}function ne(e,r){const t=ke(e),o=t.indexOf(e);if(o===-1)return;const l=r==="first"?t[0]:r==="last"?t[t.length-1]:t[Math.min(Math.max(o+r,0),t.length-1)];if(l){for(const a of t)a.tabIndex=a===l?0:-1;return l}}function xe(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Ce(e){const{foreground:r,axisFaint:t,font:o}=e,l={background:e.background,font:o.family,title:{color:r,font:o.family},axis:{labelColor:r,titleColor:r,domainColor:t,tickColor:t,gridColor:t,labelFont:o.family,titleFont:o.family},legend:{labelColor:r,titleColor:r,labelFont:o.family,titleFont:o.family},header:{labelColor:r,titleColor:r},range:{category:e.series}};return a=>l}function Ee(e){if(!e)return;const r=e.tag("theme");if(!r)return;const t={},o=r.tag("palette");if(o){const a={},n=o.textArray("series");n&&n.length>0&&(a.series=n);for(const i of ce){const f=o.tag(i);if(!f)continue;const m={},w=f.text("light"),E=f.text("dark");w&&(m.light=w),E&&(m.dark=E),Object.keys(m).length>0&&(a[i]=m)}Object.keys(a).length>0&&(t.palette=a)}const l=r.tag("font");if(l){const a={},n=l.text("family");n&&(a.family=n);const i=l.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(a.size=i),Object.keys(a).length>0&&(t.font=a)}return Object.keys(t).length>0?t:void 0}const Ae=async(e,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await J(async()=>{const{MalloyRenderer:o}=await import("./index-DSoCUF-f.js");return{MalloyRenderer:o}},[]);return new t({onClick:r,vegaConfigOverride:Ce(e),theme:xe(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};typeof window<"u"&&J(()=>import("./index-DSoCUF-f.js"),[]);async function Se(e){if(!e||typeof e!="object")return;const r=e,t=[...Array.isArray(r.model_annotations)?r.model_annotations:[],...Array.isArray(r.source_annotations)?r.source_annotations:[],...Array.isArray(r.annotations)?r.annotations:[]].map(l=>typeof l?.value=="string"?l.value:void 0).filter(l=>!!l);if(t.length===0)return;let o;try{({parseAnnotation:o}=await J(()=>import("./index-BU0_UiMu.js").then(l=>l.i),__vite__mapDeps([0,1,2,3])))}catch{return}try{const{tag:l}=o(t);return Ee(l)}catch(l){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:l,lines:t});return}}function _e(e,r,t){const o=ye(r,t);for(const[l,a]of Object.entries(o))e.style.setProperty(l,a)}const Re=`
3
+ /* Card geometry, through the renderer's OWN theme vars rather than over the top
4
+ of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
5
+ passes each through to the --malloy-render--* the card CSS reads, so a value
6
+ inherited from our wrapper loses to that declaration however early it is set:
7
+ this has to be a rule on the same element, at higher specificity. Doubling the
8
+ class does that, and then no !important is needed — which matters, because
9
+ !important here also lands on .dashboard-item-borderless and repaints a card
10
+ the author asked to have no card. */
11
+ .malloy-render.malloy-render {
12
+ --malloy-theme--dashboard-card-radius: var(--publisher-dashboard-card-radius);
13
+ --malloy-theme--dashboard-card-padding: var(--publisher-dashboard-card-padding);
14
+ }
15
+ /* dashboard.css hardcodes background: #f7f9fc on .malloy-dashboard
16
+ and .dashboard-row-header, which would paint light grey in dark
17
+ mode and also bleed an operator-picked palette.background across
18
+ the panel chrome in light. Both surfaces use
19
+ --malloy-render--background here, which buildMalloyExplicitTheme
20
+ wires to dashboardRoot: a mode-keyed neutral that stays decoupled
21
+ from palette.background (the chart canvas) on purpose. Selectors
22
+ are duplicated at higher specificity to beat the renderer s own
23
+ scoped rules. */
24
+ .malloy-render .malloy-dashboard,
25
+ .malloy-render.malloy-render .malloy-dashboard,
26
+ div.malloy-render .malloy-dashboard {
27
+ /* --publisher-dashboard-root is set on the outer Publisher wrapper
28
+ (see buildTableCssVars) and stays decoupled from
29
+ --malloy-render--background, which gets shadowed inside the
30
+ renderer when a theme.background annotation is present. The
31
+ dedicated var means the panel between tiles always paints the
32
+ operator neutral dashboardRoot regardless of annotations. */
33
+ background: var(--publisher-dashboard-root) !important;
34
+ background-color: var(--publisher-dashboard-root) !important;
35
+ color: var(--malloy-render--table-body-color) !important;
36
+ }
37
+ .malloy-render .malloy-dashboard .dashboard-row,
38
+ .malloy-render .malloy-dashboard .dashboard-row-body,
39
+ .malloy-render .malloy-dashboard .dashboard-row-header,
40
+ .malloy-render.malloy-render .malloy-dashboard .dashboard-row-header,
41
+ div.malloy-render .malloy-dashboard .dashboard-row-header {
42
+ /* Belt + suspenders: dashboard.css hardcodes .dashboard-row-header
43
+ to #f7f9fc, and row / row-body have no explicit background but
44
+ get caught in any annotation-driven inline writes. Force all of
45
+ them to the neutral panel colour. */
46
+ background: var(--publisher-dashboard-root) !important;
47
+ background-color: var(--publisher-dashboard-root) !important;
48
+ }
49
+ .malloy-render .malloy-dashboard .dashboard-item:not(.dashboard-item-borderless) {
50
+ /* Tile padding around each chart / table. Uses our custom
51
+ --malloy-render--tile-background so the operator can theme the
52
+ tile separately from the table header row (which paints from
53
+ --malloy-render--table-pinned-background below).
54
+
55
+ A flat bordered card rather than the renderer's shadow ring, which is what
56
+ makes it match the composite tile's Paper. :not(borderless) because
57
+ # borderless asks for no card at all, and an !important background and
58
+ border drew one anyway. */
59
+ background: var(--malloy-render--tile-background) !important;
60
+ color: var(--malloy-render--table-body-color) !important;
61
+ box-shadow: none !important;
62
+ border: var(--malloy-render--table-border) !important;
63
+ }
64
+ .malloy-render .malloy-dashboard .dashboard-row-header-separator {
65
+ background: var(--malloy-render--table-border) !important;
66
+ }
67
+ .malloy-render .malloy-table .th.column-cell {
68
+ /* Non-pinned tables have no header background in the renderer's
69
+ own CSS (only pinned scrolled tables paint the pinned-header
70
+ with this var). Force the same value here so every table has a
71
+ visible header band reflecting the operator's choice. */
72
+ background: var(--malloy-render--table-pinned-background) !important;
73
+ }
74
+ .malloy-render .dashboard-item-title,
75
+ .malloy-render .dashboard-dimension-name {
76
+ color: var(--malloy-render--label-color) !important;
77
+ }
78
+ .malloy-render .dashboard-item-value,
79
+ .malloy-render .dashboard-item-value-measure,
80
+ .malloy-render .dashboard-dimension-value {
81
+ color: var(--malloy-render--value-color) !important;
82
+ }
83
+ .malloy-render .malloy-table,
84
+ .malloy-render .malloy-list {
85
+ color: var(--malloy-render--table-body-color) !important;
86
+ }
87
+ .malloy-render .column-cell.th,
88
+ .malloy-render .cell-content.header {
89
+ color: var(--malloy-render--table-header-color) !important;
90
+ }
91
+ /* A cell whose column declares a "# drill" this surface can honor, marked
92
+ by markDrillableCells. Ordinary text with a pointer cursor until hovered,
93
+ then it reads as a link: the same affordance Malloyyo gives the same tag,
94
+ and the only thing that tells a reader a cell navigates. Kept off the
95
+ resting state deliberately: a column painted blue competes with the data.
96
+ (No backticks in here: this is inside a template literal.) */
97
+ .malloy-render .${v} {
98
+ cursor: pointer;
99
+ }
100
+ .malloy-render .${v}:hover > .cell-content {
101
+ color: var(--publisher-drill-link) !important;
102
+ text-decoration: underline;
103
+ }
104
+ /* Keyboard focus reads the same as hover, plus a ring: a hover colour is not
105
+ something a keyboard user can produce, and a focus ring is not something a
106
+ mouse user sees. focus-visible rather than focus, so a click does not leave a
107
+ ring behind it. (No backticks in here: this is inside a template literal.) */
108
+ .malloy-render .${v}:focus-visible {
109
+ outline: 2px solid var(--publisher-drill-link);
110
+ outline-offset: -2px;
111
+ }
112
+ .malloy-render .${v}:focus-visible > .cell-content {
113
+ color: var(--publisher-drill-link) !important;
114
+ text-decoration: underline;
115
+ }
116
+ `,le="publisher-malloy-renderer-overrides";function ze(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=Re,document.head.appendChild(e)}function Fe({result:e,height:r,drill:t,onSizeChange:o,onSizing:l}){const a=p.useRef(null),n=p.useRef(t);n.current=t;const i=p.useCallback(c=>{n.current?.onClick(c)},[]),f=t!==void 0,m=p.useRef(!1),w=p.useRef(null),E=p.useRef(0),{theme:U,layers:W,mode:Y}=ue(),G=he().shape.borderRadius,K=p.useMemo(()=>({radius:`${G}px`,padding:`${me}px`}),[G]);return p.useEffect(()=>()=>{E.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),p.useLayoutEffect(()=>{if(!a.current||!e)return;ze();const c=a.current,se=E.current+=1;let I=!1;const q=()=>!I&&se===E.current;let d,b,L=null,N=0,T=null,$=null,P=null,F=null,O=null,M=null,X=null,Q=0,A=null;m.current=!1;let g,S;const V=k=>{if(I||!k.firstElementChild||H(g,S)==="container")return;const D=fe(g,S);if(m.current&&!D)return;const x=pe(k,ae(g));x>0&&(m.current=!0,o&&x!==Q&&(Q=x,o(x)));const _=ge(k,ae(g));D&&_&&X!==_&&(X=_,M?.disconnect(),M=new ResizeObserver(()=>V(k)),M.observe(_))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const D=await Se(k),x=D?be([...W,D],Y):U;if(!q())return;try{b=await Ae(x,i)}catch(y){console.error("Failed to create renderer:",y);return}if(!q()){b.remove(),b=void 0;return}const _=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",_e(d,x,K),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;F=new MutationObserver(()=>{O&&clearTimeout(O),O=setTimeout(()=>{V(h),m.current&&F?.disconnect()},100)}),F.observe(d,{childList:!0,subtree:!0,attributes:!0});const ie=b;let Z=!1;const ee=()=>{if(!(Z||!q())){Z=!0,A&&(clearTimeout(A),A=null),_?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:ie,node:h},V(h)}};try{b.setResult(k);try{const C=b.getMetadata(),R=C?.getRootField();g=R?.renderAs(),S=R?C?.getPluginsForField(R.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,S=void 0}l?.(H(g,S)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=H(g,S),b.render(d);const y=n.current;try{if(y){const C=ve(b,y.canDrill),R=()=>{try{we(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};R();const re=s=>{const u=s.querySelector(".cell-content")??s,z=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(z.left+z.width/2),clientY:Math.round(z.bottom)}))},te=s=>s.target?.closest?.(`.${v}`)??null,de=(s,u)=>{ne(s,u)?.focus()};T=s=>{const u=te(s);if(!u)return;const z=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(z!==void 0){s.preventDefault(),de(u,z);return}s.key==="Enter"?(s.preventDefault(),re(u)):s.key===" "&&s.preventDefault()},$=s=>{if(s.key!==" ")return;const u=te(s);u&&(s.preventDefault(),re(u))},P=s=>{const u=s.target?.closest?.(`.${v}`);u&&ne(u,0)},h.addEventListener("keydown",T),h.addEventListener("keyup",$),h.addEventListener("focusin",P),C.size>0&&typeof MutationObserver<"u"&&(L=new MutationObserver(()=>{cancelAnimationFrame(N),N=requestAnimationFrame(R)}),L.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}b.onReady(ee),A=setTimeout(ee,1e4)}catch(y){console.error("Error rendering visualization:",y),F?.disconnect(),M?.disconnect(),L?.disconnect(),b.remove(),b=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{I=!0,F?.disconnect(),M?.disconnect(),O&&clearTimeout(O),A&&clearTimeout(A),d&&w.current?.node!==d&&(T&&d.removeEventListener("keydown",T),$&&d.removeEventListener("keyup",$),P&&d.removeEventListener("focusin",P),L?.disconnect(),cancelAnimationFrame(N),b?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,i,f,o,l,U,W,Y,K]),j.jsx("div",{ref:a,style:{width:"100%",height:r?`${r}px`:"400px"}})}function Oe(e){return typeof window>"u"?j.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):j.jsx(p.Suspense,{fallback:j.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:j.jsx(Fe,{...e})})}const De=Object.freeze(Object.defineProperty({__proto__:null,default:Oe},Symbol.toStringTag,{value:"Module"}));export{v as D,Oe as R,Ce as a,xe as b,De as c,ve as d,we as m,Ee as r};
@@ -0,0 +1 @@
1
+ import{aj as o,j as r,ak as s,aa as a,L as n,T as t}from"./index-CqxPodI3.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(a,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(n,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(t,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};