glass-easel-miniprogram-adapter 0.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/README.md +49 -0
- package/dist/glass_easel_miniprogram_adapter.d.ts +1 -0
- package/dist/glass_easel_miniprogram_adapter.js +2 -0
- package/dist/glass_easel_miniprogram_adapter.js.map +1 -0
- package/dist/types/src/backend.d.ts +51 -0
- package/dist/types/src/backend.d.ts.map +1 -0
- package/dist/types/src/behavior.d.ts +35 -0
- package/dist/types/src/behavior.d.ts.map +1 -0
- package/dist/types/src/component.d.ts +160 -0
- package/dist/types/src/component.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +58 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/selector_query.d.ts +98 -0
- package/dist/types/src/selector_query.d.ts.map +1 -0
- package/dist/types/src/space.d.ts +369 -0
- package/dist/types/src/space.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +77 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/utils.d.ts +2 -0
- package/dist/types/src/utils.d.ts.map +1 -0
- package/dist/types/tests/base/env.d.ts +3 -0
- package/dist/types/tests/base/env.d.ts.map +1 -0
- package/dist/types/tests/data_update.test.d.ts +2 -0
- package/dist/types/tests/data_update.test.d.ts.map +1 -0
- package/dist/types/tests/env.test.d.ts +2 -0
- package/dist/types/tests/env.test.d.ts.map +1 -0
- package/dist/types/tests/selector.test.d.ts +2 -0
- package/dist/types/tests/selector.test.d.ts.map +1 -0
- package/dist/types/tests/space.test.d.ts +2 -0
- package/dist/types/tests/space.test.d.ts.map +1 -0
- package/dist/types/tests/trait_behavior.test.d.ts +2 -0
- package/dist/types/tests/trait_behavior.test.d.ts.map +1 -0
- package/jest.config.js +13 -0
- package/package.json +32 -0
- package/src/backend.ts +106 -0
- package/src/behavior.ts +101 -0
- package/src/component.ts +476 -0
- package/src/index.ts +82 -0
- package/src/selector_query.ts +356 -0
- package/src/space.ts +1514 -0
- package/src/types.ts +85 -0
- package/src/utils.ts +3 -0
- package/tests/base/env.ts +20 -0
- package/tests/data_update.test.ts +92 -0
- package/tests/env.test.ts +141 -0
- package/tests/selector.test.ts +407 -0
- package/tests/space.test.ts +953 -0
- package/tests/trait_behavior.test.ts +141 -0
- package/tsconfig.json +11 -0
- package/webpack.config.js +78 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { DeepCopyKind, typeUtils as utils } from 'glass-easel';
|
|
2
|
+
import type { DefinitionFilter, GeneralBehavior, Behavior } from './behavior';
|
|
3
|
+
export { typeUtils as utils } from 'glass-easel';
|
|
4
|
+
export declare const enum StyleIsolation {
|
|
5
|
+
Isolated = "isolated",
|
|
6
|
+
ApplyShared = "apply-shared",
|
|
7
|
+
Shared = "shared",
|
|
8
|
+
PageIsolated = "page-isolated",
|
|
9
|
+
PageApplyShared = "page-apply-shared",
|
|
10
|
+
PageShared = "page-shared"
|
|
11
|
+
}
|
|
12
|
+
export type ComponentStaticConfig = {
|
|
13
|
+
component?: boolean;
|
|
14
|
+
usingComponents?: {
|
|
15
|
+
[name: string]: string;
|
|
16
|
+
};
|
|
17
|
+
generics?: {
|
|
18
|
+
[name: string]: true | {
|
|
19
|
+
default?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
placeholder?: {
|
|
23
|
+
[name: string]: string;
|
|
24
|
+
};
|
|
25
|
+
styleIsolation?: StyleIsolation;
|
|
26
|
+
/** @obsolete */
|
|
27
|
+
addGlobalClass?: boolean;
|
|
28
|
+
pureDataPattern?: string;
|
|
29
|
+
};
|
|
30
|
+
export type ComponentDefinitionOptions = {
|
|
31
|
+
multipleSlots?: boolean;
|
|
32
|
+
pureDataPattern?: RegExp;
|
|
33
|
+
virtualHost?: boolean;
|
|
34
|
+
dataDeepCopy?: DeepCopyKind;
|
|
35
|
+
propertyPassingDeepCopy?: DeepCopyKind;
|
|
36
|
+
propertyEarlyInit?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type ComponentMethod = utils.ComponentMethod;
|
|
39
|
+
export type BehaviorDefinition<TData extends utils.DataList, TProperty extends utils.PropertyList, TMethod extends utils.MethodList> = {
|
|
40
|
+
behaviors?: Behavior<any, any, any, any>[];
|
|
41
|
+
properties?: TProperty;
|
|
42
|
+
data?: TData | (() => TData);
|
|
43
|
+
observers?: ({
|
|
44
|
+
fields?: string;
|
|
45
|
+
observer: ComponentMethod;
|
|
46
|
+
})[] | {
|
|
47
|
+
[fields: string]: ComponentMethod;
|
|
48
|
+
};
|
|
49
|
+
methods?: TMethod;
|
|
50
|
+
created?: ComponentMethod;
|
|
51
|
+
attached?: ComponentMethod;
|
|
52
|
+
ready?: ComponentMethod;
|
|
53
|
+
moved?: ComponentMethod;
|
|
54
|
+
detached?: ComponentMethod;
|
|
55
|
+
lifetimes?: {
|
|
56
|
+
[name: string]: ComponentMethod;
|
|
57
|
+
};
|
|
58
|
+
pageLifetimes?: {
|
|
59
|
+
[name: string]: ComponentMethod;
|
|
60
|
+
};
|
|
61
|
+
relations?: utils.RelationParamsWithKey;
|
|
62
|
+
externalClasses?: string[];
|
|
63
|
+
definitionFilter?: DefinitionFilter;
|
|
64
|
+
};
|
|
65
|
+
export type ComponentDefinition<TData extends utils.DataList, TProperty extends utils.PropertyList, TMethod extends utils.MethodList, TComponentExport> = {
|
|
66
|
+
options?: ComponentDefinitionOptions;
|
|
67
|
+
export?: () => TComponentExport;
|
|
68
|
+
} & BehaviorDefinition<TData, TProperty, TMethod>;
|
|
69
|
+
export type GeneralComponentDefinition = ComponentDefinition<any, any, any, any>;
|
|
70
|
+
export type PageDefinition<TData extends utils.DataList, TExtraFields extends {
|
|
71
|
+
[k: PropertyKey]: any;
|
|
72
|
+
}> = TExtraFields & {
|
|
73
|
+
options?: ComponentDefinitionOptions;
|
|
74
|
+
behaviors?: GeneralBehavior[];
|
|
75
|
+
data?: TData;
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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C,UAAU,EAChC,gBAAgB,IACd;IACF,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,gBAAgB,CAAC;CACjC,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEhF,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,KAAK,CAAC,QAAQ,EAC5B,YAAY,SAAS;IAAE,CAAC,CAAC,EAAE,WAAW,GAAG,GAAG,CAAA;CAAE,IAC5C,YAAY,GAAG;IACjB,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,QAAO,MAEb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../tests/base/env.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AAGzC,eAAO,MAAM,IAAI,QAAS,MAAM,KAAG,WAAW,QAAQ,CAAC,iBAatD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data_update.test.d.ts","sourceRoot":"","sources":["../../../tests/data_update.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.test.d.ts","sourceRoot":"","sources":["../../../tests/env.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.test.d.ts","sourceRoot":"","sources":["../../../tests/selector.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.test.d.ts","sourceRoot":"","sources":["../../../tests/space.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trait_behavior.test.d.ts","sourceRoot":"","sources":["../../../tests/trait_behavior.test.ts"],"names":[],"mappings":""}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "glass-easel-miniprogram-adapter",
|
|
3
|
+
"description": "The MiniProgram interface adapter of the glass-easel project",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/wechat-miniprogram/glass-easel.git"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["glass-easel"],
|
|
10
|
+
"author": "wechat-miniprogram",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/wechat-miniprogram/glass-easel/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/wechat-miniprogram/glass-easel",
|
|
16
|
+
"main": "dist/glass_easel_miniprogram_adapter.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"doc": "typedoc src/index.ts --excludePrivate --excludeProtected --excludeInternal",
|
|
19
|
+
"build": "webpack --config webpack.config.js",
|
|
20
|
+
"dev": "webpack --config webpack.config.js --watch",
|
|
21
|
+
"lint": "eslint src/**/*.ts",
|
|
22
|
+
"test": "jest -c jest.config.js",
|
|
23
|
+
"coverage": "jest -c jest.config.js --collect-coverage"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"glass-easel": "*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"glass-easel": "*",
|
|
30
|
+
"glass-easel-template-compiler": "*"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/backend.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as glassEasel from 'glass-easel'
|
|
2
|
+
import { MiniProgramEnv, StyleIsolation } from '.'
|
|
3
|
+
import { CodeSpace } from './space'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A backend context that has been associated to an environment
|
|
7
|
+
*/
|
|
8
|
+
export class AssociatedBackend {
|
|
9
|
+
private _$env: MiniProgramEnv
|
|
10
|
+
/** @internal */
|
|
11
|
+
_$: glassEasel.GeneralBackendContext
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
constructor(env: MiniProgramEnv, backendContext: glassEasel.GeneralBackendContext) {
|
|
15
|
+
this._$env = env
|
|
16
|
+
this._$ = backendContext
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Register a style sheet resource
|
|
21
|
+
*
|
|
22
|
+
* Some backend cannot load style sheet URL.
|
|
23
|
+
* In this cases, the content should be registered here.
|
|
24
|
+
*/
|
|
25
|
+
registerStyleSheetContent(url: string, content: any) {
|
|
26
|
+
this._$.registerStyleSheetContent(url, content)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a root component in specified backend
|
|
31
|
+
*
|
|
32
|
+
* The component is searched in the `codeSpace` with `url` .
|
|
33
|
+
* If `url` contains "?" params, it will be parsed and try to set to component properties.
|
|
34
|
+
*/
|
|
35
|
+
createRoot(
|
|
36
|
+
tagName: string,
|
|
37
|
+
codeSpace: CodeSpace,
|
|
38
|
+
url: string,
|
|
39
|
+
genericTargets?: { [key: string]: string },
|
|
40
|
+
): Root {
|
|
41
|
+
if (this._$env !== codeSpace._$env) throw new Error('The code space is not in the same environment as the backend')
|
|
42
|
+
return new Root(this._$, tagName, codeSpace, url, genericTargets)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A root component
|
|
48
|
+
*/
|
|
49
|
+
export class Root {
|
|
50
|
+
private _$comp: glassEasel.GeneralComponent
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
constructor(
|
|
54
|
+
backendContext: glassEasel.GeneralBackendContext,
|
|
55
|
+
tagName: string,
|
|
56
|
+
codeSpace: CodeSpace,
|
|
57
|
+
url: string,
|
|
58
|
+
genericTargets?: { [key: string]: string },
|
|
59
|
+
) {
|
|
60
|
+
this._$comp = codeSpace.getComponentSpace().createComponentByUrl(
|
|
61
|
+
tagName,
|
|
62
|
+
url,
|
|
63
|
+
genericTargets || null,
|
|
64
|
+
backendContext,
|
|
65
|
+
)
|
|
66
|
+
if (codeSpace.isMainSpace()) {
|
|
67
|
+
const globalStyleSheet = codeSpace.getStyleSheet('app')
|
|
68
|
+
if (globalStyleSheet !== undefined) {
|
|
69
|
+
const styleIsolation = codeSpace._$styleIsolationMap[this._$comp.is]
|
|
70
|
+
if (
|
|
71
|
+
styleIsolation === StyleIsolation.Isolated
|
|
72
|
+
|| styleIsolation === StyleIsolation.ApplyShared
|
|
73
|
+
|| styleIsolation === StyleIsolation.Shared
|
|
74
|
+
) {
|
|
75
|
+
backendContext.appendStyleSheetPath(globalStyleSheet, codeSpace._$sharedStyleScope)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const addStyleSheet = (comp: glassEasel.GeneralComponentDefinition) => {
|
|
80
|
+
const { styleScope } = comp.getComponentOptions()
|
|
81
|
+
const path = codeSpace.getStyleSheet(comp.is)
|
|
82
|
+
if (path !== undefined) {
|
|
83
|
+
backendContext.appendStyleSheetPath(path, styleScope)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this._$comp.getRootBehavior().getComponentDependencies().forEach(addStyleSheet)
|
|
87
|
+
addStyleSheet(this._$comp.getComponentDefinition())
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the underlying component
|
|
92
|
+
*/
|
|
93
|
+
getComponent(): glassEasel.GeneralComponent {
|
|
94
|
+
return this._$comp
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Attach the root component to the backend
|
|
99
|
+
*
|
|
100
|
+
* This component, the `parent` and the `placeholder` MUST be in the same context.
|
|
101
|
+
* The `parent` MUST be a parent node of the `placeholder` .
|
|
102
|
+
*/
|
|
103
|
+
attach(parent: glassEasel.GeneralBackendElement, placeholder: glassEasel.GeneralBackendElement) {
|
|
104
|
+
glassEasel.Element.replaceDocumentElement(this._$comp, parent, placeholder)
|
|
105
|
+
}
|
|
106
|
+
}
|
package/src/behavior.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as glassEasel from 'glass-easel'
|
|
2
|
+
import {
|
|
3
|
+
GeneralComponentDefinition,
|
|
4
|
+
utils as typeUtils,
|
|
5
|
+
} from './types'
|
|
6
|
+
|
|
7
|
+
type DataList = typeUtils.DataList
|
|
8
|
+
type PropertyList = typeUtils.PropertyList
|
|
9
|
+
type MethodList = typeUtils.MethodList
|
|
10
|
+
type ChainingFilterType = typeUtils.ChainingFilterType
|
|
11
|
+
|
|
12
|
+
export type DefinitionFilter =
|
|
13
|
+
(
|
|
14
|
+
target: GeneralComponentDefinition,
|
|
15
|
+
childFilters: (
|
|
16
|
+
((target: GeneralComponentDefinition) => void)
|
|
17
|
+
| null
|
|
18
|
+
)[],
|
|
19
|
+
) => void
|
|
20
|
+
|
|
21
|
+
export type GeneralBehavior = Behavior<
|
|
22
|
+
Record<string, any>,
|
|
23
|
+
Record<string, any>,
|
|
24
|
+
Record<string, any>,
|
|
25
|
+
any
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
export class Behavior<
|
|
29
|
+
TData extends DataList,
|
|
30
|
+
TProperty extends PropertyList,
|
|
31
|
+
TMethod extends MethodList,
|
|
32
|
+
TChainingFilter extends ChainingFilterType,
|
|
33
|
+
> {
|
|
34
|
+
/** @internal */
|
|
35
|
+
_$: glassEasel.GeneralBehavior
|
|
36
|
+
/** @internal */
|
|
37
|
+
_$bindedDefinitionFilter?: ((target: GeneralComponentDefinition) => void)
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
constructor(
|
|
41
|
+
inner: glassEasel.Behavior<
|
|
42
|
+
TData,
|
|
43
|
+
TProperty,
|
|
44
|
+
TMethod,
|
|
45
|
+
TChainingFilter
|
|
46
|
+
>,
|
|
47
|
+
parents: GeneralBehavior[],
|
|
48
|
+
definitionFilter: DefinitionFilter | undefined,
|
|
49
|
+
) {
|
|
50
|
+
this._$ = inner as glassEasel.GeneralBehavior
|
|
51
|
+
|
|
52
|
+
// processing definition filter
|
|
53
|
+
if (definitionFilter !== undefined) {
|
|
54
|
+
const definitionFilterArgs = parents.map((p) => p._$bindedDefinitionFilter ?? null)
|
|
55
|
+
this._$bindedDefinitionFilter = (childDef) => {
|
|
56
|
+
definitionFilter(childDef, definitionFilterArgs)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class ComponentType<
|
|
63
|
+
TData extends DataList,
|
|
64
|
+
TProperty extends PropertyList,
|
|
65
|
+
TMethod extends MethodList,
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
|
+
TComponentExport,
|
|
68
|
+
> {
|
|
69
|
+
/** @internal */
|
|
70
|
+
_$: glassEasel.ComponentDefinition<
|
|
71
|
+
TData,
|
|
72
|
+
TProperty,
|
|
73
|
+
TMethod
|
|
74
|
+
>
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
constructor(
|
|
78
|
+
inner: glassEasel.ComponentDefinition<
|
|
79
|
+
TData,
|
|
80
|
+
TProperty,
|
|
81
|
+
TMethod
|
|
82
|
+
>,
|
|
83
|
+
) {
|
|
84
|
+
this._$ = inner
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class TraitBehavior<
|
|
89
|
+
TIn extends { [key: string]: any },
|
|
90
|
+
TOut extends { [key: string]: any } = TIn,
|
|
91
|
+
> {
|
|
92
|
+
/** @internal */
|
|
93
|
+
_$: glassEasel.TraitBehavior<TIn, TOut>
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
constructor(inner: glassEasel.TraitBehavior<TIn>)
|
|
97
|
+
constructor(inner: glassEasel.TraitBehavior<TIn, TOut>)
|
|
98
|
+
constructor(inner: glassEasel.TraitBehavior<TIn, TOut>) {
|
|
99
|
+
this._$ = inner
|
|
100
|
+
}
|
|
101
|
+
}
|