@operato/markdown 0.2.49
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/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/assets/scripts/markdown-webworker.js +30 -0
- package/demo/index.html +34 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/markdown-style.d.ts +1 -0
- package/dist/src/markdown-style.js +122 -0
- package/dist/src/markdown-style.js.map +1 -0
- package/dist/src/markdown.d.ts +1 -0
- package/dist/src/markdown.js +18 -0
- package/dist/src/markdown.js.map +1 -0
- package/dist/src/ox-layout.d.ts +45 -0
- package/dist/src/ox-layout.js +148 -0
- package/dist/src/ox-layout.js.map +1 -0
- package/dist/src/ox-markdown.d.ts +12 -0
- package/dist/src/ox-markdown.js +124 -0
- package/dist/src/ox-markdown.js.map +1 -0
- package/dist/src/ox-toolbar-style.d.ts +4 -0
- package/dist/src/ox-toolbar-style.js +226 -0
- package/dist/src/ox-toolbar-style.js.map +1 -0
- package/dist/src/ox-toolbar.d.ts +4 -0
- package/dist/src/ox-toolbar.js +122 -0
- package/dist/src/ox-toolbar.js.map +1 -0
- package/dist/stories/index.stories.d.ts +33 -0
- package/dist/stories/index.stories.js +33 -0
- package/dist/stories/index.stories.js.map +1 -0
- package/dist/test/ox-layout.test.d.ts +1 -0
- package/dist/test/ox-layout.test.js +24 -0
- package/dist/test/ox-layout.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +72 -0
- package/src/index.ts +1 -0
- package/src/markdown-style.ts +122 -0
- package/src/markdown.ts +20 -0
- package/src/ox-markdown.ts +119 -0
- package/tsconfig.json +22 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, css, html } from 'lit';
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators';
|
|
4
|
+
import { MarkdownStyle } from './markdown-style';
|
|
5
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
6
|
+
import { md } from './markdown';
|
|
7
|
+
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
8
|
+
let OxMarkdown = class OxMarkdown extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.toc = false;
|
|
12
|
+
this._headings = [];
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return html `
|
|
16
|
+
${this.toc ? this.renderToc() : html ``}
|
|
17
|
+
${this._html}
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
renderToc() {
|
|
21
|
+
var toc = this._headings || [];
|
|
22
|
+
return toc && toc.length > 0
|
|
23
|
+
? html `
|
|
24
|
+
<div id="toc">
|
|
25
|
+
Table Of Contents
|
|
26
|
+
<ul>
|
|
27
|
+
${toc.map(heading => html ` <li><a @click=${() => heading === null || heading === void 0 ? void 0 : heading.scrollIntoView()}>${heading.textContent}</a></li> `)}
|
|
28
|
+
</ul>
|
|
29
|
+
</div>
|
|
30
|
+
`
|
|
31
|
+
: html ``;
|
|
32
|
+
}
|
|
33
|
+
async updated(changed) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (changed.has('src')) {
|
|
36
|
+
if (this.src) {
|
|
37
|
+
const response = await fetch(this.src);
|
|
38
|
+
const content = await response.text();
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
this._html = html `
|
|
41
|
+
<h1>Error : ${response.status}</h1>
|
|
42
|
+
<div>${content}</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (((_a = response.headers.get('Content-Type')) === null || _a === void 0 ? void 0 : _a.indexOf('text/markdown')) !== -1) {
|
|
47
|
+
this._html = unsafeHTML((await md(content, {
|
|
48
|
+
baseUrl: this.src
|
|
49
|
+
})) || '');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this._html = unsafeHTML(content || '');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (changed.has('_html')) {
|
|
58
|
+
this._headings = Array.from(this.renderRoot.querySelectorAll('h2'));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
OxMarkdown.styles = [
|
|
63
|
+
ScrollbarStyles,
|
|
64
|
+
MarkdownStyle,
|
|
65
|
+
css `
|
|
66
|
+
#toc {
|
|
67
|
+
position: absolute;
|
|
68
|
+
max-width: 250px;
|
|
69
|
+
background-color: var(--theme-white-color);
|
|
70
|
+
padding: var(--padding-default);
|
|
71
|
+
right: var(--margin-wide);
|
|
72
|
+
font: bold var(--fontsize-large) var(--theme-font);
|
|
73
|
+
color: var(--secondary-text-color);
|
|
74
|
+
}
|
|
75
|
+
#toc ul {
|
|
76
|
+
list-style: circle;
|
|
77
|
+
margin: var(--margin-default) 0 0 var(--margin-wide);
|
|
78
|
+
padding: 0;
|
|
79
|
+
}
|
|
80
|
+
#toc a {
|
|
81
|
+
display: inline-block;
|
|
82
|
+
margin-left: -var(--margin-narrow);
|
|
83
|
+
padding: var(--padding-narrow) 0;
|
|
84
|
+
font: normal var(--fontsize-default) var(--theme-font);
|
|
85
|
+
color: var(--secondary-color);
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
#toc a:hover {
|
|
90
|
+
background-color: var(--theme-white-color);
|
|
91
|
+
text-decoration: underline;
|
|
92
|
+
color: var(--primary-color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media screen and (max-width: 480px) {
|
|
96
|
+
#toc {
|
|
97
|
+
background-color: var(--main-section-background-color);
|
|
98
|
+
border-left: 4px solid var(--primary-color);
|
|
99
|
+
border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
|
|
100
|
+
position: relative;
|
|
101
|
+
width: 100%;
|
|
102
|
+
max-width: initial;
|
|
103
|
+
padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`
|
|
107
|
+
];
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: String })
|
|
110
|
+
], OxMarkdown.prototype, "src", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: Boolean })
|
|
113
|
+
], OxMarkdown.prototype, "toc", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
state()
|
|
116
|
+
], OxMarkdown.prototype, "_html", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
state()
|
|
119
|
+
], OxMarkdown.prototype, "_headings", void 0);
|
|
120
|
+
OxMarkdown = __decorate([
|
|
121
|
+
customElement('ox-markdown')
|
|
122
|
+
], OxMarkdown);
|
|
123
|
+
export { OxMarkdown };
|
|
124
|
+
//# sourceMappingURL=ox-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-markdown.js","sourceRoot":"","sources":["../../src/ox-markdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkC,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAG5D,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,UAAU;IAA1C;;QAiD+B,QAAG,GAAY,KAAK,CAAA;QAGxC,cAAS,GAAU,EAA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jB,OAAO,EAAE,IAAI,CAAC,GAAG;yBACY,CAAC,CAAC,IAAI,EAAE,CACxC,CAAA;qBACF;yBAAM;wBACL,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;qBACvC;iBACF;aACF;SACF;QAED,IAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAA;SACpE;IACH,CAAC;CAEF,CAAA;AA3GQ,iBAAM,GAAG;IACd,eAAe;IACf,aAAa;IACb,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAa;AACX;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAqB;AAExC;IAAR,KAAK,EAAE;yCAAgD;AAC/C;IAAR,KAAK,EAAE;6CAAsB;AApDnB,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA4GtB;SA5GY,UAAU","sourcesContent":["import { LitElement, PropertyValues, TemplateResult, css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators'\n\nimport { DirectiveResult } from 'lit-html/directive'\nimport { MarkdownStyle } from './markdown-style'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { md } from './markdown'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html'\n\n@customElement('ox-markdown')\nexport class OxMarkdown extends LitElement {\n static styles = [\n ScrollbarStyles,\n MarkdownStyle,\n css`\n #toc {\n position: absolute;\n max-width: 250px;\n background-color: var(--theme-white-color);\n padding: var(--padding-default);\n right: var(--margin-wide);\n font: bold var(--fontsize-large) var(--theme-font);\n color: var(--secondary-text-color);\n }\n #toc ul {\n list-style: circle;\n margin: var(--margin-default) 0 0 var(--margin-wide);\n padding: 0;\n }\n #toc a {\n display: inline-block;\n margin-left: -var(--margin-narrow);\n padding: var(--padding-narrow) 0;\n font: normal var(--fontsize-default) var(--theme-font);\n color: var(--secondary-color);\n text-decoration: none;\n cursor: pointer;\n }\n #toc a:hover {\n background-color: var(--theme-white-color);\n text-decoration: underline;\n color: var(--primary-color);\n }\n\n @media screen and (max-width: 480px) {\n #toc {\n background-color: var(--main-section-background-color);\n border-left: 4px solid var(--primary-color);\n border-bottom: 1px dotted rgba(0, 0, 0, 0.2);\n position: relative;\n width: 100%;\n max-width: initial;\n padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);\n }\n }\n `\n ]\n\n @property({ type: String }) src?: string\n @property({ type: Boolean }) toc: boolean = false\n\n @state() _html?: TemplateResult | DirectiveResult | null\n @state() _headings: any[] = []\n\n render() {\n return html`\n ${this.toc ? this.renderToc() : html``}\n ${this._html}\n `\n }\n\n renderToc() {\n var toc = this._headings || []\n\n return toc && toc.length > 0\n ? html`\n <div id=\"toc\">\n Table Of Contents\n <ul>\n ${toc.map(\n heading => html` <li><a @click=${() => heading?.scrollIntoView()}>${heading.textContent}</a></li> `\n )}\n </ul>\n </div>\n `\n : html``\n }\n\n async updated(changed: PropertyValues<this>) {\n if (changed.has('src')) {\n if (this.src) {\n const response = await fetch(this.src)\n const content = await response.text()\n\n if (!response.ok) {\n this._html = html`\n <h1>Error : ${response.status}</h1>\n <div>${content}</div>\n `\n } else {\n if (response.headers.get('Content-Type')?.indexOf('text/markdown') !== -1) {\n this._html = unsafeHTML(\n (await md(content, {\n baseUrl: this.src\n } as StructuredSerializeOptions)) || ''\n )\n } else {\n this._html = unsafeHTML(content || '')\n }\n }\n }\n }\n \n if(changed.has('_html')) {\n this._headings = Array.from(this.renderRoot.querySelectorAll('h2'))\n }\n }\n\n}\n"]}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { css } from 'lit-element';
|
|
5
|
+
export const style = css `
|
|
6
|
+
:host {
|
|
7
|
+
background-color: var(--edit-toolbar-background-color, #394e64);
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[tools] {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
overflow: none;
|
|
15
|
+
padding: 0px 10px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[tools] > * {
|
|
19
|
+
padding: 0px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[tools] > span[button] {
|
|
23
|
+
min-width: 30px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[tools] > span[padding] {
|
|
27
|
+
flex: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[tools] > .vline {
|
|
31
|
+
display: block;
|
|
32
|
+
flex: none;
|
|
33
|
+
border-left: 1px solid rgba(255, 255, 255, 0.2);
|
|
34
|
+
border-right: 1px solid rgba(0, 0, 0, 0.15);
|
|
35
|
+
width: 0px;
|
|
36
|
+
height: 18px;
|
|
37
|
+
margin: 0 3px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
span[button] {
|
|
41
|
+
min-height: 35px;
|
|
42
|
+
|
|
43
|
+
background: url('/assets/images/icon-htoolbar.png') no-repeat;
|
|
44
|
+
background-position-x: 50%;
|
|
45
|
+
opacity: 0.8;
|
|
46
|
+
}
|
|
47
|
+
span[button]:hover {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#fullscreen,
|
|
54
|
+
#toggle-property {
|
|
55
|
+
flex: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#align-left {
|
|
59
|
+
background-position-y: 8px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#align-center {
|
|
63
|
+
background-position-y: -42px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#align-right {
|
|
67
|
+
background-position-y: -92px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#align-top {
|
|
71
|
+
background-position-y: -142px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#align-middle {
|
|
75
|
+
background-position-y: -192px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#align-bottom {
|
|
79
|
+
background-position-y: -242px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#undo {
|
|
83
|
+
background-position-y: -592px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#redo {
|
|
87
|
+
background-position-y: -642px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#front {
|
|
91
|
+
background-position-y: -292px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#back {
|
|
95
|
+
background-position-y: -342px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#forward {
|
|
99
|
+
background-position-y: -392px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#backward {
|
|
103
|
+
background-position-y: -442px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#symmetry-x {
|
|
107
|
+
background-position-y: -492px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#symmetry-y {
|
|
111
|
+
background-position-y: -542px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#group {
|
|
115
|
+
background-position-y: -492px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#ungroup {
|
|
119
|
+
background-position-y: -542px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#fullscreen {
|
|
123
|
+
background-position-y: -692px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#toggle-property {
|
|
127
|
+
background-position-y: -692px;
|
|
128
|
+
float: right;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#zoomin {
|
|
132
|
+
background-position-y: -742px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#zoomout {
|
|
136
|
+
background-position-y: -792px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#fit-scene {
|
|
140
|
+
background-position-y: -1492px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
#cut {
|
|
144
|
+
background-position-y: -842px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#copy {
|
|
148
|
+
background-position-y: -892px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#paste {
|
|
152
|
+
background-position-y: -942px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
#delete {
|
|
156
|
+
background-position-y: -992px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#font-increase {
|
|
160
|
+
background-position-y: -1042px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#font-decrease {
|
|
164
|
+
background-position-y: -1092px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#style-copy {
|
|
168
|
+
background-position-y: -1142px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#context-menu {
|
|
172
|
+
background-position-y: -692px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#symmetry-x {
|
|
176
|
+
background-position-y: -1192px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#symmetry-y {
|
|
180
|
+
background-position-y: -1242px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#rotate-cw {
|
|
184
|
+
background-position-y: -1292px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
#rotate-ccw {
|
|
188
|
+
background-position-y: -1342px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#distribute-horizontal {
|
|
192
|
+
background-position-y: -1542px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#distribute-vertical {
|
|
196
|
+
background-position-y: -1593px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
#toggle-property {
|
|
200
|
+
background-position-y: -1392px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
#preview {
|
|
204
|
+
background-position-y: -1640px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* bigger buttons */
|
|
208
|
+
#fullscreen {
|
|
209
|
+
background: url('/assets/images/icon-fullscreen.png') 50% 10px no-repeat;
|
|
210
|
+
width: var(--edit-toolbar-bigger-icon-size);
|
|
211
|
+
height: var(--edit-toolbar-bigger-icon-size);
|
|
212
|
+
border-left: var(--edit-toolbar-bigger-icon-line);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
#toggle-property {
|
|
216
|
+
background: url('/assets/images/icon-collapse.png') 80% 10px no-repeat;
|
|
217
|
+
width: var(--edit-toolbar-bigger-icon-size);
|
|
218
|
+
height: var(--edit-toolbar-bigger-icon-size);
|
|
219
|
+
border-left: var(--edit-toolbar-bigger-icon-line);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#toggle-property[active] {
|
|
223
|
+
background: url(/assets/images/icon-collapse-active.png) 80% 10px no-repeat;
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
//# sourceMappingURL=ox-toolbar-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-toolbar-style.js","sourceRoot":"","sources":["../../src/ox-toolbar-style.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4NvB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css } from 'lit-element'\n\nexport const style = css`\n :host {\n background-color: var(--edit-toolbar-background-color, #394e64);\n overflow: hidden;\n }\n\n [tools] {\n display: flex;\n align-items: center;\n overflow: none;\n padding: 0px 10px;\n }\n\n [tools] > * {\n padding: 0px;\n }\n\n [tools] > span[button] {\n min-width: 30px;\n }\n\n [tools] > span[padding] {\n flex: 1;\n }\n\n [tools] > .vline {\n display: block;\n flex: none;\n border-left: 1px solid rgba(255, 255, 255, 0.2);\n border-right: 1px solid rgba(0, 0, 0, 0.15);\n width: 0px;\n height: 18px;\n margin: 0 3px;\n }\n\n span[button] {\n min-height: 35px;\n\n background: url('/assets/images/icon-htoolbar.png') no-repeat;\n background-position-x: 50%;\n opacity: 0.8;\n }\n span[button]:hover {\n opacity: 1;\n background-color: rgba(0, 0, 0, 0.1);\n cursor: pointer;\n }\n\n #fullscreen,\n #toggle-property {\n flex: none;\n }\n\n #align-left {\n background-position-y: 8px;\n }\n\n #align-center {\n background-position-y: -42px;\n }\n\n #align-right {\n background-position-y: -92px;\n }\n\n #align-top {\n background-position-y: -142px;\n }\n\n #align-middle {\n background-position-y: -192px;\n }\n\n #align-bottom {\n background-position-y: -242px;\n }\n\n #undo {\n background-position-y: -592px;\n }\n\n #redo {\n background-position-y: -642px;\n }\n\n #front {\n background-position-y: -292px;\n }\n\n #back {\n background-position-y: -342px;\n }\n\n #forward {\n background-position-y: -392px;\n }\n\n #backward {\n background-position-y: -442px;\n }\n\n #symmetry-x {\n background-position-y: -492px;\n }\n\n #symmetry-y {\n background-position-y: -542px;\n }\n\n #group {\n background-position-y: -492px;\n }\n\n #ungroup {\n background-position-y: -542px;\n }\n\n #fullscreen {\n background-position-y: -692px;\n }\n\n #toggle-property {\n background-position-y: -692px;\n float: right;\n }\n\n #zoomin {\n background-position-y: -742px;\n }\n\n #zoomout {\n background-position-y: -792px;\n }\n\n #fit-scene {\n background-position-y: -1492px;\n }\n\n #cut {\n background-position-y: -842px;\n }\n\n #copy {\n background-position-y: -892px;\n }\n\n #paste {\n background-position-y: -942px;\n }\n\n #delete {\n background-position-y: -992px;\n }\n\n #font-increase {\n background-position-y: -1042px;\n }\n\n #font-decrease {\n background-position-y: -1092px;\n }\n\n #style-copy {\n background-position-y: -1142px;\n }\n\n #context-menu {\n background-position-y: -692px;\n }\n\n #symmetry-x {\n background-position-y: -1192px;\n }\n\n #symmetry-y {\n background-position-y: -1242px;\n }\n\n #rotate-cw {\n background-position-y: -1292px;\n }\n\n #rotate-ccw {\n background-position-y: -1342px;\n }\n\n #distribute-horizontal {\n background-position-y: -1542px;\n }\n\n #distribute-vertical {\n background-position-y: -1593px;\n }\n\n #toggle-property {\n background-position-y: -1392px;\n }\n\n #preview {\n background-position-y: -1640px;\n }\n\n /* bigger buttons */\n #fullscreen {\n background: url('/assets/images/icon-fullscreen.png') 50% 10px no-repeat;\n width: var(--edit-toolbar-bigger-icon-size);\n height: var(--edit-toolbar-bigger-icon-size);\n border-left: var(--edit-toolbar-bigger-icon-line);\n }\n\n #toggle-property {\n background: url('/assets/images/icon-collapse.png') 80% 10px no-repeat;\n width: var(--edit-toolbar-bigger-icon-size);\n height: var(--edit-toolbar-bigger-icon-size);\n border-left: var(--edit-toolbar-bigger-icon-line);\n }\n\n #toggle-property[active] {\n background: url(/assets/images/icon-collapse-active.png) 80% 10px no-repeat;\n }\n`\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement } from 'lit/decorators.js';
|
|
7
|
+
const _isMacOS = navigator.userAgent.indexOf('Mac') != -1;
|
|
8
|
+
let OxToolbar = class OxToolbar extends LitElement {
|
|
9
|
+
render() {
|
|
10
|
+
return html `
|
|
11
|
+
<slot></slot>
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
14
|
+
firstUpdated() {
|
|
15
|
+
this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false);
|
|
16
|
+
}
|
|
17
|
+
onWheelEvent(e) {
|
|
18
|
+
var delta = Math.max(-1, Math.min(1, e.deltaY || -e.detail));
|
|
19
|
+
this.scrollLeft -= delta * 40;
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
}
|
|
22
|
+
getSymbol(key) {
|
|
23
|
+
var symbol;
|
|
24
|
+
switch (key) {
|
|
25
|
+
case 'cmd':
|
|
26
|
+
case 'ctrl':
|
|
27
|
+
symbol = _isMacOS ? '⌘' : 'Ctrl';
|
|
28
|
+
break;
|
|
29
|
+
case 'shift':
|
|
30
|
+
symbol = _isMacOS ? '⇧' : 'Shift';
|
|
31
|
+
break;
|
|
32
|
+
case 'alt':
|
|
33
|
+
case 'option':
|
|
34
|
+
symbol = _isMacOS ? '⌥' : 'Alt';
|
|
35
|
+
break;
|
|
36
|
+
case 'backspace':
|
|
37
|
+
symbol = _isMacOS ? '⌫' : 'BackSpace';
|
|
38
|
+
break;
|
|
39
|
+
case 'delete':
|
|
40
|
+
symbol = _isMacOS ? '⌦' : 'Del';
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
symbol = key.toUpperCase();
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return symbol;
|
|
47
|
+
}
|
|
48
|
+
getShortcutString() {
|
|
49
|
+
var symbols = [];
|
|
50
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
51
|
+
symbols.push(this.getSymbol(arguments[i]));
|
|
52
|
+
}
|
|
53
|
+
return symbols.join(_isMacOS ? '' : '+');
|
|
54
|
+
}
|
|
55
|
+
onShortcut(e) {
|
|
56
|
+
var ctrlKey = _isMacOS ? e.metaKey : e.ctrlKey;
|
|
57
|
+
var altKey = e.altKey;
|
|
58
|
+
var shiftKey = e.shiftKey;
|
|
59
|
+
var defaultPrevent = ctrlKey || altKey;
|
|
60
|
+
switch (e.code) {
|
|
61
|
+
default:
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (defaultPrevent)
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
OxToolbar.styles = [css `
|
|
70
|
+
:host {
|
|
71
|
+
background-color: var(--edit-toolbar-background-color, #394e64);
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[tools] {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
overflow: none;
|
|
79
|
+
padding: 0px 10px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[tools] > * {
|
|
83
|
+
padding: 0px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[tools] > span[button] {
|
|
87
|
+
min-width: 30px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[tools] > span[padding] {
|
|
91
|
+
flex: 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[tools] > .vline {
|
|
95
|
+
display: block;
|
|
96
|
+
flex: none;
|
|
97
|
+
border-left: 1px solid rgba(255, 255, 255, 0.2);
|
|
98
|
+
border-right: 1px solid rgba(0, 0, 0, 0.15);
|
|
99
|
+
width: 0px;
|
|
100
|
+
height: 18px;
|
|
101
|
+
margin: 0 3px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
span[button] {
|
|
105
|
+
min-height: 35px;
|
|
106
|
+
|
|
107
|
+
background: url('/assets/images/icon-htoolbar.png') no-repeat;
|
|
108
|
+
background-position-x: 50%;
|
|
109
|
+
opacity: 0.8;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
span[button]:hover {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
}
|
|
117
|
+
`];
|
|
118
|
+
OxToolbar = __decorate([
|
|
119
|
+
customElement('ox-toolbar')
|
|
120
|
+
], OxToolbar);
|
|
121
|
+
customElements.define('process-edit-toolbar', OxToolbar);
|
|
122
|
+
//# sourceMappingURL=ox-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-toolbar.js","sourceRoot":"","sources":["../../src/ox-toolbar.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AAGzD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAmDhC,MAAM;QACJ,OAAO,IAAI,CAAA;;OAER,CAAA;IACL,CAAC;IAED,YAAY;QACV,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA;IAC1E,CAAC;IAED,YAAY,CAAC,CAAQ;QACnB,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAG,CAAgB,CAAC,MAAM,IAAI,CAAE,CAAgB,CAAC,MAAM,CAAC,CAAC,CAAA;QAC5F,IAAI,CAAC,UAAU,IAAI,KAAK,GAAG,EAAE,CAAA;QAE7B,CAAC,CAAC,cAAc,EAAE,CAAA;IACpB,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,IAAI,MAAM,CAAA;QACV,QAAQ,GAAG,EAAE;YACX,KAAK,KAAK,CAAC;YACX,KAAK,MAAM;gBACT,MAAM,GAAG,QAAQ,CAAC,CAAC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IAAI,cAAc,GAAG,OAAO,IAAI,MAAM,CAAA;QAEtC,QAAQ,CAAC,CAAC,IAAI,EAAE;YAEd;gBACE,OAAO,KAAK,CAAA;SACf;QAED,IAAI,cAAc;YAAE,CAAC,CAAC,cAAc,EAAE,CAAA;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;CAEF,CAAA;AAzHQ,gBAAM,GAAG,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDnB,CAAC,CAAA;AAjDE,SAAS;IADd,aAAa,CAAC,YAAY,CAAC;GACtB,SAAS,CA0Hd;AAED,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nconst _isMacOS = navigator.userAgent.indexOf('Mac') != -1\n\n@customElement('ox-toolbar')\nclass OxToolbar extends LitElement {\n static styles = [css` \n :host {\n background-color: var(--edit-toolbar-background-color, #394e64);\n overflow: hidden;\n }\n\n [tools] {\n display: flex;\n align-items: center;\n overflow: none;\n padding: 0px 10px;\n }\n\n [tools] > * {\n padding: 0px;\n }\n\n [tools] > span[button] {\n min-width: 30px;\n }\n\n [tools] > span[padding] {\n flex: 1;\n }\n\n [tools] > .vline {\n display: block;\n flex: none;\n border-left: 1px solid rgba(255, 255, 255, 0.2);\n border-right: 1px solid rgba(0, 0, 0, 0.15);\n width: 0px;\n height: 18px;\n margin: 0 3px;\n }\n\n span[button] {\n min-height: 35px;\n\n background: url('/assets/images/icon-htoolbar.png') no-repeat;\n background-position-x: 50%;\n opacity: 0.8;\n }\n\n span[button]:hover {\n opacity: 1;\n background-color: rgba(0, 0, 0, 0.1);\n cursor: pointer;\n }\n `]\n \n render() {\n return html`\n <slot></slot>\n `\n }\n \n firstUpdated() {\n this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)\n }\n\n onWheelEvent(e: Event) {\n var delta = Math.max(-1, Math.min(1, (e as WheelEvent).deltaY || -(e as WheelEvent).detail))\n this.scrollLeft -= delta * 40\n\n e.preventDefault()\n }\n\n getSymbol(key: string) {\n var symbol\n switch (key) {\n case 'cmd':\n case 'ctrl':\n symbol = _isMacOS ? '⌘' : 'Ctrl'\n break\n case 'shift':\n symbol = _isMacOS ? '⇧' : 'Shift'\n break\n case 'alt':\n case 'option':\n symbol = _isMacOS ? '⌥' : 'Alt'\n break\n case 'backspace':\n symbol = _isMacOS ? '⌫' : 'BackSpace'\n break\n case 'delete':\n symbol = _isMacOS ? '⌦' : 'Del'\n break\n default:\n symbol = key.toUpperCase()\n break\n }\n\n return symbol\n }\n\n getShortcutString() {\n var symbols = []\n for (var i = 0; i < arguments.length; i++) {\n symbols.push(this.getSymbol(arguments[i]))\n }\n\n return symbols.join(_isMacOS ? '' : '+')\n }\n\n onShortcut(e: KeyboardEvent) {\n var ctrlKey = _isMacOS ? e.metaKey : e.ctrlKey\n var altKey = e.altKey\n var shiftKey = e.shiftKey\n\n var defaultPrevent = ctrlKey || altKey\n\n switch (e.code) {\n\n default:\n return false\n }\n\n if (defaultPrevent) e.preventDefault()\n return true\n }\n\n}\n\ncustomElements.define('process-edit-toolbar', OxToolbar)\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../src/ox-layout';
|
|
2
|
+
import { TemplateResult } from 'lit';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: string;
|
|
6
|
+
argTypes: {
|
|
7
|
+
title: {
|
|
8
|
+
control: string;
|
|
9
|
+
};
|
|
10
|
+
counter: {
|
|
11
|
+
control: string;
|
|
12
|
+
};
|
|
13
|
+
textColor: {
|
|
14
|
+
control: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
19
|
+
interface Story<T> {
|
|
20
|
+
(args: T): TemplateResult;
|
|
21
|
+
args?: Partial<T>;
|
|
22
|
+
argTypes?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface ArgTypes {
|
|
25
|
+
title?: string;
|
|
26
|
+
counter?: number;
|
|
27
|
+
textColor?: string;
|
|
28
|
+
slot?: TemplateResult;
|
|
29
|
+
}
|
|
30
|
+
export declare const Regular: Story<ArgTypes>;
|
|
31
|
+
export declare const CustomTitle: Story<ArgTypes>;
|
|
32
|
+
export declare const CustomCounter: Story<ArgTypes>;
|
|
33
|
+
export declare const SlottedContent: Story<ArgTypes>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../src/ox-layout';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'ContextMenu',
|
|
5
|
+
component: 'ox-layout',
|
|
6
|
+
argTypes: {
|
|
7
|
+
title: { control: 'text' },
|
|
8
|
+
counter: { control: 'number' },
|
|
9
|
+
textColor: { control: 'color' }
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const Template = ({ title = 'Hello world', counter = 5, textColor, slot }) => html `
|
|
13
|
+
<ox-layout style="--ox-layout-text-color: ${textColor || 'black'}" .title=${title} .counter=${counter}>
|
|
14
|
+
${slot}
|
|
15
|
+
</ox-layout>
|
|
16
|
+
`;
|
|
17
|
+
export const Regular = Template.bind({});
|
|
18
|
+
export const CustomTitle = Template.bind({});
|
|
19
|
+
CustomTitle.args = {
|
|
20
|
+
title: 'My title'
|
|
21
|
+
};
|
|
22
|
+
export const CustomCounter = Template.bind({});
|
|
23
|
+
CustomCounter.args = {
|
|
24
|
+
counter: 123456
|
|
25
|
+
};
|
|
26
|
+
export const SlottedContent = Template.bind({});
|
|
27
|
+
SlottedContent.args = {
|
|
28
|
+
slot: html `<p>Slotted content</p>`
|
|
29
|
+
};
|
|
30
|
+
SlottedContent.argTypes = {
|
|
31
|
+
slot: { table: { disable: true } }
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.stories.js.map
|
|
@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E,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAA","sourcesContent":["import '../src/ox-layout';\n\nimport { html, TemplateResult } from 'lit';\n\nexport default {\n title: 'ContextMenu',\n component: 'ox-layout',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title?: string\n counter?: number\n textColor?: string\n slot?: TemplateResult\n}\n\nconst Template: Story<ArgTypes> = ({ title = 'Hello world', counter = 5, textColor, slot }: ArgTypes) => html`\n <ox-layout style=\"--ox-layout-text-color: ${textColor || 'black'}\" .title=${title} .counter=${counter}>\n ${slot}\n </ox-layout>\n`\n\nexport const Regular = Template.bind({})\n\nexport const CustomTitle = Template.bind({})\nCustomTitle.args = {\n title: 'My title'\n}\n\nexport const CustomCounter = Template.bind({})\nCustomCounter.args = {\n counter: 123456\n}\n\nexport const SlottedContent = Template.bind({})\nSlottedContent.args = {\n slot: html`<p>Slotted content</p>`\n}\nSlottedContent.argTypes = {\n slot: { table: { disable: true } }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../src/ox-layout';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../src/ox-layout';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
4
|
+
describe('Layout', () => {
|
|
5
|
+
it('has a default title "Hey there" and counter 5', async () => {
|
|
6
|
+
const el = await fixture(html `<ox-layout></ox-layout>`);
|
|
7
|
+
expect(el.title).to.equal('Hey there');
|
|
8
|
+
// expect(el.counter).to.equal(5)
|
|
9
|
+
});
|
|
10
|
+
it('increases the counter on button click', async () => {
|
|
11
|
+
const el = await fixture(html `<ox-layout></ox-layout>`);
|
|
12
|
+
el.shadowRoot.querySelector('button').click();
|
|
13
|
+
// expect(el.counter).to.equal(6)
|
|
14
|
+
});
|
|
15
|
+
it('can override the title via attribute', async () => {
|
|
16
|
+
const el = await fixture(html `<ox-layout title="attribute title"></ox-layout>`);
|
|
17
|
+
expect(el.title).to.equal('attribute title');
|
|
18
|
+
});
|
|
19
|
+
it('passes the a11y audit', async () => {
|
|
20
|
+
const el = await fixture(html `<ox-layout></ox-layout>`);
|
|
21
|
+
await expect(el).shadowDom.to.be.accessible();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=ox-layout.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-layout.test.js","sourceRoot":"","sources":["../../test/ox-layout.test.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAInD,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,EAAE,GAAG,MAAM,OAAO,CAAW,IAAI,CAAA,yBAAyB,CAAC,CAAA;QAEjE,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACtC,iCAAiC;IACnC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAW,IAAI,CAAA,yBAAyB,CAAC,CAAA;QACjE,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,KAAK,EAAE,CAAA;QAE/C,iCAAiC;IACnC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAW,IAAI,CAAA,iDAAiD,CAAC,CAAA;QAEzF,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAW,IAAI,CAAA,yBAAyB,CAAC,CAAA;QAEjE,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import '../src/ox-layout';\n\nimport { html } from 'lit';\n\nimport { expect, fixture } from '@open-wc/testing';\n\nimport { OxLayout } from '../src/ox-layout';\n\ndescribe('Layout', () => {\n it('has a default title \"Hey there\" and counter 5', async () => {\n const el = await fixture<OxLayout>(html`<ox-layout></ox-layout>`)\n\n expect(el.title).to.equal('Hey there')\n // expect(el.counter).to.equal(5)\n })\n\n it('increases the counter on button click', async () => {\n const el = await fixture<OxLayout>(html`<ox-layout></ox-layout>`)\n el.shadowRoot!.querySelector('button')!.click()\n\n // expect(el.counter).to.equal(6)\n })\n\n it('can override the title via attribute', async () => {\n const el = await fixture<OxLayout>(html`<ox-layout title=\"attribute title\"></ox-layout>`)\n\n expect(el.title).to.equal('attribute title')\n })\n\n it('passes the a11y audit', async () => {\n const el = await fixture<OxLayout>(html`<ox-layout></ox-layout>`)\n\n await expect(el).shadowDom.to.be.accessible()\n })\n})\n"]}
|