crelte 0.5.0-alpha.2 → 0.5.0-alpha.4
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/init/svelteComponents.js +1 -1
- package/dist/init/{crelte-vite-plugin.d.ts → virtualSvelteComponents.d.ts} +1 -1
- package/dist/loadData/Globals.d.ts.map +1 -1
- package/dist/loadData/Globals.js +4 -8
- package/package.json +1 -1
- package/src/init/svelteComponents.ts +1 -1
- package/src/init/{crelte-vite-plugin.d.ts → virtualSvelteComponents.d.ts} +1 -1
- package/src/loadData/Globals.ts +3 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { internalSvelteMount, internalSvelteRender, } from 'crelte
|
|
1
|
+
import { internalSvelteMount, internalSvelteRender, } from 'virtual:crelte/svelteComponents';
|
|
2
2
|
export function svelteMount(comp, options) {
|
|
3
3
|
return internalSvelteMount(comp, options);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module 'crelte
|
|
1
|
+
declare module 'virtual:crelte/svelteComponents' {
|
|
2
2
|
// Declarations for the internal functions imported from the plugin
|
|
3
3
|
export function internalSvelteMount(comp: any, options: any): any;
|
|
4
4
|
export function internalSvelteRender(comp: any, options: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Globals.d.ts","sourceRoot":"","sources":["../../src/loadData/Globals.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAK3B,OAAO,CAAC,OAAO,CAAyC;IAIxD,OAAO,CAAC,OAAO,CAA0B;IAGzC,OAAO,CAAC,MAAM,CAA6B;gBAE/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adData/Globals.js
CHANGED
|
@@ -42,13 +42,9 @@ export default class Globals {
|
|
|
42
42
|
get(name) {
|
|
43
43
|
if (this.waiters)
|
|
44
44
|
throw new Error('calling get in loadGlobalData will not work. call getAsync');
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// isn't it just a footgun?
|
|
49
|
-
// return this.getStore(name)?.get() ?? null;
|
|
50
|
-
}
|
|
51
|
-
return this.newData.get(name) ?? null;
|
|
45
|
+
if (this.newData)
|
|
46
|
+
return this.newData.get(name) ?? null;
|
|
47
|
+
return this.getStore(name)?.get() ?? null;
|
|
52
48
|
}
|
|
53
49
|
/**
|
|
54
50
|
* returns a store which contains a globalSet
|
|
@@ -72,7 +68,7 @@ export default class Globals {
|
|
|
72
68
|
if (this.newData)
|
|
73
69
|
return this.newData.get(name) ?? null;
|
|
74
70
|
if (!this.waiters)
|
|
75
|
-
|
|
71
|
+
return this.stores.get(name)?.get() ?? null;
|
|
76
72
|
let listeners = this.waiters.get(name);
|
|
77
73
|
if (!listeners) {
|
|
78
74
|
listeners = [];
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module 'crelte
|
|
1
|
+
declare module 'virtual:crelte/svelteComponents' {
|
|
2
2
|
// Declarations for the internal functions imported from the plugin
|
|
3
3
|
export function internalSvelteMount(comp: any, options: any): any;
|
|
4
4
|
export function internalSvelteRender(comp: any, options: any): any;
|
package/src/loadData/Globals.ts
CHANGED
|
@@ -53,17 +53,9 @@ export default class Globals {
|
|
|
53
53
|
'calling get in loadGlobalData will not work. call getAsync',
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
if (
|
|
57
|
-
throw new Error(
|
|
58
|
-
'calling get outside of a loadData is forbidden. use getStore',
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// todo do we wan't to allow this?
|
|
62
|
-
// isn't it just a footgun?
|
|
63
|
-
// return this.getStore(name)?.get() ?? null;
|
|
64
|
-
}
|
|
56
|
+
if (this.newData) return this.newData.get(name) ?? null;
|
|
65
57
|
|
|
66
|
-
return this.
|
|
58
|
+
return this.getStore(name)?.get() ?? null;
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
/**
|
|
@@ -88,10 +80,7 @@ export default class Globals {
|
|
|
88
80
|
getAsync<T = any>(name: string): Promise<T | null> | T | null {
|
|
89
81
|
if (this.newData) return this.newData.get(name) ?? null;
|
|
90
82
|
|
|
91
|
-
if (!this.waiters)
|
|
92
|
-
throw new Error(
|
|
93
|
-
'calling getAsync in non loadGlobalData contexts is pointless. Use getStore instead',
|
|
94
|
-
);
|
|
83
|
+
if (!this.waiters) return this.stores.get(name)?.get() ?? null;
|
|
95
84
|
|
|
96
85
|
let listeners = this.waiters.get(name);
|
|
97
86
|
if (!listeners) {
|