vueless 1.2.15-beta.6 → 1.2.15-beta.8

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.
package/constants.d.ts CHANGED
@@ -16,6 +16,7 @@ export const COLOR_MODE_KEY: "vl-color-mode";
16
16
  export const AUTO_MODE_KEY: "vl-auto-mode";
17
17
  export const DARK_MODE_CLASS: "vl-dark";
18
18
  export const LIGHT_MODE_CLASS: "vl-light";
19
+ export const THEME_TOKENS: "vueless-theme-tokens";
19
20
  export const DEFAULT_PRIMARY_COLOR: "grayscale";
20
21
  export const DEFAULT_NEUTRAL_COLOR: "gray";
21
22
  export const DEFAULT_TEXT: 14;
package/constants.js CHANGED
@@ -26,6 +26,7 @@ export const COLOR_MODE_KEY = "vl-color-mode";
26
26
  export const AUTO_MODE_KEY = "vl-auto-mode";
27
27
  export const DARK_MODE_CLASS = "vl-dark";
28
28
  export const LIGHT_MODE_CLASS = "vl-light";
29
+ export const THEME_TOKENS = "vueless-theme-tokens";
29
30
 
30
31
  /* Vueless defaults */
31
32
  export const DEFAULT_PRIMARY_COLOR = GRAYSCALE_COLOR;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.2.15-beta.6",
3
+ "version": "1.2.15-beta.8",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -5,6 +5,7 @@ import {
5
5
  getSlotsFragment,
6
6
  getDocsDescription,
7
7
  } from "../../utils/storybook";
8
+ import { getTheme } from "../../utils/theme";
8
9
 
9
10
  import UThemeColorToggle from "../UThemeColorToggle.vue";
10
11
  import UCol from "../../ui.container-col/UCol.vue";
@@ -19,13 +20,15 @@ interface UThemeColorToggleArgs extends Props {
19
20
  enum: "size";
20
21
  }
21
22
 
23
+ const theme = getTheme();
24
+
22
25
  export default {
23
26
  id: "100030",
24
27
  title: "Other / Theme Color Toggle",
25
28
  component: UThemeColorToggle,
26
29
  args: {
27
- primary: "",
28
- neutral: "",
30
+ primary: theme.primary,
31
+ neutral: theme.neutral,
29
32
  primaryColors: {
30
33
  grayscale: "bg-grayscale",
31
34
  red: "bg-red-600",
package/utils/theme.ts CHANGED
@@ -898,14 +898,21 @@ function setCSSVariables(
898
898
  `;
899
899
 
900
900
  if (isCSR) {
901
- const firstStyleOrLink = document.querySelector("link[rel='stylesheet'], style");
902
- const style = document.createElement("style");
901
+ const vuelessStyleId = "vueless-theme-tokens";
902
+ let style = document.getElementById(vuelessStyleId) as HTMLStyleElement | null;
903
903
 
904
- style.innerHTML = rootVariables;
904
+ if (!style) {
905
+ style = document.createElement("style");
906
+ style.id = vuelessStyleId;
907
+
908
+ const firstStyleOrLink = document.querySelector("link[rel='stylesheet'], style");
905
909
 
906
- firstStyleOrLink && firstStyleOrLink.parentNode
907
- ? firstStyleOrLink.parentNode.insertBefore(style, firstStyleOrLink)
908
- : document.head.appendChild(style);
910
+ firstStyleOrLink && firstStyleOrLink.parentNode
911
+ ? firstStyleOrLink.parentNode.insertBefore(style, firstStyleOrLink)
912
+ : document.head.appendChild(style);
913
+ }
914
+
915
+ style.innerHTML = rootVariables;
909
916
  }
910
917
 
911
918
  return rootVariables;