@operato/font 7.1.31 → 7.1.32
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 +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/custom-elements.json +0 -860
- package/src/font-creation-card.ts +0 -263
- package/src/font-graphql-client.ts +0 -117
- package/src/font-selector.ts +0 -261
- package/src/index.ts +0 -6
- package/src/ox-file-selector.ts +0 -113
- package/src/ox-font-selector.ts +0 -94
- package/src/ox-property-editor-font-selector.ts +0 -17
- package/src/redux-font-actions.ts +0 -21
- package/src/redux-font-reducers.ts +0 -88
- package/src/themes/font-theme.css +0 -14
package/src/ox-file-selector.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
|
|
3
|
-
import { LitElement, css, html } from 'lit'
|
|
4
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
@customElement('ox-file-selector')
|
|
7
|
-
export class OxFileSelector extends LitElement {
|
|
8
|
-
static styles = [
|
|
9
|
-
css`
|
|
10
|
-
:host {
|
|
11
|
-
flex: 1;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
position: relative;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#input-box {
|
|
19
|
-
display: flex;
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
input[type='file'] {
|
|
25
|
-
position: absolute;
|
|
26
|
-
width: 0px;
|
|
27
|
-
height: 0px;
|
|
28
|
-
padding: 0;
|
|
29
|
-
margin: -1px;
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
clip: rect(0, 0, 0, 0);
|
|
32
|
-
border: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
label {
|
|
36
|
-
padding: unset;
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
box-sizing: border-box;
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
|
|
44
|
-
color: var(--file-selector-color, #999);
|
|
45
|
-
font-size: inherit;
|
|
46
|
-
line-height: normal;
|
|
47
|
-
vertical-align: middle;
|
|
48
|
-
background-color: var(--file-selector-bg-color, #fdfdfd);
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
border: var(--file-selector-border, 1px solid #ebebeb);
|
|
51
|
-
border-radius: var(--file-selector-border-radius, 0.25em);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* named upload */
|
|
55
|
-
.upload-name {
|
|
56
|
-
flex: 1;
|
|
57
|
-
padding: 0.5em 0.75em; /* label의 패딩값과 일치 */
|
|
58
|
-
font-size: inherit;
|
|
59
|
-
font-family: inherit;
|
|
60
|
-
line-height: normal;
|
|
61
|
-
vertical-align: middle;
|
|
62
|
-
background-color: #f5f5f5;
|
|
63
|
-
border: 1px solid #ebebeb;
|
|
64
|
-
border-bottom-color: #e2e2e2;
|
|
65
|
-
border-radius: 0.25em;
|
|
66
|
-
-webkit-appearance: none; /* 네이티브 외형 감추기 */
|
|
67
|
-
-moz-appearance: none;
|
|
68
|
-
appearance: none;
|
|
69
|
-
}
|
|
70
|
-
`
|
|
71
|
-
]
|
|
72
|
-
|
|
73
|
-
@property({ type: String }) label: string = 'select file'
|
|
74
|
-
@property({ type: String }) accept?: string
|
|
75
|
-
@property({ type: Boolean, attribute: 'show-filename' }) showFilename: boolean = false
|
|
76
|
-
@property({ type: Boolean, attribute: 'multiple' }) multiple: boolean = false
|
|
77
|
-
@property({ type: Array }) _files: Array<any> = []
|
|
78
|
-
|
|
79
|
-
render() {
|
|
80
|
-
return html`
|
|
81
|
-
<div id="input-box">
|
|
82
|
-
${this.showFilename
|
|
83
|
-
? html`
|
|
84
|
-
<input class="upload-name" value=${this._files.map(f => f.name).join(', ') || this.label} disabled />
|
|
85
|
-
`
|
|
86
|
-
: html``}
|
|
87
|
-
<label for="input-file">${this.label}</label>
|
|
88
|
-
<input
|
|
89
|
-
id="input-file"
|
|
90
|
-
type="file"
|
|
91
|
-
accept="${this.accept}"
|
|
92
|
-
class="upload-hidden"
|
|
93
|
-
?multiple=${this.multiple}
|
|
94
|
-
hidden
|
|
95
|
-
@change=${(e: Event) => {
|
|
96
|
-
const el = e.currentTarget as HTMLInputElement
|
|
97
|
-
this.dispatchEvent(
|
|
98
|
-
new CustomEvent('file-change', {
|
|
99
|
-
bubbles: true,
|
|
100
|
-
composed: true,
|
|
101
|
-
detail: {
|
|
102
|
-
files: el.files
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
el.value = ''
|
|
108
|
-
}}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
`
|
|
112
|
-
}
|
|
113
|
-
}
|
package/src/ox-font-selector.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@material/web/icon/icon.js'
|
|
6
|
-
import './font-selector'
|
|
7
|
-
|
|
8
|
-
import { css, html, LitElement } from 'lit'
|
|
9
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
10
|
-
|
|
11
|
-
import { i18next } from '@operato/i18n'
|
|
12
|
-
import { openPopup } from '@operato/layout'
|
|
13
|
-
|
|
14
|
-
@customElement('ox-font-selector')
|
|
15
|
-
export default class OxFontSelector extends LitElement {
|
|
16
|
-
static styles = [
|
|
17
|
-
css`
|
|
18
|
-
:host {
|
|
19
|
-
position: relative;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
input[type='text'] {
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
md-icon {
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: 0;
|
|
33
|
-
right: 0;
|
|
34
|
-
}
|
|
35
|
-
`
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
@property({ type: String }) value?: string
|
|
39
|
-
@property({ type: Object }) properties: any
|
|
40
|
-
|
|
41
|
-
popup: any
|
|
42
|
-
|
|
43
|
-
render() {
|
|
44
|
-
return html`
|
|
45
|
-
<input
|
|
46
|
-
id="text"
|
|
47
|
-
type="text"
|
|
48
|
-
.value=${this.value || ''}
|
|
49
|
-
@change=${(e: Event) => this._onInputChanged(e)}
|
|
50
|
-
.placeholder=${this.getAttribute('placeholder') || ''}
|
|
51
|
-
/>
|
|
52
|
-
|
|
53
|
-
<md-icon @click=${() => this.openSelector()}>font_download</md-icon>
|
|
54
|
-
`
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
_onInputChanged(e: Event) {
|
|
58
|
-
this.value = (e.target as HTMLInputElement).value
|
|
59
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
openSelector() {
|
|
63
|
-
if (this.popup) {
|
|
64
|
-
delete this.popup
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
* 기존 설정된 보드가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
69
|
-
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
70
|
-
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
71
|
-
*/
|
|
72
|
-
var value = this.value || {}
|
|
73
|
-
|
|
74
|
-
var template = html`
|
|
75
|
-
<font-selector
|
|
76
|
-
.creatable=${true}
|
|
77
|
-
@font-selected=${async (e: CustomEvent) => {
|
|
78
|
-
var font = e.detail.font
|
|
79
|
-
this.value = font.name
|
|
80
|
-
|
|
81
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
82
|
-
|
|
83
|
-
this.popup && this.popup.close()
|
|
84
|
-
}}
|
|
85
|
-
></font-selector>
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
this.popup = openPopup(template, {
|
|
89
|
-
backdrop: true,
|
|
90
|
-
size: 'large',
|
|
91
|
-
title: i18next.t('title.select font')
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import './ox-font-selector'
|
|
6
|
-
|
|
7
|
-
import { html, TemplateResult } from 'lit'
|
|
8
|
-
|
|
9
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
10
|
-
|
|
11
|
-
export class OxPropertyEditorFontSelector extends OxPropertyEditor {
|
|
12
|
-
editorTemplate(value: any, spec: PropertySpec): TemplateResult {
|
|
13
|
-
return html` <ox-font-selector id="editor" .value=${value} .properties=${spec.property}></ox-font-selector> `
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
customElements.define('ox-property-editor-font-selector', OxPropertyEditorFontSelector)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as client from './font-graphql-client'
|
|
2
|
-
|
|
3
|
-
export const UPDATE_FONT_LIST = 'UPDATE_FONT_LIST'
|
|
4
|
-
export const CLEAR_FONT_LIST = 'CLEAR_FONT_LIST'
|
|
5
|
-
|
|
6
|
-
export const actionUpdateFontList =
|
|
7
|
-
(listParam?: { sortings?: any; filters?: any; pagination?: any }) => async (dispatch: any) => {
|
|
8
|
-
try {
|
|
9
|
-
const fonts = await client.fetchFontList(listParam || { filters: [] })
|
|
10
|
-
|
|
11
|
-
dispatch({
|
|
12
|
-
type: UPDATE_FONT_LIST,
|
|
13
|
-
list: fonts && fonts.items
|
|
14
|
-
})
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error(error)
|
|
17
|
-
dispatch({
|
|
18
|
-
type: CLEAR_FONT_LIST
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { CLEAR_FONT_LIST, UPDATE_FONT_LIST } from './redux-font-actions.js'
|
|
2
|
-
|
|
3
|
-
import { Action } from 'redux'
|
|
4
|
-
import WebFont from 'webfontloader'
|
|
5
|
-
|
|
6
|
-
type Font = {
|
|
7
|
-
name: string
|
|
8
|
-
provider: string
|
|
9
|
-
uri: string
|
|
10
|
-
active: boolean
|
|
11
|
-
files: Array<{ name: string; fullpath: string }>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const ReducerFont = (state = [], action: any) => {
|
|
15
|
-
switch (action.type) {
|
|
16
|
-
case UPDATE_FONT_LIST:
|
|
17
|
-
let newState = action.list as Array<Font>
|
|
18
|
-
let activatedFonts = newState.filter(font => font.active)
|
|
19
|
-
|
|
20
|
-
let googles = [] as Array<string>
|
|
21
|
-
let customs = [] as Array<string>
|
|
22
|
-
let customFontCSS = ''
|
|
23
|
-
|
|
24
|
-
activatedFonts.forEach(font => {
|
|
25
|
-
const { name, provider, files, uri } = font
|
|
26
|
-
|
|
27
|
-
if (provider === 'google') {
|
|
28
|
-
googles.push(name)
|
|
29
|
-
} else if (provider === 'custom') {
|
|
30
|
-
customs.push(name)
|
|
31
|
-
|
|
32
|
-
if (files && files.length > 0) {
|
|
33
|
-
customFontCSS += files
|
|
34
|
-
.map(file => {
|
|
35
|
-
const { name: filename, fullpath } = file
|
|
36
|
-
const bold = filename.toUpperCase().indexOf('BOLD') !== -1
|
|
37
|
-
|
|
38
|
-
return `@font-face {
|
|
39
|
-
font-family: '${name}';
|
|
40
|
-
src: local('${name}'), url(${fullpath});
|
|
41
|
-
font-weight: ${bold ? 'bold' : 'normal'};
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
})
|
|
45
|
-
.join('\n')
|
|
46
|
-
} else {
|
|
47
|
-
customFontCSS += `@font-face {
|
|
48
|
-
font-family: '${name}';
|
|
49
|
-
src: local('${name}')${uri ? `, url(${uri})` : ''};
|
|
50
|
-
}
|
|
51
|
-
`
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
let style = document.head.querySelector('#custom-fonts') as HTMLStyleElement
|
|
57
|
-
if (!style) {
|
|
58
|
-
style = document.createElement('style')
|
|
59
|
-
style.id = 'custom-fonts'
|
|
60
|
-
document.head.appendChild(style)
|
|
61
|
-
}
|
|
62
|
-
style.innerHTML = customFontCSS
|
|
63
|
-
|
|
64
|
-
// TODO: typekit 등 타 서비스 지원
|
|
65
|
-
let WebFontConfig = {} as any
|
|
66
|
-
if (googles.length) {
|
|
67
|
-
WebFontConfig.google = {
|
|
68
|
-
families: googles
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (customs.length) {
|
|
72
|
-
WebFontConfig.custom = {
|
|
73
|
-
families: customs
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (Object.keys(WebFontConfig).length) WebFont.load(WebFontConfig)
|
|
77
|
-
|
|
78
|
-
return newState
|
|
79
|
-
|
|
80
|
-
case CLEAR_FONT_LIST:
|
|
81
|
-
return []
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
return state
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default ReducerFont
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
--font-tools-background-color: var(--primary-color);
|
|
3
|
-
--font-selector-background-color: #fff;
|
|
4
|
-
--font-selector-name-font: bold 14px var(--theme-font);
|
|
5
|
-
--font-selector-border: 1px solid rgba(0, 0, 0, 0.2);
|
|
6
|
-
--font-selector-icon-size: 35px;
|
|
7
|
-
--font-selector-icon-font: normal 20px/35px var(--md-icon-font, 'Material Symbols Outlined');
|
|
8
|
-
--font-selector-icon-color: var(--primary-color);
|
|
9
|
-
--font-selector-icon-background-color: rgba(255, 255, 255, 0.85);
|
|
10
|
-
--font-selector-etc-background-color: var(--primary-color);
|
|
11
|
-
--font-selector-etc-font: bold 9px var(--theme-font);
|
|
12
|
-
--font-selector-etc-icon-font: normal 72px var(--md-icon-font, 'Material Symbols Outlined');
|
|
13
|
-
--font-selector-etc-icon-color: var(--secondary-color);
|
|
14
|
-
}
|