rook-cli 1.3.7 → 1.3.9

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.
@@ -1,31 +1,120 @@
1
1
  {% doc %}
2
2
  Snippet: RkModal
3
- Renders a modal/dialog wrapper using a Web Component.
3
+ Renders a media lightbox for images, videos, and embedded content.
4
+ Uses Web Component <rk-modal-element> for behaviour.
4
5
 
5
- @param {string} id - Unique modal id
6
- @param {string} content - HTML content of the modal
7
- @param {string} [title] - Optional title
6
+ @param {string} id - Unique modal id (required)
7
+ @param {string} [type] - 'image' | 'video' | 'youtube' | 'vimeo' | 'html' (default: 'image')
8
+ @param {object} [image] - Shopify image object (when type is 'image')
9
+ @param {string} [video_url] - Video URL for hosted .mp4 (when type is 'video')
10
+ @param {string} [youtube_id] - YouTube video ID (when type is 'youtube')
11
+ @param {string} [vimeo_id] - Vimeo video ID (when type is 'vimeo')
12
+ @param {string} [content] - Raw HTML content (when type is 'html')
13
+ @param {string} [alt] - Alt text for images / aria-label for media
14
+ @param {string} [aspect_ratio] - Aspect ratio for video (e.g. '16/9', default: '16/9')
15
+ @param {boolean} [autoplay] - Autoplay video on open (default: true)
8
16
  @param {string} [custom_class] - Extra CSS classes
9
17
 
10
- @example
11
- {% render 'rk-modal', id: 'my-modal', title: 'Quick View', content: some_html %}
18
+ @example — Image lightbox
19
+ {% render 'rk-modal', id: 'product-zoom', type: 'image', image: product.featured_image, alt: product.title %}
20
+
21
+ @example — YouTube lightbox
22
+ {% render 'rk-modal', id: 'brand-video', type: 'youtube', youtube_id: 'dQw4w9WgXcQ' %}
23
+
24
+ @example — Hosted video
25
+ {% render 'rk-modal', id: 'story-video', type: 'video', video_url: video_source %}
12
26
  {% enddoc %}
13
27
 
14
- <rk-modal-element data-modal-id="{{ id }}">
28
+ {%- liquid
29
+ assign modal_type = type | default: 'image'
30
+ assign modal_aspect = aspect_ratio | default: '16/9'
31
+ assign modal_autoplay = autoplay | default: true
32
+ assign modal_alt = alt | default: ''
33
+ -%}
34
+
35
+ <rk-modal-element
36
+ data-modal-id="{{ id }}"
37
+ data-type="{{ modal_type }}"
38
+ {% if modal_autoplay %}data-autoplay="true"{% endif %}
39
+ >
15
40
  <div id="{{ id }}" class="rk-modal{% if custom_class %} {{ custom_class }}{% endif %}">
41
+ {%- comment -%} Overlay {%- endcomment -%}
16
42
  <div class="rk-modal__overlay" data-action="close"></div>
