@zohodesk/react-cli 0.0.1-exp.168.3 → 0.0.1-exp.169.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.
Files changed (114) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +179 -179
  3. package/.prettierrc +6 -0
  4. package/README.md +946 -925
  5. package/bin/cli.js +482 -492
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -0
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/TODOS.md +10 -10
  13. package/docs/ValueReplacer.md +60 -60
  14. package/docs/warnings_while_install.txt +35 -35
  15. package/files/eslintrc.js +62 -62
  16. package/files/prettierrc.js +3 -3
  17. package/lib/configs/jest.config.js +1 -3
  18. package/lib/configs/webpack.css.umd.config.js +4 -4
  19. package/lib/configs/webpack.dev.config.js +1 -1
  20. package/lib/configs/webpack.docs.config.js +1 -1
  21. package/lib/configs/webpack.impact.config.js +3 -1
  22. package/lib/configs/webpack.prod.config.js +4 -2
  23. package/lib/jest/preProcessors/cssPreprocessor.js +2 -0
  24. package/lib/loaderUtils/configsAssetsLoaders.js +62 -33
  25. package/lib/loaders/workerLoader.js +9 -9
  26. package/lib/pluginUtils/getDevPlugins.js +5 -5
  27. package/lib/pluginUtils/getProdPlugins.js +5 -5
  28. package/lib/plugins/EFCPlugin.md +6 -6
  29. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  30. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  31. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  32. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  33. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  34. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  35. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  36. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  37. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  38. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  39. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  40. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  41. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  42. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  43. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  44. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  45. package/lib/postcss-plugins/hoverActivePlugin.js +50 -42
  46. package/lib/schemas/index.js +8 -3
  47. package/lib/servers/getCliPath.js +7 -3
  48. package/lib/sh/pre-commit.sh +34 -34
  49. package/lib/sh/reportPublish.sh +45 -45
  50. package/lib/utils/buildstats.html +148 -148
  51. package/lib/utils/resultSchema.json +73 -73
  52. package/npm8.md +9 -9
  53. package/package.json +148 -148
  54. package/postpublish.js +6 -6
  55. package/templates/app/.eslintrc.js +140 -140
  56. package/templates/app/README.md +12 -12
  57. package/templates/app/app/index.html +24 -24
  58. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  59. package/templates/app/app/properties/i18nkeys.json +3 -3
  60. package/templates/app/docs/all.html +69 -69
  61. package/templates/app/mockapi/index.js +18 -18
  62. package/templates/app/package.json +37 -37
  63. package/templates/app/src/actions/SampleActions/index.js +37 -37
  64. package/templates/app/src/actions/index.js +65 -65
  65. package/templates/app/src/appUrls.js +19 -19
  66. package/templates/app/src/components/Alert/Alert.js +134 -134
  67. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  68. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  69. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  70. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  71. package/templates/app/src/components/Sample/SampleList.js +61 -61
  72. package/templates/app/src/components/Slider/Slider.css +41 -41
  73. package/templates/app/src/components/Slider/Slider.js +55 -55
  74. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  75. package/templates/app/src/containers/AppContainer/index.js +96 -96
  76. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  77. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  78. package/templates/app/src/containers/DevTools/index.js +10 -10
  79. package/templates/app/src/containers/Header/index.js +67 -67
  80. package/templates/app/src/containers/Header/index.module.css +43 -43
  81. package/templates/app/src/containers/Redirect/index.js +63 -63
  82. package/templates/app/src/containers/Redirector/index.js +47 -47
  83. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  84. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  85. package/templates/app/src/historyChange.js +5 -5
  86. package/templates/app/src/index.html +10 -10
  87. package/templates/app/src/index.js +24 -24
  88. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  89. package/templates/app/src/reducers/alertData.js +11 -11
  90. package/templates/app/src/reducers/index.js +6 -6
  91. package/templates/app/src/reducers/samples.js +19 -19
  92. package/templates/app/src/store/configureStore.dev.js +51 -51
  93. package/templates/app/src/store/configureStore.js +5 -5
  94. package/templates/app/src/store/configureStore.prod.js +26 -26
  95. package/templates/app/src/util/Common.js +5 -5
  96. package/templates/app/src/util/RequestAPI.js +132 -132
  97. package/templates/docs/all.html +249 -249
  98. package/templates/docs/component.html +178 -178
  99. package/templates/docs/components.html +221 -221
  100. package/templates/docs/css/b.min.css +6 -6
  101. package/templates/docs/css/component.css +42 -42
  102. package/templates/docs/css/componentTest.css +6 -6
  103. package/templates/docs/css/hopscotch.css +585 -585
  104. package/templates/docs/css/style.css +1022 -1022
  105. package/templates/docs/impactReportTemplate.html +154 -154
  106. package/templates/docs/index.html +1493 -1493
  107. package/templates/docs/js/active-line.js +72 -72
  108. package/templates/docs/js/b.min.js +7 -7
  109. package/templates/docs/js/codemirror.js +9680 -9680
  110. package/templates/docs/js/designTokens.js +334 -334
  111. package/templates/docs/js/j.min.js +4 -4
  112. package/templates/docs/js/javascript.js +874 -874
  113. package/templates/docs/js/matchbrackets.js +145 -145
  114. package/lib/postcss-plugins/keyframesPlugin.js +0 -126
