clampography 2.0.0-beta.3 → 2.0.0-beta.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +8 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clampography",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "Fluid typography system based on CSS clamp() with optional themes and extra styles. A feature-rich alternative to Tailwind CSS Typography plugin.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -20,54 +20,45 @@ export default plugin.withOptions((options = {}) => {
20
20
 
21
21
  // Default values
22
22
  let themesToInclude = [];
23
- let defaultThemeName = "light";
23
+ let defaultThemeName = null;
24
24
  let prefersDarkTheme = false;
25
25
  let rootSelector = options.root ?? ":root";
26
26
 
27
27
  // Normalize input to an array of strings
28
- // CSS might pass this as a single long string separated by commas
29
28
  let rawThemeList = [];
30
29
 
31
30
  if (typeof configThemes === "string") {
32
31
  if (configThemes.trim() === "all") {
33
- // Special case: themes: all
32
+ // Special case: themes: all -> load everything
34
33
  rawThemeList = Object.keys(builtInThemes);
35
34
  } else if (configThemes.trim() === "false") {
36
35
  rawThemeList = [];
37
36
  } else {
38
- // Split by comma: "light --default, dark --prefersdark"
39
37
  rawThemeList = configThemes.split(",");
40
38
  }
41
39
  } else if (Array.isArray(configThemes)) {
42
40
  rawThemeList = configThemes;
43
41
  } else {
44
- // Default fallback if nothing provided
45
- rawThemeList = ["light", "dark"];
42
+ // Fallback default is EMPTY array.
43
+ // User must explicitly ask for themes via options.
44
+ rawThemeList = [];
46
45
  }
47
46
 
48
- // 3. Process the list and look for flags (--default, --prefersdark)
49
- // If "all" was used, we don't look for flags (we use default light/dark logic) unless implemented otherwise.
50
- // Here we focus on the explicit list.
51
-
47
+ // 3. Process the list and look for flags
52
48
  rawThemeList.forEach((rawItem) => {
53
49
  let themeName = rawItem.trim();
54
-
55
- // Ignore empty entries
56
50
  if (!themeName) return;
57
51
 
58
- // Check for --default flag
59
52
  if (themeName.includes("--default")) {
60
53
  themeName = themeName.replace("--default", "").trim();
61
54
  defaultThemeName = themeName;
62
55
  }
63
56
 
64
- // Check for --prefersdark flag (case insensitive just in case)
65
57
  if (themeName.toLowerCase().includes("--prefersdark")) {
66
58
  themeName = themeName.replace(/--prefersdark/i, "").trim();
67
59
  prefersDarkTheme = themeName;
68
60
  }
69
61
 
70
- // Check if theme exists in the database
71
62
  if (builtInThemes[themeName]) {
72
63
  themesToInclude.push(themeName);
73
64
  }
@@ -80,7 +71,8 @@ export default plugin.withOptions((options = {}) => {
80
71
  const themeStyles = {};
81
72
 
82
73
  // A. Default theme (:root)
83
- if (builtInThemes[defaultThemeName]) {
74
+ // Only applied if explicitly flagged with --default OR via manual logic (not applied here automatically anymore)
75
+ if (defaultThemeName && builtInThemes[defaultThemeName]) {
84
76
  themeStyles[rootSelector] = builtInThemes[defaultThemeName];
85
77
  }
86
78