@operato/font 1.0.0-beta.8 → 1.0.1
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/CHANGELOG.md +367 -0
- package/custom-elements.json +855 -0
- package/dist/src/font-creation-card.d.ts +18 -0
- package/dist/src/font-creation-card.js +258 -0
- package/dist/src/font-creation-card.js.map +1 -0
- package/dist/src/font-graphql-client.d.ts +20 -0
- package/dist/src/font-graphql-client.js +109 -0
- package/dist/src/font-graphql-client.js.map +1 -0
- package/dist/src/font-selector.d.ts +36 -0
- package/dist/src/font-selector.js +285 -0
- package/dist/src/font-selector.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ox-file-selector.d.ts +12 -0
- package/dist/src/ox-file-selector.js +129 -0
- package/dist/src/ox-file-selector.js.map +1 -0
- package/dist/src/ox-font-selector.d.ts +15 -0
- package/dist/src/ox-font-selector.js +88 -0
- package/dist/src/ox-font-selector.js.map +1 -0
- package/dist/src/ox-property-editor-font-selector.d.ts +8 -0
- package/dist/src/ox-property-editor-font-selector.js +13 -0
- package/dist/src/ox-property-editor-font-selector.js.map +1 -0
- package/dist/src/redux-font-actions.d.ts +7 -0
- package/dist/src/redux-font-actions.js +19 -0
- package/dist/src/redux-font-actions.js.map +1 -0
- package/dist/src/redux-font-reducers.d.ts +12 -0
- package/dist/src/redux-font-reducers.js +70 -0
- package/dist/src/redux-font-reducers.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +65 -20
- package/src/font-creation-card.ts +260 -0
- package/src/{graphql-client.js → font-graphql-client.ts} +35 -26
- package/src/font-selector.ts +284 -0
- package/src/index.ts +6 -0
- package/src/ox-file-selector.ts +114 -0
- package/src/ox-font-selector.ts +94 -0
- package/src/ox-property-editor-font-selector.ts +17 -0
- package/src/redux-font-actions.ts +21 -0
- package/src/redux-font-reducers.ts +88 -0
- package/src/font-creation-card.js +0 -311
- package/src/font-selector.js +0 -465
- package/src/index.js +0 -3
- package/src/ox-font-selector.js +0 -102
- package/src/ox-property-editor-font-selector.js +0 -25
- package/things-factory.config.js +0 -5
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import './font-creation-card';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
6
|
+
import Headroom from '@operato/headroom';
|
|
7
|
+
import { i18next, localize } from '@operato/i18n';
|
|
8
|
+
import { pulltorefresh } from '@operato/pull-to-refresh';
|
|
9
|
+
import { store } from '@operato/shell';
|
|
10
|
+
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles';
|
|
11
|
+
import { createFont, deleteFont, updateFont } from './font-graphql-client';
|
|
12
|
+
import { actionUpdateFontList } from './redux-font-actions';
|
|
13
|
+
let FontSelector = class FontSelector extends localize(i18next)(connect(store)(LitElement)) {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.fonts = [];
|
|
17
|
+
this.creatable = false;
|
|
18
|
+
this.provider = '';
|
|
19
|
+
this.showGotoTop = false;
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
var fonts = this.fonts || [];
|
|
23
|
+
return html `
|
|
24
|
+
<div id="filter">
|
|
25
|
+
<select
|
|
26
|
+
@change=${(e) => {
|
|
27
|
+
this.provider = e.currentTarget.value;
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<option value="">--${i18next.t('text.please choose a provider')}--</option>
|
|
31
|
+
${['google', 'custom'].map(provider => html ` <option value=${provider}>${provider}</option> `)}
|
|
32
|
+
</select>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main">
|
|
36
|
+
${this.creatable
|
|
37
|
+
? html `
|
|
38
|
+
<font-creation-card
|
|
39
|
+
class="card create"
|
|
40
|
+
@create-font=${(e) => this.onCreateFont(e)}
|
|
41
|
+
></font-creation-card>
|
|
42
|
+
`
|
|
43
|
+
: html ``}
|
|
44
|
+
${fonts
|
|
45
|
+
.filter(font => (this.provider ? font.provider === this.provider : true))
|
|
46
|
+
.map(font => html `
|
|
47
|
+
<div class="card" @click=${(e) => this.onClickSelect(font)}>
|
|
48
|
+
<div face>
|
|
49
|
+
<font .face=${font.name}>ABCDEFGHIJKLMN</font>
|
|
50
|
+
<font .face=${font.name}>abcdefghijklmn</font>
|
|
51
|
+
</div>
|
|
52
|
+
<div name>${font.name}</div>
|
|
53
|
+
<div provider>${font.provider}</div>
|
|
54
|
+
<div class="button-container">
|
|
55
|
+
<mwc-icon
|
|
56
|
+
@click=${(e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
this.toggleActive(font);
|
|
59
|
+
}}
|
|
60
|
+
>${font.active ? 'check_box' : 'check_box_outline_blank'}</mwc-icon
|
|
61
|
+
>
|
|
62
|
+
<mwc-icon
|
|
63
|
+
@click=${(e) => {
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
this.deleteFont(font);
|
|
66
|
+
}}
|
|
67
|
+
>delete</mwc-icon
|
|
68
|
+
>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
`)}
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
async firstUpdated() {
|
|
76
|
+
var list = this.renderRoot.querySelector('#main');
|
|
77
|
+
pulltorefresh({
|
|
78
|
+
container: this.renderRoot,
|
|
79
|
+
scrollable: list,
|
|
80
|
+
refresh: () => {
|
|
81
|
+
return this.refresh();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
/* for headroom */
|
|
85
|
+
this.main.addEventListener('scroll', e => {
|
|
86
|
+
const target = e.target;
|
|
87
|
+
this.showGotoTop = target.scrollTop !== 0;
|
|
88
|
+
});
|
|
89
|
+
await this.requestUpdate();
|
|
90
|
+
var originPaddingTop = parseFloat(getComputedStyle(this.main, null).getPropertyValue('padding-top'));
|
|
91
|
+
this.main.style.paddingTop = this.filter.clientHeight + originPaddingTop + 'px';
|
|
92
|
+
var headroom = new Headroom(this.filter, {
|
|
93
|
+
scroller: this.main
|
|
94
|
+
});
|
|
95
|
+
headroom.init();
|
|
96
|
+
}
|
|
97
|
+
stateChanged(state) {
|
|
98
|
+
this.fonts = state.font;
|
|
99
|
+
}
|
|
100
|
+
updated(changes) {
|
|
101
|
+
if (changes.has('fonts')) {
|
|
102
|
+
this.creationCard.reset();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async refresh() {
|
|
106
|
+
return store.dispatch(actionUpdateFontList());
|
|
107
|
+
}
|
|
108
|
+
async toggleActive(font) {
|
|
109
|
+
try {
|
|
110
|
+
await updateFont({ id: font.id, active: !font.active });
|
|
111
|
+
this.refresh();
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
console.error(e);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async onCreateFont(e) {
|
|
118
|
+
try {
|
|
119
|
+
await createFont(e.detail);
|
|
120
|
+
this.refresh();
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
console.error(e);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async deleteFont(font) {
|
|
127
|
+
try {
|
|
128
|
+
await deleteFont(font.id);
|
|
129
|
+
this.refresh();
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
console.error(e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
onClickSelect(font) {
|
|
136
|
+
this.dispatchEvent(new CustomEvent('font-selected', {
|
|
137
|
+
composed: true,
|
|
138
|
+
bubbles: true,
|
|
139
|
+
detail: {
|
|
140
|
+
font
|
|
141
|
+
}
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
FontSelector.styles = [
|
|
146
|
+
ScrollbarStyles,
|
|
147
|
+
HeadroomStyles,
|
|
148
|
+
css `
|
|
149
|
+
:host {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
background-color: var(--popup-content-background-color);
|
|
154
|
+
|
|
155
|
+
position: relative;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#main {
|
|
159
|
+
overflow: auto;
|
|
160
|
+
padding: var(--popup-content-padding);
|
|
161
|
+
display: grid;
|
|
162
|
+
grid-template-columns: var(--card-list-template);
|
|
163
|
+
grid-auto-rows: var(--card-list-rows-height);
|
|
164
|
+
grid-gap: 20px;
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#main .card {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
align-items: center;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
border-radius: var(--card-list-border-radius);
|
|
174
|
+
border: var(--font-selector-border);
|
|
175
|
+
background-color: var(--card-list-background-color);
|
|
176
|
+
|
|
177
|
+
position: relative;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.card .button-container {
|
|
181
|
+
position: absolute;
|
|
182
|
+
right: 0;
|
|
183
|
+
height: 100%;
|
|
184
|
+
display: flex;
|
|
185
|
+
direction: rtl;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
flex-wrap: wrap;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.card .button-container > mwc-icon {
|
|
191
|
+
background-color: var(--font-selector-icon-background-color);
|
|
192
|
+
text-align: center;
|
|
193
|
+
width: var(--font-selector-icon-size);
|
|
194
|
+
height: var(--font-selector-icon-size);
|
|
195
|
+
font: var(--font-selector-icon-font);
|
|
196
|
+
color: var(--font-selector-icon-color);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.card .button-container > mwc-icon:last-child {
|
|
200
|
+
border-bottom-left-radius: 12px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.card .button-container > mwc-icon:hover,
|
|
204
|
+
.card .button-container > mwc-icon:active {
|
|
205
|
+
background-color: var(--primary-color);
|
|
206
|
+
color: #fff;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#main .card.create {
|
|
210
|
+
overflow: visible;
|
|
211
|
+
background-color: initial;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
#main .card:hover {
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
[face] {
|
|
219
|
+
flex: 1;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
[name] {
|
|
223
|
+
background-color: var(--board-renderer-name-background-color);
|
|
224
|
+
opacity: 0.8;
|
|
225
|
+
margin-top: -35px;
|
|
226
|
+
width: 100%;
|
|
227
|
+
color: #fff;
|
|
228
|
+
font-weight: bolder;
|
|
229
|
+
font-size: 13px;
|
|
230
|
+
text-indent: 7px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
[provider] {
|
|
234
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
235
|
+
width: 100%;
|
|
236
|
+
min-height: 15px;
|
|
237
|
+
font-size: 0.6rem;
|
|
238
|
+
color: #fff;
|
|
239
|
+
text-indent: 7px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#filter {
|
|
243
|
+
padding: var(--popup-content-padding);
|
|
244
|
+
background-color: var(--font-tools-background-color);
|
|
245
|
+
box-shadow: var(--box-shadow);
|
|
246
|
+
|
|
247
|
+
position: absolute;
|
|
248
|
+
width: 100%;
|
|
249
|
+
box-sizing: border-box;
|
|
250
|
+
z-index: 1;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
#filter * {
|
|
254
|
+
font-size: 15px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
select {
|
|
258
|
+
text-transform: capitalize;
|
|
259
|
+
float: right;
|
|
260
|
+
}
|
|
261
|
+
`
|
|
262
|
+
];
|
|
263
|
+
__decorate([
|
|
264
|
+
property({ type: Array })
|
|
265
|
+
], FontSelector.prototype, "fonts", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
property({ type: Boolean })
|
|
268
|
+
], FontSelector.prototype, "creatable", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
property({ type: String })
|
|
271
|
+
], FontSelector.prototype, "provider", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
query('#main')
|
|
274
|
+
], FontSelector.prototype, "main", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
query('#filter')
|
|
277
|
+
], FontSelector.prototype, "filter", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
query('font-creation-card')
|
|
280
|
+
], FontSelector.prototype, "creationCard", void 0);
|
|
281
|
+
FontSelector = __decorate([
|
|
282
|
+
customElement('font-selector')
|
|
283
|
+
], FontSelector);
|
|
284
|
+
export { FontSelector };
|
|
285
|
+
//# sourceMappingURL=font-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/font-selector.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,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OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;SACjB;IACH,CAAC;IAED,aAAa,CAAC,IAAS;QACrB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,MAAM,EAAE;gBACN,IAAI;aACL;SACF,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA1QQ,mBAAM,GAAG;IACd,eAAe;IACf,cAAc;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiHF;CACF,CAAA;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAuB;AACpB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB;AAEjC;IAAf,KAAK,CAAC,OAAO,CAAC;0CAAmB;AAChB;IAAjB,KAAK,CAAC,SAAS,CAAC;4CAAqB;AACT;IAA5B,KAAK,CAAC,oBAAoB,CAAC;kDAAmC;AA9HpD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA2QxB;SA3QY,YAAY","sourcesContent":["import './font-creation-card'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport Headroom from '@operato/headroom'\nimport { i18next, localize } from '@operato/i18n'\nimport { pulltorefresh } from '@operato/pull-to-refresh'\nimport { store } from '@operato/shell'\nimport { HeadroomStyles, ScrollbarStyles } from '@operato/styles'\n\nimport { createFont, deleteFont, updateFont } from './font-graphql-client'\nimport { actionUpdateFontList } from './redux-font-actions'\n\n@customElement('font-selector')\nexport class FontSelector extends localize(i18next)(connect(store)(LitElement)) {\n static styles = [\n ScrollbarStyles,\n HeadroomStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background-color: var(--popup-content-background-color);\n\n position: relative;\n }\n\n #main {\n overflow: auto;\n padding: var(--popup-content-padding);\n display: grid;\n grid-template-columns: var(--card-list-template);\n grid-auto-rows: var(--card-list-rows-height);\n grid-gap: 20px;\n box-sizing: border-box;\n }\n\n #main .card {\n display: flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n border-radius: var(--card-list-border-radius);\n border: var(--font-selector-border);\n background-color: var(--card-list-background-color);\n\n position: relative;\n }\n\n .card .button-container {\n position: absolute;\n right: 0;\n height: 100%;\n display: flex;\n direction: rtl;\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .card .button-container > mwc-icon {\n background-color: var(--font-selector-icon-background-color);\n text-align: center;\n width: var(--font-selector-icon-size);\n height: var(--font-selector-icon-size);\n font: var(--font-selector-icon-font);\n color: var(--font-selector-icon-color);\n }\n\n .card .button-container > mwc-icon:last-child {\n border-bottom-left-radius: 12px;\n }\n\n .card .button-container > mwc-icon:hover,\n .card .button-container > mwc-icon:active {\n background-color: var(--primary-color);\n color: #fff;\n }\n\n #main .card.create {\n overflow: visible;\n background-color: initial;\n }\n\n #main .card:hover {\n cursor: pointer;\n }\n\n [face] {\n flex: 1;\n }\n\n [name] {\n background-color: var(--board-renderer-name-background-color);\n opacity: 0.8;\n margin-top: -35px;\n width: 100%;\n color: #fff;\n font-weight: bolder;\n font-size: 13px;\n text-indent: 7px;\n }\n\n [provider] {\n background-color: rgba(0, 0, 0, 0.7);\n width: 100%;\n min-height: 15px;\n font-size: 0.6rem;\n color: #fff;\n text-indent: 7px;\n }\n\n #filter {\n padding: var(--popup-content-padding);\n background-color: var(--font-tools-background-color);\n box-shadow: var(--box-shadow);\n\n position: absolute;\n width: 100%;\n box-sizing: border-box;\n z-index: 1;\n }\n\n #filter * {\n font-size: 15px;\n }\n\n select {\n text-transform: capitalize;\n float: right;\n }\n `\n ]\n\n @property({ type: Array }) fonts: Array<any> = []\n @property({ type: Boolean }) creatable: boolean = false\n @property({ type: String }) provider: string = ''\n\n @query('#main') main!: HTMLElement\n @query('#filter') filter!: HTMLElement\n @query('font-creation-card') creationCard!: { reset: () => {} }\n\n showGotoTop: boolean = false\n\n render() {\n var fonts = this.fonts || []\n\n return html`\n <div id=\"filter\">\n <select\n @change=${(e: Event) => {\n this.provider = (e.currentTarget as HTMLInputElement).value\n }}\n >\n <option value=\"\">--${i18next.t('text.please choose a provider')}--</option>\n ${['google', 'custom'].map(provider => html` <option value=${provider}>${provider}</option> `)}\n </select>\n </div>\n\n <div id=\"main\">\n ${this.creatable\n ? html`\n <font-creation-card\n class=\"card create\"\n @create-font=${(e: CustomEvent) => this.onCreateFont(e)}\n ></font-creation-card>\n `\n : html``}\n ${fonts\n .filter(font => (this.provider ? font.provider === this.provider : true))\n .map(\n font => html`\n <div class=\"card\" @click=${(e: Event) => this.onClickSelect(font)}>\n <div face>\n <font .face=${font.name}>ABCDEFGHIJKLMN</font>\n <font .face=${font.name}>abcdefghijklmn</font>\n </div>\n <div name>${font.name}</div>\n <div provider>${font.provider}</div>\n <div class=\"button-container\">\n <mwc-icon\n @click=${(e: Event) => {\n e.stopPropagation()\n this.toggleActive(font)\n }}\n >${font.active ? 'check_box' : 'check_box_outline_blank'}</mwc-icon\n >\n <mwc-icon\n @click=${(e: Event) => {\n e.stopPropagation()\n this.deleteFont(font)\n }}\n >delete</mwc-icon\n >\n </div>\n </div>\n `\n )}\n </div>\n `\n }\n\n async firstUpdated() {\n var list = this.renderRoot.querySelector('#main')\n\n pulltorefresh({\n container: this.renderRoot,\n scrollable: list,\n refresh: () => {\n return this.refresh()\n }\n })\n\n /* for headroom */\n this.main.addEventListener('scroll', e => {\n const target = e.target as HTMLElement\n this.showGotoTop = target.scrollTop !== 0\n })\n\n await this.requestUpdate()\n\n var originPaddingTop = parseFloat(getComputedStyle(this.main, null).getPropertyValue('padding-top'))\n this.main.style.paddingTop = this.filter.clientHeight + originPaddingTop + 'px'\n var headroom = new Headroom(this.filter, {\n scroller: this.main\n })\n headroom.init()\n }\n\n stateChanged(state: any) {\n this.fonts = state.font\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('fonts')) {\n this.creationCard.reset()\n }\n }\n\n async refresh() {\n return store.dispatch(actionUpdateFontList() as any)\n }\n\n async toggleActive(font: { id: string; active: boolean }) {\n try {\n await updateFont({ id: font.id, active: !font.active })\n this.refresh()\n } catch (e) {\n console.error(e)\n }\n }\n\n async onCreateFont(e: CustomEvent) {\n try {\n await createFont(e.detail)\n this.refresh()\n } catch (e) {\n console.error(e)\n }\n }\n\n async deleteFont(font: { id: string }) {\n try {\n await deleteFont(font.id)\n this.refresh()\n } catch (e) {\n console.error(e)\n }\n }\n\n onClickSelect(font: any) {\n this.dispatchEvent(\n new CustomEvent('font-selected', {\n composed: true,\n bubbles: true,\n detail: {\n font\n }\n })\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './font-selector.js';
|
|
2
|
+
export * from './ox-font-selector.js';
|
|
3
|
+
export * from './ox-property-editor-font-selector.js';
|
|
4
|
+
export * from './redux-font-actions.js';
|
|
5
|
+
export { default as ReducerFont } from './redux-font-reducers.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uCAAuC,CAAA;AAErD,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["export * from './font-selector.js'\nexport * from './ox-font-selector.js'\nexport * from './ox-property-editor-font-selector.js'\n\nexport * from './redux-font-actions.js'\nexport { default as ReducerFont } from './redux-font-reducers.js'\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
2
|
+
import '@material/mwc-icon-button';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
export declare class OxFileSelector extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
label: string;
|
|
7
|
+
accept?: string;
|
|
8
|
+
showFilename: boolean;
|
|
9
|
+
multiple: boolean;
|
|
10
|
+
_files: Array<any>;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/mwc-icon';
|
|
3
|
+
import '@material/mwc-icon-button';
|
|
4
|
+
import { LitElement, css, html } from 'lit';
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
let OxFileSelector = class OxFileSelector extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.label = 'select file';
|
|
10
|
+
this.showFilename = false;
|
|
11
|
+
this.multiple = false;
|
|
12
|
+
this._files = [];
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return html `
|
|
16
|
+
<div id="input-box">
|
|
17
|
+
${this.showFilename
|
|
18
|
+
? html `
|
|
19
|
+
<input class="upload-name" value=${this._files.map(f => f.name).join(', ') || this.label} disabled />
|
|
20
|
+
`
|
|
21
|
+
: html ``}
|
|
22
|
+
<label for="input-file">${this.label}</label>
|
|
23
|
+
<input
|
|
24
|
+
id="input-file"
|
|
25
|
+
type="file"
|
|
26
|
+
accept="${this.accept}"
|
|
27
|
+
class="upload-hidden"
|
|
28
|
+
?multiple=${this.multiple}
|
|
29
|
+
hidden
|
|
30
|
+
@change=${(e) => {
|
|
31
|
+
const el = e.currentTarget;
|
|
32
|
+
this.dispatchEvent(new CustomEvent('file-change', {
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
detail: {
|
|
36
|
+
files: el.files
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
el.value = '';
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
OxFileSelector.styles = [
|
|
47
|
+
css `
|
|
48
|
+
:host {
|
|
49
|
+
flex: 1;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
position: relative;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#input-box {
|
|
57
|
+
display: flex;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input[type='file'] {
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: 0px;
|
|
65
|
+
height: 0px;
|
|
66
|
+
padding: 0;
|
|
67
|
+
margin: -1px;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
clip: rect(0, 0, 0, 0);
|
|
70
|
+
border: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
label {
|
|
74
|
+
padding: unset;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
|
|
82
|
+
color: var(--file-selector-color, #999);
|
|
83
|
+
font-size: inherit;
|
|
84
|
+
line-height: normal;
|
|
85
|
+
vertical-align: middle;
|
|
86
|
+
background-color: var(--file-selector-bg-color, #fdfdfd);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
border: var(--file-selector-border, 1px solid #ebebeb);
|
|
89
|
+
border-radius: var(--file-selector-border-radius, 0.25em);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* named upload */
|
|
93
|
+
.upload-name {
|
|
94
|
+
flex: 1;
|
|
95
|
+
padding: 0.5em 0.75em; /* label의 패딩값과 일치 */
|
|
96
|
+
font-size: inherit;
|
|
97
|
+
font-family: inherit;
|
|
98
|
+
line-height: normal;
|
|
99
|
+
vertical-align: middle;
|
|
100
|
+
background-color: #f5f5f5;
|
|
101
|
+
border: 1px solid #ebebeb;
|
|
102
|
+
border-bottom-color: #e2e2e2;
|
|
103
|
+
border-radius: 0.25em;
|
|
104
|
+
-webkit-appearance: none; /* 네이티브 외형 감추기 */
|
|
105
|
+
-moz-appearance: none;
|
|
106
|
+
appearance: none;
|
|
107
|
+
}
|
|
108
|
+
`
|
|
109
|
+
];
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: String })
|
|
112
|
+
], OxFileSelector.prototype, "label", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: String })
|
|
115
|
+
], OxFileSelector.prototype, "accept", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: Boolean, attribute: 'show-filename' })
|
|
118
|
+
], OxFileSelector.prototype, "showFilename", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: Boolean, attribute: 'multiple' })
|
|
121
|
+
], OxFileSelector.prototype, "multiple", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: Array })
|
|
124
|
+
], OxFileSelector.prototype, "_files", void 0);
|
|
125
|
+
OxFileSelector = __decorate([
|
|
126
|
+
customElement('ox-file-selector')
|
|
127
|
+
], OxFileSelector);
|
|
128
|
+
export { OxFileSelector };
|
|
129
|
+
//# sourceMappingURL=ox-file-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-file-selector.js","sourceRoot":"","sources":["../../src/ox-file-selector.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AACc;IAAxD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;oDAA8B;AAClC;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;gDAA0B;AAClD;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAAwB;AAtEvC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA0G1B;SA1GY,cAAc","sourcesContent":["import '@material/mwc-icon'\nimport '@material/mwc-icon-button'\n\nimport { LitElement, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n@customElement('ox-file-selector')\nexport class OxFileSelector extends LitElement {\n static styles = [\n css`\n :host {\n flex: 1;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n }\n\n #input-box {\n display: flex;\n width: 100%;\n height: 100%;\n }\n\n input[type='file'] {\n position: absolute;\n width: 0px;\n height: 0px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n }\n\n label {\n padding: unset;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--file-selector-color, #999);\n font-size: inherit;\n line-height: normal;\n vertical-align: middle;\n background-color: var(--file-selector-bg-color, #fdfdfd);\n cursor: pointer;\n border: var(--file-selector-border, 1px solid #ebebeb);\n border-radius: var(--file-selector-border-radius, 0.25em);\n }\n\n /* named upload */\n .upload-name {\n flex: 1;\n padding: 0.5em 0.75em; /* label의 패딩값과 일치 */\n font-size: inherit;\n font-family: inherit;\n line-height: normal;\n vertical-align: middle;\n background-color: #f5f5f5;\n border: 1px solid #ebebeb;\n border-bottom-color: #e2e2e2;\n border-radius: 0.25em;\n -webkit-appearance: none; /* 네이티브 외형 감추기 */\n -moz-appearance: none;\n appearance: none;\n }\n `\n ]\n\n @property({ type: String }) label: string = 'select file'\n @property({ type: String }) accept?: string\n @property({ type: Boolean, attribute: 'show-filename' }) showFilename: boolean = false\n @property({ type: Boolean, attribute: 'multiple' }) multiple: boolean = false\n @property({ type: Array }) _files: Array<any> = []\n\n render() {\n return html`\n <div id=\"input-box\">\n ${this.showFilename\n ? html`\n <input class=\"upload-name\" value=${this._files.map(f => f.name).join(', ') || this.label} disabled />\n `\n : html``}\n <label for=\"input-file\">${this.label}</label>\n <input\n id=\"input-file\"\n type=\"file\"\n accept=\"${this.accept}\"\n class=\"upload-hidden\"\n ?multiple=${this.multiple}\n hidden\n @change=${(e: Event) => {\n const el = e.currentTarget as HTMLInputElement\n this.dispatchEvent(\n new CustomEvent('file-change', {\n bubbles: true,\n composed: true,\n detail: {\n files: el.files\n }\n })\n )\n\n el.value = ''\n }}\n />\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@material/mwc-icon';
|
|
5
|
+
import './font-selector';
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
export default class OxFontSelector extends LitElement {
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
value?: string;
|
|
10
|
+
properties: any;
|
|
11
|
+
popup: any;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
_onInputChanged(e: Event): void;
|
|
14
|
+
openSelector(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@material/mwc-icon';
|
|
6
|
+
import './font-selector';
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { i18next } from '@operato/i18n';
|
|
10
|
+
import { openPopup } from '@operato/layout';
|
|
11
|
+
let OxFontSelector = class OxFontSelector extends LitElement {
|
|
12
|
+
render() {
|
|
13
|
+
return html `
|
|
14
|
+
<input
|
|
15
|
+
id="text"
|
|
16
|
+
type="text"
|
|
17
|
+
.value=${this.value || ''}
|
|
18
|
+
@change=${(e) => this._onInputChanged(e)}
|
|
19
|
+
.placeholder=${this.getAttribute('placeholder') || ''}
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<mwc-icon @click=${() => this.openSelector()}>font_download</mwc-icon>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
_onInputChanged(e) {
|
|
26
|
+
this.value = e.target.value;
|
|
27
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
28
|
+
}
|
|
29
|
+
openSelector() {
|
|
30
|
+
if (this.popup) {
|
|
31
|
+
delete this.popup;
|
|
32
|
+
}
|
|
33
|
+
/*
|
|
34
|
+
* 기존 설정된 보드가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
35
|
+
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
36
|
+
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
37
|
+
*/
|
|
38
|
+
var value = this.value || {};
|
|
39
|
+
var template = html `
|
|
40
|
+
<font-selector
|
|
41
|
+
.creatable=${true}
|
|
42
|
+
@font-selected=${async (e) => {
|
|
43
|
+
var font = e.detail.font;
|
|
44
|
+
this.value = font.name;
|
|
45
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
46
|
+
this.popup && this.popup.close();
|
|
47
|
+
}}
|
|
48
|
+
></font-selector>
|
|
49
|
+
`;
|
|
50
|
+
this.popup = openPopup(template, {
|
|
51
|
+
backdrop: true,
|
|
52
|
+
size: 'large',
|
|
53
|
+
title: i18next.t('title.select font')
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
OxFontSelector.styles = [
|
|
58
|
+
css `
|
|
59
|
+
:host {
|
|
60
|
+
position: relative;
|
|
61
|
+
display: inline-block;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
input[type='text'] {
|
|
65
|
+
box-sizing: border-box;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
mwc-icon {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
right: 0;
|
|
75
|
+
}
|
|
76
|
+
`
|
|
77
|
+
];
|
|
78
|
+
__decorate([
|
|
79
|
+
property({ type: String })
|
|
80
|
+
], OxFontSelector.prototype, "value", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Object })
|
|
83
|
+
], OxFontSelector.prototype, "properties", void 0);
|
|
84
|
+
OxFontSelector = __decorate([
|
|
85
|
+
customElement('ox-font-selector')
|
|
86
|
+
], OxFontSelector);
|
|
87
|
+
export default OxFontSelector;
|
|
88
|
+
//# sourceMappingURL=ox-font-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-font-selector.js","sourceRoot":"","sources":["../../src/ox-font-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,oBAAoB,CAAA;AAC3B,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,IAAqB,cAAc,GAAnC,MAAqB,cAAe,SAAQ,UAAU;IA4BpD,MAAM;QACJ,OA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CAAC,CAAC,mBAAmB,CAAC;SACtC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA9EQ,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAgB;AAxBxB,cAAc;IADlC,aAAa,CAAC,kBAAkB,CAAC;GACb,cAAc,CA+ElC;eA/EoB,cAAc","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon'\nimport './font-selector'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-font-selector')\nexport default class OxFontSelector extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n display: inline-block;\n }\n\n input[type='text'] {\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n mwc-icon {\n position: absolute;\n top: 0;\n right: 0;\n }\n `\n ]\n\n @property({ type: String }) value?: string\n @property({ type: Object }) properties: any\n\n popup: any\n\n render() {\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @change=${(e: Event) => this._onInputChanged(e)}\n .placeholder=${this.getAttribute('placeholder') || ''}\n />\n\n <mwc-icon @click=${() => this.openSelector()}>font_download</mwc-icon>\n `\n }\n\n _onInputChanged(e: Event) {\n this.value = (e.target as HTMLInputElement).value\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n /*\n * 기존 설정된 보드가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var value = this.value || {}\n\n var template = html`\n <font-selector\n .creatable=${true}\n @font-selected=${async (e: CustomEvent) => {\n var font = e.detail.font\n this.value = font.name\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.popup && this.popup.close()\n }}\n ></font-selector>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.select font')\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import './ox-font-selector';
|
|
5
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor';
|
|
6
|
+
export declare class OxPropertyEditorFontSelector extends OxPropertyEditor {
|
|
7
|
+
editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import './ox-font-selector';
|
|
5
|
+
import { html } from 'lit';
|
|
6
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
7
|
+
export class OxPropertyEditorFontSelector extends OxPropertyEditor {
|
|
8
|
+
editorTemplate(value, spec) {
|
|
9
|
+
return html ` <ox-font-selector id="editor" .value=${value} .properties=${spec.property}></ox-font-selector> `;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
customElements.define('ox-property-editor-font-selector', OxPropertyEditorFontSelector);
|
|
13
|
+
//# sourceMappingURL=ox-property-editor-font-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-property-editor-font-selector.js","sourceRoot":"","sources":["../../src/ox-property-editor-font-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAA;AAEzE,MAAM,OAAO,4BAA6B,SAAQ,gBAAgB;IAChE,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,OAAO,IAAI,CAAA,yCAAyC,KAAK,gBAAgB,IAAI,CAAC,QAAQ,uBAAuB,CAAA;IAC/G,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,kCAAkC,EAAE,4BAA4B,CAAC,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-font-selector'\n\nimport { html } from 'lit'\n\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\n\nexport class OxPropertyEditorFontSelector extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n return html` <ox-font-selector id=\"editor\" .value=${value} .properties=${spec.property}></ox-font-selector> `\n }\n}\n\ncustomElements.define('ox-property-editor-font-selector', OxPropertyEditorFontSelector)\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const UPDATE_FONT_LIST = "UPDATE_FONT_LIST";
|
|
2
|
+
export declare const CLEAR_FONT_LIST = "CLEAR_FONT_LIST";
|
|
3
|
+
export declare const actionUpdateFontList: (listParams?: {
|
|
4
|
+
sortings?: any;
|
|
5
|
+
filters?: any;
|
|
6
|
+
pagination?: any;
|
|
7
|
+
}) => (dispatch: any) => Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as client from './font-graphql-client';
|
|
2
|
+
export const UPDATE_FONT_LIST = 'UPDATE_FONT_LIST';
|
|
3
|
+
export const CLEAR_FONT_LIST = 'CLEAR_FONT_LIST';
|
|
4
|
+
export const actionUpdateFontList = (listParams) => async (dispatch) => {
|
|
5
|
+
try {
|
|
6
|
+
const fonts = await client.fetchFontList(listParams || { filters: [] });
|
|
7
|
+
dispatch({
|
|
8
|
+
type: UPDATE_FONT_LIST,
|
|
9
|
+
list: fonts && fonts.items
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error(error);
|
|
14
|
+
dispatch({
|
|
15
|
+
type: CLEAR_FONT_LIST
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=redux-font-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redux-font-actions.js","sourceRoot":"","sources":["../../src/redux-font-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,UAAgE,EAAE,EAAE,CAAC,KAAK,EAAE,QAAa,EAAE,EAAE;IAC5F,IAAI;QACF,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,UAAU,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;QAEvE,QAAQ,CAAC;YACP,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK;SAC3B,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,QAAQ,CAAC;YACP,IAAI,EAAE,eAAe;SACtB,CAAC,CAAA;KACH;AACH,CAAC,CAAA","sourcesContent":["import * as client from './font-graphql-client'\n\nexport const UPDATE_FONT_LIST = 'UPDATE_FONT_LIST'\nexport const CLEAR_FONT_LIST = 'CLEAR_FONT_LIST'\n\nexport const actionUpdateFontList =\n (listParams?: { sortings?: any; filters?: any; pagination?: any }) => async (dispatch: any) => {\n try {\n const fonts = await client.fetchFontList(listParams || { filters: [] })\n\n dispatch({\n type: UPDATE_FONT_LIST,\n list: fonts && fonts.items\n })\n } catch (error) {\n console.error(error)\n dispatch({\n type: CLEAR_FONT_LIST\n })\n }\n }\n"]}
|