efront 3.27.1 → 3.28.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.
@@ -1,21 +1,29 @@
1
1
  var hasOwnProperty = {}.hasOwnProperty;
2
2
  var renderElements = Object.create(null);
3
3
  var presets = Object.create(null);
4
+ var copyAttribute = function (node, copys) {
5
+ for (var { name, value } of copys) switch (name.toLowerCase()) {
6
+ case "class":
7
+ addClass(node, value);
8
+ break;
9
+ case "style":
10
+ css(node, value);
11
+ break;
12
+ case "src":
13
+ case "placeholder":
14
+ node[name] = value;
15
+ break;
16
+ default:
17
+ node.setAttribute(name, value);
18
+ }
19
+ }
4
20
  var createTemplateNodes = function (text) {
5
21
  remove(this.with);
6
22
  if (isEmpty(text)) return;
7
23
  if (isNode(text)) {
8
24
  var node = text;
9
25
  if (isElement(node) && this.$struct.copys) {
10
- for (var c of this.$struct.copys) {
11
- if (c.name === 'class') {
12
- addClass(node, c.value);
13
- }
14
- else if (c.name === 'style') {
15
- css(node, c.value);
16
- }
17
- else node.setAttribute(c.name, c.value);
18
- }
26
+ copyAttribute(node, this.$struct.copys);
19
27
  }
20
28
  this.with = [node];
21
29
  return;
@@ -779,23 +787,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
779
787
  if (nextSibling) appendChild.before(nextSibling, replacer);
780
788
  else if (parentNode) appendChild(parentNode, replacer);
781
789
  if (element.parentNode === parentNode) remove(element);
782
- copys.forEach(function (attr) {
783
- var { name, value } = attr;
784
- switch (name.toLowerCase()) {
785
- case "class":
786
- addClass(replacer, value);
787
- break;
788
- case "style":
789
- css(replacer, value);
790
- break;
791
- case "src":
792
- case "placeholder":
793
- replacer[name] = value;
794
- break;
795
- default:
796
- replacer.setAttribute(name, value);
797
- }
798
- });
790
+ copyAttribute(replacer, copys);
799
791
  if (!replacer.renderid) replacer.renderid = element.renderid;
800
792
  }
801
793
  }
@@ -899,6 +891,15 @@ function createStructure(element) {
899
891
  element.removeAttribute(name);
900
892
  continue;
901
893
  };
894
+ if (/^\./.test(name) && !value) {
895
+ // 识别为class
896
+ element.removeAttribute(name);
897
+ value = name.slice(1).replace(/\./g, ' ')
898
+ name = 'class';
899
+ copys.push({ name, value });
900
+ element.setAttribute(name, value);
901
+ continue;
902
+ }
902
903
  if (/^(?:class|style|src|\:|placeholder)$/i.test(name)) {
903
904
  copys.push(attr);
904
905
  continue;
@@ -1,4 +1,4 @@
1
- var nav = createElement(div);
1
+ var nav = createElement("titlebar");
2
2
 
3
3
  function btn(element) {
4
4
  var opt = button(element);
@@ -14,7 +14,7 @@
14
14
  border : 1px solid #18333c;
15
15
  background-color: #18333c99;
16
16
  backdrop-filter : blur(20px);
17
- box-shadow : inset 0 0 6px #51ddf6, inset 200px -160px 200px -200px #51ddf6;
17
+ box-shadow : inset 0 0 6px #51ddf666, inset 200px -160px 200px -200px #51ddf633;
18
18
  cursor : default;
19
19
 
20
20
  >label {
@@ -15,6 +15,7 @@ body>& {
15
15
  -webkit-user-select: none;
16
16
  border: 1px solid #0006;
17
17
  min-width: 160px;
18
+ background: #fff;
18
19
  }
19
20
 
20
21
  &[draggable] {
@@ -25,7 +26,7 @@ body>& {
25
26
  >[body] {
26
27
  padding: 6px 20px 6px 6px;
27
28
  margin-right: -20px;
28
- background: #f2f4f6;
29
+ background: #f2f4f622;
29
30
  display: block;
30
31
  width: auto;
31
32
  height: 100%;
@@ -35,8 +36,8 @@ body>& {
35
36
  box-sizing: border-box;
36
37
  background-clip: padding-box;
37
38
 
38
- border-top: 6px solid #fff;
39
- border-bottom: 6px solid #fff;
39
+ border-top: 6px solid #fff2;
40
+ border-bottom: 6px solid #fff2;
40
41
 
41
42
  &:not(:nth-last-child(1)) {
42
43
  padding-bottom: 42px;
@@ -48,13 +49,12 @@ body>& {
48
49
  >[head] {
49
50
  top: 0;
50
51
  z-index: 2;
51
- background: #fffc;
52
+ background: inherit;
52
53
  position: relative;
53
54
  position: sticky;
54
55
  line-height: 20px;
55
56
  overflow: hidden;
56
57
  text-overflow: ellipsis;
57
- color: #333;
58
58
  padding: 12px 16px 10px 16px;
59
59
 
60
60
  &:before {
@@ -108,7 +108,7 @@ body>& {
108
108
  padding: 6px 16px 0 16px;
109
109
  border-top: 1px solid rgba(0, 0, 0, .16);
110
110
  backdrop-filter: blur(20px);
111
- background: #fffc;
111
+ background: inherit;
112
112
  position: sticky;
113
113
  width: 100%;
114
114
  bottom: 0;
@@ -323,7 +323,7 @@ function prepare(pgpath, ok) {
323
323
  };
324
324
  state.titlebar = function () {
325
325
  var realTitleBar = titlebar.apply(null, arguments);
326
- state.with(realTitleBar);
326
+ if (!realTitleBar.parentNode) state.with(realTitleBar);
327
327
  return realTitleBar;
328
328
  };
329
329
  var roles = res || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.27.1",
3
+ "version": "3.28.0",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {