native-document 1.0.255 → 1.0.257
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.257",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,6 +46,8 @@ export default function Toast(content, props = {}) {
|
|
|
46
46
|
props,
|
|
47
47
|
};
|
|
48
48
|
this.aria = { 'role': 'status', 'aria-live': 'polite' };
|
|
49
|
+
|
|
50
|
+
queueMicrotask(() => this.show());
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
BaseComponent.extends(Toast);
|
|
@@ -260,4 +262,9 @@ Toast.prototype.onClose = function(handler) {
|
|
|
260
262
|
return this;
|
|
261
263
|
};
|
|
262
264
|
|
|
265
|
+
Toast.error = (content, props = {}) => Toast(content, props).error();
|
|
266
|
+
Toast.success = (content, props = {}) => Toast(content, props).success();
|
|
267
|
+
Toast.warning = (content, props = {}) => Toast(content, props).warning();
|
|
268
|
+
Toast.info = (content, props = {}) => Toast(content, props).info();
|
|
269
|
+
|
|
263
270
|
Toast.prototype.show = BaseComponent.prototype.toNdElement;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ObservableItem from './ObservableItem';
|
|
2
|
+
import {ObservableObject} from './ObservableObject';
|
|
2
3
|
import {debounce} from '../utils/helpers';
|
|
3
4
|
|
|
4
5
|
const STATE = {
|
|
@@ -39,7 +40,7 @@ export default function ObservableResource(fn, deps, config) {
|
|
|
39
40
|
this.$controller = null;
|
|
40
41
|
this.$subscriptions = [];
|
|
41
42
|
|
|
42
|
-
this.data = config.into ?? new
|
|
43
|
+
this.data = config.into ?? new ObservableObject({});
|
|
43
44
|
this.error = new ObservableItem(null);
|
|
44
45
|
this.state = new ObservableItem(STATE.UNRESOLVED);
|
|
45
46
|
|
|
@@ -65,6 +66,10 @@ ObservableResource.prototype.$applyResult = function(result) {
|
|
|
65
66
|
this.$config.apply(result, this.data);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
69
|
+
if(result?.__$Observable) {
|
|
70
|
+
this.data = result;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
68
73
|
this.data.set(result);
|
|
69
74
|
};
|
|
70
75
|
|
|
@@ -300,10 +305,8 @@ ObservableResource.prototype.isUnresolved = function() {
|
|
|
300
305
|
* resource.onSuccess((data) => console.log('Loaded:', data));
|
|
301
306
|
*/
|
|
302
307
|
ObservableResource.prototype.onSuccess = function(callback) {
|
|
303
|
-
this.
|
|
304
|
-
|
|
305
|
-
callback(value);
|
|
306
|
-
}
|
|
308
|
+
this.state.on(STATE.READY, () => {
|
|
309
|
+
callback(this.data.val());
|
|
307
310
|
});
|
|
308
311
|
return this;
|
|
309
312
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--drawer-z-index: 1000;
|
|
3
3
|
--drawer-background-color: white;
|
|
4
|
-
--drawer-width:
|
|
4
|
+
--drawer-width: 500px;
|
|
5
5
|
--drawer-backdrop-color: rgba(0, 0, 0, var(--opacity-backdrop));
|
|
6
6
|
--drawer-panel-backdrop-color: hsl(from var(--gray-lite-1) h s l / .5);
|
|
7
7
|
--drawer-panel-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
|
@@ -21,6 +21,7 @@ export const formatSize = (bytes) => {
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
export const getFileThumbnail = (file, fieldInstance) => {
|
|
24
|
+
file = file?.__$Observable ? file.val() : file;
|
|
24
25
|
const isImage = file.type?.startsWith('image/') || !!file.url;
|
|
25
26
|
const url = file.url ?? URL.createObjectURL(file);
|
|
26
27
|
if(isImage) {
|