@vouchfor/embeds 0.0.0-experiment.039a74b
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/components/InlineEmbed.d.ts +17 -0
- package/dist/es/components/index.d.ts +2 -0
- package/dist/es/embeds.js +16 -0
- package/dist/es/embeds.js.map +1 -0
- package/dist/es/index.d.ts +1 -0
- package/dist/iife/embeds.iife.js +1351 -0
- package/dist/iife/embeds.iife.js.map +1 -0
- package/package.json +74 -0
- package/src/components/InlineEmbed.stories.ts +119 -0
- package/src/components/InlineEmbed.ts +24 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/vite-env.d.ts +1 -0
package/package.json
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
{
|
2
|
+
"name": "@vouchfor/embeds",
|
3
|
+
"version": "0.0.0-experiment.039a74b",
|
4
|
+
"license": "MIT",
|
5
|
+
"author": "Aaron Williams",
|
6
|
+
"main": "dist/es/embeds.js",
|
7
|
+
"module": "dist/es/embeds.js",
|
8
|
+
"type": "module",
|
9
|
+
"types": "dist/es/index.d.ts",
|
10
|
+
"exports": {
|
11
|
+
".": "./dist/es/embeds.js",
|
12
|
+
"./embed": "./dist/iife/embeds.iife.js"
|
13
|
+
},
|
14
|
+
"files": ["dist", "src"],
|
15
|
+
"publishConfig": {
|
16
|
+
"tag": "experiment",
|
17
|
+
"access": "public"
|
18
|
+
},
|
19
|
+
"scripts": {
|
20
|
+
"build": "rm -rf dist && tsc && vite build --mode iife && vite build --mode es",
|
21
|
+
"build:deps": "yarn --cwd ../media-player build",
|
22
|
+
"build:package": "yarn build",
|
23
|
+
"build:storybook": "yarn prebuild && storybook build",
|
24
|
+
"generate:manifest": "wca src --outFile custom-elements.json",
|
25
|
+
"lint": "eslint . --quiet",
|
26
|
+
"lint:fix": "eslint . --fix",
|
27
|
+
"lint:staged": "lint-staged",
|
28
|
+
"prepublishOnly": "yarn build",
|
29
|
+
"size": "size-limit",
|
30
|
+
"storybook": "yarn prebuild && storybook dev -p 6006",
|
31
|
+
"prebuild": "yarn build:deps && yarn generate:manifest",
|
32
|
+
"test": "true"
|
33
|
+
},
|
34
|
+
"lint-staged": {
|
35
|
+
"**/*.{ts,tsx,js}": "eslint --fix --quiet",
|
36
|
+
"**/*.{md,json,yml}": "prettier --write"
|
37
|
+
},
|
38
|
+
"dependencies": {
|
39
|
+
"@vouchfor/media-player": "0.0.0-experiment.039a74b"
|
40
|
+
},
|
41
|
+
"peerDependencies": {
|
42
|
+
"lit": "^2.7.5"
|
43
|
+
},
|
44
|
+
"devDependencies": {
|
45
|
+
"@esm-bundle/chai": "^4.3.4-fix.0",
|
46
|
+
"@open-wc/testing": "^3.2.0",
|
47
|
+
"@storybook/addon-essentials": "^7.4.5",
|
48
|
+
"@storybook/addon-links": "^7.4.5",
|
49
|
+
"@storybook/blocks": "^7.4.5",
|
50
|
+
"@storybook/web-components": "^7.4.5",
|
51
|
+
"@storybook/web-components-vite": "^7.4.5",
|
52
|
+
"@types/mocha": "^10.0.1",
|
53
|
+
"@vouchfor/eslint-config": "^1.0.0",
|
54
|
+
"@vouchfor/prettier-config": "^1.0.0",
|
55
|
+
"@web/dev-server-esbuild": "^0.4.1",
|
56
|
+
"@web/test-runner": "^0.17.1",
|
57
|
+
"@web/test-runner-browserstack": "^0.6.1",
|
58
|
+
"@web/test-runner-mocha": "^0.8.1",
|
59
|
+
"@web/test-runner-playwright": "^0.10.1",
|
60
|
+
"dotenv": "^16.3.1",
|
61
|
+
"eslint": "^8.50.0",
|
62
|
+
"eslint-plugin-import": "^2.28.1",
|
63
|
+
"lint-staged": "^14.0.1",
|
64
|
+
"lit": "^2.8.0",
|
65
|
+
"prettier": "^3.0.3",
|
66
|
+
"react": "^18.2.0",
|
67
|
+
"react-dom": "^18.2.0",
|
68
|
+
"storybook": "^7.4.5",
|
69
|
+
"typescript": "^5.1.3",
|
70
|
+
"vite": "^4.4.9",
|
71
|
+
"vite-plugin-dts": "^3.6.0",
|
72
|
+
"web-component-analyzer": "^1.1.7"
|
73
|
+
}
|
74
|
+
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import { html } from 'lit';
|
2
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
3
|
+
|
4
|
+
import type { InlineEmbedProps } from './';
|
5
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
6
|
+
|
7
|
+
import './';
|
8
|
+
|
9
|
+
type InlineEmbedArgs = InlineEmbedProps & {
|
10
|
+
showVouch?: boolean;
|
11
|
+
};
|
12
|
+
|
13
|
+
const _InlineEmbed = ({
|
14
|
+
vouchHashId,
|
15
|
+
preload,
|
16
|
+
autoplay,
|
17
|
+
env,
|
18
|
+
apiKey,
|
19
|
+
controls,
|
20
|
+
enableTracking,
|
21
|
+
trackingSource,
|
22
|
+
|
23
|
+
// Template properties
|
24
|
+
type,
|
25
|
+
format,
|
26
|
+
resolution,
|
27
|
+
aspectRatio,
|
28
|
+
headerShortName,
|
29
|
+
headerSubtitle,
|
30
|
+
headerBrandLogo
|
31
|
+
}: InlineEmbedArgs) => {
|
32
|
+
return html`
|
33
|
+
<div style="height: 100vh">
|
34
|
+
<vembed-inline
|
35
|
+
env=${ifDefined(env)}
|
36
|
+
apiKey=${ifDefined(apiKey)}
|
37
|
+
?autoplay=${autoplay}
|
38
|
+
?enableTracking=${enableTracking}
|
39
|
+
.vouchHashId=${vouchHashId}
|
40
|
+
resolution=${ifDefined(resolution)}
|
41
|
+
aspectRatio=${ifDefined(aspectRatio)}
|
42
|
+
preload=${ifDefined(preload)}
|
43
|
+
type=${ifDefined(type)}
|
44
|
+
.controls=${controls}
|
45
|
+
trackingSource=${ifDefined(trackingSource)}
|
46
|
+
format=${ifDefined(format)}
|
47
|
+
?headerShortName=${headerShortName}
|
48
|
+
?headerBrandLogo=${headerBrandLogo}
|
49
|
+
headerSubtitle=${ifDefined(headerSubtitle)}
|
50
|
+
></vembed-inline>
|
51
|
+
</div>
|
52
|
+
`;
|
53
|
+
};
|
54
|
+
|
55
|
+
// More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction
|
56
|
+
const meta = {
|
57
|
+
title: 'Embeds/Inline',
|
58
|
+
tags: ['autodocs'],
|
59
|
+
render: (args) => _InlineEmbed(args),
|
60
|
+
component: 'vembed-inline'
|
61
|
+
} satisfies Meta<InlineEmbedProps>;
|
62
|
+
|
63
|
+
type Story = StoryObj<InlineEmbedArgs>;
|
64
|
+
|
65
|
+
const InlineEmbed: Story = {
|
66
|
+
args: {
|
67
|
+
env: 'dev',
|
68
|
+
apiKey: 'RtW1R7JYej-pymoGNEUCblZz0NTLZzsuC9xKxcsewIYpf3UEIePcGvtkRnd4K',
|
69
|
+
vouchHashId: 'X526IKhw90',
|
70
|
+
resolution: 1080,
|
71
|
+
aspectRatio: 0,
|
72
|
+
preload: 'none',
|
73
|
+
autoplay: false,
|
74
|
+
enableTracking: true,
|
75
|
+
trackingSource: 'media_player_storybook',
|
76
|
+
|
77
|
+
type: 'BASIC',
|
78
|
+
format: 'letterbox',
|
79
|
+
headerShortName: true,
|
80
|
+
headerSubtitle: 'client',
|
81
|
+
headerBrandLogo: false,
|
82
|
+
|
83
|
+
showVouch: true
|
84
|
+
},
|
85
|
+
argTypes: {
|
86
|
+
type: {
|
87
|
+
control: 'radio',
|
88
|
+
options: ['BARE', 'BASIC', 'INLINE', 'JUMBO', 'FOUNDIT', 'CISCO']
|
89
|
+
},
|
90
|
+
headerSubtitle: {
|
91
|
+
control: 'radio',
|
92
|
+
options: ['role', 'client']
|
93
|
+
},
|
94
|
+
headerShortName: {
|
95
|
+
control: 'boolean'
|
96
|
+
},
|
97
|
+
headerBrandLogo: {
|
98
|
+
control: 'boolean'
|
99
|
+
},
|
100
|
+
preload: {
|
101
|
+
control: 'radio',
|
102
|
+
options: ['auto', 'none']
|
103
|
+
},
|
104
|
+
format: {
|
105
|
+
control: 'radio',
|
106
|
+
options: ['letterbox', 'letterbox-video', 'crop', 'crop-top', 'squarebox']
|
107
|
+
},
|
108
|
+
env: {
|
109
|
+
control: 'radio',
|
110
|
+
options: ['prod', 'staging', 'dev']
|
111
|
+
}
|
112
|
+
},
|
113
|
+
parameters: {
|
114
|
+
layout: 'fullscreen'
|
115
|
+
}
|
116
|
+
};
|
117
|
+
|
118
|
+
export default meta;
|
119
|
+
export { InlineEmbed };
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { MediaPlayer } from '@vouchfor/media-player';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
|
4
|
+
import type { MediaPlayerProps } from '@vouchfor/media-player';
|
5
|
+
|
6
|
+
type InlineEmbedProps = MediaPlayerProps;
|
7
|
+
|
8
|
+
@customElement('vembed-inline')
|
9
|
+
class InlineEmbed extends MediaPlayer {}
|
10
|
+
|
11
|
+
declare global {
|
12
|
+
interface HTMLElementTagNameMap {
|
13
|
+
'vembed-inline': InlineEmbed;
|
14
|
+
}
|
15
|
+
|
16
|
+
namespace JSX {
|
17
|
+
interface IntrinsicElements {
|
18
|
+
'vembed-inline': InlineEmbed;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
export { InlineEmbed };
|
24
|
+
export type { InlineEmbedProps };
|
package/src/index.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export { InlineEmbed } from '~/components/InlineEmbed';
|
@@ -0,0 +1 @@
|
|
1
|
+
/// <reference types="vite/client" />
|