glass-easel-devtools-panel 0.9.0 → 0.10.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.
@@ -5,8 +5,8 @@
5
5
  }
6
6
 
7
7
  .section {
8
- margin-bottom: 5px;
9
- color: @common-text;
8
+ margin-bottom: 2px;
9
+ .color-mode(color, @common-text);
10
10
  }
11
11
  .section-item {
12
12
  white-space: nowrap;
@@ -14,18 +14,18 @@
14
14
  }
15
15
  .section-key {
16
16
  display: inline;
17
- color: @property-name;
17
+ .color-mode(color, @property-name);
18
18
  }
19
19
  .section-key-core {
20
20
  display: inline;
21
- color: @core-attribute-name;
21
+ .color-mode(color, @core-attribute-name);
22
22
  }
23
23
  .section-value {
24
24
  display: inline;
25
- color: @attribute-value;
25
+ .color-mode(color, @attribute-value);
26
26
  }
27
27
  .section-value-extra {
28
- color: @important-text;
28
+ .color-mode(color, @important-text);
29
29
  }
30
30
 
31
31
  .section-empty {
@@ -40,7 +40,7 @@
40
40
  flex: none;
41
41
  text-align: center;
42
42
  white-space: nowrap;
43
- color: @important-text;
43
+ .color-mode(color, @important-text);
44
44
  margin: 1px;
45
45
  }
