@master/css-runtime 2.0.0-rc.61 → 2.0.0-rc.63
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.
- package/dist/global.min.js +1 -1
- package/dist/index.cjs +76 -77
- package/dist/index.development.cjs +81 -82
- package/dist/index.development.mjs +82 -83
- package/dist/index.mjs +77 -78
- package/dist/layer.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Layer, withSyntaxLayer, MasterCSS, config,
|
|
1
|
+
import { Layer, withSyntaxLayer, MasterCSS, config, VariableRule, AnimationRule } from '@master/css';
|
|
2
2
|
import { installHook } from '@master/css-devtools-hook';
|
|
3
3
|
|
|
4
4
|
const createLogger = (type)=>{
|
|
@@ -45,13 +45,13 @@ function registerClassCountDebugger() {
|
|
|
45
45
|
const eachCount = cssRuntime.classCounts.get(className);
|
|
46
46
|
const eachActualCount = actualClassCounts[className];
|
|
47
47
|
if (eachCount !== eachActualCount) {
|
|
48
|
-
log.error(`Class count mismatch for
|
|
48
|
+
log.error(`Class count mismatch for \`${className}\` (expected ${eachActualCount}) (received ${eachCount})`);
|
|
49
49
|
errored = true;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
cssRuntime.classCounts.forEach((eachCount, className)=>{
|
|
53
53
|
if (!Object.prototype.hasOwnProperty.call(actualClassCounts, className)) {
|
|
54
|
-
log.error(`Class count mismatch for
|
|
54
|
+
log.error(`Class count mismatch for \`${className}\` (expected ${0}) (received ${eachCount})`);
|
|
55
55
|
errored = true;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -132,43 +132,29 @@ class RuntimeLayer extends Layer {
|
|
|
132
132
|
}
|
|
133
133
|
insert(rule, index = this.rules.length) {
|
|
134
134
|
const insertedIndex = super.insert(rule, index);
|
|
135
|
-
if (insertedIndex === undefined) return;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const lastNativeRule = previouRule.nodes[previouRule.nodes.length - 1];
|
|
144
|
-
lastCssRule = lastNativeRule.native;
|
|
145
|
-
}
|
|
146
|
-
return lastCssRule;
|
|
147
|
-
}(this, insertedIndex - 1);
|
|
148
|
-
if (lastCssRule) {
|
|
149
|
-
for(let i = 0; i < this.native.cssRules.length; i++){
|
|
150
|
-
if (this.native.cssRules[i] === lastCssRule) {
|
|
151
|
-
cssRuleIndex = i + 1;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
for(let i = 0; i < rule.nodes.length;){
|
|
157
|
-
const node = rule.nodes[i];
|
|
158
|
-
try {
|
|
159
|
-
const insertedIndex = this.native.insertRule(node.text, cssRuleIndex);
|
|
160
|
-
node.native = this.native.cssRules.item(insertedIndex);
|
|
161
|
-
cssRuleIndex++;
|
|
162
|
-
i++;
|
|
163
|
-
} catch (error) {
|
|
164
|
-
console.error(error, node);
|
|
165
|
-
rule.nodes.splice(i, 1);
|
|
166
|
-
}
|
|
135
|
+
if (insertedIndex === undefined || !this.native) return;
|
|
136
|
+
const insertRuleSafely = (text, position)=>{
|
|
137
|
+
try {
|
|
138
|
+
const insertedIndex = this.native.insertRule(text, position);
|
|
139
|
+
return this.native.cssRules.item(insertedIndex);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error(error, rule);
|
|
142
|
+
return;
|
|
167
143
|
}
|
|
144
|
+
};
|
|
145
|
+
if ('nodes' in rule) {
|
|
146
|
+
let currentIndex = insertedIndex;
|
|
147
|
+
rule.nodes.forEach((node)=>{
|
|
148
|
+
node.native = insertRuleSafely(node.text, currentIndex);
|
|
149
|
+
if (node.native) currentIndex++;
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
rule.native = insertRuleSafely(rule.text, index);
|
|
168
153
|
}
|
|
169
154
|
return insertedIndex;
|
|
170
155
|
}
|
|
171
156
|
detach() {
|
|
157
|
+
super.detach();
|
|
172
158
|
const nativeSheet = this.cssRuntime.style?.sheet;
|
|
173
159
|
if (nativeSheet && this.native?.parentStyleSheet) {
|
|
174
160
|
const foundIndex = findNativeCSSRuleIndex(nativeSheet.cssRules, this.native);
|
|
@@ -179,17 +165,22 @@ class RuntimeLayer extends Layer {
|
|
|
179
165
|
}
|
|
180
166
|
delete(key) {
|
|
181
167
|
const deletedRule = super.delete(key);
|
|
182
|
-
if (!deletedRule) return;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
168
|
+
if (!deletedRule || !this.native) return;
|
|
169
|
+
const deleteRuleSafely = (rule)=>{
|
|
170
|
+
if (!rule) return;
|
|
171
|
+
const foundIndex = findNativeCSSRuleIndex(this.native.cssRules, rule);
|
|
172
|
+
if (foundIndex !== -1) {
|
|
173
|
+
try {
|
|
174
|
+
this.native.deleteRule(foundIndex);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error(error, rule);
|
|
191
177
|
}
|
|
192
178
|
}
|
|
179
|
+
};
|
|
180
|
+
if ('nodes' in deletedRule) {
|
|
181
|
+
deletedRule.nodes.forEach((node)=>deleteRuleSafely(node.native));
|
|
182
|
+
} else {
|
|
183
|
+
deleteRuleSafely(deletedRule.native);
|
|
193
184
|
}
|
|
194
185
|
return deletedRule;
|
|
195
186
|
}
|
|
@@ -285,7 +276,7 @@ class CSSRuntime extends MasterCSS {
|
|
|
285
276
|
this.style.id = 'master';
|
|
286
277
|
this.container.append(this.style);
|
|
287
278
|
this.style.sheet.insertRule(this.layerStatementRule.text);
|
|
288
|
-
this.layerStatementRule.
|
|
279
|
+
this.layerStatementRule.native = this.style.sheet.cssRules.item(0);
|
|
289
280
|
for (const eachConnectedName of connectedNames){
|
|
290
281
|
this.add(eachConnectedName);
|
|
291
282
|
}
|
|
@@ -424,20 +415,32 @@ class CSSRuntime extends MasterCSS {
|
|
|
424
415
|
if (eachNativeCSSRule.name === 'theme') {
|
|
425
416
|
this.themeLayer.native = eachCSSLayerRule;
|
|
426
417
|
let variableRule;
|
|
427
|
-
|
|
428
|
-
for(
|
|
429
|
-
|
|
418
|
+
const unresolvedCSSRules = new Map();
|
|
419
|
+
for (const rule of eachCSSLayerRule.cssRules){
|
|
420
|
+
// trim() for fix the firefox bug that the cssText ends with \n\n
|
|
421
|
+
unresolvedCSSRules.set(rule.cssText.trim(), rule);
|
|
422
|
+
}
|
|
423
|
+
for (const cssRule of eachCSSLayerRule.cssRules){
|
|
424
|
+
if (!unresolvedCSSRules.has(cssRule.cssText)) continue;
|
|
430
425
|
const variableCSSRule = cssRule.constructor.name === 'CSSMediaRule' ? cssRule.cssRules[0] : cssRule;
|
|
431
426
|
const variableName = variableCSSRule.style[0].slice(2);
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
427
|
+
const variable = this.variables.get(variableName);
|
|
428
|
+
if (!variable) continue;
|
|
429
|
+
variableRule = new VariableRule(variableName, variable, this);
|
|
430
|
+
this.themeLayer.rules.push(variableRule);
|
|
431
|
+
this.themeLayer.tokenCounts.set(variableRule.name, 0);
|
|
432
|
+
variableRule.nodes.forEach((node)=>{
|
|
433
|
+
const checkRuleIndex = checkSheet.insertRule(node.text);
|
|
434
|
+
const checkNodeNativeRule = checkSheet.cssRules.item(checkRuleIndex);
|
|
435
|
+
if (checkNodeNativeRule) {
|
|
436
|
+
const checkNodeNativeRuleText = checkNodeNativeRule.cssText.trim();
|
|
437
|
+
const match = unresolvedCSSRules.get(checkNodeNativeRuleText);
|
|
438
|
+
if (match) {
|
|
439
|
+
node.native = match;
|
|
440
|
+
unresolvedCSSRules.delete(checkNodeNativeRuleText);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
441
444
|
});
|
|
442
445
|
}
|
|
443
446
|
if (this.themeLayer.rules.length) this.rules.push(this.themeLayer);
|
|
@@ -445,15 +448,13 @@ class CSSRuntime extends MasterCSS {
|
|
|
445
448
|
cssLayerRules.push(eachCSSLayerRule);
|
|
446
449
|
}
|
|
447
450
|
} else if (eachNativeCSSRule.constructor.name === 'CSSLayerStatementRule') {
|
|
448
|
-
this.layerStatementRule.
|
|
451
|
+
this.layerStatementRule.native = eachNativeCSSRule;
|
|
449
452
|
} else if (eachNativeCSSRule.constructor.name === 'CSSKeyframesRule') {
|
|
450
|
-
const
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
]);
|
|
453
|
+
const nativeKeyframsRule = eachNativeCSSRule;
|
|
454
|
+
const keyframes = this.animations.get(nativeKeyframsRule.name);
|
|
455
|
+
if (!keyframes) continue;
|
|
456
|
+
const animationRule = new AnimationRule(nativeKeyframsRule.name, keyframes, this);
|
|
457
|
+
animationRule.native = nativeKeyframsRule;
|
|
457
458
|
this.animationsNonLayer.rules.push(animationRule);
|
|
458
459
|
this.rules.push(animationRule);
|
|
459
460
|
this.animationsNonLayer.tokenCounts.set(animationRule.name, 0);
|
|
@@ -498,26 +499,24 @@ class CSSRuntime extends MasterCSS {
|
|
|
498
499
|
layer.insertVariables(createdRule);
|
|
499
500
|
layer.insertAnimations(createdRule);
|
|
500
501
|
result.allSyntaxRules.push(createdRule);
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
console.error(`Cannot retrieve CSS rule for \`${node.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
515
|
-
} catch (error) {
|
|
516
|
-
{
|
|
517
|
-
console.debug(`Cannot insert CSS rule for \`${node.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
502
|
+
try {
|
|
503
|
+
const checkRuleIndex = checkSheet.insertRule(createdRule.text);
|
|
504
|
+
const checkNodeNativeRule = checkSheet.cssRules.item(checkRuleIndex);
|
|
505
|
+
if (checkNodeNativeRule) {
|
|
506
|
+
const checkNodeNativeRuleText = checkNodeNativeRule.cssText.trim();
|
|
507
|
+
const match = unresolvedCSSRules.get(checkNodeNativeRuleText);
|
|
508
|
+
if (match) {
|
|
509
|
+
createdRule.native = match;
|
|
510
|
+
unresolvedCSSRules.delete(checkNodeNativeRuleText);
|
|
511
|
+
continue;
|
|
518
512
|
}
|
|
519
513
|
}
|
|
520
|
-
|
|
514
|
+
console.error(`Cannot retrieve CSS rule for \`${createdRule.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
515
|
+
} catch (error) {
|
|
516
|
+
{
|
|
517
|
+
console.debug(`Cannot insert CSS rule for \`${createdRule.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
521
520
|
}
|
|
522
521
|
} else {
|
|
523
522
|
console.error(`Cannot recognize \`${eachNativeLayerRule.cssText}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Layer, withSyntaxLayer, MasterCSS, config,
|
|
1
|
+
import { Layer, withSyntaxLayer, MasterCSS, config, VariableRule, AnimationRule } from '@master/css';
|
|
2
2
|
import { installHook } from '@master/css-devtools-hook';
|
|
3
3
|
|
|
4
4
|
function registerGlobal(CSSRuntime) {
|
|
@@ -34,43 +34,29 @@ class RuntimeLayer extends Layer {
|
|
|
34
34
|
}
|
|
35
35
|
insert(rule, index = this.rules.length) {
|
|
36
36
|
const insertedIndex = super.insert(rule, index);
|
|
37
|
-
if (insertedIndex === undefined) return;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const lastNativeRule = previouRule.nodes[previouRule.nodes.length - 1];
|
|
46
|
-
lastCssRule = lastNativeRule.native;
|
|
47
|
-
}
|
|
48
|
-
return lastCssRule;
|
|
49
|
-
}(this, insertedIndex - 1);
|
|
50
|
-
if (lastCssRule) {
|
|
51
|
-
for(let i = 0; i < this.native.cssRules.length; i++){
|
|
52
|
-
if (this.native.cssRules[i] === lastCssRule) {
|
|
53
|
-
cssRuleIndex = i + 1;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
for(let i = 0; i < rule.nodes.length;){
|
|
59
|
-
const node = rule.nodes[i];
|
|
60
|
-
try {
|
|
61
|
-
const insertedIndex = this.native.insertRule(node.text, cssRuleIndex);
|
|
62
|
-
node.native = this.native.cssRules.item(insertedIndex);
|
|
63
|
-
cssRuleIndex++;
|
|
64
|
-
i++;
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error(error, node);
|
|
67
|
-
rule.nodes.splice(i, 1);
|
|
68
|
-
}
|
|
37
|
+
if (insertedIndex === undefined || !this.native) return;
|
|
38
|
+
const insertRuleSafely = (text, position)=>{
|
|
39
|
+
try {
|
|
40
|
+
const insertedIndex = this.native.insertRule(text, position);
|
|
41
|
+
return this.native.cssRules.item(insertedIndex);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(error, rule);
|
|
44
|
+
return;
|
|
69
45
|
}
|
|
46
|
+
};
|
|
47
|
+
if ('nodes' in rule) {
|
|
48
|
+
let currentIndex = insertedIndex;
|
|
49
|
+
rule.nodes.forEach((node)=>{
|
|
50
|
+
node.native = insertRuleSafely(node.text, currentIndex);
|
|
51
|
+
if (node.native) currentIndex++;
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
rule.native = insertRuleSafely(rule.text, index);
|
|
70
55
|
}
|
|
71
56
|
return insertedIndex;
|
|
72
57
|
}
|
|
73
58
|
detach() {
|
|
59
|
+
super.detach();
|
|
74
60
|
const nativeSheet = this.cssRuntime.style?.sheet;
|
|
75
61
|
if (nativeSheet && this.native?.parentStyleSheet) {
|
|
76
62
|
const foundIndex = findNativeCSSRuleIndex(nativeSheet.cssRules, this.native);
|
|
@@ -81,17 +67,22 @@ class RuntimeLayer extends Layer {
|
|
|
81
67
|
}
|
|
82
68
|
delete(key) {
|
|
83
69
|
const deletedRule = super.delete(key);
|
|
84
|
-
if (!deletedRule) return;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
if (!deletedRule || !this.native) return;
|
|
71
|
+
const deleteRuleSafely = (rule)=>{
|
|
72
|
+
if (!rule) return;
|
|
73
|
+
const foundIndex = findNativeCSSRuleIndex(this.native.cssRules, rule);
|
|
74
|
+
if (foundIndex !== -1) {
|
|
75
|
+
try {
|
|
76
|
+
this.native.deleteRule(foundIndex);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(error, rule);
|
|
93
79
|
}
|
|
94
80
|
}
|
|
81
|
+
};
|
|
82
|
+
if ('nodes' in deletedRule) {
|
|
83
|
+
deletedRule.nodes.forEach((node)=>deleteRuleSafely(node.native));
|
|
84
|
+
} else {
|
|
85
|
+
deleteRuleSafely(deletedRule.native);
|
|
95
86
|
}
|
|
96
87
|
return deletedRule;
|
|
97
88
|
}
|
|
@@ -183,7 +174,7 @@ class CSSRuntime extends MasterCSS {
|
|
|
183
174
|
this.style.id = 'master';
|
|
184
175
|
this.container.append(this.style);
|
|
185
176
|
this.style.sheet.insertRule(this.layerStatementRule.text);
|
|
186
|
-
this.layerStatementRule.
|
|
177
|
+
this.layerStatementRule.native = this.style.sheet.cssRules.item(0);
|
|
187
178
|
for (const eachConnectedName of connectedNames){
|
|
188
179
|
this.add(eachConnectedName);
|
|
189
180
|
}
|
|
@@ -322,20 +313,32 @@ class CSSRuntime extends MasterCSS {
|
|
|
322
313
|
if (eachNativeCSSRule.name === 'theme') {
|
|
323
314
|
this.themeLayer.native = eachCSSLayerRule;
|
|
324
315
|
let variableRule;
|
|
325
|
-
|
|
326
|
-
for(
|
|
327
|
-
|
|
316
|
+
const unresolvedCSSRules = new Map();
|
|
317
|
+
for (const rule of eachCSSLayerRule.cssRules){
|
|
318
|
+
// trim() for fix the firefox bug that the cssText ends with \n\n
|
|
319
|
+
unresolvedCSSRules.set(rule.cssText.trim(), rule);
|
|
320
|
+
}
|
|
321
|
+
for (const cssRule of eachCSSLayerRule.cssRules){
|
|
322
|
+
if (!unresolvedCSSRules.has(cssRule.cssText)) continue;
|
|
328
323
|
const variableCSSRule = cssRule.constructor.name === 'CSSMediaRule' ? cssRule.cssRules[0] : cssRule;
|
|
329
324
|
const variableName = variableCSSRule.style[0].slice(2);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
325
|
+
const variable = this.variables.get(variableName);
|
|
326
|
+
if (!variable) continue;
|
|
327
|
+
variableRule = new VariableRule(variableName, variable, this);
|
|
328
|
+
this.themeLayer.rules.push(variableRule);
|
|
329
|
+
this.themeLayer.tokenCounts.set(variableRule.name, 0);
|
|
330
|
+
variableRule.nodes.forEach((node)=>{
|
|
331
|
+
const checkRuleIndex = checkSheet.insertRule(node.text);
|
|
332
|
+
const checkNodeNativeRule = checkSheet.cssRules.item(checkRuleIndex);
|
|
333
|
+
if (checkNodeNativeRule) {
|
|
334
|
+
const checkNodeNativeRuleText = checkNodeNativeRule.cssText.trim();
|
|
335
|
+
const match = unresolvedCSSRules.get(checkNodeNativeRuleText);
|
|
336
|
+
if (match) {
|
|
337
|
+
node.native = match;
|
|
338
|
+
unresolvedCSSRules.delete(checkNodeNativeRuleText);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
339
342
|
});
|
|
340
343
|
}
|
|
341
344
|
if (this.themeLayer.rules.length) this.rules.push(this.themeLayer);
|
|
@@ -343,15 +346,13 @@ class CSSRuntime extends MasterCSS {
|
|
|
343
346
|
cssLayerRules.push(eachCSSLayerRule);
|
|
344
347
|
}
|
|
345
348
|
} else if (eachNativeCSSRule.constructor.name === 'CSSLayerStatementRule') {
|
|
346
|
-
this.layerStatementRule.
|
|
349
|
+
this.layerStatementRule.native = eachNativeCSSRule;
|
|
347
350
|
} else if (eachNativeCSSRule.constructor.name === 'CSSKeyframesRule') {
|
|
348
|
-
const
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
]);
|
|
351
|
+
const nativeKeyframsRule = eachNativeCSSRule;
|
|
352
|
+
const keyframes = this.animations.get(nativeKeyframsRule.name);
|
|
353
|
+
if (!keyframes) continue;
|
|
354
|
+
const animationRule = new AnimationRule(nativeKeyframsRule.name, keyframes, this);
|
|
355
|
+
animationRule.native = nativeKeyframsRule;
|
|
355
356
|
this.animationsNonLayer.rules.push(animationRule);
|
|
356
357
|
this.rules.push(animationRule);
|
|
357
358
|
this.animationsNonLayer.tokenCounts.set(animationRule.name, 0);
|
|
@@ -396,23 +397,21 @@ class CSSRuntime extends MasterCSS {
|
|
|
396
397
|
layer.insertVariables(createdRule);
|
|
397
398
|
layer.insertAnimations(createdRule);
|
|
398
399
|
result.allSyntaxRules.push(createdRule);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
400
|
+
try {
|
|
401
|
+
const checkRuleIndex = checkSheet.insertRule(createdRule.text);
|
|
402
|
+
const checkNodeNativeRule = checkSheet.cssRules.item(checkRuleIndex);
|
|
403
|
+
if (checkNodeNativeRule) {
|
|
404
|
+
const checkNodeNativeRuleText = checkNodeNativeRule.cssText.trim();
|
|
405
|
+
const match = unresolvedCSSRules.get(checkNodeNativeRuleText);
|
|
406
|
+
if (match) {
|
|
407
|
+
createdRule.native = match;
|
|
408
|
+
unresolvedCSSRules.delete(checkNodeNativeRuleText);
|
|
409
|
+
continue;
|
|
411
410
|
}
|
|
412
|
-
console.error(`Cannot retrieve CSS rule for \`${node.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
413
|
-
} catch (error) {
|
|
414
411
|
}
|
|
415
|
-
|
|
412
|
+
console.error(`Cannot retrieve CSS rule for \`${createdRule.text}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
|
413
|
+
} catch (error) {
|
|
414
|
+
}
|
|
416
415
|
}
|
|
417
416
|
} else {
|
|
418
417
|
console.error(`Cannot recognize \`${eachNativeLayerRule.cssText}\`. (${layer.name}) (https://rc.css.master.co/messages/hydration-errors)`);
|
package/dist/layer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Layer, Rule } from '@master/css';
|
|
1
|
+
import { Layer, Rule, VariableRule } from '@master/css';
|
|
2
2
|
import CSSRuntime from './core';
|
|
3
3
|
export default class RuntimeLayer extends Layer {
|
|
4
4
|
name: string;
|
|
@@ -8,8 +8,8 @@ export default class RuntimeLayer extends Layer {
|
|
|
8
8
|
native: CSSLayerBlockRule | null;
|
|
9
9
|
constructor(name: string, cssRuntime: CSSRuntime);
|
|
10
10
|
attach(): void;
|
|
11
|
-
insert(rule: Rule, index?: number): number | undefined;
|
|
11
|
+
insert(rule: Rule | VariableRule, index?: number): number | undefined;
|
|
12
12
|
detach(): void;
|
|
13
|
-
delete(key: string): Rule | undefined;
|
|
13
|
+
delete(key: string): Rule | VariableRule | undefined;
|
|
14
14
|
reset(): void;
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css-runtime","type":"module","scripts":{"build":"techor build","dev":"pnpm build --watch","e2e":"playwright test","e2e:watch":"nodemon -e js,mjs,ts,html,css --watch dist --watch e2e --exec playwright test","type-check":"tsc --noEmit","lint":"eslint"},"license":"MIT","description":"Run Master CSS right in the browser","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/runtime"},"keywords":["utility","css","lightweight","mastercss","master","runtime","cdn"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","browser":"./dist/global.min.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":{"development":"./dist/index.development.cjs","default":"./dist/index.cjs"},"import":{"development":"./dist/index.development.mjs","default":"./dist/index.mjs"}}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.
|
|
1
|
+
{"name":"@master/css-runtime","type":"module","scripts":{"build":"techor build","dev":"pnpm build --watch","e2e":"playwright test","e2e:watch":"nodemon -e js,mjs,ts,html,css --watch dist --watch e2e --exec playwright test","type-check":"tsc --noEmit","lint":"eslint"},"license":"MIT","description":"Run Master CSS right in the browser","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/runtime"},"keywords":["utility","css","lightweight","mastercss","master","runtime","cdn"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","browser":"./dist/global.min.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":{"development":"./dist/index.development.cjs","default":"./dist/index.cjs"},"import":{"development":"./dist/index.development.mjs","default":"./dist/index.mjs"}}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.63","@master/css-devtools-hook":"^2.0.0-rc.63"},"devDependencies":{"@playwright/test":"^1.49.1","shared":"^2.0.0-rc.63"},"version":"2.0.0-rc.63"}
|