@shijiu/jsview-vue 0.9.265 → 0.9.272

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.
@@ -0,0 +1,90 @@
1
+ let camelcase = require('camelcase-css')
2
+
3
+ let UNITLESS = {
4
+ // QCode Added >>>>>
5
+ left: true,
6
+ top: true,
7
+ width: true,
8
+ height: true,
9
+ // QCode Added <<<<<
10
+
11
+ boxFlex: true,
12
+ boxFlexGroup: true,
13
+ columnCount: true,
14
+ flex: true,
15
+ flexGrow: true,
16
+ flexPositive: true,
17
+ flexShrink: true,
18
+ flexNegative: true,
19
+ fontWeight: true,
20
+ lineClamp: true,
21
+ lineHeight: true,
22
+ opacity: true,
23
+ order: true,
24
+ orphans: true,
25
+ tabSize: true,
26
+ widows: true,
27
+ zIndex: true,
28
+ zoom: true,
29
+ fillOpacity: true,
30
+ strokeDashoffset: true,
31
+ strokeOpacity: true,
32
+ strokeWidth: true
33
+ }
34
+
35
+ function atRule (node) {
36
+ if (typeof node.nodes === 'undefined') {
37
+ return true
38
+ } else {
39
+ return process(node)
40
+ }
41
+ }
42
+
43
+ function process (node) {
44
+ let name
45
+ let result = {}
46
+
47
+ node.each(child => {
48
+ if (child.type === 'atrule') {
49
+ name = '@' + child.name
50
+ if (child.params) name += ' ' + child.params
51
+ if (typeof result[name] === 'undefined') {
52
+ result[name] = atRule(child)
53
+ } else if (Array.isArray(result[name])) {
54
+ result[name].push(atRule(child))
55
+ } else {
56
+ result[name] = [result[name], atRule(child)]
57
+ }
58
+ } else if (child.type === 'rule') {
59
+ let body = process(child)
60
+ if (result[child.selector]) {
61
+ for (let i in body) {
62
+ result[child.selector][i] = body[i]
63
+ }
64
+ } else {
65
+ result[child.selector] = body
66
+ }
67
+ } else if (child.type === 'decl') {
68
+ if (child.prop[0] === '-' && child.prop[1] === '-') {
69
+ name = child.prop
70
+ } else {
71
+ name = camelcase(child.prop)
72
+ }
73
+ let value = child.value
74
+ if (!isNaN(child.value) && UNITLESS[name]) {
75
+ value = parseFloat(child.value)
76
+ }
77
+ if (child.important) value += ' !important'
78
+ if (typeof result[name] === 'undefined') {
79
+ result[name] = value
80
+ } else if (Array.isArray(result[name])) {
81
+ result[name].push(value)
82
+ } else {
83
+ result[name] = [result[name], value]
84
+ }
85
+ }
86
+ })
87
+ return result
88
+ }
89
+
90
+ module.exports = process
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveScript = exports.canInlineTemplate = void 0;
4
+ const compiler_sfc_1 = require("@vue/compiler-sfc");
5
+ const clientCache = new WeakMap();
6
+ const serverCache = new WeakMap();
7
+ /**
8
+ * inline template mode can only be enabled if:
9
+ * - is production (separate compilation needed for HMR during dev)
10
+ * - template has no pre-processor (separate loader chain required)
11
+ * - template is not using src
12
+ */
13
+ function canInlineTemplate(descriptor, isProd) {
14
+ const templateLang = descriptor.template && descriptor.template.lang;
15
+ const templateSrc = descriptor.template && descriptor.template.src;
16
+ return false; // QCode Modified
17
+ }
18
+ exports.canInlineTemplate = canInlineTemplate;
19
+ function resolveScript(descriptor, scopeId, options, loaderContext) {
20
+ var _a;
21
+ if (!descriptor.script && !descriptor.scriptSetup) {
22
+ return null;
23
+ }
24
+ const isProd = loaderContext.mode === 'production' || process.env.NODE_ENV === 'production';
25
+ const isServer = (_a = options.isServerBuild) !== null && _a !== void 0 ? _a : loaderContext.target === 'node';
26
+ const enableInline = canInlineTemplate(descriptor, isProd);
27
+ const cacheToUse = isServer ? serverCache : clientCache;
28
+ const cached = cacheToUse.get(descriptor);
29
+ if (cached) {
30
+ return cached;
31
+ }
32
+ let resolved = null;
33
+ let compiler;
34
+ if (typeof options.compiler === 'string') {
35
+ compiler = require(options.compiler);
36
+ }
37
+ else {
38
+ compiler = options.compiler;
39
+ }
40
+ if (compiler_sfc_1.compileScript) {
41
+ try {
42
+ resolved = compiler_sfc_1.compileScript(descriptor, {
43
+ id: scopeId,
44
+ isProd,
45
+ inlineTemplate: enableInline,
46
+ refSugar: options.refSugar,
47
+ babelParserPlugins: options.babelParserPlugins,
48
+ templateOptions: {
49
+ ssr: isServer,
50
+ compiler,
51
+ compilerOptions: options.compilerOptions,
52
+ transformAssetUrls: options.transformAssetUrls || true,
53
+ },
54
+ });
55
+ }
56
+ catch (e) {
57
+ loaderContext.emitError(e);
58
+ }
59
+ }
60
+ else if (descriptor.scriptSetup) {
61
+ loaderContext.emitError(`<script setup> is not supported by the installed version of ` +
62
+ `@vue/compiler-sfc - please upgrade.`);
63
+ }
64
+ else {
65
+ resolved = descriptor.script;
66
+ }
67
+ cacheToUse.set(descriptor, resolved);
68
+ return resolved;
69
+ }
70
+ exports.resolveScript = resolveScript;