46
46
  .box-model-content {
@@ -51,12 +51,12 @@
51
51
  .box-model-padding {
52
52
  border: 1px solid #888;
53
53
  padding: 1px;
54
- background: @primary-bg;
54
+ .color-mode(background-color, @primary-bg);
55
55
  }
56
56
  .box-model-border {
57
57
  border: 1px solid #888;
58
58
  padding: 1px;
59
- background: @secondary-bg;
59
+ .color-mode(background-color, @secondary-bg);
60
60
  }
61
61
  .box-model-margin {
62
62
  padding: 1px;
@@ -67,18 +67,66 @@
67
67
  align-items: center;
68
68
  }
69
69
 
70
+ .class-external-hint {
71
+ display: inline;
72
+ font-style: italic;
73
+ }
74
+ .class-value-item {
75
+ .color-mode(color, @attribute-value);
76
+ }
77
+
70
78
  .style-rule {
71
- padding-left: 1em;
72
79
  margin: 5px 0;
80
+ user-select: text;
73
81
  }
74
82
  .style-rule_inactive {
75
- text-decoration: line-through @important-text;
83
+ opacity: 0.5;
76
84
  }
77
85
  .style-rule-prefix {
78
- margin-left: -1em;
79
86
  font-style: italic;
87
+ user-select: none;
88
+ }
89
+ .style-rule-disabled {
90
+ display: inline-block;
91
+ width: 1em;
92
+ height: 1em;
93
+ line-height: 1em;
94
+ text-align: center;
95
+ cursor: pointer;
96
+ .color-mode(color, @warn-text);
97
+ }
98
+ .style-rule-enabled {
99
+ display: inline-block;
100
+ width: 1em;
101
+ height: 1em;
102
+ line-height: 1em;
103
+ text-align: center;
104
+ cursor: pointer;
105
+ color: transparent;
106
+ }
107
+ .style-rule-enabled_hover {
108
+ .color-mode(color, @warn-text);
109
+ }
110
+ .style-rule-scope {
111
+ display: inline;
112
+ font-style: italic;
113
+ user-select: none;
80
114
  }
81
115
  .style-rule-title {
82
- margin-left: -1em;
83
- color: @important-text;
116
+ display: inline;
117
+ .color-mode(color, @important-text);
118
+ }
119
+ .style-rule-property_disabled {
120
+ opacity: 0.5;
121
+ }
122
+ .style-rule-item-add {
123
+ display: inline-block;
124
+ cursor: text;
125
+ }
126
+ .style-rule-inline-add {
127
+ font-style: normal;
128
+ display: inline-block;
129
+ }
130
+ .style-rule-inline-add_hover {
131
+ .color-mode(background-color, @hover-bg);
84
132
  }
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,72 @@
1
+ const PRESERVED_RIGHT_WIDTH = 16
2
+
3
+ Component()
4
+ .property('edit', Boolean)
5
+ .property('value', String)
6
+ .data(() => ({
7
+ width: 0,
8
+ previewValue: '',
9
+ }))
10
+ .init(({ self, data, observer, listener, method }) => {
11
+ observer('edit', (v) => {
12
+ if (v) {
13
+ self.setData({}, () => {
14
+ const editInput = self._$?.getShadowRoot()?.getElementById('edit')?.getBackendElement()
15
+ if (editInput) {
16
+ self._$?.getBackendContext()?.setFocusedNode?.(editInput as any)
17
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
18
+ ;(editInput as any).select?.()
19
+ }
20
+ })
21
+ }
22
+ })
23
+
24
+ observer(['edit', 'value'], () => {
25
+ updateWidth()
26
+ })
27
+
28
+ const getInputValue = () => {
29
+ const editInput = self._$?.getShadowRoot()?.getElementById('edit')?.getBackendElement()
30
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
31
+ return (editInput as any)?.value as string | undefined
32
+ }
33
+
34
+ const startEdit = listener(() => {
35
+ self.setData({ edit: true, width: PRESERVED_RIGHT_WIDTH, previewValue: data.value })
36
+ })
37
+
38
+ const inputBlur = listener(() => {
39
+ commit()
40
+ })
41
+
42
+ const updateWidth = method(() => {
43
+ if (!data.edit) return
44
+ const previewValue = getInputValue() ?? data.value
45
+ self.setData({ previewValue }, () => {
46
+ self
47
+ .createSelectorQuery()
48
+ .select('#measure')
49
+ .boundingClientRect((rect) => {
50
+ if (!rect) return
51
+ const width =
52
+ rect.width > PRESERVED_RIGHT_WIDTH
53
+ ? rect.width + PRESERVED_RIGHT_WIDTH
54
+ : PRESERVED_RIGHT_WIDTH
55
+ self.setData({ width })
56
+ })
57
+ .exec()
58
+ })
59
+ })
60
+
61
+ const commit = method(() => {
62
+ setTimeout(() => {
63
+ const value = getInputValue()
64
+ if (value === undefined) return
65
+ self.setData({ edit: false, value })
66
+ self.triggerEvent('change', { value }, {})
67
+ }, 0)
68
+ })
69
+
70
+ return { startEdit, inputBlur, updateWidth, commit }
71
+ })
72
+ .register()
@@ -0,0 +1,7 @@
1
+ <view catch:tap="startEdit">
2
+ <slot />
3
+ </view>
4
+ <block wx:if="{{ edit }}">
5
+ <div id="measure" class="measure">{{ previewValue }}</div>
6
+ <input id="edit" class="edit" style="width: {{ width }}px" value="{{ value }}" bind:blur="inputBlur" bind:keyup="updateWidth" bind:change="commit" />
7
+ </block>
@@ -0,0 +1,32 @@
1
+ @import url('../common.wxss');
2
+
3
+ :host {
4
+ display: inline-block;
5
+ cursor: text;
6
+ position: relative;
7
+ }
8
+
9
+ .measure {
10
+ color: transparent;
11
+ position: absolute;
12
+ left: 0;
13
+ top: 0;
14
+ font-family: monospace;
15
+ white-space: nowrap;
16
+ }
17
+
18
+ .edit {
19
+ box-sizing: content-box;
20
+ position: absolute;
21
+ left: -2px;
22
+ top: -2px;
23
+ right: -2px;
24
+ border: 1px solid #808080;
25
+ padding: 1px;
26
+ .color-mode(background-color, @secondary-bg);
27
+ .color-mode(color, @important-text);
28
+ font-size: 1em;
29
+ font-family: monospace;
30
+ border-radius: none;
31
+ outline: none;
32
+ }
@@ -6,8 +6,8 @@
6
6
 
7
7
  .title {
8
8
  padding: 0 5px;
9
- background: @secondary-bg;
10
- color: @important-text;
9
+ .color-mode(background-color, @secondary-bg);
10
+ .color-mode(color, @important-text);
11
11
  line-height: 1.5;
12
12
  white-space: nowrap;
13
13
  }
@@ -24,7 +24,7 @@
24
24
  margin-left: 0.5em;
25
25
  }
26
26
  .title-refresh_hover {
27
- background-color: @hover-bg;
27
+ .color-mode(background-color, @hover-bg);
28
28
  }
