@ansiversa/components 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansiversa/components",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,10 @@ interface Props {
14
14
  disabled?: boolean;
15
15
  /** extra classes if ever needed */
16
16
  className?: string;
17
+ /** allow plain class attribute passthrough */
18
+ class?: string;
19
+ /** forward any other HTML attributes (e.g., Alpine x-*) */
20
+ [key: string]: any;
17
21
  }
18
22
 
19
23
  const {
@@ -24,6 +28,8 @@ const {
24
28
  type = "button",
25
29
  disabled = false,
26
30
  className,
31
+ class: extraClass,
32
+ ...rest
27
33
  } = Astro.props;
28
34
 
29
35
  // Build class list based on our global.css system
@@ -54,16 +60,19 @@ if (block) {
54
60
  if (className) {
55
61
  classes.push(className);
56
62
  }
63
+ if (extraClass) {
64
+ classes.push(extraClass as string);
65
+ }
57
66
 
58
67
  const classAttr = classes.join(" ");
59
68
  ---
60
69
 
61
70
  {href ? (
62
- <a href={href} class={classAttr}>
71
+ <a href={href} class={classAttr} {...rest}>
63
72
  <slot />
64
73
  </a>
65
74
  ) : (
66
- <button type={type} class={classAttr} disabled={disabled}>
75
+ <button type={type} class={classAttr} disabled={disabled} {...rest}>
67
76
  <slot />
68
77
  </button>
69
78
  )}
@@ -27,9 +27,14 @@ const classAttr = classes.join(" ");
27
27
 
28
28
  const rawDomain = (import.meta.env.ANSIVERSA_COOKIE_DOMAIN || "ansiversa.com").trim();
29
29
  const normalizedDomain = rawDomain.replace(/^(https?:\/\/)/i, "").replace(/\/+$/, "");
30
- const ROOT_URL = rawDomain.startsWith("http")
30
+ const protocol = rawDomain.match(/^https?:\/\//i)
31
+ ? undefined
32
+ : import.meta.env.PROD
33
+ ? "https"
34
+ : "http";
35
+ const ROOT_URL = rawDomain.match(/^https?:\/\//i)
31
36
  ? rawDomain.replace(/\/+$/, "")
32
- : `https://${normalizedDomain}`;
37
+ : `${protocol}://${normalizedDomain}`;
33
38
 
34
39
  const iconMap: Record<string, string> = {
35
40
  Apps: `
@@ -11,9 +11,14 @@ const {
11
11
 
12
12
  const rawDomain = (import.meta.env.ANSIVERSA_COOKIE_DOMAIN || "ansiversa.com").trim();
13
13
  const normalizedDomain = rawDomain.replace(/^(https?:\/\/)/i, "").replace(/\/+$/, "");
14
- const ROOT_URL = rawDomain.startsWith("http")
14
+ const protocol = rawDomain.match(/^https?:\/\//i)
15
+ ? undefined
16
+ : import.meta.env.PROD
17
+ ? "https"
18
+ : "http";
19
+ const ROOT_URL = rawDomain.match(/^https?:\/\//i)
15
20
  ? rawDomain.replace(/\/+$/, "")
16
- : `https://${normalizedDomain}`;
21
+ : `${protocol}://${normalizedDomain}`;
17
22
  ---
18
23
 
19
24
 
@@ -18,9 +18,14 @@ const user = Astro.locals.user;
18
18
 
19
19
  const rawDomain = (import.meta.env.ANSIVERSA_COOKIE_DOMAIN || "ansiversa.com").trim();
20
20
  const normalizedDomain = rawDomain.replace(/^(https?:\/\/)/i, "").replace(/\/+$/, "");
21
- const ROOT_URL = rawDomain.startsWith("http")
21
+ const protocol = rawDomain.match(/^https?:\/\//i)
22
+ ? undefined
23
+ : import.meta.env.PROD
24
+ ? "https"
25
+ : "http";
26
+ const ROOT_URL = rawDomain.match(/^https?:\/\//i)
22
27
  ? rawDomain.replace(/\/+$/, "")
23
- : `https://${normalizedDomain}`;
28
+ : `${protocol}://${normalizedDomain}`;
24
29
  ---
25
30
 
26
31