lookbook 2.0.2 → 2.0.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/components/lookbook/button/component.html.erb +2 -2
  3. data/app/components/lookbook/copy_button/component.html.erb +1 -1
  4. data/app/components/lookbook/debug_menu/component.html.erb +2 -2
  5. data/app/components/lookbook/dimensions_display/component.html.erb +4 -4
  6. data/app/components/lookbook/embed/inspector/component.html.erb +2 -2
  7. data/app/components/lookbook/filter/component.html.erb +4 -4
  8. data/app/components/lookbook/header/component.html.erb +3 -3
  9. data/app/components/lookbook/icon_button/component.rb +1 -1
  10. data/app/components/lookbook/nav/component.html.erb +1 -1
  11. data/app/components/lookbook/nav/item/component.js +1 -1
  12. data/app/components/lookbook/params/editor/component.html.erb +1 -1
  13. data/app/components/lookbook/split_layout/component.html.erb +1 -1
  14. data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +1 -1
  15. data/app/components/lookbook/tabs/tab/component.html.erb +2 -2
  16. data/app/components/lookbook/text_button/component.rb +1 -1
  17. data/app/components/lookbook/viewport/component.html.erb +8 -8
  18. data/app/views/layouts/lookbook/application.html.erb +8 -8
  19. data/app/views/layouts/lookbook/embed.html.erb +2 -2
  20. data/app/views/lookbook/inspector/inputs/_color.html.erb +2 -2
  21. data/app/views/lookbook/inspector/inputs/_text_two_step.html.erb +3 -3
  22. data/app/views/lookbook/inspector/inputs/_toggle.html.erb +1 -1
  23. data/app/views/lookbook/inspector/panels/_output.html.erb +2 -2
  24. data/app/views/lookbook/inspector/show.html.erb +6 -6
  25. data/lib/lookbook/entities/rendered_scenario_entity.rb +7 -2
  26. data/lib/lookbook/file_watcher.rb +0 -6
  27. data/lib/lookbook/services/tags/tag_options_parser.rb +13 -4
  28. data/lib/lookbook/tags/param_tag.rb +7 -4
  29. data/lib/lookbook/tags/yard_tag.rb +3 -2
  30. data/lib/lookbook/version.rb +1 -1
  31. data/public/lookbook-assets/js/index.js +1455 -901
  32. data/public/lookbook-assets/js/index.js.map +1 -1
  33. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 367001bca8dd83ecf86085760aaa3befe93665913ada3602c893b5b768700b82
4
- data.tar.gz: 733c573b3380072d0acecb9ce63e50f5a652d75ff649bda983c25935c938464b
3
+ metadata.gz: 23c9ebbf01e8228763851357baeb33218efefdeebbe03f1ffe9be340ad9e22d8
4
+ data.tar.gz: 0af47c23f936c11f782d611f52e113f006ba323afd61d3f6c7598cea9ac7ee0c
5
5
  SHA512:
6
- metadata.gz: afe34ddf105269ad47a25d1f0b208eb7dec1acf7858cde29c1aec9f3a59fcafb99ee17f4f48e7ba3b1aef59ac20aa50e2e0382560862cef334c25605f43130b6
7
- data.tar.gz: ced6d61a75a6e614dba752215f9ff7226c1c10e2c569048a605af35ed5c165129581dd9e8f34362a0d52863fae04143e23ec2615d33afdc027437b4f8ab96393
6
+ metadata.gz: 2c0c8d14d894301fb289defc7f61f1886ec2e2da17d958bafe8e880cbdd6232a44a1d91d2db9ecb37cf970908a4b600d80fba1fdf0199d8dfd2bd0fdf133ad8e
7
+ data.tar.gz: 830455b5818b67bcc5245898ce2e2c0eda5b99117b8fbe2f20898dc839e28a7d8c12901575d31d7653c0daab23aee3fe314c6348746f8e12754b4ed9f7d8599f
@@ -2,8 +2,8 @@
2
2
  id: id,
3
3
  icon: icon,
4
4
  **button_attrs,
