polen 0.8.2-next.1 → 0.9.0-next.3

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 (76) hide show
  1. package/build/api/vite/logger.d.ts +2 -1
  2. package/build/api/vite/logger.d.ts.map +1 -1
  3. package/build/api/vite/logger.js +23 -19
  4. package/build/api/vite/logger.js.map +1 -1
  5. package/build/api/vite/plugins/core.js +4 -4
  6. package/build/api/vite/plugins/core.js.map +1 -1
  7. package/build/api/vite/plugins/{pages-tree.d.ts → pages.d.ts} +2 -2
  8. package/build/api/vite/plugins/pages.d.ts.map +1 -0
  9. package/build/api/vite/plugins/{pages-tree.js → pages.js} +6 -5
  10. package/build/api/vite/plugins/pages.js.map +1 -0
  11. package/build/api/vite/plugins/serve.d.ts.map +1 -1
  12. package/build/api/vite/plugins/serve.js +40 -7
  13. package/build/api/vite/plugins/serve.js.map +1 -1
  14. package/build/lib/file-router/sidebar/sidebar-tree.d.ts.map +1 -1
  15. package/build/lib/file-router/sidebar/sidebar-tree.js +13 -13
  16. package/build/lib/file-router/sidebar/sidebar-tree.js.map +1 -1
  17. package/build/lib/file-router/sidebar/types.d.ts +2 -2
  18. package/build/lib/file-router/sidebar/types.d.ts.map +1 -1
  19. package/build/lib/kit-temp.d.ts +6 -0
  20. package/build/lib/kit-temp.d.ts.map +1 -1
  21. package/build/lib/kit-temp.js +30 -0
  22. package/build/lib/kit-temp.js.map +1 -1
  23. package/build/template/components/Link.d.ts +7 -1
  24. package/build/template/components/Link.d.ts.map +1 -1
  25. package/build/template/components/Link.jsx +33 -5
  26. package/build/template/components/Link.jsx.map +1 -1
  27. package/build/template/components/Texts/MinorHeading.d.ts +4 -0
  28. package/build/template/components/Texts/MinorHeading.d.ts.map +1 -0
  29. package/build/template/components/Texts/MinorHeading.jsx +11 -0
  30. package/build/template/components/Texts/MinorHeading.jsx.map +1 -0
  31. package/build/template/components/Texts/index.d.ts +2 -0
  32. package/build/template/components/Texts/index.d.ts.map +1 -0
  33. package/build/template/components/Texts/index.js +2 -0
  34. package/build/template/components/Texts/index.js.map +1 -0
  35. package/build/template/components/Texts/texts.d.ts +2 -0
  36. package/build/template/components/Texts/texts.d.ts.map +1 -0
  37. package/build/template/components/Texts/texts.js +2 -0
  38. package/build/template/components/Texts/texts.js.map +1 -0
  39. package/build/template/components/sidebar/Sidebar.d.ts.map +1 -0
  40. package/build/template/components/sidebar/Sidebar.jsx +15 -0
  41. package/build/template/components/sidebar/Sidebar.jsx.map +1 -0
  42. package/build/template/components/sidebar/SidebarItem.d.ts +9 -0
  43. package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -0
  44. package/build/template/components/sidebar/SidebarItem.jsx +94 -0
  45. package/build/template/components/sidebar/SidebarItem.jsx.map +1 -0
  46. package/build/template/components/sidebar/ToggleButton.d.ts +5 -0
  47. package/build/template/components/sidebar/ToggleButton.d.ts.map +1 -0
  48. package/build/template/components/sidebar/ToggleButton.jsx +6 -0
  49. package/build/template/components/sidebar/ToggleButton.jsx.map +1 -0
  50. package/build/template/routes/root.d.ts.map +1 -1
  51. package/build/template/routes/root.jsx +1 -1
  52. package/build/template/routes/root.jsx.map +1 -1
  53. package/package.json +16 -1
  54. package/src/api/vite/logger.ts +26 -21
  55. package/src/api/vite/plugins/core.ts +4 -4
  56. package/src/api/vite/plugins/{pages-tree.ts → pages.ts} +5 -4
  57. package/src/api/vite/plugins/serve.ts +42 -9
  58. package/src/lib/file-router/sidebar/sidebar-tree.test.ts +6 -6
  59. package/src/lib/file-router/sidebar/sidebar-tree.ts +14 -14
  60. package/src/lib/file-router/sidebar/types.ts +2 -2
  61. package/src/lib/kit-temp.ts +36 -0
  62. package/src/template/components/Link.tsx +53 -6
  63. package/src/template/components/Texts/MinorHeading.tsx +18 -0
  64. package/src/template/components/Texts/index.ts +1 -0
  65. package/src/template/components/Texts/texts.ts +1 -0
  66. package/src/template/components/sidebar/Sidebar.tsx +26 -0
  67. package/src/template/components/sidebar/SidebarItem.tsx +156 -0
  68. package/src/template/components/sidebar/ToggleButton.tsx +12 -0
  69. package/src/template/routes/root.tsx +1 -2
  70. package/build/api/vite/plugins/pages-tree.d.ts.map +0 -1
  71. package/build/api/vite/plugins/pages-tree.js.map +0 -1
  72. package/build/template/components/Sidebar.d.ts.map +0 -1
  73. package/build/template/components/Sidebar.jsx +0 -115
  74. package/build/template/components/Sidebar.jsx.map +0 -1
  75. package/src/template/components/Sidebar.tsx +0 -194
  76. /package/build/template/components/{Sidebar.d.ts → sidebar/Sidebar.d.ts} +0 -0
