keystone_ui 0.46.0 → 0.48.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1209af69898ff5cfa1879680b8d9de9a9ca569474d6471a85f906f1bdcac7425
4
- data.tar.gz: 4f7d5750c98755ccc5ac4a7c17095f018219e731417101d60e2ea5b2f2e164d1
3
+ metadata.gz: 92d45d0ca72ce5a2128a391d80bd404bcfae53fc8cbef3a2a79ffaad716bcf1e
4
+ data.tar.gz: 48fc5e92e536ddd94a2ee7b60793f29a72969f3a9329ab86e8f6d66222c6dc2a
5
5
  SHA512:
6
- metadata.gz: 251cec86be528ce9676410c4eb8f317df3954060faa79c4e841c918681618b39f7778d2fd22e51116ec12fd4237b5dd1f617d549bd06e0c4149c412869b5da25
7
- data.tar.gz: d1f9983ec813ce4ef08ee138470df4c7d60b583a07742fa0855a1d4b5ca7b69a5d1c3c0b98a0ea11defbd026c9cbe7aa99cc0a65e53613808e33446722666cbf
6
+ metadata.gz: dff8292ec2415468e2c63f54a12b12bd5a8dcca50313794b3ab5a78720cc1cec36e344044fa00cf3689932a86bc256c7edd94c5af6f01002d54f6d9b491efc0b
7
+ data.tar.gz: e226f99862c150bb1f8d2e81c03c66fb63ffb5a70e5e53759532eedde96767367a4f12873e46f34eccddf9603e8ecce3ccf52510d1aa59791bf7823342cc2d33
@@ -59,6 +59,8 @@ const LIGHT_THEMES = ["light", "custom"]
59
59
 
60
60
  export const isDarkMode = (theme, prefersDark) => theme === "dark" || (prefersDark && !LIGHT_THEMES.includes(theme))
61
61
 
62
+ export const drawnDark = (element, prefersDark) => isDarkMode(element.closest("[data-theme]")?.dataset.theme, prefersDark)
63
+
62
64
  const CHART_COLOR_COUNT = 5
63
65
 
64
66
  const INHERITED_FONTS = ["", "inherit"]
@@ -86,7 +88,7 @@ export const styleDatasets = (datasets, theme, resolve) => {
86
88
 
87
89
  export const watchTheme = ({ document, matchMedia, MutationObserver }, onChange) => {
88
90
  const observer = new MutationObserver(onChange)
89
- observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "data-look"] })
91
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "data-look", "style"] })
90
92
  observer.observe(document.head, { childList: true, subtree: true, characterData: true })
91
93
  const darkPreference = matchMedia("(prefers-color-scheme: dark)")
92
94
  darkPreference.addEventListener("change", onChange)
@@ -136,7 +138,7 @@ export default class extends Controller {
136
138
  return match ? read(match[1]) || color : color
137
139
  }
138
140
 
139
- const dark = isDarkMode(document.documentElement.dataset.theme, matchMedia("(prefers-color-scheme: dark)").matches)
141
+ const dark = drawnDark(this.element, matchMedia("(prefers-color-scheme: dark)").matches)
140
142
  return { theme: themeColors(read, dark, styles.fontFamily), resolve }
141
143
  }
142
144
  }
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class BottomNavComponent < ViewComponent::Base
6
- NAV_CLASSES = "ks-bottom-nav lg:hidden hotwire-native:hidden"
6
+ NAV_CLASSES = "ks-bottom-nav lg:hidden hotwire-native:hidden print:hidden"
7
7
 
8
8
  def nav_classes
9
9
  NAV_CLASSES
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class BreadcrumbsComponent < ViewComponent::Base
6
- CLASSES = "ks-mobile-header-back ks-breadcrumbs hidden lg:block text-sm"
6
+ CLASSES = "ks-mobile-header-back ks-breadcrumbs hidden lg:block text-sm print:hidden"
7
7
  SEPARATOR = "›"
8
8
 
9
9
  def initialize(trail:, current: nil)
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class DesktopBackLinkComponent < ViewComponent::Base
6
- CLASSES = "ks-mobile-header-back ks-page-back hidden lg:inline-flex items-center"
6
+ CLASSES = "ks-mobile-header-back ks-page-back hidden lg:inline-flex items-center print:hidden"
7
7
  LABEL = "Back"
8
8
 
9
9
  def initialize(url:)
@@ -9,7 +9,7 @@ module Keystone
9
9
  </svg>
10
10
  SVG
11
11
 
12
- WRAPPER_CLASSES = "relative lg:hidden"
12
+ WRAPPER_CLASSES = "relative lg:hidden print:hidden"
13
13
  BUTTON_CLASSES = "ks-action-menu-button"
14
14
  DROPDOWN_CLASSES = "ks-action-menu hidden absolute right-0 z-50 w-48 origin-top-right"
15
15
 
@@ -15,7 +15,7 @@ module Keystone
15
15
  </svg>
16
16
  SVG
17
17
 
18
- WRAPPER_CLASSES = "lg:hidden"
18
+ WRAPPER_CLASSES = "lg:hidden print:hidden"
19
19
  BACK_LINK_CLASSES = "ks-mobile-header-back"
20
20
  TITLE_CLASSES = "ks-mobile-header-title absolute left-1/2 -translate-x-1/2 lg:hidden truncate max-w-[60%]"
21
21
  SUBTITLE_CLASSES = "ks-mobile-header-subtitle block text-xs truncate text-center"
@@ -3,7 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class NavbarComponent < ViewComponent::Base
6
- NAV_BASE = "top-nav"
6
+ NAV_BASE = "top-nav print:hidden"
7
7
  NAV_STICKY = "sticky top-0 z-40"
8
8
  MOBILE_LEFT_CLASSES = "lg:hidden flex items-center"
9
9
  LOGO_CLASSES = "logo"
@@ -5,9 +5,9 @@ require "keystone_ui/visible_navigation"
5
5
  module Keystone
6
6
  module Ui
7
7
  class NavigationComponent < ViewComponent::Base
8
- TOP_BAR_CLASSES = "hidden lg:block sticky top-0 z-40"
8
+ TOP_BAR_CLASSES = "hidden lg:block sticky top-0 z-40 print:hidden"
9
9
  SIDEBAR_ROW_CLASSES = "lg:flex"
10
- SIDEBAR_CLASSES = "ks-sidebar hidden lg:flex lg:sticky lg:top-0 lg:h-screen shrink-0 overflow-y-auto"
10
+ SIDEBAR_CLASSES = "ks-sidebar hidden lg:flex lg:sticky lg:top-0 lg:h-screen shrink-0 overflow-y-auto print:hidden"
11
11
  SIDEBAR_LOGO_CLASSES = "ks-sidebar-logo"
12
12
  SIDEBAR_GROUP_CLASSES = "flex flex-col"
13
13
  SIDEBAR_GROUP_LABEL_CLASSES = "ks-sidebar-group-label"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.46.0"
4
+ VERSION = "0.48.0"
5
5
  end
@@ -198,6 +198,9 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
198
198
 
199
199
  5. Wire navigation in the layout.
200
200
 
201
+ Every navigation component is left off a printed page, so a printed page or
202
+ a PDF holds only the page's content.
203
+
201
204
  - `ui_navigation` takes no keywords and a block holding the page content, so
202
205
  it goes around `yield`. It draws the tabs the app declares with
203
206
  `config.navigation_group` as a top bar of menus from `lg:` up, then the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.0
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider