revojs 0.0.59 → 0.0.60
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/index.js
CHANGED
|
@@ -111,7 +111,7 @@ var Scope = class extends EventTarget {
|
|
|
111
111
|
context;
|
|
112
112
|
constructor(parentScope) {
|
|
113
113
|
super();
|
|
114
|
-
this.context = new Map();
|
|
114
|
+
this.context = /* @__PURE__ */ new Map();
|
|
115
115
|
this.setParentScope(parentScope);
|
|
116
116
|
}
|
|
117
117
|
getParentScope() {
|
|
@@ -123,7 +123,7 @@ var Scope = class extends EventTarget {
|
|
|
123
123
|
}
|
|
124
124
|
getContext(input) {
|
|
125
125
|
let scope = this;
|
|
126
|
-
const seen = new Set();
|
|
126
|
+
const seen = /* @__PURE__ */ new Set();
|
|
127
127
|
while (scope && !seen.has(scope)) {
|
|
128
128
|
seen.add(scope);
|
|
129
129
|
if (scope.context.has(input)) return scope.context.get(input);
|
|
@@ -156,8 +156,8 @@ var Handler = class Handler {
|
|
|
156
156
|
get(target, key) {
|
|
157
157
|
const compute = activeCompute;
|
|
158
158
|
if (compute) {
|
|
159
|
-
const computes = targets.get(target) ?? new Map();
|
|
160
|
-
const set = computes.get(key) ?? new Set();
|
|
159
|
+
const computes = targets.get(target) ?? /* @__PURE__ */ new Map();
|
|
160
|
+
const set = computes.get(key) ?? /* @__PURE__ */ new Set();
|
|
161
161
|
computes.set(key, set.add(compute));
|
|
162
162
|
targets.set(target, computes);
|
|
163
163
|
compute.getParentScope()?.onStop(() => set.delete(compute));
|
|
@@ -208,7 +208,7 @@ function defineContext(key) {
|
|
|
208
208
|
return key;
|
|
209
209
|
}
|
|
210
210
|
let activeCompute;
|
|
211
|
-
const targets = new WeakMap();
|
|
211
|
+
const targets = /* @__PURE__ */ new WeakMap();
|
|
212
212
|
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region src/html/index.ts
|
|
@@ -485,7 +485,7 @@ const isServer = () => typeof window === "undefined";
|
|
|
485
485
|
const preventDefault = (event) => event.preventDefault();
|
|
486
486
|
const stopPropagation = (event) => event.stopPropagation();
|
|
487
487
|
const stopImmediatePropagation = (event) => event.stopImmediatePropagation();
|
|
488
|
-
const components = new Map();
|
|
488
|
+
const components = /* @__PURE__ */ new Map();
|
|
489
489
|
const HOST_CONTEXT = defineContext("HOST_CONTEXT");
|
|
490
490
|
|
|
491
491
|
//#endregion
|
|
@@ -859,10 +859,15 @@ const useLocale = (scope, context) => {
|
|
|
859
859
|
const $ = (key) => {
|
|
860
860
|
return () => messages.value?.[key] ?? key;
|
|
861
861
|
};
|
|
862
|
+
const date = (date$1, options) => {
|
|
863
|
+
const format = new Intl.DateTimeFormat(locale.value, options);
|
|
864
|
+
if (date$1) return format.format(date$1);
|
|
865
|
+
};
|
|
862
866
|
return {
|
|
863
867
|
locale,
|
|
864
868
|
messages,
|
|
865
|
-
|
|
869
|
+
$,
|
|
870
|
+
date
|
|
866
871
|
};
|
|
867
872
|
};
|
|
868
873
|
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -17,10 +17,12 @@ export declare const createLocale: <T extends LocaleOptions>(options: T) => {
|
|
|
17
17
|
locale: State<string | undefined>;
|
|
18
18
|
messages: State<Record<string, string> | undefined>;
|
|
19
19
|
$: (key: never) => () => string | number | symbol;
|
|
20
|
+
date: (date?: Date, options?: Intl.DateTimeFormatOptions) => string | undefined;
|
|
20
21
|
}>;
|
|
21
22
|
};
|
|
22
23
|
export declare const useLocale: <T extends LocaleContext>(scope: Scope, context?: Descriptor<T>) => {
|
|
23
24
|
locale: State<string | undefined>;
|
|
24
25
|
messages: State<Record<string, string> | undefined>;
|
|
25
26
|
$: (key: keyof T["options"]["locales"][keyof T["options"]["locales"]]) => () => string | number | symbol;
|
|
27
|
+
date: (date?: Date, options?: Intl.DateTimeFormatOptions) => string | undefined;
|
|
26
28
|
};
|
package/dist/presets/bun.js
CHANGED
|
@@ -9,7 +9,7 @@ var Scope = class extends EventTarget {
|
|
|
9
9
|
context;
|
|
10
10
|
constructor(parentScope) {
|
|
11
11
|
super();
|
|
12
|
-
this.context = new Map();
|
|
12
|
+
this.context = /* @__PURE__ */ new Map();
|
|
13
13
|
this.setParentScope(parentScope);
|
|
14
14
|
}
|
|
15
15
|
getParentScope() {
|
|
@@ -21,7 +21,7 @@ var Scope = class extends EventTarget {
|
|
|
21
21
|
}
|
|
22
22
|
getContext(input) {
|
|
23
23
|
let scope = this;
|
|
24
|
-
const seen = new Set();
|
|
24
|
+
const seen = /* @__PURE__ */ new Set();
|
|
25
25
|
while (scope && !seen.has(scope)) {
|
|
26
26
|
seen.add(scope);
|
|
27
27
|
if (scope.context.has(input)) return scope.context.get(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "revojs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "coverbase/revojs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@revojs/tsconfig": "*",
|
|
43
43
|
"@revojs/rolldown": "*",
|
|
44
|
-
"@types/bun": "^1.2.
|
|
45
|
-
"rolldown": "^1.0.0-beta.
|
|
44
|
+
"@types/bun": "^1.2.17",
|
|
45
|
+
"rolldown": "^1.0.0-beta.19"
|
|
46
46
|
}
|
|
47
47
|
}
|