cronixui 1.0.4 → 1.0.6

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 (32) hide show
  1. package/package.json +9 -2
  2. package/packages/go/cronixui/cronixui.go +379 -0
  3. package/packages/go/cronixui/go.mod +3 -0
  4. package/packages/go/cronixui/tokens.go +129 -0
  5. package/packages/python/cronixui/__init__.py +109 -0
  6. package/packages/python/cronixui/accordion.py +29 -0
  7. package/packages/python/cronixui/command_palette.py +53 -0
  8. package/packages/python/cronixui/core.py +48 -0
  9. package/packages/python/cronixui/dropdown.py +26 -0
  10. package/packages/python/cronixui/modal.py +22 -0
  11. package/packages/python/cronixui/nav.py +31 -0
  12. package/packages/python/cronixui/pagination.py +58 -0
  13. package/packages/python/cronixui/pyproject.toml +11 -0
  14. package/packages/python/cronixui/search.py +50 -0
  15. package/packages/python/cronixui/tabs.py +18 -0
  16. package/packages/python/cronixui/toast.py +73 -0
  17. package/packages/python/cronixui/toggle.py +22 -0
  18. package/packages/python/cronixui/tokens.py +200 -0
  19. package/packages/rust/cronixui/src/accordion.rs +49 -0
  20. package/packages/rust/cronixui/src/command_palette.rs +62 -0
  21. package/packages/rust/cronixui/src/dropdown.rs +31 -0
  22. package/packages/rust/cronixui/src/lib.rs +81 -0
  23. package/packages/rust/cronixui/src/modal.rs +27 -0
  24. package/packages/rust/cronixui/src/pagination.rs +37 -0
  25. package/packages/rust/cronixui/src/search.rs +49 -0
  26. package/packages/rust/cronixui/src/tabs.rs +23 -0
  27. package/packages/rust/cronixui/src/toast.rs +70 -0
  28. package/packages/rust/cronixui/src/toggle.rs +27 -0
  29. package/packages/rust/cronixui/src/tokens.rs +137 -0
  30. package/packages/web/src/index.js +2 -0
  31. package/packages/web/src/index.mjs +2 -0
  32. package/packages/web/src/tokens.ts +120 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cronixui",
3
- "version": "1.0.4",
4
- "description": "CronixUI - A dark-themed UI toolkit with crimson accents and Outfit typography",
3
+ "version": "1.0.6",
4
+ "description": "CronixUI - A dark-themed UI toolkit with crimson accents and Outfit typography. Available for JavaScript, TypeScript, Python, Go, and Rust.",
5
5
  "keywords": [
6
6
  "ui",
7
7
  "css",
@@ -30,6 +30,10 @@
30
30
  "import": "./packages/react/src/index.js",
31
31
  "types": "./packages/react/src/index.d.ts"
32
32
  },
33
+ "./tokens": {
34
+ "import": "./packages/web/src/tokens.ts",
35
+ "types": "./packages/web/src/tokens.ts"
36
+ },
33
37
  "./css": "./packages/web/dist/cronixui.css",
34
38
  "./css/min": "./packages/web/dist/cronixui.min.css",
35
39
  "./js": "./packages/web/dist/cronixui.js",
@@ -40,6 +44,9 @@
40
44
  "packages/web/src/",
41
45
  "packages/react/src/",
42
46
  "packages/win/CronixUI.WinUI/",
47
+ "packages/python/cronixui/",
48
+ "packages/go/cronixui/",
49
+ "packages/rust/cronixui/src/",
43
50
  "README.md"
44
51
  ],
