rook-cli 1.3.2 → 1.3.4

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 (89) hide show
  1. package/package.json +3 -2
  2. package/rook-framework/PRD-INSTALL-COMMAND.md +379 -0
  3. package/rook-framework/PRD.md +1214 -0
  4. package/rook-framework/README.md +143 -0
  5. package/rook-framework/assets/rk-accordion.js +99 -0
  6. package/rook-framework/assets/rk-alert-dialog.js +132 -0
  7. package/rook-framework/assets/rk-bottom-app-bar.js +88 -0
  8. package/rook-framework/assets/rk-carousel.js +145 -0
  9. package/rook-framework/assets/rk-collapsible.js +151 -0
  10. package/rook-framework/assets/rk-dialog.js +161 -0
  11. package/rook-framework/assets/rk-drawer.js +214 -0
  12. package/rook-framework/assets/rk-framework-core.css +2554 -0
  13. package/rook-framework/assets/rk-framework-tokens.css +101 -0
  14. package/rook-framework/assets/rk-modal.js +91 -0
  15. package/rook-framework/assets/rk-popover.js +264 -0
  16. package/rook-framework/assets/rk-progress.js +81 -0
  17. package/rook-framework/assets/rk-quantity.js +91 -0
  18. package/rook-framework/assets/rk-scroll-area.js +286 -0
  19. package/rook-framework/assets/rk-sheet.js +157 -0
  20. package/rook-framework/assets/rk-tabs.js +179 -0
  21. package/rook-framework/assets/rk-toggle.js +153 -0
  22. package/rook-framework/blocks/rk-accordion.liquid +97 -0
  23. package/rook-framework/blocks/rk-badge.liquid +103 -0
  24. package/rook-framework/blocks/rk-button.liquid +166 -0
  25. package/rook-framework/blocks/rk-divider.liquid +100 -0
  26. package/rook-framework/blocks/rk-form-field.liquid +120 -0
  27. package/rook-framework/blocks/rk-icon.liquid +134 -0
  28. package/rook-framework/blocks/rk-image.liquid +198 -0
  29. package/rook-framework/blocks/rk-installments.liquid +99 -0
  30. package/rook-framework/blocks/rk-pix-discount.liquid +99 -0
  31. package/rook-framework/blocks/rk-price.liquid +128 -0
  32. package/rook-framework/blocks/rk-quantity.liquid +108 -0
  33. package/rook-framework/blocks/rk-quick-add.liquid +137 -0
  34. package/rook-framework/blocks/rk-skeleton.liquid +104 -0
  35. package/rook-framework/blocks/rk-typography.liquid +183 -0
  36. package/rook-framework/config/rk-settings_schema.json +259 -0
  37. package/rook-framework/snippets/rk-accordion.liquid +31 -0
  38. package/rook-framework/snippets/rk-alert-dialog.liquid +83 -0
  39. package/rook-framework/snippets/rk-aspect-ratio.liquid +23 -0
  40. package/rook-framework/snippets/rk-badge.liquid +17 -0
  41. package/rook-framework/snippets/rk-bottom-app-bar.liquid +51 -0
  42. package/rook-framework/snippets/rk-button.liquid +49 -0
  43. package/rook-framework/snippets/rk-card.liquid +64 -0
  44. package/rook-framework/snippets/rk-carousel.liquid +74 -0
  45. package/rook-framework/snippets/rk-checkbox.liquid +34 -0
  46. package/rook-framework/snippets/rk-collapsible.liquid +52 -0
  47. package/rook-framework/snippets/rk-dialog.liquid +85 -0
  48. package/rook-framework/snippets/rk-divider.liquid +25 -0
  49. package/rook-framework/snippets/rk-drawer.liquid +81 -0
  50. package/rook-framework/snippets/rk-external-assets copy.liquid +33 -0
  51. package/rook-framework/snippets/rk-external-assets.liquid +68 -0
  52. package/rook-framework/snippets/rk-form-field.liquid +83 -0
  53. package/rook-framework/snippets/rk-gap-style.liquid +32 -0
  54. package/rook-framework/snippets/rk-icon.liquid +28 -0
  55. package/rook-framework/snippets/rk-image.liquid +60 -0
  56. package/rook-framework/snippets/rk-input.liquid +35 -0
  57. package/rook-framework/snippets/rk-installments.liquid +54 -0
  58. package/rook-framework/snippets/rk-item.liquid +69 -0
  59. package/rook-framework/snippets/rk-layout-style.liquid +37 -0
  60. package/rook-framework/snippets/rk-modal.liquid +31 -0
  61. package/rook-framework/snippets/rk-pix-discount.liquid +34 -0
  62. package/rook-framework/snippets/rk-popover.liquid +77 -0
  63. package/rook-framework/snippets/rk-price.liquid +48 -0
  64. package/rook-framework/snippets/rk-progress.liquid +38 -0
  65. package/rook-framework/snippets/rk-quantity.liquid +56 -0
  66. package/rook-framework/snippets/rk-quick-add.liquid +67 -0
  67. package/rook-framework/snippets/rk-scripts.liquid +17 -0
  68. package/rook-framework/snippets/rk-scroll-area.liquid +60 -0
  69. package/rook-framework/snippets/rk-sheet.liquid +86 -0
  70. package/rook-framework/snippets/rk-size-style.liquid +48 -0
  71. package/rook-framework/snippets/rk-skeleton.liquid +25 -0
  72. package/rook-framework/snippets/rk-spacing-padding.liquid +18 -0
  73. package/rook-framework/snippets/rk-spacing-style.liquid +54 -0
  74. package/rook-framework/snippets/rk-spinner.liquid +43 -0
  75. package/rook-framework/snippets/rk-swatch.liquid +33 -0
  76. package/rook-framework/snippets/rk-table.liquid +44 -0
  77. package/rook-framework/snippets/rk-tabs.liquid +52 -0
  78. package/rook-framework/snippets/rk-textarea.liquid +42 -0
  79. package/rook-framework/snippets/rk-toggle-group.liquid +27 -0
  80. package/rook-framework/snippets/rk-toggle.liquid +58 -0
  81. package/rook-framework/snippets/rk-typography.liquid +27 -0
  82. package/rook-framework/snippets/rk-variables.liquid +74 -0
  83. package/src/app.js +24 -0
  84. package/src/commands/InstallCommand.js +133 -0
  85. package/src/mcp/server.js +111 -1
  86. package/src/services/FrameworkInstaller.js +379 -0
  87. package/src/templates/block.liquid.txt +0 -15
  88. package/src/ui/PromptUI.js +15 -1
  89. package/src/utils/logger.js +1 -1