17
- <div class="rk-modal__content" role="dialog" aria-modal="true" {% if title %}aria-label="{{ title }}"{% endif %}>
18
- <button type="button" class="rk-modal__close" data-action="close" aria-label="Fechar">
19
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
20
- <path d="M15 5L5 15M5 5l10 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
21
- </svg>
22
- </button>
23
-
24
- {% if title %}
25
- <h2 class="rk-typography rk-typography--lg rk-typography--bold" style="margin-bottom: var(--rk-space-md);">{{ title }}</h2>
26
- {% endif %}
27
-
28
- {{ content }}
43
+
44
+ {%- comment -%} Close button {%- endcomment -%}
45
+ <button type="button" class="rk-modal__close" data-action="close" aria-label="Fechar">
46
+ {% render 'rk-icon', icon: 'close', size: 'md', color: '#fff' %}
47
+ </button>
48
+
49
+ {%- comment -%} Media content {%- endcomment -%}
50
+ <div
51
+ class="rk-modal__content"
52
+ role="dialog"
53
+ aria-modal="true"
54
+ {% if modal_alt != blank %}aria-label="{{ modal_alt }}"{% endif %}
55
+ >
56
+ {%- case modal_type -%}
57
+
58
+ {%- when 'image' -%}
59
+ {%- if image != blank -%}
60
+ {%- assign img_alt = modal_alt | default: image.alt | escape -%}
61
+ <div class="rk-modal__media rk-modal__media--image">
62
+ {{
63
+ image
64
+ | image_url: width: 1600
65
+ | image_tag:
66
+ class: 'rk-modal__img',
67
+ loading: 'lazy',
68
+ alt: img_alt,
69
+ sizes: '(min-width: 1200px) 1200px, 90vw'
70
+ }}
71
+ </div>
72
+ {%- endif -%}
73
+
74
+ {%- when 'video' -%}
75
+ <div class="rk-modal__media rk-modal__media--video" style="aspect-ratio: {{ modal_aspect }};">
76
+ <video
77
+ class="rk-modal__video"
78
+ controls
79
+ playsinline
80
+ preload="metadata"
81
+ {% if modal_autoplay %}data-autoplay{% endif %}
82
+ {% if modal_alt != blank %}aria-label="{{ modal_alt }}"{% endif %}
83
+ >
84
+ <source src="{{ video_url }}" type="video/mp4">
85
+ </video>
86
+ </div>
87
+
88
+ {%- when 'youtube' -%}
89
+ <div class="rk-modal__media rk-modal__media--embed" style="aspect-ratio: {{ modal_aspect }};">
90
+ <iframe
91
+ class="rk-modal__iframe"
92
+ data-src="https://www.youtube.com/embed/{{ youtube_id }}?rel=0&enablejsapi=1"
93
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
94
+ allowfullscreen
95
+ loading="lazy"
96
+ {% if modal_alt != blank %}title="{{ modal_alt }}"{% endif %}
97
+ ></iframe>
98
+ </div>
99
+
100
+ {%- when 'vimeo' -%}
101
+ <div class="rk-modal__media rk-modal__media--embed" style="aspect-ratio: {{ modal_aspect }};">
102
+ <iframe
103
+ class="rk-modal__iframe"
104
+ data-src="https://player.vimeo.com/video/{{ vimeo_id }}?title=0&byline=0&portrait=0"
105
+ allow="autoplay; fullscreen; picture-in-picture"
106
+ allowfullscreen
107
+ loading="lazy"
108
+ {% if modal_alt != blank %}title="{{ modal_alt }}"{% endif %}
109
+ ></iframe>
110
+ </div>
111
+
112
+ {%- when 'html' -%}
113
+ <div class="rk-modal__media rk-modal__media--html">
114
+ {{ content }}
115
+ </div>
116
+
117
+ {%- endcase -%}
29
118
  </div>
30
119
  </div>
31
120
  </rk-modal-element>
@@ -0,0 +1,56 @@
1
+ {% doc %}
2
+ Snippet: RkReveal
3
+ Wrapper que aplica animacao de revelacao progressiva por scroll (fade-in + slide-up).
4
+ Usa IntersectionObserver para detectar quando o elemento entra na viewport
5
+ e dispara a animacao com suporte a stagger (cascata entre filhos).
6
+
7
+ @param {string} [animation] - Tipo de animacao: 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'fade' | 'zoom' (default: 'fade-up')
8
+ @param {number} [duration] - Duracao da animacao em ms (default: 600)
9
+ @param {number} [delay] - Atraso antes de iniciar em ms (default: 0)
10
+ @param {number} [stagger] - Atraso incremental entre filhos diretos em ms (default: 0, desativado)
11
+ @param {number} [threshold] - Percentual visivel para disparar (0.0 a 1.0, default: 0.1)
12
+ @param {string} [easing] - CSS easing function (default: 'cubic-bezier(0.16, 1, 0.3, 1)')
13
+ @param {boolean} [once] - Anima apenas uma vez (default: true)
14
+ @param {string} [content] - HTML do conteudo interno
15
+ @param {string} [custom_class] - Classes CSS extras
16
+ @param {string} [tag] - Tag HTML do wrapper (default: 'div')
17
+
18
+ @example
19
+ {% capture card_content %}
20
+ <div>Card 1</div>
21
+ <div>Card 2</div>
22
+ <div>Card 3</div>
23
+ {% endcapture %}
24
+ {% render 'rk-reveal', content: card_content, animation: 'fade-up', stagger: 100 %}
25
+
26
+ {% capture banner %}
27
+ <h2>Titulo do Banner</h2>
28
+ {% endcapture %}
29
+ {% render 'rk-reveal', content: banner, animation: 'fade-up', delay: 200, duration: 800 %}
30
+ {% enddoc %}
31
+
32
+ {%- liquid
33
+ assign rv_animation = animation | default: 'fade-up'
34
+ assign rv_duration = duration | default: 600
35
+ assign rv_delay = delay | default: 0
36
+ assign rv_stagger = stagger | default: 0
37
+ assign rv_threshold = threshold | default: '0.1'
38
+ assign rv_easing = easing | default: 'cubic-bezier(0.16, 1, 0.3, 1)'
39
+ assign rv_once = once | default: true
40
+ assign rv_tag = tag | default: 'div'
41
+ -%}
42
+
43
+ <rk-reveal-element
44
+ class="rk-reveal{% if custom_class %} {{ custom_class }}{% endif %}"
45
+ data-animation="{{ rv_animation }}"
46
+ data-duration="{{ rv_duration }}"
47
+ data-delay="{{ rv_delay }}"
48
+ data-stagger="{{ rv_stagger }}"
49
+ data-threshold="{{ rv_threshold }}"
50
+ data-easing="{{ rv_easing }}"
51
+ data-once="{{ rv_once }}"
52
+ >
53
+ <{{ rv_tag }} class="rk-reveal__content">
54
+ {{ content }}
55
+ </{{ rv_tag }}>
56
+ </rk-reveal-element>
@@ -7,7 +7,7 @@
7
7
 