@@ -1,194 +0,0 @@
1
- import type { FileRouter } from '#lib/file-router/index'
2
- import { ChevronDownIcon, ChevronRightIcon } from '@radix-ui/react-icons'
3
- import { Box, Flex, Text } from '@radix-ui/themes'
4
- import { useState } from 'react'
5
- import { Link, useLocation } from 'react-router'
6
-
7
- interface SidebarProps {
8
- items: FileRouter.Sidebar.Item[]
9
- }
10
-
11
- export const Sidebar = ({ items }: SidebarProps) => {
12
- const location = useLocation()
13
-
14
- return (
15
- <Box
16
- data-testid='sidebar'
17
- style={{
18
- width: `240px`,
19
- minWidth: `240px`,
20
- flexShrink: 0,
21
- borderRight: `1px solid var(--gray-3)`,
22
- height: `100%`,
23
- paddingRight: `var(--space-4)`,
24
- }}
25
- >
26
- <style>
27
- {`
28
- /* Using data attributes - more idiomatic for Radix UI */
29
- .sidebar-nav-item:hover:not([data-active]) {
30
- background-color: var(--gray-2) !important;
31
- }
32
- .sidebar-section:hover:not([data-active]):not([data-active-child]) {
33
- background-color: var(--gray-2) !important;
34
- }
35
-
36
- /* Alternative with class names (current approach) */
37
- /*
38
- .sidebar-nav-item:hover:not(.active) {
39
- background-color: var(--gray-2) !important;
40
- }
41
- .sidebar-section:hover:not(.active):not(.has-active-child) {
42
- background-color: var(--gray-2) !important;
43
- }
44
- */
45
- `}
46
- </style>
47
- <Flex direction='column' gap='1'>
48
- {items.map((item) => (
49
- <SidebarItem
50
- key={item.pathExp}
51
- item={item}
52
- currentPathExp={location.pathname}
53
- />
54
- ))}
55
- </Flex>
56
- </Box>
57
- )
58
- }
59
-
60
- interface SidebarItemProps {
61
- item: FileRouter.Sidebar.Item
62
- currentPathExp: string
63
- level?: number
64
- }
65
-
66
- const SidebarItem = ({ item, currentPathExp, level = 0 }: SidebarItemProps) => {
67
- if (item.type === `ItemLink`) {
68
- return <SidebarItemLink nav={item} currentPathExp={currentPathExp} level={level} />
69
- }
70
-
71
- return <SidebarItemSection section={item} currentPathExp={currentPathExp} level={level} />
72
- }
73
-
74
- interface SidebarItemLinkProps {
75
- nav: FileRouter.Sidebar.ItemLink
76
- currentPathExp: string
77
- level: number
78
- }
79
-
80
- const SidebarItemLink = ({ nav, currentPathExp, level }: SidebarItemLinkProps) => {
81
- // Normalize paths for comparison - remove leading slash if present
82
- const normalizedCurrentPath = currentPathExp.startsWith('/') ? currentPathExp.slice(1) : currentPathExp
83
- const isActive = normalizedCurrentPath === nav.pathExp
84
-
85
- return (
86
- <Link
87
- to={`/${nav.pathExp}`}
88
- data-active={isActive || undefined}
89
- className='sidebar-nav-item'
90
- style={{
91
- textDecoration: `none`,
92
- color: isActive ? `var(--accent-11)` : `var(--gray-12)`,
93
- padding: `var(--space-2) var(--space-3)`,
94
- paddingLeft: `calc(var(--space-3) + ${(level * 16).toString()}px)`,
95
- borderRadius: `var(--radius-2)`,
96
- display: `block`,
97
- backgroundColor: isActive ? `var(--accent-3)` : `transparent`,
98
- transition: `background-color 0.2s ease, color 0.2s ease`,
99
- }}
100
- >
101
- <Text size='2' weight={isActive ? `medium` : `regular`}>
102
- {nav.title}
103
- </Text>
104
- </Link>
105
- )
106
- }
107
-
108
- interface SidebarItemSectionProps {
109
- section: FileRouter.Sidebar.ItemSection
110
- currentPathExp: string
111
- level: number
112
- }
113
-
114
- const SidebarItemSection = ({ section, currentPathExp, level }: SidebarItemSectionProps) => {
115
- const [isExpanded, setIsExpanded] = useState(true)
116
- // Normalize paths for comparison - remove leading slash if present
117
- const normalizedCurrentPath = currentPathExp.startsWith('/') ? currentPathExp.slice(1) : currentPathExp
118
- const isDirectlyActive = normalizedCurrentPath === section.pathExp
119
- const hasActiveChild = section.navs.some(nav => normalizedCurrentPath === nav.pathExp)
120
- const isActiveGroup = isDirectlyActive || hasActiveChild
121
-
122
- return (
123
- <>
124
- <Flex
125
- align='center'
126
- data-active={isDirectlyActive || undefined}
127
- data-active-child={hasActiveChild || undefined}
128
- className='sidebar-section'
129
- style={{
130
- padding: `var(--space-2) var(--space-3)`,
131
- paddingLeft: `calc(var(--space-3) + ${(level * 16).toString()}px)`,
132
- borderRadius: `var(--radius-2)`,
133
- backgroundColor: isDirectlyActive ? `var(--accent-3)` : hasActiveChild ? `var(--accent-2)` : `transparent`,
134
- transition: `background-color 0.2s ease`,
135
- }}
136
- >
137
- <Box
138
- onClick={() => {
139
- setIsExpanded(!isExpanded)
140
- }}
141
- style={{
142
- display: `flex`,
143
- alignItems: `center`,
144
- cursor: `pointer`,
145
- padding: `4px`,
146
- marginRight: `4px`,
147
- marginLeft: `-4px`,
148
- }}
149
- >
150
- {isExpanded ? <ChevronDownIcon /> : <ChevronRightIcon />}
151
- </Box>
152
- {section.isNavToo
153
- ? (
154
- <Link
155
- to={`/${section.pathExp}`}
156
- style={{
157
- textDecoration: `none`,
158
- color: isDirectlyActive ? `var(--accent-11)` : `var(--gray-12)`,
159
- flex: 1,
160
- }}
161
- >
162
- <Text size='2' weight={isDirectlyActive ? `bold` : `medium`}>
163
- {section.title}
164
- </Text>
165
- </Link>
166
- )
167
- : (
168
- <Text
169
- size='2'
170
- weight={isDirectlyActive ? `bold` : `medium`}
171
- style={{
172
- flex: 1,
173
- color: isDirectlyActive ? `var(--accent-11)` : `var(--gray-12)`,
174
- }}
175
- >
176
- {section.title}
177
- </Text>
178
- )}
179
- </Flex>
180
- {isExpanded && (
181
- <Flex direction='column' gap='1'>
182
- {section.navs.map((nav) => (
183
- <SidebarItemLink
184
- key={nav.pathExp}
185
- nav={nav}
186
- currentPathExp={currentPathExp}
187
- level={level + 1}
188
- />
189
- ))}
190
- </Flex>
191
- )}
192
- </>
193
- )
194
- }