@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.
- package/README.md +442 -572
- package/accordion.rip +113 -0
- package/alert-dialog.rip +96 -0
- package/autocomplete.rip +141 -0
- package/avatar.rip +37 -0
- package/badge.rip +15 -0
- package/breadcrumb.rip +46 -0
- package/button-group.rip +26 -0
- package/button.rip +23 -0
- package/card.rip +25 -0
- package/carousel.rip +110 -0
- package/checkbox-group.rip +65 -0
- package/checkbox.rip +33 -0
- package/collapsible.rip +50 -0
- package/combobox.rip +155 -0
- package/context-menu.rip +105 -0
- package/date-picker.rip +214 -0
- package/dialog.rip +107 -0
- package/drawer.rip +79 -0
- package/editable-value.rip +80 -0
- package/field.rip +53 -0
- package/fieldset.rip +22 -0
- package/form.rip +39 -0
- package/grid.rip +901 -0
- package/index.rip +16 -0
- package/input-group.rip +28 -0
- package/input.rip +36 -0
- package/label.rip +16 -0
- package/menu.rip +162 -0
- package/menubar.rip +155 -0
- package/meter.rip +36 -0
- package/multi-select.rip +158 -0
- package/native-select.rip +32 -0
- package/nav-menu.rip +129 -0
- package/number-field.rip +162 -0
- package/otp-field.rip +89 -0
- package/package.json +18 -27
- package/pagination.rip +123 -0
- package/popover.rip +143 -0
- package/preview-card.rip +73 -0
- package/progress.rip +25 -0
- package/radio-group.rip +67 -0
- package/resizable.rip +123 -0
- package/scroll-area.rip +145 -0
- package/select.rip +184 -0
- package/separator.rip +17 -0
- package/skeleton.rip +22 -0
- package/slider.rip +165 -0
- package/spinner.rip +17 -0
- package/table.rip +27 -0
- package/tabs.rip +124 -0
- package/textarea.rip +48 -0
- package/toast.rip +87 -0
- package/toggle-group.rip +78 -0
- package/toggle.rip +24 -0
- package/toolbar.rip +46 -0
- package/tooltip.rip +115 -0
- package/dist/rip-ui.min.js +0 -522
- package/dist/rip-ui.min.js.br +0 -0
- package/serve.rip +0 -92
- package/ui.rip +0 -964
package/dist/rip-ui.min.js.br
DELETED
|
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!()
|