8
8
  {%- liquid
9
9
  # Lista de componentes JS essenciais do Rook Framework
10
- assign rk_components = 'quantity,modal,accordion,popover,scroll-area,drawer,dialog,sheet,tabs,toggle,progress,collapsible,carousel,bottom-app-bar'
10
+ assign rk_components = 'quantity,modal,accordion,popover,scroll-area,drawer,dialog,sheet,tabs,toggle,progress,collapsible,carousel,bottom-app-bar,reveal'
11
11
  assign rk_components_array = rk_components | split: ','
12
12
  -%}
13
13
 
@@ -14,6 +14,7 @@
14
14
  import path from 'path';
15
15
  import os from 'os';
16
16
  import fs from 'fs-extra';
17
+ import { REMOTE_PATHS } from '../config/constants.js';
17
18
 
18
19
  export class AddCommand {
19
20
 
@@ -120,7 +121,7 @@ export class AddCommand {
120
121
  this.logger.destaque(`🧩 Instalando ${kitSelecionado.componentes.length} componente(s) do manifesto...\n`);
121
122
 
122
123
  for (const nomeComponente of kitSelecionado.componentes) {
123
- const caminhoComponente = `components/${nomeComponente}`;
124
+ const caminhoComponente = `${REMOTE_PATHS.COMPONENTS}/${nomeComponente}`;
124
125
 
125
126
  try {
126
127
  this.logger.info(`[${totalComponentesInstalados + 1}/${kitSelecionado.componentes.length}] ${nomeComponente}`);
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  /** Repositório de origem no GitHub (owner/repo) */
9
- export const GITHUB_REPO = process.env.GITHUB_REPO || 'chesslabdev/rook-cli/tree/main/rook-components';
9
+ export const GITHUB_REPO = process.env.GITHUB_REPO || 'chesslabdev/rook-cli';
10
10
 
11
11
  /** URL base da API do GitHub para conteúdo do repositório */
12
12
  export const GITHUB_API_BASE = `https://api.github.com/repos/${GITHUB_REPO}/contents`;
@@ -30,10 +30,9 @@ export const SHOPIFY_DIRS = [
30
30
  'templates',
31
31
  ];
32
32
 
33
- /** Pastas raiz do repositório remoto */
34
33
  export const REMOTE_PATHS = {
35
- KITS: 'kits',
36
- COMPONENTS: 'components',
34
+ KITS: 'rook-components/kits',
35
+ COMPONENTS: 'rook-components/components',
37
36
  };
38
37
 
39
38
  /** Nome do CLI exibido nos logs */
@@ -49,7 +49,7 @@ export class Logger {
49
49
  banner() {
50
50
  console.log('');
51
51
  console.log(pc.bold(pc.white(' ╔══════════════════════════════╗')));
52
- console.log(pc.bold(pc.white(' ║ ♟️ ROOK CLI v1.3.7 ║')));
52
+ console.log(pc.bold(pc.white(' ║ ♟️ ROOK CLI v1.3.9 ║')));
53
53
  console.log(pc.bold(pc.white(' ║ Shopify Component Tool ║')));
54
54
  console.log(pc.bold(pc.white(' ╚══════════════════════════════╝')));
55
55
  console.log('');
@@ -1,166 +0,0 @@
1
- {% comment %}
2
- Block: RK Button
3
- Renders a rk-button with full customizer control.
4
- Uses rk-size-style and rk-spacing-style for Horizon-compatible sizing and spacing.
5
- {% endcomment %}
6
-
7
- <rk-button-block
8
- id="block-{{ block.id }}"
9
- {{ block.shopify_attributes }}
10
- class="rk-block rk-size-style rk-spacing-style"
11
- style="
12
- {% render 'rk-size-style', settings: block.settings %}
13
- {% render 'rk-spacing-style', settings: block.settings %}
14
- {% if block.settings.alignment == 'center' %}text-align: center;{% elsif block.settings.alignment == 'right' %}text-align: right;{% endif %}
15
- "
16
- >
17
- {% render 'rk-button',
18
- text: block.settings.text,
19
- url: block.settings.url,
20
- style: block.settings.style,
21
- size: block.settings.size,
22
- full_width: block.settings.full_width,
23
- icon: block.settings.icon
24
- %}
25
- </rk-button-block>
26
-
27
- {% schema %}
28
- {
29
- "name": "RK | Botão",
30
- "tag": null,
31
- "settings": [
32
- {
33
- "type": "text",
34
- "id": "text",
35
- "label": "Texto do botão",
36
- "default": "Clique aqui"
37
- },
38
- {
39
- "type": "url",
40
- "id": "url",
41
- "label": "Link"
42
- },
43
- {
44
- "type": "select",
45
- "id": "style",
46
- "label": "Estilo",
47
- "options": [
48
- { "value": "primary", "label": "Primário" },
49
- { "value": "secondary", "label": "Secundário" },
50
- { "value": "outline", "label": "Outline" },
51
- { "value": "ghost", "label": "Ghost" },
52
- { "value": "link", "label": "Link" }
53
- ],
54
- "default": "primary"
55
- },
56
- {
57
- "type": "select",
58
- "id": "size",
59
- "label": "Tamanho",
60
- "options": [
61
- { "value": "sm", "label": "Pequeno" },
62
- { "value": "md", "label": "Médio" },
63
- { "value": "lg", "label": "Grande" }
64
- ],
65
- "default": "md"
66
- },
67
- {
68
- "type": "checkbox",
69
- "id": "full_width",
70
- "label": "Largura total",
71
- "default": false
72
- },
73
- {
74
- "type": "text",
75
- "id": "icon",
76
- "label": "Ícone (nome)",
77
- "info": "Ex: heart, cart, arrow"
78
- },
79
- {
80
- "type": "header",
81
- "content": "Dimensionamento"
82
- },
83
- {
84
- "type": "select",
85
- "id": "width",
86
- "label": "Largura",
87
- "options": [
88
- { "value": "fit-content", "label": "Ajustar ao conteúdo" },
89
- { "value": "fill", "label": "Preencher" },
90
- { "value": "custom", "label": "Personalizado" }
91
- ],
92
- "default": "fit-content"
93
- },
94
- {
95
- "type": "range",
96
- "id": "custom_width",
97
- "label": "Largura personalizada",
98
- "min": 10,
99
- "max": 100,
100
- "step": 5,
101
- "unit": "%",
102
- "default": 100
103
- },
104
- {
105
- "type": "header",
106
- "content": "Layout"
107
- },
108
- {
109
- "type": "text_alignment",
110
- "id": "alignment",
111
- "label": "Alinhamento",
112
- "default": "left"
113
- },
114
- {
115
- "type": "header",
116
- "content": "Espaçamento"
117
- },
118
- {
119
- "type": "range",
120
- "id": "padding-block-start",
121
- "label": "Topo",
122
- "min": 0,
123
- "max": 100,
124
- "step": 2,
125
- "unit": "px",
126
- "default": 0
127
- },
128
- {
129
- "type": "range",
130
- "id": "padding-block-end",
131
- "label": "Base",
132
- "min": 0,
133
- "max": 100,
134
- "step": 2,
135
- "unit": "px",
136
- "default": 0
137
- },
138
- {
139
- "type": "range",
140
- "id": "padding-inline-start",
141
- "label": "Esquerda",
142
- "min": 0,
143
- "max": 100,
144
- "step": 2,
145
- "unit": "px",
146
- "default": 0
147
- },
148
- {
149
- "type": "range",
150
- "id": "padding-inline-end",
151
- "label": "Direita",
152
- "min": 0,
153
- "max": 100,
154
- "step": 2,
155
- "unit": "px",
156
- "default": 0
157
- }
158
- ],
159
- "presets": [
160
- {
161
- "name": "RK | Botão",
162
- "category": "Rook UI"
163
- }
164
- ]
165
- }
166
- {% endschema %}
@@ -1,134 +0,0 @@
1
- {% comment %}
2
- Block: RK Icon
3
- Renders a rk-icon standalone block.
4
- Uses rk-spacing-style for Horizon-compatible spacing.
5
- {% endcomment %}
6
-
7
- <rk-icon-block
8
- id="block-{{ block.id }}"
9
- {{ block.shopify_attributes }}
10
- class="rk-block rk-spacing-style"
11
- style="
12
- {% render 'rk-spacing-style', settings: block.settings %}
13
- {% if block.settings.alignment == 'center' %}text-align: center;{% elsif block.settings.alignment == 'right' %}text-align: right;{% endif %}
14
- "
15
- >
16
- {% render 'rk-icon',
17
- icon: block.settings.icon,
18
- size: block.settings.size,
19
- color: block.settings.color
20
- %}
21
- </rk-icon-block>
22
-
23
- {% schema %}
24
- {
25
- "name": "RK | Ícone",
26
- "tag": null,
27
- "settings": [
28
- {
29
- "type": "select",
30
- "id": "icon",
31
- "label": "Ícone",
32
- "options": [
33
- { "value": "heart", "label": "Coração" },
34
- { "value": "star", "label": "Estrela" },
35
- { "value": "truck", "label": "Caminhão" },
36
- { "value": "lock", "label": "Cadeado" },
37
- { "value": "return", "label": "Devolução" },
38
- { "value": "chat_bubble", "label": "Chat" },
39
- { "value": "fire", "label": "Fogo" },
40
- { "value": "lightning_bolt", "label": "Raio" },
41
- { "value": "leaf", "label": "Folha" },
42
- { "value": "plant", "label": "Planta" },
43
- { "value": "recycle", "label": "Reciclável" },
44
- { "value": "snowflake", "label": "Floco de neve" },
45
- { "value": "map_pin", "label": "Pin de mapa" },
46
- { "value": "eye", "label": "Olho" },
47
- { "value": "ruler", "label": "Régua" },
48
- { "value": "price_tag", "label": "Etiqueta de preço" },
49
- { "value": "question_mark", "label": "Interrogação" },
50
- { "value": "error", "label": "Erro" },
51
- { "value": "check_box", "label": "Checkbox" },
52
- { "value": "clipboard", "label": "Clipboard" },
53
- { "value": "plane", "label": "Avião" },
54
- { "value": "stopwatch", "label": "Cronômetro" },
55
- { "value": "silhouette", "label": "Perfil" }
56
- ],
57
- "default": "heart"
58
- },
59
- {
60
- "type": "select",
61
- "id": "size",
62
- "label": "Tamanho",
63
- "options": [
64
- { "value": "sm", "label": "Pequeno (16px)" },
65
- { "value": "md", "label": "Médio (20px)" },
66
- { "value": "lg", "label": "Grande (24px)" },
67
- { "value": "xl", "label": "Extra Grande (32px)" }
68
- ],
69
- "default": "md"
70
- },
71
- {
72
- "type": "color",
73
- "id": "color",
74
- "label": "Cor"
75
- },
76
- {
77
- "type": "text_alignment",
78
- "id": "alignment",
79
- "label": "Alinhamento",
80
- "default": "left"
81
- },
82
- {
83
- "type": "header",
84
- "content": "Espaçamento"
85
- },
86
- {
87
- "type": "range",
88
- "id": "padding-block-start",
89
- "label": "Topo",
90
- "min": 0,
91
- "max": 100,
92
- "step": 2,
93
- "unit": "px",
94
- "default": 0
95
- },
96
- {
97
- "type": "range",
98
- "id": "padding-block-end",
99
- "label": "Base",
100
- "min": 0,
101
- "max": 100,
102
- "step": 2,
103
- "unit": "px",
104
- "default": 0
105
- },
106
- {
107
- "type": "range",
108
- "id": "padding-inline-start",
109
- "label": "Esquerda",
110
- "min": 0,
111
- "max": 100,
112
- "step": 2,
113
- "unit": "px",
114
- "default": 0
115
- },
116
- {
117
- "type": "range",
118
- "id": "padding-inline-end",
119
- "label": "Direita",
120
- "min": 0,
121
- "max": 100,
122
- "step": 2,
123
- "unit": "px",
124
- "default": 0
125
- }
126
- ],
127
- "presets": [
128
- {
129
- "name": "RK | Ícone",
130
- "category": "Rook UI"
131
- }
132
- ]
133
- }
134
- {% endschema %}