alchemy-media 0.6.1 → 0.6.2
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 +6 -0
- package/assets/fonts/fontawesome6/fa-brands-400.ttf +0 -0
- package/assets/fonts/fontawesome6/fa-brands-400.woff2 +0 -0
- package/assets/fonts/fontawesome6/fa-regular-400.ttf +0 -0
- package/assets/fonts/fontawesome6/fa-regular-400.woff2 +0 -0
- package/assets/fonts/fontawesome6/fa-solid-900.ttf +0 -0
- package/assets/fonts/fontawesome6/fa-solid-900.woff2 +0 -0
- package/assets/fonts/fontawesome6/fa-v4compatibility.ttf +0 -0
- package/assets/fonts/fontawesome6/fa-v4compatibility.woff2 +0 -0
- package/assets/stylesheets/alchemy_icons.scss +12 -4
- package/assets/stylesheets/element/alchemy_file.scss +93 -1
- package/assets/stylesheets/fontawesome6/_animated.scss +153 -0
- package/assets/stylesheets/fontawesome6/_bordered-pulled.scss +20 -0
- package/assets/stylesheets/fontawesome6/_core.scss +33 -0
- package/assets/stylesheets/{fontawesome5.15 → fontawesome6}/_fixed-width.scss +2 -1
- package/assets/stylesheets/fontawesome6/_functions.scss +57 -0
- package/assets/stylesheets/fontawesome6/_icons.scss +9 -0
- package/assets/stylesheets/{fontawesome5.15 → fontawesome6}/_list.scss +4 -4
- package/assets/stylesheets/fontawesome6/_mixins.scss +73 -0
- package/assets/stylesheets/fontawesome6/_rotated-flipped.scss +31 -0
- package/assets/stylesheets/fontawesome6/_screen-reader.scss +14 -0
- package/assets/stylesheets/{fontawesome5.15 → fontawesome6}/_shims.scss +625 -664
- package/assets/stylesheets/fontawesome6/_sizing.scss +16 -0
- package/assets/stylesheets/{fontawesome5.15 → fontawesome6}/_stacked.scss +5 -4
- package/assets/stylesheets/fontawesome6/_variables.scss +4885 -0
- package/assets/stylesheets/fontawesome6/brands.scss +30 -0
- package/assets/stylesheets/{fontawesome5.15 → fontawesome6}/fontawesome.scss +7 -2
- package/assets/stylesheets/fontawesome6/regular.scss +26 -0
- package/assets/stylesheets/fontawesome6/solid.scss +26 -0
- package/assets/stylesheets/fontawesome6/v4-shims.scss +11 -0
- package/element/al_file.js +104 -24
- package/helper/media_helper.js +7 -1
- package/package.json +3 -3
- package/view/element/al_file.hwk +16 -5
- package/assets/fonts/fontawesome5.15/fa-brands-400.eot +0 -0
- package/assets/fonts/fontawesome5.15/fa-brands-400.svg +0 -3717
- package/assets/fonts/fontawesome5.15/fa-brands-400.ttf +0 -0
- package/assets/fonts/fontawesome5.15/fa-brands-400.woff +0 -0
- package/assets/fonts/fontawesome5.15/fa-brands-400.woff2 +0 -0
- package/assets/fonts/fontawesome5.15/fa-regular-400.eot +0 -0
- package/assets/fonts/fontawesome5.15/fa-regular-400.svg +0 -801
- package/assets/fonts/fontawesome5.15/fa-regular-400.ttf +0 -0
- package/assets/fonts/fontawesome5.15/fa-regular-400.woff +0 -0
- package/assets/fonts/fontawesome5.15/fa-regular-400.woff2 +0 -0
- package/assets/fonts/fontawesome5.15/fa-solid-900.eot +0 -0
- package/assets/fonts/fontawesome5.15/fa-solid-900.svg +0 -5028
- package/assets/fonts/fontawesome5.15/fa-solid-900.ttf +0 -0
- package/assets/fonts/fontawesome5.15/fa-solid-900.woff +0 -0
- package/assets/fonts/fontawesome5.15/fa-solid-900.woff2 +0 -0
- package/assets/stylesheets/fontawesome5.15/_animated.scss +0 -20
- package/assets/stylesheets/fontawesome5.15/_bordered-pulled.scss +0 -20
- package/assets/stylesheets/fontawesome5.15/_core.scss +0 -21
- package/assets/stylesheets/fontawesome5.15/_icons.scss +0 -1462
- package/assets/stylesheets/fontawesome5.15/_larger.scss +0 -23
- package/assets/stylesheets/fontawesome5.15/_mixins.scss +0 -56
- package/assets/stylesheets/fontawesome5.15/_rotated-flipped.scss +0 -24
- package/assets/stylesheets/fontawesome5.15/_screen-reader.scss +0 -5
- package/assets/stylesheets/fontawesome5.15/_variables.scss +0 -1479
- package/assets/stylesheets/fontawesome5.15/brands.scss +0 -23
- package/assets/stylesheets/fontawesome5.15/regular.scss +0 -23
- package/assets/stylesheets/fontawesome5.15/solid.scss +0 -24
- package/assets/stylesheets/fontawesome5.15/v4-shims.scss +0 -6
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
3
|
+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
|
+
* Copyright 2022 Fonticons, Inc.
|
|
5
|
+
*/
|
|
6
|
+
@import 'functions';
|
|
7
|
+
@import 'variables';
|
|
8
|
+
|
|
9
|
+
:root, :host {
|
|
10
|
+
--#{$fa-css-prefix}-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: 'Font Awesome 6 Brands';
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
font-display: $fa-font-display;
|
|
18
|
+
src: url('#{$fa-font-path}/fa-brands-400.woff2') format('woff2'),
|
|
19
|
+
url('#{$fa-font-path}/fa-brands-400.ttf') format('truetype');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.fab,
|
|
23
|
+
.#{$fa-css-prefix}-brands {
|
|
24
|
+
font-family: 'Font Awesome 6 Brands';
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@each $name, $icon in $fa-brand-icons {
|
|
29
|
+
.#{$fa-css-prefix}-#{$name}:before { content: unquote("\"#{ $icon }\""); }
|
|
30
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Font Awesome Free
|
|
2
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
3
3
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
|
+
* Copyright 2022 Fonticons, Inc.
|
|
4
5
|
*/
|
|
6
|
+
// Font Awesome core compile (Web Fonts-based)
|
|
7
|
+
// -------------------------
|
|
8
|
+
|
|
9
|
+
@import 'functions';
|
|
5
10
|
@import 'variables';
|
|
6
11
|
@import 'mixins';
|
|
7
12
|
@import 'core';
|
|
8
|
-
@import '
|
|
13
|
+
@import 'sizing';
|
|
9
14
|
@import 'fixed-width';
|
|
10
15
|
@import 'list';
|
|
11
16
|
@import 'bordered-pulled';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
3
|
+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
|
+
* Copyright 2022 Fonticons, Inc.
|
|
5
|
+
*/
|
|
6
|
+
@import 'functions';
|
|
7
|
+
@import 'variables';
|
|
8
|
+
|
|
9
|
+
:root, :host {
|
|
10
|
+
--#{$fa-css-prefix}-font-regular: normal 400 1em/1 "#{ $fa-style-family }";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: 'Font Awesome 6 Free';
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
font-display: $fa-font-display;
|
|
18
|
+
src: url('#{$fa-font-path}/fa-regular-400.woff2') format('woff2'),
|
|
19
|
+
url('#{$fa-font-path}/fa-regular-400.ttf') format('truetype');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.far,
|
|
23
|
+
.#{$fa-css-prefix}-regular {
|
|
24
|
+
font-family: 'Font Awesome 6 Free';
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
3
|
+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
|
+
* Copyright 2022 Fonticons, Inc.
|
|
5
|
+
*/
|
|
6
|
+
@import 'functions';
|
|
7
|
+
@import 'variables';
|
|
8
|
+
|
|
9
|
+
:root, :host {
|
|
10
|
+
--#{$fa-css-prefix}-font-solid: normal 900 1em/1 "#{ $fa-style-family }";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: 'Font Awesome 6 Free';
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 900;
|
|
17
|
+
font-display: $fa-font-display;
|
|
18
|
+
src: url('#{$fa-font-path}/fa-solid-900.woff2') format('woff2'),
|
|
19
|
+
url('#{$fa-font-path}/fa-solid-900.ttf') format('truetype');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.fas,
|
|
23
|
+
.#{$fa-css-prefix}-solid {
|
|
24
|
+
font-family: 'Font Awesome 6 Free';
|
|
25
|
+
font-weight: 900;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
3
|
+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
4
|
+
* Copyright 2022 Fonticons, Inc.
|
|
5
|
+
*/
|
|
6
|
+
// V4 shims compile (Web Fonts-based)
|
|
7
|
+
// -------------------------
|
|
8
|
+
|
|
9
|
+
@import 'functions';
|
|
10
|
+
@import 'variables';
|
|
11
|
+
@import 'shims';
|
package/element/al_file.js
CHANGED
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
* @since 0.6.0
|
|
6
6
|
* @version 0.6.0
|
|
7
7
|
*/
|
|
8
|
-
const AlFile = Function.inherits('Alchemy.Element.App',
|
|
9
|
-
return AlFile.super.call(this);
|
|
10
|
-
});
|
|
8
|
+
const AlFile = Function.inherits('Alchemy.Element.App', 'AlFile');
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* The template code
|
|
@@ -28,13 +26,13 @@ AlFile.setTemplateFile('element/al_file');
|
|
|
28
26
|
AlFile.setStylesheetFile('element/alchemy_file');
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
|
-
* Getter for the
|
|
29
|
+
* Getter for the drop target
|
|
32
30
|
*
|
|
33
31
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
34
|
-
* @since 0.2
|
|
35
|
-
* @version 0.2
|
|
32
|
+
* @since 0.6.2
|
|
33
|
+
* @version 0.6.2
|
|
36
34
|
*/
|
|
37
|
-
AlFile.addElementGetter('
|
|
35
|
+
AlFile.addElementGetter('drop_target', '.al-file-drop-target');
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
38
|
* Getter for the file input
|
|
@@ -54,14 +52,54 @@ AlFile.addElementGetter('file_input', '.al-file-input');
|
|
|
54
52
|
*/
|
|
55
53
|
AlFile.addElementGetter('preview_element', '.al-file-preview');
|
|
56
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Getter for the remove button
|
|
57
|
+
*
|
|
58
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
59
|
+
* @since 0.6.2
|
|
60
|
+
* @version 0.6.2
|
|
61
|
+
*/
|
|
62
|
+
AlFile.addElementGetter('remove_button', '.al-file-remove');
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Getter for the uploading-icon
|
|
66
|
+
*
|
|
67
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
68
|
+
* @since 0.6.2
|
|
69
|
+
* @version 0.6.2
|
|
70
|
+
*/
|
|
71
|
+
AlFile.addElementGetter('icon_uploading', '.uploading-icon');
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Getter for the empty-icon
|
|
75
|
+
*
|
|
76
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
77
|
+
* @since 0.6.2
|
|
78
|
+
* @version 0.6.2
|
|
79
|
+
*/
|
|
80
|
+
AlFile.addElementGetter('icon_empty', '.empty-icon');
|
|
81
|
+
|
|
57
82
|
/**
|
|
58
83
|
* Set the value
|
|
59
84
|
*
|
|
60
85
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
61
86
|
* @since 0.6.0
|
|
62
|
-
* @version 0.6.
|
|
87
|
+
* @version 0.6.2
|
|
63
88
|
*/
|
|
64
89
|
AlFile.setAttribute('value', null, function setValue(value) {
|
|
90
|
+
|
|
91
|
+
if (value == null) {
|
|
92
|
+
value = '';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (this.remove_button) {
|
|
96
|
+
this.remove_button.hidden = !value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (this.icon_empty) {
|
|
100
|
+
this.icon_empty.hidden = !!value;
|
|
101
|
+
}
|
|
102
|
+
|
|
65
103
|
this.updatePreview(value);
|
|
66
104
|
return value;
|
|
67
105
|
});
|
|
@@ -97,15 +135,15 @@ AlFile.setMethod(function updatePreview(value) {
|
|
|
97
135
|
*
|
|
98
136
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
99
137
|
* @since 0.6.0
|
|
100
|
-
* @version 0.6.
|
|
138
|
+
* @version 0.6.2
|
|
101
139
|
*/
|
|
102
140
|
AlFile.setMethod(async function uploadFile(config) {
|
|
103
141
|
|
|
104
|
-
const that = this;
|
|
105
|
-
|
|
106
142
|
let file = config.file,
|
|
107
143
|
filename = config.filename,
|
|
108
144
|
format = config.format;
|
|
145
|
+
|
|
146
|
+
this.classList.add('uploading');
|
|
109
147
|
|
|
110
148
|
let form_data = new FormData(),
|
|
111
149
|
url = this.dataset.uploadUrl;
|
|
@@ -121,10 +159,18 @@ AlFile.setMethod(async function uploadFile(config) {
|
|
|
121
159
|
form_data.append('format', format);
|
|
122
160
|
}
|
|
123
161
|
|
|
124
|
-
let response
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
162
|
+
let response;
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
response = await Blast.fetch({
|
|
166
|
+
url : url,
|
|
167
|
+
post : form_data,
|
|
168
|
+
});
|
|
169
|
+
} catch (err) {
|
|
170
|
+
console.error('Failed to upload file:', err);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.classList.remove('uploading');
|
|
128
174
|
|
|
129
175
|
if (!response || !response.files || !response.files[0]) {
|
|
130
176
|
return;
|
|
@@ -139,32 +185,66 @@ AlFile.setMethod(async function uploadFile(config) {
|
|
|
139
185
|
});
|
|
140
186
|
|
|
141
187
|
/**
|
|
142
|
-
*
|
|
188
|
+
* Added to the DOM for the first time
|
|
143
189
|
*
|
|
144
190
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
145
191
|
* @since 0.6.0
|
|
146
|
-
* @version 0.6.
|
|
192
|
+
* @version 0.6.2
|
|
147
193
|
*/
|
|
148
194
|
AlFile.setMethod(function introduced() {
|
|
149
195
|
|
|
150
196
|
const that = this;
|
|
151
197
|
|
|
152
|
-
this.
|
|
198
|
+
this.addEventListener('dragenter', e => {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
});
|
|
153
201
|
|
|
154
|
-
this.
|
|
202
|
+
this.addEventListener('dragover', e => {
|
|
203
|
+
this.classList.add('dropping');
|
|
155
204
|
e.preventDefault();
|
|
156
|
-
this.file_input.click();
|
|
157
205
|
});
|
|
158
206
|
|
|
159
|
-
this.
|
|
207
|
+
this.addEventListener('dragend', e => {
|
|
208
|
+
this.classList.remove('dropping');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
this.addEventListener('dragleave', e => {
|
|
212
|
+
this.classList.remove('dropping');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
this.addEventListener('drop', e => {
|
|
216
|
+
this.classList.remove('dropping');
|
|
217
|
+
this.classList.add('dropped');
|
|
160
218
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
|
|
221
|
+
let file = e.dataTransfer.files[0];
|
|
222
|
+
|
|
223
|
+
this.uploadFile({
|
|
224
|
+
file : file,
|
|
225
|
+
filename : file.name,
|
|
164
226
|
format : null,
|
|
165
227
|
});
|
|
166
228
|
});
|
|
167
229
|
|
|
230
|
+
this.updatePreview();
|
|
231
|
+
|
|
232
|
+
this.file_input.addEventListener('change', e => {
|
|
233
|
+
|
|
234
|
+
this.classList.remove('dropping');
|
|
235
|
+
this.classList.add('dropped');
|
|
236
|
+
|
|
237
|
+
this.uploadFile({
|
|
238
|
+
file : this.file_input.files[0],
|
|
239
|
+
filename : this.file_input.files[0].name,
|
|
240
|
+
format : null,
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
this.remove_button.addEventListener('click', e => {
|
|
245
|
+
this.value = null;
|
|
246
|
+
});
|
|
247
|
+
|
|
168
248
|
});
|
|
169
249
|
|
|
170
250
|
/**
|
package/helper/media_helper.js
CHANGED
|
@@ -93,7 +93,7 @@ Media.setStatic(function loadImagesBasedOnSize() {
|
|
|
93
93
|
*
|
|
94
94
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
95
95
|
* @since 0.5.0
|
|
96
|
-
* @version 0.
|
|
96
|
+
* @version 0.6.2
|
|
97
97
|
*
|
|
98
98
|
* @param {Element} element The element to apply to
|
|
99
99
|
* @param {String} image The image identifier
|
|
@@ -116,6 +116,12 @@ Media.setMethod(function applyDirective(element, image, options) {
|
|
|
116
116
|
options = {};
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
let variables = element[Hawkejs.VARIABLES];
|
|
120
|
+
|
|
121
|
+
if (!options.route) {
|
|
122
|
+
options.route = variables?.['media-route'];
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
if (width) {
|
|
120
126
|
if (width.indexOf('%') > -1) {
|
|
121
127
|
element.removeAttribute('width');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy-media",
|
|
3
3
|
"description": "The media plugin for Alchemy",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type" : "git",
|
|
7
7
|
"url" : "https://github.com/skerit/alchemy-media.git"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"veronica" : "~0.2.2"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"alchemymvc" : ">=1.
|
|
15
|
+
"alchemymvc" : ">=1.2.0"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node" : ">=
|
|
19
|
+
"node" : ">=14.0.0"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/view/element/al_file.hwk
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
<
|
|
2
|
-
<div class="al-file-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
</div>
|
|
1
|
+
<label class="al-file-drop-target">
|
|
2
|
+
<div class="al-file-preview"></div>
|
|
3
|
+
<al-ico class="uploading-icon fa-solid fa-spinner fa-spin-pulse"></al-ico>
|
|
4
|
+
<al-ico class="empty-icon fa-solid fa-file-arrow-up" hidden></al-ico>
|
|
6
5
|
<input type="file" tabindex="-1" class="al-file-input" hidden>
|
|
6
|
+
</label>
|
|
7
|
+
|
|
8
|
+
<div class="al-file-right">
|
|
9
|
+
<button class="al-file-choose-existing">
|
|
10
|
+
<al-ico class="fa-solid fa-file-image"></al-ico>
|
|
11
|
+
{%t "select-uploaded-file" %}
|
|
12
|
+
</button>
|
|
13
|
+
|
|
14
|
+
<button class="al-file-remove">
|
|
15
|
+
<al-ico class="fa-solid fa-trash-can"></al-ico>
|
|
16
|
+
{%t "remove-current-file" %}
|
|
17
|
+
</button>
|
|
7
18
|
</div>
|
|
Binary file
|