@@ -1,145 +1,145 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- (function(mod) {
5
- if (typeof exports == "object" && typeof module == "object") // CommonJS
6
- mod(require("../../lib/codemirror"));
7
- else if (typeof define == "function" && define.amd) // AMD
8
- define(["../../lib/codemirror"], mod);
9
- else // Plain browser env
10
- mod(CodeMirror);
11
- })(function(CodeMirror) {
12
- var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
13
- (document.documentMode == null || document.documentMode < 8);
14
-
15
- var Pos = CodeMirror.Pos;
16
-
17
- var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
18
-
19
- function findMatchingBracket(cm, where, config) {
20
- var line = cm.getLineHandle(where.line), pos = where.ch - 1;
21
- var afterCursor = config && config.afterCursor
22
- if (afterCursor == null)
23
- afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
24
-
25
- // A cursor is defined as between two characters, but in in vim command mode
26
- // (i.e. not insert mode), the cursor is visually represented as a
27
- // highlighted box on top of the 2nd character. Otherwise, we allow matches
28
- // from before or after the cursor.
29
- var match = (!afterCursor && pos >= 0 && matching[line.text.charAt(pos)]) ||
30
- matching[line.text.charAt(++pos)];
31
- if (!match) return null;
32
- var dir = match.charAt(1) == ">" ? 1 : -1;
33
- if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
34
- var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
35
-
36
- var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
37
- if (found == null) return null;
38
- return {from: Pos(where.line, pos), to: found && found.pos,
39
- match: found && found.ch == match.charAt(0), forward: dir > 0};
40
- }
41
-
42
- // bracketRegex is used to specify which type of bracket to scan
43
- // should be a regexp, e.g. /[[\]]/
44
- //
45
- // Note: If "where" is on an open bracket, then this bracket is ignored.
46
- //
47
- // Returns false when no bracket was found, null when it reached
48
- // maxScanLines and gave up
49
- function scanForBracket(cm, where, dir, style, config) {
50
- var maxScanLen = (config && config.maxScanLineLength) || 10000;
51
- var maxScanLines = (config && config.maxScanLines) || 1000;
52
-
53
- var stack = [];
54
- var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
55
- var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
56
- : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
57
- for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
58
- var line = cm.getLine(lineNo);
59
- if (!line) continue;
60
- var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
61
- if (line.length > maxScanLen) continue;
62
- if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
63
- for (; pos != end; pos += dir) {
64
- var ch = line.charAt(pos);
65
- if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
66
- var match = matching[ch];
67
- if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
68
- else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
69
- else stack.pop();
70
- }
71
- }
72
- }
73
- return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
74
- }
75
-
76
- function matchBrackets(cm, autoclear, config) {
77
- // Disable brace matching in long lines, since it'll cause hugely slow updates
78
- var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
79
- var marks = [], ranges = cm.listSelections();
80
- for (var i = 0; i < ranges.length; i++) {
81
- var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
82
- if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
83
- var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
84
- marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
85
- if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
86
- marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
87
- }
88
- }
89
-
90
- if (marks.length) {
91
- // Kludge to work around the IE bug from issue #1193, where text
92
- // input stops going to the textare whever this fires.
93
- if (ie_lt8 && cm.state.focused) cm.focus();
94
-
95
- var clear = function() {
96
- cm.operation(function() {
97
- for (var i = 0; i < marks.length; i++) marks[i].clear();
98
- });
99
- };
100
- if (autoclear) setTimeout(clear, 800);
101
- else return clear;
102
- }
103
- }
104
-
105
- function doMatchBrackets(cm) {
106
- cm.operation(function() {
107
- if (cm.state.matchBrackets.currentlyHighlighted) {
108
- cm.state.matchBrackets.currentlyHighlighted();
109
- cm.state.matchBrackets.currentlyHighlighted = null;
110
- }
111
- cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
112
- });
113
- }
114
-
115
- CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
116
- if (old && old != CodeMirror.Init) {
117
- cm.off("cursorActivity", doMatchBrackets);
118
- if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
119
- cm.state.matchBrackets.currentlyHighlighted();
120
- cm.state.matchBrackets.currentlyHighlighted = null;
121
- }
122
- }
123
- if (val) {
124
- cm.state.matchBrackets = typeof val == "object" ? val : {};
125
- cm.on("cursorActivity", doMatchBrackets);
126
- }
127
- });
128
-
129
- CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
130
- CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
131
- // Backwards-compatibility kludge
132
- if (oldConfig || typeof config == "boolean") {
133
- if (!oldConfig) {
134
- config = config ? {strict: true} : null
135
- } else {
136
- oldConfig.strict = config
137
- config = oldConfig
138
- }
139
- }
140
- return findMatchingBracket(this, pos, config)
141
- });
142
- CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
143
- return scanForBracket(this, pos, dir, style, config);
144
- });
145
- });
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
13
+ (document.documentMode == null || document.documentMode < 8);
14
+
15
+ var Pos = CodeMirror.Pos;
16
+
17
+ var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
18
+
19
+ function findMatchingBracket(cm, where, config) {
20
+ var line = cm.getLineHandle(where.line), pos = where.ch - 1;
21
+ var afterCursor = config && config.afterCursor
22
+ if (afterCursor == null)
23
+ afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
24
+
25
+ // A cursor is defined as between two characters, but in in vim command mode
26
+ // (i.e. not insert mode), the cursor is visually represented as a
27
+ // highlighted box on top of the 2nd character. Otherwise, we allow matches
28
+ // from before or after the cursor.
29
+ var match = (!afterCursor && pos >= 0 && matching[line.text.charAt(pos)]) ||
30
+ matching[line.text.charAt(++pos)];
31
+ if (!match) return null;
32
+ var dir = match.charAt(1) == ">" ? 1 : -1;
33
+ if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
34
+ var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
35
+
36
+ var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
37
+ if (found == null) return null;
38
+ return {from: Pos(where.line, pos), to: found && found.pos,
39
+ match: found && found.ch == match.charAt(0), forward: dir > 0};
40
+ }
41
+
42
+ // bracketRegex is used to specify which type of bracket to scan
43
+ // should be a regexp, e.g. /[[\]]/
44
+ //
45
+ // Note: If "where" is on an open bracket, then this bracket is ignored.
46
+ //
47
+ // Returns false when no bracket was found, null when it reached
48
+ // maxScanLines and gave up
49
+ function scanForBracket(cm, where, dir, style, config) {
50
+ var maxScanLen = (config && config.maxScanLineLength) || 10000;
51
+ var maxScanLines = (config && config.maxScanLines) || 1000;
52
+
53
+ var stack = [];
54
+ var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
55
+ var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
56
+ : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
57
+ for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
58
+ var line = cm.getLine(lineNo);
59
+ if (!line) continue;
60
+ var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
61
+ if (line.length > maxScanLen) continue;
62
+ if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
63
+ for (; pos != end; pos += dir) {
64
+ var ch = line.charAt(pos);
65
+ if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
66
+ var match = matching[ch];
67
+ if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
68
+ else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
69
+ else stack.pop();
70
+ }
71
+ }
72
+ }
73
+ return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
74
+ }
75
+
76
+ function matchBrackets(cm, autoclear, config) {
77
+ // Disable brace matching in long lines, since it'll cause hugely slow updates
78
+ var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
79
+ var marks = [], ranges = cm.listSelections();
80
+ for (var i = 0; i < ranges.length; i++) {
81
+ var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
82
+ if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
83
+ var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
84
+ marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
85
+ if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
86
+ marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
87
+ }
88
+ }
89
+
90
+ if (marks.length) {
91
+ // Kludge to work around the IE bug from issue #1193, where text
92
+ // input stops going to the textare whever this fires.
93
+ if (ie_lt8 && cm.state.focused) cm.focus();
94
+
95
+ var clear = function() {
96
+ cm.operation(function() {
97
+ for (var i = 0; i < marks.length; i++) marks[i].clear();
98
+ });
99
+ };
100
+ if (autoclear) setTimeout(clear, 800);
101
+ else return clear;
102
+ }
103
+ }
104
+
105
+ function doMatchBrackets(cm) {
106
+ cm.operation(function() {
107
+ if (cm.state.matchBrackets.currentlyHighlighted) {
108
+ cm.state.matchBrackets.currentlyHighlighted();
109
+ cm.state.matchBrackets.currentlyHighlighted = null;
110
+ }
111
+ cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
112
+ });
113
+ }
114
+
115
+ CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
116
+ if (old && old != CodeMirror.Init) {
117
+ cm.off("cursorActivity", doMatchBrackets);
118
+ if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
119
+ cm.state.matchBrackets.currentlyHighlighted();
120
+ cm.state.matchBrackets.currentlyHighlighted = null;
121
+ }
122
+ }
123
+ if (val) {
124
+ cm.state.matchBrackets = typeof val == "object" ? val : {};
125
+ cm.on("cursorActivity", doMatchBrackets);
126
+ }
127
+ });
128
+
129
+ CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
130
+ CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
131
+ // Backwards-compatibility kludge
132
+ if (oldConfig || typeof config == "boolean") {
133
+ if (!oldConfig) {
134
+ config = config ? {strict: true} : null
135
+ } else {
136
+ oldConfig.strict = config
137
+ config = oldConfig
138
+ }
139
+ }
140
+ return findMatchingBracket(this, pos, config)
141
+ });
142
+ CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
143
+ return scanForBracket(this, pos, dir, style, config);
144
+ });
145
+ });
@@ -1,126 +0,0 @@
1
- "use strict";
2
-
3
- var _postcss = _interopRequireWildcard(require("postcss"));
4
-
5
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
6
-
7
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8
-
9
- module.exports = _postcss.default.plugin('postcss-reduced-motion', () => {
10
- function animDeclPosn(rule) {
11
- let posn = -1;
12
- rule.walkDecls((decl, index) => {
13
- //console.log(decl.prop, " " , decl.value);
14
- if (decl.prop.includes('animation')) {
15
- //console.log(decl.prop," selected")
16
- posn = index;
17
- }
18
- });
19
- return posn;
20
- }
21
-
22
- return root => {
23
- let redRules = [];
24
- root.walkAtRules((atrule, index) => {
25
- if (index !== 0) {
26
- //ignore case
27
- let ignore = false;
28
-
29
- if (root.nodes[index - 1].type === 'comment') {
30
- ignore = root.nodes[index - 1].text.includes('reduced-motion:ignore');
31
- } //animation none push to reduced motion
32
-
33
-
34
- if (!ignore) {
35
- //console.log(atrule)
36
- atrule.walkRules(rule => {
37
- let pos = animDeclPosn(rule);
38
-
39
- if (pos !== -1) {
40
- let ruleNew = rule.clone();
41
- let decl = ruleNew.nodes[pos];
42
- let declClone = decl.clone();
43
- declClone.value = 'none';
44
- ruleNew.walkDecls(declVal => declVal.remove());
45
- ruleNew.append(declClone);
46
- let atRuleNew = atrule.clone();
47
- atRuleNew.nodes = [];
48
- atRuleNew.push(ruleNew);
49
- redRules.push(atRuleNew);
50
- }
51
- });
52
- }
53
- } else {
54
- //animation none push to reduced motion
55
- //console.log(atrule)
56
- atrule.walkRules(rule => {
57
- let pos = animDeclPosn(rule);
58
-
59
- if (pos !== -1) {
60
- let ruleNew = rule.clone();
61
- let decl = ruleNew.nodes[pos];
62
- let declClone = decl.clone();
63
- declClone.value = 'none';
64
- ruleNew.walkDecls(declVal => declVal.remove());
65
- ruleNew.append(declClone);
66
- let atRuleNew = atrule.clone();
67
- atRuleNew.nodes = [];
68
- atRuleNew.push(ruleNew);
69
- redRules.push(atRuleNew);
70
- }
71
- });
72
- }
73
- });
74
- root.walkRules((rule, index) => {
75
- if (rule.type === 'rule' && rule.parent.name === undefined) {
76
- if (index !== 0) {
77
- //ignore case
78
- let ignore = false;
79
-
80
- if (root.nodes[index - 1].type === 'comment') {
81
- ignore = root.nodes[index - 1].text.includes('reduced-motion:ignore');
82
- } //animation none push to reduced motion
83
-
84
-
85
- if (!ignore) {
86
- //console.log(atrule)
87
- rule.walkDecls(decl => {
88
- if (decl !== undefined && decl.prop.includes('animation')) {
89
- let declClone = decl.clone();
90
- let newRule = rule.clone();
91
- declClone.value = 'none';
92
- newRule.walkDecls(declVal => declVal.remove());
93
- newRule.append(declClone);
94
- redRules.push(newRule);
95
- }
96
- });
97
- }
98
- } else {
99
- //animation none push to reduced motion
100
- //console.log(atrule)
101
- rule.walkDecls(decl => {
102
- if (decl !== undefined && decl.prop.includes('animation')) {
103
- let declClone = decl.clone();
104
- let newRule = rule.clone();
105
- declClone.value = 'none';
106
- newRule.walkDecls(declVal => declVal.remove());
107
- newRule.append(declClone);
108
- redRules.push(newRule);
109
- }
110
- });
111
- }
112
- }
113
- });
114
-
115
- if (redRules.length > 0) {
116
- let redMtnQuery = (0, _postcss.atRule)({
117
- name: 'media',
118
- params: '(prefers-reduced-motion)'
119
- });
120
- root.append(redMtnQuery).last;
121
- redRules.forEach(rule => {
122
- redMtnQuery.append(rule);
123
- });
124
- }
125
- };
126
- });