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,48 @@
1
+ {%- doc -%}
2
+ Renders CSS variables for size (width/height) styles with responsive support.
3
+ Portable equivalent of Horizon's `size-style.liquid` with `rk-` prefixed variables.
4
+ Intended for blocks and sections that provide values for all the referenced settings.
5
+
6
+ @param {object} settings - The block or section settings object containing size values
7
+
8
+ Settings keys used:
9
+ - settings.width: 'fill' | 'fit-content' | 'custom' | CSS value
10
+ - settings.custom_width: number (percentage when width == 'custom')
11
+ - settings.height: 'fill' | 'fit-content' | 'custom' | CSS value
12
+ - settings.custom_height: number (percentage when height == 'custom')
13
+ - settings.width_mobile: 'fill' | 'fit-content' | 'custom' (optional, mobile override)
14
+ - settings.custom_width_mobile: number (percentage when width_mobile == 'custom')
15
+
16
+ @example
17
+ <div class="rk-size-style" style="{% render 'rk-size-style', settings: block.settings %}">
18
+ {%- enddoc -%}
19
+
20
+ {%- comment -%}--- Width ---{%- endcomment -%}
21
+ {%- if settings.width == 'custom' -%}
22
+ --rk-width: {{ settings.custom_width }}%;
23
+ {%- elsif settings.width == 'fill' -%}
24
+ --rk-width: 100%;
25
+ {%- elsif settings.width != blank -%}
26
+ --rk-width: {{ settings.width }};
27
+ {%- endif -%}
28
+
29
+ {%- comment -%}--- Height ---{%- endcomment -%}
30
+ {%- if settings.height == 'custom' -%}
31
+ --rk-height: {{ settings.custom_height }}%;
32
+ {%- elsif settings.height == 'fill' -%}
33
+ --rk-height: 100%;
34
+ {%- elsif settings.height != blank -%}
35
+ --rk-height: {{ settings.height }};
36
+ {%- endif -%}
37
+
38
+ {%- comment -%}--- Width Mobile ---{%- endcomment -%}
39
+ {%- if settings.width_mobile == 'custom' -%}
40
+ --rk-width-mobile: {{ settings.custom_width_mobile }}%;
41
+ --rk-width-mobile-min: {{ settings.custom_width_mobile }}%;
42
+ {%- elsif settings.width_mobile == 'fill' -%}
43
+ --rk-width-mobile: 100%;
44
+ --rk-width-mobile-min: 5rem;
45
+ {%- elsif settings.width_mobile == 'fit-content' -%}
46
+ --rk-width-mobile: fit-content;
47
+ --rk-width-mobile-min: fit-content;
48
+ {%- endif -%}
@@ -0,0 +1,25 @@
1
+ {% doc %}
2
+ Snippet: RkSkeleton
3
+ Renders a loading placeholder skeleton.
4
+
5
+ @param {string} [width] - CSS width (default: '100%')
6
+ @param {string} [height] - CSS height (default: '1em')
7
+ @param {string} [shape] - 'text' | 'circle' | 'rect' (default: 'text')
8
+ @param {string} [custom_class] - Extra CSS classes
9
+
10
+ @example
11
+ {% render 'rk-skeleton', width: '200px', height: '20px' %}
12
+ {% render 'rk-skeleton', shape: 'circle', width: '48px', height: '48px' %}
13
+ {% enddoc %}
14
+
15
+ {%- liquid
16
+ assign sk_width = width | default: '100%'
17
+ assign sk_height = height | default: '1em'
18
+ assign sk_shape = shape | default: 'text'
19
+ -%}
20
+
21
+ <div
22
+ class="rk-skeleton{% if sk_shape == 'circle' %} rk-skeleton--circle{% elsif sk_shape == 'text' %} rk-skeleton--text{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
23
+ style="width: {{ sk_width }}; height: {{ sk_height }};"
24
+ aria-hidden="true"
25
+ ></div>
@@ -0,0 +1,18 @@
1
+ {%- doc -%}
2
+ Renders CSS variables for simple padding styles without responsive scaling.
3
+ Portable equivalent of Horizon's `spacing-padding.liquid` with `rk-` prefixed variables.
4
+ Use this for simpler cases where responsive scaling is not needed.
5
+
6
+ @param {object} settings - The block or section settings object containing padding values
7
+
8
+ Settings keys used:
9
+ - settings['padding-block-start']: number (px, default: 0)
10
+ - settings['padding-block-end']: number (px, default: 0)
11
+ - settings['padding-inline-start']: number (px, default: 0)
12
+ - settings['padding-inline-end']: number (px, default: 0)
13
+
14
+ @example
15
+ <div style="{% render 'rk-spacing-padding', settings: section.settings %}">
16
+ {%- enddoc -%}
17
+
18
+ --rk-pt: {{ settings.padding-block-start | default: 0 }}px; --rk-pb: {{ settings.padding-block-end | default: 0 }}px; --rk-ps: {{ settings.padding-inline-start | default: 0 }}px; --rk-pe: {{ settings.padding-inline-end | default: 0 }}px;
@@ -0,0 +1,54 @@
1
+ {%- doc -%}
2
+ Renders CSS variables for spacing (padding) styles with responsive scaling.
3
+ Portable equivalent of Horizon's `spacing-style.liquid` with `rk-` prefixed variables.
4
+ Intended for blocks and sections that provide values for all the referenced settings.
5
+
6
+ Values above `scale_min` (default: 20px) are wrapped in a responsive `max()` function
7
+ that scales down proportionally on smaller viewports using `--rk-spacing-scale`.
8
+
9
+ @param {object} settings - The block or section settings object containing spacing values
10
+
11
+ Settings keys used:
12
+ - settings['padding-block-start']: number (px)
13
+ - settings['padding-block-end']: number (px)
14
+ - settings['padding-inline-start']: number (px)
15
+ - settings['padding-inline-end']: number (px)
16
+
17
+ CSS Variables generated:
18
+ - --rk-pt (padding-block-start)
19
+ - --rk-pb (padding-block-end)
20
+ - --rk-ps (padding-inline-start)
21
+ - --rk-pe (padding-inline-end)
22
+
23
+ @example
24
+ <div class="rk-spacing-style" style="{% render 'rk-spacing-style', settings: block.settings %}">
25
+ {%- enddoc -%}
26
+
27
+ {%- liquid
28
+ assign rk_scale_min = 20
29
+ assign rk_keys = 'padding-block-start,padding-block-end,padding-inline-start,padding-inline-end' | split: ','
30
+ assign rk_vars = '--rk-pt,--rk-pb,--rk-ps,--rk-pe' | split: ','
31
+
32
+ for key in rk_keys
33
+ assign value = settings[key]
34
+ assign var_name = rk_vars[forloop.index0]
35
+
36
+ if value != blank
37
+ echo var_name
38
+ echo ': '
39
+
40
+ if value > rk_scale_min
41
+ echo 'max('
42
+ echo rk_scale_min
43
+ echo 'px, calc(var(--rk-spacing-scale, 1) * '
44
+ echo value
45
+ echo 'px))'
46
+ else
47
+ echo value
48
+ echo 'px'
49
+ endif
50
+
51
+ echo ';'
52
+ endif
53
+ endfor
54
+ -%}
@@ -0,0 +1,43 @@
1
+ {% doc %}
2
+ Snippet: RkSpinner
3
+ Elemento gráfico animado em SVG para indicar processamento em andamento.
4
+
5
+ @param {string} [size] - Define o tamanho do spinner: 'sm', 'md' (padrão), 'lg'.
6
+ @param {string} [color] - Cor CSS/Utilitária para o spinner. Por padrão herda `currentColor`.
7
+ @param {string} [custom_class] - Classes CSS extras para o container.
8
+ @param {string} [label] - Texto para acessibilidade (Screen Readers). Padrão: "Carregando...".
9
+
10
+ @example
11
+ <!-- Uso básico -->
12
+ {% render 'rk-spinner' %}
13
+
14
+ <!-- Pequeno dentro de um botão -->
15
+ <button class="rk-button">
16
+ {% render 'rk-spinner', size: 'sm', custom_class: 'mr-2' %}
17
+ Salvando
18
+ </button>
19
+ {% enddoc %}
20
+
21
+ {%- liquid
22
+ assign t_size = size | default: 'md'
23
+ assign t_label = label | default: 'Carregando...'
24
+ -%}
25
+
26
+ <span role="status" class="rk-spinner-wrapper{% if custom_class %} {{ custom_class }}{% endif %}">
27
+ <svg
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ width="24"
30
+ height="24"
31
+ viewBox="0 0 24 24"
32
+ fill="none"
33
+ stroke="currentColor"
34
+ stroke-width="2"
35
+ stroke-linecap="round"
36
+ stroke-linejoin="round"
37
+ class="rk-spinner rk-spinner--{{ t_size }}{% if color %} {{ color }}{% endif %}"
38
+ aria-hidden="true"
39
+ >
40
+ <path d="M21 12a9 9 0 1 1-6.219-8.56"></path>
41
+ </svg>
42
+ <span class="rk-sr-only">{{ t_label }}</span>
43
+ </span>
@@ -0,0 +1,33 @@
1
+ {% doc %}
2
+ Snippet: RkSwatch
3
+ Renders a variant swatch (color, image or unavailable).
4
+
5
+ @param {object} swatch - Shopify swatch object
6
+ @param {object} [variant_image] - Alternative image to use
7
+ @param {boolean} [active] - Currently selected
8
+ @param {boolean} [unavailable] - Unavailable state
9
+ @param {string} [custom_class] - Extra CSS classes
10
+
11
+ @example
12
+ {% render 'rk-swatch', swatch: swatch, active: true %}
13
+ {% enddoc %}
14
+
15
+ {%- liquid
16
+ assign swatch_value = null
17
+
18
+ if variant_image
19
+ assign swatch_url = variant_image | image_url: width: 64
20
+ assign swatch_value = 'url(' | append: swatch_url | append: ')'
21
+ elsif swatch.image
22
+ assign swatch_url = swatch.image | image_url: width: 80
23
+ assign swatch_value = 'url(' | append: swatch_url | append: ')'
24
+ elsif swatch.color
25
+ assign swatch_value = 'rgb(' | append: swatch.color.rgb | append: ')'
26
+ endif
27
+ -%}
28
+
29
+ <span
30
+ class="rk-swatch{% if active %} rk-swatch--active{% endif %}{% if unavailable %} rk-swatch--unavailable{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
31
+ style="--rk-swatch-bg: {{ swatch_value }};"
32
+ >
33
+ </span>
@@ -0,0 +1,44 @@
1
+ {% doc %}
2
+ Snippet: RkTable
3
+ Renders a responsive Table component (Shadcn/UI pattern).
4
+ The snippet acts as a wrapper to manage horizontal scrolling on mobile,
5
+ while you write the semantic HTML inside it.
6
+
7
+ @param {string} content - HTML containing <thead>, <tbody>, etc.
8
+ @param {boolean} [striped] - Add alternating row colors (default: false)
9
+ @param {string} [custom_class] - Extra CSS classes for the wrapper
10
+
11
+ @example
12
+ {% capture table_content %}
13
+ <thead>
14
+ <tr>
15
+ <th>Fatura</th>
16
+ <th>Status</th>
17
+ <th>Método</th>
18
+ <th class="rk-text-right">Valor</th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <tr>
23
+ <td>INV001</td>
24
+ <td>Paga</td>
25
+ <td>Cartão de Crédito</td>
26
+ <td class="rk-text-right">R$ 250,00</td>
27
+ </tr>
28
+ <tr>
29
+ <td>INV002</td>
30
+ <td>Pendente</td>
31
+ <td>Pix</td>
32
+ <td class="rk-text-right">R$ 150,00</td>
33
+ </tr>
34
+ </tbody>
35
+ {% endcapture %}
36
+
37
+ {% render 'rk-table', content: table_content, striped: true %}
38
+ {% enddoc %}
39
+
40
+ <div class="rk-table-wrapper{% if custom_class %} {{ custom_class }}{% endif %}">
41
+ <table class="rk-table{% if striped %} rk-table--striped{% endif %}">
42
+ {{ content }}
43
+ </table>
44
+ </div>
@@ -0,0 +1,52 @@
1
+ {% doc %}
2
+ Snippet: RkTabs
3
+ Renders a Tabs wrapper (Shadcn/UI pattern).
4
+ The snippet manages the Web Component wrapper and the basic layout.
5
+ You need to provide the raw HTML for triggers (buttons) and content (panels)
6
+ following the WAI-ARIA specs (roles and aria-attributes).
7
+
8
+ @param {string} id - Unique tabs id (for prefixing triggers/panels)
9
+ @param {string} triggers - HTML for the tab triggers ([role="tab"])
10
+ @param {string} content - HTML for the tab panels ([role="tabpanel"])
11
+ @param {string} [default_value] - ID of the tab to open by default
12
+ @param {string} [orientation] - 'horizontal' (default) or 'vertical'
13
+ @param {string} [custom_class] - Extra CSS classes
14
+
15
+ @example
16
+ {% capture tabs_triggers %}
17
+ <button class="rk-tabs__trigger" role="tab" aria-controls="panel-1" id="tab-1">Descrição</button>
18
+ <button class="rk-tabs__trigger" role="tab" aria-controls="panel-2" id="tab-2">Especificações</button>
19
+ {% endcapture %}
20
+
21
+ {% capture tabs_content %}
22
+ <div class="rk-tabs__panel" role="tabpanel" id="panel-1" aria-labelledby="tab-1">
23
+ <p>Texto da descrição aqui.</p>
24
+ </div>
25
+ <div class="rk-tabs__panel" role="tabpanel" id="panel-2" aria-labelledby="tab-2" hidden>
26
+ <p>Detalhes técnicos aqui.</p>
27
+ </div>
28
+ {% endcapture %}
29
+
30
+ {% render 'rk-tabs', id: 'product-tabs', triggers: tabs_triggers, content: tabs_content, default_value: 'tab-1' %}
31
+ {% enddoc %}
32
+
33
+ {%- liquid
34
+ assign t_orientation = orientation | default: 'horizontal'
35
+ -%}
36
+
37
+ <rk-tabs-element
38
+ id="{{ id | default: 'rk-tabs' }}"
39
+ data-default-value="{{ default_value }}"
40
+ data-orientation="{{ t_orientation }}"
41
+ class="rk-tabs rk-tabs--{{ t_orientation }}{% if custom_class %} {{ custom_class }}{% endif %}"
42
+ >
43
+ {%- comment -%} Tab List {%- endcomment -%}
44
+ <div class="rk-tabs__list" role="tablist" aria-orientation="{{ t_orientation }}">
45
+ {{ triggers }}
46
+ </div>
47
+
48
+ {%- comment -%} Tab Panels {%- endcomment -%}
49
+ <div class="rk-tabs__content-wrapper">
50
+ {{ content }}
51
+ </div>
52
+ </rk-tabs-element>
@@ -0,0 +1,42 @@
1
+ {% doc %}
2
+ Snippet: RkTextarea
3
+ Campo de entrada de texto com múltiplas linhas (textarea), seguindo o estilo base (Shadcn/UI).
4
+
5
+ @param {string} [id] - ID único para o campo, vinculando-o ao Label.
6
+ @param {string} [name] - Nome do campo no formulário.
7
+ @param {string} [placeholder] - Texto de dica (placeholder).
8
+ @param {string} [value] - Valor inicial.
9
+ @param {number} [rows] - Quantidade de linhas visíveis (altura inicial). Padrão: 3.
10
+ @param {string} [resize] - Propriedade de redimensionamento ('none', 'vertical', 'both'). Padrão: 'vertical'.
11
+ @param {boolean} [required] - Se o campo é obrigatório.
12
+ @param {boolean} [disabled] - Se o campo está desabilitado.
13
+ @param {boolean} [readonly] - Se o campo é somente leitura.
14
+ @param {boolean} [has_error] - Define estilo de erro na borda se `true`.
15
+ @param {string} [custom_class] - Classes CSS customizadas.
16
+
17
+ @example
18
+ {% render 'rk-textarea',
19
+ id: 'contact_message',
20
+ name: 'contact[body]',
21
+ placeholder: 'Digite sua mensagem aqui...',
22
+ rows: 4,
23
+ required: true
24
+ %}
25
+ {% enddoc %}
26
+
27
+ {%- liquid
28
+ assign t_rows = rows | default: 3
29
+ assign t_resize = resize | default: 'vertical'
30
+ -%}
31
+
32
+ <textarea
33
+ {% if id %}id="{{ id }}"{% endif %}
34
+ {% if name %}name="{{ name }}"{% endif %}
35
+ class="rk-textarea rk-textarea--resize-{{ t_resize }}{% if has_error %} rk-textarea--error{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
36
+ rows="{{ t_rows }}"
37
+ {% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
38
+ {% if required %}required aria-required="true"{% endif %}
39
+ {% if disabled %}disabled aria-disabled="true"{% endif %}
40
+ {% if readonly %}readonly{% endif %}
41
+ {% if has_error %}aria-invalid="true"{% endif %}
42
+ >{{ value }}</textarea>
@@ -0,0 +1,27 @@
1
+ {% doc %}
2
+ Snippet: RkToggleGroup
3
+ Renders a Toggle Group that manages multiple <rk-toggle-element>.
4
+ Uses <rk-toggle-group> Web Component.
5
+
6
+ @param {string} type - 'single' or 'multiple' (default: 'single')
7
+ @param {string} toggles - The rendered HTML of the <rk-toggle-element>s
8
+ @param {string} [custom_class] - Extra CSS classes
9
+
10
+ @example
11
+ {% capture group_toggles %}
12
+ {% render 'rk-toggle', value: 'b', text: 'B', variant: 'outline', pressed: true %}
13
+ {% render 'rk-toggle', value: 'i', text: 'I', variant: 'outline' %}
14
+ {% render 'rk-toggle', value: 'u', text: 'U', variant: 'outline' %}
15
+ {% endcapture %}
16
+
17
+ {% render 'rk-toggle-group', type: 'multiple', toggles: group_toggles %}
18
+ {% enddoc %}
19
+
20
+ <rk-toggle-group
21
+ data-type="{{ type | default: 'single' }}"
22
+ role="group"
23
+ dir="ltr"
24
+ class="rk-toggle-group{% if custom_class %} {{ custom_class }}{% endif %}"
25
+ >
26
+ {{ toggles }}
27
+ </rk-toggle-group>
@@ -0,0 +1,58 @@
1
+ {% doc %}
2
+ Snippet: RkToggle
3
+ Renders a Toggle button (two-state switch).
4
+ Uses <rk-toggle-element> Web Component.
5
+
6
+ @param {string} value - The value when pressed
7
+ @param {string} [id] - Unique id
8
+ @param {string} [text] - Text label
9
+ @param {string} [icon] - HTML for the icon (usually an SVG)
10
+ @param {string} [variant] - 'default' or 'outline' (default: 'default')
11
+ @param {string} [size] - 'sm', 'md', 'lg' (default: 'md')
12
+ @param {boolean} [pressed] - Set true if it should start pressed
13
+ @param {boolean} [disabled] - Set
14
+ @param {string} [aria_label] - Required if only icon is used
15
+ @param {string} [custom_class] - Extra CSS classes
16
+
17
+ @example
18
+ {% render 'rk-toggle', icon: my_bold_svg, aria_label: 'Bold', pressed: true %}
19
+ {% enddoc %}
20
+
21
+ {%- liquid
22
+ assign t_variant = variant | default: 'default'
23
+ assign t_size = size | default: 'md'
24
+ assign t_pressed = pressed | default: false
25
+
26
+ capture class_list
27
+ echo 'rk-toggle'
28
+ echo ' rk-toggle--' | append: t_variant
29
+ echo ' rk-toggle--' | append: t_size
30
+ if t_pressed
31
+ echo ' rk-toggle--on'
32
+ else
33
+ echo ' rk-toggle--off'
34
+ endif
35
+ if custom_class
36
+ echo ' ' | append: custom_class
37
+ endif
38
+ endcapture
39
+ -%}
40
+
41
+ <rk-toggle-element data-value="{{ value | escape }}">
42
+ <button
43
+ type="button"
44
+ class="{{ class_list | strip_newlines }}"
45
+ {% if id %}id="{{ id }}"{% endif %}
46
+ {% if disabled %}disabled aria-disabled="true"{% endif %}
47
+ aria-pressed="{{ t_pressed | downcase }}"
48
+ {% if aria_label %}aria-label="{{ aria_label }}"{% endif %}
49
+ >
50
+ {%- if icon -%}
51
+ <span class="rk-toggle__icon">{{ icon }}</span>
52
+ {%- endif -%}
53
+
54
+ {%- if text -%}
55
+ <span class="rk-toggle__text">{{ text }}</span>
56
+ {%- endif -%}
57
+ </button>
58
+ </rk-toggle-element>
@@ -0,0 +1,27 @@
1
+ {% doc %}
2
+ Snippet: RkTypography
3
+ Renders a text element with configurable scale, weight and alignment.
4
+
5
+ @param {string} text - The text content (HTML safe)
6
+ @param {string} [tag] - HTML tag (default: 'p')
7
+ @param {string} [size] - 'xs'|'sm'|'md'|'lg'|'xl'|'2xl'|'3xl'|'4xl' (default: 'md')
8
+ @param {string} [align] - 'center' | 'right'
9
+ @param {boolean} [muted] - Muted color
10
+ @param {boolean} [bold] - Bold weight
11
+ @param {boolean} [uppercase] - Uppercase text
12
+ @param {string} [custom_class] - Extra CSS classes
13
+
14
+ @example
15
+ {% render 'rk-typography', text: 'Hello', tag: 'h2', size: '2xl', bold: true %}
16
+ {% enddoc %}
17
+
18
+ {%- liquid
19
+ assign el = tag | default: 'p'
20
+ assign t_size = size | default: 'md'
21
+ -%}
22
+
23
+ <{{ el }}
24
+ class="rk-typography rk-typography--{{ t_size }}{% if align %} rk-typography--{{ align }}{% endif %}{% if muted %} rk-typography--muted{% endif %}{% if bold %} rk-typography--bold{% endif %}{% if uppercase %} rk-typography--uppercase{% endif %}{% if custom_class %} {{ custom_class }}{% endif %}"
25
+ >
26
+ {{ text }}
27
+ </{{ el }}>
@@ -0,0 +1,74 @@
1
+ {% comment %}
2
+ Rook UI Core Framework — CSS Variables (Liquid → CSS)
3
+ =====================================================
4
+ Este snippet gera todas as CSS custom properties dinâmicas do framework,
5
+ populadas a partir das settings globais do tema (rk-settings_schema.json).
6
+
7
+ Deve ser renderizado no <head> do layout/theme.liquid:
8
+ {% render 'rk-variables' %}
9
+
10
+ Segue o mesmo padrão do Horizon (theme-styles-variables.liquid) usando
11
+ a tag {% style %} para injeção inline de CSS com acesso às settings.
12
+ {% endcomment %}
13
+
14
+ {% style %}
15
+ :root {
16
+ /* ================================================================
17
+ CORES — Dinâmicas via Theme Settings
18
+ ================================================================ */
19
+
20
+ /* Primárias */
21
+ --rk-color-primary: {{ settings.rk_color_primary }};
22
+ --rk-color-primary-hover: {{ settings.rk_color_primary_hover }};
23
+ --rk-color-primary-foreground: {{ settings.rk_color_primary_foreground }};
24
+
25
+ /* Secundárias */
26
+ --rk-color-secondary: {{ settings.rk_color_secondary }};
27
+ --rk-color-secondary-hover: {{ settings.rk_color_secondary_hover }};
28
+
29
+ /* Fundos */
30
+ --rk-color-bg: {{ settings.rk_color_background }};
31
+ --rk-color-bg-secondary: {{ settings.rk_color_background_secondary }};
32
+
33
+ /* Semânticas */
34
+ --rk-color-success: {{ settings.rk_color_success }};
35
+ --rk-color-danger: {{ settings.rk_color_danger }};
36
+ --rk-color-destructive: {{ settings.rk_color_danger }};
37
+
38
+ /* Texto */
39
+ --rk-color-text: {{ settings.rk_color_text }};
40
+ --rk-color-text-muted: {{ settings.rk_color_text_muted }};
41
+
42
+ /* Bordas e Foco */
43
+ --rk-color-border: {{ settings.rk_color_border }};
44
+ --rk-color-ring: {{ settings.rk_color_ring }};
45
+
46
+ {%- comment -%}
47
+ Gerar a versão RGB das cores de borda para uso com opacity.
48
+ Ex: rgb(var(--rk-color-border-rgb) / 0.5)
49
+ {%- endcomment -%}
50
+ {%- assign rk_border_color = settings.rk_color_border -%}
51
+ --rk-color-border-rgb: {{ rk_border_color.red }} {{ rk_border_color.green }} {{ rk_border_color.blue }};
52
+
53
+ {%- assign rk_text_color = settings.rk_color_text -%}
54
+ --rk-color-text-rgb: {{ rk_text_color.red }} {{ rk_text_color.green }} {{ rk_text_color.blue }};
55
+
56
+ /* Hover de borda (derivado) */
57
+ --rk-color-border-hover: rgb({{ rk_text_color.red }} {{ rk_text_color.green }} {{ rk_text_color.blue }} / 0.3);
58
+
59
+ /* ================================================================
60
+ FORMA — Border Radius dinâmico
61
+ ================================================================ */
62
+ --rk-radius: {{ settings.rk_border_radius }}px;
63
+ --rk-radius-sm: {{ settings.rk_border_radius_sm }}px;
64
+ --rk-radius-lg: {{ settings.rk_border_radius_lg }}px;
65
+ --rk-radius-pill: {{ settings.rk_border_radius_pill }}px;
66
+ --rk-radius-md: {{ settings.rk_border_radius }}px;
67
+
68
+ /* ================================================================
69
+ TRANSIÇÃO — Velocidade dinâmica
70
+ ================================================================ */
71
+ --rk-transition-speed: {{ settings.rk_transition_speed }}ms;
72
+ --rk-transition: var(--rk-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
73
+ }
74
+ {% endstyle %}
package/src/app.js CHANGED
@@ -22,6 +22,8 @@ import { AddCommand } from './commands/AddCommand.js';
22
22
  import { ConfigCommand } from './commands/ConfigCommand.js';
23
23
  import { GenerateCommand } from './commands/GenerateCommand.js';
24
24
  import { ScaffoldService } from './services/ScaffoldService.js';
25
+ import { FrameworkInstaller } from './services/FrameworkInstaller.js';
26
+ import { InstallCommand } from './commands/InstallCommand.js';
25
27
  import { CLI_NAME } from './config/constants.js';
26
28
 
27
29
  export class App {
@@ -61,6 +63,14 @@ export class App {
61
63
  this.scaffoldService,
62
64
  this.conflictResolver
63
65
  );
66
+
67
+ this.frameworkInstaller = new FrameworkInstaller(this.logger);
68
+
69
+ this.installCommand = new InstallCommand(
70
+ this.logger,
71
+ this.promptUI,
72
+ this.frameworkInstaller
73
+ );
64
74
  }
65
75
 
66
76
  /**
@@ -108,6 +118,20 @@ export class App {
108
118
  await this.generateCommand.executar(nome, opcoes);
109
119
  });
110
120
 
121
+ // Comando: rook install
122
+ this.programa
123
+ .command('install')
124
+ .alias('i')
125
+ .description('Instala o Rook UI Core Framework no tema Shopify')
126
+ .option('--path <dir>', 'Diretório do tema Shopify (padrão: diretório atual)')
127
+ .option('--force', 'Sobrescreve arquivos sem perguntar')
128
+ .option('--skip-layout', 'Não modifica o theme.liquid')
129
+ .option('--skip-settings', 'Não modifica o settings_schema.json')
130
+ .action(async (opcoes) => {
131
+ this.logger.banner();
132
+ await this.installCommand.executar(opcoes);
133
+ });
134
+
111
135
  // Comando padrão (sem argumentos) — abre o menu interativo
112
136
  this.programa
113
137
  .action(async () => {