@next-core/brick-kit 2.115.0 → 2.116.1
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/CHANGELOG.md +27 -0
- package/dist/index.bundle.js +50 -34
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +50 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/CustomTemplates/registerCustomTemplate.d.ts.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/internal/mediaQuery.d.ts +3 -3
- package/dist/types/internal/mediaQuery.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.116.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.116.0...@next-core/brick-kit@2.116.1) (2022-04-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @next-core/brick-kit
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.116.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.115.1...@next-core/brick-kit@2.116.0) (2022-04-01)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* support re-registering custom templates ([ea91d7d](https://github.com/easyops-cn/next-core/commit/ea91d7de23e0a9d3a935c01a9a103fb44b8cdfb3))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [2.115.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.115.0...@next-core/brick-kit@2.115.1) (2022-03-30)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @next-core/brick-kit
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [2.115.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.114.0...@next-core/brick-kit@2.115.0) (2022-03-30)
|
|
7
34
|
|
|
8
35
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -2186,28 +2186,28 @@
|
|
|
2186
2186
|
return tplContextMap.get(tplContextId);
|
|
2187
2187
|
}
|
|
2188
2188
|
|
|
2189
|
-
var
|
|
2189
|
+
var MediaBreakpoint;
|
|
2190
2190
|
|
|
2191
|
-
(function (
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
})(
|
|
2191
|
+
(function (MediaBreakpoint) {
|
|
2192
|
+
MediaBreakpoint["xLarge"] = "xLarge";
|
|
2193
|
+
MediaBreakpoint["large"] = "large";
|
|
2194
|
+
MediaBreakpoint["medium"] = "medium";
|
|
2195
|
+
MediaBreakpoint["small"] = "small";
|
|
2196
|
+
MediaBreakpoint["xSmall"] = "xSmall";
|
|
2197
|
+
})(MediaBreakpoint || (MediaBreakpoint = {}));
|
|
2198
2198
|
|
|
2199
|
-
var
|
|
2199
|
+
var mediaBreakpointMinWidthMap = new Map([[MediaBreakpoint.xLarge, "1920px"], [MediaBreakpoint.large, "1600px"], [MediaBreakpoint.medium, "1280px"], [MediaBreakpoint.small, "1024px"], [MediaBreakpoint.xSmall, 0]]);
|
|
2200
2200
|
var mediaEventTarget = new EventTarget$1();
|
|
2201
|
-
var
|
|
2201
|
+
var breakpointMatchesMap = {};
|
|
2202
2202
|
var MEDIA = {};
|
|
2203
2203
|
|
|
2204
|
-
function handleMatchesChange(data,
|
|
2204
|
+
function handleMatchesChange(data, breakpoint) {
|
|
2205
2205
|
var changed = false;
|
|
2206
|
-
|
|
2206
|
+
breakpointMatchesMap[breakpoint] = data.matches;
|
|
2207
2207
|
|
|
2208
|
-
for (var [
|
|
2209
|
-
if (
|
|
2210
|
-
MEDIA.
|
|
2208
|
+
for (var [_breakpoint] of mediaBreakpointMinWidthMap) {
|
|
2209
|
+
if (breakpointMatchesMap[_breakpoint] && MEDIA.breakpoint !== _breakpoint) {
|
|
2210
|
+
MEDIA.breakpoint = _breakpoint;
|
|
2211
2211
|
changed = true;
|
|
2212
2212
|
break;
|
|
2213
2213
|
}
|
|
@@ -2220,17 +2220,17 @@
|
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
2222
|
|
|
2223
|
-
|
|
2224
|
-
var mediaQueryList = window.matchMedia("(min-width: ".concat(
|
|
2225
|
-
handleMatchesChange(mediaQueryList,
|
|
2223
|
+
mediaBreakpointMinWidthMap.forEach((minWidth, breakpoint) => {
|
|
2224
|
+
var mediaQueryList = window.matchMedia("(min-width: ".concat(minWidth, ")"));
|
|
2225
|
+
handleMatchesChange(mediaQueryList, breakpoint);
|
|
2226
2226
|
|
|
2227
2227
|
if (mediaQueryList.addEventListener) {
|
|
2228
2228
|
mediaQueryList.addEventListener("change", event => {
|
|
2229
|
-
handleMatchesChange(event,
|
|
2229
|
+
handleMatchesChange(event, breakpoint);
|
|
2230
2230
|
});
|
|
2231
2231
|
} else {
|
|
2232
2232
|
mediaQueryList.addListener(event => {
|
|
2233
|
-
handleMatchesChange(event,
|
|
2233
|
+
handleMatchesChange(event, breakpoint);
|
|
2234
2234
|
});
|
|
2235
2235
|
}
|
|
2236
2236
|
});
|
|
@@ -7903,7 +7903,9 @@
|
|
|
7903
7903
|
var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
|
|
7904
7904
|
Object.assign(storyboard, _objectSpread__default["default"](_objectSpread__default["default"]({}, storyboardPatch), {}, {
|
|
7905
7905
|
$$fulfilling: Promise.resolve(),
|
|
7906
|
-
$$fulfilled: true
|
|
7906
|
+
$$fulfilled: true,
|
|
7907
|
+
$$registerCustomTemplateProcessed: false,
|
|
7908
|
+
$$depsProcessed: false
|
|
7907
7909
|
}));
|
|
7908
7910
|
this.postProcessStoryboard(storyboard);
|
|
7909
7911
|
}
|
|
@@ -10966,37 +10968,37 @@
|
|
|
10966
10968
|
}
|
|
10967
10969
|
|
|
10968
10970
|
function registerCustomTemplate(tplName, tplConstructor, appId) {
|
|
10969
|
-
var _tplConstructor$proxy;
|
|
10970
|
-
|
|
10971
10971
|
var tagName = tplName; // When a template is registered by an app, its namespace maybe missed.
|
|
10972
10972
|
|
|
10973
10973
|
if (appId && !tplName.includes(".")) {
|
|
10974
10974
|
tagName = "".concat(appId, ".").concat(tplName);
|
|
10975
10975
|
}
|
|
10976
10976
|
|
|
10977
|
-
|
|
10977
|
+
var registered = customTemplateRegistry.has(tagName);
|
|
10978
|
+
|
|
10979
|
+
if (registered) {
|
|
10978
10980
|
// When open launchpad, the storyboard will be updated.
|
|
10979
10981
|
// However, we can't *undefine* a custom element.
|
|
10980
10982
|
// Just ignore re-registering custom templates.
|
|
10981
10983
|
if (!appId || appRegistered.has(appId)) {
|
|
10982
10984
|
// eslint-disable-next-line no-console
|
|
10983
|
-
console.
|
|
10985
|
+
console.warn("Custom template of \"".concat(tagName, "\" already registered."));
|
|
10984
10986
|
}
|
|
10987
|
+
} else {
|
|
10988
|
+
registered = !!customElements.get(tagName);
|
|
10985
10989
|
|
|
10986
|
-
|
|
10987
|
-
|
|
10990
|
+
if (registered) {
|
|
10991
|
+
// eslint-disable-next-line no-console
|
|
10992
|
+
console.warn("Custom template of \"".concat(tagName, "\" already defined by customElements."));
|
|
10993
|
+
}
|
|
10994
|
+
} // Now we allow re-register custom template
|
|
10988
10995
|
|
|
10989
|
-
if (customElements.get(tagName)) {
|
|
10990
|
-
// eslint-disable-next-line no-console
|
|
10991
|
-
console.error("Custom template of \"".concat(tagName, "\" already defined by customElements."));
|
|
10992
|
-
return;
|
|
10993
|
-
}
|
|
10994
10996
|
|
|
10995
10997
|
customTemplateRegistry.set(tagName, _objectSpread__default["default"](_objectSpread__default["default"]({}, tplConstructor), {}, {
|
|
10996
10998
|
name: tagName
|
|
10997
10999
|
})); // Collect defined properties of the template.
|
|
10998
11000
|
|
|
10999
|
-
var props =
|
|
11001
|
+
var props = getPropsOfCustomTemplate(tagName);
|
|
11000
11002
|
var nativeProp = props.find(prop => prop in HTMLElement.prototype); // istanbul ignore if
|
|
11001
11003
|
|
|
11002
11004
|
if (nativeProp !== undefined) {
|
|
@@ -11004,13 +11006,17 @@
|
|
|
11004
11006
|
console.error("In custom template \"".concat(tagName, "\", \"").concat(nativeProp, "\" is a native HTMLElement property, and should be avoid to be used as a brick property."));
|
|
11005
11007
|
}
|
|
11006
11008
|
|
|
11009
|
+
if (registered) {
|
|
11010
|
+
return;
|
|
11011
|
+
}
|
|
11012
|
+
|
|
11007
11013
|
customElements.define(tagName, class TplElement extends HTMLElement {
|
|
11008
11014
|
get $$typeof() {
|
|
11009
11015
|
return "custom-template";
|
|
11010
11016
|
}
|
|
11011
11017
|
|
|
11012
11018
|
static get _dev_only_definedProperties() {
|
|
11013
|
-
return
|
|
11019
|
+
return getPropsOfCustomTemplate(tagName);
|
|
11014
11020
|
}
|
|
11015
11021
|
|
|
11016
11022
|
connectedCallback() {
|
|
@@ -11028,6 +11034,16 @@
|
|
|
11028
11034
|
}
|
|
11029
11035
|
}
|
|
11030
11036
|
|
|
11037
|
+
function getPropsOfCustomTemplate(tagName) {
|
|
11038
|
+
var _state$map, _proxy$properties;
|
|
11039
|
+
|
|
11040
|
+
var {
|
|
11041
|
+
state,
|
|
11042
|
+
proxy
|
|
11043
|
+
} = customTemplateRegistry.get(tagName);
|
|
11044
|
+
return ((_state$map = state === null || state === void 0 ? void 0 : state.map(item => item.name)) !== null && _state$map !== void 0 ? _state$map : []).concat(Object.keys((_proxy$properties = proxy === null || proxy === void 0 ? void 0 : proxy.properties) !== null && _proxy$properties !== void 0 ? _proxy$properties : {}));
|
|
11045
|
+
}
|
|
11046
|
+
|
|
11031
11047
|
var customProcessorRegistry = new Map();
|
|
11032
11048
|
function registerCustomProcessor(processorFullName, processorFunc) {
|
|
11033
11049
|
// `namespace` should be the camelCase of the package name.
|