@cal.macconnachie/web-components 0.0.9 → 0.0.10

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/README.md CHANGED
@@ -34,14 +34,14 @@ Then create a type declaration file for TypeScript support:
34
34
 
35
35
  ```typescript
36
36
  // src/types/auth.d.ts
37
- export interface CalsAuth extends HTMLElement {
37
+ export interface Auth extends HTMLElement {
38
38
  openModal(): void;
39
39
  logout(): void;
40
40
  }
41
41
 
42
42
  declare global {
43
43
  interface HTMLElementTagNameMap {
44
- 'auth': CalsAuth;
44
+ 'auth': Auth;
45
45
  }
46
46
  }
47
47
  ```
@@ -57,9 +57,9 @@ Now you can use it with full type safety in your components:
57
57
 
58
58
  <script setup lang="ts">
59
59
  import { ref } from 'vue';
60
- import type { CalsAuth } from '@/types/auth';
60
+ import type { Auth } from '@/types/auth';
61
61
 
62
- const authRef = ref<CalsAuth>();
62
+ const authRef = ref<Auth>();
63
63
 
64
64
  const openAuth = () => {
65
65
  authRef.value?.openModal();
@@ -70,10 +70,10 @@ const openAuth = () => {
70
70
  **React:**
71
71
  ```tsx
72
72
  import { useRef } from 'react';
73
- import type { CalsAuth } from '@/types/auth';
73
+ import type { Auth } from '@/types/auth';
74
74
 
75
75
  function App() {
76
- const authRef = useRef<CalsAuth>(null);
76
+ const authRef = useRef<Auth>(null);
77
77
 
78
78
  return (
79
79
  <>
@@ -112,9 +112,9 @@ document.getElementById('logout-auth')?.addEventListener('click', () => {
112
112
 
113
113
  TypeScript:
114
114
  ```typescript
115
- import type { CalsAuth } from 'https://cdn.cals-api.com/components/auth.js';
115
+ import type { Auth } from 'https://cdn.cals-api.com/components/auth.js';
116
116
 
117
- const auth = document.querySelector<CalsAuth>('auth');
117
+ const auth = document.querySelector<Auth>('auth');
118
118
 
119
119
  document.getElementById('open-auth')?.addEventListener('click', () => {
120
120
  auth?.openModal();
@@ -2506,5 +2506,5 @@ m = y([
2506
2506
  Zt("auth")
2507
2507
  ], m);
2508
2508
  export {
2509
- m as CalsAuth
2509
+ m as Auth
2510
2510
  };
@@ -1,12 +1,18 @@
1
+ import { AxiosInstance } from 'axios';
1
2
  import { CSSResult } from 'lit';
2
3
  import { LitElement } from 'lit';
3
4
  import { nothing } from 'lit';
4
5
  import { PropertyValues } from 'lit';
5
6
  import { TemplateResult } from 'lit-html';
6
7
 
7
- declare type AuthMode = 'signin' | 'signup';
8
+ export declare const apiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
8
9
 
9
- export declare class CalsAuth extends LitElement {
10
+ declare interface ApiClientConfig {
11
+ baseUrl: string;
12
+ apiBaseUrl?: string;
13
+ }
14
+
15
+ export declare class Auth extends LitElement {
10
16
  open: boolean;
11
17
  initialMode: AuthMode;
12
18
  logoUrl: string;
@@ -110,7 +116,15 @@ export declare class CalsAuth extends LitElement {
110
116
  static styles: CSSResult;
111
117
  }
112
118
 
113
- export declare class CalsThemeToggle extends LitElement {
119
+ declare type AuthMode = 'signin' | 'signup';
120
+
121
+ export declare class AuthRefreshError extends Error {
122
+ constructor(message?: string);
123
+ }
124
+
125
+ export declare const createApiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
126
+
127
+ export declare class ThemeToggle extends LitElement {
114
128
  theme: 'light' | 'dark';
115
129
  storageKey: string;
116
130
  size: 'sm' | 'md' | 'lg';
@@ -752,5 +752,5 @@ g = E([
752
752
  Ut("cals-theme-toggle")
753
753
  ], g);
754
754
  export {
755
- g as CalsThemeToggle
755
+ g as ThemeToggle
756
756
  };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
+ import { AxiosInstance } from 'axios';
1
2
  import { CSSResult } from 'lit';
2
3
  import { LitElement } from 'lit';
3
4
  import { nothing } from 'lit';
4
5
  import { PropertyValues } from 'lit';
5
6
  import { TemplateResult } from 'lit-html';
6
7
 
7
- declare type AuthMode = 'signin' | 'signup';
8
+ export declare const apiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
8
9
 
9
- export declare class CalsAuth extends LitElement {
10
+ declare interface ApiClientConfig {
11
+ baseUrl: string;
12
+ apiBaseUrl?: string;
13
+ }
14
+
15
+ export declare class Auth extends LitElement {
10
16
  open: boolean;
11
17
  initialMode: AuthMode;
12
18
  logoUrl: string;
@@ -110,7 +116,15 @@ export declare class CalsAuth extends LitElement {
110
116
  static styles: CSSResult;
111
117
  }
112
118
 
113
- export declare class CalsThemeToggle extends LitElement {
119
+ declare type AuthMode = 'signin' | 'signup';
120
+
121
+ export declare class AuthRefreshError extends Error {
122
+ constructor(message?: string);
123
+ }
124
+
125
+ export declare const createApiClient: ({ baseUrl, apiBaseUrl }: ApiClientConfig) => AxiosInstance;
126
+
127
+ export declare class ThemeToggle extends LitElement {
114
128
  theme: 'light' | 'dark';
115
129
  storageKey: string;
116
130
  size: 'sm' | 'md' | 'lg';