glass-easel-miniprogram-adapter 0.14.0 → 0.15.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/glass_easel_miniprogram_adapter.d.ts +5 -2
- package/package.json +4 -4
- package/src/component.ts +2 -0
- package/src/space.ts +7 -1
- package/tests/space.test.ts +22 -0
|
@@ -123,6 +123,8 @@ declare class MediaQueryObserver {
|
|
|
123
123
|
type DataList$6 = typeUtils.DataList;
|
|
124
124
|
type PropertyList$6 = typeUtils.PropertyList;
|
|
125
125
|
type MethodList$5 = typeUtils.MethodList;
|
|
126
|
+
type Empty$4 = typeUtils.Empty;
|
|
127
|
+
type PropertyValues<TProperty extends PropertyList$6> = typeUtils.PropertyValues<TProperty>;
|
|
126
128
|
type AllData<TData extends DataList$6, TProperty extends PropertyList$6> = typeUtils.DataWithPropertyValues<TData, TProperty>;
|
|
127
129
|
type ExportType<UData extends DataList$6, UProperty extends PropertyList$6, UMethod extends MethodList$5, UComponentExport, UExtraThisFields extends DataList$6> = [UComponentExport] extends [never] ? Component<UData, UProperty, UMethod, UComponentExport, UExtraThisFields> : UComponentExport;
|
|
128
130
|
declare const determineComponentExports: (parent: GeneralBehavior[], selfExport: ((source: GeneralComponent | null) => any) | undefined) => ((source: GeneralComponent | null) => any) | undefined;
|
|
@@ -289,9 +291,10 @@ declare const component_ComponentCaller: typeof ComponentCaller;
|
|
|
289
291
|
type component_ComponentProto<TData extends DataList$6, TProperty extends PropertyList$6, TMethod extends MethodList$5, TComponentExport, TExtraThisFields extends DataList$6> = ComponentProto<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>;
|
|
290
292
|
declare const component_ComponentProto: typeof ComponentProto;
|
|
291
293
|
type component_GeneralComponent = GeneralComponent;
|
|
294
|
+
type component_PropertyValues<TProperty extends PropertyList$6> = PropertyValues<TProperty>;
|
|
292
295
|
declare const component_determineComponentExports: typeof determineComponentExports;
|
|
293
296
|
declare namespace component {
|
|
294
|
-
export { type component_AllData as AllData, type component_Component as Component, component_ComponentCaller as ComponentCaller, component_ComponentProto as ComponentProto, type component_GeneralComponent as GeneralComponent, component_determineComponentExports as determineComponentExports };
|
|
297
|
+
export { type component_AllData as AllData, type component_Component as Component, component_ComponentCaller as ComponentCaller, component_ComponentProto as ComponentProto, type Empty$4 as Empty, type component_GeneralComponent as GeneralComponent, type component_PropertyValues as PropertyValues, component_determineComponentExports as determineComponentExports };
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
type ResolveBehaviorBuilder<B, TChainingFilter extends ChainingFilterType$4> = typeUtils.IsNever<TChainingFilter> extends false ? TChainingFilter extends ChainingFilterType$4 ? Omit<B, TChainingFilter['remove']> & TChainingFilter['add'] : B : B;
|
|
@@ -699,7 +702,7 @@ declare namespace index {
|
|
|
699
702
|
interface PageConstructor {
|
|
700
703
|
<TData extends DataList, TNewExtraFields extends {
|
|
701
704
|
[k: PropertyKey]: any;
|
|
702
|
-
}>(definition: PageDefinition<TData, TNewExtraFields> & ThisType<Component<TData, Empty, TNewExtraFields, never, Empty>>):
|
|
705
|
+
}>(definition: PageDefinition<TData, TNewExtraFields> & ThisType<Component<TData, Empty, TNewExtraFields, never, Empty>>): ComponentType<TData, Empty, TNewExtraFields, never, Empty>;
|
|
703
706
|
}
|
|
704
707
|
interface ComponentConstructor {
|
|
705
708
|
(): DefaultComponentBuilder;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glass-easel-miniprogram-adapter",
|
|
3
3
|
"description": "The MiniProgram interface adapter of the glass-easel project",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/wechat-miniprogram/glass-easel.git"
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"module": "dist/glass_easel_miniprogram_adapter.es.js",
|
|
20
20
|
"types": "dist/glass_easel_miniprogram_adapter.d.js",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"glass-easel": "0.
|
|
22
|
+
"glass-easel": "0.15.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"glass-easel": "0.
|
|
26
|
-
"glass-easel-template-compiler": "0.
|
|
25
|
+
"glass-easel": "0.15.0",
|
|
26
|
+
"glass-easel-template-compiler": "0.15.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"doc": "typedoc src/index.ts --excludePrivate --excludeProtected --excludeInternal",
|
package/src/component.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { MediaQueryObserver } from './media_query'
|
|
|
8
8
|
type DataList = typeUtils.DataList
|
|
9
9
|
type PropertyList = typeUtils.PropertyList
|
|
10
10
|
type MethodList = typeUtils.MethodList
|
|
11
|
+
export type Empty = typeUtils.Empty
|
|
12
|
+
export type PropertyValues<TProperty extends PropertyList> = typeUtils.PropertyValues<TProperty>
|
|
11
13
|
export type AllData<
|
|
12
14
|
TData extends DataList,
|
|
13
15
|
TProperty extends PropertyList,
|
package/src/space.ts
CHANGED
|
@@ -31,7 +31,13 @@ export interface PageConstructor {
|
|
|
31
31
|
/* TExtraThisFields */ Empty
|
|
32
32
|
>
|
|
33
33
|
>,
|
|
34
|
-
):
|
|
34
|
+
): ComponentType<
|
|
35
|
+
/* TData */ TData,
|
|
36
|
+
/* TProperty */ Empty,
|
|
37
|
+
/* TMethod */ TNewExtraFields,
|
|
38
|
+
/* TComponentExport */ never,
|
|
39
|
+
/* TExtraThisFields */ Empty
|
|
40
|
+
>
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
// The component constructor
|
package/tests/space.test.ts
CHANGED
|
@@ -1194,4 +1194,26 @@ describe('define', () => {
|
|
|
1194
1194
|
root.getComponent().triggerPageLifetime('show', [])
|
|
1195
1195
|
expect(domHtml(root.getComponent())).toBe('<comp1>2</comp1>')
|
|
1196
1196
|
})
|
|
1197
|
+
|
|
1198
|
+
test('overall behavior', () => {
|
|
1199
|
+
const env = new MiniProgramEnv()
|
|
1200
|
+
const codeSpace = env.createCodeSpace('', true)
|
|
1201
|
+
|
|
1202
|
+
const componentSpace = codeSpace.getComponentSpace()
|
|
1203
|
+
const overall = componentSpace.defineBehavior({
|
|
1204
|
+
is: 'overall',
|
|
1205
|
+
data: {
|
|
1206
|
+
num: 1,
|
|
1207
|
+
},
|
|
1208
|
+
})
|
|
1209
|
+
codeSpace.setOverallBehavior(overall)
|
|
1210
|
+
|
|
1211
|
+
codeSpace.addCompiledTemplate('comp', tmpl(`<div>{{ num }}</div>`))
|
|
1212
|
+
|
|
1213
|
+
codeSpace.component('comp').register()
|
|
1214
|
+
|
|
1215
|
+
const ab = env.associateBackend()
|
|
1216
|
+
const root = ab.createRoot('body', codeSpace, 'comp')
|
|
1217
|
+
expect(domHtml(root.getComponent())).toBe('<div>1</div>')
|
|
1218
|
+
})
|
|
1197
1219
|
})
|