rip-lang 3.13.119 → 3.13.121

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 (71) hide show
  1. package/README.md +11 -2
  2. package/docs/RIP-LANG.md +4 -0
  3. package/docs/dist/rip.js +257 -27
  4. package/docs/dist/rip.min.js +183 -183
  5. package/docs/dist/rip.min.js.br +0 -0
  6. package/docs/ui/accordion.rip +103 -0
  7. package/docs/ui/alert-dialog.rip +53 -0
  8. package/docs/ui/autocomplete.rip +115 -0
  9. package/docs/ui/avatar.rip +37 -0
  10. package/docs/ui/badge.rip +15 -0
  11. package/docs/ui/breadcrumb.rip +47 -0
  12. package/docs/ui/button-group.rip +26 -0
  13. package/docs/ui/button.rip +23 -0
  14. package/docs/ui/card.rip +25 -0
  15. package/docs/ui/carousel.rip +110 -0
  16. package/docs/ui/checkbox-group.rip +61 -0
  17. package/docs/ui/checkbox.rip +33 -0
  18. package/docs/ui/collapsible.rip +50 -0
  19. package/docs/ui/combobox.rip +130 -0
  20. package/docs/ui/context-menu.rip +88 -0
  21. package/docs/ui/date-picker.rip +206 -0
  22. package/docs/ui/dialog.rip +60 -0
  23. package/docs/ui/drawer.rip +58 -0
  24. package/docs/ui/editable-value.rip +82 -0
  25. package/docs/ui/field.rip +53 -0
  26. package/docs/ui/fieldset.rip +22 -0
  27. package/docs/ui/form.rip +39 -0
  28. package/docs/ui/grid.rip +901 -0
  29. package/docs/ui/hljs-rip.js +209 -0
  30. package/docs/ui/index.css +1797 -0
  31. package/docs/ui/index.html +2385 -0
  32. package/docs/ui/input-group.rip +28 -0
  33. package/docs/ui/input.rip +36 -0
  34. package/docs/ui/label.rip +16 -0
  35. package/docs/ui/menu.rip +134 -0
  36. package/docs/ui/menubar.rip +151 -0
  37. package/docs/ui/meter.rip +36 -0
  38. package/docs/ui/multi-select.rip +203 -0
  39. package/docs/ui/native-select.rip +33 -0
  40. package/docs/ui/nav-menu.rip +126 -0
  41. package/docs/ui/number-field.rip +162 -0
  42. package/docs/ui/otp-field.rip +89 -0
  43. package/docs/ui/pagination.rip +123 -0
  44. package/docs/ui/popover.rip +93 -0
  45. package/docs/ui/preview-card.rip +75 -0
  46. package/docs/ui/progress.rip +25 -0
  47. package/docs/ui/radio-group.rip +57 -0
  48. package/docs/ui/resizable.rip +123 -0
  49. package/docs/ui/scroll-area.rip +145 -0
  50. package/docs/ui/select.rip +151 -0
  51. package/docs/ui/separator.rip +17 -0
  52. package/docs/ui/skeleton.rip +22 -0
  53. package/docs/ui/slider.rip +165 -0
  54. package/docs/ui/spinner.rip +17 -0
  55. package/docs/ui/table.rip +27 -0
  56. package/docs/ui/tabs.rip +113 -0
  57. package/docs/ui/textarea.rip +48 -0
  58. package/docs/ui/toast.rip +87 -0
  59. package/docs/ui/toggle-group.rip +71 -0
  60. package/docs/ui/toggle.rip +24 -0
  61. package/docs/ui/toolbar.rip +38 -0
  62. package/docs/ui/tooltip.rip +85 -0
  63. package/package.json +1 -1
  64. package/src/compiler.js +24 -12
  65. package/src/components.js +43 -6
  66. package/src/grammar/grammar.rip +2 -2
  67. package/src/lexer.js +26 -0
  68. package/src/parser.js +2 -2
  69. package/src/sourcemap-utils.js +91 -0
  70. package/src/typecheck.js +33 -8
  71. package/src/ui.rip +118 -2
