@things-factory/figure-library 10.1.281 → 10.1.282
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/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +1 -0
- package/dist-client/pages/figure-library-page.d.ts +6 -0
- package/dist-client/pages/figure-library-page.js +42 -2
- package/dist-client/settings/figure-source-setting-let.d.ts +25 -0
- package/dist-client/settings/figure-source-setting-let.js +190 -0
- package/dist-client/viewparts/figure-import-result.d.ts +20 -0
- package/dist-client/viewparts/figure-import-result.js +50 -0
- package/dist-client/viewparts/figure-package-import.d.ts +3 -14
- package/dist-client/viewparts/figure-package-import.js +3 -28
- package/dist-client/viewparts/figure-source-install.d.ts +24 -0
- package/dist-client/viewparts/figure-source-install.js +313 -0
- package/dist-server/routers/figure-source-thumbnail-router.d.ts +5 -0
- package/dist-server/routers/figure-source-thumbnail-router.js +39 -0
- package/dist-server/routes.js +3 -0
- package/dist-server/service/figure-library-resolver.js +2 -4
- package/dist-server/service/index.d.ts +6 -1
- package/dist-server/service/index.js +6 -1
- package/dist-server/service/library/import.d.ts +2 -0
- package/dist-server/service/library/import.js +3 -0
- package/dist-server/service/source/figure-source-resolver.d.ts +57 -0
- package/dist-server/service/source/figure-source-resolver.js +287 -0
- package/dist-server/service/source/source-client.d.ts +27 -0
- package/dist-server/service/source/source-client.js +109 -0
- package/dist-server/service/source/source-install.d.ts +57 -0
- package/dist-server/service/source/source-install.js +83 -0
- package/dist-server/service/source/source-setting-rules.d.ts +39 -0
- package/dist-server/service/source/source-setting-rules.js +71 -0
- package/package.json +8 -6
- package/translations/en.json +33 -1
- package/translations/es.json +33 -1
- package/translations/ja.json +33 -1
- package/translations/ko.json +33 -1
- package/translations/ms.json +33 -1
- package/translations/zh.json +33 -1
package/dist-client/index.d.ts
CHANGED
package/dist-client/index.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import '@material/web/button/text-button.js';
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
1
3
|
import '@operato/data-grist';
|
|
2
4
|
import '@operato/data-grist/ox-card-thumb.js';
|
|
3
5
|
import '@things-factory/figure-viewer/dist-client/figure-thumb-mark.js';
|
|
4
6
|
import '../viewparts/figure-releases-popup.js';
|
|
5
7
|
import '../viewparts/figure-package-import.js';
|
|
8
|
+
import '../viewparts/figure-source-install.js';
|
|
6
9
|
import { PageView } from '@operato/shell';
|
|
7
10
|
declare const FigureLibraryPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
8
11
|
export declare class FigureLibraryPage extends FigureLibraryPage_base {
|
|
9
12
|
static styles: import("lit").CSSResult[];
|
|
10
13
|
private gristConfig;
|
|
14
|
+
/** Whether a figure server to install from is set in Settings (ADR-0114 decision 21): the install is offered only then. */
|
|
15
|
+
private sourceSet;
|
|
11
16
|
private grist;
|
|
12
17
|
get context(): {
|
|
13
18
|
title: string;
|
|
@@ -34,6 +39,7 @@ export declare class FigureLibraryPage extends FigureLibraryPage_base {
|
|
|
34
39
|
/** The line under the name: the full name and the version it draws with, as a board card's 「v1 · 3일 전」, and whether it is an item. */
|
|
35
40
|
private metaOf;
|
|
36
41
|
private openReleases;
|
|
42
|
+
private openSourceInstall;
|
|
37
43
|
private openImport;
|
|
38
44
|
}
|
|
39
45
|
export {};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/button/text-button.js';
|
|
3
|
+
import '@material/web/icon/icon.js';
|
|
2
4
|
import '@operato/data-grist';
|
|
3
5
|
import '@operato/data-grist/ox-card-thumb.js';
|
|
4
6
|
import '@things-factory/figure-viewer/dist-client/figure-thumb-mark.js';
|
|
5
7
|
import '../viewparts/figure-releases-popup.js';
|
|
6
8
|
import '../viewparts/figure-package-import.js';
|
|
9
|
+
import '../viewparts/figure-source-install.js';
|
|
7
10
|
import { versionText } from '../viewparts/figure-version.js';
|
|
8
11
|
import gql from 'graphql-tag';
|
|
9
|
-
import { css, html } from 'lit';
|
|
12
|
+
import { css, html, nothing } from 'lit';
|
|
10
13
|
import { customElement, query, state } from 'lit/decorators.js';
|
|
11
14
|
import { DataGrist } from '@operato/data-grist';
|
|
12
15
|
import { client } from '@operato/graphql';
|
|
@@ -71,6 +74,8 @@ const NONE = '-';
|
|
|
71
74
|
let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageView) {
|
|
72
75
|
constructor() {
|
|
73
76
|
super(...arguments);
|
|
77
|
+
/** Whether a figure server to install from is set in Settings (ADR-0114 decision 21): the install is offered only then. */
|
|
78
|
+
this.sourceSet = false;
|
|
74
79
|
this.fetchHandler = async ({ page = 1, limit = 24, filters = [] }) => {
|
|
75
80
|
const response = await client.query({
|
|
76
81
|
query: FIGURES,
|
|
@@ -94,9 +99,19 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
|
|
|
94
99
|
/* The card, its picture cell and the upload FAB: every card catalog's (ADR-0117 amendment 2026-10-13). */
|
|
95
100
|
CardCatalogStyles,
|
|
96
101
|
css `
|
|
102
|
+
div[filters-row] {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: var(--spacing-medium, 8px);
|
|
106
|
+
}
|
|
97
107
|
ox-filters-form {
|
|
98
108
|
flex: 1;
|
|
99
109
|
}
|
|
110
|
+
/* The install sits at the right end of the filter row, at the height of the chips beside it. */
|
|
111
|
+
md-text-button[source-install] {
|
|
112
|
+
flex: none;
|
|
113
|
+
--md-text-button-container-height: 28px;
|
|
114
|
+
}
|
|
100
115
|
`
|
|
101
116
|
]; }
|
|
102
117
|
get context() {
|
|
@@ -114,8 +129,13 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
|
|
|
114
129
|
render() {
|
|
115
130
|
return html `
|
|
116
131
|
<ox-grist class="page-fill" mode="CARD" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler}>
|
|
117
|
-
<div slot="headroom">
|
|
132
|
+
<div slot="headroom" filters-row>
|
|
118
133
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
134
|
+
${this.sourceSet
|
|
135
|
+
? html `<md-text-button source-install @click=${() => this.openSourceInstall()}>
|
|
136
|
+
<md-icon slot="icon">download</md-icon>${i18next.t('figure-library.button.install-from-source')}
|
|
137
|
+
</md-text-button>`
|
|
138
|
+
: nothing}
|
|
119
139
|
</div>
|
|
120
140
|
</ox-grist>
|
|
121
141
|
|
|
@@ -126,6 +146,13 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
|
|
|
126
146
|
}
|
|
127
147
|
async pageInitialized() {
|
|
128
148
|
await this.configure();
|
|
149
|
+
try {
|
|
150
|
+
const response = await client.query({ query: gql `query { figureLibrarySourceSet }`, fetchPolicy: 'no-cache' });
|
|
151
|
+
this.sourceSet = !!response.data?.figureLibrarySourceSet;
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
this.sourceSet = false;
|
|
155
|
+
}
|
|
129
156
|
}
|
|
130
157
|
/*
|
|
131
158
|
* The filter options are read once here (and again after an import), never per render: an async options function
|
|
@@ -269,6 +296,15 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
|
|
|
269
296
|
title: i18next.t('figure-library.title.releases-of', { name: (record.release ?? record.latest).name, count: record.releaseCount })
|
|
270
297
|
});
|
|
271
298
|
}
|
|
299
|
+
openSourceInstall() {
|
|
300
|
+
const popup = openPopup(html `<figure-source-install
|
|
301
|
+
@imported=${async () => {
|
|
302
|
+
await this.configure();
|
|
303
|
+
this.grist.fetch();
|
|
304
|
+
}}
|
|
305
|
+
@close=${() => popup.close()}
|
|
306
|
+
></figure-source-install>`, { backdrop: true, size: 'large', closable: true, title: i18next.t('figure-library.button.install-from-source') });
|
|
307
|
+
}
|
|
272
308
|
openImport() {
|
|
273
309
|
openPopup(html `<figure-package-import
|
|
274
310
|
@imported=${async () => {
|
|
@@ -282,6 +318,10 @@ __decorate([
|
|
|
282
318
|
state(),
|
|
283
319
|
__metadata("design:type", Object)
|
|
284
320
|
], FigureLibraryPage.prototype, "gristConfig", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
state(),
|
|
323
|
+
__metadata("design:type", Object)
|
|
324
|
+
], FigureLibraryPage.prototype, "sourceSet", void 0);
|
|
285
325
|
__decorate([
|
|
286
326
|
query('ox-grist'),
|
|
287
327
|
__metadata("design:type", DataGrist)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import '@material/web/button/outlined-button.js';
|
|
2
|
+
import '@material/web/button/text-button.js';
|
|
3
|
+
import '@things-factory/setting-base';
|
|
4
|
+
import { LitElement, nothing } from 'lit';
|
|
5
|
+
declare const FigureSourceSettingLet_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
6
|
+
/**
|
|
7
|
+
* 「피규어 서버 연결」 (ADR-0114 decision 21) - the figure server this domain installs figures from: its address, the
|
|
8
|
+
* domain on it and the access token it issued. Domain attributes, so shown to whoever may change them (privilege
|
|
9
|
+
* `env-var`). The token is never read back - the card says whether it is set, and a new one replaces it.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FigureSourceSettingLet extends FigureSourceSettingLet_base {
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
private keeps;
|
|
14
|
+
private draft;
|
|
15
|
+
private checking;
|
|
16
|
+
private checked?;
|
|
17
|
+
private settingRead;
|
|
18
|
+
private saving;
|
|
19
|
+
connectedCallback(): Promise<void>;
|
|
20
|
+
private get setting();
|
|
21
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
22
|
+
private check;
|
|
23
|
+
private save;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/button/outlined-button.js';
|
|
3
|
+
import '@material/web/button/text-button.js';
|
|
4
|
+
import '@things-factory/setting-base';
|
|
5
|
+
import gql from 'graphql-tag';
|
|
6
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
7
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
8
|
+
import { client, MutationController, QueryController } from '@operato/graphql';
|
|
9
|
+
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { notify } from '@operato/layout';
|
|
11
|
+
import { FieldHintStyles } from '@operato/styles';
|
|
12
|
+
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
13
|
+
const FIELDS = 'url domain tokenSet tokenHint';
|
|
14
|
+
/**
|
|
15
|
+
* 「피규어 서버 연결」 (ADR-0114 decision 21) - the figure server this domain installs figures from: its address, the
|
|
16
|
+
* domain on it and the access token it issued. Domain attributes, so shown to whoever may change them (privilege
|
|
17
|
+
* `env-var`). The token is never read back - the card says whether it is set, and a new one replaces it.
|
|
18
|
+
*/
|
|
19
|
+
let FigureSourceSettingLet = class FigureSourceSettingLet extends localize(i18next)(LitElement) {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.keeps = false;
|
|
23
|
+
this.draft = {};
|
|
24
|
+
this.checking = false;
|
|
25
|
+
this.settingRead = new QueryController(this, gql(`query { figureLibrarySource { ${FIELDS} } }`), {
|
|
26
|
+
variables: () => (this.keeps ? {} : undefined)
|
|
27
|
+
});
|
|
28
|
+
this.saving = new MutationController(this, gql(`mutation ($patch: FigureSourceSettingPatch!) { updateFigureLibrarySource(patch: $patch) { ${FIELDS} } }`), { refetch: () => [this.settingRead] });
|
|
29
|
+
}
|
|
30
|
+
static { this.styles = [
|
|
31
|
+
FieldHintStyles,
|
|
32
|
+
css `
|
|
33
|
+
div[content] {
|
|
34
|
+
display: grid;
|
|
35
|
+
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
|
|
36
|
+
align-items: start;
|
|
37
|
+
gap: var(--spacing-medium, 8px) var(--spacing-large, 12px);
|
|
38
|
+
}
|
|
39
|
+
@media (max-width: 600px) {
|
|
40
|
+
div[content] {
|
|
41
|
+
grid-template-columns: minmax(0, 1fr);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
label {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--spacing-small, 4px);
|
|
48
|
+
font: var(--label-font);
|
|
49
|
+
color: var(--md-sys-color-on-surface);
|
|
50
|
+
text-transform: var(--label-text-transform);
|
|
51
|
+
}
|
|
52
|
+
label.wide {
|
|
53
|
+
grid-column: 1 / -1;
|
|
54
|
+
}
|
|
55
|
+
input {
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: var(--form-element-height-medium, 32px);
|
|
59
|
+
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
60
|
+
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
61
|
+
border: var(--border-dim-color);
|
|
62
|
+
border-radius: var(--border-radius);
|
|
63
|
+
padding: var(--input-padding);
|
|
64
|
+
font: var(--input-font);
|
|
65
|
+
text-transform: none;
|
|
66
|
+
}
|
|
67
|
+
div[actions] {
|
|
68
|
+
grid-column: 1 / -1;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: flex-end;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: var(--spacing-small, 4px);
|
|
73
|
+
}
|
|
74
|
+
[checked] {
|
|
75
|
+
margin-right: auto;
|
|
76
|
+
font-size: var(--ui-t-small, 11.5px);
|
|
77
|
+
}
|
|
78
|
+
[checked][failed] {
|
|
79
|
+
color: var(--ui-crit, var(--md-sys-color-error));
|
|
80
|
+
}
|
|
81
|
+
`
|
|
82
|
+
]; }
|
|
83
|
+
async connectedCallback() {
|
|
84
|
+
super.connectedCallback();
|
|
85
|
+
this.keeps = await hasPrivilege({ category: 'env-var', privilege: 'mutation', domainOwnerGranted: true });
|
|
86
|
+
}
|
|
87
|
+
get setting() {
|
|
88
|
+
return this.settingRead.data?.figureLibrarySource || undefined;
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
const setting = this.setting;
|
|
92
|
+
if (!setting)
|
|
93
|
+
return nothing;
|
|
94
|
+
const busy = this.saving.pending;
|
|
95
|
+
const value = (name) => this.draft[name] ?? setting[name] ?? '';
|
|
96
|
+
const set = (name, text) => (this.draft = { ...this.draft, [name]: text });
|
|
97
|
+
return html `
|
|
98
|
+
<setting-let>
|
|
99
|
+
<span slot="title">${i18next.t('figure-library.setting.title')}</span>
|
|
100
|
+
<div slot="content" content>
|
|
101
|
+
<label
|
|
102
|
+
>${i18next.t('figure-library.setting.url')}
|
|
103
|
+
<input type="url" autocomplete="off" placeholder="https://figure.hatiolab.com" .value=${value('url')} ?disabled=${busy} @input=${(e) => set('url', e.target.value)}
|
|
104
|
+
/></label>
|
|
105
|
+
<label
|
|
106
|
+
>${i18next.t('figure-library.setting.domain')}
|
|
107
|
+
<input autocomplete="off" placeholder="system" .value=${value('domain')} ?disabled=${busy} @input=${(e) => set('domain', e.target.value)}
|
|
108
|
+
/></label>
|
|
109
|
+
<label class="wide"
|
|
110
|
+
>${i18next.t('figure-library.setting.token')}
|
|
111
|
+
<input type="password" autocomplete="off" .value=${this.draft.token ?? ''} ?disabled=${busy} @input=${(e) => set('token', e.target.value)} />
|
|
112
|
+
<small class="hint"
|
|
113
|
+
>${setting.tokenSet
|
|
114
|
+
? i18next.t('figure-library.setting.token-set', { hint: setting.tokenHint ?? '' })
|
|
115
|
+
: i18next.t('figure-library.setting.token-unset')}</small
|
|
116
|
+
></label
|
|
117
|
+
>
|
|
118
|
+
<div actions>
|
|
119
|
+
${this.checked ? html `<span checked ?failed=${!this.checked.ok} role="status">${this.checked.text}</span>` : nothing}
|
|
120
|
+
<md-text-button ?disabled=${busy || this.checking || !setting.url || !setting.tokenSet} @click=${() => this.check()}
|
|
121
|
+
>${i18next.t('figure-library.setting.check')}</md-text-button
|
|
122
|
+
>
|
|
123
|
+
<md-outlined-button ?disabled=${busy || !Object.keys(this.draft).length} @click=${() => this.save()}>${i18next.t('figure-library.button.save')}</md-outlined-button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</setting-let>
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
/* One catalog row asked with the saved setting: the answer says what to fix. */
|
|
130
|
+
async check() {
|
|
131
|
+
this.checking = true;
|
|
132
|
+
this.checked = undefined;
|
|
133
|
+
try {
|
|
134
|
+
const response = await client.query({
|
|
135
|
+
query: gql `
|
|
136
|
+
query {
|
|
137
|
+
checkFigureLibrarySource {
|
|
138
|
+
ok
|
|
139
|
+
code
|
|
140
|
+
message
|
|
141
|
+
total
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`,
|
|
145
|
+
fetchPolicy: 'no-cache'
|
|
146
|
+
});
|
|
147
|
+
const answer = response.data.checkFigureLibrarySource;
|
|
148
|
+
this.checked = answer.ok
|
|
149
|
+
? { ok: true, text: i18next.t('figure-library.setting.check-ok', { count: answer.total ?? 0 }) }
|
|
150
|
+
: { ok: false, text: answer.message ?? answer.code };
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
this.checked = { ok: false, text: e?.message ?? String(e) };
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
this.checking = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async save() {
|
|
160
|
+
/* A token left blank stays as it is - the card never holds the token it read. */
|
|
161
|
+
const { token, ...rest } = this.draft;
|
|
162
|
+
const patch = { ...rest, ...(token?.trim() ? { token } : {}) };
|
|
163
|
+
if (!(await this.saving.run({ patch })))
|
|
164
|
+
return;
|
|
165
|
+
this.draft = {};
|
|
166
|
+
this.checked = undefined;
|
|
167
|
+
notify({ message: i18next.t('figure-library.setting.saved') });
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
__decorate([
|
|
171
|
+
state(),
|
|
172
|
+
__metadata("design:type", Object)
|
|
173
|
+
], FigureSourceSettingLet.prototype, "keeps", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
state(),
|
|
176
|
+
__metadata("design:type", Object)
|
|
177
|
+
], FigureSourceSettingLet.prototype, "draft", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
state(),
|
|
180
|
+
__metadata("design:type", Object)
|
|
181
|
+
], FigureSourceSettingLet.prototype, "checking", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
state(),
|
|
184
|
+
__metadata("design:type", Object)
|
|
185
|
+
], FigureSourceSettingLet.prototype, "checked", void 0);
|
|
186
|
+
FigureSourceSettingLet = __decorate([
|
|
187
|
+
customElement('figure-source-setting-let')
|
|
188
|
+
], FigureSourceSettingLet);
|
|
189
|
+
export { FigureSourceSettingLet };
|
|
190
|
+
//# sourceMappingURL=figure-source-setting-let.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
export type ImportResult = {
|
|
3
|
+
problems: {
|
|
4
|
+
code: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
}[];
|
|
7
|
+
outcomes: {
|
|
8
|
+
ref: string;
|
|
9
|
+
outcome: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
differs?: string[];
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
declare const FigureImportResultView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
15
|
+
export declare class FigureImportResultView extends FigureImportResultView_base {
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
result?: ImportResult;
|
|
18
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { i18next, localize } from '@operato/i18n';
|
|
5
|
+
/*
|
|
6
|
+
* What became of each figure a package brought (ADR-0114): added, skipped or refused with the reason. A package file
|
|
7
|
+
* and an install from the figure server are one import, so both show their result with this.
|
|
8
|
+
*/
|
|
9
|
+
let FigureImportResultView = class FigureImportResultView extends localize(i18next)(LitElement) {
|
|
10
|
+
static { this.styles = css `
|
|
11
|
+
:host {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
}
|
|
16
|
+
[refused] {
|
|
17
|
+
color: var(--ui-crit, var(--md-sys-color-error));
|
|
18
|
+
}
|
|
19
|
+
[ref] {
|
|
20
|
+
font-family: var(--ui-mono, monospace);
|
|
21
|
+
}
|
|
22
|
+
p {
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
`; }
|
|
26
|
+
render() {
|
|
27
|
+
const result = this.result;
|
|
28
|
+
if (!result)
|
|
29
|
+
return nothing;
|
|
30
|
+
return html `<div role="status">
|
|
31
|
+
${result.problems.length
|
|
32
|
+
? html `<p refused role="alert">${i18next.t('figure-library.text.package-refused', { code: result.problems.map(p => p.code).join(', ') })}</p>`
|
|
33
|
+
: result.outcomes.map(o => html `<div>
|
|
34
|
+
<span ref>${o.ref}</span> ·
|
|
35
|
+
<strong ?refused=${o.outcome === 'refused'}>${i18next.t(`figure-library.outcome.${o.outcome}`)}</strong>
|
|
36
|
+
${o.differs?.length ? html `<div>${i18next.t('figure-library.text.differs', { fields: o.differs.join(', ') })}</div>` : nothing}
|
|
37
|
+
${o.outcome === 'refused' && o.code ? html `<div>${i18next.t(`error.${o.code}`, { defaultValue: o.code })}</div>` : nothing}
|
|
38
|
+
</div>`)}
|
|
39
|
+
</div>`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
property({ attribute: false }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], FigureImportResultView.prototype, "result", void 0);
|
|
46
|
+
FigureImportResultView = __decorate([
|
|
47
|
+
customElement('figure-import-result')
|
|
48
|
+
], FigureImportResultView);
|
|
49
|
+
export { FigureImportResultView };
|
|
50
|
+
//# sourceMappingURL=figure-import-result.js.map
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import '@operato/input/ox-input-file.js';
|
|
2
|
+
import './figure-import-result.js';
|
|
2
3
|
import { LitElement } from 'lit';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
code: string;
|
|
6
|
-
path?: string;
|
|
7
|
-
}[];
|
|
8
|
-
outcomes: {
|
|
9
|
-
ref: string;
|
|
10
|
-
outcome: string;
|
|
11
|
-
code?: string;
|
|
12
|
-
differs?: string[];
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
4
|
+
import type { ImportResult } from './figure-import-result.js';
|
|
5
|
+
export type { ImportResult };
|
|
15
6
|
declare const FigurePackageImport_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
16
7
|
export declare class FigurePackageImport extends FigurePackageImport_base {
|
|
17
8
|
static styles: import("lit").CSSResult;
|
|
@@ -19,6 +10,4 @@ export declare class FigurePackageImport extends FigurePackageImport_base {
|
|
|
19
10
|
private result?;
|
|
20
11
|
render(): import("lit-html").TemplateResult<1>;
|
|
21
12
|
private importFile;
|
|
22
|
-
private renderResult;
|
|
23
13
|
}
|
|
24
|
-
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/input/ox-input-file.js';
|
|
3
|
+
import './figure-import-result.js';
|
|
3
4
|
import gql from 'graphql-tag';
|
|
4
|
-
import { css, html, LitElement
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
5
6
|
import { customElement, state } from 'lit/decorators.js';
|
|
6
7
|
import { client, uploadContext } from '@operato/graphql';
|
|
7
8
|
import { i18next, localize } from '@operato/i18n';
|
|
@@ -37,20 +38,6 @@ let FigurePackageImport = class FigurePackageImport extends localize(i18next)(Li
|
|
|
37
38
|
padding: 16px;
|
|
38
39
|
font-size: var(--ui-t-body, 13px);
|
|
39
40
|
}
|
|
40
|
-
[result] {
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
gap: 8px;
|
|
44
|
-
}
|
|
45
|
-
[refused] {
|
|
46
|
-
color: var(--ui-crit, var(--md-sys-color-error));
|
|
47
|
-
}
|
|
48
|
-
[ref] {
|
|
49
|
-
font-family: var(--ui-mono, monospace);
|
|
50
|
-
}
|
|
51
|
-
p {
|
|
52
|
-
margin: 0;
|
|
53
|
-
}
|
|
54
41
|
`; }
|
|
55
42
|
render() {
|
|
56
43
|
return html `
|
|
@@ -67,7 +54,7 @@ let FigurePackageImport = class FigurePackageImport extends localize(i18next)(Li
|
|
|
67
54
|
this.importFile(file);
|
|
68
55
|
}}
|
|
69
56
|
></ox-input-file>
|
|
70
|
-
|
|
57
|
+
<figure-import-result .result=${this.result}></figure-import-result>
|
|
71
58
|
`;
|
|
72
59
|
}
|
|
73
60
|
async importFile(file) {
|
|
@@ -92,18 +79,6 @@ let FigurePackageImport = class FigurePackageImport extends localize(i18next)(Li
|
|
|
92
79
|
this.result = result;
|
|
93
80
|
this.dispatchEvent(new CustomEvent('imported', { detail: result }));
|
|
94
81
|
}
|
|
95
|
-
renderResult(result) {
|
|
96
|
-
return html `<div result role="status">
|
|
97
|
-
${result.problems.length
|
|
98
|
-
? html `<p refused role="alert">${i18next.t('figure-library.text.package-refused', { code: result.problems.map(p => p.code).join(', ') })}</p>`
|
|
99
|
-
: result.outcomes.map(o => html `<div>
|
|
100
|
-
<span ref>${o.ref}</span> ·
|
|
101
|
-
<strong ?refused=${o.outcome === 'refused'}>${i18next.t(`figure-library.outcome.${o.outcome}`)}</strong>
|
|
102
|
-
${o.differs?.length ? html `<div>${i18next.t('figure-library.text.differs', { fields: o.differs.join(', ') })}</div>` : nothing}
|
|
103
|
-
${o.outcome === 'refused' && o.code ? html `<div>${o.code}</div>` : nothing}
|
|
104
|
-
</div>`)}
|
|
105
|
-
</div>`;
|
|
106
|
-
}
|
|
107
82
|
};
|
|
108
83
|
__decorate([
|
|
109
84
|
state(),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '@material/web/button/text-button.js';
|
|
2
|
+
import '@material/web/button/filled-button.js';
|
|
3
|
+
import '@operato/popup/ox-popup-actions.js';
|
|
4
|
+
import './figure-import-result.js';
|
|
5
|
+
import { LitElement } from 'lit';
|
|
6
|
+
declare const FigureSourceInstall_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
7
|
+
export declare class FigureSourceInstall extends FigureSourceInstall_base {
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
private search;
|
|
10
|
+
private items;
|
|
11
|
+
private total;
|
|
12
|
+
private reading;
|
|
13
|
+
private installing;
|
|
14
|
+
private failure;
|
|
15
|
+
private chosen;
|
|
16
|
+
private result?;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
private renderItem;
|
|
20
|
+
private choose;
|
|
21
|
+
private read;
|
|
22
|
+
private install;
|
|
23
|
+
}
|
|
24
|
+
export {};
|