@nebularstreams/libmui 2.5.124 → 3.0.0
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/libui.esm.js +2 -2
- package/dist/libui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +0 -4
- package/src/widgets/TemplatedInputWidget.js +1 -1
- package/src/meta/Emojis.js +0 -32136
- package/src/meta/FontAwesome.js +0 -8012
- package/src/widgets/SmileysPanel.js +0 -20
- package/src/widgets/SmileysWidget.js +0 -199
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import m from "mithril";
|
|
2
|
-
import {defineWidget} from "./Basic";
|
|
3
|
-
import TitleBarWidget from "./TitleBarWidget";
|
|
4
|
-
import SmileysWidget from "./SmileysWidget";
|
|
5
|
-
|
|
6
|
-
export default defineWidget(
|
|
7
|
-
({attrs}) => [
|
|
8
|
-
...attrs.toggle ? [] : [
|
|
9
|
-
m(TitleBarWidget, {
|
|
10
|
-
onClick: attrs.onClose,
|
|
11
|
-
title: "Add an emoji"
|
|
12
|
-
})
|
|
13
|
-
],
|
|
14
|
-
m(SmileysWidget, {
|
|
15
|
-
horizontal: true,
|
|
16
|
-
onClick: attrs.onClick,
|
|
17
|
-
icons: attrs.icons
|
|
18
|
-
})
|
|
19
|
-
]
|
|
20
|
-
);
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import m from "mithril";
|
|
2
|
-
import {defineWidget, Empty} from "./Basic";
|
|
3
|
-
import InputWidget from "./InputWidget";
|
|
4
|
-
import EMOJIS from "../meta/Emojis";
|
|
5
|
-
import FONTAWESOME from "../meta/FontAwesome";
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
FAVOLEGEND = "⭐️",
|
|
10
|
-
FAVORITES = {},
|
|
11
|
-
BLACKLIST = {Component: true};
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
"codes": "1F3F4 E0067 E0062 E0077 E006C E0073 E007F",
|
|
17
|
-
"char": "🏴",
|
|
18
|
-
"name": "flag: Wales",
|
|
19
|
-
"category": "Flags (subdivision-flag)",
|
|
20
|
-
"group": "Flags",
|
|
21
|
-
"subgroup": "subdivision-flag"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
favorites,
|
|
28
|
-
groups,
|
|
29
|
-
filtered,
|
|
30
|
-
filterText,
|
|
31
|
-
ICONSET;
|
|
32
|
-
|
|
33
|
-
function filter(text, minlen = 2) {
|
|
34
|
-
if (text && text.length >= minlen) {
|
|
35
|
-
filtered = ICONSET.filter((smiley) => (smiley.name.toLowerCase()
|
|
36
|
-
.indexOf(text) >= 0));
|
|
37
|
-
m.redraw();
|
|
38
|
-
} else if (filtered) {
|
|
39
|
-
filtered = null;
|
|
40
|
-
m.redraw();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function setIconset(emojis, icons) {
|
|
45
|
-
ICONSET = [
|
|
46
|
-
...emojis ? EMOJIS : [],
|
|
47
|
-
...icons ? FONTAWESOME : []
|
|
48
|
-
];
|
|
49
|
-
calc();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function calc() {
|
|
53
|
-
favorites = FAVORITES || {};
|
|
54
|
-
const favkeys = Object.keys(favorites);
|
|
55
|
-
groups = ICONSET.reduce((total, item) => {
|
|
56
|
-
const {
|
|
57
|
-
char,
|
|
58
|
-
group,
|
|
59
|
-
name,
|
|
60
|
-
icon,
|
|
61
|
-
class: clase
|
|
62
|
-
} = item;
|
|
63
|
-
if (!BLACKLIST[group]) {
|
|
64
|
-
if (total[group]) {
|
|
65
|
-
total[group].push({
|
|
66
|
-
char,
|
|
67
|
-
name,
|
|
68
|
-
icon,
|
|
69
|
-
class: clase
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
total[group] = [{
|
|
73
|
-
char,
|
|
74
|
-
name,
|
|
75
|
-
icon,
|
|
76
|
-
class: clase
|
|
77
|
-
}
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return total;
|
|
82
|
-
},
|
|
83
|
-
favkeys.length
|
|
84
|
-
? {
|
|
85
|
-
|
|
86
|
-
favorites: favkeys.map((char) => ({
|
|
87
|
-
name: favorites[char].name,
|
|
88
|
-
char
|
|
89
|
-
}))
|
|
90
|
-
}
|
|
91
|
-
: {});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function del(item) {
|
|
95
|
-
if (item && item.char && favorites[item.char]) {
|
|
96
|
-
delete favorites[item.char];
|
|
97
|
-
calc();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function save(item) {
|
|
102
|
-
if (item && item.char && item.name && !item.icon) {
|
|
103
|
-
favorites[item.char] = item.name;
|
|
104
|
-
calc();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const SmileysWidget = defineWidget(
|
|
109
|
-
({attrs, state}) => m("widget.ohidden",
|
|
110
|
-
{
|
|
111
|
-
class: (attrs.mainclass ? attrs.mainclass : "smileyswidget") + " " + (attrs.horizontal ? "flexcol" : "flexrow")
|
|
112
|
-
},
|
|
113
|
-
[
|
|
114
|
-
m(InputWidget, {
|
|
115
|
-
hint: "search emoji ...",
|
|
116
|
-
containerClass: "bottombox forinputs unitheight col-12 font-125 order-end noshrink bg-inputs",
|
|
117
|
-
class: "font-125 transparent pad-1 pad-h",
|
|
118
|
-
autofocus: true,
|
|
119
|
-
value: filterText,
|
|
120
|
-
oninput: (value) => {
|
|
121
|
-
filterText = value.toLowerCase();
|
|
122
|
-
filter(filterText);
|
|
123
|
-
},
|
|
124
|
-
onchange: () => {
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
|
|
128
|
-
...filtered
|
|
129
|
-
? [
|
|
130
|
-
m(
|
|
131
|
-
"icons.flexrow.wrap.scrolly.grows",
|
|
132
|
-
filtered.length
|
|
133
|
-
? filtered.map(
|
|
134
|
-
(smiley) => m(".smiley", {
|
|
135
|
-
onclick: (e) => {
|
|
136
|
-
if (state.current === "favorites" && e.shiftKey) {
|
|
137
|
-
del(smiley);
|
|
138
|
-
} else {
|
|
139
|
-
save(smiley);
|
|
140
|
-
}
|
|
141
|
-
attrs.onClick(smiley.char, smiley);
|
|
142
|
-
},
|
|
143
|
-
class: smiley.class || ""
|
|
144
|
-
}, smiley.char))
|
|
145
|
-
: [
|
|
146
|
-
m(Empty, {
|
|
147
|
-
icon: "smile",
|
|
148
|
-
message: "No icons found",
|
|
149
|
-
size: 2
|
|
150
|
-
})
|
|
151
|
-
]
|
|
152
|
-
)
|
|
153
|
-
]
|
|
154
|
-
: [
|
|
155
|
-
m(
|
|
156
|
-
".categories.noshrink",
|
|
157
|
-
{
|
|
158
|
-
class: attrs.horizontal ? "flexrow wrap" : "flexcol"
|
|
159
|
-
},
|
|
160
|
-
Object.keys(groups)
|
|
161
|
-
.map((group) => m(".grows.cat", {
|
|
162
|
-
className: (state.current === group ? "accent" : "") + " " + (group === "favorites" ? "isfav" : ""),
|
|
163
|
-
onclick: () => {
|
|
164
|
-
state.current = group;
|
|
165
|
-
m.redraw();
|
|
166
|
-
}
|
|
167
|
-
}, group === "favorites"
|
|
168
|
-
? FAVOLEGEND : group))
|
|
169
|
-
),
|
|
170
|
-
m(
|
|
171
|
-
"icons.flexrow.wrap.scrolly.grows",
|
|
172
|
-
groups[state.current]
|
|
173
|
-
? groups[state.current].map((smiley) => m(".smiley", {
|
|
174
|
-
onclick: (e) => {
|
|
175
|
-
if (state.current === "favorites" && e.shiftKey) {
|
|
176
|
-
del(smiley);
|
|
177
|
-
} else {
|
|
178
|
-
save(smiley);
|
|
179
|
-
}
|
|
180
|
-
attrs.onClick(smiley.char, smiley);
|
|
181
|
-
},
|
|
182
|
-
class: smiley.class || ""
|
|
183
|
-
}, smiley.char))
|
|
184
|
-
: []
|
|
185
|
-
)
|
|
186
|
-
]
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
]
|
|
190
|
-
),
|
|
191
|
-
({attrs, state}) => {
|
|
192
|
-
setIconset(!attrs.noemojis, attrs.icons);
|
|
193
|
-
[state.current] = Object.keys(groups);
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
export default SmileysWidget;
|
|
198
|
-
|
|
199
|
-
|