@shijiu/jsview-vue 1.9.650 → 1.9.719

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.
Files changed (157) hide show
  1. package/package.json +7 -18
  2. package/samples/AnimPicture/App.vue +5 -5
  3. package/samples/Basic/components/div/DivLayout.vue +1 -1
  4. package/samples/Basic/components/text/TextOverflow.vue +10 -5
  5. package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
  6. package/samples/Collision/App.vue +452 -0
  7. package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
  8. package/samples/DemoHomepage/router.js +21 -1
  9. package/samples/DemoHomepage/views/Homepage.vue +3 -7
  10. package/samples/FilterDemo/App.vue +1 -1
  11. package/samples/FlipCard/App.vue +2 -2
  12. package/samples/FlipCard/FlipCard.vue +2 -2
  13. package/samples/GridDemo/App.vue +3 -3
  14. package/samples/GridDemo/ButtonBlock.vue +2 -2
  15. package/samples/GridDemo/FocusItem.vue +2 -2
  16. package/samples/GridDemo/Item.vue +1 -1
  17. package/samples/HashHistory/App.vue +10 -3
  18. package/samples/HashHistory/components/Item.vue +1 -1
  19. package/samples/ImpactStop/App.vue +435 -0
  20. package/samples/Input/App.vue +8 -17
  21. package/samples/Input/InputPanel.vue +19 -12
  22. package/samples/LongImage/Button.vue +1 -1
  23. package/samples/LongImage/ButtonItem.vue +1 -1
  24. package/samples/LongImage/LongImageScroll.vue +2 -2
  25. package/samples/LongText/App.vue +1 -1
  26. package/samples/LongText/Button.vue +1 -1
  27. package/samples/LongText/ButtonItem.vue +1 -1
  28. package/samples/LongText/LongTextScroll.vue +3 -3
  29. package/samples/Marquee/App.vue +176 -40
  30. package/samples/Marquee/longText.js +14 -0
  31. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  32. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +3 -3
  33. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  34. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  35. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  36. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  37. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  38. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  39. package/samples/MetroWidgetDemos/Item.vue +20 -2
  40. package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
  41. package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
  42. package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +1 -1
  43. package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
  44. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
  45. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
  46. package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +3 -11
  47. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
  48. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  49. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  50. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
  51. package/samples/MetroWidgetDemos/WidgetItem.vue +2 -2
  52. package/samples/MetroWidgetDemos/data.js +2 -1
  53. package/samples/NinePatchDemo/App.vue +2 -2
  54. package/samples/NinePatchDemo/Item.vue +1 -1
  55. package/samples/Preload/App.vue +17 -12
  56. package/samples/Preload/Item.vue +1 -1
  57. package/samples/QrcodeDemo/App.vue +1 -1
  58. package/samples/ScaleDownNeon/App.vue +107 -0
  59. package/samples/SoundPool/App.vue +1 -1
  60. package/samples/TextBox/App.vue +9 -82
  61. package/samples/TextBox/RenderCenter.vue +40 -16
  62. package/samples/TextBox/RenderLeft.vue +48 -19
  63. package/samples/TextBox/RenderOneLine.vue +30 -49
  64. package/samples/TextBox/RenderRight.vue +40 -16
  65. package/samples/TextShadowDemo/App.vue +11 -17
  66. package/samples/TextureAnimation/App2.vue +43 -15
  67. package/samples/TextureAnimation/assets/light.png +0 -0
  68. package/samples/TextureAnimation/assets/light2.png +0 -0
  69. package/samples/TextureSize/App.vue +3 -3
  70. package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
  71. package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
  72. package/samples/TransitPage/App.vue +1 -1
  73. package/samples/VideoDemo/App.vue +8 -8
  74. package/samples/VideoDemo/components/Button.vue +1 -1
  75. package/samples/VisibleSensorDemo/App.vue +94 -27
  76. package/tsconfig.json +6 -6
  77. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +55 -59
  78. package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
  79. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  80. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +226 -107
  81. package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
  82. package/utils/JsViewEngineWidget/WidgetCommon.js +13 -5
  83. package/utils/JsViewEngineWidget/index.js +3 -2
  84. package/utils/JsViewPlugin/BrowserPluginLoader.js +1 -1
  85. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
  86. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +23 -2
  87. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +1 -1
  88. package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
  89. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  90. package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
  91. package/utils/JsViewVueTools/JsvStyleClass.js +1 -1
  92. package/utils/JsViewVueTools/index.js +2 -1
  93. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
  94. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
  95. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +7 -9
  96. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
  97. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +3 -3
  98. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
  99. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +5 -5
  100. package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
  101. package/utils/JsViewVueWidget/JsvGrid.vue +3 -11
  102. package/utils/JsViewVueWidget/JsvInput/Cursor.vue +5 -3
  103. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +15 -14
  104. package/utils/JsViewVueWidget/JsvMarquee.vue +180 -207
  105. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -2
  106. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  107. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  108. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +38 -42
  109. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  110. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  111. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +24 -8
  112. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
  113. package/utils/JsViewVueWidget/JsvTextBox.vue +20 -86
  114. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -9
  115. package/utils/JsViewVueWidget/JsvTouchContainer.vue +6 -7
  116. package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
  117. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +6 -6
  118. package/utils/JsViewVueWidget/index.js +8 -8
  119. package/utils/JsViewVueWidget/utils/index.js +8 -0
  120. package/utils/JsViewVueWidget/utils/text.js +19 -0
  121. package/dom/bin/jsview-browser-debug-dom.min.js +0 -1
  122. package/dom/bin/jsview-dom.min.js +0 -1
  123. package/dom/bin/jsview-forge-define.min.js +0 -1
  124. package/dom/browser-root-style.css +0 -21
  125. package/dom/jsv-browser-debug-dom.js +0 -8
  126. package/dom/jsv-dom.js +0 -6
  127. package/dom/jsv-forge-define.js +0 -6
  128. package/dom/target_core_revision.mjs +0 -15
  129. package/loader/header_script_loader.js +0 -134
  130. package/loader/jsview-main.js +0 -42
  131. package/loader/jsview.config.default.js +0 -37
  132. package/loader/jsview.default.config.js +0 -37
  133. package/loader/loader.js +0 -179
  134. package/loader/loader_webkit.js +0 -40
  135. package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17609
  136. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -335
  137. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +0 -446
  138. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +0 -91
  139. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8038
  140. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1700
  141. package/patches/node_modules/postcss-js/objectifier.js +0 -90
  142. package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +0 -63147
  143. package/patches/node_modules/vite/dist/node/jsview.vite.config.js +0 -53
  144. package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3595
  145. package/scripts/common.js +0 -58
  146. package/scripts/jsview-install-local-packages.js +0 -73
  147. package/scripts/jsview-jsmap-serve.js +0 -105
  148. package/scripts/jsview-post-build.js +0 -183
  149. package/scripts/jsview-post-install.js +0 -102
  150. package/scripts/jsview-run-android.js +0 -67
  151. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  152. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  153. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  154. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  155. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  156. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  157. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -1,335 +0,0 @@
