@skhema/web-component 0.0.9
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 +57 -0
- package/dist/cdn.d.ts +4 -0
- package/dist/cdn.d.ts.map +1 -0
- package/dist/components/SkhemaElement.d.ts +34 -0
- package/dist/components/SkhemaElement.d.ts.map +1 -0
- package/dist/components/types.d.ts +43 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/index.cjs +675 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +675 -0
- package/dist/index.es.js.map +1 -0
- package/dist/utils/analytics.d.ts +7 -0
- package/dist/utils/analytics.d.ts.map +1 -0
- package/dist/utils/seo.d.ts +12 -0
- package/dist/utils/seo.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +12 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/web-component.min.js +2 -0
- package/dist/web-component.min.js.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @skhema/web-component
|
|
2
|
+
|
|
3
|
+
An embeddable web component for Contributor's to wrap content that can be immediately integrated in to Skhema's business strategy platform.
|
|
4
|
+
|
|
5
|
+
## CDN Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<script src="https://unpkg.com/@skhema/web-component"></script>
|
|
9
|
+
|
|
10
|
+
<skhema-element element-type="key_challenge" contributor-id="your_username">
|
|
11
|
+
Strategic busines content goes here.
|
|
12
|
+
</skhema-element>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## NPM Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @skhema/web-component
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import '@skhema/web-component';
|
|
23
|
+
// Component is automatically registered
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Attributes
|
|
27
|
+
|
|
28
|
+
| Attribute | Required | Description |
|
|
29
|
+
|-----------|----------|-------------|
|
|
30
|
+
| `element-type` | ✓ | Type of strategic element |
|
|
31
|
+
| `contributor-id` | ✓ | Your contributor identifier |
|
|
32
|
+
| `content` | | Alternative to inner text |
|
|
33
|
+
| `theme` | | Visual theme: `light`, `dark`, `auto` |
|
|
34
|
+
|
|
35
|
+
## Element Types
|
|
36
|
+
|
|
37
|
+
- `key_challenge` - Business challenges
|
|
38
|
+
- `supporting_fact` - Evidence and data points
|
|
39
|
+
- `guiding_policy` - Strategic approaches
|
|
40
|
+
- `solution_alternative` - Potential solutions
|
|
41
|
+
- And more...
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<article>
|
|
47
|
+
<p>The automotive industry is undergoing transformation...</p>
|
|
48
|
+
|
|
49
|
+
<skhema-element element-type="key_challenge" contributor-id="analyst">
|
|
50
|
+
Traditional automakers face retooling challenges while competing with Tesla.
|
|
51
|
+
</skhema-element>
|
|
52
|
+
</article>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
package/dist/cdn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAY9D,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SkhemaElementAttributes, ContentData, SkhemaElementEventMap } from './types.js';
|
|
2
|
+
|
|
3
|
+
export declare class SkhemaElement extends HTMLElement {
|
|
4
|
+
private shadow;
|
|
5
|
+
private contentData;
|
|
6
|
+
private componentConnected;
|
|
7
|
+
constructor();
|
|
8
|
+
static get observedAttributes(): (keyof SkhemaElementAttributes)[];
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(_name: keyof SkhemaElementAttributes, oldValue: string | null, newValue: string | null): void;
|
|
11
|
+
private render;
|
|
12
|
+
private getContent;
|
|
13
|
+
private renderContent;
|
|
14
|
+
private formatContributorName;
|
|
15
|
+
private getInitials;
|
|
16
|
+
private renderError;
|
|
17
|
+
private addStructuredData;
|
|
18
|
+
private trackLoad;
|
|
19
|
+
private handleSaveClick;
|
|
20
|
+
getContentData(): ContentData | null;
|
|
21
|
+
refresh(): void;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementEventMap extends SkhemaElementEventMap {
|
|
25
|
+
}
|
|
26
|
+
namespace JSX {
|
|
27
|
+
interface IntrinsicElements {
|
|
28
|
+
'skhema-element': Partial<SkhemaElementAttributes> & {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=SkhemaElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkhemaElement.d.ts","sourceRoot":"","sources":["../../src/components/SkhemaElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAkB,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA8T9G,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,kBAAkB,CAAS;;IAOnC,MAAM,KAAK,kBAAkB,IAAI,CAAC,MAAM,uBAAuB,CAAC,EAAE,CAEjE;IAED,iBAAiB;IAYjB,wBAAwB,CAAC,KAAK,EAAE,MAAM,uBAAuB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAM/G,OAAO,CAAC,MAAM;IA4Bd,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,aAAa;IAiErB,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,iBAAiB;YAoBX,SAAS;YAsBT,eAAe;IAgBtB,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC,OAAO,IAAI,IAAI;CAGvB;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAoB,SAAQ,qBAAqB;KAAG;IAE9D,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,gBAAgB,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG;gBACnD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;aACpB,CAAC;SACH;KACF;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ElementValue } from '@skhema/types';
|
|
2
|
+
|
|
3
|
+
export interface SkhemaElementAttributes {
|
|
4
|
+
'element-type': ElementValue;
|
|
5
|
+
'contributor-id': string;
|
|
6
|
+
'content'?: string;
|
|
7
|
+
'source-url'?: string;
|
|
8
|
+
'theme'?: 'light' | 'dark' | 'auto';
|
|
9
|
+
'track-analytics'?: 'true' | 'false';
|
|
10
|
+
}
|
|
11
|
+
export interface EmbedAnalytics {
|
|
12
|
+
contributorId: string;
|
|
13
|
+
elementType: ElementValue;
|
|
14
|
+
contentHash: string;
|
|
15
|
+
pageUrl: string;
|
|
16
|
+
pageTitle?: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
userAgent?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ContentData {
|
|
21
|
+
contributor_id: string;
|
|
22
|
+
element_type: ElementValue;
|
|
23
|
+
content: string;
|
|
24
|
+
content_hash: string;
|
|
25
|
+
source_url: string;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
page_title?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface RedirectUrlOptions {
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
utmSource?: string;
|
|
32
|
+
utmMedium?: string;
|
|
33
|
+
utmCampaign?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SkhemaElementEventMap {
|
|
36
|
+
'skhema:load': CustomEvent<EmbedAnalytics>;
|
|
37
|
+
'skhema:click': CustomEvent<ContentData>;
|
|
38
|
+
'skhema:error': CustomEvent<{
|
|
39
|
+
error: string;
|
|
40
|
+
details?: any;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,YAAY,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,YAAY,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC3C,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACzC,cAAc,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;CAC/D"}
|