UNPKG

@arcgis/coding-components

Version:
68 lines (57 loc) 4.04 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import{a as u}from"./HPZZVB4X.js";import a from"./GLJQQLP2.js";import{b as o}from"./6G5URSC7.js";import{H as i,I as v,g as p,h as n,j as t,p as d,q as r}from"./2FGVSLMQ.js";export default $arcgis.t(([{e:m,f:y,g:b}])=>{var s={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(a=>a.selected=!1)},g="tree-item-metadata",f=({name:e,isMetadata:a=!1})=>t`<bdi class=${i(o("dictionary-property",a&&g))}>${e}</bdi><bdi class=${i(o(a&&g))}>:&nbsp;</bdi>`,M=({obj:e,subtree:a})=>t`<calcite-tree slot=${"children"} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e,void 0,2)}</calcite-tree-item></calcite-tree>`,N=({value:e,subtree:a=!1})=>t`<calcite-tree slot=${(a?"children":void 0)??v} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${f({name:"type"})}<bdi>${d(e.type)}</bdi></div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${f({name:"value"})}<span class="string-value">${JSON.stringify(e,void 0,2)}</span></div></calcite-tree-item></calcite-tree>`,D=({type:e,value:a})=>{switch(e){case"unknown":case"Unknown":return t`<span class="constant-value">${e}</span>`;case"null":case"Null":return t`<span class="constant-value">null</span>`;case"text":case"String":case"Text":return t`<span class="string-value">${r(a)}</span>`;case"number":case"Number":return t`<span class="number-value">${a}</span>`;case"boolean":case"Boolean":return t`<span class="constant-value">${a}</span>`;case"date":case"Date":return t`<span class="date-value">${a}</span>`;case"dateOnly":case"DateOnly":return t`<span class="string-value">${r(a)}</span>`;case"time":case"Time":return t`<span class="string-value">${r(a)}</span>`;case"":return t`<span class="string-value">null</span>`;default:return null}},h=["boolean","date","dateOnly","null","number","text","time","unknown","Boolean","Date","DateOnly","Null","Number","Text","Time","Unknown","String",""],E=e=>h.includes(e.type);function j(e){switch(e.type){case"null":case"unknown":return{type:e.type,value:e.type};case"number":return{type:e.type,value:String(e.value)};case"boolean":return{type:e.type,value:String(e.value)};case"text":return{type:e.type,value:e.value};case"date":return{type:e.type,value:m(e)};case"dateOnly":return{type:e.type,value:y(e)};case"time":return{type:e.type,value:b(e)}}}var S="calcite-mode-dark";function C(){let e=`:host { `,a=u["light-theme"];Object.entries(a).forEach(([c,l])=>{e+=` --arcgis-editor-${c}: ${l}; `}),e+=`} `,e+=`:host(:state(${S})), `,e+=`:host([calcite-mode-dark]) { `;let $=u["dark-theme"];return Object.entries($).forEach(([c,l])=>{e+=` --arcgis-editor-${c}: ${l};`}),e+=` } `,n` ${p(e)} `}var B=n` .xs { font-size: var(--calcite-font-size-xs); color: var(--calcite-color-text-2); } .breakpoint-code { font-size: var(--calcite-font-size--2); } [class*="result-value-"] { font-size: var(--calcite-font-size--2); background-color: var(--calcite-color-foreground-1); } .tree-item-label, .number-value, .string-value, .boolean-value { font-family: var(--calcite-code-family); } .tree-item-label, .value-type { color: var(--calcite-color-text-2); font-weight: var(--calcite-font-weight-normal); } .tree-item-metadata { opacity: 0.7; } .dictionary-property { color: var(--arcgis-editor-identifier); } .uninitialized-value { color: var(--arcgis-editor-identifier); } .number-value { color: var(--arcgis-editor-number); } .string-value { color: var(--arcgis-editor-string); white-space: pre-wrap; } .constant-value { color: var(--arcgis-editor-constant); } .date-value { color: var(--arcgis-editor-date); } `;return{a:s,b:f,c:M,d:N,e:D,f:E,g:j,h:S,i:C,j:B}},a)