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.
- checksums.yaml +4 -4
- data/app/components/lookbook/button/component.html.erb +2 -2
- data/app/components/lookbook/copy_button/component.html.erb +1 -1
- data/app/components/lookbook/debug_menu/component.html.erb +2 -2
- data/app/components/lookbook/dimensions_display/component.html.erb +4 -4
- data/app/components/lookbook/embed/inspector/component.html.erb +2 -2
- data/app/components/lookbook/filter/component.html.erb +4 -4
- data/app/components/lookbook/header/component.html.erb +3 -3
- data/app/components/lookbook/icon_button/component.rb +1 -1
- data/app/components/lookbook/nav/component.html.erb +1 -1
- data/app/components/lookbook/nav/item/component.js +1 -1
- data/app/components/lookbook/params/editor/component.html.erb +1 -1
- data/app/components/lookbook/split_layout/component.html.erb +1 -1
- data/app/components/lookbook/tabs/dropdown_tab/component.html.erb +1 -1
- data/app/components/lookbook/tabs/tab/component.html.erb +2 -2
- data/app/components/lookbook/text_button/component.rb +1 -1
- data/app/components/lookbook/viewport/component.html.erb +8 -8
- data/app/views/layouts/lookbook/application.html.erb +8 -8
- data/app/views/layouts/lookbook/embed.html.erb +2 -2
- data/app/views/lookbook/inspector/inputs/_color.html.erb +2 -2
- data/app/views/lookbook/inspector/inputs/_text_two_step.html.erb +3 -3
- data/app/views/lookbook/inspector/inputs/_toggle.html.erb +1 -1
- data/app/views/lookbook/inspector/panels/_output.html.erb +2 -2
- data/app/views/lookbook/inspector/show.html.erb +6 -6
- data/lib/lookbook/entities/rendered_scenario_entity.rb +7 -2
- data/lib/lookbook/file_watcher.rb +0 -6
- data/lib/lookbook/services/tags/tag_options_parser.rb +13 -4
- data/lib/lookbook/tags/param_tag.rb +7 -4
- data/lib/lookbook/tags/yard_tag.rb +3 -2
- data/lib/lookbook/version.rb +1 -1
- data/public/lookbook-assets/js/index.js +1455 -901
- data/public/lookbook-assets/js/index.js.map +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 23c9ebbf01e8228763851357baeb33218efefdeebbe03f1ffe9be340ad9e22d8
         | 
| 4 | 
            +
              data.tar.gz: 0af47c23f936c11f782d611f52e113f006ba323afd61d3f6c7598cea9ac7ee0c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
              " | 
| 6 | 
            -
              " | 
| 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 | 
            -
              " | 
| 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 | 
            -
                         | 
| 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 | 
            -
                       | 
| 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 | 
            -
              " | 
| 4 | 
            -
              " | 
| 5 | 
            -
              " | 
| 6 | 
            -
              " | 
| 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 | 
            -
                   | 
| 56 | 
            -
                   | 
| 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 | 
            -
                   | 
| 11 | 
            -
                   | 
| 12 | 
            -
                   | 
| 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"  | 
| 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 | 
            -
                      " | 
| 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 | 
            -
                      " | 
| 49 | 
            +
                      "x-on:click.stop": "toggleSidebar",
         | 
| 50 50 | 
             
                      "x-show": "$store.layout.mobile && !sidebarHidden",
         | 
| 51 | 
            -
                      " | 
| 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 | 
             
            <%= 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 | 
            -
              " | 
| 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 | 
            -
              " | 
| 19 | 
            -
              " | 
| 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 | 
             
              },
         | 
| @@ -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 | 
            -
                     | 
| 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 | 
            -
                         | 
| 41 | 
            -
                         | 
| 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 | 
            -
                         | 
| 51 | 
            -
                         | 
| 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 | 
            -
                         | 
| 61 | 
            -
                         | 
| 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 | 
            -
                 | 
| 7 | 
            -
                 | 
| 8 | 
            -
                 | 
| 9 | 
            -
                 | 
| 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 | 
            -
                      " | 
| 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 | 
            -
                                      " | 
| 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 | 
            -
                                      " | 
| 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">
         | 
| @@ -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  | 
| 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 | 
            -
                  " | 
| 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 | 
            -
                  " | 
| 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 | 
            -
              " | 
| 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. | 
| 3 | 
            +
                <% scenarios.each do |scenario| -%><%== "<!-- #{scenario.label} -->\n#{scenario.beautified_output}\n\n" -%><% end %>
         | 
| 4 4 | 
             
              <%- else -%>
         | 
| 5 | 
            -
                <%== scenarios.first. | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                          " | 
| 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 | 
            -
                 | 
| 27 | 
            -
             | 
| 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 | 
            -
                  @ | 
| 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 | 
            -
                   | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 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 | 
            -
                   | 
| 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 | 
            -
                  { | 
| 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]
         | 
    
        data/lib/lookbook/version.rb
    CHANGED