lookbook 0.3.0.beta.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b0d42f049a62be24079955f108c14f4b7b73b8b0f0a677639cce865e2260006
4
- data.tar.gz: db6d156648495478cdcd55101065cb3875cfbdfb2b9bce3f924e37a11b2b789b
3
+ metadata.gz: 7079abdbe93ab54ba45d95752d1506c90d7aa0734afff9fc4bd947984d2dede9
4
+ data.tar.gz: ff9f78726cb4b6686ced040eca344e8585ea8ec16931d670591692400e7307ff
5
5
  SHA512:
6
- metadata.gz: 15a7f9761f859bfdc9965801aba418e30fc95520635fc1a03dd9ff63af5e73e98563bc8d16420ae705824f18dffcdc9f834b57547815c4ab5cf899aba831e2e3
7
- data.tar.gz: 889cea13089b40fa493c7ca39e6ff871f9db6432b9fffa1b57ab1a3a686b6e04ee2d0e3859093abcea386ccd67e2d7fe3aeaf2acf239632c535332d2a35e2ae3
6
+ metadata.gz: edcf8e461252b4d18101019c6636bb4a2b298691abac0d8154a4eb30a66a8cb836c3b60b9e63533c66753fc336005ef78e9e8cabac11330c3db0447ec22a9475
7
+ data.tar.gz: fd329c551311cf634c92544226fb5c5fe6104146945e1498cae010a18694fba46b01ce0fc3d86ae1a4b9ff51cb9a10030f4223e0fff601d7b081dc687f3b62d5
data/README.md CHANGED
@@ -27,9 +27,9 @@ Lookbook uses [RDoc/Yard-style comment tags](https://rubydoc.info/gems/yard/file
27
27
  - Resizable preview window for responsive testing
28
28
  - Highlighted preview source code and HTML output
29
29
  - Add notes via comments in the preview file (markdown supported)
30
- - Auto-updating UI when component or preview files are updated
31
- - Supports 'hidden' previews and examples
32
- - Works with standard the ViewComponent preview system
30
+ - Auto-updating UI when component or preview files are updated _(Rails v6.0+ only)_
31
+ - Hide, group and rename preview examples using comment tags
32
+ - Fully compatible with standard the ViewComponent preview system
33
33
 
34
34
  ## Lookbook demo
35
35
 
@@ -248,6 +248,8 @@ However the following Lookbook-specific config options are also available:
248
248
 
249
249
  ### UI auto-refresh
250
250
 
251
+ > ⚠️ UI auto-refresh is only supported in Rails v6.0+
252
+
251
253
  Disable/enable the auto-updating of the Lookbook UI when files change. Enabled by default.
252
254
 
253
255
  ```ruby
@@ -21,8 +21,11 @@ export default function () {
21
21
  this.$dispatch("nav:updated");
22
22
  });
23
23
  },
24
- navigate($event) {
25
- history.pushState({}, null, $event.currentTarget.href);
24
+ navigate(path) {
25
+ if (path instanceof Event) {
26
+ path = path.currentTarget.href;
27
+ }
28
+ history.pushState({}, null, path);
26
29
  this.$dispatch("popstate");
27
30
  },
28
31
  focusFilter() {
@@ -89,13 +89,13 @@ module Lookbook
89
89
 
90
90
  def rendered_example
91
91
  if @example.type == :group
92
- rendered = @example.examples.map do |example|
92
+ examples = @example.examples.map do |example|
93
93
  {
94
94
  label: example.label,
95
- content: preview_controller.render_example_to_string(@preview, example.name)
95
+ html: preview_controller.render_example_to_string(@preview, example.name)
96
96
  }
97
97
  end
98
- joined = render_to_string "layouts/group", locals: {items: rendered}, layout: nil
98
+ joined = render_to_string "lookbook/preview_group", locals: {examples: examples}, layout: nil
99
99
  preview_controller.render_in_layout_to_string(joined, @preview.lookbook_layout)
100
100
  else
101
101
  preview_controller.request.params[:path] = "#{@preview.preview_name}/#{@example.name}".chomp("/")
@@ -1,5 +1,5 @@
1
1
  <div class="flex flex-col h-full min-h-fill w-full">
2
- <%= render "./shared/header" %>
2
+ <%= render "shared/header" %>
3
3
  <div class="flex flex-col items-center justify-center h-full min-h-fill">
4
4
  <div class="p-4 text-center">
5
5
  <svg class="feather w-10 h-10 text-gray-300 mx-auto">
@@ -8,4 +8,4 @@
8
8
  <h5 class="mt-4 text-gray-400 text-base">Select a preview to get started</h5>
9
9
  </div>
10
10
  </div>
11
- </div>
11
+ </div>
@@ -1 +1 @@
1
- <%= render "./workbench" %>
1
+ <%= render "shared/workbench" %>
@@ -21,14 +21,14 @@
21
21
  <div
22
22
  x-data="page"
23
23
  x-effect="updateTitle"
24
- @refresh.document="fetchHTML().then(doc => $dispatch('document:updated', {doc}))"
24
+ @refresh.document="fetchHTML().then(doc => $dispatch('document:updated', {doc}))"
25
25
  @popstate.window="fetchHTML().then(doc => { $dispatch('document:loaded', {doc}); sidebarOpenMobile = false})"
26
26
  @sidebar:toggle.window="sidebarOpenMobile = !sidebarOpenMobile"
27
27
  :style="`grid-template-columns: ${$store.nav.width}px 1px 1fr;`"
28
28
  class="md:grid w-screen h-screen"
29
29
  >
30
30
  <div class="h-full bg-gray-100 overflow-hidden" x-show="$screen('md') || sidebarOpenMobile" x-cloak>
31
- <%= render "./sidebar" %>
31
+ <%= render "shared/sidebar" %>
32
32
  </div>
33
33
  <div x-data="split(splitProps)" class="h-full gutter border-r border-gray-300 relative" x-show="$screen('md')" x-cloak>
34
34
  <div class="w-[9px] h-full bg-transparent hover:bg-indigo-100 hover:bg-opacity-20 transition absolute top-0 bottom-0 transform -translate-x-1/2 cursor-[col-resize] z-10"></div>
@@ -1,5 +1,5 @@
1
- <%= render "./nav/node", node: node do %>
1
+ <%= render "nav/node", node: node do %>
2
2
  <% node.items.each do |item| %>
3
- <%= render "./nav/#{item.type.to_s}", node: item %>
4
- <% end %>
5
- <% end %>
3
+ <%= render "nav/#{item.type.to_s}", node: item %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%
2
+ path = show_path leaf.path
3
+ display ||= :leaf
4
+ label ||= leaf.label
5
+ %>
6
+ <li x-data="navLeaf" :class="{hidden}" x-init="matchers = <%= leaf.matchers.to_json %>; path = '<%= path %>'; setActive()" @popstate.window="setActive">
7
+ <a href="<%= path %>"
8
+ class="pr-3 py-[5px] flex items-center w-full group transition hover:bg-gray-200 hover:bg-opacity-50"
9
+ style="<%= nav_padding_style(depth) %>"
10
+ :class="{'!bg-indigo-100':active}"
11
+ @click.stop.prevent="navigate"
12
+ >
13
+ <div class="relative w-3.5 h-3.5 mr-1.5 <%= "ml-[3px]" if display == :node %> " :class="active ? 'text-gray-900' : 'text-indigo-500'">
14
+ <svg class="feather flex-none group-hover:text-indigo-800 transition w-3.5 h-3.5">
15
+ <use xlink:href="/lookbook-assets/feather-sprite.svg#<%= display == :node ? "layers" : "eye" %>" />
16
+ </svg>
17
+ </div>
18
+ <div class="truncate whitespace-nowrap <%= "font-bold" if display == :node %>">
19
+ <%= label %>
20
+ </div>
21
+ </a>
22
+ </li>
@@ -1,5 +1,5 @@
1
1
  <li id="<%= node.id %>" x-data="navNode" <% if node.hierarchy_depth == 1 %> class="py-1 border-b border-gray-300 cursor-pointer"<% end %> :class="{hidden}" x-cloak>
2
- <div @click="toggle" style="<%= nav_padding_style(node.hierarchy_depth) %>">
2
+ <div @click="toggle(); if (open()) { <%= "navigate('#{path}')" if defined?(path) %>}" style="<%= nav_padding_style(node.hierarchy_depth) %>" class="hover:bg-gray-200 hover:bg-opacity-50">
3
3
  <div class="flex items-center cursor-pointer pr-3 py-[5px]">
4
4
  <svg class="feather w-3 h-3 mr-1 text-gray-500 flex-none">
5
5
  <use xlink:href="/lookbook-assets/feather-sprite.svg#chevron-down" x-show="open" x-cloak />
@@ -1,29 +1,11 @@
1
- <%= render "./nav/node", node: node do %>
2
- <% node.get_examples.each do |example| %>
3
- <% path = show_path example.path %>
4
- <li x-data="navLeaf" :class="{hidden}" x-init="matchers = <%= example.matchers.to_json %>; path = '<%= path %>'; setActive()" @popstate.window="setActive">
5
- <a href="<%= path %>"
6
- class="pr-3 py-[5px] flex items-center w-full group transition hover:bg-gray-200 hover:bg-opacity-50"
7
- style="<%= nav_padding_style(example.hierarchy_depth + 1) %>"
8
- :class="{'!bg-indigo-100':active}"
9
- @click.stop.prevent="navigate"
10
- >
11
- <div class="relative w-3.5 h-3.5 mr-1.5" :class="active ? 'text-gray-900' : 'text-indigo-500'">
12
- <svg class="feather flex-none group-hover:text-indigo-800 transition <% if example.type == :group %> absolute top-[-2px] left-[-2px] w-3 h-3<% else %>w-3.5 h-3.5<% end %>">
13
- <use xlink:href="/lookbook-assets/feather-sprite.svg#eye" />
14
- </svg>
15
- <% if example.type == :group %>
16
- <svg class="feather w-3 h-3 flex-none group-hover:text-indigo-800 transition absolute top-[4px] left-[4px]">
17
- <use xlink:href="/lookbook-assets/feather-sprite.svg#eye" />
18
- </svg>
19
- <% end %>
20
- </div>
21
- <div class="truncate whitespace-nowrap">
22
- <%= example.label %>
23
- </div>
24
- </a>
25
- </li>
1
+ <% examples = node.get_examples %>
2
+ <% if examples.many? %>
3
+ <%= render "nav/node", node: node, path: show_path(examples.first.path) do %>
4
+ <% examples.each do |example| %>
5
+ <%= render "nav/leaf", leaf: example, depth: example.hierarchy_depth + 1 %>
6
+ <% end %>
26
7
  <% end %>
8
+ <% else %>
9
+ <% example = examples.first %>
10
+ <%= render "nav/leaf", leaf: example, depth: example.hierarchy_depth, label: node.label, display: :node %>
27
11
  <% end %>
28
-
29
-
@@ -0,0 +1,8 @@
1
+ <% examples.each do |example| %>
2
+ <div style="margin-bottom: 30px;">
3
+ <h6 style="color: #999; font-family: sans-serif; font-size: 14px; margin-top: 0; margin-bottom: 10px;">
4
+ <%= example[:label] %>
5
+ </h6>
6
+ <%= example[:html] %>
7
+ </div>
8
+ <% end %>
@@ -5,4 +5,4 @@
5
5
  </svg>
6
6
  </button>
7
7
  <%= yield %>
8
- </header>
8
+ </header>
@@ -27,7 +27,7 @@
27
27
  <% if @nav.items.any? %>
28
28
  <ul x-ref="items">
29
29
  <% @nav.items.each do |item| %>
30
- <%= render "./nav/#{item.type.to_s}", node: item %>
30
+ <%= render "nav/#{item.type.to_s}", node: item %>
31
31
  <% end %>
32
32
  </ul>
33
33
  <div class="p-4 text-center" x-show="hidden" x-cloak>
@@ -41,5 +41,5 @@
41
41
  <% end %>
42
42
  </nav>
43
43
  </div>
44
- </div>
45
- </div>
44
+ </div>
45
+ </div>
@@ -1,12 +1,12 @@
1
1
  <div id="workbench" class="bg-gray-50 h-screen flex flex-col" x-data="workbench">
2
- <%= render "./workbench/header" %>
2
+ <%= render "workbench/header" %>
3
3
  <div class="md:grid flex-grow" :style="`grid-template-rows: 1fr 1px ${$store.inspector.height}px`">
4
- <%= render "./workbench/preview" %>
4
+ <%= render "workbench/preview" %>
5
5
  <div class="w-full gutter border-t border-gray-300 relative" x-data="split(splitProps)" x-show="$screen('md')">
6
6
  <div class="h-[11px] w-full bg-transparent hover:bg-indigo-100 hover:bg-opacity-20 transition absolute left-0 right-0 transform -translate-y-1/2 cursor-[row-resize]"></div>
7
7
  </div>
8
8
  <% if @inspector %>
9
- <%= render "./workbench/inspector", **@inspector %>
9
+ <%= render "workbench/inspector", **@inspector %>
10
10
  <% end %>
11
- </div>
12
- </div>
11
+ </div>
12
+ </div>
@@ -1,9 +1,11 @@
1
- <%= render "./shared/header" do %>
1
+ <%= render "shared/header" do %>
2
2
  <div class="flex items-center">
3
3
  <div class="flex items-center space-x-1">
4
4
  <strong class="whitespace-nowrap truncate"><%= @preview.label %></strong>
5
- <span>/</span>
6
- <span class="whitespace-nowrap truncate"><%= @example.label %></span>
5
+ <% if @preview.get_examples.many? %>
6
+ <span>/</span>
7
+ <span class="whitespace-nowrap truncate"><%= @example.label %></span>
8
+ <% end %>
7
9
  </div>
8
10
  </div>
9
11
  <div class="flex text-xs ml-auto font-monospace text-gray-700 space-x-1" x-show="$screen('md')">
@@ -34,4 +36,4 @@
34
36
  </svg>
35
37
  </a>
36
38
  </div>
37
- <% end %>
39
+ <% end %>
@@ -21,12 +21,12 @@
21
21
  <% panes.each do |key, props| %>
22
22
  <div class="flex flex-col h-full relative" x-show="active('<%= key %>')" x-cloak>
23
23
  <% if props[:clipboard].present? %>
24
- <%= render "./shared/clipboard" do %><%= h props[:clipboard].strip %><% end %>
24
+ <%= render "shared/clipboard" do %><%= h props[:clipboard].strip %><% end %>
25
25
  <% end %>
26
26
  <div class="flex flex-col h-full overflow-auto">
27
- <%= render "./workbench/inspector/#{props[:template]}", key: key, **props %>
27
+ <%= render "workbench/inspector/#{props[:template]}", key: key, **props %>
28
28
  </div>
29
29
  </div>
30
30
  <% end %>
31
31
  </div>
32
- </div>
32
+ </div>
@@ -83,7 +83,14 @@ module Lookbook
83
83
 
84
84
  class << self
85
85
  def websocket
86
- @websocket ||= ActionCable::Server::Base.new(config: Lookbook::Engine.cable)
86
+ if Rails.version.to_f >= 6.0
87
+ @websocket ||= ActionCable::Server::Base.new(config: Lookbook::Engine.cable)
88
+ else
89
+ @websocket = ActionCable::Server::Base.new
90
+ @websocket.config = Lookbook::Engine.cable
91
+
92
+ @websocket
93
+ end
87
94
  end
88
95
 
89
96
  def cable
@@ -31,6 +31,7 @@ module Lookbook
31
31
  if name.nil?
32
32
  @lookbook_examples += examples
33
33
  else
34
+ name = lookbook_label if name.strip == ""
34
35
  @lookbook_examples << PreviewGroup.new(name.underscore, self, examples)
35
36
  end
36
37
  end
@@ -1,3 +1,3 @@
1
1
  module Lookbook
2
- VERSION = "0.3.0.beta.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v2.2.15 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v2.2.7 | MIT License | https://tailwindcss.com */
2
2
 
3
3
  /*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
4
4
 
@@ -475,18 +475,6 @@ button,
475
475
  cursor: pointer;
476
476
  }
477
477
 
478
- /**
479
- * Override legacy focus reset from Normalize with modern Firefox focus styles.
480
- *
481
- * This is actually an improvement over the new defaults in Firefox in our testing,
482
- * as it triggers the better focus styles even for links, which still use a dotted
483
- * outline in Firefox by default.
484
- */
485
-
486
- :-moz-focusring {
487
- outline: auto;
488
- }
489
-
490
478
  table {
491
479
  border-collapse: collapse;
492
480
  }
@@ -1468,22 +1456,6 @@ pre[class*="language-"] {
1468
1456
  bottom: 0px;
1469
1457
  }
1470
1458
 
1471
- .top-1\/2 {
1472
- top: 50%;
1473
- }
1474
-
1475
- .right-2 {
1476
- right: 0.5rem;
1477
- }
1478
-
1479
- .left-0 {
1480
- left: 0px;
1481
- }
1482
-
1483
- .right-0 {
1484
- right: 0px;
1485
- }
1486
-
1487
1459
  .top-0 {
1488
1460
  top: 0px;
1489
1461
  }
@@ -1492,20 +1464,20 @@ pre[class*="language-"] {
1492
1464
  bottom: 0px;
1493
1465
  }
1494
1466
 
1495
- .top-\[-2px\] {
1496
- top: -2px;
1467
+ .right-0 {
1468
+ right: 0px;
1497
1469
  }
1498
1470
 
1499
- .left-\[-2px\] {
1500
- left: -2px;
1471
+ .top-1\/2 {
1472
+ top: 50%;
1501
1473
  }
1502
1474
 
1503
- .top-\[4px\] {
1504
- top: 4px;
1475
+ .right-2 {
1476
+ right: 0.5rem;
1505
1477
  }
1506
1478
 
1507
- .left-\[4px\] {
1508
- left: 4px;
1479
+ .left-0 {
1480
+ left: 0px;
1509
1481
  }
1510
1482
 
1511
1483
  .left-4 {
@@ -1521,14 +1493,6 @@ pre[class*="language-"] {
1521
1493
  margin-right: auto;
1522
1494
  }
1523
1495
 
1524
- .ml-4 {
1525
- margin-left: 1rem;
1526
- }
1527
-
1528
- .mb-1 {
1529
- margin-bottom: 0.25rem;
1530
- }
1531
-
1532
1496
  .mt-4 {
1533
1497
  margin-top: 1rem;
1534
1498
  }
@@ -1541,18 +1505,30 @@ pre[class*="language-"] {
1541
1505
  margin-top: 0.5rem;
1542
1506
  }
1543
1507
 
1544
- .mr-1 {
1545
- margin-right: 0.25rem;
1546
- }
1547
-
1548
1508
  .mr-1\.5 {
1549
1509
  margin-right: 0.375rem;
1550
1510
  }
1551
1511
 
1512
+ .ml-\[3px\] {
1513
+ margin-left: 3px;
1514
+ }
1515
+
1516
+ .mr-1 {
1517
+ margin-right: 0.25rem;
1518
+ }
1519
+
1552
1520
  .mr-3 {
1553
1521
  margin-right: 0.75rem;
1554
1522
  }
1555
1523
 
1524
+ .ml-4 {
1525
+ margin-left: 1rem;
1526
+ }
1527
+
1528
+ .mb-1 {
1529
+ margin-bottom: 0.25rem;
1530
+ }
1531
+
1556
1532
  .ml-auto {
1557
1533
  margin-left: auto;
1558
1534
  }
@@ -1577,6 +1553,10 @@ pre[class*="language-"] {
1577
1553
  display: none;
1578
1554
  }
1579
1555
 
1556
+ .h-screen {
1557
+ height: 100vh;
1558
+ }
1559
+
1580
1560
  .h-full {
1581
1561
  height: 100%;
1582
1562
  }
@@ -1585,40 +1565,28 @@ pre[class*="language-"] {
1585
1565
  height: 2.5rem;
1586
1566
  }
1587
1567
 
1588
- .h-5 {
1589
- height: 1.25rem;
1568
+ .h-3\.5 {
1569
+ height: 0.875rem;
1590
1570
  }
1591
1571
 
1592
1572
  .h-3 {
1593
1573
  height: 0.75rem;
1594
1574
  }
1595
1575
 
1596
- .h-screen {
1597
- height: 100vh;
1598
- }
1599
-
1600
- .h-\[11px\] {
1601
- height: 11px;
1602
- }
1603
-
1604
- .h-3\.5 {
1605
- height: 0.875rem;
1606
- }
1607
-
1608
1576
  .h-4 {
1609
1577
  height: 1rem;
1610
1578
  }
1611
1579
 
1612
- .w-5 {
1613
- width: 1.25rem;
1580
+ .h-5 {
1581
+ height: 1.25rem;
1614
1582
  }
1615
1583
 
1616
- .w-full {
1617
- width: 100%;
1584
+ .h-\[11px\] {
1585
+ height: 11px;
1618
1586
  }
1619
1587
 
1620
- .w-3 {
1621
- width: 0.75rem;
1588
+ .w-full {
1589
+ width: 100%;
1622
1590
  }
1623
1591
 
1624
1592
  .w-10 {
@@ -1637,10 +1605,18 @@ pre[class*="language-"] {
1637
1605
  width: 0.875rem;
1638
1606
  }
1639
1607
 
1608
+ .w-3 {
1609
+ width: 0.75rem;
1610
+ }
1611
+
1640
1612
  .w-4 {
1641
1613
  width: 1rem;
1642
1614
  }
1643
1615
 
1616
+ .w-5 {
1617
+ width: 1.25rem;
1618
+ }
1619
+
1644
1620
  .max-w-xs {
1645
1621
  max-width: 20rem;
1646
1622
  }
@@ -1657,22 +1633,18 @@ pre[class*="language-"] {
1657
1633
  flex-grow: 1;
1658
1634
  }
1659
1635
 
1660
- .-translate-y-1\/2 {
1661
- --tw-translate-y: -50%;
1662
- transform: var(--tw-transform);
1663
- }
1664
-
1665
1636
  .-translate-x-1\/2 {
1666
1637
  --tw-translate-x: -50%;
1667
1638
  transform: var(--tw-transform);
1668
1639
  }
1669
1640
 
1670
- .transform {
1641
+ .-translate-y-1\/2 {
1642
+ --tw-translate-y: -50%;
1671
1643
  transform: var(--tw-transform);
1672
1644
  }
1673
1645
 
1674
- .cursor-\[row-resize\] {
1675
- cursor: row-resize;
1646
+ .transform {
1647
+ transform: var(--tw-transform);
1676
1648
  }
1677
1649
 
1678
1650
  .cursor-\[col-resize\] {
@@ -1683,6 +1655,10 @@ pre[class*="language-"] {
1683
1655
  cursor: pointer;
1684
1656
  }
1685
1657
 
1658
+ .cursor-\[row-resize\] {
1659
+ cursor: row-resize;
1660
+ }
1661
+
1686
1662
  .cursor-auto {
1687
1663
  cursor: auto;
1688
1664
  }
@@ -1778,22 +1754,22 @@ pre[class*="language-"] {
1778
1754
  border-width: 1px;
1779
1755
  }
1780
1756
 
1781
- .border-b {
1782
- border-bottom-width: 1px;
1783
- }
1784
-
1785
- .border-t {
1786
- border-top-width: 1px;
1787
- }
1788
-
1789
1757
  .border-r {
1790
1758
  border-right-width: 1px;
1791
1759
  }
1792
1760
 
1761
+ .border-b {
1762
+ border-bottom-width: 1px;
1763
+ }
1764
+
1793
1765
  .border-l {
1794
1766
  border-left-width: 1px;
1795
1767
  }
1796
1768
 
1769
+ .border-t {
1770
+ border-top-width: 1px;
1771
+ }
1772
+
1797
1773
  .border-b-2 {
1798
1774
  border-bottom-width: 2px;
1799
1775
  }
@@ -1826,25 +1802,25 @@ pre[class*="language-"] {
1826
1802
  background-color: rgba(255, 255, 255, var(--tw-bg-opacity));
1827
1803
  }
1828
1804
 
1829
- .bg-transparent {
1830
- background-color: transparent;
1831
- }
1832
-
1833
- .bg-gray-50 {
1834
- --tw-bg-opacity: 1;
1835
- background-color: rgba(249, 250, 251, var(--tw-bg-opacity));
1836
- }
1837
-
1838
1805
  .bg-gray-100 {
1839
1806
  --tw-bg-opacity: 1;
1840
1807
  background-color: rgba(243, 244, 246, var(--tw-bg-opacity));
1841
1808
  }
1842
1809
 
1810
+ .bg-transparent {
1811
+ background-color: transparent;
1812
+ }
1813
+
1843
1814
  .\!bg-indigo-100 {
1844
1815
  --tw-bg-opacity: 1 !important;
1845
1816
  background-color: rgba(224, 231, 255, var(--tw-bg-opacity)) !important;
1846
1817
  }
1847
1818
 
1819
+ .bg-gray-50 {
1820
+ --tw-bg-opacity: 1;
1821
+ background-color: rgba(249, 250, 251, var(--tw-bg-opacity));
1822
+ }
1823
+
1848
1824
  .p-4 {
1849
1825
  padding: 1rem;
1850
1826
  }
@@ -1857,9 +1833,9 @@ pre[class*="language-"] {
1857
1833
  padding: 0.25rem;
1858
1834
  }
1859
1835
 
1860
- .px-4 {
1861
- padding-left: 1rem;
1862
- padding-right: 1rem;
1836
+ .py-\[5px\] {
1837
+ padding-top: 5px;
1838
+ padding-bottom: 5px;
1863
1839
  }
1864
1840
 
1865
1841
  .py-1 {
@@ -1867,16 +1843,16 @@ pre[class*="language-"] {
1867
1843
  padding-bottom: 0.25rem;
1868
1844
  }
1869
1845
 
1870
- .py-\[5px\] {
1871
- padding-top: 5px;
1872
- padding-bottom: 5px;
1873
- }
1874
-
1875
1846
  .py-2 {
1876
1847
  padding-top: 0.5rem;
1877
1848
  padding-bottom: 0.5rem;
1878
1849
  }
1879
1850
 
1851
+ .px-4 {
1852
+ padding-left: 1rem;
1853
+ padding-right: 1rem;
1854
+ }
1855
+
1880
1856
  .px-1 {
1881
1857
  padding-left: 0.25rem;
1882
1858
  padding-right: 0.25rem;
@@ -1920,6 +1896,11 @@ pre[class*="language-"] {
1920
1896
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
1921
1897
  }
1922
1898
 
1899
+ .text-base {
1900
+ font-size: 1rem;
1901
+ line-height: 1.5rem;
1902
+ }
1903
+
1923
1904
  .text-sm {
1924
1905
  font-size: 0.875rem;
1925
1906
  line-height: 1.25rem;
@@ -1930,11 +1911,6 @@ pre[class*="language-"] {
1930
1911
  line-height: 1rem;
1931
1912
  }
1932
1913
 
1933
- .text-base {
1934
- font-size: 1rem;
1935
- line-height: 1.5rem;
1936
- }
1937
-
1938
1914
  .text-\[11px\] {
1939
1915
  font-size: 11px;
1940
1916
  }
@@ -1943,19 +1919,14 @@ pre[class*="language-"] {
1943
1919
  font-weight: 700;
1944
1920
  }
1945
1921
 
1946
- .text-gray-400 {
1947
- --tw-text-opacity: 1;
1948
- color: rgba(156, 163, 175, var(--tw-text-opacity));
1949
- }
1950
-
1951
- .text-gray-500 {
1922
+ .text-gray-300 {
1952
1923
  --tw-text-opacity: 1;
1953
- color: rgba(107, 114, 128, var(--tw-text-opacity));
1924
+ color: rgba(209, 213, 219, var(--tw-text-opacity));
1954
1925
  }
1955
1926
 
1956
- .text-gray-300 {
1927
+ .text-gray-400 {
1957
1928
  --tw-text-opacity: 1;
1958
- color: rgba(209, 213, 219, var(--tw-text-opacity));
1929
+ color: rgba(156, 163, 175, var(--tw-text-opacity));
1959
1930
  }
1960
1931
 
1961
1932
  .text-red-300 {
@@ -1968,14 +1939,14 @@ pre[class*="language-"] {
1968
1939
  color: rgba(55, 65, 81, var(--tw-text-opacity));
1969
1940
  }
1970
1941
 
1971
- .text-gray-800 {
1942
+ .text-gray-500 {
1972
1943
  --tw-text-opacity: 1;
1973
- color: rgba(31, 41, 55, var(--tw-text-opacity));
1944
+ color: rgba(107, 114, 128, var(--tw-text-opacity));
1974
1945
  }
1975
1946
 
1976
- .text-indigo-500 {
1947
+ .text-gray-800 {
1977
1948
  --tw-text-opacity: 1;
1978
- color: rgba(99, 102, 241, var(--tw-text-opacity));
1949
+ color: rgba(31, 41, 55, var(--tw-text-opacity));
1979
1950
  }
1980
1951
 
1981
1952
  .text-gray-900 {
@@ -1983,6 +1954,11 @@ pre[class*="language-"] {
1983
1954
  color: rgba(17, 24, 39, var(--tw-text-opacity));
1984
1955
  }
1985
1956
 
1957
+ .text-indigo-500 {
1958
+ --tw-text-opacity: 1;
1959
+ color: rgba(99, 102, 241, var(--tw-text-opacity));
1960
+ }
1961
+
1986
1962
  .\!text-gray-300 {
1987
1963
  --tw-text-opacity: 1 !important;
1988
1964
  color: rgba(209, 213, 219, var(--tw-text-opacity)) !important;
@@ -20,10 +20,7 @@
20
20
  return a;
21
21
  };
22
22
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
23
- var __require = typeof require !== "undefined" ? require : (x) => {
24
- throw new Error('Dynamic require of "' + x + '" is not supported');
25
- };
26
- var __commonJS = (cb, mod) => function __require2() {
23
+ var __commonJS = (cb, mod) => function __require() {
27
24
  return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
28
25
  };
29
26
  var __reExport = (target, module, desc) => {
@@ -2222,7 +2219,7 @@
2222
2219
  function closestDataStack(node) {
2223
2220
  if (node._x_dataStack)
2224
2221
  return node._x_dataStack;
2225
- if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) {
2222
+ if (node instanceof ShadowRoot) {
2226
2223
  return closestDataStack(node.host);
2227
2224
  }
2228
2225
  if (!node.parentNode) {
@@ -2428,9 +2425,6 @@ Expression: "${expression}"
2428
2425
  return getDirectiveHandler(el, directive2);
2429
2426
  });
2430
2427
  }
2431
- function attributesOnly(attributes) {
2432
- return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr));
2433
- }
2434
2428
  var isDeferringHandlers = false;
2435
2429
  var directiveHandlerStacks = new Map();
2436
2430
  var currentHandlerStackKey = Symbol();
@@ -2484,8 +2478,7 @@ Expression: "${expression}"
2484
2478
  return { name, value };
2485
2479
  };
2486
2480
  var into = (i) => i;
2487
- function toTransformedAttributes(callback = () => {
2488
- }) {
2481
+ function toTransformedAttributes(callback) {
2489
2482
  return ({ name, value }) => {
2490
2483
  let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => {
2491
2484
  return transform(carry);
@@ -2565,7 +2558,7 @@ Expression: "${expression}"
2565
2558
  isHolding = true;
2566
2559
  }
2567
2560
  function walk(el, callback) {
2568
- if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
2561
+ if (el instanceof ShadowRoot) {
2569
2562
  Array.from(el.children).forEach((el2) => walk(el2, callback));
2570
2563
  return;
2571
2564
  }
@@ -2593,7 +2586,7 @@ Expression: "${expression}"
2593
2586
  onAttributesAdded((el, attrs) => {
2594
2587
  directives(el, attrs).forEach((handle) => handle());
2595
2588
  });
2596
- let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
2589
+ let outNestedComponents = (el) => !closestRoot(el.parentElement);
2597
2590
  Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => {
2598
2591
  initTree(el);
2599
2592
  });
@@ -2613,15 +2606,14 @@ Expression: "${expression}"
2613
2606
  function addInitSelector(selectorCallback) {
2614
2607
  initSelectorCallbacks.push(selectorCallback);
2615
2608
  }
2616
- function closestRoot(el, includeInitSelectors = false) {
2609
+ function closestRoot(el) {
2617
2610
  if (!el)
2618
2611
  return;
2619
- const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
2620
- if (selectors.some((selector) => el.matches(selector)))
2612
+ if (rootSelectors().some((selector) => el.matches(selector)))
2621
2613
  return el;
2622
2614
  if (!el.parentElement)
2623
2615
  return;
2624
- return closestRoot(el.parentElement, includeInitSelectors);
2616
+ return closestRoot(el.parentElement);
2625
2617
  }
2626
2618
  function isRoot(el) {
2627
2619
  return rootSelectors().some((selector) => el.matches(selector));
@@ -2637,29 +2629,6 @@ Expression: "${expression}"
2637
2629
  function destroyTree(root) {
2638
2630
  walk(root, (el) => cleanupAttributes(el));
2639
2631
  }
2640
- function debounce(func, wait) {
2641
- var timeout;
2642
- return function() {
2643
- var context = this, args = arguments;
2644
- var later = function() {
2645
- timeout = null;
2646
- func.apply(context, args);
2647
- };
2648
- clearTimeout(timeout);
2649
- timeout = setTimeout(later, wait);
2650
- };
2651
- }
2652
- function throttle(func, limit) {
2653
- let inThrottle;
2654
- return function() {
2655
- let context = this, args = arguments;
2656
- if (!inThrottle) {
2657
- func.apply(context, args);
2658
- inThrottle = true;
2659
- setTimeout(() => inThrottle = false, limit);
2660
- }
2661
- };
2662
- }
2663
2632
  function plugin(callback) {
2664
2633
  callback(alpine_default);
2665
2634
  }
@@ -2746,7 +2715,7 @@ Expression: "${expression}"
2746
2715
  get raw() {
2747
2716
  return raw;
2748
2717
  },
2749
- version: "3.4.0",
2718
+ version: "3.2.4",
2750
2719
  disableEffectScheduling,
2751
2720
  setReactivityEngine,
2752
2721
  addRootSelector,
@@ -2757,8 +2726,6 @@ Expression: "${expression}"
2757
2726
  interceptor,
2758
2727
  mutateDom,
2759
2728
  directive,
2760
- throttle,
2761
- debounce,
2762
2729
  evaluate,
2763
2730
  initTree,
2764
2731
  nextTick,
@@ -2793,23 +2760,7 @@ Expression: "${expression}"
2793
2760
  }));
2794
2761
  });
2795
2762
  magic("store", getStores);
2796
- magic("root", (el) => closestRoot(el));
2797
- magic("refs", (el) => {
2798
- if (el._x_refs_proxy)
2799
- return el._x_refs_proxy;
2800
- el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el));
2801
- return el._x_refs_proxy;
2802
- });
2803
- function getArrayOfRefObject(el) {
2804
- let refObjects = [];
2805
- let currentEl = el;
2806
- while (currentEl) {
2807
- if (currentEl._x_refs)
2808
- refObjects.push(currentEl._x_refs);
2809
- currentEl = currentEl.parentNode;
2810
- }
2811
- return refObjects;
2812
- }
2763
+ magic("refs", (el) => closestRoot(el)._x_refs || {});
2813
2764
  magic("el", (el) => el);
2814
2765
  function setClasses(el, value) {
2815
2766
  if (Array.isArray(value)) {
@@ -3017,9 +2968,7 @@ Expression: "${expression}"
3017
2968
  };
3018
2969
  }
3019
2970
  window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) {
3020
- let clickAwayCompatibleShow = () => {
3021
- document.visibilityState === "visible" ? requestAnimationFrame(show) : setTimeout(show);
3022
- };
2971
+ let clickAwayCompatibleShow = () => requestAnimationFrame(show);
3023
2972
  if (value) {
3024
2973
  el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow();
3025
2974
  return;
@@ -3299,7 +3248,7 @@ Expression: "${expression}"
3299
3248
  return booleanAttributes.includes(attrName);
3300
3249
  }
3301
3250
  function attributeShouldntBePreservedIfFalsy(name) {
3302
- return !["aria-pressed", "aria-checked", "aria-expanded"].includes(name);
3251
+ return !["aria-pressed", "aria-checked"].includes(name);
3303
3252
  }
3304
3253
  function on(el, event, modifiers, callback) {
3305
3254
  let listenerTarget = el;
@@ -3351,12 +3300,12 @@ Expression: "${expression}"
3351
3300
  if (modifiers.includes("debounce")) {
3352
3301
  let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait";
3353
3302
  let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
3354
- handler3 = debounce(handler3, wait);
3303
+ handler3 = debounce(handler3, wait, this);
3355
3304
  }
3356
3305
  if (modifiers.includes("throttle")) {
3357
3306
  let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait";
3358
3307
  let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
3359
- handler3 = throttle(handler3, wait);
3308
+ handler3 = throttle(handler3, wait, this);
3360
3309
  }
3361
3310
  if (modifiers.includes("once")) {
3362
3311
  handler3 = wrapHandler(handler3, (next, e) => {
@@ -3375,6 +3324,29 @@ Expression: "${expression}"
3375
3324
  function camelCase2(subject) {
3376
3325
  return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
3377
3326
  }
3327
+ function debounce(func, wait) {
3328
+ var timeout;
3329
+ return function() {
3330
+ var context = this, args = arguments;
3331
+ var later = function() {
3332
+ timeout = null;
3333
+ func.apply(context, args);
3334
+ };
3335
+ clearTimeout(timeout);
3336
+ timeout = setTimeout(later, wait);
3337
+ };
3338
+ }
3339
+ function throttle(func, limit) {
3340
+ let inThrottle;
3341
+ return function() {
3342
+ let context = this, args = arguments;
3343
+ if (!inThrottle) {
3344
+ func.apply(context, args);
3345
+ inThrottle = true;
3346
+ setTimeout(() => inThrottle = false, limit);
3347
+ }
3348
+ };
3349
+ }
3378
3350
  function isNumeric(subject) {
3379
3351
  return !Array.isArray(subject) && !isNaN(subject);
3380
3352
  }
@@ -3426,9 +3398,7 @@ Expression: "${expression}"
3426
3398
  up: "arrow-up",
3427
3399
  down: "arrow-down",
3428
3400
  left: "arrow-left",
3429
- right: "arrow-right",
3430
- period: ".",
3431
- equal: "="
3401
+ right: "arrow-right"
3432
3402
  };
3433
3403
  modifierToKeyMap[key] = key;
3434
3404
  return Object.keys(modifierToKeyMap).map((modifier) => {
@@ -3509,12 +3479,7 @@ Expression: "${expression}"
3509
3479
  }
3510
3480
  directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak")))));
3511
3481
  addInitSelector(() => `[${prefix("init")}]`);
3512
- directive("init", skipDuringClone((el, { expression }) => {
3513
- if (typeof expression === "string") {
3514
- return !!expression.trim() && evaluate(el, expression, {}, false);
3515
- }
3516
- return evaluate(el, expression, {}, false);
3517
- }));
3482
+ directive("init", skipDuringClone((el, { expression }) => evaluate(el, expression, {}, false)));
3518
3483
  directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
3519
3484
  let evaluate2 = evaluateLater2(expression);
3520
3485
  effect3(() => {
@@ -3554,12 +3519,6 @@ Expression: "${expression}"
3554
3519
  cleanupRunners.pop()();
3555
3520
  getBindings((bindings) => {
3556
3521
  let attributes = Object.entries(bindings).map(([name, value]) => ({ name, value }));
3557
- attributesOnly(attributes).forEach(({ name, value }, index2) => {
3558
- attributes[index2] = {
3559
- name: `x-bind:${name}`,
3560
- value: `"${value}"`
3561
- };
3562
- });
3563
3522
  directives(el, attributes, original).map((handle) => {
3564
3523
  cleanupRunners.push(handle.runCleanups);
3565
3524
  handle();
@@ -3759,11 +3718,6 @@ Expression: "${expression}"
3759
3718
  names.forEach((name, i) => {
3760
3719
  scopeVariables[name] = item[i];
3761
3720
  });
3762
- } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") {
3763
- let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim());
3764
- names.forEach((name) => {
3765
- scopeVariables[name] = item[name];
3766
- });
3767
3721
  } else {
3768
3722
  scopeVariables[iteratorNames.item] = item;
3769
3723
  }
@@ -8420,8 +8374,11 @@ Expression: "${expression}"
8420
8374
  this.$dispatch("nav:updated");
8421
8375
  });
8422
8376
  },
8423
- navigate($event) {
8424
- history.pushState({}, null, $event.currentTarget.href);
8377
+ navigate(path) {
8378
+ if (path instanceof Event) {
8379
+ path = path.currentTarget.href;
8380
+ }
8381
+ history.pushState({}, null, path);
8425
8382
  this.$dispatch("popstate");
8426
8383
  },
8427
8384
  focusFilter() {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.beta.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2021-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: view_component
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.3'
75
+ version: '3.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.3'
82
+ version: '3.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: yard
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -207,19 +207,20 @@ files:
207
207
  - app/channels/lookbook/reload_channel.rb
208
208
  - app/controllers/lookbook/app_controller.rb
209
209
  - app/helpers/lookbook/application_helper.rb
210
- - app/views/lookbook/_sidebar.html.erb
211
- - app/views/lookbook/_workbench.html.erb
212
210
  - app/views/lookbook/app/error.html.erb
213
211
  - app/views/lookbook/app/index.html.erb
214
212
  - app/views/lookbook/app/not_found.html.erb
215
213
  - app/views/lookbook/app/show.html.erb
216
214
  - app/views/lookbook/layouts/app.html.erb
217
- - app/views/lookbook/layouts/group.html.erb
218
215
  - app/views/lookbook/nav/_collection.html.erb
216
+ - app/views/lookbook/nav/_leaf.html.erb
219
217
  - app/views/lookbook/nav/_node.html.erb
220
218
  - app/views/lookbook/nav/_preview.html.erb
219
+ - app/views/lookbook/preview_group.html.erb
221
220
  - app/views/lookbook/shared/_clipboard.html.erb
222
221
  - app/views/lookbook/shared/_header.html.erb
222
+ - app/views/lookbook/shared/_sidebar.html.erb
223
+ - app/views/lookbook/shared/_workbench.html.erb
223
224
  - app/views/lookbook/workbench/_header.html.erb
224
225
  - app/views/lookbook/workbench/_inspector.html.erb
225
226
  - app/views/lookbook/workbench/_preview.html.erb
@@ -258,9 +259,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
259
  version: '0'
259
260
  required_rubygems_version: !ruby/object:Gem::Requirement
260
261
  requirements:
261
- - - ">"
262
+ - - ">="
262
263
  - !ruby/object:Gem::Version
263
- version: 1.3.1
264
+ version: '0'
264
265
  requirements: []
265
266
  rubygems_version: 3.1.2
266
267
  signing_key:
@@ -1,6 +0,0 @@
1
- <% items.each do |item| %>
2
- <div class="lookbook-example" style="margin-bottom: 30px;">
3
- <h6 class="lookbook-example-label" style="color: #999; font-size: 14px; margin-bottom: 10px;"><%= item[:label] %></h6>
4
- <%= item[:content] %>
5
- </div>
6
- <% end %>