-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·98 lines (85 loc) · 2.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html>
<head>
<script src="https://root/simply/simply.min.js"></script>
<script type="module" src="https://unpkg.com/api-viewer-element?module"></script>
<link rel="shortcut icon" href="#">
</head>
<body>
<api-viewer section="demo">
<template data-element="s-icon" data-target="knob" data-attr="height" data-type="string" attribute-knobs="?test">
<input/>
</template>
<template data-target="host" data-element="s-icon">
<s-icon icon="cil:locomotive" height="100"></s-icon>
</template>
</api-viewer>
<script>
get("../s-icon.html", "s-icon");
</script>
<script type="module">
import { create, ts, litPlugin } from 'https://cdn.jsdelivr.net/npm/@custom-elements-manifest/analyzer@0.6.6/browser/index.js';
var test = function () {
/**
* @attr {boolean} disabled - disables the element
* @attribute {string} foo - description for foo
*
* @csspart bar - Styles the color of b
*
* @slot - This is a default/unnamed slot
* @slot container - You can put some elements here
*
* @cssprop --text-color - Controls the color of f
* @cssproperty [--background-color=red] - Controls the color of bar
*
* @prop {string} [data.props.icon=cil:locomotive] - some description
* @fires {CustomEvent} animalfound-changed - Event fired when value is changed
* @property {string} [data['props']['height']=100] - some description
*
* @fires custom-event - some description for custom-event
* @fires {Event} typed-event - some description for typed-event
* @event {CustomEvent} typed-custom-event - some description for typed-custom-event
*
* @summary This is MyElementttt
*
* @tag s-icon
* @tagname ssss
*/
class UnityComponent extends HTMLElement { } customElements.define("s-icon", UnityComponent);
}
console.log(test.toString(), document.query);
const modules = [ts.createSourceFile(
'my-element.js',
test.toString(),
ts.ScriptTarget.ES2015,
true
)];
const manifest = create({
plugins: [...litPlugin()],
modules,
context: { dev: false },
});
document.querySelector('api-viewer').manifest = manifest;
let _onPropChanged = function (e) {
console.log("naber iyi");
const target = e.composedPath()[0];
const { name, type } = target.dataset;
let value;
switch (type) {
case 'boolean':
value = target.checked;
break;
case 'number':
value = target.value === '' ? null : Number(target.value);
break;
default:
value = target.value;}
const { knob, custom } = this.getKnob(name);
if (knob) {
this.setKnobs(name, type, value, knob.attribute, custom);
}
}
var opc = customElements.get("api-demo-layout").prototype._onPropChanged = _onPropChanged;
console.log(manifest);
</script>
</body>
</html>