@shijiu/jsview 1.9.887 → 1.9.909

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,31 +1,31 @@
1
- /*
2
- * JsView Added
3
- */
4
- 'use strict';
5
-
6
- const StyleName = require("./jsview-style-types").StyleName;
1
+ const { StyleName, StyleVariable } = require("./jsview-style-types");
7
2
 
8
3
  class StyleConverter {
9
4
  static ToInteger(value) {
5
+ if (StyleVariable.IsVariable(value)) {
6
+ return value;
7
+ }
8
+
10
9
  if (!value) {
11
10
  return value;
12
11
  }
13
- if (typeof value == "number") {
12
+ if (typeof value !== "string") {
14
13
  return Math.floor(value);
15
14
  }
16
15
 
17
- if (typeof value == "string") {
18
- const number = parseInt(value);
19
- if (number != value && value.endsWith('px') == false) {
20
- throw Error("Bad unit in value " + value);
21
- }
22
- return number;
16
+ value = StyleConverter.ExecIfCalc(value);
17
+ const ret = parseInt(value);
18
+ if (ret != value && value.endsWith('px') == false) {
19
+ throw Error("Bad unit in value " + value);
23
20
  }
24
-
25
- return value;
21
+ return ret;
26
22
  }
27
23
 
28
24
  static ToFloat(value) {
25
+ if (StyleVariable.IsVariable(value)) {
26
+ return value;
27
+ }
28
+
29
29
  if (!value) {
30
30
  return value;
31
31
  }
@@ -33,290 +33,47 @@ class StyleConverter {
33
33
  return value;
34
34
  }
35
35
 
36
+ value = StyleConverter.ExecIfCalc(value);
36
37
  let ret = parseFloat(value);
37
38
  return ret;
38
39
  }
39
40
 
40
- // static ToConst(value, defaultValue) {
41
- // if (typeof (value) == "symbol") {
42
- // return value;
43
- // }
44
-
45
- // if (!value) {
46
- // value = "";
47
- // }
48
-
49
- // if (value.includes('contain')) {
50
- // return StyleValue.ObjectFit.CONTAIN;
51
- // } else if (value.includes('cover')) {
52
- // return StyleValue.ObjectFit.COVER;
53
- // } else if (value.includes('fill')) {
54
- // return StyleValue.ObjectFit.FILL;
55
- // } else if (value.includes('none')) {
56
- // return StyleValue.ObjectFit.NONE;
57
- // } else if (value.includes('scale-down')) {
58
- // return StyleValue.ObjectFit.SCALEDOWN;
59
- // } else if (value.includes('hidden')) {
60
- // return StyleValue.Overflow.HIDDEN;
61
- // } else if (value.includes('visible')) {
62
- // return StyleValue.Overflow.VISIBLE;
63
- // }
64
-
65
- // return defaultValue; // default value
66
- // }
41
+ static ToString(value) {
42
+ if (StyleVariable.IsVariable(value)) {
43
+ return value;
44
+ }
67
45
 
68
- static ToString(value, upperCase) {
69
46
  if (!value) {
70
47
  return "";
71
48
  }
72
49
 
73
- if (upperCase) {
74
- value = value.toUpperCase();
75
- }
76
-
50
+ value = StyleConverter.ExecIfCalc(value);
77
51
  return value;
78
52
  }
79
53
 
80
-
81
- static ToRect(str) {
82
- let arrays = StyleConverter.SplitString(str, ' ');
83
-
84
- let rect = {
85
- top: arrays.length > 0 ? parseInt(arrays[0]) : 0,
86
- right: arrays.length > 1 ? parseInt(arrays[1]) : null,
87
- bottom: arrays.length > 2 ? parseInt(arrays[2]) : null,
88
- left: arrays.length > 3 ? parseInt(arrays[3]) : null,
89
- };
90
- rect.right = (!!rect.right || rect.right === 0 ? rect.right : rect.top);
91
- rect.bottom = (!!rect.bottom || rect.bottom === 0 ? rect.bottom : rect.top);
92
- rect.left = (!!rect.left || rect.left === 0 ? rect.left : rect.right);
93
- return rect;
94
- }
95
-
96
- static ToCorner(str) {
97
- let arrays = StyleConverter.SplitString(str, ' ');
98
-
99
- let rect = {
100
- topLeft: arrays.length > 0 ? parseInt(arrays[0]) : 0,
101
- topRight: arrays.length > 1 ? parseInt(arrays[1]) : null,
102
- bottomRight: arrays.length > 2 ? parseInt(arrays[2]) : null,
103
- bottomLeft: arrays.length > 3 ? parseInt(arrays[3]) : null,
104
- };
105
- rect.topRight = (!!rect.topRight || rect.topRight === 0 ? rect.topRight : rect.topLeft);
106
- rect.bottomRight = (!!rect.bottomRight || rect.bottomRight === 0 ? rect.bottomRight : rect.topLeft);
107
- rect.bottomLeft = (!!rect.bottomLeft || rect.bottomLeft === 0 ? rect.bottomLeft : rect.bottomRight);
108
- return rect;
109
- }
110
-
111
- static ToAnimation(str) {
112
- if (str === null || str.length === 0) {
113
- return null;
114
- }
115
-
116
- let bezierStart = str.indexOf('cubic-bezier');
117
- let arrays = [];
118
- if (bezierStart >= 0) { // 防止贝塞尔里面的空格被拆分
119
- let bezierEnd = str.indexOf(')');
120
- let bezierStr = str.substring(bezierStart, bezierEnd + 1);
121
- let bezierArray = StyleConverter.SplitString(str, bezierStr);
122
- for (let item of bezierArray) {
123
- let subArrays = StyleConverter.SplitString(item, ' ');
124
- arrays = arrays.concat(subArrays);
125
- }
126
- arrays.push(bezierStr);
127
- } else {
128
- arrays = StyleConverter.SplitString(str, ' ');
129
- }
130
-
131
- // 下面四个属性在animation字符串中是无序的,所以需要单独判断。
132
- let timingFunction = null;
133
- let delay = 0;
134
- let iterationCount = 1;
135
- let direction = str.includes("alternate");
136
- for (let idx = 2; idx < arrays.length; idx++) { // 前两个选项固定是name和duration
137
- if (arrays[idx] === "infinite") {
138
- iterationCount = -1; // -1表示无限循环
139
- continue;
140
- }
141
-
142
- let num = StyleConverter.ToTimeMs(arrays[idx]);
143
- if (isNaN(num) === false) { // 表示时间
144
- delay = num;
145
- } else {
146
- num = parseFloat(arrays[idx]);
147
- if (isNaN(num) === false) { // 表示次数
148
- iterationCount = num;
149
- } else { // 不是数字,直接赋给timingFunction,省略判断
150
- timingFunction = arrays[idx];
151
- }
152
- }
153
- }
154
-
155
- let duration = arrays.length > 1 ? StyleConverter.ToTimeMs(arrays[1]) : 0;
156
- let anim = {
157
- name: arrays.length > 0 ? arrays[0] : "",
158
- duration: duration,
159
- timingFunction: timingFunction,
160
- delay: delay,
161
- iterationCount: iterationCount,
162
- direction: direction,
163
- };
164
- // console.log("StyleConverter.ConvertAnimation() anim=", anim);
165
-
166
- return anim;
167
- }
168
-
169
- static ToTransition(str) {
170
- if (str == null || str.length == 0) {
171
- return null;
172
- }
173
- let transition = {};
174
- let arrays = new Array();
175
- let splitStr = str.split(',');
176
- for (let idx = 0; idx < splitStr.length; idx++) {
177
- if (splitStr[idx].indexOf('(') >= 0) { // 如果包含"(", 则将直到")"为止的内容当作一个部分
178
- let endIdx = idx;
179
- while (endIdx < splitStr.length && splitStr[endIdx].indexOf(')') < 0) { // 没有包含")"
180
- endIdx++;
181
- }
182
- let concatStr = "";
183
- for (let subIdx = idx; subIdx <= endIdx; subIdx++) {
184
- if (subIdx != idx) {
185
- concatStr += ",";
186
- }
187
- concatStr += splitStr[subIdx];
188
- }
189
- idx = endIdx;
190
- arrays = arrays.concat(concatStr);
191
- } else {
192
- arrays = arrays.concat(splitStr[idx]);
193
- }
194
- }
195
- // console.warn("StyleConverter.ConvertTransition() arrays=" + JSON.stringify(arrays));
196
- for (let item of arrays) {
197
- let ret = StyleConverter.ConvertAnimation(item);
198
- transition[ret.name] = ret;
199
- if (ret.name == "all") {
200
- let allProps = new Array("opacity", "left", "top", "width", "height", "transform");
201
- for (let prop of allProps) {
202
- transition[prop] = ret;
203
- }
204
- }
205
- }
206
- return transition;
207
- }
208
-
209
- // static ConvertEasing(str, duration) {
210
- // let easing = Forge.Easing.Circular.InOut;
211
- // if (!str) {
212
- // return easing;
213
- // }
214
-
215
- // if (str.includes('ease')) { // 加速用
216
- // if (str.includes('-in-out')) {
217
- // easing = Forge.Easing.Circular.InOut;
218
- // } else if (str.includes('-out')) {
219
- // easing = Forge.Easing.Circular.Out;
220
- // } else if (str.includes('-in')) {
221
- // easing = Forge.Easing.Circular.In;
222
- // } else {
223
- // easing = Forge.Easing.Circular.InOut;
224
- // }
225
- // } else if (str.includes('linear')) {
226
- // easing = null; // null是匀速动画
227
- // } else if (str.includes('cubic-bezier')) {
228
- // let bezier = StyleConverter.ConvertBezier(str);
229
- // easing = new Forge.BezierEasing(bezier.x1, bezier.y1, bezier.x2, bezier.y2, duration);
230
- // } else if (str.includes("steps")) {
231
- // let steps = StyleConverter.ConvertSteps(str);
232
- // easing = new Forge.StepsEasing(steps.steps, steps.type);
233
- // }
234
-
235
- // // console.log("StyleConverter.ConvertEasing() easing=" + JSON.stringify(easing.Package()));
236
- // return easing;
237
- // }
238
-
239
- static ConvertBezier(str) {
240
- let startIdx = str.indexOf('(');
241
- if (startIdx >= 0) {
242
- str = str.substring(startIdx + 1);
243
- }
244
-
245
- let arrays = StyleConverter.SplitString(str, ',');
246
-
247
- let bezier = {
248
- x1: arrays.length > 0 ? parseFloat(arrays[0]) : 0,
249
- y1: arrays.length > 1 ? parseFloat(arrays[1]) : 0,
250
- x2: arrays.length > 2 ? parseFloat(arrays[2]) : 0,
251
- y2: arrays.length > 3 ? parseFloat(arrays[3]) : 0,
252
- };
253
- return bezier;
254
- }
255
-
256
- static ConvertSteps(str) {
257
- let startIdx = str.indexOf('(');
258
- if (startIdx >= 0) {
259
- str = str.substring(startIdx + 1);
260
- }
261
- let arrays = StyleConverter.SplitString(str, ',');
262
- return {
263
- steps: arrays.length > 0 ? parseInt(arrays[0]) : 1,
264
- type: arrays.length > 1 ? (arrays[1].includes("start") ? 0 : 1) : 0,
54
+ static ExecIfCalc(value) {
55
+ if (typeof value !== "string") {
56
+ return value;
265
57
  }
266
- }
267
58
 
268
- static SplitString(from, sep) {
269
- if (!from) {
270
- from = "";
271
- }
272
- let arrays = from.trim().split(sep);
273
- if (sep !== ' ') {
274
- return arrays;
59
+ const isCalc = (value.startsWith("calc("));
60
+ if (!isCalc) {
61
+ return value;
275
62
  }
276
63
 
277
- //去除多个空格的条件下的影响
278
- let ret = [];
279
- for (let item of arrays) {
280
- if (!item) {
281
- continue;
282
- }
283
-
284
- ret.push(item);
64
+ const expr = value.replace(/calc(\(.*\))/, '$1')
65
+ let ret = null;
66
+ try {
67
+ ret = eval(expr);
68
+ } catch (ex) {
69
+ console.error("Failed to exec StyleConverter.ExecIfCalc(" + value + ")");
70
+ throw ex;
285
71
  }
286
72
 
73
+ console.log('execIfCalc() value=', value, " ret=", ret);
287
74
  return ret;
288
75
  }
289
76
 
290
- static ToTimeMs(str) {
291
- if (!str) {
292
- str = "";
293
- }
294
- str = str.trim();
295
-
296
- let timing = NaN;
297
- if (str.endsWith('ms')) {
298
- timing = 1;
299
- } else if (str.endsWith('s')) {
300
- timing = 1000;
301
- }
302
- timing *= parseFloat(str);
303
-
304
- return timing;
305
- }
306
-
307
- static ToInset(value) {
308
- if (!value
309
- || value.startsWith('inset') === false) {
310
- console.error("JsView Error: Failed to convert inset, InvalidArgs: value=", value);
311
- return null;
312
- }
313
-
314
- let idx = value.indexOf('(') + 1;
315
- let edgeValue = value.substring(idx);
316
- let rect = StyleConverter.ToRect(edgeValue);
317
-
318
- return rect
319
- }
320
77
  }
321
78
 
322
79
  class StyleFormatter {
@@ -324,51 +81,51 @@ class StyleFormatter {
324
81
  let formattedValue = propValue;
325
82
 
326
83
  switch (propName) {
327
- case StyleName.Height:
328
- case StyleName.Left:
329
- case StyleName.Top:
330
- case StyleName.Width:
84
+ case StyleName.Layout.Height:
85
+ case StyleName.Layout.Left:
86
+ case StyleName.Layout.Top:
87
+ case StyleName.Layout.Width:
331
88
  formattedValue = StyleFormatter.#GetLayoutValue(propName, propValue);
332
89
  break;
333
- case StyleName.BackgroundColor:
334
- case StyleName.BackgroundImage:
335
- case StyleName.BorderRadius:
90
+ case StyleName.Background.BackgroundColor:
91
+ case StyleName.Background.BackgroundImage:
92
+ case StyleName.Background.BorderRadius:
336
93
  formattedValue = StyleFormatter.#GetBackgroundValue(propName, propValue);
337
94
  break;
338
- case StyleName.BackfaceVisibility:
339
- case StyleName.BorderImage:
340
- case StyleName.BorderImageWidth:
341
- case StyleName.BorderImageOutset:
342
- case StyleName.ClipPath:
343
- case StyleName.Display:
344
- case StyleName.ObjectFit:
345
- case StyleName.Opacity:
346
- case StyleName.Overflow:
347
- case StyleName.Perspective:
348
- case StyleName.PerspectiveOrigin:
349
- case StyleName.Visibility:
350
- case StyleName.ZIndex:
95
+ case StyleName.Effect.BackfaceVisibility:
96
+ case StyleName.Effect.BorderImage:
97
+ case StyleName.Effect.BorderImageWidth:
98
+ case StyleName.Effect.BorderImageOutset:
99
+ case StyleName.Effect.ClipPath:
100
+ case StyleName.Effect.Display:
101
+ case StyleName.Effect.ObjectFit:
102
+ case StyleName.Effect.Opacity:
103
+ case StyleName.Effect.Overflow:
104
+ case StyleName.Effect.Perspective:
105
+ case StyleName.Effect.PerspectiveOrigin:
106
+ case StyleName.Effect.Visibility:
107
+ case StyleName.Effect.ZIndex:
351
108
  formattedValue = StyleFormatter.#GetEffectValue(propName, propValue);
352
109
  break;
353
- case StyleName.Color:
354
- case StyleName.FontFamily:
355
- case StyleName.FontSize:
356
- case StyleName.FontStyle:
357
- case StyleName.FontWeight:
358
- case StyleName.LineHeight:
359
- case StyleName.TextAlign:
360
- case StyleName.TextShadow:
361
- case StyleName.TextOverflow:
362
- case StyleName.WebkitTextStroke:
363
- case StyleName.WhiteSpace:
364
- case StyleName.WordWrap:
110
+ case StyleName.Text.Color:
111
+ case StyleName.Text.FontFamily:
112
+ case StyleName.Text.FontSize:
113
+ case StyleName.Text.FontStyle:
114
+ case StyleName.Text.FontWeight:
115
+ case StyleName.Text.LineHeight:
116
+ case StyleName.Text.TextAlign:
117
+ case StyleName.Text.TextShadow:
118
+ case StyleName.Text.TextOverflow:
119
+ case StyleName.Text.WebkitTextStroke:
120
+ case StyleName.Text.WhiteSpace:
121
+ case StyleName.Text.WordWrap:
365
122
  formattedValue = StyleFormatter.#GetTextValue(propName, propValue);
366
123
  break;
367
- case StyleName.Animation:
368
- case StyleName.Transform:
369
- case StyleName.TransformOrigin:
370
- case StyleName.TransformStyle:
371
- case StyleName.Transition:
124
+ case StyleName.Motion.Animation:
125
+ case StyleName.Motion.Transform:
126
+ case StyleName.Motion.TransformOrigin:
127
+ case StyleName.Motion.TransformStyle:
128
+ case StyleName.Motion.Transition:
372
129
  formattedValue = StyleFormatter.#GetMotionValue(propName, propValue);
373
130
  break;
374
131
  default:
@@ -389,9 +146,6 @@ class StyleFormatter {
389
146
  static #GetBackgroundValue(propName, propValue) {
390
147
  let formattedValue = null;
391
148
  switch (propName) {
392
- case StyleName.BorderRadius:
393
- formattedValue = StyleConverter.ToCorner(propValue);
394
- break;
395
149
  default:
396
150
  formattedValue = StyleConverter.ToString(propValue);
397
151
  break;
@@ -403,13 +157,14 @@ class StyleFormatter {
403
157
  static #GetEffectValue(propName, propValue) {
404
158
  let formattedValue = null;
405
159
  switch (propName) {
406
- case StyleName.Display:
407
- case StyleName.Overflow:
408
- case StyleName.Visibility:
160
+ case StyleName.Effect.ClipPath:
161
+ case StyleName.Effect.Display:
162
+ case StyleName.Effect.Overflow:
163
+ case StyleName.Effect.Visibility:
409
164
  formattedValue = StyleConverter.ToString(propValue);
410
165
  break;
411
- case StyleName.ClipPath:
412
- formattedValue = StyleConverter.ToInset(propValue);
166
+ case StyleName.Effect.Opacity:
167
+ formattedValue = StyleConverter.ToFloat(propValue);
413
168
  break;
414
169
  default:
415
170
  formattedValue = StyleConverter.ToInteger(propValue);
@@ -422,8 +177,8 @@ class StyleFormatter {
422
177
  static #GetTextValue(propName, propValue) {
423
178
  let formattedValue = null;
424
179
  switch (propName) {
425
- case StyleName.FontSize:
426
- case StyleName.LineHeight:
180
+ case StyleName.Text.FontSize:
181
+ case StyleName.Text.LineHeight:
427
182
  formattedValue = StyleConverter.ToInteger(propValue);
428
183
  break;
429
184
  default:
@@ -443,4 +198,4 @@ class StyleFormatter {
443
198
 
444
199
  }
445
200
 
446
- exports.getFormattedValue = StyleFormatter.GetFormattedValue;
201
+ exports.getFormattedValue = StyleFormatter.GetFormattedValue;
@@ -1,91 +1,80 @@
1
- /*
2
- * JsView Added
3
- */
4
- 'use strict';
1
+ class StyleName {
2
+ static Layout = class {
3
+ static Height = "height";
4
+ static Left = "left";
5
+ static Top = "top";
6
+ static Width = "width";
5
7
 
6
- // export const StyleGroup = {
7
- // Layout: 'layout',
8
- // Background: 'background',
9
- // Effect: 'effect',
10
- // Text: 'text',
11
- // Motion: 'motion',
12
- // }
8
+ constructor() { throw new Error("new StyleName.Layout() is forbidden."); }
9
+ }
13
10
 
14
- const StyleName = {
15
- // Layout
16
- Height: 'height',
17
- Left: 'left',
18
- Top: 'top',
19
- Width: 'width',
20
- // Bottom : 'bottom',
21
- // Right : 'right',
11
+ static Background = class {
12
+ static BackgroundColor = "backgroundColor";
13
+ static BackgroundImage = "backgroundImage";
14
+ static BorderRadius = "borderRadius";
22
15
 
23
- // Background
24
- BackgroundColor: 'backgroundColor',
25
- BackgroundImage: 'backgroundImage',
26
- BorderRadius: 'borderRadius',
16
+ constructor() { throw new Error("new StyleName.Background() is forbidden."); }
17
+ }
27
18
 
28
- // Effect
29
- BackfaceVisibility: 'backfaceVisibility',
30
- BorderImage: 'borderImage',
31
- BorderImageWidth: 'borderImageWidth',
32
- BorderImageOutset: 'borderImageOutset',
33
- ClipPath: 'clipPath',
34
- Color: 'color',
35
- Display: 'display',
36
- ObjectFit: 'objectFit',
37
- Opacity: 'opacity',
38
- Overflow: 'overflow',
39
- Perspective: 'perspective',
40
- PerspectiveOrigin: 'perspectiveOrigin',
41
- Visibility: 'visibility',
42
- ZIndex: 'zIndex',
19
+ static Effect = class {
20
+ static BackfaceVisibility = "backfaceVisibility";
21
+ static BorderImage = "borderImage";
22
+ static BorderImageWidth = "borderImageWidth";
23
+ static BorderImageOutset = "borderImageOutset";
24
+ static ClipPath = "clipPath";
25
+ static Display = "display";
26
+ static ObjectFit = "objectFit";
27
+ static Opacity = "opacity";
28
+ static Overflow = "overflow";
29
+ static Perspective = "perspective";
30
+ static PerspectiveOrigin = "perspectiveOrigin";
31
+ static Transform = "transform";
32
+ static TransformOrigin = "transformOrigin";
33
+ static TransformStyle = "transformStyle";
34
+ static Visibility = "visibility";
35
+ static ZIndex = "zIndex";
43
36
 
44
- // Text
45
- FontFamily: 'fontFamily',
46
- FontSize: 'fontSize',
47
- FontStyle: 'fontStyle',
48
- FontWeight: 'fontWeight',
49
- LineHeight: 'lineHeight',
50
- TextAlign: 'textAlign',
51
- TextShadow: 'textShadow',
52
- TextOverflow: 'textOverflow',
53
- WebkitTextStroke: 'WebkitTextStroke',
54
- WhiteSpace: 'whiteSpace',
55
- WordWrap: 'wordWrap',
56
- JsvTextEmoji: 'JsvTextEmoji',
37
+ constructor() { throw new Error("new StyleName.Effect() is forbidden."); }
38
+ }
57
39
 
58
- // Motion
59
- Animation: 'animation',
60
- Transform: 'transform',
61
- TransformOrigin: 'transformOrigin',
62
- TransformStyle: 'transformStyle',
63
- Transition: 'transition',
64
- }
40
+ static Text = class {
41
+ static Color = "color";
42
+ static FontFamily = "fontFamily";
43
+ static FontSize = "fontSize";
44
+ static FontStyle = "fontStyle";
45
+ static FontWeight = "fontWeight";
46
+ static LineHeight = "lineHeight";
47
+ static TextAlign = "textAlign";
48
+ static TextOverflow = "textOverflow";
49
+ static TextShadow = "textShadow";
50
+ static WebkitTextStroke = "WebkitTextStroke";
51
+ static WhiteSpace = "whiteSpace";
52
+ static WordWrap = "wordWrap";
53
+ static JsvTextEmoji = "JsvTextEmoji";
54
+
55
+ constructor() { throw new Error("new StyleName.Text() is forbidden."); }
56
+ }
65
57
 
58
+ static Motion = class {
59
+ static Animation = "animation";
60
+ static Transition = "transition";
66
61
 
67
- // export const StyleValue = {
68
- // Overflow: {
69
- // Hidden: 'hidden',
70
- // Visible: 'visible',
71
- // },
62
+ constructor() { throw new Error("new StyleName.Motion() is forbidden."); }
63
+ }
72
64
 
73
- // ObjectFit: {
74
- // Fill: Symbol('fill'),
75
- // Contain: Symbol('contain'),
76
- // Cover: Symbol('cover'),
77
- // None: Symbol('none'),
78
- // Scaledown: Symbol('scale-down'),
79
- // },
80
- // }
65
+ constructor() { throw new Error("new StyleName() is forbidden."); }
66
+ }
81
67
 
82
- // export class StyleType {
83
- // static IsVariable(value) {
84
- // const isVar = ( typeof (value) === "string"
85
- // && (value.startsWith('--') || value.startsWith('var(--')));
68
+ class StyleVariable {
69
+ static IsVariable(value) {
70
+ let variable = value.toString();
86
71
 
87
- // return isVar;
88
- // }
89
- // }
72
+ const isVar = (variable.startsWith("--") || variable.startsWith("var(--"));
73
+ return isVar;
74
+ }
75
+
76
+ constructor() { throw new Error("new StyleVariable() is forbidden."); }
77
+ }
90
78
 
91
79
  exports.StyleName = StyleName;
80
+ exports.StyleVariable = StyleVariable;
@@ -5126,7 +5126,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5126
5126
 
5127
5127
  // 释放renderBreak时,创建出来的占位element
5128
5128
  if (n1.el) {
5129
- n1.el.parentElement.removeChild(n1.el);
5129
+ n1.el.parentNode.removeChild(n1.el);
5130
5130
  n1.el = null;
5131
5131
  }
5132
5132
 
@@ -6237,7 +6237,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6237
6237
  // 但是 mount 状态需要进行记录,避免由于RenderBreaker引起子节点未patch因为无法umount状态
6238
6238
 
6239
6239
  if (vnode.jsvRenderBreaker?.breaked) {
6240
- vnode.el.parentElement.removeChild(vnode.el);
6240
+ vnode.el.parentNode.removeChild(vnode.el);
6241
6241
  vnode.el = null;
6242
6242
  vnode.anchor = null;
6243
6243
  vnode.jsvRenderBreaker = null;