@@ -0,0 +1,53 @@
1
+ # Field — accessible headless form field wrapper
2
+ #
3
+ # Associates a label, description, and error message with a form control.
4
+ # Generates linked IDs for aria-labelledby/describedby/errormessage.
5
+ # Ships zero CSS.
6
+ #
7
+ # Usage:
8
+ # Field label: "Email", error: errors.email
9
+ # Input value <=> email, type: "email"
10
+
11
+ export Field = component
12
+ @label:: string := ""
13
+ @description:: string := ""
14
+ @error:: string := ""
15
+ @disabled:: boolean := false
16
+ @required:: boolean := false
17
+
18
+ _id =! "fld-#{Math.random().toString(36).slice(2, 8)}"
19
+
20
+ mounted: ->
21
+ ctrl = @_root?.querySelector('input, select, textarea, button, [role]')
22
+ if ctrl
23
+ ctrl.setAttribute 'aria-labelledby', "#{_id}-label" if @label
24
+ ctrl.setAttribute 'aria-describedby', "#{_id}-desc" if @description
25
+ ctrl.setAttribute 'aria-errormessage', "#{_id}-err" if @error
26
+ ctrl.setAttribute 'aria-invalid', true if @error
27
+ ctrl.setAttribute 'aria-required', true if @required
28
+
29
+ ~>
30
+ ctrl = @_root?.querySelector('input, select, textarea, button, [role]')
31
+ return unless ctrl
32
+ if @error
33
+ ctrl.setAttribute 'aria-invalid', true
34
+ ctrl.setAttribute 'aria-errormessage', "#{_id}-err"
35
+ else
36
+ ctrl.removeAttribute 'aria-invalid'
37
+ ctrl.removeAttribute 'aria-errormessage'
38
+
39
+ render
40
+ div $disabled: @disabled?!, $invalid: @error?!
41
+ if @label
42
+ label id: "#{_id}-label", $label: true
43
+ @label
44
+ if @required
45
+ span $required: true, aria-hidden: "true"
46
+ " *"
47
+ slot
48
+ if @description and not @error
49
+ div id: "#{_id}-desc", $description: true
50
+ @description
51
+ if @error
52
+ div id: "#{_id}-err", role: "alert", $error: true
53
+ @error
@@ -0,0 +1,22 @@
1
+ # Fieldset — accessible headless fieldset with legend
2
+ #
3
+ # Groups related fields with an optional legend. Disables all children
4
+ # when @disabled is set. Ships zero CSS.
5
+ #
6
+ # Usage:
7
+ # Fieldset legend: "Shipping Address"
8
+ # Field label: "Street"
9
+ # Input value <=> street
10
+ # Field label: "City"
11
+ # Input value <=> city
12
+
13
+ export Fieldset = component
14
+ @legend:: string := ""
15
+ @disabled:: boolean := false
16
+
17
+ render
18
+ fieldset disabled: @disabled, $disabled: @disabled?!
19
+ if @legend
20
+ legend $legend: true
21
+ @legend
22
+ slot
@@ -0,0 +1,39 @@
1
+ # Form — accessible headless form with validation and submission
2
+ #
3
+ # Wraps native <form> with submit handling, validation state, and
4
+ # loading indicator support. Prevents default submission and emits
5
+ # a 'submit' event. Ships zero CSS.
6
+ #
7
+ # Usage:
8
+ # Form @submit: handleSubmit
9
+ # Field label: "Name"
10
+ # Input value <=> name
11
+ # Button
12
+ # "Submit"
13
+
14
+ export Form = component
15
+ @disabled:: boolean := false
16
+
17
+ submitting := false
18
+ submitted := false
19
+ errors := {}
20
+
21
+ _onSubmit: (e) ->
22
+ e.preventDefault()
23
+ return if @disabled or submitting
24
+ submitting = true
25
+ submitted = true
26
+ @emit 'submit', { form: e.target }
27
+
28
+ setErrors: (errs) ->
29
+ errors = errs or {}
30
+
31
+ setSubmitting: (val) ->
32
+ submitting = val
33
+
34
+ render
35
+ form @submit: @_onSubmit, novalidate: true
36
+ $disabled: @disabled?!
37
+ $submitting: submitting?!
38
+ $submitted: submitted?!
39
+ slot