5
- "@keydown.esc.stop": "hideDropdown",
6
- "@navigation:complete.window": "updateDropdown") do %>
5
+ "x-on:keydown.esc.stop": "hideDropdown",
6
+ "x-on:navigation:complete.window": "updateDropdown") do %>
7
7
  <%= content %>
8
8
  <% end %>
9
9
 
@@ -2,7 +2,7 @@
2
2
  name: "copy-button",
3
3
  **button_attrs,
4
4
  "x-data": prepare_alpine_data,
5
- "@click.prevent": "copyToClipboard" do |button| %>
5
+ "x-on:click.prevent": "copyToClipboard" do |button| %>
6
6
  <% button.with_icon name: icon, size: icon_size, "x-show": "!copied", cloak: true %>
7
7
  <% button.with_icon name: :check, size: icon_size, class: "text-green-500", "x-show": "copied", cloak: true %>
8
8
  <% if content %>
@@ -6,7 +6,7 @@
6
6
  <a href="#"
7
7
  class="text-xs flex items-center hover:underline"
8
8
  x-data="clipboardComponent"
9
- @click.prevent.stop="copyToClipboard('#debug-data')">
9
+ x-on:click.prevent.stop="copyToClipboard('#debug-data')">
10
10
  <span x-show="copied" x-cloak>
11
11
  <%= icon :check, size: 2.5, class: "text-green-600" %>
12
12
  </span>
@@ -20,7 +20,7 @@
20
20
  <li>
21
21
  <a href="#"
22
22
  class="text-xs flex items-center hover:underline"
23
- @click.stop="localStorage.clear(); window.location.reload();">
23
+ x-on:click.stop="localStorage.clear(); window.location.reload();">
24
24
  <%= icon :refresh_cw, size: 2.5 %>
25
25
  <span class="ml-2">Reset local storage</span>
26
26
  </a>
@@ -1,9 +1,9 @@
1
1
  <%= render_component_tag class: "flex items-center text-xs font-mono space-x-1 transition",
2
2
  ":class":"{'!opacity-100': resizing}",
3
- "@viewport:resize-start.window": "resizing = true",
4
- "@viewport:resize-complete.window": "resizing = false",
5
- "@dom:update-start.window": "tearDown",
6
- "@dom:update-complete.window": "createObserver",
3
+ "x-on:viewport:resize-start.window": "resizing = true",
4
+ "x-on:viewport:resize-complete.window": "resizing = false",
5
+ "x-on:dom:update-start.window": "tearDown",
6
+ "x-on:dom:update-complete.window": "createObserver",
7
7
  "x-show": "target" do %>
8
8
  <span x-text="`${width}px`"></span>
9
9
  <span class="opacity-70">x</span>
@@ -52,8 +52,8 @@
52
52
  style="border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; overflow: hidden;"
53
53
  <% end %>>
54
54
  <div
55
- @viewport:resize-progress="resizeIframe"
56
- @viewport:resize-complete="resizeIframe"
55
+ x-on:viewport:resize-progress="resizeIframe"
56
+ x-on:viewport:resize-complete="resizeIframe"
57
57
  x-ref="viewportWrapper">
58
58
  <%= lookbook_render :viewport,
59
59
  iframe_id: "#{id}-viewport",
@@ -7,10 +7,10 @@
7
7
  x-ref="input"
8
8
  x-model="<%= @model %>"
9
9
  x-effect="$dispatch('filter:change', { text, filter: this })"
10
- @keydown.esc.stop="clear"
11
- @keydown.f.window="if (!($event.shiftKey || $event.metaKey || $event.ctrlKey || $event.altKey)) { focus(); $event.preventDefault(); $event.stopPropagation(); }"
12
- @keydown.stop>
13
- <button class="text-lookbook-icon-button-stroke hover:text-lookbook-icon-button-stroke-hover focus:ring-0 focus:outline-none absolute top-1/2 right-3 -translate-y-1/2" @click="clear" :class="{hidden: !active}">
10
+ x-on:keydown.esc.stop="clear"
11
+ x-on:keydown.f.window="if (!($event.shiftKey || $event.metaKey || $event.ctrlKey || $event.altKey)) { focus(); $event.preventDefault(); $event.stopPropagation(); }"
12
+ x-on:keydown.stop>
13
+ <button class="text-lookbook-icon-button-stroke hover:text-lookbook-icon-button-stroke-hover focus:ring-0 focus:outline-none absolute top-1/2 right-3 -translate-y-1/2" x-on:click="clear" x-bind:class="{hidden: !active}">
14
14
  <%= icon :x, size: 3 %>
