@rip-lang/ui 0.3.20 → 0.3.21

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 (61) hide show
  1. package/README.md +442 -572
  2. package/accordion.rip +113 -0
  3. package/alert-dialog.rip +96 -0
  4. package/autocomplete.rip +141 -0
  5. package/avatar.rip +37 -0
  6. package/badge.rip +15 -0
  7. package/breadcrumb.rip +46 -0
  8. package/button-group.rip +26 -0
  9. package/button.rip +23 -0
  10. package/card.rip +25 -0
  11. package/carousel.rip +110 -0
  12. package/checkbox-group.rip +65 -0
  13. package/checkbox.rip +33 -0
  14. package/collapsible.rip +50 -0
  15. package/combobox.rip +155 -0
  16. package/context-menu.rip +105 -0
  17. package/date-picker.rip +214 -0
  18. package/dialog.rip +107 -0
  19. package/drawer.rip +79 -0
  20. package/editable-value.rip +80 -0
  21. package/field.rip +53 -0
  22. package/fieldset.rip +22 -0
  23. package/form.rip +39 -0
  24. package/grid.rip +901 -0
  25. package/index.rip +16 -0
  26. package/input-group.rip +28 -0
  27. package/input.rip +36 -0
  28. package/label.rip +16 -0
  29. package/menu.rip +162 -0
  30. package/menubar.rip +155 -0
  31. package/meter.rip +36 -0
  32. package/multi-select.rip +158 -0
  33. package/native-select.rip +32 -0
  34. package/nav-menu.rip +129 -0
  35. package/number-field.rip +162 -0
  36. package/otp-field.rip +89 -0
  37. package/package.json +18 -27
  38. package/pagination.rip +123 -0
  39. package/popover.rip +143 -0
  40. package/preview-card.rip +73 -0
  41. package/progress.rip +25 -0
  42. package/radio-group.rip +67 -0
  43. package/resizable.rip +123 -0
  44. package/scroll-area.rip +145 -0
  45. package/select.rip +184 -0
  46. package/separator.rip +17 -0
  47. package/skeleton.rip +22 -0
  48. package/slider.rip +165 -0
  49. package/spinner.rip +17 -0
  50. package/table.rip +27 -0
  51. package/tabs.rip +124 -0
  52. package/textarea.rip +48 -0
  53. package/toast.rip +87 -0
  54. package/toggle-group.rip +78 -0
  55. package/toggle.rip +24 -0
  56. package/toolbar.rip +46 -0
  57. package/tooltip.rip +115 -0
  58. package/dist/rip-ui.min.js +0 -522
  59. package/dist/rip-ui.min.js.br +0 -0
  60. package/serve.rip +0 -92
  61. package/ui.rip +0 -964
Binary file
package/serve.rip DELETED
@@ -1,92 +0,0 @@
1
- # ==============================================================================
2
- # @rip-lang/ui/serve — Rip UI Server Middleware
3
- # ==============================================================================
4
- #
5
- # Serves the Rip UI runtime, auto-generated app bundles, and component files.
6
- # Hot-reload SSE is handled by rip-server; this middleware registers watch dirs.
7
- #
8
- # Usage:
9
- # import { ripUI } from '@rip-lang/ui/serve'
10
- # use ripUI dir: dir, components: 'routes', includes: ['ui'], watch: true, title: 'My App'
11
- #
12
- # Options:
13
- # app: string — URL mount point (default: '')
14
- # dir: string — app directory on disk (default: '.')
15
- # components: string — directory for page components, relative to dir (default: 'components')
16
- # includes: array — directories for shared components, relative to dir (default: [])
17
- # watch: boolean — enable hot-reload (registers watch dirs with rip-server)
18
- # state: object — initial app state passed via bundle
19
- # title: string — document title
20
- #
21
- # ==============================================================================
22
-
23
- import { get } from '@rip-lang/api'
24
-
25
- export ripUI = (opts = {}) ->
26
- prefix = opts.app or ''
27
- appDir = opts.dir or '.'
28
- componentsDir = "#{appDir}/#{opts.components or 'components'}"
29
- includeDirs = (opts.includes or []).map (d) -> "#{appDir}/#{d}"
30
- enableWatch = opts.watch or false
31
- appState = opts.state or null
32
- appTitle = opts.title or null
33
- uiDir = import.meta.dir
34
-
35
- # Resolve rip-ui.min.js (compiler + UI framework bundled)
36
- bundlePath = "#{uiDir}/dist/rip-ui.min.js"
37
-
38
- # ----------------------------------------------------------------------------
39
- # Route: /rip/* — framework files, registered once
40
- # ----------------------------------------------------------------------------
41
-
42
- unless ripUI._registered
43
- get "/rip/rip-ui.min.js", (c) -> c.send bundlePath, 'application/javascript'
44
- ripUI._registered = true
45
-
46
- # ----------------------------------------------------------------------------
47
- # Route: {prefix}/components/* — individual .rip component files
48
- # Route: {prefix}/bundle — app bundle (components + data as JSON)
49
- # ----------------------------------------------------------------------------
50
-
51
- get "#{prefix}/components/*", (c) ->
52
- name = c.req.path.slice("#{prefix}/components/".length)
53
- c.send "#{componentsDir}/#{name}", 'text/plain; charset=UTF-8'
54
-
55
- get "#{prefix}/bundle", (c) ->
56
- glob = new Bun.Glob("**/*.rip")
57
- components = {}
58
- paths = Array.from(glob.scanSync(componentsDir))
59
- for path in paths
60
- components["components/#{path}"] = Bun.file("#{componentsDir}/#{path}").text!
61
-
62
- for dir in includeDirs
63
- incPaths = Array.from(glob.scanSync(dir))
64
- for path in incPaths
65
- key = "components/_lib/#{path}"
66
- components[key] = Bun.file("#{dir}/#{path}").text! unless components[key]
67
-
68
- data = {}
69
- data.title = appTitle if appTitle
70
- data.watch = enableWatch
71
- if appState
72
- data[k] = v for k, v of appState
73
-
74
- json = JSON.stringify({ components, data })
75
- etag = "W/\"#{Bun.hash(json).toString(36)}\""
76
- if c.req.header('if-none-match') is etag
77
- return new Response(null, { status: 304, headers: { 'ETag': etag } })
78
- new Response json, headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'ETag': etag }
79
-
80
- # ----------------------------------------------------------------------------
81
- # Register watch directories with rip-server via control socket
82
- # ----------------------------------------------------------------------------
83
-
84
- if enableWatch and process.env.SOCKET_PREFIX
85
- ctl = "/tmp/#{process.env.SOCKET_PREFIX}.ctl.sock"
86
- dirs = [componentsDir, ...includeDirs]
87
- body = JSON.stringify({ op: 'watch', prefix, dirs })
88
- fetch('http://localhost/watch', { method: 'POST', body, headers: { 'content-type': 'application/json' }, unix: ctl }).catch (e) ->
89
- console.warn "rip-ui: watch registration failed: #{e.message}"
90
-
91
- # Return pass-through middleware
92
- (c, next) -> next!()