45
52
  "scripts": {
@@ -0,0 +1,379 @@
1
+ package cronixui
2
+
3
+ import "fmt"
4
+
5
+ // Version of CronixUI
6
+ const Version = "1.0.4"
7
+
8
+ // ToastType represents toast notification type
9
+ type ToastType int
10
+
11
+ const (
12
+ ToastTypeSuccess ToastType = iota
13
+ ToastTypeError
14
+ ToastTypeWarning
15
+ ToastTypeInfo
16
+ )
17
+
18
+ // Toast represents a toast notification
19
+ type Toast struct {
20
+ Title string
21
+ Message string
22
+ Type ToastType
23
+ Duration int
24
+ }
25
+
26
+ // ToastShow displays a toast notification
27
+ func ToastShow(message string, opts ...func(*Toast)) *Toast {
28
+ t := &Toast{Message: message, Type: ToastTypeInfo, Duration: 4000}
29
+ for _, opt := range opts {
30
+ opt(t)
31
+ }
32
+ return t
33
+ }
34
+
35
+ // WithTitle sets toast title
36
+ func WithTitle(title string) func(*Toast) {
37
+ return func(t *Toast) { t.Title = title }
38
+ }
39
+
40
+ // WithType sets toast type
41
+ func WithType(toastType ToastType) func(*Toast) {
42
+ return func(t *Toast) { t.Type = toastType }
43
+ }
44
+
45
+ // WithDuration sets toast duration
46
+ func WithDuration(duration int) func(*Toast) {
47
+ return func(t *Toast) { t.Duration = duration }
48
+ }
49
+
50
+ // ToastSuccess shows a success toast
51
+ func ToastSuccess(message string) *Toast {
52
+ return ToastShow(message, WithType(ToastTypeSuccess))
53
+ }
54
+
55
+ // ToastError shows an error toast
56
+ func ToastError(message string) *Toast {
57
+ return ToastShow(message, WithType(ToastTypeError))
58
+ }
59
+
60
+ // ToastWarning shows a warning toast
61
+ func ToastWarning(message string) *Toast {
62
+ return ToastShow(message, WithType(ToastTypeWarning))
63
+ }
64
+
65
+ // ToastInfo shows an info toast
66
+ func ToastInfo(message string) *Toast {
67
+ return ToastShow(message, WithType(ToastTypeInfo))
68
+ }
69
+
70
+ // Toggle represents a toggle switch
71
+ type Toggle struct {
72
+ on bool
73
+ }
74
+
75
+ // NewToggle creates a new toggle
76
+ func NewToggle() *Toggle {
77
+ return &Toggle{}
78
+ }
79
+
80
+ // Toggle flips the toggle state
81
+ func (t *Toggle) Toggle() {
82
+ t.on = !t.on
83
+ }
84
+
85
+ // IsOn returns current toggle state
86
+ func (t *Toggle) IsOn() bool {
87
+ return t.on
88
+ }
89
+
90
+ // SetOn sets the toggle state
91
+ func (t *Toggle) SetOn(value bool) {
92
+ t.on = value
93
+ }
94
+
95
+ // Modal represents a modal dialog
96
+ type Modal struct {
97
+ open bool
98
+ }
99
+
100
+ // NewModal creates a new modal
101
+ func NewModal() *Modal {
102
+ return &Modal{}
103
+ }
104
+
105
+ // Open opens the modal
106
+ func (m *Modal) Open() {
107
+ m.open = true
108
+ }
109
+
110
+ // Close closes the modal
111
+ func (m *Modal) Close() {
112
+ m.open = false
113
+ }
114
+
115
+ // IsOpen returns whether modal is open
116
+ func (m *Modal) IsOpen() bool {
117
+ return m.open
118
+ }
119
+
120
+ // Dropdown represents a dropdown menu
121
+ type Dropdown struct {
122
+ open bool
123
+ }
124
+
125
+ // NewDropdown creates a new dropdown
126
+ func NewDropdown() *Dropdown {
127
+ return &Dropdown{}
128
+ }
129
+
130
+ // Open opens the dropdown
131
+ func (d *Dropdown) Open() {
132
+ d.open = true
133
+ }
134
+
135
+ // Close closes the dropdown
136
+ func (d *Dropdown) Close() {
137
+ d.open = false
138
+ }
139
+
140
+ // Toggle flips dropdown state
141
+ func (d *Dropdown) Toggle() {
142
+ d.open = !d.open
143
+ }
144
+
145
+ // IsOpen returns whether dropdown is open
146
+ func (d *Dropdown) IsOpen() bool {
147
+ return d.open
148
+ }
149
+
150
+ // Tabs represents a tabs component
151
+ type Tabs struct {
152
+ activeIndex int
153
+ }
154
+
155
+ // NewTabs creates new tabs
156
+ func NewTabs() *Tabs {
157
+ return &Tabs{activeIndex: 0}
158
+ }
159
+
160
+ // SetActive sets active tab by index
161
+ func (t *Tabs) SetActive(index int) {
162
+ t.activeIndex = index
163
+ }
164
+
165
+ // ActiveIndex returns current active index
166
+ func (t *Tabs) ActiveIndex() int {
167
+ return t.activeIndex
168
+ }
169
+
170
+ // Accordion represents an accordion component
171
+ type Accordion struct {
172
+ openIndices map[int]bool
173
+ }
174
+
175
+ // NewAccordion creates a new accordion
176
+ func NewAccordion() *Accordion {
177
+ return &Accordion{openIndices: make(map[int]bool)}
178
+ }
179
+
180
+ // Toggle toggles an accordion item
181
+ func (a *Accordion) Toggle(index int) {
182
+ a.openIndices[index] = !a.openIndices[index]
183
+ }
184
+
185
+ // Open opens an accordion item
186
+ func (a *Accordion) Open(index int) {
187
+ a.openIndices[index] = true
188
+ }
189
+
190
+ // Close closes an accordion item
191
+ func (a *Accordion) Close(index int) {
192
+ a.openIndices[index] = false
193
+ }
194
+
195
+ // OpenAll opens all items up to total
196
+ func (a *Accordion) OpenAll(total int) {
197
+ for i := 0; i < total; i++ {
198
+ a.openIndices[i] = true
199
+ }
200
+ }
201
+
202
+ // CloseAll closes all accordion items
203
+ func (a *Accordion) CloseAll() {
204
+ a.openIndices = make(map[int]bool)
205
+ }
206
+
207
+ // IsOpen returns whether item is open
208
+ func (a *Accordion) IsOpen(index int) bool {
209
+ return a.openIndices[index]
210
+ }
211
+
212
+ // Pagination represents a pagination component
213
+ type Pagination struct {
214
+ total int
215
+ current int
216
+ }
217
+
218
+ // NewPagination creates new pagination
219
+ func NewPagination(total, current int) *Pagination {
220
+ if current < 1 {
221
+ current = 1
222
+ }
223
+ if current > total {
224
+ current = total
225
+ }
226
+ return &Pagination{total: total, current: current}
227
+ }
228
+
229
+ // GoTo navigates to a specific page
230
+ func (p *Pagination) GoTo(page int) {
231
+ if page >= 1 && page <= p.total {
232
+ p.current = page
233
+ }
234
+ }
235
+
236
+ // Next goes to next page
237
+ func (p *Pagination) Next() {
238
+ if p.current < p.total {
239
+ p.current++
240
+ }
241
+ }
242
+
243
+ // Prev goes to previous page
244
+ func (p *Pagination) Prev() {
245
+ if p.current > 1 {
246
+ p.current--
247
+ }
248
+ }
249
+
250
+ // Current returns current page
251
+ func (p *Pagination) Current() int {
252
+ return p.current
253
+ }
254
+
255
+ // Total returns total pages
256
+ func (p *Pagination) Total() int {
257
+ return p.total
258
+ }
259
+
260
+ // CommandPaletteItem represents a command palette item
261
+ type CommandPaletteItem struct {
262
+ Title string
263
+ Kbd string
264
+ Action func()
265
+ }
266
+
267
+ // CommandPalette represents a command palette
268
+ type CommandPalette struct {
269
+ open bool
270
+ items []CommandPaletteItem
271
+ }
272
+
273
+ // NewCommandPalette creates a new command palette
274
+ func NewCommandPalette() *CommandPalette {
275
+ return &CommandPalette{items: make([]CommandPaletteItem, 0)}
276
+ }
277
+
278
+ // Open opens command palette
279
+ func (c *CommandPalette) Open() {
280
+ c.open = true
281
+ }
282
+
283
+ // Close closes command palette
284
+ func (c *CommandPalette) Close() {
285
+ c.open = false
286
+ }
287
+
288
+ // Toggle toggles command palette
289
+ func (c *CommandPalette) Toggle() {
290
+ c.open = !c.open
291
+ }
292
+
293
+ // IsOpen returns whether command palette is open
294
+ func (c *CommandPalette) IsOpen() bool {
295
+ return c.open
296
+ }
297
+
298
+ // SetItems sets command items
299
+ func (c *CommandPalette) SetItems(items []CommandPaletteItem) {
300
+ c.items = items
301
+ }
302
+
303
+ // Items returns all items
304
+ func (c *CommandPalette) Items() []CommandPaletteItem {
305
+ return c.items
306
+ }
307
+
308
+ // Execute executes item by index
309
+ func (c *CommandPalette) Execute(index int) {
310
+ if index >= 0 && index < len(c.items) && c.items[index].Action != nil {
311
+ c.items[index].Action()
312
+ c.Close()
313
+ }
314
+ }
315
+
316
+ // SearchItem represents a search result item
317
+ type SearchItem struct {
318
+ Title string
319
+ Subtitle string
320
+ Action func()
321
+ }
322
+
323
+ // Search represents a search component
324
+ type Search struct {
325
+ open bool
326
+ items []SearchItem
327
+ }
328
+
329
+ // NewSearch creates a new search
330
+ func NewSearch() *Search {
331
+ return &Search{items: make([]SearchItem, 0)}
332
+ }
333
+
334
+ // SetItems sets searchable items
335
+ func (s *Search) SetItems(items []SearchItem) {
336
+ s.items = items
337
+ }
338
+
339
+ // Filter filters items by query
340
+ func (s *Search) Filter(query string) []SearchItem {
341
+ var results []SearchItem
342
+ for _, item := range s.items {
343
+ results = append(results, item)
344
+ }
345
+ return results
346
+ }
347
+
348
+ // Open opens search results
349
+ func (s *Search) Open() {
350
+ s.open = true
351
+ }
352
+
353
+ // Close closes search results
354
+ func (s *Search) Close() {
355
+ s.open = false
356
+ }
357
+
358
+ // IsOpen returns whether search is open
359
+ func (s *Search) IsOpen() bool {
360
+ return s.open
361
+ }
362
+
363
+ // Items returns all items
364
+ func (s *Search) Items() []SearchItem {
365
+ return s.items
366
+ }
367
+
368
+ // Select selects and executes item by index
369
+ func (s *Search) Select(index int) {
370
+ if index >= 0 && index < len(s.items) && s.items[index].Action != nil {
371
+ s.items[index].Action()
372
+ s.Close()
373
+ }
374
+ }
375
+
376
+ // Init initializes all CronixUI components
377
+ func Init() {
378
+ fmt.Println("CronixUI", Version, "initialized")
379
+ }
@@ -0,0 +1,3 @@
1
+ module github.com/CazyUndee/CronixUI/packages/go/cronixui
2
+
3
+ go 1.21
@@ -0,0 +1,129 @@
1
+ package cronixui
2
+
3
+ // Color represents a color token
4
+ type Color struct {
5
+ Hex string
6
+ R int
7
+ G int
8
+ B int
9
+ }
10
+
11
+ // Background colors
12
+ var (
13
+ BG = Color{Hex: "#0a0a0a", R: 10, G: 10, B: 10}
14
+ Surface = Color{Hex: "#111111", R: 17, G: 17, B: 17}
15
+ Surface2 = Color{Hex: "#1a1a1a", R: 26, G: 26, B: 26}
16
+ Surface3 = Color{Hex: "#222222", R: 34, G: 34, B: 34}
17
+ Surface4 = Color{Hex: "#2a2a2a", R: 42, G: 42, B: 42}
18
+ )
19
+
20
+ // Text colors
21
+ var (
22
+ Text = Color{Hex: "#f0ede8", R: 240, G: 237, B: 232}
23
+ TextMuted = "rgba(240, 237, 232, 0.5)"
24
+ TextDim = "rgba(240, 237, 232, 0.25)"
25
+ )
26
+
27
+ // Accent colors (Crimson)
28
+ var (
29
+ Accent = Color{Hex: "#6b2323", R: 107, G: 35, B: 35}
30
+ AccentHover = Color{Hex: "#7d2a2a", R: 125, G: 42, B: 42}
31
+ AccentLight = Color{Hex: "#8a3535", R: 138, G: 53, B: 53}
32
+ AccentGlow = "rgba(107, 35, 35, 0.3)"
33
+ AccentText = Color{Hex: "#c97a7a", R: 201, G: 122, B: 122}
34
+ )
35
+
36
+ // Semantic colors
37
+ var (
38
+ Success = Color{Hex: "#1e5028", R: 30, G: 80, B: 40}
39
+ SuccessBorder = "rgba(60, 140, 70, 0.4)"
40
+ SuccessText = Color{Hex: "#6bc47a", R: 107, G: 196, B: 122}
41
+
42
+ Warning = Color{Hex: "#503c14", R: 80, G: 60, B: 20}
43
+ WarningBorder = "rgba(150, 110, 30, 0.4)"
44
+ WarningText = Color{Hex: "#c4a43a", R: 196, G: 164, B: 58}
45
+
46
+ Error_ = Color{Hex: "#501414", R: 80, G: 20, B: 20}
47
+ ErrorBorder = "rgba(180, 60, 60, 0.4)"
48
+ ErrorText = Color{Hex: "#c46b6b", R: 196, G: 107, B: 107}
49
+
50
+ Info = Color{Hex: "#143550", R: 20, G: 53, B: 80}
51
+ InfoBorder = "rgba(60, 140, 200, 0.4)"
52
+ InfoText = Color{Hex: "#6ba8c4", R: 107, G: 168, B: 196}
53
+ )
54
+
55
+ // Border colors
56
+ var (
57
+ Border = "rgba(255, 255, 255, 0.08)"
58
+ BorderHover = "rgba(255, 255, 255, 0.15)"
59
+ BorderFocus = "rgba(255, 255, 255, 0.25)"
60
+ )
61
+
62
+ // Typography tokens
63
+ var (
64
+ FontFamily = "'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
65
+ FontMono = "'JetBrains Mono', 'Fira Code', 'Consolas', monospace"
66
+ FontSizeXs = 11
67
+ FontSizeSm = 12
68
+ FontSizeBase = 13
69
+ FontSizeMd = 14
70
+ FontSizeLg = 16
71
+ FontSizeXl = 20
72
+ FontSize2xl = 28
73
+ FontSize3xl = 36
74
+ )
75
+
76
+ // Spacing tokens
77
+ var (
78
+ Space1 = 4
79
+ Space2 = 8
80
+ Space3 = 12
81
+ Space4 = 16
82
+ Space5 = 20
83
+ Space6 = 24
84
+ Space8 = 32
85
+ Space10 = 40
86
+ Space12 = 48
87
+ )
88
+
89
+ // Border radius tokens
90
+ var (
91
+ RadiusSm = 6
92
+ Radius = 10
93
+ RadiusLg = 14
94
+ RadiusXl = 20
95
+ RadiusFull = 9999
96
+ )
97
+
98
+ // Shadow tokens
99
+ var (
100
+ ShadowSm = "0 1px 2px rgba(0, 0, 0, 0.3)"
101
+ Shadow = "0 4px 12px rgba(0, 0, 0, 0.4)"
102
+ ShadowLg = "0 8px 24px rgba(0, 0, 0, 0.5)"
103
+ ShadowGlow = "0 0 20px rgba(107, 35, 35, 0.3)"
104
+ )
105
+
106
+ // Transition tokens
107
+ var (
108
+ TransitionFast = "0.1s ease"
109
+ TransitionDefault = "0.15s ease"
110
+ TransitionSlow = "0.25s ease"
111
+ )
112
+
113
+ // Z-index tokens
114
+ var (
115
+ ZIndexDropdown = 100
116
+ ZIndexSticky = 200
117
+ ZIndexFixed = 300
118
+ ZIndexModalBackdrop = 400
119
+ ZIndexModal = 500
120
+ ZIndexPopover = 600
121
+ ZIndexTooltip = 700
122
+ ZIndexToast = 800
123
+ )
124
+
125
+ // Layout tokens
126
+ var (
127
+ ContainerMax = 1200
128
+ SidebarWidth = 260
129
+ )
@@ -0,0 +1,109 @@
1
+ """
2
+ CronixUI - A dark-themed UI toolkit with crimson accents and Outfit typography
3
+ """
4
+
5
+ from .toast import Toast
6
+ from .toggle import Toggle
7
+ from .modal import Modal
8
+ from .dropdown import Dropdown
9
+ from .tabs import Tabs
10
+ from .accordion import Accordion
11
+ from .pagination import Pagination
12
+ from .command_palette import CommandPalette, CommandPaletteItem
13
+ from .search import Search, SearchItem
14
+ from .nav import Nav
15
+ from .core import init, query, query_all, create_el
16
+ from .tokens import (
17
+ BG,
18
+ SURFACE,
19
+ SURFACE_2,
20
+ SURFACE_3,
21
+ SURFACE_4,
22
+ TEXT,
23
+ TEXT_MUTED,
24
+ TEXT_DIM,
25
+ ACCENT,
26
+ ACCENT_HOVER,
27
+ ACCENT_LIGHT,
28
+ ACCENT_GLOW,
29
+ ACCENT_TEXT,
30
+ SUCCESS,
31
+ SUCCESS_BORDER,
32
+ SUCCESS_TEXT,
33
+ WARNING,
34
+ WARNING_BORDER,
35
+ WARNING_TEXT,
36
+ ERROR,
37
+ ERROR_BORDER,
38
+ ERROR_TEXT,
39
+ INFO,
40
+ INFO_BORDER,
41
+ INFO_TEXT,
42
+ BORDER,
43
+ BORDER_HOVER,
44
+ BORDER_FOCUS,
45
+ typography,
46
+ spacing,
47
+ radius,
48
+ shadow,
49
+ transition,
50
+ z_index,
51
+ layout,
52
+ )
53
+
54
+ __version__ = "1.0.5"
55
+ __all__ = [
56
+ "Toast",
57
+ "Toggle",
58
+ "Modal",
59
+ "Dropdown",
60
+ "Tabs",
61
+ "Accordion",
62
+ "Pagination",
63
+ "CommandPalette",
64
+ "CommandPaletteItem",
65
+ "Search",
66
+ "SearchItem",
67
+ "Nav",
68
+ "init",
69
+ "query",
70
+ "query_all",
71
+ "create_el",
72
+ # Colors
73
+ "BG",
74
+ "SURFACE",
75
+ "SURFACE_2",
76
+ "SURFACE_3",
77
+ "SURFACE_4",
78
+ "TEXT",
79
+ "TEXT_MUTED",
80
+ "TEXT_DIM",
81
+ "ACCENT",
82
+ "ACCENT_HOVER",
83
+ "ACCENT_LIGHT",
84
+ "ACCENT_GLOW",
85
+ "ACCENT_TEXT",
86
+ "SUCCESS",
87
+ "SUCCESS_BORDER",
88
+ "SUCCESS_TEXT",
89
+ "WARNING",
90
+ "WARNING_BORDER",
91
+ "WARNING_TEXT",
92
+ "ERROR",
93
+ "ERROR_BORDER",
94
+ "ERROR_TEXT",
95
+ "INFO",
96
+ "INFO_BORDER",
97
+ "INFO_TEXT",
98
+ "BORDER",
99
+ "BORDER_HOVER",
100
+ "BORDER_FOCUS",
101
+ # Token objects
102
+ "typography",
103
+ "spacing",
104
+ "radius",
105
+ "shadow",
106
+ "transition",
107
+ "z_index",
108
+ "layout",
109
+ ]
@@ -0,0 +1,29 @@
1
+ """Accordion component."""
2
+
3
+
4
+ class Accordion:
5
+ """Accordion component."""
6
+
7
+ def __init__(self, element=None):
8
+ """Initialize accordion on element."""
9
+ self._element = element
10
+ self._open_indices: list = []
11
+
12
+ def toggle(self, index: int) -> None:
13
+ """Toggle accordion item by index."""
14
+ if index in self._open_indices:
15
+ self._open_indices.remove(index)
16
+ else:
17
+ self._open_indices.append(index)
18
+
19
+ def open_all(self, total: int) -> None:
20
+ """Open all accordion items."""
21
+ self._open_indices = list(range(total))
22
+
23
+ def close_all(self) -> None:
24
+ """Close all accordion items."""
25
+ self._open_indices.clear()
26
+
27
+ def is_open(self, index: int) -> bool:
28
+ """Check if item is open."""
29
+ return index in self._open_indices