15
15
  </button>
16
16
  </div>
@@ -41,14 +41,14 @@
41
41
  <% end %>
42
42
 
43
43
  <% group.with_button icon: :menu,
44
- "@click.stop": "toggleSidebar",
44
+ "x-on:click.stop": "toggleSidebar",
45
45
  "x-show": "$store.layout.mobile && sidebarHidden",
46
46
  class: "!text-lookbook-header-text" %>
47
47
 
48
48
  <% group.with_button icon: :x,
49
- "@click.stop": "toggleSidebar",
49
+ "x-on:click.stop": "toggleSidebar",
50
50
  "x-show": "$store.layout.mobile && !sidebarHidden",
51
- "@keydown.esc.window": "closeMobileSidebar",
51
+ "x-on:keydown.esc.window": "closeMobileSidebar",
52
52
  class: "!text-lookbook-header-text" %>
53
53
  <% end %>
54
54
  <% end %>
@@ -1,6 +1,6 @@
1
1
  module Lookbook
2
2
  class IconButton::Component < Lookbook::BaseComponent
3
- renders_many :icons, Icon::Component
3
+ renders_many :icons, Lookbook::Icon::Component
4
4
 
5
5
  ICON_SIZES = {
6
6
  xs: 3,
@@ -1,5 +1,5 @@
1
1
  <%= render_component_tag class: "flex flex-col overflow-hidden h-full",
2
- "@filter:change.stop": "filter($event.detail.text)" do %>
2
+ "x-on:filter:change.stop": "filter($event.detail.text)" do %>
3
3
 
4
4
  <% if toolbar %>
5
5
  <%= toolbar %>
@@ -58,7 +58,7 @@ export default function navItemComponent({ id, matchers }) {
58
58
 
59
59
  bindings: {
60
60
  toggle: {
61
- ["@click.stop"]: "toggle",
61
+ ["x-on:click.stop"]: "toggle",
62
62
  ["x-ref"]: "toggle",
63
63
  },
64
64
  link: {
@@ -1,6 +1,6 @@
1
1
  <%= render_component_tag class: "overflow-hidden" do %>
2
2
  <div class="bg-lookbook-params-editor-bg border border-lookbook-divider rounded-md overflow-x-auto">
3
- <table class="border-collapse w-full" :class="narrow && 'linear'">
3
+ <table class="border-collapse w-full" x-bind:class="narrow && 'linear'">
4
4
  <thead>
5
5
  <tr>
6
6
  <th class="param-label">Param</th>
@@ -3,7 +3,7 @@
3
3
  <%= pane %>
4
4
  <% if i < panes.size %>
5
5
  <div class="split-layout-gutter bg-lookbook-divider relative z-50" x-init="registerGutter">
6
- <div class="absolute z-10 bg-transparent hover:bg-lookbook-draggable-hint transition-all" :class="{
6
+ <div class="absolute z-10 bg-transparent hover:bg-lookbook-draggable-hint transition-all" x-bind:class="{
7
7
  'w-[9px] h-full -translate-x-1/2 cursor-[col-resize] split-layout-gutter-vertical': vertical,
8
8
  'h-[9px] w-full -translate-y-1/2 cursor-[row-resize] split-layout-gutter-horizontal': horizontal
9
9
  }"></div>
@@ -13,7 +13,7 @@
13
13
  'border-transparent text-lookbook-tabs-text hover:text-lookbook-tabs-text-hover': !isSelected($el),
14
14
  'hidden': visibleTabsCount >= #{@position}
15
15
  }",
16
- "@click.prevent": "selectTab($el)",
16
+ "x-on:click.prevent": "selectTab($el)",
17
17
  data: {
18
18
  disabled: @disabled
19
19
  } do %>
@@ -15,8 +15,8 @@
15
15
  '!text-lookbook-tabs-text-disabled': isDisabled($el),
16
16
  'invisible pointer-events-none relative z-[-1]': visibleTabsCount < #{@position}
17
17
  }",
18
- "@click.prevent": "selectTab($el)",
19
- "@keydown.window.prevent.#{@hotkey}": @hotkey.present? ? "$el.click()" : nil,
18
+ "x-on:click.prevent": "selectTab($el)",
19
+ "x-on:keydown.window.prevent.#{@hotkey}": @hotkey.present? ? "$el.click()" : nil,
20
20
  data: {
21
21
  disabled: @disabled
22
22
  },
@@ -1,6 +1,6 @@
1
1
  module Lookbook
2
2
  class TextButton::Component < Lookbook::BaseComponent
3
- renders_many :icons, Icon::Component
3
+ renders_many :icons, Lookbook::Icon::Component
4
4
 
5
5
  ICON_SIZES = {
6
6
  xs: 3,
@@ -28,17 +28,17 @@
28
28
  <iframe seamless<%= " id=#{@iframe_id}" if @iframe_id.present? %>
29
29
  x-ref="iframe"
30
30
  class="bg-lookbook-page-bg h-full w-full border border-lookbook-divider"
31
- :class="{ 'pointer-events-none': reflowing }"
31
+ x-bind:class="{ 'pointer-events-none': reflowing }"
32
32
  style="<%= "max-height: #{@max_height}px;" if @max_height.present? %>"
33
33
  src="<%= @src %>"
34
34
  frameborder="0"
35
- @load="$dispatch('viewport:loaded', {viewport: this})"
35
+ x-on:load="$dispatch('viewport:loaded', {viewport: this})"
36
36
  title="viewport"></iframe>
37
37
  <% if @resize_width %>
38
38
  <div
39
39
  class="resize-handle border-r border-t border-lookbook-divider cursor-[col-resize] <%= "border-b" unless @resize_height %>"
40
- @pointerdown="onResizeWidthStart"
41
- @dblclick="toggleFullWidth">
40
+ x-on:pointerdown="onResizeWidthStart"
41
+ x-on:dblclick="toggleFullWidth">
42
42
  <svg class="h-4 w-4 pointer-events-none" fill="currentColor" viewBox="0 0 24 24">
43
43
  <path d="M8 5h2v14H8zM14 5h2v14h-2z"></path>
44
44
  </svg>
@@ -47,8 +47,8 @@
47
47
  <% if @resize_height %>
48
48
  <div
49
49
  class="resize-handle border-b border-l border-lookbook-divider cursor-[row-resize] <%= "border-r" unless @resize_width %>"
50
- @pointerdown="onResizeHeightStart"
51
- @dblclick="toggleFullHeight">
50
+ x-on:pointerdown="onResizeHeightStart"
51
+ x-on:dblclick="toggleFullHeight">
52
52
  <svg class="h-4 w-4 pointer-events-none rotate-90" fill="currentColor" viewBox="0 0 24 24" >
53
53
  <path d="M8 5h2v14H8zM14 5h2v14h-2z"></path>
54
54
  </svg>
@@ -57,8 +57,8 @@
57
57
  <% if @resize_height && @resize_width %>
58
58
  <div
59
59
  class="resize-handle border-r border-b border-lookbook-divider cursor-[nwse-resize]"
60
- @pointerdown="onResizeStart"
61
- @dblclick="toggleFullSize">
60
+ x-on:pointerdown="onResizeStart"
61
+ x-on:dblclick="toggleFullSize">
62
62
  <svg class="h-3.5 w-3.5 pointer-events-none rotate-45 relative -top-px -left-px" fill="currentColor" viewBox="0 0 24 24" >
63
63
  <path d="M8 5h2v14H8zM14 5h2v14h-2z"></path>
64
64
  </svg>
@@ -3,10 +3,10 @@
3
3
  id="app"
4
4
  x-data="app"
5
5
  x-cloak
6
- @popstate.window="handleNavigation"
7
- @click.document="hijax"
8
- @navigation:start="closeMobileSidebar"
9
- @dom:update-complete.window="Lookbook.initEmbeds()"
6
+ x-on:popstate.window="handleNavigation"
7
+ x-on:click.document="hijax"
8
+ x-on:navigation:start="closeMobileSidebar"
9
+ x-on:dom:update-complete.window="Lookbook.initEmbeds()"
10
10
  class="w-screen h-screen grid grid-rows-[40px_1fr] relative">
11
11
 
12
12
  <%= render "lookbook/partials/user_styles" %>
@@ -29,7 +29,7 @@
29
29
  'translate-x-full': $store.layout.mobile && sidebarHidden,
30
30
  '!absolute right-0 bottom-0 top-[40px] h-[calc(100%_-_40px)] w-full max-w-[420px] z-[1001] border-l border-lookbook-divider': $store.layout.mobile
31
31
  }",
32
- "@click.outside": "closeMobileSidebar",
32
+ "x-on:click.outside": "closeMobileSidebar",
33
33
  cloak: true do %>
34
34
 
35
35
  <%= lookbook_render :split_layout,
@@ -50,7 +50,7 @@
50
50
  <%= lookbook_render :button_group, size: :xs do |group| %>
51
51
  <% group.with_button icon: :minus_square,
52
52
  tooltip: "Collapse all",
53
- "@click": "closeAll" %>
53
+ "x-on:click": "closeAll" %>
54
54
  <% end %>
55
55
  <% end %>
56
56
  <% end %>
@@ -73,7 +73,7 @@
73
73
  <%= lookbook_render :button_group, size: :xs do |group| %>
74
74
  <% group.with_button icon: :minus_square,
75
75
  tooltip: "Collapse all",
76
- "@click": "closeAll" %>
76
+ "x-on:click": "closeAll" %>
77
77
  <% end %>
78
78
  <% end %>
79
79
  <% end %>
@@ -93,7 +93,7 @@
93
93
  </div>
94
94
  <% end %>
95
95
 
96
- <div class="absolute opacity-0 bg-black inset-0 top-[39px] z-[-1] transition-opacity" :class="($store.layout.mobile && !sidebarHidden) && '!opacity-30 !z-[1000]'" data-cloak></div>
96
+ <div class="absolute opacity-0 bg-black inset-0 top-[39px] z-[-1] transition-opacity" x-bind:class="($store.layout.mobile && !sidebarHidden) && '!opacity-30 !z-[1000]'" data-cloak></div>
97
97
 
98
98
  <% if content_for? :dropdowns %>
99
99
  <div class="hidden">
@@ -3,8 +3,8 @@
3
3
  id="app"
4
4
  x-data="app"
5
5
  x-cloak
6
- @popstate.window="handleNavigation"
7
- @click.document="hijax"
6
+ x-on:popstate.window="handleNavigation"
7
+ x-on:click.document="hijax"
8
8
  class="overflow-hidden">
9
9
 
10
10
  <%= render "lookbook/partials/user_styles" %>
@@ -1,6 +1,6 @@
1
1
  <%= text_field_tag(name, value,
2
2
  **input_options,
3
3
  type: "color",
4
- "@change.stop": "",
5
- "@blur": "value = $el.value",
4
+ "x-on:change.stop": "",
5
+ "x-on:blur": "value = $el.value",
6
6
  ) %>
@@ -1,12 +1,12 @@
1
1
  <div x-data="{changed: false, applyChange(){ this.value = this.$refs.input.value; this.changed = false; }}">
2
2
 
3
- <div @change.stop="changed = ($event.target.value !== value)" class="flex items-center gap-2">
3
+ <div x-on:change.stop="changed = ($event.target.value !== value)" class="flex items-center gap-2">
4
4
  <%= text_field_tag(name, value,
5
5
  **input_options,
6
6
  type: input,
7
7
  class: "flex-grow",
8
8
  "x-ref": "input",
9
- "@keydown.enter.stop": "applyChange"
9
+ "x-on:keydown.enter.stop": "applyChange"
10
10
  ) %>
11
11
 
12
12
  <%= lookbook_render :button,
@@ -14,6 +14,6 @@
14
14
  tooltip: "Apply changes",
15
15
  class: "flex-none !bg-lookbook-button-bg hover:!bg-lookbook-button-bg-hover rounded-md !text-lookbook-button-text",
16
16
  "x-show": "changed",
17
- "@click": "applyChange" %>
17
+ "x-on:click": "applyChange" %>
18
18
  </div>
19
19
  </div>
@@ -15,6 +15,6 @@ span_classes = [
15
15
  class: class_names(button_classes),
16
16
  role: "switch",
17
17
  type: "button",
18
- "@click.stop": "value = value == 'true' ? 'false' : 'true'", escape: false do %>
18
+ "x-on:click.stop": "value = value == 'true' ? 'false' : 'true'", escape: false do %>
19
19
  <%= tag.span "aria-hidden": true, class: class_names(span_classes) %>
20
20
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= lookbook_render :code, line_numbers: true, full_height: true do -%>
2
2
  <% if scenarios.many? -%>
3
- <% scenarios.each do |scenario| -%><%== "<!-- #{scenario.label} -->\n#{scenario.output}\n\n" -%><% end %>
3
+ <% scenarios.each do |scenario| -%><%== "<!-- #{scenario.label} -->\n#{scenario.beautified_output}\n\n" -%><% end %>
4
4
  <%- else -%>
5
- <%== scenarios.first.output -%>
5
+ <%== scenarios.first.beautified_output -%>
6
6
  <%- end %>
7
7
  <% end %>
@@ -55,7 +55,7 @@
55
55
  <% group.with_button id: "refresh-preview-button",
56
56
  icon: :refresh_cw,
57
57
  tooltip: "Refresh preview",
58
- "@click.stop": "startSpin(); $dispatch('viewport:reload'); stopSpin(500);" %>
58
+ "x-on:click.stop": "startSpin(); $dispatch('viewport:reload'); stopSpin(500);" %>
59
59
 
60
60
  <% group.with_button id: "open-preview-button",
61
61
  icon: :external_link,
@@ -66,7 +66,7 @@
66
66
  <% group.with_button id: "show-drawer-button",
67
67
  icon: "sidebar",
68
68
  tooltip: "Show drawer",
69
- "@click": "$store.inspector.drawer.hidden = false",
69
+ "x-on:click": "$store.inspector.drawer.hidden = false",
70
70
  class: "rotate-180",
71
71
  "x-show": "$store.inspector.drawer.hidden && vertical",
72
72
  cloak: true %>
@@ -74,7 +74,7 @@
74
74
  <% group.with_button id: "show-drawer-button",
75
75
  icon: "credit-card",
76
76
  tooltip: "Show drawer",
77
- "@click": "$store.inspector.drawer.hidden = false",
77
+ "x-on:click": "$store.inspector.drawer.hidden = false",
78
78
  class: "rotate-180",
79
79
  "x-show": "$store.inspector.drawer.hidden && !vertical",
80
80
  cloak: true %>
@@ -131,7 +131,7 @@
131
131
  <% group.with_button id: "drawer-to-right-button",
132
132
  icon: :sidebar_open,
133
133
  tooltip: "Pin drawer on right",
134
- "@click": "switchOrientation",
134
+ "x-on:click": "switchOrientation",
135
135
  "x-show": "horizontal",
136
136
  ":class": "{'pointer-events-none opacity-50 !cursor-not-allowed': horizontal && layoutWidth <= $store.inspector.minVerticalSplitWidth}",
137
137
  cloak: true %>
@@ -139,7 +139,7 @@
139
139
  <% group.with_button id: "drawer-to-bottom-button",
140
140
  icon: :sidebar_open,
141
141
  tooltip: "Pin drawer on bottom",
142
- "@click": "switchOrientation",
142
+ "x-on:click": "switchOrientation",
143
143
  "x-show": "vertical",
144
144
  class: "rotate-90",
145
145
  cloak: true %>
@@ -147,7 +147,7 @@
147
147
  <% group.with_button id: "hide-drawer-button",
148
148
  icon: :x_circle,
149
149
  tooltip: "Hide drawer",
150
- "@click": "$store.inspector.drawer.hidden = true",
150
+ "x-on:click": "$store.inspector.drawer.hidden = true",
151
151
  cloak: true %>
152
152
  <% end %>
153
153
  <% end %>
@@ -23,8 +23,13 @@ module Lookbook
23
23
  # HTML output of the rendered scenario.
24
24
  #
25
25
  # @return [String] Rendered output
26
- def output
27
- @_output ||= CodeBeautifier.call(@output)
26
+ attr_reader :output
27
+
28
+ # 'Beautified' HTML output of the rendered scenario.
29
+ #
30
+ # @return [String] Rendered output
31
+ def beautified_output
32
+ @_beautified_output ||= CodeBeautifier.call(output)
28
33
  end
29
34
 
30
35
  # @api private
@@ -2,12 +2,6 @@ module Lookbook
2
2
  class FileWatcher
3
3
  class << self
4
4
  def new(...)
5
- if evented?
6
- Lookbook.logger.debug "Using `EventedFileUpdateChecker` for file watching"
7
- else
8
- Lookbook.logger.debug "The 'listen' gem was not found. Using `FileUpdateChecker` for file watching"
9
- end
10
-
11
5
  file_watcher.new(...)
12
6
  end
13
7
 
@@ -9,19 +9,28 @@ module Lookbook
9
9
 
10
10
  def initialize(input, resolver_opts = {})
11
11
  @input = input.to_s.strip
12
- @resolver_opts = resolver_opts
12
+ @resolve = resolver_opts.fetch(:resolve, true)
13
+ @resolver_opts = resolver_opts.except(:resolve)
13
14
  @fallback = resolver_opts.fetch(:fallback, {})
14
15
  end
15
16
 
16
17
  def call
17
18
  options_string, remaining_text = parse_input(@input)
18
- resolved_options = resolver(options_string).call(options_string, **@resolver_opts)
19
- options = prepare_options(resolved_options)
20
- [options, remaining_text]
19
+ if resolve?
20
+ resolved_options = resolver(options_string).call(options_string, **@resolver_opts)
21
+ options = prepare_options(resolved_options)
22
+ [options, remaining_text]
23
+ else
24
+ [options_string, remaining_text]
25
+ end
21
26
  end
22
27
 
23
28
  protected
24
29
 
30
+ def resolve?
31
+ !!@resolve
32
+ end
33
+
25
34
  def resolver(options_string)
26
35
  if options_string.present?
27
36
  handler = RESOLVERS.find { |r| r.resolveable?(options_string) }
@@ -52,9 +52,7 @@ module Lookbook
52
52
  end
53
53
 
54
54
  # Parse and remove any options from string
55
- text_with_options = text
56
- _, text = parse_options(text)
57
- options_str = text_with_options.sub(text, "")
55
+ options_str, text = parse_options(text, resolve: false)
58
56
 
59
57
  # Parse description, if provided
60
58
  text.match(DESCRIPTION_MATCHER) do |match_data|
@@ -64,7 +62,12 @@ module Lookbook
64
62
 
65
63
  input, rest = text.split(" ", 2)
66
64
 
67
- {input: input, value_type: value_type, description: description, rest: [rest, options_str].compact.join(" ")}
65
+ {
66
+ input: input,
67
+ value_type: value_type,
68
+ description: description,
69
+ rest: [rest, options_str].compact.join(" ")
70
+ }
68
71
  end
69
72
  end
70
73
  end
@@ -78,12 +78,13 @@ module Lookbook
78
78
  host_code_object&.path&.constantize
79
79
  end
80
80
 
81
- def parse_options(input)
81
+ def parse_options(input, resolve: true)
82
82
  if self.class.supports_options?
83
83
  TagOptionsParser.call(input, {
84
84
  file: host_file,
85
85
  base_dir: host_file&.dirname,
86
- eval_context: host_class_instance
86
+ eval_context: host_class_instance,
87
+ resolve: resolve
87
88
  })
88
89
  else
89
90
  [{}, @text]
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.4"
3
3
  end