-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
dev-ui.js
151 lines (134 loc) · 2.88 KB
/
dev-ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import Iconify from '@iconify/iconify';
import style from './src/css/style.scss';
import UI from './src/ui';
// UI configuration
const itemsPerPage = 55; // 5 rows x 11 icons. Also see plugin-ui.js
let iconifyConfig = {
config: {
itemsPerPage: itemsPerPage,
search: {
limit: itemsPerPage * 2,
},
},
};
// Use local API for development. See config.common.js
if (process.env.ICONIFY_API) {
Iconify.setConfig('defaultAPI', process.env.ICONIFY_API_VALUE);
}
if (process.env.SEARCH_API) {
iconifyConfig.config.API = {
URI: process.env.SEARCH_API_VALUE,
};
}
let params = {
callback: (event, data) => {
console.log('Callback to plugin:', event, data);
},
iconify: iconifyConfig,
// Prefix to limit plugin to one collection. Changing this might be broken by stored route and require reset of options
// prefix: 'ic',
// Route
route: {
page: 'iconify',
iconify: {
type: 'collection',
params: {
prefix: 'ic',
page: 1,
search: 'arrow',
},
parent: {
type: 'collections',
},
},
},
// State
options: {
// selected icon
icon: 'mdi:home',
// selected node
node: '0:11',
// icon changes
color: '#a20',
hFlip: true,
rotate: 1,
// layout
list: true,
},
// Saved lists
storage: {
recent: [
'mdi:home',
'ic:baseline-build',
'ic:missing', // invalid entry
],
bookmarks: ['bytesize:home', 'el:home', 'el:home-alt'],
},
// parent nodes
parentNodes: [
{ id: '0:1', type: 'PAGE', name: 'Tests', parents: [] },
{
id: '130:38',
type: 'FRAME',
name: 'Horizontal auto-group',
parents: ['130:35', '0:1'],
default: true,
layoutMode: 'HORIZONTAL',
},
{
id: '130:37',
type: 'GROUP',
name:
'Layer with a very very very very very very very very very very long name to test overflow',
parents: ['130:35', '0:1'],
},
{
id: '130:35',
type: 'FRAME',
name: 'iOS stuff',
parents: ['0:1'],
layoutMode: 'NONE',
},
],
};
var ui = new UI(document.getElementById('container'), params);
// Test showCode()
setTimeout(function() {
ui.showCode({
name: 'ic:twotone-folder-open',
color: '#88aa33',
props: {
rotate: 0,
vFlip: false,
hFlip: false,
},
node: {
name: 'ic:twotone-folder-open',
width: 120,
height: 120,
rotation: 0,
color: '#88aa33',
},
});
}, 1000);
// Test notices
/*
setTimeout(() => {
ui.addNotice('Testing notice!');
}, 1000);
setTimeout(() => {
ui.addNotice('Error message!', {type: 'error'});
}, 2000);
setTimeout(() => {
ui.addNotice('This will stay for 10 seconds', {expiration: 10000});
}, 2500);
setTimeout(() => {
ui.addNotice('A warning?', {type: 'warning'});
}, 4000);
setTimeout(() => {
ui.addNotice('A very very very very very very very very very very very very very very very very very very very very long notice to test text wrapping?');
}, 6000);
*/