@framesquared/core 0.1.0 → 0.2.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/index.d.ts +8 -7
- package/dist/index.js +33 -53
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -923,7 +923,8 @@ declare const EventBus: EventBusImpl;
|
|
|
923
923
|
* }
|
|
924
924
|
* ```
|
|
925
925
|
*/
|
|
926
|
-
|
|
926
|
+
interface EventMap {
|
|
927
|
+
}
|
|
927
928
|
/**
|
|
928
929
|
* Overlay interface that narrows Observable's string-based API to a
|
|
929
930
|
* concrete event map `Events`.
|
|
@@ -931,10 +932,10 @@ type EventMap = {};
|
|
|
931
932
|
interface TypedObservable<Events extends {
|
|
932
933
|
[K in keyof Events]: unknown[];
|
|
933
934
|
}> {
|
|
934
|
-
on<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) =>
|
|
935
|
-
un<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) =>
|
|
936
|
-
addListener<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) =>
|
|
937
|
-
removeListener<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) =>
|
|
935
|
+
on<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) => false | undefined, scope?: object, options?: ListenerOptions): Destroyable | void;
|
|
936
|
+
un<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) => false | undefined, scope?: object): void;
|
|
937
|
+
addListener<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) => false | undefined, scope?: object, options?: ListenerOptions): Destroyable | void;
|
|
938
|
+
removeListener<E extends keyof Events & string>(eventName: E, handler: (...args: Events[E]) => false | undefined, scope?: object): void;
|
|
938
939
|
fireEvent<E extends keyof Events & string>(eventName: E, ...args: Events[E]): boolean;
|
|
939
940
|
fireEventArgs<E extends keyof Events & string>(eventName: E, args: Events[E]): boolean;
|
|
940
941
|
hasListener<E extends keyof Events & string>(eventName: E): boolean;
|
|
@@ -1172,8 +1173,8 @@ declare const LocaleManager: {
|
|
|
1172
1173
|
getLocale(): Locale | null;
|
|
1173
1174
|
t(key: string, params?: Record<string, unknown>): string;
|
|
1174
1175
|
getDirection(): "ltr" | "rtl";
|
|
1175
|
-
on(event: string, fn:
|
|
1176
|
-
off(event: string, fn:
|
|
1176
|
+
on(event: string, fn: (...args: any[]) => void): void;
|
|
1177
|
+
off(event: string, fn: (...args: any[]) => void): void;
|
|
1177
1178
|
reset(): void;
|
|
1178
1179
|
};
|
|
1179
1180
|
|
package/dist/index.js
CHANGED
|
@@ -607,7 +607,7 @@ function processClassConfigs(Ctor) {
|
|
|
607
607
|
}
|
|
608
608
|
const merged = {};
|
|
609
609
|
for (const cls of chain) {
|
|
610
|
-
if (
|
|
610
|
+
if (Object.prototype.hasOwnProperty.call(cls, "$configDefs")) {
|
|
611
611
|
Object.assign(merged, cls.$configDefs);
|
|
612
612
|
}
|
|
613
613
|
}
|
|
@@ -782,13 +782,7 @@ var Base = class {
|
|
|
782
782
|
};
|
|
783
783
|
|
|
784
784
|
// src/class/ClassManager.ts
|
|
785
|
-
var RESERVED_DEF_KEYS = /* @__PURE__ */ new Set([
|
|
786
|
-
"extend",
|
|
787
|
-
"mixins",
|
|
788
|
-
"alias",
|
|
789
|
-
"config",
|
|
790
|
-
"statics"
|
|
791
|
-
]);
|
|
785
|
+
var RESERVED_DEF_KEYS = /* @__PURE__ */ new Set(["extend", "mixins", "alias", "config", "statics"]);
|
|
792
786
|
var ClassManagerImpl = class {
|
|
793
787
|
/** className → constructor */
|
|
794
788
|
classes = /* @__PURE__ */ new Map();
|
|
@@ -866,9 +860,6 @@ function applyMixins(targetClass, mixins) {
|
|
|
866
860
|
function define(className, definition) {
|
|
867
861
|
const SuperClass = definition.extend || Base;
|
|
868
862
|
const NewClass = class extends SuperClass {
|
|
869
|
-
constructor(...args) {
|
|
870
|
-
super(...args);
|
|
871
|
-
}
|
|
872
863
|
};
|
|
873
864
|
NewClass.$className = className;
|
|
874
865
|
if (definition.config) {
|
|
@@ -1005,9 +996,7 @@ function createConfigDecorator(metaOverrides = {}) {
|
|
|
1005
996
|
const cap = capitalize(name);
|
|
1006
997
|
const applyName = `apply${cap}`;
|
|
1007
998
|
const updateName = `update${cap}`;
|
|
1008
|
-
const metaMap = getOrCreateMetaMap(
|
|
1009
|
-
context.metadata
|
|
1010
|
-
);
|
|
999
|
+
const metaMap = getOrCreateMetaMap(context.metadata);
|
|
1011
1000
|
let meta = metaMap.get(name);
|
|
1012
1001
|
if (!meta) {
|
|
1013
1002
|
meta = {
|
|
@@ -1026,7 +1015,7 @@ function createConfigDecorator(metaOverrides = {}) {
|
|
|
1026
1015
|
ensureAccessors(Ctor, name);
|
|
1027
1016
|
if (inst.$pendingConfig && name in inst.$pendingConfig) {
|
|
1028
1017
|
inst[name] = inst.$pendingConfig[name];
|
|
1029
|
-
|
|
1018
|
+
Reflect.deleteProperty(inst.$pendingConfig, name);
|
|
1030
1019
|
inst.$configInitialized?.add(name);
|
|
1031
1020
|
}
|
|
1032
1021
|
if (meta.required && !inst.$configInitialized?.has(name)) {
|
|
@@ -1087,22 +1076,17 @@ function createConfigDecorator(metaOverrides = {}) {
|
|
|
1087
1076
|
return { init: initFn, get: getFn, set: setFn };
|
|
1088
1077
|
};
|
|
1089
1078
|
}
|
|
1090
|
-
var config = Object.assign(
|
|
1091
|
-
createConfigDecorator(),
|
|
1092
|
-
{
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
merge: createConfigDecorator({ merge: true })
|
|
1099
|
-
}
|
|
1100
|
-
);
|
|
1079
|
+
var config = Object.assign(createConfigDecorator(), {
|
|
1080
|
+
required: createConfigDecorator({ required: true }),
|
|
1081
|
+
lazy(factory) {
|
|
1082
|
+
return createConfigDecorator({ lazyFactory: factory });
|
|
1083
|
+
},
|
|
1084
|
+
cached: createConfigDecorator({ cached: true }),
|
|
1085
|
+
merge: createConfigDecorator({ merge: true })
|
|
1086
|
+
});
|
|
1101
1087
|
function observable(_target, context) {
|
|
1102
1088
|
const name = String(context.name);
|
|
1103
|
-
const metaMap = getOrCreateMetaMap(
|
|
1104
|
-
context.metadata
|
|
1105
|
-
);
|
|
1089
|
+
const metaMap = getOrCreateMetaMap(context.metadata);
|
|
1106
1090
|
let meta = metaMap.get(name);
|
|
1107
1091
|
if (!meta) {
|
|
1108
1092
|
meta = {
|
|
@@ -1588,9 +1572,7 @@ function removeEntry(list, entry) {
|
|
|
1588
1572
|
if (idx !== -1) list.splice(idx, 1);
|
|
1589
1573
|
}
|
|
1590
1574
|
function findEntry(list, fn, scope) {
|
|
1591
|
-
return list.find(
|
|
1592
|
-
(e) => e.fn === fn && e.scope === scope
|
|
1593
|
-
);
|
|
1575
|
+
return list.find((e) => e.fn === fn && e.scope === scope);
|
|
1594
1576
|
}
|
|
1595
1577
|
var Observable = define("Ext.mixin.Observable", {
|
|
1596
1578
|
// ----- on (with overloads) -----
|
|
@@ -1635,6 +1617,7 @@ var Observable = define("Ext.mixin.Observable", {
|
|
|
1635
1617
|
if (entry) removeEntry(list, entry);
|
|
1636
1618
|
},
|
|
1637
1619
|
// ----- aliases -----
|
|
1620
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
1638
1621
|
addListener(...args) {
|
|
1639
1622
|
return this.on(...args);
|
|
1640
1623
|
},
|
|
@@ -1912,9 +1895,7 @@ var EventBusImpl = class {
|
|
|
1912
1895
|
* Removes a specific subscription by handler reference.
|
|
1913
1896
|
*/
|
|
1914
1897
|
unsubscribe(channel, handler) {
|
|
1915
|
-
const idx = this.subscriptions.findIndex(
|
|
1916
|
-
(s) => s.pattern === channel && s.handler === handler
|
|
1917
|
-
);
|
|
1898
|
+
const idx = this.subscriptions.findIndex((s) => s.pattern === channel && s.handler === handler);
|
|
1918
1899
|
if (idx !== -1) this.subscriptions.splice(idx, 1);
|
|
1919
1900
|
}
|
|
1920
1901
|
};
|
|
@@ -2030,11 +2011,13 @@ function angle(x1, y1, x2, y2) {
|
|
|
2030
2011
|
return Math.atan2(y2 - y1, x2 - x1) * (180 / Math.PI);
|
|
2031
2012
|
}
|
|
2032
2013
|
function dispatchGesture(el, name, detail) {
|
|
2033
|
-
el.dispatchEvent(
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2014
|
+
el.dispatchEvent(
|
|
2015
|
+
new CustomEvent(name, {
|
|
2016
|
+
bubbles: true,
|
|
2017
|
+
cancelable: true,
|
|
2018
|
+
detail: detail ?? {}
|
|
2019
|
+
})
|
|
2020
|
+
);
|
|
2038
2021
|
}
|
|
2039
2022
|
var GestureRecognizer = class {
|
|
2040
2023
|
el;
|
|
@@ -2202,12 +2185,7 @@ var GestureRecognizer = class {
|
|
|
2202
2185
|
pts[1].currentX,
|
|
2203
2186
|
pts[1].currentY
|
|
2204
2187
|
);
|
|
2205
|
-
const currentAngle = angle(
|
|
2206
|
-
pts[0].currentX,
|
|
2207
|
-
pts[0].currentY,
|
|
2208
|
-
pts[1].currentX,
|
|
2209
|
-
pts[1].currentY
|
|
2210
|
-
);
|
|
2188
|
+
const currentAngle = angle(pts[0].currentX, pts[0].currentY, pts[1].currentX, pts[1].currentY);
|
|
2211
2189
|
if (this.initialPinchDistance > 0) {
|
|
2212
2190
|
const scale = currentDist / this.initialPinchDistance;
|
|
2213
2191
|
dispatchGesture(this.el, "pinch", {
|
|
@@ -2355,7 +2333,7 @@ var AriaManager = {
|
|
|
2355
2333
|
descEl.id = id;
|
|
2356
2334
|
descEl.textContent = description;
|
|
2357
2335
|
descEl.style.cssText = "position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);";
|
|
2358
|
-
element.parentNode
|
|
2336
|
+
(element.parentNode ?? document.body).appendChild(descEl);
|
|
2359
2337
|
element.setAttribute("aria-describedby", id);
|
|
2360
2338
|
},
|
|
2361
2339
|
setLive(element, mode) {
|
|
@@ -2588,9 +2566,11 @@ var LocaleManager = {
|
|
|
2588
2566
|
getDirection() {
|
|
2589
2567
|
return activeLocale?.getDirection() ?? "ltr";
|
|
2590
2568
|
},
|
|
2569
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2591
2570
|
on(event, fn) {
|
|
2592
2571
|
(listeners[event] ??= []).push(fn);
|
|
2593
2572
|
},
|
|
2573
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2594
2574
|
off(event, fn) {
|
|
2595
2575
|
const list = listeners[event];
|
|
2596
2576
|
if (!list) return;
|
|
@@ -2668,8 +2648,8 @@ var enUS = new Locale({
|
|
|
2668
2648
|
"messagebox.confirm.title": "Confirm",
|
|
2669
2649
|
"messagebox.prompt.title": "Prompt",
|
|
2670
2650
|
// Misc
|
|
2671
|
-
|
|
2672
|
-
|
|
2651
|
+
loading: "Loading...",
|
|
2652
|
+
error: "Error"
|
|
2673
2653
|
}
|
|
2674
2654
|
});
|
|
2675
2655
|
|
|
@@ -2727,8 +2707,8 @@ var esES = new Locale({
|
|
|
2727
2707
|
"messagebox.alert.title": "Alerta",
|
|
2728
2708
|
"messagebox.confirm.title": "Confirmar",
|
|
2729
2709
|
"messagebox.prompt.title": "Aviso",
|
|
2730
|
-
|
|
2731
|
-
|
|
2710
|
+
loading: "Cargando...",
|
|
2711
|
+
error: "Error"
|
|
2732
2712
|
}
|
|
2733
2713
|
});
|
|
2734
2714
|
|
|
@@ -2786,8 +2766,8 @@ var arSA = new Locale({
|
|
|
2786
2766
|
"messagebox.alert.title": "\u062A\u0646\u0628\u064A\u0647",
|
|
2787
2767
|
"messagebox.confirm.title": "\u062A\u0623\u0643\u064A\u062F",
|
|
2788
2768
|
"messagebox.prompt.title": "\u0625\u062F\u062E\u0627\u0644",
|
|
2789
|
-
|
|
2790
|
-
|
|
2769
|
+
loading: "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644...",
|
|
2770
|
+
error: "\u062E\u0637\u0623"
|
|
2791
2771
|
}
|
|
2792
2772
|
});
|
|
2793
2773
|
|