29
29
  .arrow {
30
30
  display: inline-block;
@@ -2,14 +2,13 @@
2
2
 
3
3
  @keyframes value-update-ani {
4
4
  from {
5
- background: @update-bg;
6
5
  }
7
6
  to {
8
- background: transparent;
7
+ background-color: transparent;
9
8
  }
10
9
  }
11
10
  .updated {
12
- background: @update-bg;
11
+ .color-mode(background-color, @update-bg);
13
12
  animation-duration: 1s;
14
13
  animation-fill-mode: both;
15
14
  animation-name: value-update-ani;
@@ -22,10 +21,10 @@
22
21
 
23
22
  .slice {
24
23
  display: inline;
25
- color: @common-text;
24
+ .color-mode(color, @common-text);
26
25
  }
27
26
  .slice_dynamic {
28
- color: @attribute-value;
27
+ .color-mode(color, @attribute-value);
29
28
  }
30
29
 
31
30
  .var-name {
@@ -37,8 +36,8 @@
37
36
  text-align: center;
38
37
  font-size: 0.8em;
39
38
  font-style: italic;
40
- color: @important-text;
39
+ .color-mode(color, @important-text);
41
40
  }
42
41
  .var-name_hover {
43
- background: @hover-bg;
42
+ .color-mode(background-color, @hover-bg);
44
43
  }
@@ -8,13 +8,13 @@ body {
8
8
  .wrapper {
9
9
  font-family: monospace;
10
10
  font-size: 12px;
11
- background: @primary-bg;
11
+ .color-mode(background-color, @primary-bg);
12
12
  height: 100%;
13
13
  cursor: default;
14
14
  user-select: none;
15
15
  }
16
16
  .empty {
17
- color: @common-text;
17
+ .color-mode(color, @common-text);
18
18
  font-style: italic;
19
19
  padding: 5px;
20
20
  }
@@ -41,8 +41,8 @@ body {
41
41
 
42
42
  .toolbar {
43
43
  flex: none;
44
- background: @secondary-bg;
45
- color: @important-text;
44
+ .color-mode(background-color, @secondary-bg);
45
+ .color-mode(color, @important-text);
46
46
  border-bottom: 2px solid #888;
47
47
  display: flex;
48
48
  }
@@ -55,10 +55,10 @@ body {
55
55
  padding: 5px 10px;
56
56
  }
57
57
  .tool_hover {
58
- background: @hover-bg;
58
+ .color-mode(background-color, @hover-bg);
59
59
  }
60
60
  .tool_active {
61
- background: @selected-bg;
61
+ .color-mode(background-color, @selected-bg);
62
62
  }
63
63
 
64
64
  .tree {
@@ -2,14 +2,13 @@
2
2
 
3
3
  @keyframes update-ani {
4
4
  from {
5
- background: @update-bg;
6
5
  }
7
6
  to {
8
7
  background: transparent;
9
8
  }
10
9
  }
11
10
  .updated {
12
- background: @update-bg;
11
+ .color-mode(background-color, @update-bg);
13
12
  animation-duration: 1s;
14
13
  animation-fill-mode: both;
15
14
  animation-name: update-ani;
@@ -21,7 +20,7 @@
21
20
  }
22
21
 
23
22
  .tag {
24
- color: @common-text;
23
+ .color-mode(color, @common-text);
25
24
  white-space: nowrap;
26
25
  }
27
26
 
@@ -45,20 +44,20 @@
45
44
  display: inline-block;
46
45
  }
47
46
  .tag-body_hover {
48
- background: @hover-bg;
47
+ .color-mode(background-color, @hover-bg);
49
48
  }
50
49
  .tag-body_selected {
51
- background: @selected-bg;
50
+ .color-mode(background-color, @selected-bg);
52
51
  }
53
52
  .tag-body_highlight {
54
- background-color: rgba(0, 128, 192, 0.25);
53
+ .color-mode(background-color, @highlight-bg);
55
54
  }
56
55
  .tag-text {
57
56
  display: inline;
58
57
  }
59
58
  .tag-name {
60
59
  display: inline-block;
61
- color: @tag-name;
60
+ .color-mode(color, @tag-name);
62
61
  }
63
62
 
64
63
  .tag-var-name-wrapper {
@@ -73,10 +72,10 @@
73
72
  text-align: center;
74
73
  font-size: 0.8em;
75
74
  font-style: italic;
76
- color: @important-text;
75
+ .color-mode(color, @important-text);
77
76
  }
78
77
  .tag-var-name_hover {
79
- background: @hover-bg;
78
+ .color-mode(background-color, @hover-bg);
80
79
  }
81
80
 
82
81
  .attribute {
@@ -85,14 +84,14 @@
85
84
  }
86
85
  .attribute-name {
87
86
  display: inline-block;
88
- color: @core-attribute-name;
87
+ .color-mode(color, @core-attribute-name);
89
88
  }
90
89
  .attribute-name_property {
91
- color: @property-name;
90
+ .color-mode(color, @property-name);
92
91
  }
93
92
  .attribute-value {
94
93
  display: inline-block;
95
- color: @attribute-value;
94
+ .color-mode(color, @attribute-value);
96
95
  }
97
96
 
98
97
  .children {
@@ -104,10 +103,10 @@
104
103
  font-style: italic;
105
104
  }
106
105
  .virtual-tag-name_hover {
107
- background: @selected-bg;
106
+ .color-mode(background-color, @selected-bg);
108
107
  }
109
108
 
110
109
  .text-content {
111
- color: @important-text;
110
+ .color-mode(color, @important-text);
112
111
  padding: 1px 0;
113
112
  }