1
- /*
2
- * JsView Added
3
- */
4
- 'use strict';
5
-
6
- Object.defineProperty(exports, '__esModule', { value: true });
7
-
8
- const crypto = require('crypto');
9
- var fs = require('fs');
10
- var path = require('path');
11
- var postCss = require('postcss');
12
- var postCssJs = require('postcss-js');
13
- var postCssImport = require('postcss-import-sync');
14
- const compilerSfc = require("./compiler-sfc.cjs");
15
- const styleFormat = require("./jsview-style-format");
16
-
17
- var nodeModulesDir = path.resolve(process.cwd(), 'node_modules')
18
- var cachedCssStyles = {}
19
-
20
- function ensureSfcDescriptor(descriptor) {
21
- try {
22
- ensureSfcDescriptorImpl(descriptor)
23
- } catch (exception) {
24
- console.error("Failed to call ensureSfcDescriptor()! Exception:\n", exception);
25
- }
26
- }
27
-
28
- function compileCssToJs(sfc, options) {
29
- try {
30
- return compileCssToJsImpl(sfc, options)
31
- } catch (exception) {
32
- console.error("Failed to call compileCssToJs()! Exception:\n", exception);
33
- }
34
- }
35
-
36
- function compileAndSaveImportedNode(styleFilePath, styleNodes) {
37
- try {
38
- return compileAndSaveImportedNodeImpl(styleFilePath, styleNodes)
39
- } catch (exception) {
40
- console.error("Failed to call compileAndSaveImportedNode()! Exception:\n", exception);
41
- }
42
- }
43
-
44
- function ensureSfcDescriptorImpl(descriptor) {
45
- // 如果css-style不存在,不做任何事
46
- if(descriptor.styles.length <= 0) {
47
- return;
48
- }
49
-
50
- // 为了将css-style植入到script中,script或scriptSetup必须存在一个
51
- if(!!descriptor.script
52
- || !!descriptor.scriptSetup) {
53
- return;
54
- }
55
-
56
- // 为了触发compiler-sfc.cjs.compileScript()
57
- // 如果script和scriptSetup都不存在,就做一个空的
58
- // console.log("JsView: insert a empty script.");
59
- descriptor.script = {
60
- type: 'script',
61
- content: "export default {}\n",
62
- loc: {
63
- source: "",
64
- start: { column: 0, line: 0, offset: 0 },
65
- end: { column: 0, line: 0, offset: 0}
66
- },
67
- attrs: {},
68
- map: {
69
- version: 3,
70
- sources: [],
71
- names: [],
72
- mappings: '',
73
- // file: null,
74
- sourceRoot: '',
75
- sourcesContent: []
76
- }
77
- };
78
- }
79
-
80
- function compileCssToJsImpl(sfc, options) {
81
- if(sfc.styles.length <= 0) {
82
- return ""
83
- }
84
-
85
- let compileStyleOptions = {
86
- filename: sfc.filename,
87
- id: `data-v-${options.id}`,
88
- // map: null,
89
- trim: true,
90
- isProd: options.isProd,
91
-
92
- source: null,
93
- scoped: false,
94
- modules: false,
95
- };
96
- // let styleCodeContainer = new Set();
97
- let styleContentContainer = "";
98
- let styleImportContainer = "";
99
- sfc.styles.forEach(style => {
100
- if(!!style.module) {
101
- let errMsg = "JsView: style module is not released by Vue3!\n";
102
- errMsg += style;
103
- console.error(errMsg + " errors =", errors);
104
- throw new Error(errMsg)
105
- }
106
- compileStyleOptions.source = style.content
107
- if(!!style.attrs.src) { // 处理<style [scoped] src="xxx">
108
- const baseDir = path.dirname(sfc.filename);
109
- const cssSrcPath = path.resolve(baseDir, style.attrs.src);
110
- compileStyleOptions.source = fs.readFileSync(cssSrcPath, "utf8");
111
- }
112
- compileStyleOptions.scoped = style.scoped
113
- compileStyleOptions.modules = style.module
114
- const { rawResult, errors } = compilerSfc.compileStyle(compileStyleOptions)
115
- if(errors.length) {
116
- const errMsg = "JsView: Failed to compile style when convert css to js!";
117
- console.error(errMsg + " errors =", errors);
118
- throw new Error(errMsg)
119
- }
120
-
121
- const styleNodes = rawResult.result.root.nodes;
122
- styleNodes.forEach(node => {
123
- // console.log('node=', node)
124
- // console.log('node.type=', node.type, "node.name=", node.name, "node.selector=", node.selector);
125
-
126
- if (node.type === "comment") {
127
- // DO NOTHING
128
- } else if(node.name === "import") {
129
- const styleInfo = compileImportNode(node);
130
- // styleCodeContainer.add(styleCode);
131
-
132
- checkSelectors(node, styleInfo.styleFilePath, styleInfo.styleSelectors); // 检测selector是否已经处理过
133
- let styleJsFilePath = path.relative(nodeModulesDir, styleInfo.styleJsFilePath);
134
- styleJsFilePath = styleJsFilePath.replace(/\\/g, '/');
135
- styleImportContainer += `\nimport "/${path.basename(nodeModulesDir)}/${styleJsFilePath}";`
136
- } else if(node.name === "keyframes") {
137
- const styleFilePath = node.source.input.file;
138
- const styleSelectors = new Set([node.params]);
139
- const styleContent = compileKeyframesNode(node);
140
-
141
- checkSelectors(node, styleFilePath, styleSelectors); // 检测selector是否已经处理过
142
- styleContentContainer += styleContent;
143
- } else if(!!node.selector) {
144
- const styleFilePath = node.source.input.file;
145
- const styleSelectors = new Set([node.selector]);
146
- const styleContent = compileSelectorNode(node);
147
-
148
- checkSelectors(node, styleFilePath, styleSelectors); // 检测selector是否已经处理过
149
- styleContentContainer += styleContent;
150
- } else {
151
- check(false, node.source.input.css, "JsView Error: Unsupported css node.");
152
- }
153
- })
154
- })
155
-
156
- let jsvStyleSheets = styleImportContainer;
157
- jsvStyleSheets += "\nObject.assign(window.JsvCode.Dom.StyleSheets, {";
158
- jsvStyleSheets += styleContentContainer;
159
- jsvStyleSheets += "});\n";
160
-
161
- // 用于@import的css hotload,但是没有生效
162
- // styleCodeContainer.forEach(styleCode => {
163
- // jsvStyleSheets += styleCode + "\n";
164
- // });
165
-
166
- // console.log('jsview-css-to-js.compileCssToJs() jsvStyleSheets=' + jsvStyleSheets)
167
- return jsvStyleSheets;
168
- }
169
-
170
- function checkSelectors(node, styleFilePath, styleSelectors) {
171
- for(let cachedFilePath in cachedCssStyles) {
172
- if(cachedFilePath == styleFilePath) {
173
- continue;
174
- }
175
-
176
- const cachedSelectors = cachedCssStyles[cachedFilePath];
177
- for(let selector of cachedSelectors) {
178
- if(styleSelectors.has(selector)) { // 发现重复的selector
179
- let errMsg = "JsView Warn: Multi defined CSS selector '" + selector + "' from " + node.source.input.file + ".\n";
180
- errMsg += "It has been defined in " + cachedFilePath + ".\n";
181
- check(false, node.source.input.css, errMsg);
182
- }
183
- }
184
- }
185
-
186
- // 添加到缓存
187
- let cachedSelectors = cachedCssStyles[styleFilePath];
188
- if(!cachedSelectors) {
189
- cachedSelectors = new Set()
190
- }
191
- cachedSelectors = new Set([...cachedSelectors, ...styleSelectors]);
192
- cachedCssStyles[styleFilePath] = cachedSelectors;
193
- }
194
-
195
- function check(expr, source, errMsg) {
196
- if(!expr) {
197
- errMsg += (" source is: \n" + source);
198
- console.error("\n" + errMsg);
199
- throw new Error(errMsg);
200
- }
201
- }
202
-
203
- function compileImportNode(node) {
204
- const name = node.name;
205
- check(name, node.source.input.css, "JsView Error: name is not found!");
206
-
207
- check(name === "import", node.source.input.css, "JsView Error: @import name is not found!");
208
-
209
- let result = null;
210
- try {
211
- const plugins = [].slice();
212
- plugins.push(postCssImport)
213
-
214
- const content = node.source.input.css.slice(node.source.start.offset, node.source.end.offset + 1);
215
- check(content.endsWith(";"), "JsView Error: Failed to parse @import, please end with ';'")
216
-
217
- const options = {
218
- from: node.source.input.file
219
- };
220
-
221
- result = postCss(plugins).process(content, options);
222
- } catch (e) {
223
- console.log('JsView Error: Failed to compile css import node.', e);
224
- throw e;
225
- }
226
-
227
- const sourceDir = path.dirname(node.source.input.file);
228
- let styleFileName = node.params.replace(/^["'](.+(?=["']$))["']$/, '$1')
229
- const styleFilePath = path.resolve(sourceDir, styleFileName);
230
- return compileAndSaveImportedNodeImpl(styleFilePath, result.root.nodes);
231
- }
232
-
233
- function compileAndSaveImportedNodeImpl(styleFilePath, styleNodes) {
234
- let styleSelectors = new Set();
235
- let styleContent = "";
236
-
237
- styleNodes.forEach(node => {
238
- if(node.name === "keyframes") {
239
- styleContent += compileKeyframesNode(node);
240
- } else if(!!node.selector) {
241
- styleContent += compileSelectorNode(node);
242
- styleSelectors.add(node.selector);
243
- } else {
244
- check(false, node.source.input.css, "JsView Error: Unsupported css node from import css file.");
245
- }
246
- })
247
-
248
- // 保存到js文件并import到script中
249
- const cacheDir = path.resolve(nodeModulesDir, '@shijiu', '.cache')
250
- if (!fs.existsSync(cacheDir)) {
251
- fs.mkdirSync(cacheDir);
252
- }
253
- const styleFilePathHash = crypto.createHash('md5').update(styleFilePath).digest('hex').substring(0, 8);
254
- const styleJsFileName = path.basename(styleFilePath) + '.' + styleFilePathHash + '.js';
255
- const styleJsFilePath = path.join(cacheDir, styleJsFileName);
256
-
257
- styleContent = "\nObject.assign(window.JsvCode.Dom.StyleSheets, {" + styleContent;
258
- styleContent += "});\n";
259
- fs.writeFileSync(styleJsFilePath, styleContent, "utf8");
260
-
261
- return {
262
- styleFilePath,
263
- styleSelectors,
264
- styleJsFilePath
265
- };
266
- }
267
-
268
- function getStringOffset(source, line, column) {
269
- check(!isNaN(line), source, "JsView Error: Failed to get string offset, line is NaN.");
270
- check(!isNaN(column), source, "JsView Error: Failed to get string offset, column is NaN.");
271
-
272
- line -= 1;
273
- column -= 1;
274
-
275
- var offset = 0;
276
- for (var idx = 0; idx < line; idx++) {
277
- offset = source.indexOf('\n', offset + 1);
278
- check(offset >= 0, source, "JsView Error: Failed to get string offset, line=" + line + ", column=" + column);
279
- }
280
- offset += column;
281
-
282
- return offset;
283
- }
284
-
285
- function compileKeyframesNode(node) {
286
- const name = node.name;
287
- check(name, node.source.input.css, "JsView Error: name is not found!");
288
-
289
- check(name === "keyframes", node.source.input.css, "JsView Error: @keyframes name is not found!");
290
-
291
- let startOffset = node.source.start.offset;
292
- let endOffset = node.source.end.offset;
293
- if (typeof (startOffset) == 'undefined') {
294
- startOffset = getStringOffset(node.source.input.css, node.source.start.line, node.source.start.column);
295
- }
296
- if (typeof (endOffset) == 'undefined') {
297
- endOffset = getStringOffset(node.source.input.css, node.source.end.line, node.source.end.column);
298
- }
299
- const content = node.source.input.css.slice(startOffset, endOffset + 1);
300
- // console.log('jsview-css-to-js.compileKeyframesNode() \n', startOffset, endOffset, content);
301
-
302
- let styleContent = "'" + node.params + "':'";
303
- styleContent += content.replace(/(\r|\n|\r\n)/g, " ");
304
- styleContent += "',";
305
-
306
- // console.log('jsview-css-to-js.compileKeyframesNode() return ' + styleContent);
307
- return styleContent
308
- }
309
-
310
- function compileSelectorNode(node) {
311
- const selector = node.selector;
312
- check(selector, node.source.input.css, "JsView Error: Selector is not found!");
313
-
314
- let errMsg = "JsView Error: Only class selector is supported!\n";
315
- errMsg += "JsView Error: Please use css like `.classname { property: value; }`";
316
- check(selector.startsWith('.'), node.source.input.css, errMsg);
317
-
318
- const declarations = postCssJs.objectify(node);
319
- for (const name in declarations) {
320
- const value = declarations[name];
321
- const formattedValue = styleFormat.getFormattedValue(name, value);
322
- declarations[name] = formattedValue;
323
- }
324
-
325
- let styleContent = "'" + selector.substr(1) + "':";
326
- styleContent += JSON.stringify(declarations);
327
- styleContent += ",";
328
-
329
- // console.log('jsview-css-to-js.compileSelectorNode() return ', styleContent);
330
- return styleContent;
331
- }
332
-
333
- exports.ensureSfcDescriptor = ensureSfcDescriptor;
334
- exports.compileCssToJs = compileCssToJs;
335
- exports.compileAndSaveImportedNode = compileAndSaveImportedNode;