tosijs 1.0.10 → 1.1.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/blueprint-loader.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +18 -17
- package/dist/main.js +9 -9
- package/dist/main.js.map +18 -17
- package/dist/module.js +9 -9
- package/dist/module.js.map +18 -17
- package/dist/path-listener.d.ts +2 -2
- package/dist/registry.d.ts +14 -0
- package/dist/version.d.ts +1 -1
- package/dist/xin-types.d.ts +47 -2
- package/package.json +1 -1
package/dist/path-listener.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PathTestFunction, ObserverCallbackFunction } from './xin-types';
|
|
1
|
+
import { PathTestFunction, ObserverCallbackFunction, XinTouchableType } from './xin-types';
|
|
2
2
|
export declare const observerShouldBeRemoved: unique symbol;
|
|
3
3
|
export declare const listeners: Listener[];
|
|
4
4
|
export declare class Listener {
|
|
@@ -8,6 +8,6 @@ export declare class Listener {
|
|
|
8
8
|
constructor(test: string | RegExp | PathTestFunction, callback: string | ObserverCallbackFunction);
|
|
9
9
|
}
|
|
10
10
|
export declare const updates: () => Promise<void>;
|
|
11
|
-
export declare const touch: (touchable:
|
|
11
|
+
export declare const touch: (touchable: XinTouchableType) => void;
|
|
12
12
|
export declare const observe: (test: string | RegExp | PathTestFunction, callback: ObserverCallbackFunction) => Listener;
|
|
13
13
|
export declare const unobserve: (listener: Listener) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central registry for xin state.
|
|
3
|
+
* Extracted to break circular dependency between xin.ts and bind.ts.
|
|
4
|
+
*/
|
|
5
|
+
import { XinObject, XinProxy, XinBinding } from './xin-types';
|
|
6
|
+
export declare const registry: XinObject;
|
|
7
|
+
export declare const setXinProxy: (xin: XinProxy<XinObject>) => void;
|
|
8
|
+
export declare const getXinProxy: () => XinProxy<XinObject>;
|
|
9
|
+
type BindFunc = (element: Element, path: string, binding: XinBinding, options?: XinObject) => void;
|
|
10
|
+
type OnFunc = any;
|
|
11
|
+
export declare const setBindFunctions: (bind: BindFunc, on: OnFunc) => void;
|
|
12
|
+
export declare const getBind: () => BindFunc;
|
|
13
|
+
export declare const getOn: () => OnFunc;
|
|
14
|
+
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0
|
|
1
|
+
export declare const version = "1.1.0";
|
package/dist/xin-types.d.ts
CHANGED
|
@@ -25,11 +25,54 @@ type ListTemplateBuilder<U = any> = (elements: ElementsProxy, item: U) => HTMLEl
|
|
|
25
25
|
type ListBinding = [ElementProps, HTMLTemplateElement];
|
|
26
26
|
export interface BoxedArrayProps<U = any> {
|
|
27
27
|
tosiListBinding: (templateBuilder: ListTemplateBuilder<U>, options?: ListBindingOptions) => ListBinding;
|
|
28
|
+
listBinding: (templateBuilder: ListTemplateBuilder<U>, options?: ListBindingOptions) => ListBinding;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* BoxedScalar represents a boxed primitive value (string, number, boolean, null, undefined).
|
|
32
|
+
* It provides a clean API for accessing the value and path, and catches the common
|
|
33
|
+
* comparison trap where users write `proxy.x === 3` instead of `proxy.x.value === 3`.
|
|
34
|
+
*
|
|
35
|
+
* Note: Direct assignment like `proxy.x = 3` is a TypeScript type error due to
|
|
36
|
+
* fundamental limitations in TypeScript's mapped types (no asymmetric get/set).
|
|
37
|
+
* Use `proxy.x.value = 3` instead.
|
|
38
|
+
*/
|
|
39
|
+
export interface BoxedScalar<T> {
|
|
40
|
+
value: T;
|
|
41
|
+
path: string;
|
|
42
|
+
observe: (callback: ObserverCallbackFunction) => VoidFunction;
|
|
43
|
+
bind: <E extends Element = Element>(element: E, binding: XinBinding<E>, options?: XinObject) => void;
|
|
44
|
+
on: (element: HTMLElement, eventType: keyof HTMLElementEventMap) => VoidFunction;
|
|
45
|
+
binding: (binding: XinBinding) => {
|
|
46
|
+
bind: {
|
|
47
|
+
value: string;
|
|
48
|
+
binding: XinBinding;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
listBinding: (templateBuilder: ListTemplateBuilder<T>, options?: ListBindingOptions) => ListBinding;
|
|
52
|
+
valueOf: () => T;
|
|
53
|
+
toString: () => string;
|
|
54
|
+
toJSON: () => T;
|
|
55
|
+
xinValue: T;
|
|
56
|
+
xinPath: string;
|
|
57
|
+
tosiValue: T;
|
|
58
|
+
tosiPath: string;
|
|
59
|
+
xinObserve: (callback: ObserverCallbackFunction) => VoidFunction;
|
|
60
|
+
tosiObserve: (callback: ObserverCallbackFunction) => VoidFunction;
|
|
61
|
+
xinBind: <E extends Element = Element>(element: E, binding: XinBinding<E>, options?: XinObject) => void;
|
|
62
|
+
tosiBind: <E extends Element = Element>(element: E, binding: XinBinding<E>, options?: XinObject) => void;
|
|
63
|
+
xinOn: (element: HTMLElement, eventType: keyof HTMLElementEventMap) => VoidFunction;
|
|
64
|
+
tosiOn: (element: HTMLElement, eventType: keyof HTMLElementEventMap) => VoidFunction;
|
|
65
|
+
tosiBinding: (binding: XinBinding) => {
|
|
66
|
+
bind: {
|
|
67
|
+
value: string;
|
|
68
|
+
binding: XinBinding;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
28
71
|
}
|
|
29
72
|
export type BoxedProxy<T = any> = T extends Array<infer U> ? Array<BoxedProxy<U>> & XinProps<T> & BoxedArrayProps<U> : T extends Function ? T & XinProps<Function> : T extends object ? {
|
|
30
73
|
[K in keyof T]: BoxedProxy<T[K]>;
|
|
31
|
-
} & XinProps<T> : T extends string ?
|
|
32
|
-
export type Unboxed<T = any> = T extends String ? string : T extends Number ? number : T extends Boolean ? boolean : T;
|
|
74
|
+
} & XinProps<T> : T extends string ? BoxedScalar<string> : T extends number ? BoxedScalar<number> : T extends boolean ? BoxedScalar<boolean> : T extends undefined | null ? BoxedScalar<T> : T;
|
|
75
|
+
export type Unboxed<T = any> = T extends BoxedScalar<infer U> ? U : T extends String ? string : T extends Number ? number : T extends Boolean ? boolean : T;
|
|
33
76
|
export type XinProxy<T = any> = T extends Array<infer U> ? Array<XinProxy<U>> : T extends Function ? T : T extends object ? {
|
|
34
77
|
[K in keyof T]: T[K] extends object ? XinProxy<T[K]> : T[K];
|
|
35
78
|
} : T;
|
|
@@ -120,6 +163,8 @@ export interface ListBindingOptions {
|
|
|
120
163
|
width?: number;
|
|
121
164
|
visibleColumns?: number;
|
|
122
165
|
rowChunkSize?: number;
|
|
166
|
+
/** Use 'window' to virtualize based on window scroll position instead of element scroll */
|
|
167
|
+
scrollContainer?: 'window' | 'element';
|
|
123
168
|
};
|
|
124
169
|
hiddenProp?: symbol | string;
|
|
125
170
|
visibleProp?: symbol | string;
|