@@ -0,0 +1,34 @@
1
+ {% doc %}
2
+ Snippet: RkCheckbox
3
+ Renders a checkbox input with label.
4
+
5
+ @param {string} name - Input name
6
+ @param {string} id - Unique id
7
+ @param {string} label - Label text
8
+ @param {string} [value] - Input value (default: 'on')
9
+ @param {boolean} [checked] - Pre-checked state
10
+ @param {boolean} [disabled] - Disabled state
11
+ @param {boolean} [required] - Required state
12
+ @param {string} [custom_class] - Extra CSS classes
13
+
14
+ @example
15
+ {% render 'rk-checkbox', name: 'agree', id: 'agree', label: 'Concordo com os termos' %}
16
+ {% enddoc %}
17
+
18
+ {%- liquid
19
+ assign cb_value = value | default: 'on'
20
+ -%}
21
+
22
+ <label class="rk-checkbox{% if custom_class %} {{ custom_class }}{% endif %}" for="{{ id }}">
23
+ <input
24
+ type="checkbox"
25
+ class="rk-checkbox__input"
26
+ id="{{ id }}"
27
+ name="{{ name }}"
28
+ value="{{ cb_value }}"
29
+ {% if checked %}checked{% endif %}
30
+ {% if disabled %}disabled{% endif %}
31
+ {% if required %}required aria-required="true"{% endif %}
32
+ >
33
+ <span class="rk-checkbox__label">{{ label }}</span>
34
+ </label>
@@ -0,0 +1,52 @@
1
+ {% doc %}
2
+ Snippet: RkCollapsible
3
+ Renders a Collapsible element (Shadcn/UI pattern).
4
+ Unlike Accordion (details/summary), this uses standard divs and JS for exact height animation control and WAI-ARIA roles.
5
+
6
+ @param {string} id - Unique id for aria linking
7
+ @param {string} trigger - HTML content for the trigger button
8
+ @param {string} content - HTML content to hide/show
9
+ @param {boolean} [open] - Should it render open initially? (default: false)
10
+ @param {string} [custom_class] - Extra CSS classes
11
+
12
+ @example
13
+ {% capture coll_trigger %}
14
+ <span>Mais Informações</span>
15
+ <span class="rk-collapsible__icon">⬇️</span>
16
+ {% endcapture %}
17
+ {% capture coll_content %}
18
+ <p>Aqui você encontra todas as informações sobre a garantia e devoluções.</p>
19
+ {% endcapture %}
20
+ {% render 'rk-collapsible', id: 'info-1', trigger: coll_trigger, content: coll_content %}
21
+ {% enddoc %}
22
+
23
+ {%- liquid
24
+ assign t_open = open | default: false
25
+ -%}
26
+
27
+ <rk-collapsible-element
28
+ id="{{ id }}"
29
+ class="rk-collapsible{% if custom_class %} {{ custom_class }}{% endif %}"
30
+ data-open="{{ t_open }}"
31
+ >
32
+ {%- comment -%} Trigger {%- endcomment -%}
33
+ <button
34
+ type="button"
35
+ class="rk-collapsible__trigger"
36
+ aria-expanded="{{ t_open }}"
37
+ aria-controls="{{ id }}-content"
38
+ >
39
+ {{ trigger }}
40
+ </button>
41
+
42
+ {%- comment -%} Content Animated Wrapper {%- endcomment -%}
43
+ <div
44
+ id="{{ id }}-content"
45
+ class="rk-collapsible__content{% if t_open %} rk-collapsible__content--expanded{% endif %}"
46
+ {% unless t_open %}hidden{% endunless %}
47
+ >
48
+ <div class="rk-collapsible__content-inner">
49
+ {{ content }}
50
+ </div>
51
+ </div>
52
+ </rk-collapsible-element>
@@ -0,0 +1,85 @@
1
+ {% doc %}
2
+ Snippet: RkDialog
3
+ Renders a Dialog / Modal (Shadcn/UI pattern) with full anatomy.
4
+ Uses Web Component <rk-dialog-element> for behaviour.
5
+
6
+ @param {string} id - Unique dialog id (required)
7
+ @param {string} title - Dialog title (required for a11y)
8
+ @param {string} [description] - Header description / subtitle
9
+ @param {string} [body] - HTML for the body content
10
+ @param {string} [footer] - HTML for the footer (action buttons)
11
+ @param {boolean} [overlay_close] - Close on overlay click (default: true)
12
+ @param {boolean} [show_close] - Show X close button (default: true)
13
+ @param {string} [width] - Content width (e.g. '540px')
14
+ @param {string} [custom_class] - Extra CSS classes
15
+
16
+ @example
17
+ {% capture dialog_body %}
18
+ <p>Content here</p>
19
+ {% endcapture %}
20
+ {% capture dialog_footer %}
21
+ <button class="rk-btn rk-btn--secondary rk-btn--md" data-action="close">
22
+ <span class="rk-btn__text">Cancelar</span>
23
+ </button>
24
+ {% render 'rk-button', text: 'Salvar', style: 'primary' %}
25
+ {% endcapture %}
26
+ {% render 'rk-dialog', id: 'my-dialog', title: 'Editar Perfil', description: 'Atualize suas informações.', body: dialog_body, footer: dialog_footer %}
27
+ {% enddoc %}
28
+
29
+ {%- liquid
30
+ assign d_overlay_close = overlay_close | default: true
31
+ assign d_show_close = show_close | default: true
32
+ -%}
33
+
34
+ {%- capture title_id -%}{{ id }}-title{%- endcapture -%}
35
+ {%- capture desc_id -%}{{ id }}-desc{%- endcapture -%}
36
+
37
+ <rk-dialog-element
38
+ data-dialog-id="{{ id }}"
39
+ data-overlay-close="{{ d_overlay_close }}"
40
+ >
41
+ <div id="{{ id }}" class="rk-dialog{% if custom_class %} {{ custom_class }}{% endif %}">
42
+ {%- comment -%} Overlay {%- endcomment -%}
43
+ <div class="rk-dialog__overlay"></div>
44
+
45
+ {%- comment -%} Content {%- endcomment -%}
46
+ <div
47
+ class="rk-dialog__content"
48
+ role="dialog"
49
+ aria-modal="true"
50
+ aria-labelledby="{{ title_id }}"
51
+ {% if description %}aria-describedby="{{ desc_id }}"{% endif %}
52
+ {% if width %}style="--rk-dialog-width: {{ width }};"{% endif %}
53
+ >
54
+ {%- if d_show_close -%}
55
+ <button type="button" class="rk-dialog__close" data-action="close" aria-label="Fechar">
56
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
57
+ <path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
58
+ </svg>
59
+ </button>
60
+ {%- endif -%}
61
+
62
+ {%- comment -%} Header {%- endcomment -%}
63
+ <div class="rk-dialog__header">
64
+ <h2 id="{{ title_id }}" class="rk-dialog__title">{{ title }}</h2>
65
+ {%- if description -%}
66
+ <p id="{{ desc_id }}" class="rk-dialog__description">{{ description }}</p>
67
+ {%- endif -%}
68
+ </div>
69
+
70
+ {%- comment -%} Body {%- endcomment -%}
71
+ {%- if body -%}
72
+ <div class="rk-dialog__body">
73
+ {{ body }}
74
+ </div>
75
+ {%- endif -%}
76
+
77
+ {%- comment -%} Footer {%- endcomment -%}
78
+ {%- if footer -%}
79
+ <div class="rk-dialog__footer">
80
+ {{ footer }}
81
+ </div>
82
+ {%- endif -%}
83
+ </div>
84
+ </div>
85
+ </rk-dialog-element>
@@ -0,0 +1,25 @@
1
+ {% doc %}
2
+ Snippet: RkDivider
3
+ Renders a visual divider line.
4
+
5
+ @param {string} [thickness] - CSS thickness (default: '1px')
6
+ @param {string} [width] - CSS width (default: '100%')
7
+ @param {string} [align] - 'left' | 'center' | 'right' (default: 'center')
8
+ @param {string} [custom_class] - Extra CSS classes
9
+
10
+ @example
11
+ {% render 'rk-divider', width: '80%' %}
12
+ {% enddoc %}
13
+
14
+ {%- liquid
15
+ assign d_thickness = thickness | default: '1px'
16
+ assign d_width = width | default: '100%'
17
+ assign d_align = align | default: 'center'
18
+ -%}
19
+
20
+ <div
21
+ class="rk-divider{% if custom_class %} {{ custom_class }}{% endif %}"
22
+ style="--rk-divider-align: {{ d_align }};"
23
+ >
24
+ <hr class="rk-divider__line" style="--rk-divider-thickness: {{ d_thickness }}; --rk-divider-width: {{ d_width }};">
25
+ </div>
@@ -0,0 +1,81 @@
1
+ {% doc %}
2
+ Snippet: RkDrawer
3
+ Renders a Drawer (sliding panel from screen edge).
4
+ Uses Web Component <rk-drawer-element> for behaviour.
5
+
6
+ @param {string} id - Unique drawer id
7
+ @param {string} [side] - 'bottom' | 'top' | 'left' | 'right' (default: 'bottom')
8
+ @param {boolean} [show_handle] - Show drag handle indicator (default: true)
9
+ @param {string} [title] - Optional header title
10
+ @param {string} [description] - Optional header description
11
+ @param {string} [body] - HTML for the body content
12
+ @param {string} [footer] - HTML for the footer (action buttons)
13
+ @param {string} [custom_class] - Extra CSS classes
14
+ @param {string} [width] - Panel width for left/right drawers (e.g. '400px')
15
+ @param {string} [height] - Panel height for top/bottom drawers (e.g. '50vh')
16
+
17
+ @example
18
+ {% capture drawer_body %}
19
+ <p>Drawer content here</p>
20
+ {% endcapture %}
21
+ {% capture drawer_footer %}
22
+ {% render 'rk-button', text: 'Confirmar', style: 'primary', full_width: true %}
23
+ {% endcapture %}
24
+ {% render 'rk-drawer', id: 'my-drawer', side: 'bottom', title: 'Filtros', body: drawer_body, footer: drawer_footer %}
25
+ {% enddoc %}
26
+
27
+ {%- liquid
28
+ assign d_side = side | default: 'bottom'
29
+ assign d_show_handle = show_handle | default: true
30
+ -%}
31
+
32
+ <rk-drawer-element data-drawer-id="{{ id }}" data-side="{{ d_side }}">
33
+ <div id="{{ id }}" class="rk-drawer{% if custom_class %} {{ custom_class }}{% endif %}">
34
+ {%- comment -%} Overlay {%- endcomment -%}
35
+ <div class="rk-drawer__overlay"></div>
36
+
37
+ {%- comment -%} Panel {%- endcomment -%}
38
+ <div
39
+ class="rk-drawer__panel rk-drawer__panel--{{ d_side }}"
40
+ role="dialog"
41
+ aria-modal="true"
42
+ {% if title %}aria-label="{{ title }}"{% endif %}
43
+ {% if width %}style="--rk-drawer-width: {{ width }};"{% endif %}
44
+ {% if height %}style="--rk-drawer-height: {{ height }};"{% endif %}
45
+ >
46
+ {%- if d_show_handle and d_side == 'bottom' or d_show_handle and d_side == 'top' -%}
47
+ <div class="rk-drawer__handle">
48
+ <div class="rk-drawer__handle-bar"></div>
49
+ </div>
50
+ {%- endif -%}
51
+
52
+ {%- comment -%} Close button {%- endcomment -%}
53
+ <button type="button" class="rk-drawer__close" data-action="close" aria-label="Fechar">
54
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
55
+ <path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
56
+ </svg>
57
+ </button>
58
+
59
+ {%- if title or description -%}
60
+ <div class="rk-drawer__header">
61
+ {%- if title -%}
62
+ <h2 class="rk-drawer__title">{{ title }}</h2>
63
+ {%- endif -%}
64
+ {%- if description -%}
65
+ <p class="rk-drawer__description">{{ description }}</p>
66
+ {%- endif -%}
67
+ </div>
68
+ {%- endif -%}
69
+
70
+ <div class="rk-drawer__body">
71
+ {{ body }}
72
+ </div>
73
+
74
+ {%- if footer -%}
75
+ <div class="rk-drawer__footer">
76
+ {{ footer }}
77
+ </div>
78
+ {%- endif -%}
79
+ </div>
80
+ </div>
81
+ </rk-drawer-element>
@@ -0,0 +1,33 @@
1
+ {% doc %}
2
+ Snippet: RkExternalAssets
3
+ Módulo de CDNs e serviços externos.
4
+
5
+ @param {string} location - 'head' ou 'body'
6
+
7
+ @example
8
+ {% render 'rk-external-assets', location: 'head' %}
9
+ {% enddoc %}
10
+
11
+ {%- liquid
12
+ assign location = location | default: 'head'
13
+ -%}
14
+
15
+ {%- if location == 'head' -%}
16
+ <!-- [RkExternalAssets] Preconnects -->
17
+ <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
18
+ <link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
19
+ <link rel="preconnect" href="https://unpkg.com" crossorigin>
20
+
21
+ <!-- [RkExternalAssets] Stylesheets CSS -->
22
+ {%- comment -%} Add external CSS here {%- endcomment -%}
23
+
24
+ {%- elsif location == 'body' -%}
25
+ <!-- [RkExternalAssets] Javascripts -->
26
+
27
+ <!-- [RkExternalAssets] Inline Initializations -->
28
+ <script>
29
+ if (typeof anime !== 'undefined') {
30
+ window.animate = anime.animate;
31
+ }
32
+ </script>
33
+ {%- endif -%}
@@ -0,0 +1,68 @@
1
+ {% doc %}
2
+ Snippet: RkExternalAssets
3
+ Módulo de CDNs e serviços externos.
4
+
5
+ @param {string} location - 'head' ou 'body'
6
+
7
+ @example
8
+ {% render 'rk-external-assets', location: 'head' %}
9
+ {% enddoc %}
10
+
11
+ {%- liquid
12
+ assign location = location | default: 'head'
13
+
14
+ # 1. CONFIG MAP - DOMÍNIOS PARA PRECONNECT
15
+ assign preconnects_str = "https://cdn.jsdelivr.net, https://cdnjs.cloudflare.com, https://unpkg.com"
16
+
17
+ # 2. CONFIG MAP - CSS ASSETS (Formato: id | url)
18
+ assign css_assets_str = ""
19
+
20
+ # 3. CONFIG MAP - JS ASSETS (Formato: id | url | strategy)
21
+ assign js_assets_str = "gsap | https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js | defer, scrolltrigger | https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js | defer"
22
+ -%}
23
+
24
+ {%- if location == 'head' -%}
25
+ <!-- [RkExternalAssets] Preconnects -->
26
+ {%- assign preconnect_domains = preconnects_str | split: ',' -%}
27
+ {%- for domain in preconnect_domains -%}
28
+ {%- assign domain_clean = domain | strip -%}
29
+ {%- if domain_clean != blank -%}
30
+ <link rel="preconnect" href="{{ domain_clean }}" crossorigin>
31
+ {%- endif -%}
32
+ {%- endfor -%}
33
+
34
+ <!-- [RkExternalAssets] Stylesheets CSS -->
35
+ {%- assign css_lines = css_assets_str | split: ',' -%}
36
+ {%- for css_line in css_lines -%}
37
+ {%- assign css_clean = css_line | strip -%}
38
+ {%- if css_clean == blank -%}{%- continue -%}{%- endif -%}
39
+
40
+ {%- assign css_data = css_clean | split: '|' -%}
41
+ {%- if css_data.size >= 2 -%}
42
+ {%- assign css_id = css_data[0] | strip -%}
43
+ {%- assign css_url = css_data[1] | strip -%}
44
+ <link rel="stylesheet" href="{{ css_url }}" id="rk-ext-{{ css_id }}">
45
+ {%- endif -%}
46
+ {%- endfor -%}
47
+ {%- endif -%}
48
+
49
+ {%- if location == 'body' -%}
50
+ <!-- [RkExternalAssets] Javascripts -->
51
+ {%- assign js_lines = js_assets_str | split: ',' -%}
52
+ {%- for js_line in js_lines -%}
53
+ {%- assign js_clean = js_line | strip -%}
54
+ {%- if js_clean == blank -%}{%- continue -%}{%- endif -%}
55
+
56
+ {%- assign js_data = js_clean | split: '|' -%}
57
+ {%- if js_data.size >= 2 -%}
58
+ {%- assign js_id = js_data[0] | strip -%}
59
+ {%- assign js_url = js_data[1] | strip -%}
60
+ {%- assign js_strategy = js_data[2] | strip | default: 'defer' -%}
61
+ {%- if js_strategy == 'async' -%}
62
+ <script src="{{ js_url }}" id="rk-ext-{{ js_id }}" async></script>
63
+ {%- else -%}
64
+ <script src="{{ js_url }}" id="rk-ext-{{ js_id }}" defer></script>
65
+ {%- endif -%}
66
+ {%- endif -%}
67
+ {%- endfor -%}
68
+ {%- endif -%}
@@ -0,0 +1,83 @@
1
+ {% doc %}
2
+ Snippet: RkFormField
3
+ Componente estrutural para agrupar campos de formulário (Label + Input + Descrição + Mensagem de Erro).
4
+ Gerencia automaticamente as associações WAI-ARIA com base no ID fornecido.
5
+
6
+ @param {string} id - O ID único base para o controle (Ex: 'customer_email'). O input dentro deve usar esse ID.
7
+ @param {string} label - O texto do label.
8
+ @param {string} control - Elemento transcluído de marcação (ex: `<input>`, `<select>`, `<textarea>`).
9
+ @param {string} [description] - Texto descritivo/ajuda opcional para guiar o preenchimento.
10
+ @param {string} [error] - Se presente, o campo entra em estado de erro e exibe esta mensagem.
11
+ @param {boolean} [required] - Se true, exibe o indicador (asterisco) de campo obrigatório.
12
+ @param {string} [layout] - 'vertical' (padrão) ou 'horizontal'.
13
+
14
+ @example
15
+ {% capture control_input %}
16
+ <input type="email" id="email" name="customer[email]" class="rk-input" required>
17
+ {% endcapture %}
18
+
19
+ {% render 'rk-form-field',
20
+ id: 'email',
21
+ label: 'Endereço de E-mail',
22
+ control: control_input,
23
+ description: 'Nós nunca compartilharemos o seu e-mail.',
24
+ required: true
25
+ %}
26
+ {% enddoc %}
27
+
28
+ {%- liquid
29
+ assign t_layout = layout | default: 'vertical'
30
+ assign has_error = false
31
+ if error != blank
32
+ assign has_error = true
33
+ endif
34
+
35
+ assign description_id = id | append: '-description'
36
+ assign error_id = id | append: '-error'
37
+ -%}
38
+
39
+ <div class="rk-form-field rk-form-field--{{ t_layout }}{% if has_error %} rk-form-field--error{% endif %}">
40
+
41
+ {%- comment -%} ==========================================
42
+ 1. LABEL AREA
43
+ ========================================== {%- endcomment -%}
44
+ <label for="{{ id }}" class="rk-form-field__label">
45
+ {{ label }}
46
+ {%- if required -%}
47
+ <span class="rk-form-field__required" aria-hidden="true">*</span>
48
+ {%- endif -%}
49
+ </label>
50
+
51
+ {%- comment -%} ==========================================
52
+ 2. CONTROL WRAPPER (Adicionando ARIA associations ao filho)
53
+ ========================================== {%- endcomment -%}
54
+ <div
55
+ class="rk-form-field__control"
56
+ {%- comment -%}
57
+ Como Liquid não parseia o conteúdo de `control` para injetar ATRIBUTOS facilmente
58
+ nós deixamos como wrapper. Recomendado que no arquivo que chamou adicione navativamente
59
+ se o WAI ARIA total for crítico. Mas o wrapper abraça.
60
+ {%- endcomment -%}
61
+ >
62
+ {{ control }}
63
+ </div>
64
+
65
+ {%- comment -%} ==========================================
66
+ 3. DESCRIPTION AREA
67
+ ========================================== {%- endcomment -%}
68
+ {%- if description != blank and has_error == false -%}
69
+ <p id="{{ description_id }}" class="rk-form-field__description">
70
+ {{ description }}
71
+ </p>
72
+ {%- endif -%}
73
+
74
+ {%- comment -%} ==========================================
75
+ 4. ERROR MESSAGE
76
+ ========================================== {%- endcomment -%}
77
+ {%- if has_error -%}
78
+ <p id="{{ error_id }}" class="rk-form-field__error" role="alert">
79
+ {{ error }}
80
+ </p>
81
+ {%- endif -%}
82
+
83
+ </div>
@@ -0,0 +1,32 @@
1
+ {%- doc -%}
2
+ Renders the CSS variable for the `gap` style with responsive scaling support.
3
+ Portable equivalent of Horizon's `gap-style.liquid` with `rk-` prefixed variables.
4
+
5
+ Values above `scale_min` (default: 24px) are wrapped in a responsive `max()` function
6
+ that scales down proportionally on smaller viewports using `--rk-gap-scale`.
7
+
8
+ @param {number} value - The base or desktop gap value to use, in pixels.
9
+ @param {string} [name] - The name of the CSS variable suffix. Default: 'gap'
10
+ @param {number} [scale_min] - Value above which gap scaling will be applied. Default: 24
11
+ @param {boolean} [disable_scaling] - If true, disables scaling and outputs the original value.
12
+
13
+ @example
14
+ <div class="rk-gap-style" style="{% render 'rk-gap-style', value: block.settings.gap %}">
15
+
16
+ @example Custom name
17
+ <div style="{% render 'rk-gap-style', value: 28, name: 'card-gap' %}">
18
+ → outputs: --rk-card-gap: max(24px, calc(var(--rk-gap-scale, 1) * 28px));
19
+ {%- enddoc -%}
20
+
21
+ {%- liquid
22
+ assign rk_min = scale_min | default: 24
23
+ assign rk_name = name | default: 'gap'
24
+ -%}
25
+
26
+ {%- if value != blank -%}
27
+ {%- if disable_scaling != true and value > rk_min -%}
28
+ --rk-{{ rk_name }}: max({{ rk_min }}px, calc(var(--rk-gap-scale, 1) * {{ value }}px));
29
+ {%- else -%}
30
+ --rk-{{ rk_name }}: {{ value }}px;
31
+ {%- endif -%}
32
+ {%- endif -%}
@@ -0,0 +1,28 @@
1
+ {% doc %}
2
+ Snippet: RkIcon
3
+ Renders an SVG icon wrapper.
4
+
5
+ @param {string} icon - Icon name to render (passes through to theme's icon.liquid)
6
+ @param {string} [size] - 'sm' | 'md' | 'lg' | 'xl' (default: 'md')
7
+ @param {string} [custom_class] - Extra CSS classes
8
+ @param {string} [color] - CSS color value
9
+ @param {string} [label] - Accessibility label
10
+
11
+ @example
12
+ {% render 'rk-icon', icon: 'heart', size: 'lg' %}
13
+ {% enddoc %}
14
+
15
+ {%- liquid
16
+ assign icon_size = size | default: 'md'
17
+ -%}
18
+
19
+ <span
20
+ class="rk-icon rk-icon--{{ icon_size }}{% if custom_class %} {{ custom_class }}{% endif %}"
21
+ {% if color %}style="color: {{ color }}"{% endif %}
22
+ {% if label %}aria-label="{{ label }}"{% else %}aria-hidden="true"{% endif %}
23
+ role="{% if label %}img{% else %}presentation{% endif %}"
24
+ >
25
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
26
+ {% render 'icon', icon: icon %}
27
+ </svg>
28
+ </span>
@@ -0,0 +1,60 @@
1
+ {% doc %}
2
+ Snippet: RkImage
3
+ Renders a responsive <img> with srcset, aspect-ratio, lazyload, and CLS prevention.
4
+
5
+ @param {object} image - Shopify image object
6
+ @param {number} [width] - Custom width (default: image.width)
7
+ @param {number} [height] - Custom height
8
+ @param {string} [sizes] - Responsive sizes attribute
9
+ @param {string} [loading] - 'lazy' | 'eager' (default: 'lazy')
10
+ @param {string} [class] - Extra CSS classes
11
+ @param {string} [style] - Additional inline styles
12
+ @param {string} [alt] - Alt text override
13
+ @param {string} [shape] - 'rounded' | 'circle'
14
+ @param {string} [placeholder_text] - Text fallback if image is blank
15
+
16
+ @example
17
+ {% render 'rk-image', image: product.featured_image, loading: 'eager' %}
18
+ {% enddoc %}
19
+
20
+ {%- liquid
21
+ assign img_loading = loading | default: 'lazy'
22
+ assign img_alt = alt | default: image.alt | escape
23
+ assign img_width = width | default: image.width
24
+ assign img_height = height | default: image.height
25
+ assign img_sizes = sizes | default: '100vw'
26
+
27
+ assign shape_class = ''
28
+ if shape == 'rounded'
29
+ assign shape_class = ' rk-image--rounded'
30
+ elsif shape == 'circle'
31
+ assign shape_class = ' rk-image--circle'
32
+ endif
33
+ -%}
34
+
35
+ {% if image != blank %}
36
+ {%- assign height_1x = img_height -%}
37
+ {%- assign height_2x = img_height | times: 2 -%}
38
+ {%- assign height_3x = img_height | times: 3 -%}
39
+
40
+ {%- capture srcset_value -%}
41
+ {{ image | image_url: height: height_1x }} 1x, {{ image | image_url: height: height_2x }} 2x, {{ image | image_url: height: height_3x }} 3x
42
+ {%- endcapture -%}
43
+
44
+ <div
45
+ class="rk-image{{ shape_class }}{% if class %} {{ class }}{% endif %}"
46
+ style="aspect-ratio: {{ img_width }} / {{ img_height }};{% if style %} {{ style }}{% endif %}"
47
+ >
48
+ {{ image | image_url: height: height_1x | image_tag:
49
+ class: 'rk-image__img',
50
+ srcset: srcset_value,
51
+ sizes: img_sizes,
52
+ loading: img_loading,
53
+ alt: img_alt
54
+ }}
55
+ </div>
56
+ {% elsif placeholder_text != blank %}
57
+ <div class="rk-image__placeholder{% if class %} {{ class }}{% endif %}" style="{% if style %}{{ style }}{% endif %}">
58
+ {{ placeholder_text }}
59
+ </div>
60
+ {% endif %}
@@ -0,0 +1,35 @@
1
+ {% doc %}
2
+ Snippet: RkInput
3
+ Renders a text input field.
4
+
5
+ @param {string} name - Input name attribute
6
+ @param {string} [id] - Input id attribute
7
+ @param {string} [type] - Input type (default: 'text')
8
+ @param {string} [value] - Initial value
9
+ @param {string} [placeholder] - Placeholder text
10
+ @param {boolean} [required] - Makes input required
11
+ @param {boolean} [disabled] - Disables input
12
+ @param {boolean} [error] - Shows error state
13
+ @param {string} [custom_class] - Extra CSS classes
14
+ @param {string} [attr] - Additional HTML attributes
15
+
16
+ @example
17
+ {% render 'rk-input', name: 'email', type: 'email', placeholder: 'seu@email.com' %}
18
+ {% enddoc %}
19
+
20
+ {%- liquid
21
+ assign input_type = type | default: 'text'
22
+ assign input_id = id | default: name
23
+ -%}
24
+
25
+ <input
26
+ type="{{ input_type }}"
27
+ id="{{ input_id }}"
28
+ name="{{ name }}"
29
+ {% if value %}value="{{ value }}"{% endif %}
30
+ {% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
31
+ {% if required %}required aria-required="true"{% endif %}
32
+ {% if disabled %}disabled{% endif %}
33
+ class="rk-input{% if error %} rk-input--error{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
34
+ {{ attr }}
35
+ >
@@ -0,0 +1,54 @@
1
+ {% doc %}
2
+ Snippet: RkInstallments
3
+ Renders the installment price information reading global settings.
4
+
5
+ @param {number} price - Price in cents to calculate installments from
6
+ @param {string} [custom_class] - Extra CSS classes
7
+
8
+ @example
9
+ {% render 'rk-installments', price: product.selected_or_first_available_variant.price %}
10
+ {% enddoc %}
11
+
12
+ {%- liquid
13
+ unless settings.rk_installments_enabled
14
+ break
15
+ endunless
16
+
17
+ assign inst_max = settings.rk_installments_max | default: 12
18
+ assign inst_no_interest = settings.rk_installments_without_interest | default: 3
19
+ assign inst_min_value = settings.rk_installments_min_value | default: '500' | plus: 0
20
+ assign interest_rate_raw = settings.rk_installments_interest_rate | default: '2.99'
21
+
22
+ assign best_installments = 1
23
+ assign best_value = price
24
+
25
+ for i in (1..inst_max)
26
+ assign value = price | divided_by: i
27
+ if value >= inst_min_value
28
+ assign best_installments = i
29
+ assign best_value = value
30
+ else
31
+ break
32
+ endif
33
+ endfor
34
+
35
+ assign has_interest = false
36
+ if best_installments > inst_no_interest
37
+ assign has_interest = true
38
+ endif
39
+
40
+ assign formatted_value = best_value | money
41
+ -%}
42
+
43
+ {% if best_installments > 1 %}
44
+ <span class="rk-installments{% if custom_class %} {{ custom_class }}{% endif %}">
45
+ <span class="rk-installments__value">{{ best_installments }}x</span>
46
+ de
47
+ <span class="rk-installments__value">{{ formatted_value }}</span>
48
+ {% if has_interest %}
49
+ <span class="rk-installments__interest">(com juros de {{ interest_rate_raw }}%)</span>
50
+ {% else %}
51
+ <span class="rk-installments__interest">sem juros</span>
52
+ {% endif %}
53
+ </span>
54
+ {% endif %}