xv-webcomponents 0.1.3
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/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/xv-button-v2.d.ts +11 -0
- package/dist/components/xv-checkbox-v2.d.ts +11 -0
- package/dist/components/xv-checkbox.d.ts +11 -0
- package/dist/types/components/xv-button/xv-button.d.ts +16 -0
- package/dist/types/components/xv-checkbox/xv-checkbox.d.ts +7 -0
- package/dist/types/components.d.ts +95 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/xv-webcomponents/app-globals-0f993ce5.js +5 -0
- package/dist/xv-webcomponents/app-globals-0f993ce5.js.map +1 -0
- package/dist/xv-webcomponents/index-5f0a9e2d.js +3922 -0
- package/dist/xv-webcomponents/index-5f0a9e2d.js.map +1 -0
- package/dist/xv-webcomponents/index.esm.js +17 -0
- package/dist/xv-webcomponents/index.esm.js.map +1 -0
- package/dist/xv-webcomponents/xv-button-v2.entry.js +37 -0
- package/dist/xv-webcomponents/xv-button-v2.entry.js.map +1 -0
- package/dist/xv-webcomponents/xv-checkbox-08da5153.js +28 -0
- package/dist/xv-webcomponents/xv-checkbox-08da5153.js.map +1 -0
- package/dist/xv-webcomponents/xv-checkbox-v2.entry.js +4 -0
- package/dist/xv-webcomponents/xv-checkbox-v2.entry.js.map +1 -0
- package/dist/xv-webcomponents/xv-checkbox.entry.js +4 -0
- package/dist/xv-webcomponents/xv-checkbox.entry.js.map +1 -0
- package/dist/xv-webcomponents/xv-webcomponents.esm.js +49 -0
- package/dist/xv-webcomponents/xv-webcomponents.esm.js.map +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 crossvertise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @xv/webcomponents-base
|
|
2
|
+
|
|
3
|
+
**Reusable Web Components for XV Applications**
|
|
4
|
+
This repository contains Web Components built with Stencil.js to provide a modular and reusable UI across multiple applications.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
**Reusable Web Components** – Designed for multiple XV applications
|
|
11
|
+
**Stencil.js Powered** – Built using modern Web Component standards
|
|
12
|
+
**Shadow DOM Support** – Encapsulated styles and functionality
|
|
13
|
+
**Brand-Specific Theming** – Automatically detects and applies brand styles
|
|
14
|
+
**Framework Agnostic** – Works with Angular, React, Vue, and plain HTML
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Folder Structure
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
xv-webcomponents-base/
|
|
22
|
+
│── src/
|
|
23
|
+
│ ├── components/ # Web Component source files
|
|
24
|
+
│ │ ├── button/
|
|
25
|
+
│ │ │ ├── xv-button.tsx
|
|
26
|
+
│ │ │ ├── xv-button.css
|
|
27
|
+
│ │ │ ├── xv-button.e2e.ts
|
|
28
|
+
│ │ │ ├── xv-button.spec.ts
|
|
29
|
+
│ │ ├── checkbox/
|
|
30
|
+
│ │ │ ├── xv-checkbox.tsx
|
|
31
|
+
│ │ │ ├── xv-checkbox.css
|
|
32
|
+
│ │ │ ├── xv-checkbox.e2e.ts
|
|
33
|
+
│ │ │ ├── xv-checkbox.spec.ts
|
|
34
|
+
│ ├── utils/ # Utility functions for components
|
|
35
|
+
│── dist/ # Compiled distribution files
|
|
36
|
+
│── loader/ # Loader scripts for consuming Web Components
|
|
37
|
+
│── package.json
|
|
38
|
+
│── README.md
|
|
39
|
+
│── stencil.config.ts # Stencil.js configuration
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
To install the package from npm:
|
|
47
|
+
```bash
|
|
48
|
+
npm install @xv/webcomponents-base
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
### **Using in an HTML Page**
|
|
56
|
+
Simply include the Web Component in your HTML:
|
|
57
|
+
```html
|
|
58
|
+
<script type="module" src="https://cdn.yourcompany.com/xv-webcomponents/xv-webcomponents.esm.js"></script>
|
|
59
|
+
<xv-button-v2 label="Click Me" variant="accent"></xv-button-v2>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### **Using in an Angular Project**
|
|
63
|
+
First, import `CUSTOM_ELEMENTS_SCHEMA` in your module:
|
|
64
|
+
```typescript
|
|
65
|
+
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
66
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
67
|
+
|
|
68
|
+
@NgModule({
|
|
69
|
+
declarations: [],
|
|
70
|
+
imports: [BrowserModule],
|
|
71
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
72
|
+
})
|
|
73
|
+
export class AppModule {}
|
|
74
|
+
```
|
|
75
|
+
Now, use the Web Component in your Angular templates:
|
|
76
|
+
```html
|
|
77
|
+
<xv-button-v2 label="Click Me" variant="primary"></xv-button-v2>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### **Using in a C# Razor Page (MVC)**
|
|
81
|
+
```html
|
|
82
|
+
<xv-button-v2 label="Submit" variant="secondary"></xv-button-v2>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### **Using in Sitefinity CMS**
|
|
86
|
+
Embed the Web Component inside a content block:
|
|
87
|
+
```html
|
|
88
|
+
<xv-button-v2 label="Learn More" variant="ghost"></xv-button-v2>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 🛠 Development & Building
|
|
94
|
+
|
|
95
|
+
### **1️⃣ Build the Components**
|
|
96
|
+
To build all components:
|
|
97
|
+
```bash
|
|
98
|
+
npm run build
|
|
99
|
+
```
|
|
100
|
+
This generates compiled components inside the `dist/` folder.
|
|
101
|
+
|
|
102
|
+
### **2️⃣ Run Local Development Server**
|
|
103
|
+
To test components locally:
|
|
104
|
+
```bash
|
|
105
|
+
npm start
|
|
106
|
+
```
|
|
107
|
+
This starts a development server and watches for changes.
|
|
108
|
+
|
|
109
|
+
### **3️⃣ Publish to npm**
|
|
110
|
+
To publish a new version of the package:
|
|
111
|
+
```bash
|
|
112
|
+
npm version patch
|
|
113
|
+
npm publish --access public
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Contributing
|
|
119
|
+
|
|
120
|
+
### **Adding a New Component**
|
|
121
|
+
1. Generate a new component:
|
|
122
|
+
```bash
|
|
123
|
+
npm run generate component xv-new-component
|
|
124
|
+
```
|
|
125
|
+
2. Implement logic and styles inside `src/components/xv-new-component/`.
|
|
126
|
+
3. Test the component using Jest (`.spec.ts`) and e2e tests.
|
|
127
|
+
4. Run `npm run build` to generate the compiled version.
|
|
128
|
+
5. Commit changes and submit a pull request.
|
|
129
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
|
|
3
|
+
* if the path needs to be customized.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getAssetPath: (path: string) => string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to manually set the base path where assets can be found.
|
|
9
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
10
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
11
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
12
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
13
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
14
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
15
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
16
|
+
*/
|
|
17
|
+
export declare const setAssetPath: (path: string) => void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
21
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
22
|
+
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
23
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
24
|
+
* will result in the same behavior.
|
|
25
|
+
*/
|
|
26
|
+
export declare const setNonce: (nonce: string) => void
|
|
27
|
+
|
|
28
|
+
export interface SetPlatformOptions {
|
|
29
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
30
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
31
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface XvButtonV2 extends Components.XvButtonV2, HTMLElement {}
|
|
4
|
+
export const XvButtonV2: {
|
|
5
|
+
prototype: XvButtonV2;
|
|
6
|
+
new (): XvButtonV2;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface XvCheckboxV2 extends Components.XvCheckboxV2, HTMLElement {}
|
|
4
|
+
export const XvCheckboxV2: {
|
|
5
|
+
prototype: XvCheckboxV2;
|
|
6
|
+
new (): XvCheckboxV2;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface XvCheckbox extends Components.XvCheckbox, HTMLElement {}
|
|
4
|
+
export const XvCheckbox: {
|
|
5
|
+
prototype: XvCheckbox;
|
|
6
|
+
new (): XvCheckbox;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class XvButton {
|
|
2
|
+
el: HTMLElement;
|
|
3
|
+
/** Button label */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Variant */
|
|
6
|
+
variant: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'ghost';
|
|
7
|
+
/** Size */
|
|
8
|
+
size: 'small' | 'medium' | 'large';
|
|
9
|
+
/** Disabled state */
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
/** Automatically detected brand */
|
|
12
|
+
detectedBrand: string;
|
|
13
|
+
private applyGlobalStyles;
|
|
14
|
+
componentWillLoad(): void;
|
|
15
|
+
render(): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
export namespace Components {
|
|
9
|
+
interface XvButtonV2 {
|
|
10
|
+
/**
|
|
11
|
+
* Disabled state
|
|
12
|
+
*/
|
|
13
|
+
"disabled": boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Button label
|
|
16
|
+
*/
|
|
17
|
+
"label": string;
|
|
18
|
+
/**
|
|
19
|
+
* Size
|
|
20
|
+
*/
|
|
21
|
+
"size": 'small' | 'medium' | 'large';
|
|
22
|
+
/**
|
|
23
|
+
* Variant
|
|
24
|
+
*/
|
|
25
|
+
"variant": 'accent' | 'primary' | 'secondary' | 'tertiary' | 'ghost';
|
|
26
|
+
}
|
|
27
|
+
interface XvCheckbox {
|
|
28
|
+
}
|
|
29
|
+
interface XvCheckboxV2 {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
declare global {
|
|
33
|
+
interface HTMLXvButtonV2Element extends Components.XvButtonV2, HTMLStencilElement {
|
|
34
|
+
}
|
|
35
|
+
var HTMLXvButtonV2Element: {
|
|
36
|
+
prototype: HTMLXvButtonV2Element;
|
|
37
|
+
new (): HTMLXvButtonV2Element;
|
|
38
|
+
};
|
|
39
|
+
interface HTMLXvCheckboxElement extends Components.XvCheckbox, HTMLStencilElement {
|
|
40
|
+
}
|
|
41
|
+
var HTMLXvCheckboxElement: {
|
|
42
|
+
prototype: HTMLXvCheckboxElement;
|
|
43
|
+
new (): HTMLXvCheckboxElement;
|
|
44
|
+
};
|
|
45
|
+
interface HTMLXvCheckboxV2Element extends Components.XvCheckboxV2, HTMLStencilElement {
|
|
46
|
+
}
|
|
47
|
+
var HTMLXvCheckboxV2Element: {
|
|
48
|
+
prototype: HTMLXvCheckboxV2Element;
|
|
49
|
+
new (): HTMLXvCheckboxV2Element;
|
|
50
|
+
};
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
"xv-button-v2": HTMLXvButtonV2Element;
|
|
53
|
+
"xv-checkbox": HTMLXvCheckboxElement;
|
|
54
|
+
"xv-checkbox-v2": HTMLXvCheckboxV2Element;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
declare namespace LocalJSX {
|
|
58
|
+
interface XvButtonV2 {
|
|
59
|
+
/**
|
|
60
|
+
* Disabled state
|
|
61
|
+
*/
|
|
62
|
+
"disabled"?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Button label
|
|
65
|
+
*/
|
|
66
|
+
"label"?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Size
|
|
69
|
+
*/
|
|
70
|
+
"size"?: 'small' | 'medium' | 'large';
|
|
71
|
+
/**
|
|
72
|
+
* Variant
|
|
73
|
+
*/
|
|
74
|
+
"variant"?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'ghost';
|
|
75
|
+
}
|
|
76
|
+
interface XvCheckbox {
|
|
77
|
+
}
|
|
78
|
+
interface XvCheckboxV2 {
|
|
79
|
+
}
|
|
80
|
+
interface IntrinsicElements {
|
|
81
|
+
"xv-button-v2": XvButtonV2;
|
|
82
|
+
"xv-checkbox": XvCheckbox;
|
|
83
|
+
"xv-checkbox-v2": XvCheckboxV2;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export { LocalJSX as JSX };
|
|
87
|
+
declare module "@stencil/core" {
|
|
88
|
+
export namespace JSX {
|
|
89
|
+
interface IntrinsicElements {
|
|
90
|
+
"xv-button-v2": LocalJSX.XvButtonV2 & JSXBase.HTMLAttributes<HTMLXvButtonV2Element>;
|
|
91
|
+
"xv-checkbox": LocalJSX.XvCheckbox & JSXBase.HTMLAttributes<HTMLXvCheckboxElement>;
|
|
92
|
+
"xv-checkbox-v2": LocalJSX.XvCheckboxV2 & JSXBase.HTMLAttributes<HTMLXvCheckboxV2Element>;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview entry point for your component library
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
+
* constants or data structure that accompany your components.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
+
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
+
*/
|
|
10
|
+
export { format } from './utils/utils';
|
|
11
|
+
export type * from './components.d.ts';
|