@pandacss/studio 0.15.3 → 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.
Files changed (59) hide show
  1. package/package.json +8 -8
  2. package/src/lib/panda.context.ts +0 -2
  3. package/styled-system/chunks/src__components__color-wrapper.css +16 -25
  4. package/styled-system/chunks/src__components__colors.css +0 -1
  5. package/styled-system/chunks/src__components__empty-state.css +0 -1
  6. package/styled-system/chunks/src__components__font-family.css +0 -1
  7. package/styled-system/chunks/src__components__font-tokens.css +0 -1
  8. package/styled-system/chunks/src__components__input.css +10 -16
  9. package/styled-system/chunks/src__components__layer-styles.css +5 -7
  10. package/styled-system/chunks/src__components__nav-item.css +3 -5
  11. package/styled-system/chunks/src__components__overview.css +4 -7
  12. package/styled-system/chunks/src__components__radii.css +0 -1
  13. package/styled-system/chunks/src__components__semantic-color.css +0 -1
  14. package/styled-system/chunks/src__components__side-nav-item.css +4 -7
  15. package/styled-system/chunks/src__components__side-nav.css +0 -1
  16. package/styled-system/chunks/src__components__text-styles.css +0 -1
  17. package/styled-system/chunks/src__components__theme-toggle.css +2 -4
  18. package/styled-system/chunks/src__components__token-content.css +0 -1
  19. package/styled-system/chunks/src__components__token-group.css +0 -1
  20. package/styled-system/chunks/src__components__typography-playground.css +0 -1
  21. package/styled-system/chunks/src__layouts__Sidebar.css +4 -4
  22. package/styled-system/jsx/factory.mjs +28 -15
  23. package/styled-system/styles.css +50 -319
  24. package/styled-system/types/jsx.d.ts +10 -2
  25. package/virtual-panda.ts +2 -12
  26. package/src/components/analyzer/category-utilities.tsx +0 -156
  27. package/src/components/analyzer/data-combobox.tsx +0 -154
  28. package/src/components/analyzer/data-table.tsx +0 -39
  29. package/src/components/analyzer/external-icon.tsx +0 -8
  30. package/src/components/analyzer/file-details.tsx +0 -101
  31. package/src/components/analyzer/get-report-infos-from.ts +0 -80
  32. package/src/components/analyzer/quick-tooltip.tsx +0 -15
  33. package/src/components/analyzer/report-item-columns.tsx +0 -52
  34. package/src/components/analyzer/report-item-link.tsx +0 -98
  35. package/src/components/analyzer/section.tsx +0 -24
  36. package/src/components/analyzer/sort-icon.tsx +0 -10
  37. package/src/components/analyzer/text-with-count.tsx +0 -28
  38. package/src/components/analyzer/token-search-combobox.tsx +0 -39
  39. package/src/components/analyzer/truncated-text.tsx +0 -28
  40. package/src/components/analyzer/utility-details.tsx +0 -325
  41. package/src/components/color-item.tsx +0 -37
  42. package/src/components/token-analyzer.tsx +0 -397
  43. package/src/lib/analysis-data.ts +0 -17
  44. package/src/lib/get-report-item.tsx +0 -41
  45. package/src/pages/token-analyzer/file.astro +0 -11
  46. package/src/pages/token-analyzer/index.astro +0 -11
  47. package/src/pages/token-analyzer/utility.astro +0 -11
  48. package/styled-system/chunks/src__components__analyzer__category-utilities.css +0 -118
  49. package/styled-system/chunks/src__components__analyzer__data-combobox.css +0 -137
  50. package/styled-system/chunks/src__components__analyzer__data-table.css +0 -46
  51. package/styled-system/chunks/src__components__analyzer__file-details.css +0 -98
  52. package/styled-system/chunks/src__components__analyzer__report-item-columns.css +0 -39
  53. package/styled-system/chunks/src__components__analyzer__report-item-link.css +0 -78
  54. package/styled-system/chunks/src__components__analyzer__section.css +0 -30
  55. package/styled-system/chunks/src__components__analyzer__text-with-count.css +0 -34
  56. package/styled-system/chunks/src__components__analyzer__truncated-text.css +0 -18
  57. package/styled-system/chunks/src__components__analyzer__utility-details.css +0 -139
  58. package/styled-system/chunks/src__components__color-item.css +0 -22
  59. package/styled-system/chunks/src__components__token-analyzer.css +0 -220
