@pandacss/studio 0.15.2 → 0.15.4
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/package.json +8 -8
- package/src/lib/panda.context.ts +0 -2
- package/styled-system/chunks/src__components__color-wrapper.css +16 -25
- package/styled-system/chunks/src__components__colors.css +0 -1
- package/styled-system/chunks/src__components__empty-state.css +0 -1
- package/styled-system/chunks/src__components__font-family.css +0 -1
- package/styled-system/chunks/src__components__font-tokens.css +0 -1
- package/styled-system/chunks/src__components__input.css +10 -16
- package/styled-system/chunks/src__components__layer-styles.css +5 -7
- package/styled-system/chunks/src__components__nav-item.css +3 -5
- package/styled-system/chunks/src__components__overview.css +4 -7
- package/styled-system/chunks/src__components__radii.css +0 -1
- package/styled-system/chunks/src__components__semantic-color.css +0 -1
- package/styled-system/chunks/src__components__side-nav-item.css +4 -7
- package/styled-system/chunks/src__components__side-nav.css +0 -1
- package/styled-system/chunks/src__components__text-styles.css +0 -1
- package/styled-system/chunks/src__components__theme-toggle.css +2 -4
- package/styled-system/chunks/src__components__token-content.css +0 -1
- package/styled-system/chunks/src__components__token-group.css +0 -1
- package/styled-system/chunks/src__components__typography-playground.css +0 -1
- package/styled-system/chunks/src__layouts__Sidebar.css +4 -4
- package/styled-system/jsx/factory.mjs +29 -17
- package/styled-system/styles.css +50 -319
- package/styled-system/types/jsx.d.ts +10 -2
- package/styled-system/types/recipe.d.ts +10 -8
- package/virtual-panda.ts +2 -12
- package/src/components/analyzer/category-utilities.tsx +0 -156
- package/src/components/analyzer/data-combobox.tsx +0 -154
- package/src/components/analyzer/data-table.tsx +0 -39
- package/src/components/analyzer/external-icon.tsx +0 -8
- package/src/components/analyzer/file-details.tsx +0 -101
- package/src/components/analyzer/get-report-infos-from.ts +0 -80
- package/src/components/analyzer/quick-tooltip.tsx +0 -15
- package/src/components/analyzer/report-item-columns.tsx +0 -52
- package/src/components/analyzer/report-item-link.tsx +0 -98
- package/src/components/analyzer/section.tsx +0 -24
- package/src/components/analyzer/sort-icon.tsx +0 -10
- package/src/components/analyzer/text-with-count.tsx +0 -28
- package/src/components/analyzer/token-search-combobox.tsx +0 -39
- package/src/components/analyzer/truncated-text.tsx +0 -28
- package/src/components/analyzer/utility-details.tsx +0 -325
- package/src/components/color-item.tsx +0 -37
- package/src/components/token-analyzer.tsx +0 -397
- package/src/lib/analysis-data.ts +0 -17
- package/src/lib/get-report-item.tsx +0 -41
- package/src/pages/token-analyzer/file.astro +0 -11
- package/src/pages/token-analyzer/index.astro +0 -11
- package/src/pages/token-analyzer/utility.astro +0 -11
- package/styled-system/chunks/src__components__analyzer__category-utilities.css +0 -118
- package/styled-system/chunks/src__components__analyzer__data-combobox.css +0 -137
- package/styled-system/chunks/src__components__analyzer__data-table.css +0 -46
- package/styled-system/chunks/src__components__analyzer__file-details.css +0 -98
- package/styled-system/chunks/src__components__analyzer__report-item-columns.css +0 -39
- package/styled-system/chunks/src__components__analyzer__report-item-link.css +0 -78
- package/styled-system/chunks/src__components__analyzer__section.css +0 -30
- package/styled-system/chunks/src__components__analyzer__text-with-count.css +0 -34
- package/styled-system/chunks/src__components__analyzer__truncated-text.css +0 -18
- package/styled-system/chunks/src__components__analyzer__utility-details.css +0 -139
- package/styled-system/chunks/src__components__color-item.css +0 -22
- package/styled-system/chunks/src__components__token-analyzer.css +0 -220
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { Grid, panda, Stack, Wrap } from '../../../styled-system/jsx'
|
|
2
|
-
import { gridItem, styledLink } from '../../../styled-system/patterns'
|
|
3
|
-
import { getReportItem, getUtilityLink } from '../../lib/get-report-item'
|
|
4
|
-
import { groupBy } from '../../lib/group-in'
|
|
5
|
-
import { Section } from './section'
|
|
6
|
-
import { TextWithCount } from './text-with-count'
|
|
7
|
-
import { TruncatedText } from './truncated-text'
|
|
8
|
-
|
|
9
|
-
import { Portal, Select, SelectContent, SelectOption, SelectPositioner, SelectTrigger } from '@ark-ui/react'
|
|
10
|
-
import { useState } from 'react'
|
|
11
|
-
import { css, cx } from '../../../styled-system/css'
|
|
12
|
-
import { ReportItemLink } from './report-item-link'
|
|
13
|
-
import { SortIcon } from './sort-icon'
|
|
14
|
-
|
|
15
|
-
const selectOptionClass = css({
|
|
16
|
-
padding: '4px 8px',
|
|
17
|
-
bg: 'card',
|
|
18
|
-
rounded: 'md',
|
|
19
|
-
'& li': {
|
|
20
|
-
cursor: 'pointer',
|
|
21
|
-
_hover: { opacity: 0.8 },
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
type SortBy = 'property name' | 'tokens count'
|
|
26
|
-
const defaultOption = { label: 'tokens count', value: 'tokens count' as SortBy }
|
|
27
|
-
|
|
28
|
-
export const ByCategory = ({ byCategory }: { byCategory: Record<string, number[]> }) => {
|
|
29
|
-
const { unknown, ...rest } = byCategory
|
|
30
|
-
const keys = Object.keys(rest)
|
|
31
|
-
const [sortedBy, setSortedBy] = useState<SortBy>('tokens count')
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Section
|
|
35
|
-
p="0"
|
|
36
|
-
title={
|
|
37
|
-
<span>
|
|
38
|
-
<TextWithCount count={keys.length + 1}>Category </TextWithCount>
|
|
39
|
-
<panda.span ml="2">utilities</panda.span>
|
|
40
|
-
</span>
|
|
41
|
-
}
|
|
42
|
-
subTitle={
|
|
43
|
-
<panda.div ml="auto">
|
|
44
|
-
<Select
|
|
45
|
-
onChange={(option) => setSortedBy((option?.value as SortBy) ?? 'tokens count')}
|
|
46
|
-
defaultValue={defaultOption}
|
|
47
|
-
>
|
|
48
|
-
{({ selectedOption }) => (
|
|
49
|
-
<>
|
|
50
|
-
<SelectTrigger>
|
|
51
|
-
<panda.button display="flex" alignItems="center" cursor="pointer" _hover={{ opacity: 0.6 }}>
|
|
52
|
-
Sort by {selectedOption?.label}
|
|
53
|
-
<panda.div w="26px" ml="2" color="text">
|
|
54
|
-
<SortIcon />
|
|
55
|
-
</panda.div>
|
|
56
|
-
</panda.button>
|
|
57
|
-
</SelectTrigger>
|
|
58
|
-
<Portal>
|
|
59
|
-
<SelectPositioner>
|
|
60
|
-
<SelectContent className={cx(selectOptionClass, css({ listStyle: 'none' }))}>
|
|
61
|
-
<SelectOption
|
|
62
|
-
className={selectOptionClass}
|
|
63
|
-
value={defaultOption.value}
|
|
64
|
-
label={defaultOption.label}
|
|
65
|
-
/>
|
|
66
|
-
<SelectOption className={selectOptionClass} value="property name" label="property name" />
|
|
67
|
-
</SelectContent>
|
|
68
|
-
</SelectPositioner>
|
|
69
|
-
</Portal>
|
|
70
|
-
</>
|
|
71
|
-
)}
|
|
72
|
-
</Select>
|
|
73
|
-
</panda.div>
|
|
74
|
-
}
|
|
75
|
-
>
|
|
76
|
-
<Grid gap="4" columns={2}>
|
|
77
|
-
{/* TODO filter out variants from recipes ? */}
|
|
78
|
-
{keys.map((category) => (
|
|
79
|
-
<CategoryUtilities key={category} category={category} byCategory={byCategory} sortedBy={sortedBy} />
|
|
80
|
-
))}
|
|
81
|
-
{unknown ? (
|
|
82
|
-
<CategoryUtilities
|
|
83
|
-
className={gridItem({ colSpan: 2 })}
|
|
84
|
-
category="unknown"
|
|
85
|
-
byCategory={byCategory}
|
|
86
|
-
sortedBy={sortedBy}
|
|
87
|
-
/>
|
|
88
|
-
) : null}
|
|
89
|
-
</Grid>
|
|
90
|
-
</Section>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const CategoryUtilities = ({
|
|
95
|
-
category,
|
|
96
|
-
byCategory,
|
|
97
|
-
className,
|
|
98
|
-
sortedBy,
|
|
99
|
-
}: {
|
|
100
|
-
category: string
|
|
101
|
-
byCategory: Record<string, number[]>
|
|
102
|
-
className?: string
|
|
103
|
-
sortedBy: SortBy
|
|
104
|
-
}) => {
|
|
105
|
-
const reportItemIdList = byCategory[category as keyof typeof byCategory]
|
|
106
|
-
|
|
107
|
-
const categoryTokens = reportItemIdList.map(getReportItem)
|
|
108
|
-
const grouped = groupBy(categoryTokens, 'value')
|
|
109
|
-
const values = Object.entries(grouped)
|
|
110
|
-
const flattened = values.flatMap(([_value, reportItemList]) => reportItemList)
|
|
111
|
-
|
|
112
|
-
const sorted = flattened
|
|
113
|
-
.filter((item) => {
|
|
114
|
-
return item === grouped[String(item.value)][0]
|
|
115
|
-
})
|
|
116
|
-
.sort((a, b) => {
|
|
117
|
-
if (sortedBy === 'property name') {
|
|
118
|
-
const result = a.propName.localeCompare(b.propName)
|
|
119
|
-
if (result !== 0) {
|
|
120
|
-
return result
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return String(a.value).localeCompare(String(b.value))
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (sortedBy === 'tokens count') {
|
|
127
|
-
return grouped[String(b.value)].length - grouped[String(a.value)].length
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return 0
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<Stack key={category} p="4" bg="card" color="text" rounded="md" gap="2" className={className}>
|
|
135
|
-
<panda.h4>
|
|
136
|
-
<panda.a className={styledLink({})} href={getUtilityLink({ category })}>
|
|
137
|
-
<TextWithCount count={values.length}>
|
|
138
|
-
<TruncatedText text={category} fontWeight="semibold" />
|
|
139
|
-
</TextWithCount>
|
|
140
|
-
</panda.a>
|
|
141
|
-
</panda.h4>
|
|
142
|
-
<Wrap gap="2">
|
|
143
|
-
{sorted.map((reportItem) => {
|
|
144
|
-
return (
|
|
145
|
-
<ReportItemLink
|
|
146
|
-
key={reportItem.id}
|
|
147
|
-
value={reportItem.value}
|
|
148
|
-
category={reportItem.category}
|
|
149
|
-
propName={reportItem.propName}
|
|
150
|
-
/>
|
|
151
|
-
)
|
|
152
|
-
})}
|
|
153
|
-
</Wrap>
|
|
154
|
-
</Stack>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Combobox,
|
|
3
|
-
ComboboxContent,
|
|
4
|
-
ComboboxControl,
|
|
5
|
-
ComboboxInput,
|
|
6
|
-
ComboboxLabel,
|
|
7
|
-
ComboboxOption,
|
|
8
|
-
ComboboxPositioner,
|
|
9
|
-
ComboboxTrigger,
|
|
10
|
-
Portal,
|
|
11
|
-
} from '@ark-ui/react'
|
|
12
|
-
import { useEffect, useState } from 'react'
|
|
13
|
-
import { css } from '../../../styled-system/css'
|
|
14
|
-
import { Flex, panda } from '../../../styled-system/jsx'
|
|
15
|
-
import { ChevronDownIcon, XMarkIcon } from '../icons'
|
|
16
|
-
import { inputRecipe } from '../input'
|
|
17
|
-
|
|
18
|
-
export type DataComboboxOption = {
|
|
19
|
-
value: string
|
|
20
|
-
label: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type DataComboboxProps = {
|
|
24
|
-
options: DataComboboxOption[]
|
|
25
|
-
label?: React.ReactNode
|
|
26
|
-
placeholder?: string
|
|
27
|
-
filterFn?: (value: string) => DataComboboxOption[]
|
|
28
|
-
defaultValue?: string
|
|
29
|
-
onSelect?: (option: any) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const DataCombobox = ({ options: allOptions, label, ...props }: DataComboboxProps) => {
|
|
33
|
-
const [options, setOptions] = useState(allOptions)
|
|
34
|
-
const filterFn =
|
|
35
|
-
props.filterFn ||
|
|
36
|
-
((value: string) => allOptions.filter((item) => item.label.toLowerCase().includes(value.toLowerCase())))
|
|
37
|
-
|
|
38
|
-
// sync available options from parent
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
setOptions(allOptions)
|
|
41
|
-
}, [allOptions])
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Combobox openOnClick {...props} className={css({ m: 4 })}>
|
|
45
|
-
{(state: any) => {
|
|
46
|
-
return (
|
|
47
|
-
<>
|
|
48
|
-
<ComboboxControl>
|
|
49
|
-
<panda.div display="flex" flexDirection="column" gap="2">
|
|
50
|
-
{label && (
|
|
51
|
-
<ComboboxLabel>
|
|
52
|
-
<panda.span fontWeight="bold">{label}</panda.span>
|
|
53
|
-
</ComboboxLabel>
|
|
54
|
-
)}
|
|
55
|
-
<panda.div display="flex" position="relative" isolation="isolate">
|
|
56
|
-
<ComboboxInput
|
|
57
|
-
defaultValue={props.defaultValue}
|
|
58
|
-
placeholder={props.placeholder ?? 'Search...'}
|
|
59
|
-
className={inputRecipe()}
|
|
60
|
-
onChange={(e) => {
|
|
61
|
-
const value = e.target.value
|
|
62
|
-
if (!value) {
|
|
63
|
-
props?.onSelect?.({ relatedTarget: null })
|
|
64
|
-
setOptions(allOptions)
|
|
65
|
-
state.clearValue()
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
setOptions(filterFn(value))
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
<Flex
|
|
73
|
-
top="0px"
|
|
74
|
-
right="0px"
|
|
75
|
-
align="center"
|
|
76
|
-
justify="center"
|
|
77
|
-
position="absolute"
|
|
78
|
-
zIndex="2"
|
|
79
|
-
height="full"
|
|
80
|
-
>
|
|
81
|
-
{state.selectedValue && (
|
|
82
|
-
<panda.span
|
|
83
|
-
display="flex"
|
|
84
|
-
px="2"
|
|
85
|
-
cursor="pointer"
|
|
86
|
-
userSelect="none"
|
|
87
|
-
onClick={() => state.clearValue()}
|
|
88
|
-
alignItems="center"
|
|
89
|
-
>
|
|
90
|
-
<XMarkIcon />
|
|
91
|
-
</panda.span>
|
|
92
|
-
)}
|
|
93
|
-
<ComboboxTrigger>
|
|
94
|
-
<panda.span
|
|
95
|
-
ml="auto"
|
|
96
|
-
p="2"
|
|
97
|
-
display="flex"
|
|
98
|
-
cursor="pointer"
|
|
99
|
-
borderLeft="solid 1px"
|
|
100
|
-
borderColor="border"
|
|
101
|
-
color="text"
|
|
102
|
-
>
|
|
103
|
-
<panda.span
|
|
104
|
-
data-expanded={state.isOpen ? '' : undefined}
|
|
105
|
-
transform={{ _expanded: 'rotate(180deg)' }}
|
|
106
|
-
transition="all .2s ease"
|
|
107
|
-
>
|
|
108
|
-
<ChevronDownIcon />
|
|
109
|
-
</panda.span>
|
|
110
|
-
</panda.span>
|
|
111
|
-
</ComboboxTrigger>
|
|
112
|
-
</Flex>
|
|
113
|
-
</panda.div>
|
|
114
|
-
</panda.div>
|
|
115
|
-
</ComboboxControl>
|
|
116
|
-
<Portal>
|
|
117
|
-
<ComboboxPositioner>
|
|
118
|
-
<ComboboxContent
|
|
119
|
-
className={css({
|
|
120
|
-
maxHeight: '300px',
|
|
121
|
-
overflow: 'auto',
|
|
122
|
-
padding: '4px 8px',
|
|
123
|
-
bg: 'card',
|
|
124
|
-
listStyle: 'none',
|
|
125
|
-
rounded: 'md',
|
|
126
|
-
border: '1px solid token(colors.border)',
|
|
127
|
-
shadow: 'sm',
|
|
128
|
-
})}
|
|
129
|
-
>
|
|
130
|
-
{/* TODO virtualization */}
|
|
131
|
-
{options.map((option) => (
|
|
132
|
-
<ComboboxOption
|
|
133
|
-
key={option.label + '-' + option.value}
|
|
134
|
-
value={option.value}
|
|
135
|
-
label={option.label}
|
|
136
|
-
className={css({
|
|
137
|
-
padding: '4px 8px',
|
|
138
|
-
rounded: 'md',
|
|
139
|
-
wordWrap: 'break-word',
|
|
140
|
-
_highlighted: {
|
|
141
|
-
bg: 'border',
|
|
142
|
-
},
|
|
143
|
-
})}
|
|
144
|
-
/>
|
|
145
|
-
))}
|
|
146
|
-
</ComboboxContent>
|
|
147
|
-
</ComboboxPositioner>
|
|
148
|
-
</Portal>
|
|
149
|
-
</>
|
|
150
|
-
)
|
|
151
|
-
}}
|
|
152
|
-
</Combobox>
|
|
153
|
-
)
|
|
154
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import { Grid, panda } from '../../../styled-system/jsx'
|
|
3
|
-
import { flex } from '../../../styled-system/patterns'
|
|
4
|
-
|
|
5
|
-
export type Column<T> = { header: string; accessor: string; cell?: (item: T) => ReactNode }
|
|
6
|
-
|
|
7
|
-
// TODO tanstack/table ? hide/show columns + sort
|
|
8
|
-
export function DataTable<T>({ list, columns }: { list: T[]; columns: ReadonlyArray<Column<T>> }) {
|
|
9
|
-
return (
|
|
10
|
-
<panda.div>
|
|
11
|
-
<Grid
|
|
12
|
-
gridTemplateColumns="80px repeat(auto-fit, minmax(30px, 1fr))"
|
|
13
|
-
w="full"
|
|
14
|
-
fontWeight="bold"
|
|
15
|
-
fontSize="lg"
|
|
16
|
-
mb="2"
|
|
17
|
-
>
|
|
18
|
-
{columns.map((column) => {
|
|
19
|
-
return <panda.div key={column.header}>{column.header}</panda.div>
|
|
20
|
-
})}
|
|
21
|
-
</Grid>
|
|
22
|
-
<panda.div className={flex({ direction: 'column', gap: '2' })}>
|
|
23
|
-
{list.map((item, index) => {
|
|
24
|
-
return (
|
|
25
|
-
<Grid gridTemplateColumns="80px repeat(auto-fit, minmax(30px, 1fr))" w="full" key={index}>
|
|
26
|
-
{columns.map((column) => {
|
|
27
|
-
return (
|
|
28
|
-
<panda.div key={column.accessor} wordBreak="break-word">
|
|
29
|
-
{column.cell?.(item) ?? (item as any)[column.accessor]}
|
|
30
|
-
</panda.div>
|
|
31
|
-
)
|
|
32
|
-
})}
|
|
33
|
-
</Grid>
|
|
34
|
-
)
|
|
35
|
-
})}
|
|
36
|
-
</panda.div>
|
|
37
|
-
</panda.div>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @see https://iconmonstr.com/share-11-svg/ */
|
|
2
|
-
export const ExternalIcon = () => {
|
|
3
|
-
return (
|
|
4
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
5
|
-
<path d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z" />
|
|
6
|
-
</svg>
|
|
7
|
-
)
|
|
8
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { ReportItemJSON } from '@pandacss/types'
|
|
2
|
-
import { panda, Wrap } from '../../../styled-system/jsx'
|
|
3
|
-
import { styledLink } from '../../../styled-system/patterns'
|
|
4
|
-
import { createContext } from '../../lib/create-context'
|
|
5
|
-
import { analysisData } from '../../lib/analysis-data'
|
|
6
|
-
import { getReportItem, getUtilityLink, getReportRelativeFilePath } from '../../lib/get-report-item'
|
|
7
|
-
import { ByCategory } from './category-utilities'
|
|
8
|
-
import { ColorItem } from '../color-item'
|
|
9
|
-
import { TokenSearchCombobox } from './token-search-combobox'
|
|
10
|
-
import { TextWithCount } from './text-with-count'
|
|
11
|
-
import { TruncatedText } from './truncated-text'
|
|
12
|
-
|
|
13
|
-
export const FileDetails = () => {
|
|
14
|
-
const search = new URLSearchParams(window.location.search)
|
|
15
|
-
const filepath = search.get('filepath')
|
|
16
|
-
|
|
17
|
-
const byFilepath = analysisData.details.byFilepath[filepath as keyof typeof analysisData.details.byFilepath] ?? []
|
|
18
|
-
const reportItemList = byFilepath.map(getReportItem)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<panda.div>
|
|
22
|
-
<panda.div display="flex">
|
|
23
|
-
<panda.a href="/token-analyzer">
|
|
24
|
-
<panda.span fontWeight="bold">{'<'} </panda.span>Back
|
|
25
|
-
</panda.a>
|
|
26
|
-
<panda.div ml="auto">
|
|
27
|
-
<TokenSearchCombobox placeholder="Global search" />
|
|
28
|
-
</panda.div>
|
|
29
|
-
</panda.div>
|
|
30
|
-
<panda.div p="4" mt="4">
|
|
31
|
-
{!filepath ? (
|
|
32
|
-
<panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
|
|
33
|
-
No file selected
|
|
34
|
-
</panda.div>
|
|
35
|
-
) : reportItemList.length > 0 ? (
|
|
36
|
-
<FileProvider value={{ filepath, localMaps: analysisData.details.byFilePathMaps[filepath], reportItemList }}>
|
|
37
|
-
<FileDetailsContent />
|
|
38
|
-
</FileProvider>
|
|
39
|
-
) : (
|
|
40
|
-
<panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
|
|
41
|
-
No results
|
|
42
|
-
</panda.div>
|
|
43
|
-
)}
|
|
44
|
-
</panda.div>
|
|
45
|
-
</panda.div>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const [FileProvider, useFileContext] = createContext<{
|
|
50
|
-
filepath: string
|
|
51
|
-
localMaps: (typeof analysisData.details.byFilePathMaps)[string]
|
|
52
|
-
reportItemList: Array<ReportItemJSON>
|
|
53
|
-
}>({
|
|
54
|
-
name: 'UtilityFileContext',
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const FileDetailsContent = () => {
|
|
58
|
-
const { filepath, localMaps, reportItemList } = useFileContext()
|
|
59
|
-
const colors = Object.entries(localMaps.colorsUsed)
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<>
|
|
63
|
-
<panda.h3 mb="4">
|
|
64
|
-
Usage in file :{' '}
|
|
65
|
-
<panda.a
|
|
66
|
-
mt="1"
|
|
67
|
-
key={filepath}
|
|
68
|
-
className={styledLink({})}
|
|
69
|
-
href={getUtilityLink({ filepath })}
|
|
70
|
-
onClick={(e) => e.stopPropagation()}
|
|
71
|
-
>
|
|
72
|
-
<TextWithCount count={reportItemList.length}>{getReportRelativeFilePath(filepath)}</TextWithCount>
|
|
73
|
-
</panda.a>
|
|
74
|
-
</panda.h3>
|
|
75
|
-
<ByCategory byCategory={localMaps.byCategory} />
|
|
76
|
-
{colors.length ? (
|
|
77
|
-
<panda.div mt="8">
|
|
78
|
-
<panda.h3>
|
|
79
|
-
<TextWithCount count={colors.length}>Color palette</TextWithCount>
|
|
80
|
-
</panda.h3>
|
|
81
|
-
<Wrap gap="2" mt="4">
|
|
82
|
-
{colors.map(([key]) => {
|
|
83
|
-
return (
|
|
84
|
-
<ColorItem
|
|
85
|
-
tokenName={key}
|
|
86
|
-
key={key}
|
|
87
|
-
py="2"
|
|
88
|
-
px="4"
|
|
89
|
-
transition="all 0.2s ease"
|
|
90
|
-
_hover={{ bgColor: 'gray.100' }}
|
|
91
|
-
>
|
|
92
|
-
<TruncatedText text={key} />
|
|
93
|
-
</ColorItem>
|
|
94
|
-
)
|
|
95
|
-
})}
|
|
96
|
-
</Wrap>
|
|
97
|
-
</panda.div>
|
|
98
|
-
) : null}
|
|
99
|
-
</>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ReportItemJSON } from '@pandacss/types'
|
|
2
|
-
import { analysisData } from '../../lib/analysis-data'
|
|
3
|
-
import { getReportItem, type SearchableReportItemAttributes } from '../../lib/get-report-item'
|
|
4
|
-
|
|
5
|
-
export const getReportInfosFrom = (params: SearchableReportItemAttributes) => {
|
|
6
|
-
let byTokenName: Array<ReportItemJSON['id']> = []
|
|
7
|
-
let byCategory: Array<ReportItemJSON['id']> = []
|
|
8
|
-
let byPropName: Array<ReportItemJSON['id']> = []
|
|
9
|
-
let byInstanceName: Array<ReportItemJSON['id']> = []
|
|
10
|
-
let byFilepath: Array<ReportItemJSON['id']> = []
|
|
11
|
-
let hasParam = false
|
|
12
|
-
|
|
13
|
-
if (params.value) {
|
|
14
|
-
byTokenName =
|
|
15
|
-
analysisData.details.globalMaps.byTokenName[
|
|
16
|
-
params.value as keyof typeof analysisData.details.globalMaps.byTokenName
|
|
17
|
-
] ?? []
|
|
18
|
-
hasParam = true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (params.category) {
|
|
22
|
-
byCategory =
|
|
23
|
-
analysisData.details.globalMaps.byCategory[
|
|
24
|
-
params.category as keyof typeof analysisData.details.globalMaps.byCategory
|
|
25
|
-
] ?? []
|
|
26
|
-
hasParam = true
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (params.propName) {
|
|
30
|
-
byPropName =
|
|
31
|
-
analysisData.details.globalMaps.byPropertyName[
|
|
32
|
-
params.propName as keyof typeof analysisData.details.globalMaps.byPropertyName
|
|
33
|
-
] ?? []
|
|
34
|
-
hasParam = true
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (params.from) {
|
|
38
|
-
byInstanceName =
|
|
39
|
-
analysisData.details.globalMaps.byInstanceName[
|
|
40
|
-
params.from as keyof typeof analysisData.details.globalMaps.byInstanceName
|
|
41
|
-
] ?? []
|
|
42
|
-
hasParam = true
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (params.filepath) {
|
|
46
|
-
byFilepath = analysisData.details.byFilepath[params.filepath as keyof typeof analysisData.details.byFilepath] ?? []
|
|
47
|
-
hasParam = true
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
params,
|
|
52
|
-
hasParam,
|
|
53
|
-
byTokenName: byTokenName.map(getReportItem),
|
|
54
|
-
byCategory: byCategory.map(getReportItem),
|
|
55
|
-
byPropName: byPropName.map(getReportItem),
|
|
56
|
-
byInstanceName: byInstanceName.map(getReportItem),
|
|
57
|
-
byFilepath: byFilepath.map(getReportItem),
|
|
58
|
-
reportItemList: combineIntersections(byTokenName, byCategory, byPropName, byInstanceName, byFilepath).map(
|
|
59
|
-
getReportItem,
|
|
60
|
-
),
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function combineIntersections<T>(...lists: Array<T[]>) {
|
|
64
|
-
return lists.reduce((acc, current) => {
|
|
65
|
-
if (!acc.length) return current
|
|
66
|
-
|
|
67
|
-
if (!current.length) return acc
|
|
68
|
-
|
|
69
|
-
return intersection(acc, current)
|
|
70
|
-
}, [] as T[])
|
|
71
|
-
}
|
|
72
|
-
function intersection<T = any>(left: Array<T>, right: Array<T>) {
|
|
73
|
-
const _intersection = new Set()
|
|
74
|
-
for (const elem of right) {
|
|
75
|
-
if (left.includes(elem)) {
|
|
76
|
-
_intersection.add(elem)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return Array.from(_intersection) as Array<T>
|
|
80
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Portal, Tooltip, TooltipContent, TooltipPositioner, TooltipTrigger } from '@ark-ui/react'
|
|
2
|
-
import type { ReactElement, ReactNode } from 'react'
|
|
3
|
-
|
|
4
|
-
export const QuickTooltip = ({ children, tooltip }: { children: ReactElement; tooltip: ReactNode }) => {
|
|
5
|
-
return (
|
|
6
|
-
<Tooltip openDelay={0} closeDelay={100} positioning={{ placement: 'bottom-start', gutter: 20 }}>
|
|
7
|
-
<TooltipTrigger>{children}</TooltipTrigger>
|
|
8
|
-
<Portal>
|
|
9
|
-
<TooltipPositioner>
|
|
10
|
-
<TooltipContent>{tooltip}</TooltipContent>
|
|
11
|
-
</TooltipPositioner>
|
|
12
|
-
</Portal>
|
|
13
|
-
</Tooltip>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { ReportItemJSON } from '@pandacss/types'
|
|
2
|
-
import { panda } from '../../../styled-system/jsx'
|
|
3
|
-
import { ReportItemOpenInEditorLink, UtilityLink } from './report-item-link'
|
|
4
|
-
import { QuickTooltip } from './quick-tooltip'
|
|
5
|
-
|
|
6
|
-
export const reportItemColumns = [
|
|
7
|
-
{
|
|
8
|
-
header: '#',
|
|
9
|
-
accessor: 'id',
|
|
10
|
-
cell: (item: ReportItemJSON) => <panda.span onClick={() => console.log(item)}>{item.id}</panda.span>,
|
|
11
|
-
},
|
|
12
|
-
{ header: 'from', accessor: 'from', cell: (item: ReportItemJSON) => <UtilityLink from={item.from} /> },
|
|
13
|
-
{
|
|
14
|
-
header: 'category',
|
|
15
|
-
accessor: 'category',
|
|
16
|
-
cell: (item: ReportItemJSON) => <UtilityLink category={item.category} />,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
header: 'property name',
|
|
20
|
-
accessor: 'propName',
|
|
21
|
-
cell: (item: ReportItemJSON) => <UtilityLink propName={item.propName} />,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
header: 'token name',
|
|
25
|
-
accessor: 'value',
|
|
26
|
-
cell: (item: ReportItemJSON) => {
|
|
27
|
-
return (
|
|
28
|
-
<panda.div display="flex" alignItems="center">
|
|
29
|
-
{!item.isKnown && (
|
|
30
|
-
<QuickTooltip
|
|
31
|
-
tooltip={
|
|
32
|
-
<panda.span p="2" bgColor="card" border="1px solid token(colors.border)" shadow="sm" rounded="md">
|
|
33
|
-
unknown token
|
|
34
|
-
</panda.span>
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<panda.span mr="2" userSelect="none">
|
|
38
|
-
{'❌'}
|
|
39
|
-
</panda.span>
|
|
40
|
-
</QuickTooltip>
|
|
41
|
-
)}
|
|
42
|
-
<UtilityLink value={item.value} />
|
|
43
|
-
</panda.div>
|
|
44
|
-
)
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
header: 'filepath',
|
|
49
|
-
accessor: 'filepath',
|
|
50
|
-
cell: (item: ReportItemJSON) => <ReportItemOpenInEditorLink withRange {...item} />,
|
|
51
|
-
},
|
|
52
|
-
] as const // TODO satisifes Column[]
|