@@ -1,28 +0,0 @@
1
- import { panda } from '../../../styled-system/jsx'
2
- import type { JsxStyleProps } from '../../../styled-system/types'
3
- import { truncate } from '../../lib/truncate'
4
- import { QuickTooltip } from './quick-tooltip'
5
-
6
- export const TruncatedText = ({
7
- text,
8
- characters = 24,
9
- ...props
10
- }: { text: string; characters?: number } & JsxStyleProps) => {
11
- if (text.length > characters) {
12
- return (
13
- <QuickTooltip
14
- tooltip={
15
- <panda.span p="2" bgColor="card" border="1px solid rgba(0, 0, 0, 0.1)">
16
- {truncate(text, 80)}
17
- </panda.span>
18
- }
19
- >
20
- <panda.span color="text" {...props}>
21
- {text.substring(0, characters) + '...'}
22
- </panda.span>
23
- </QuickTooltip>
24
- )
25
- }
26
-
27
- return <panda.span {...props}>{text}</panda.span>
28
- }
@@ -1,325 +0,0 @@
1
- import {
2
- Portal,
3
- Select,
4
- SelectContent,
5
- SelectLabel,
6
- SelectOption,
7
- SelectPositioner,
8
- SelectTrigger,
9
- } from '@ark-ui/react'
10
- import { useState } from 'react'
11
-
12
- import { css, cx } from '../../../styled-system/css'
13
- import { Flex, Wrap, panda } from '../../../styled-system/jsx'
14
- import { styledLink } from '../../../styled-system/patterns'
15
-
16
- import { analysisData } from '../../lib/analysis-data'
17
- import { createContext } from '../../lib/create-context'
18
- import { getFileLink, getReportRelativeFilePath, type SearchableReportItemAttributes } from '../../lib/get-report-item'
19
- import { TokenSearchCombobox } from './token-search-combobox'
20
- import { DataCombobox, type DataComboboxOption } from './data-combobox'
21
- import { DataTable } from './data-table'
22
- import { getReportInfosFrom } from './get-report-infos-from'
23
- import { reportItemColumns } from './report-item-columns'
24
- import { Section } from './section'
25
- import { TextWithCount } from './text-with-count'
26
- import { XMarkIcon } from '../icons'
27
-
28
- export const UtilityDetails = () => {
29
- const search = new URLSearchParams(window.location.search)
30
- const initialParams = Object.fromEntries(search.entries()) as SearchableReportItemAttributes
31
- const [params, setParams] = useState(initialParams)
32
- // console.log({ params, globalMaps: analysisData.details.globalMaps })
33
-
34
- const infos = getReportInfosFrom(params)
35
- // console.log(infos)
36
-
37
- return (
38
- <panda.div>
39
- <panda.div display="flex">
40
- <panda.a href="/token-analyzer">
41
- <panda.span fontWeight="bold">{'<'} </panda.span>Back
42
- </panda.a>
43
- <panda.div ml="auto">
44
- <TokenSearchCombobox placeholder="Global search" />
45
- </panda.div>
46
- </panda.div>
47
- <panda.div p="4" mt="4">
48
- <DetailsProvider value={[infos, setParams]}>
49
- <UtilityFilters />
50
- <hr />
51
- {infos.reportItemList.length ? (
52
- <UtilityDetailsContent />
53
- ) : !infos.hasParam ? (
54
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
55
- Use at least one filter
56
- </panda.div>
57
- ) : (
58
- <panda.div display="flex" justifyContent="center" fontSize="xl" p="16" fontWeight="bold">
59
- No results
60
- </panda.div>
61
- )}
62
- </DetailsProvider>
63
- </panda.div>
64
- </panda.div>
65
- )
66
- }
67
-
68
- type Infos = ReturnType<typeof getReportInfosFrom>
69
- const [DetailsProvider, useDetails] = createContext<[Infos, React.Dispatch<React.SetStateAction<Infos['params']>>]>({
70
- name: 'UtilityDetailsContext',
71
- })
72
-
73
- const updateSearchParam = (key: string, value: string | undefined) => {
74
- const search = new URLSearchParams(window.location.search)
75
- if (value === undefined) {
76
- search.delete(key)
77
- } else {
78
- search.set(key, value)
79
- }
80
- window.history.pushState(Object.fromEntries(search.entries()), '', `${window.location.pathname}?${search.toString()}`)
81
- }
82
-
83
- const uniq = (arr: string[]) => Array.from(new Set(arr))
84
- const toOption = (value: string | object) =>
85
- (typeof value === 'string' ? { value, label: value } : value) as DataComboboxOption
86
- const toFilepathOption = (filepath: string) => ({ value: filepath, label: getReportRelativeFilePath(filepath) })
87
-
88
- const UtilityFilters = () => {
89
- const [infos, setParams] = useDetails()
90
- const [resetKey, setResetKey] = useState(0)
91
-
92
- const allTokenNames = Object.keys(analysisData.details.globalMaps.byTokenName)
93
- const filteredTokenNames = uniq(infos.reportItemList.map((item) => String(item.value)))
94
- const tokenNames = filteredTokenNames.length > 0 ? filteredTokenNames : allTokenNames
95
-
96
- const allCategories = Object.keys(analysisData.details.globalMaps.byCategory)
97
- const filteredCategories = uniq(infos.reportItemList.map((item) => item.category))
98
- const categories = filteredCategories.length > 0 ? filteredCategories : allCategories
99
-
100
- const allPropertyNames = Object.keys(analysisData.details.globalMaps.byPropertyName)
101
- const filteredPropertyNames = uniq(infos.reportItemList.map((item) => item.propName))
102
- const propertyNames = filteredPropertyNames.length > 0 ? filteredPropertyNames : allPropertyNames
103
-
104
- const allFrom = Object.keys(analysisData.details.globalMaps.byInstanceName)
105
- const filteredFrom = uniq(infos.reportItemList.map((item) => item.from))
106
- const from = filteredFrom.length > 0 ? filteredFrom : allFrom
107
-
108
- const allFilepath = Object.keys(analysisData.details.byFilepath).map(toFilepathOption)
109
- const filteredFilepath = uniq(infos.reportItemList.map((item) => item.filepath)).map(toFilepathOption)
110
- const filepath = filteredFilepath.length > 0 ? filteredFilepath : allFilepath
111
-
112
- return (
113
- <panda.div mb="4">
114
- <Flex>
115
- <panda.h3>Filters</panda.h3>
116
- {infos.hasParam && (
117
- <panda.button
118
- ml="auto"
119
- cursor="pointer"
120
- userSelect="none"
121
- bg="card"
122
- px="3"
123
- py="2"
124
- rounded="md"
125
- _hover={{ opacity: 0.8 }}
126
- onClick={() => {
127
- updateSearchParam('value', undefined)
128
- updateSearchParam('category', undefined)
129
- updateSearchParam('propName', undefined)
130
- updateSearchParam('from', undefined)
131
- updateSearchParam('filepath', undefined)
132
- setParams({})
133
- setResetKey((k) => k + 1)
134
- }}
135
- >
136
- <panda.span display="flex" gap="2" alignItems="center">
137
- <XMarkIcon width="16" height="16" /> Clear filters
138
- </panda.span>
139
- </panda.button>
140
- )}
141
- </Flex>
142
- <Wrap key={resetKey}>
143
- <DataCombobox
144
- label="Token name"
145
- options={tokenNames.map(toOption)}
146
- onSelect={(e) => {
147
- updateSearchParam('value', e.value)
148
- return setParams((params) => ({ ...params, ['value']: e.value }))
149
- }}
150
- defaultValue={String(infos.params.value ?? '')}
151
- />
152
- <DataCombobox
153
- label="Property name"
154
- options={propertyNames.map(toOption)}
155
- onSelect={(e) => {
156
- updateSearchParam('propName', e.value)
157
- return setParams((params) => ({ ...params, ['propName']: e.value }))
158
- }}
159
- defaultValue={String(infos.params.propName ?? '')}
160
- />
161
- <DataCombobox
162
- label="Category"
163
- options={categories.map(toOption)}
164
- onSelect={(e) => {
165
- updateSearchParam('category', e.value)
166
- return setParams((params) => ({ ...params, ['category']: e.value }))
167
- }}
168
- defaultValue={String(infos.params.category ?? '')}
169
- />
170
- <DataCombobox
171
- label="Instance name (from)"
172
- options={from.map(toOption)}
173
- onSelect={(e) => {
174
- updateSearchParam('from', e.value)
175
- return setParams((params) => ({ ...params, ['from']: e.value }))
176
- }}
177
- defaultValue={String(infos.params.from ?? '')}
178
- />
179
- <DataCombobox
180
- label="Filepath"
181
- options={filepath.map(toOption)}
182
- onSelect={(e) => {
183
- updateSearchParam('filepath', e.value)
184
- return setParams((params) => ({ ...params, ['filepath']: e.value }))
185
- }}
186
- defaultValue={String(infos.params.filepath ?? '')}
187
- />
188
- </Wrap>
189
- </panda.div>
190
- )
191
- }
192
-
193
- const UtilityDetailsContent = () => {
194
- const [infos] = useDetails()
195
-
196
- return (
197
- <>
198
- <ReportItemMatchingFiltersTable {...infos} />
199
- <UsedInFiles />
200
- </>
201
- )
202
- }
203
-
204
- const UsedInFiles = () => {
205
- const [infos] = useDetails()
206
- const files = uniq(infos.reportItemList.map((item) => item.filepath))
207
-
208
- return (
209
- <panda.div>
210
- <panda.h3>
211
- <TextWithCount count={files.length}>Used in files</TextWithCount>
212
- </panda.h3>
213
- <panda.div display="flex" flexDirection="column">
214
- {files.map((filepath) => (
215
- <panda.a
216
- mt="1"
217
- key={filepath}
218
- className={styledLink({})}
219
- href={getFileLink({ filepath })}
220
- onClick={(e) => e.stopPropagation()}
221
- >
222
- <TextWithCount count={infos.reportItemList.filter((item) => item.filepath === filepath).length}>
223
- {getReportRelativeFilePath(filepath)}
224
- </TextWithCount>
225
- </panda.a>
226
- ))}
227
- </panda.div>
228
- </panda.div>
229
- )
230
- }
231
-
232
- const selectOptionClass = css({
233
- padding: '4px 8px',
234
- rounded: 'md',
235
- '& li': {
236
- cursor: 'pointer',
237
- _hover: { opacity: 0.8 },
238
- },
239
- })
240
-
241
- const ReportItemMatchingFiltersTable = (infos: Infos) => {
242
- const tokenName = infos.params.value
243
- const defaultOption = { label: `matching search filters`, value: 'reportItemList' }
244
- const columns = reportItemColumns.filter((col) => (infos.params as any)[col.accessor] === undefined)
245
-
246
- return (
247
- <>
248
- <Select defaultValue={defaultOption}>
249
- {({ selectedOption }) => {
250
- const value = (selectedOption?.value ?? defaultOption.value) as keyof Omit<Infos, 'params' | 'hasParam'>
251
- // console.log({ value, list: infos[value] })
252
-
253
- return (
254
- <Section
255
- title={
256
- <>
257
- <SelectLabel>By </SelectLabel>
258
- <SelectTrigger asChild>
259
- <button>{selectedOption?.label}</button>
260
- </SelectTrigger>
261
- </>
262
- }
263
- subTitle={
264
- <panda.span fontSize="md" fontWeight="bold" ml="auto">
265
- Found ({infos[value].length}) matches{' '}
266
- </panda.span>
267
- }
268
- bg="card"
269
- >
270
- <DataTable list={infos[value]} columns={columns} />
271
- <>
272
- <Portal>
273
- <SelectPositioner>
274
- <SelectContent className={cx(selectOptionClass, css({ listStyle: 'none' }))}>
275
- <SelectOption
276
- className={selectOptionClass}
277
- value={defaultOption.value}
278
- label={defaultOption.label}
279
- />
280
- {infos.params.value && (
281
- <SelectOption
282
- className={selectOptionClass}
283
- label={`token name (${tokenName})`}
284
- value="byTokenName"
285
- />
286
- )}
287
- {infos.params.propName && (
288
- <SelectOption
289
- className={selectOptionClass}
290
- value="byPropName"
291
- label={`property name (${infos.params.propName})`}
292
- />
293
- )}
294
- {infos.params.category && (
295
- <SelectOption
296
- className={selectOptionClass}
297
- value="byCategory"
298
- label={`category (${infos.params.category})`}
299
- />
300
- )}
301
- {infos.params.from && (
302
- <SelectOption
303
- className={selectOptionClass}
304
- value="byInstanceName"
305
- label={`from (${infos.params.from})`}
306
- />
307
- )}
308
- {infos.params.filepath && (
309
- <SelectOption
310
- className={selectOptionClass}
311
- value="byFilepath"
312
- label={`filepath (${getReportRelativeFilePath(infos.params.filepath)})`}
313
- />
314
- )}
315
- </SelectContent>
316
- </SelectPositioner>
317
- </Portal>
318
- </>
319
- </Section>
320
- )
321
- }}
322
- </Select>
323
- </>
324
- )
325
- }
@@ -1,37 +0,0 @@
1
- import type { PropsWithChildren } from 'react'
2
- import { panda } from '../../styled-system/jsx'
3
- import type { JsxStyleProps } from '../../styled-system/types'
4
- import { tokenDictionary } from '../lib/analysis-data'
5
- import { getReportItemFromTokenName, getUtilityLink } from '../lib/get-report-item'
6
- import { ColorWrapper } from './color-wrapper'
7
-
8
- export const ColorItem = ({
9
- tokenName,
10
- children,
11
- ...props
12
- }: PropsWithChildren<{ tokenName: string } & JsxStyleProps>) => {
13
- const token = tokenDictionary.getByName('colors.' + tokenName)
14
- const value = token?.value ?? tokenName
15
- const reportItem = getReportItemFromTokenName(tokenName)
16
-
17
- if (!reportItem) return null
18
-
19
- return (
20
- <panda.a href={getUtilityLink({ value: reportItem.value })} key={tokenName} {...props}>
21
- <ColorWrapper
22
- w="auto"
23
- minW="80px"
24
- h="40px"
25
- mb="2"
26
- style={{ background: value, border: '1px solid rgba(0,0,0,0.1)' }}
27
- />
28
- {children}
29
-
30
- {tokenName !== value && (
31
- <panda.div opacity={0.7}>
32
- <panda.span>{value}</panda.span>
33
- </panda.div>
34
- )}
35
- </panda.a>
36
- )
37
- }