@angular/platform-server 16.0.0-next.4 → 16.0.0-next.6
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/{fesm2020/platform-server.mjs → esm2022/src/bundled-domino.mjs} +140 -4632
- package/esm2022/src/http.mjs +26 -0
- package/{esm2020 → esm2022}/src/location.mjs +4 -4
- package/{esm2020 → esm2022}/src/platform_state.mjs +4 -4
- package/{esm2020 → esm2022}/src/server.mjs +5 -5
- package/esm2022/src/server_events.mjs +32 -0
- package/esm2022/src/server_renderer.mjs +279 -0
- package/{esm2020 → esm2022}/src/tokens.mjs +1 -1
- package/esm2022/src/transfer_state.mjs +59 -0
- package/esm2022/src/utils.mjs +146 -0
- package/{esm2020 → esm2022}/src/version.mjs +1 -1
- package/{esm2020 → esm2022}/testing/src/server.mjs +5 -5
- package/{fesm2015 → fesm2022}/init.mjs +1 -1
- package/{esm2020/src/bundled-domino.mjs → fesm2022/platform-server.mjs} +1065 -3732
- package/fesm2022/platform-server.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/testing.mjs +5 -5
- package/{fesm2015 → fesm2022}/testing.mjs.map +1 -1
- package/index.d.ts +9 -1
- package/init/index.d.ts +1 -1
- package/package.json +19 -30
- package/testing/index.d.ts +1 -1
- package/esm2020/src/http.mjs +0 -125
- package/esm2020/src/server_events.mjs +0 -40
- package/esm2020/src/server_renderer.mjs +0 -282
- package/esm2020/src/transfer_state.mjs +0 -60
- package/esm2020/src/utils.mjs +0 -145
- package/fesm2015/platform-server.mjs +0 -21143
- package/fesm2015/platform-server.mjs.map +0 -1
- package/fesm2015/testing.mjs +0 -58
- package/fesm2020/init.mjs +0 -35
- package/fesm2020/init.mjs.map +0 -1
- package/fesm2020/platform-server.mjs.map +0 -1
- package/fesm2020/testing.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/init/index.mjs +0 -0
- /package/{esm2020 → esm2022}/init/init.mjs +0 -0
- /package/{esm2020 → esm2022}/init/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/init/src/init.mjs +0 -0
- /package/{esm2020 → esm2022}/init/src/shims.mjs +0 -0
- /package/{esm2020 → esm2022}/platform-server.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/src/domino_adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/src/platform-server.mjs +0 -0
- /package/{esm2020 → esm2022}/src/private_export.mjs +0 -0
- /package/{esm2020 → esm2022}/src/provide_server.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/src/testing.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/testing.mjs +0 -0
- /package/{fesm2015 → fesm2022}/init.mjs.map +0 -0
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Angular v16.0.0-next.4
|
|
3
|
-
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
|
-
* License: MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ɵsetRootDomAdapter, DOCUMENT, XhrFactory, PlatformLocation, ɵgetDOM, ɵPLATFORM_SERVER_ID, ViewportScroller, ɵNullViewportScroller } from '@angular/common';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
import { Injectable, Inject, InjectionToken, inject, EnvironmentInjector, Optional, ViewEncapsulation, APP_ID, RendererStyleFlags2, ɵescapeTransferStateContent, NgModule, Injector, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, makeEnvironmentProviders, Renderer2, ApplicationRef, ɵIS_HYDRATION_FEATURE_ENABLED, ɵannotateForHydration, ɵisPromise, Version } from '@angular/core';
|
|
10
|
-
import * as i1 from '@angular/platform-browser';
|
|
11
|
-
import { ɵBrowserDomAdapter, ɵshimStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, TransferState, EVENT_MANAGER_PLUGINS, BrowserModule } from '@angular/platform-browser';
|
|
12
|
-
import { ɵHttpInterceptorHandler, HttpBackend, HttpHandler, HttpClientModule, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
13
|
-
import { ɵAnimationRendererFactory, NoopAnimationsModule, provideNoopAnimations } from '@angular/platform-browser/animations';
|
|
14
|
-
import { ɵAnimationEngine } from '@angular/animations/browser';
|
|
15
|
-
import { ɵplatformCoreDynamic } from '@angular/platform-browser-dynamic';
|
|
16
|
-
import { Observable, Subject } from 'rxjs';
|
|
17
|
-
import * as xhr2 from 'xhr2';
|
|
18
|
-
import * as url from 'url';
|
|
19
|
-
import { DomElementSchemaRegistry } from '@angular/compiler';
|
|
20
|
-
import { first } from 'rxjs/operators';
|
|
21
|
-
|
|
22
1
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
23
2
|
var __commonJS = (cb, mod) => function __require() {
|
|
24
3
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -897,6 +876,13 @@ var require_Node = __commonJS({
|
|
|
897
876
|
set: function(v) {
|
|
898
877
|
}
|
|
899
878
|
},
|
|
879
|
+
innerText: {
|
|
880
|
+
get: function() {
|
|
881
|
+
return null;
|
|
882
|
+
},
|
|
883
|
+
set: function(v) {
|
|
884
|
+
}
|
|
885
|
+
},
|
|
900
886
|
_countChildrenOfType: { value: function(type) {
|
|
901
887
|
var sum = 0;
|
|
902
888
|
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
|
@@ -2924,6 +2910,19 @@ var require_Element = __commonJS({
|
|
|
2924
2910
|
}
|
|
2925
2911
|
}
|
|
2926
2912
|
},
|
|
2913
|
+
innerText: {
|
|
2914
|
+
get: function() {
|
|
2915
|
+
var strings = [];
|
|
2916
|
+
recursiveGetText(this, strings);
|
|
2917
|
+
return strings.join("").replace(/[ \t\n\f\r]+/g, " ").trim();
|
|
2918
|
+
},
|
|
2919
|
+
set: function(newtext) {
|
|
2920
|
+
this.removeChildren();
|
|
2921
|
+
if (newtext !== null && newtext !== void 0 && newtext !== "") {
|
|
2922
|
+
this._appendChild(this.ownerDocument.createTextNode(newtext));
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2927
2926
|
innerHTML: {
|
|
2928
2927
|
get: function() {
|
|
2929
2928
|
return this.serialize();
|
|
@@ -3627,6 +3626,17 @@ var require_Element = __commonJS({
|
|
|
3627
3626
|
}
|
|
3628
3627
|
this.value = v;
|
|
3629
3628
|
}
|
|
3629
|
+
},
|
|
3630
|
+
innerText: {
|
|
3631
|
+
get: function() {
|
|
3632
|
+
return this.value;
|
|
3633
|
+
},
|
|
3634
|
+
set: function(v) {
|
|
3635
|
+
if (v === null || v === void 0) {
|
|
3636
|
+
v = "";
|
|
3637
|
+
}
|
|
3638
|
+
this.value = v;
|
|
3639
|
+
}
|
|
3630
3640
|
}
|
|
3631
3641
|
});
|
|
3632
3642
|
Element._Attr = Attr;
|
|
@@ -3894,6 +3904,7 @@ var require_Text = __commonJS({
|
|
|
3894
3904
|
nodeName: { value: "#text" },
|
|
3895
3905
|
nodeValue,
|
|
3896
3906
|
textContent: nodeValue,
|
|
3907
|
+
innerText: nodeValue,
|
|
3897
3908
|
data: {
|
|
3898
3909
|
get: nodeValue.get,
|
|
3899
3910
|
set: function(v) {
|
|
@@ -3960,6 +3971,7 @@ var require_Comment = __commonJS({
|
|
|
3960
3971
|
nodeName: { value: "#comment" },
|
|
3961
3972
|
nodeValue,
|
|
3962
3973
|
textContent: nodeValue,
|
|
3974
|
+
innerText: nodeValue,
|
|
3963
3975
|
data: {
|
|
3964
3976
|
get: nodeValue.get,
|
|
3965
3977
|
set: function(v) {
|
|
@@ -3999,6 +4011,7 @@ var require_DocumentFragment = __commonJS({
|
|
|
3999
4011
|
}
|
|
4000
4012
|
},
|
|
4001
4013
|
textContent: Object.getOwnPropertyDescriptor(Element.prototype, "textContent"),
|
|
4014
|
+
innerText: Object.getOwnPropertyDescriptor(Element.prototype, "innerText"),
|
|
4002
4015
|
querySelector: { value: function(selector) {
|
|
4003
4016
|
var nodes = this.querySelectorAll(selector);
|
|
4004
4017
|
return nodes.length ? nodes[0] : null;
|
|
@@ -4068,6 +4081,7 @@ var require_ProcessingInstruction = __commonJS({
|
|
|
4068
4081
|
} },
|
|
4069
4082
|
nodeValue,
|
|
4070
4083
|
textContent: nodeValue,
|
|
4084
|
+
innerText: nodeValue,
|
|
4071
4085
|
data: {
|
|
4072
4086
|
get: nodeValue.get,
|
|
4073
4087
|
set: function(v) {
|
|
@@ -4745,3640 +4759,87 @@ var require_CustomEvent = __commonJS({
|
|
|
4745
4759
|
});
|
|
4746
4760
|
}
|
|
4747
4761
|
});
|
|
4748
|
-
|
|
4749
|
-
// external/npm/node_modules/domino/lib/events.js
|
|
4750
|
-
var require_events = __commonJS({
|
|
4751
|
-
"external/npm/node_modules/domino/lib/events.js"(exports, module) {
|
|
4752
|
-
"use strict";
|
|
4753
|
-
module.exports = {
|
|
4754
|
-
Event: require_Event(),
|
|
4755
|
-
UIEvent: require_UIEvent(),
|
|
4756
|
-
MouseEvent: require_MouseEvent(),
|
|
4757
|
-
CustomEvent: require_CustomEvent()
|
|
4758
|
-
};
|
|
4759
|
-
}
|
|
4760
|
-
});
|
|
4761
|
-
|
|
4762
|
-
// external/npm/node_modules/domino/lib/
|
|
4763
|
-
var
|
|
4764
|
-
"external/npm/node_modules/domino/lib/
|
|
4765
|
-
"use strict";
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
var listeners = this._listeners[event.type].concat();
|
|
4791
|
-
for (var i = 0, len = listeners.length; i < len; i++) {
|
|
4792
|
-
listeners[i].call(this, event);
|
|
4793
|
-
}
|
|
4794
|
-
}
|
|
4795
|
-
},
|
|
4796
|
-
removeListener: function(type, listener) {
|
|
4797
|
-
if (this._listeners[type]) {
|
|
4798
|
-
var listeners = this._listeners[type];
|
|
4799
|
-
for (var i = 0, len = listeners.length; i < len; i++) {
|
|
4800
|
-
if (listeners[i] === listener) {
|
|
4801
|
-
listeners.splice(i, 1);
|
|
4802
|
-
break;
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
}
|
|
4807
|
-
};
|
|
4808
|
-
function StringReader(text) {
|
|
4809
|
-
this._input = text.replace(/(\r|\n){1,2}/g, "\n");
|
|
4810
|
-
this._line = 1;
|
|
4811
|
-
this._col = 1;
|
|
4812
|
-
this._cursor = 0;
|
|
4813
|
-
}
|
|
4814
|
-
StringReader.prototype = {
|
|
4815
|
-
constructor: StringReader,
|
|
4816
|
-
getCol: function() {
|
|
4817
|
-
return this._col;
|
|
4818
|
-
},
|
|
4819
|
-
getLine: function() {
|
|
4820
|
-
return this._line;
|
|
4821
|
-
},
|
|
4822
|
-
eof: function() {
|
|
4823
|
-
return this._cursor === this._input.length;
|
|
4824
|
-
},
|
|
4825
|
-
peek: function(count) {
|
|
4826
|
-
var c = null;
|
|
4827
|
-
count = typeof count === "undefined" ? 1 : count;
|
|
4828
|
-
if (this._cursor < this._input.length) {
|
|
4829
|
-
c = this._input.charAt(this._cursor + count - 1);
|
|
4830
|
-
}
|
|
4831
|
-
return c;
|
|
4832
|
-
},
|
|
4833
|
-
read: function() {
|
|
4834
|
-
var c = null;
|
|
4835
|
-
if (this._cursor < this._input.length) {
|
|
4836
|
-
if (this._input.charAt(this._cursor) === "\n") {
|
|
4837
|
-
this._line++;
|
|
4838
|
-
this._col = 1;
|
|
4839
|
-
} else {
|
|
4840
|
-
this._col++;
|
|
4841
|
-
}
|
|
4842
|
-
c = this._input.charAt(this._cursor++);
|
|
4843
|
-
}
|
|
4844
|
-
return c;
|
|
4845
|
-
},
|
|
4846
|
-
mark: function() {
|
|
4847
|
-
this._bookmark = {
|
|
4848
|
-
cursor: this._cursor,
|
|
4849
|
-
line: this._line,
|
|
4850
|
-
col: this._col
|
|
4851
|
-
};
|
|
4852
|
-
},
|
|
4853
|
-
reset: function() {
|
|
4854
|
-
if (this._bookmark) {
|
|
4855
|
-
this._cursor = this._bookmark.cursor;
|
|
4856
|
-
this._line = this._bookmark.line;
|
|
4857
|
-
this._col = this._bookmark.col;
|
|
4858
|
-
delete this._bookmark;
|
|
4859
|
-
}
|
|
4860
|
-
},
|
|
4861
|
-
readTo: function(pattern) {
|
|
4862
|
-
var buffer = "", c;
|
|
4863
|
-
while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length) {
|
|
4864
|
-
c = this.read();
|
|
4865
|
-
if (c) {
|
|
4866
|
-
buffer += c;
|
|
4867
|
-
} else {
|
|
4868
|
-
throw new Error('Expected "' + pattern + '" at line ' + this._line + ", col " + this._col + ".");
|
|
4869
|
-
}
|
|
4870
|
-
}
|
|
4871
|
-
return buffer;
|
|
4872
|
-
},
|
|
4873
|
-
readWhile: function(filter) {
|
|
4874
|
-
var buffer = "", c = this.read();
|
|
4875
|
-
while (c !== null && filter(c)) {
|
|
4876
|
-
buffer += c;
|
|
4877
|
-
c = this.read();
|
|
4878
|
-
}
|
|
4879
|
-
return buffer;
|
|
4880
|
-
},
|
|
4881
|
-
readMatch: function(matcher) {
|
|
4882
|
-
var source = this._input.substring(this._cursor), value = null;
|
|
4883
|
-
if (typeof matcher === "string") {
|
|
4884
|
-
if (source.indexOf(matcher) === 0) {
|
|
4885
|
-
value = this.readCount(matcher.length);
|
|
4886
|
-
}
|
|
4887
|
-
} else if (matcher instanceof RegExp) {
|
|
4888
|
-
if (matcher.test(source)) {
|
|
4889
|
-
value = this.readCount(RegExp.lastMatch.length);
|
|
4890
|
-
}
|
|
4891
|
-
}
|
|
4892
|
-
return value;
|
|
4893
|
-
},
|
|
4894
|
-
readCount: function(count) {
|
|
4895
|
-
var buffer = "";
|
|
4896
|
-
while (count--) {
|
|
4897
|
-
buffer += this.read();
|
|
4898
|
-
}
|
|
4899
|
-
return buffer;
|
|
4900
|
-
}
|
|
4901
|
-
};
|
|
4902
|
-
function SyntaxError2(message, line, col) {
|
|
4903
|
-
Error.call(this);
|
|
4904
|
-
this.name = this.constructor.name;
|
|
4905
|
-
this.col = col;
|
|
4906
|
-
this.line = line;
|
|
4907
|
-
this.message = message;
|
|
4908
|
-
}
|
|
4909
|
-
SyntaxError2.prototype = Object.create(Error.prototype);
|
|
4910
|
-
SyntaxError2.prototype.constructor = SyntaxError2;
|
|
4911
|
-
function SyntaxUnit(text, line, col, type) {
|
|
4912
|
-
this.col = col;
|
|
4913
|
-
this.line = line;
|
|
4914
|
-
this.text = text;
|
|
4915
|
-
this.type = type;
|
|
4916
|
-
}
|
|
4917
|
-
SyntaxUnit.fromToken = function(token) {
|
|
4918
|
-
return new SyntaxUnit(token.value, token.startLine, token.startCol);
|
|
4919
|
-
};
|
|
4920
|
-
SyntaxUnit.prototype = {
|
|
4921
|
-
constructor: SyntaxUnit,
|
|
4922
|
-
valueOf: function() {
|
|
4923
|
-
return this.toString();
|
|
4924
|
-
},
|
|
4925
|
-
toString: function() {
|
|
4926
|
-
return this.text;
|
|
4927
|
-
}
|
|
4928
|
-
};
|
|
4929
|
-
function TokenStreamBase(input, tokenData) {
|
|
4930
|
-
this._reader = input ? new StringReader(input.toString()) : null;
|
|
4931
|
-
this._token = null;
|
|
4932
|
-
this._tokenData = tokenData;
|
|
4933
|
-
this._lt = [];
|
|
4934
|
-
this._ltIndex = 0;
|
|
4935
|
-
this._ltIndexCache = [];
|
|
4936
|
-
}
|
|
4937
|
-
TokenStreamBase.createTokenData = function(tokens) {
|
|
4938
|
-
var nameMap = [], typeMap = /* @__PURE__ */ Object.create(null), tokenData = tokens.concat([]), i = 0, len = tokenData.length + 1;
|
|
4939
|
-
tokenData.UNKNOWN = -1;
|
|
4940
|
-
tokenData.unshift({ name: "EOF" });
|
|
4941
|
-
for (; i < len; i++) {
|
|
4942
|
-
nameMap.push(tokenData[i].name);
|
|
4943
|
-
tokenData[tokenData[i].name] = i;
|
|
4944
|
-
if (tokenData[i].text) {
|
|
4945
|
-
typeMap[tokenData[i].text] = i;
|
|
4946
|
-
}
|
|
4947
|
-
}
|
|
4948
|
-
tokenData.name = function(tt) {
|
|
4949
|
-
return nameMap[tt];
|
|
4950
|
-
};
|
|
4951
|
-
tokenData.type = function(c) {
|
|
4952
|
-
return typeMap[c];
|
|
4953
|
-
};
|
|
4954
|
-
return tokenData;
|
|
4955
|
-
};
|
|
4956
|
-
TokenStreamBase.prototype = {
|
|
4957
|
-
constructor: TokenStreamBase,
|
|
4958
|
-
match: function(tokenTypes, channel) {
|
|
4959
|
-
if (!(tokenTypes instanceof Array)) {
|
|
4960
|
-
tokenTypes = [tokenTypes];
|
|
4961
|
-
}
|
|
4962
|
-
var tt = this.get(channel), i = 0, len = tokenTypes.length;
|
|
4963
|
-
while (i < len) {
|
|
4964
|
-
if (tt === tokenTypes[i++]) {
|
|
4965
|
-
return true;
|
|
4966
|
-
}
|
|
4967
|
-
}
|
|
4968
|
-
this.unget();
|
|
4969
|
-
return false;
|
|
4970
|
-
},
|
|
4971
|
-
mustMatch: function(tokenTypes, channel) {
|
|
4972
|
-
var token;
|
|
4973
|
-
if (!(tokenTypes instanceof Array)) {
|
|
4974
|
-
tokenTypes = [tokenTypes];
|
|
4975
|
-
}
|
|
4976
|
-
if (!this.match.apply(this, arguments)) {
|
|
4977
|
-
token = this.LT(1);
|
|
4978
|
-
throw new SyntaxError2("Expected " + this._tokenData[tokenTypes[0]].name + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
4979
|
-
}
|
|
4980
|
-
},
|
|
4981
|
-
advance: function(tokenTypes, channel) {
|
|
4982
|
-
while (this.LA(0) !== 0 && !this.match(tokenTypes, channel)) {
|
|
4983
|
-
this.get();
|
|
4984
|
-
}
|
|
4985
|
-
return this.LA(0);
|
|
4986
|
-
},
|
|
4987
|
-
get: function(channel) {
|
|
4988
|
-
var tokenInfo = this._tokenData, i = 0, token, info;
|
|
4989
|
-
if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length) {
|
|
4990
|
-
i++;
|
|
4991
|
-
this._token = this._lt[this._ltIndex++];
|
|
4992
|
-
info = tokenInfo[this._token.type];
|
|
4993
|
-
while (info.channel !== void 0 && channel !== info.channel && this._ltIndex < this._lt.length) {
|
|
4994
|
-
this._token = this._lt[this._ltIndex++];
|
|
4995
|
-
info = tokenInfo[this._token.type];
|
|
4996
|
-
i++;
|
|
4997
|
-
}
|
|
4998
|
-
if ((info.channel === void 0 || channel === info.channel) && this._ltIndex <= this._lt.length) {
|
|
4999
|
-
this._ltIndexCache.push(i);
|
|
5000
|
-
return this._token.type;
|
|
5001
|
-
}
|
|
5002
|
-
}
|
|
5003
|
-
token = this._getToken();
|
|
5004
|
-
if (token.type > -1 && !tokenInfo[token.type].hide) {
|
|
5005
|
-
token.channel = tokenInfo[token.type].channel;
|
|
5006
|
-
this._token = token;
|
|
5007
|
-
this._lt.push(token);
|
|
5008
|
-
this._ltIndexCache.push(this._lt.length - this._ltIndex + i);
|
|
5009
|
-
if (this._lt.length > 5) {
|
|
5010
|
-
this._lt.shift();
|
|
5011
|
-
}
|
|
5012
|
-
if (this._ltIndexCache.length > 5) {
|
|
5013
|
-
this._ltIndexCache.shift();
|
|
5014
|
-
}
|
|
5015
|
-
this._ltIndex = this._lt.length;
|
|
5016
|
-
}
|
|
5017
|
-
info = tokenInfo[token.type];
|
|
5018
|
-
if (info && (info.hide || info.channel !== void 0 && channel !== info.channel)) {
|
|
5019
|
-
return this.get(channel);
|
|
5020
|
-
} else {
|
|
5021
|
-
return token.type;
|
|
5022
|
-
}
|
|
5023
|
-
},
|
|
5024
|
-
LA: function(index) {
|
|
5025
|
-
var total = index, tt;
|
|
5026
|
-
if (index > 0) {
|
|
5027
|
-
if (index > 5) {
|
|
5028
|
-
throw new Error("Too much lookahead.");
|
|
5029
|
-
}
|
|
5030
|
-
while (total) {
|
|
5031
|
-
tt = this.get();
|
|
5032
|
-
total--;
|
|
5033
|
-
}
|
|
5034
|
-
while (total < index) {
|
|
5035
|
-
this.unget();
|
|
5036
|
-
total++;
|
|
5037
|
-
}
|
|
5038
|
-
} else if (index < 0) {
|
|
5039
|
-
if (this._lt[this._ltIndex + index]) {
|
|
5040
|
-
tt = this._lt[this._ltIndex + index].type;
|
|
5041
|
-
} else {
|
|
5042
|
-
throw new Error("Too much lookbehind.");
|
|
5043
|
-
}
|
|
5044
|
-
} else {
|
|
5045
|
-
tt = this._token.type;
|
|
5046
|
-
}
|
|
5047
|
-
return tt;
|
|
5048
|
-
},
|
|
5049
|
-
LT: function(index) {
|
|
5050
|
-
this.LA(index);
|
|
5051
|
-
return this._lt[this._ltIndex + index - 1];
|
|
5052
|
-
},
|
|
5053
|
-
peek: function() {
|
|
5054
|
-
return this.LA(1);
|
|
5055
|
-
},
|
|
5056
|
-
token: function() {
|
|
5057
|
-
return this._token;
|
|
5058
|
-
},
|
|
5059
|
-
tokenName: function(tokenType) {
|
|
5060
|
-
if (tokenType < 0 || tokenType > this._tokenData.length) {
|
|
5061
|
-
return "UNKNOWN_TOKEN";
|
|
5062
|
-
} else {
|
|
5063
|
-
return this._tokenData[tokenType].name;
|
|
5064
|
-
}
|
|
5065
|
-
},
|
|
5066
|
-
tokenType: function(tokenName) {
|
|
5067
|
-
return this._tokenData[tokenName] || -1;
|
|
5068
|
-
},
|
|
5069
|
-
unget: function() {
|
|
5070
|
-
if (this._ltIndexCache.length) {
|
|
5071
|
-
this._ltIndex -= this._ltIndexCache.pop();
|
|
5072
|
-
this._token = this._lt[this._ltIndex - 1];
|
|
5073
|
-
} else {
|
|
5074
|
-
throw new Error("Too much lookahead.");
|
|
5075
|
-
}
|
|
5076
|
-
}
|
|
5077
|
-
};
|
|
5078
|
-
parserlib.util = {
|
|
5079
|
-
__proto__: null,
|
|
5080
|
-
StringReader,
|
|
5081
|
-
SyntaxError: SyntaxError2,
|
|
5082
|
-
SyntaxUnit,
|
|
5083
|
-
EventTarget,
|
|
5084
|
-
TokenStreamBase
|
|
5085
|
-
};
|
|
5086
|
-
})();
|
|
5087
|
-
(function() {
|
|
5088
|
-
var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, StringReader = parserlib.util.StringReader, SyntaxError2 = parserlib.util.SyntaxError, SyntaxUnit = parserlib.util.SyntaxUnit;
|
|
5089
|
-
var Colors = {
|
|
5090
|
-
__proto__: null,
|
|
5091
|
-
aliceblue: "#f0f8ff",
|
|
5092
|
-
antiquewhite: "#faebd7",
|
|
5093
|
-
aqua: "#00ffff",
|
|
5094
|
-
aquamarine: "#7fffd4",
|
|
5095
|
-
azure: "#f0ffff",
|
|
5096
|
-
beige: "#f5f5dc",
|
|
5097
|
-
bisque: "#ffe4c4",
|
|
5098
|
-
black: "#000000",
|
|
5099
|
-
blanchedalmond: "#ffebcd",
|
|
5100
|
-
blue: "#0000ff",
|
|
5101
|
-
blueviolet: "#8a2be2",
|
|
5102
|
-
brown: "#a52a2a",
|
|
5103
|
-
burlywood: "#deb887",
|
|
5104
|
-
cadetblue: "#5f9ea0",
|
|
5105
|
-
chartreuse: "#7fff00",
|
|
5106
|
-
chocolate: "#d2691e",
|
|
5107
|
-
coral: "#ff7f50",
|
|
5108
|
-
cornflowerblue: "#6495ed",
|
|
5109
|
-
cornsilk: "#fff8dc",
|
|
5110
|
-
crimson: "#dc143c",
|
|
5111
|
-
cyan: "#00ffff",
|
|
5112
|
-
darkblue: "#00008b",
|
|
5113
|
-
darkcyan: "#008b8b",
|
|
5114
|
-
darkgoldenrod: "#b8860b",
|
|
5115
|
-
darkgray: "#a9a9a9",
|
|
5116
|
-
darkgrey: "#a9a9a9",
|
|
5117
|
-
darkgreen: "#006400",
|
|
5118
|
-
darkkhaki: "#bdb76b",
|
|
5119
|
-
darkmagenta: "#8b008b",
|
|
5120
|
-
darkolivegreen: "#556b2f",
|
|
5121
|
-
darkorange: "#ff8c00",
|
|
5122
|
-
darkorchid: "#9932cc",
|
|
5123
|
-
darkred: "#8b0000",
|
|
5124
|
-
darksalmon: "#e9967a",
|
|
5125
|
-
darkseagreen: "#8fbc8f",
|
|
5126
|
-
darkslateblue: "#483d8b",
|
|
5127
|
-
darkslategray: "#2f4f4f",
|
|
5128
|
-
darkslategrey: "#2f4f4f",
|
|
5129
|
-
darkturquoise: "#00ced1",
|
|
5130
|
-
darkviolet: "#9400d3",
|
|
5131
|
-
deeppink: "#ff1493",
|
|
5132
|
-
deepskyblue: "#00bfff",
|
|
5133
|
-
dimgray: "#696969",
|
|
5134
|
-
dimgrey: "#696969",
|
|
5135
|
-
dodgerblue: "#1e90ff",
|
|
5136
|
-
firebrick: "#b22222",
|
|
5137
|
-
floralwhite: "#fffaf0",
|
|
5138
|
-
forestgreen: "#228b22",
|
|
5139
|
-
fuchsia: "#ff00ff",
|
|
5140
|
-
gainsboro: "#dcdcdc",
|
|
5141
|
-
ghostwhite: "#f8f8ff",
|
|
5142
|
-
gold: "#ffd700",
|
|
5143
|
-
goldenrod: "#daa520",
|
|
5144
|
-
gray: "#808080",
|
|
5145
|
-
grey: "#808080",
|
|
5146
|
-
green: "#008000",
|
|
5147
|
-
greenyellow: "#adff2f",
|
|
5148
|
-
honeydew: "#f0fff0",
|
|
5149
|
-
hotpink: "#ff69b4",
|
|
5150
|
-
indianred: "#cd5c5c",
|
|
5151
|
-
indigo: "#4b0082",
|
|
5152
|
-
ivory: "#fffff0",
|
|
5153
|
-
khaki: "#f0e68c",
|
|
5154
|
-
lavender: "#e6e6fa",
|
|
5155
|
-
lavenderblush: "#fff0f5",
|
|
5156
|
-
lawngreen: "#7cfc00",
|
|
5157
|
-
lemonchiffon: "#fffacd",
|
|
5158
|
-
lightblue: "#add8e6",
|
|
5159
|
-
lightcoral: "#f08080",
|
|
5160
|
-
lightcyan: "#e0ffff",
|
|
5161
|
-
lightgoldenrodyellow: "#fafad2",
|
|
5162
|
-
lightgray: "#d3d3d3",
|
|
5163
|
-
lightgrey: "#d3d3d3",
|
|
5164
|
-
lightgreen: "#90ee90",
|
|
5165
|
-
lightpink: "#ffb6c1",
|
|
5166
|
-
lightsalmon: "#ffa07a",
|
|
5167
|
-
lightseagreen: "#20b2aa",
|
|
5168
|
-
lightskyblue: "#87cefa",
|
|
5169
|
-
lightslategray: "#778899",
|
|
5170
|
-
lightslategrey: "#778899",
|
|
5171
|
-
lightsteelblue: "#b0c4de",
|
|
5172
|
-
lightyellow: "#ffffe0",
|
|
5173
|
-
lime: "#00ff00",
|
|
5174
|
-
limegreen: "#32cd32",
|
|
5175
|
-
linen: "#faf0e6",
|
|
5176
|
-
magenta: "#ff00ff",
|
|
5177
|
-
maroon: "#800000",
|
|
5178
|
-
mediumaquamarine: "#66cdaa",
|
|
5179
|
-
mediumblue: "#0000cd",
|
|
5180
|
-
mediumorchid: "#ba55d3",
|
|
5181
|
-
mediumpurple: "#9370d8",
|
|
5182
|
-
mediumseagreen: "#3cb371",
|
|
5183
|
-
mediumslateblue: "#7b68ee",
|
|
5184
|
-
mediumspringgreen: "#00fa9a",
|
|
5185
|
-
mediumturquoise: "#48d1cc",
|
|
5186
|
-
mediumvioletred: "#c71585",
|
|
5187
|
-
midnightblue: "#191970",
|
|
5188
|
-
mintcream: "#f5fffa",
|
|
5189
|
-
mistyrose: "#ffe4e1",
|
|
5190
|
-
moccasin: "#ffe4b5",
|
|
5191
|
-
navajowhite: "#ffdead",
|
|
5192
|
-
navy: "#000080",
|
|
5193
|
-
oldlace: "#fdf5e6",
|
|
5194
|
-
olive: "#808000",
|
|
5195
|
-
olivedrab: "#6b8e23",
|
|
5196
|
-
orange: "#ffa500",
|
|
5197
|
-
orangered: "#ff4500",
|
|
5198
|
-
orchid: "#da70d6",
|
|
5199
|
-
palegoldenrod: "#eee8aa",
|
|
5200
|
-
palegreen: "#98fb98",
|
|
5201
|
-
paleturquoise: "#afeeee",
|
|
5202
|
-
palevioletred: "#d87093",
|
|
5203
|
-
papayawhip: "#ffefd5",
|
|
5204
|
-
peachpuff: "#ffdab9",
|
|
5205
|
-
peru: "#cd853f",
|
|
5206
|
-
pink: "#ffc0cb",
|
|
5207
|
-
plum: "#dda0dd",
|
|
5208
|
-
powderblue: "#b0e0e6",
|
|
5209
|
-
purple: "#800080",
|
|
5210
|
-
red: "#ff0000",
|
|
5211
|
-
rosybrown: "#bc8f8f",
|
|
5212
|
-
royalblue: "#4169e1",
|
|
5213
|
-
saddlebrown: "#8b4513",
|
|
5214
|
-
salmon: "#fa8072",
|
|
5215
|
-
sandybrown: "#f4a460",
|
|
5216
|
-
seagreen: "#2e8b57",
|
|
5217
|
-
seashell: "#fff5ee",
|
|
5218
|
-
sienna: "#a0522d",
|
|
5219
|
-
silver: "#c0c0c0",
|
|
5220
|
-
skyblue: "#87ceeb",
|
|
5221
|
-
slateblue: "#6a5acd",
|
|
5222
|
-
slategray: "#708090",
|
|
5223
|
-
slategrey: "#708090",
|
|
5224
|
-
snow: "#fffafa",
|
|
5225
|
-
springgreen: "#00ff7f",
|
|
5226
|
-
steelblue: "#4682b4",
|
|
5227
|
-
tan: "#d2b48c",
|
|
5228
|
-
teal: "#008080",
|
|
5229
|
-
thistle: "#d8bfd8",
|
|
5230
|
-
tomato: "#ff6347",
|
|
5231
|
-
turquoise: "#40e0d0",
|
|
5232
|
-
violet: "#ee82ee",
|
|
5233
|
-
wheat: "#f5deb3",
|
|
5234
|
-
white: "#ffffff",
|
|
5235
|
-
whitesmoke: "#f5f5f5",
|
|
5236
|
-
yellow: "#ffff00",
|
|
5237
|
-
yellowgreen: "#9acd32",
|
|
5238
|
-
currentColor: "The value of the 'color' property.",
|
|
5239
|
-
activeBorder: "Active window border.",
|
|
5240
|
-
activecaption: "Active window caption.",
|
|
5241
|
-
appworkspace: "Background color of multiple document interface.",
|
|
5242
|
-
background: "Desktop background.",
|
|
5243
|
-
buttonface: "The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5244
|
-
buttonhighlight: "The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5245
|
-
buttonshadow: "The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
|
5246
|
-
buttontext: "Text on push buttons.",
|
|
5247
|
-
captiontext: "Text in caption, size box, and scrollbar arrow box.",
|
|
5248
|
-
graytext: "Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
|
|
5249
|
-
greytext: "Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",
|
|
5250
|
-
highlight: "Item(s) selected in a control.",
|
|
5251
|
-
highlighttext: "Text of item(s) selected in a control.",
|
|
5252
|
-
inactiveborder: "Inactive window border.",
|
|
5253
|
-
inactivecaption: "Inactive window caption.",
|
|
5254
|
-
inactivecaptiontext: "Color of text in an inactive caption.",
|
|
5255
|
-
infobackground: "Background color for tooltip controls.",
|
|
5256
|
-
infotext: "Text color for tooltip controls.",
|
|
5257
|
-
menu: "Menu background.",
|
|
5258
|
-
menutext: "Text in menus.",
|
|
5259
|
-
scrollbar: "Scroll bar gray area.",
|
|
5260
|
-
threeddarkshadow: "The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5261
|
-
threedface: "The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5262
|
-
threedhighlight: "The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5263
|
-
threedlightshadow: "The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5264
|
-
threedshadow: "The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
|
5265
|
-
window: "Window background.",
|
|
5266
|
-
windowframe: "Window frame.",
|
|
5267
|
-
windowtext: "Text in windows."
|
|
5268
|
-
};
|
|
5269
|
-
function Combinator(text, line, col) {
|
|
5270
|
-
SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
|
|
5271
|
-
this.type = "unknown";
|
|
5272
|
-
if (/^\s+$/.test(text)) {
|
|
5273
|
-
this.type = "descendant";
|
|
5274
|
-
} else if (text === ">") {
|
|
5275
|
-
this.type = "child";
|
|
5276
|
-
} else if (text === "+") {
|
|
5277
|
-
this.type = "adjacent-sibling";
|
|
5278
|
-
} else if (text === "~") {
|
|
5279
|
-
this.type = "sibling";
|
|
5280
|
-
}
|
|
5281
|
-
}
|
|
5282
|
-
Combinator.prototype = new SyntaxUnit();
|
|
5283
|
-
Combinator.prototype.constructor = Combinator;
|
|
5284
|
-
function MediaFeature(name, value) {
|
|
5285
|
-
SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);
|
|
5286
|
-
this.name = name;
|
|
5287
|
-
this.value = value;
|
|
5288
|
-
}
|
|
5289
|
-
MediaFeature.prototype = new SyntaxUnit();
|
|
5290
|
-
MediaFeature.prototype.constructor = MediaFeature;
|
|
5291
|
-
function MediaQuery(modifier, mediaType, features, line, col) {
|
|
5292
|
-
SyntaxUnit.call(this, (modifier ? modifier + " " : "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
|
|
5293
|
-
this.modifier = modifier;
|
|
5294
|
-
this.mediaType = mediaType;
|
|
5295
|
-
this.features = features;
|
|
5296
|
-
}
|
|
5297
|
-
MediaQuery.prototype = new SyntaxUnit();
|
|
5298
|
-
MediaQuery.prototype.constructor = MediaQuery;
|
|
5299
|
-
function Parser(options) {
|
|
5300
|
-
EventTarget.call(this);
|
|
5301
|
-
this.options = options || {};
|
|
5302
|
-
this._tokenStream = null;
|
|
5303
|
-
}
|
|
5304
|
-
Parser.DEFAULT_TYPE = 0;
|
|
5305
|
-
Parser.COMBINATOR_TYPE = 1;
|
|
5306
|
-
Parser.MEDIA_FEATURE_TYPE = 2;
|
|
5307
|
-
Parser.MEDIA_QUERY_TYPE = 3;
|
|
5308
|
-
Parser.PROPERTY_NAME_TYPE = 4;
|
|
5309
|
-
Parser.PROPERTY_VALUE_TYPE = 5;
|
|
5310
|
-
Parser.PROPERTY_VALUE_PART_TYPE = 6;
|
|
5311
|
-
Parser.SELECTOR_TYPE = 7;
|
|
5312
|
-
Parser.SELECTOR_PART_TYPE = 8;
|
|
5313
|
-
Parser.SELECTOR_SUB_PART_TYPE = 9;
|
|
5314
|
-
Parser.prototype = function() {
|
|
5315
|
-
var proto = new EventTarget(), prop, additions = {
|
|
5316
|
-
__proto__: null,
|
|
5317
|
-
constructor: Parser,
|
|
5318
|
-
DEFAULT_TYPE: 0,
|
|
5319
|
-
COMBINATOR_TYPE: 1,
|
|
5320
|
-
MEDIA_FEATURE_TYPE: 2,
|
|
5321
|
-
MEDIA_QUERY_TYPE: 3,
|
|
5322
|
-
PROPERTY_NAME_TYPE: 4,
|
|
5323
|
-
PROPERTY_VALUE_TYPE: 5,
|
|
5324
|
-
PROPERTY_VALUE_PART_TYPE: 6,
|
|
5325
|
-
SELECTOR_TYPE: 7,
|
|
5326
|
-
SELECTOR_PART_TYPE: 8,
|
|
5327
|
-
SELECTOR_SUB_PART_TYPE: 9,
|
|
5328
|
-
_stylesheet: function() {
|
|
5329
|
-
var tokenStream = this._tokenStream, count, token, tt;
|
|
5330
|
-
this.fire("startstylesheet");
|
|
5331
|
-
this._charset();
|
|
5332
|
-
this._skipCruft();
|
|
5333
|
-
while (tokenStream.peek() === Tokens.IMPORT_SYM) {
|
|
5334
|
-
this._import();
|
|
5335
|
-
this._skipCruft();
|
|
5336
|
-
}
|
|
5337
|
-
while (tokenStream.peek() === Tokens.NAMESPACE_SYM) {
|
|
5338
|
-
this._namespace();
|
|
5339
|
-
this._skipCruft();
|
|
5340
|
-
}
|
|
5341
|
-
tt = tokenStream.peek();
|
|
5342
|
-
while (tt > Tokens.EOF) {
|
|
5343
|
-
try {
|
|
5344
|
-
switch (tt) {
|
|
5345
|
-
case Tokens.MEDIA_SYM:
|
|
5346
|
-
this._media();
|
|
5347
|
-
this._skipCruft();
|
|
5348
|
-
break;
|
|
5349
|
-
case Tokens.PAGE_SYM:
|
|
5350
|
-
this._page();
|
|
5351
|
-
this._skipCruft();
|
|
5352
|
-
break;
|
|
5353
|
-
case Tokens.FONT_FACE_SYM:
|
|
5354
|
-
this._font_face();
|
|
5355
|
-
this._skipCruft();
|
|
5356
|
-
break;
|
|
5357
|
-
case Tokens.KEYFRAMES_SYM:
|
|
5358
|
-
this._keyframes();
|
|
5359
|
-
this._skipCruft();
|
|
5360
|
-
break;
|
|
5361
|
-
case Tokens.VIEWPORT_SYM:
|
|
5362
|
-
this._viewport();
|
|
5363
|
-
this._skipCruft();
|
|
5364
|
-
break;
|
|
5365
|
-
case Tokens.DOCUMENT_SYM:
|
|
5366
|
-
this._document();
|
|
5367
|
-
this._skipCruft();
|
|
5368
|
-
break;
|
|
5369
|
-
case Tokens.UNKNOWN_SYM:
|
|
5370
|
-
tokenStream.get();
|
|
5371
|
-
if (!this.options.strict) {
|
|
5372
|
-
this.fire({
|
|
5373
|
-
type: "error",
|
|
5374
|
-
error: null,
|
|
5375
|
-
message: "Unknown @ rule: " + tokenStream.LT(0).value + ".",
|
|
5376
|
-
line: tokenStream.LT(0).startLine,
|
|
5377
|
-
col: tokenStream.LT(0).startCol
|
|
5378
|
-
});
|
|
5379
|
-
count = 0;
|
|
5380
|
-
while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) {
|
|
5381
|
-
count++;
|
|
5382
|
-
}
|
|
5383
|
-
while (count) {
|
|
5384
|
-
tokenStream.advance([Tokens.RBRACE]);
|
|
5385
|
-
count--;
|
|
5386
|
-
}
|
|
5387
|
-
} else {
|
|
5388
|
-
throw new SyntaxError2("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
|
|
5389
|
-
}
|
|
5390
|
-
break;
|
|
5391
|
-
case Tokens.S:
|
|
5392
|
-
this._readWhitespace();
|
|
5393
|
-
break;
|
|
5394
|
-
default:
|
|
5395
|
-
if (!this._ruleset()) {
|
|
5396
|
-
switch (tt) {
|
|
5397
|
-
case Tokens.CHARSET_SYM:
|
|
5398
|
-
token = tokenStream.LT(1);
|
|
5399
|
-
this._charset(false);
|
|
5400
|
-
throw new SyntaxError2("@charset not allowed here.", token.startLine, token.startCol);
|
|
5401
|
-
case Tokens.IMPORT_SYM:
|
|
5402
|
-
token = tokenStream.LT(1);
|
|
5403
|
-
this._import(false);
|
|
5404
|
-
throw new SyntaxError2("@import not allowed here.", token.startLine, token.startCol);
|
|
5405
|
-
case Tokens.NAMESPACE_SYM:
|
|
5406
|
-
token = tokenStream.LT(1);
|
|
5407
|
-
this._namespace(false);
|
|
5408
|
-
throw new SyntaxError2("@namespace not allowed here.", token.startLine, token.startCol);
|
|
5409
|
-
default:
|
|
5410
|
-
tokenStream.get();
|
|
5411
|
-
this._unexpectedToken(tokenStream.token());
|
|
5412
|
-
}
|
|
5413
|
-
}
|
|
5414
|
-
}
|
|
5415
|
-
} catch (ex) {
|
|
5416
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
5417
|
-
this.fire({
|
|
5418
|
-
type: "error",
|
|
5419
|
-
error: ex,
|
|
5420
|
-
message: ex.message,
|
|
5421
|
-
line: ex.line,
|
|
5422
|
-
col: ex.col
|
|
5423
|
-
});
|
|
5424
|
-
} else {
|
|
5425
|
-
throw ex;
|
|
5426
|
-
}
|
|
5427
|
-
}
|
|
5428
|
-
tt = tokenStream.peek();
|
|
5429
|
-
}
|
|
5430
|
-
if (tt !== Tokens.EOF) {
|
|
5431
|
-
this._unexpectedToken(tokenStream.token());
|
|
5432
|
-
}
|
|
5433
|
-
this.fire("endstylesheet");
|
|
5434
|
-
},
|
|
5435
|
-
_charset: function(emit) {
|
|
5436
|
-
var tokenStream = this._tokenStream, charset, token, line, col;
|
|
5437
|
-
if (tokenStream.match(Tokens.CHARSET_SYM)) {
|
|
5438
|
-
line = tokenStream.token().startLine;
|
|
5439
|
-
col = tokenStream.token().startCol;
|
|
5440
|
-
this._readWhitespace();
|
|
5441
|
-
tokenStream.mustMatch(Tokens.STRING);
|
|
5442
|
-
token = tokenStream.token();
|
|
5443
|
-
charset = token.value;
|
|
5444
|
-
this._readWhitespace();
|
|
5445
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5446
|
-
if (emit !== false) {
|
|
5447
|
-
this.fire({
|
|
5448
|
-
type: "charset",
|
|
5449
|
-
charset,
|
|
5450
|
-
line,
|
|
5451
|
-
col
|
|
5452
|
-
});
|
|
5453
|
-
}
|
|
5454
|
-
}
|
|
5455
|
-
},
|
|
5456
|
-
_import: function(emit) {
|
|
5457
|
-
var tokenStream = this._tokenStream, uri, importToken, mediaList = [];
|
|
5458
|
-
tokenStream.mustMatch(Tokens.IMPORT_SYM);
|
|
5459
|
-
importToken = tokenStream.token();
|
|
5460
|
-
this._readWhitespace();
|
|
5461
|
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
|
5462
|
-
uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1");
|
|
5463
|
-
this._readWhitespace();
|
|
5464
|
-
mediaList = this._media_query_list();
|
|
5465
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5466
|
-
this._readWhitespace();
|
|
5467
|
-
if (emit !== false) {
|
|
5468
|
-
this.fire({
|
|
5469
|
-
type: "import",
|
|
5470
|
-
uri,
|
|
5471
|
-
media: mediaList,
|
|
5472
|
-
line: importToken.startLine,
|
|
5473
|
-
col: importToken.startCol
|
|
5474
|
-
});
|
|
5475
|
-
}
|
|
5476
|
-
},
|
|
5477
|
-
_namespace: function(emit) {
|
|
5478
|
-
var tokenStream = this._tokenStream, line, col, prefix, uri;
|
|
5479
|
-
tokenStream.mustMatch(Tokens.NAMESPACE_SYM);
|
|
5480
|
-
line = tokenStream.token().startLine;
|
|
5481
|
-
col = tokenStream.token().startCol;
|
|
5482
|
-
this._readWhitespace();
|
|
5483
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5484
|
-
prefix = tokenStream.token().value;
|
|
5485
|
-
this._readWhitespace();
|
|
5486
|
-
}
|
|
5487
|
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
|
5488
|
-
uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");
|
|
5489
|
-
this._readWhitespace();
|
|
5490
|
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
|
5491
|
-
this._readWhitespace();
|
|
5492
|
-
if (emit !== false) {
|
|
5493
|
-
this.fire({
|
|
5494
|
-
type: "namespace",
|
|
5495
|
-
prefix,
|
|
5496
|
-
uri,
|
|
5497
|
-
line,
|
|
5498
|
-
col
|
|
5499
|
-
});
|
|
5500
|
-
}
|
|
5501
|
-
},
|
|
5502
|
-
_media: function() {
|
|
5503
|
-
var tokenStream = this._tokenStream, line, col, mediaList;
|
|
5504
|
-
tokenStream.mustMatch(Tokens.MEDIA_SYM);
|
|
5505
|
-
line = tokenStream.token().startLine;
|
|
5506
|
-
col = tokenStream.token().startCol;
|
|
5507
|
-
this._readWhitespace();
|
|
5508
|
-
mediaList = this._media_query_list();
|
|
5509
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
5510
|
-
this._readWhitespace();
|
|
5511
|
-
this.fire({
|
|
5512
|
-
type: "startmedia",
|
|
5513
|
-
media: mediaList,
|
|
5514
|
-
line,
|
|
5515
|
-
col
|
|
5516
|
-
});
|
|
5517
|
-
while (true) {
|
|
5518
|
-
if (tokenStream.peek() === Tokens.PAGE_SYM) {
|
|
5519
|
-
this._page();
|
|
5520
|
-
} else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) {
|
|
5521
|
-
this._font_face();
|
|
5522
|
-
} else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) {
|
|
5523
|
-
this._viewport();
|
|
5524
|
-
} else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) {
|
|
5525
|
-
this._document();
|
|
5526
|
-
} else if (!this._ruleset()) {
|
|
5527
|
-
break;
|
|
5528
|
-
}
|
|
5529
|
-
}
|
|
5530
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
5531
|
-
this._readWhitespace();
|
|
5532
|
-
this.fire({
|
|
5533
|
-
type: "endmedia",
|
|
5534
|
-
media: mediaList,
|
|
5535
|
-
line,
|
|
5536
|
-
col
|
|
5537
|
-
});
|
|
5538
|
-
},
|
|
5539
|
-
_media_query_list: function() {
|
|
5540
|
-
var tokenStream = this._tokenStream, mediaList = [];
|
|
5541
|
-
this._readWhitespace();
|
|
5542
|
-
if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) {
|
|
5543
|
-
mediaList.push(this._media_query());
|
|
5544
|
-
}
|
|
5545
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5546
|
-
this._readWhitespace();
|
|
5547
|
-
mediaList.push(this._media_query());
|
|
5548
|
-
}
|
|
5549
|
-
return mediaList;
|
|
5550
|
-
},
|
|
5551
|
-
_media_query: function() {
|
|
5552
|
-
var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = [];
|
|
5553
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5554
|
-
ident = tokenStream.token().value.toLowerCase();
|
|
5555
|
-
if (ident !== "only" && ident !== "not") {
|
|
5556
|
-
tokenStream.unget();
|
|
5557
|
-
ident = null;
|
|
5558
|
-
} else {
|
|
5559
|
-
token = tokenStream.token();
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
this._readWhitespace();
|
|
5563
|
-
if (tokenStream.peek() === Tokens.IDENT) {
|
|
5564
|
-
type = this._media_type();
|
|
5565
|
-
if (token === null) {
|
|
5566
|
-
token = tokenStream.token();
|
|
5567
|
-
}
|
|
5568
|
-
} else if (tokenStream.peek() === Tokens.LPAREN) {
|
|
5569
|
-
if (token === null) {
|
|
5570
|
-
token = tokenStream.LT(1);
|
|
5571
|
-
}
|
|
5572
|
-
expressions.push(this._media_expression());
|
|
5573
|
-
}
|
|
5574
|
-
if (type === null && expressions.length === 0) {
|
|
5575
|
-
return null;
|
|
5576
|
-
} else {
|
|
5577
|
-
this._readWhitespace();
|
|
5578
|
-
while (tokenStream.match(Tokens.IDENT)) {
|
|
5579
|
-
if (tokenStream.token().value.toLowerCase() !== "and") {
|
|
5580
|
-
this._unexpectedToken(tokenStream.token());
|
|
5581
|
-
}
|
|
5582
|
-
this._readWhitespace();
|
|
5583
|
-
expressions.push(this._media_expression());
|
|
5584
|
-
}
|
|
5585
|
-
}
|
|
5586
|
-
return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);
|
|
5587
|
-
},
|
|
5588
|
-
_media_type: function() {
|
|
5589
|
-
return this._media_feature();
|
|
5590
|
-
},
|
|
5591
|
-
_media_expression: function() {
|
|
5592
|
-
var tokenStream = this._tokenStream, feature = null, token, expression = null;
|
|
5593
|
-
tokenStream.mustMatch(Tokens.LPAREN);
|
|
5594
|
-
feature = this._media_feature();
|
|
5595
|
-
this._readWhitespace();
|
|
5596
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
5597
|
-
this._readWhitespace();
|
|
5598
|
-
token = tokenStream.LT(1);
|
|
5599
|
-
expression = this._expression();
|
|
5600
|
-
}
|
|
5601
|
-
tokenStream.mustMatch(Tokens.RPAREN);
|
|
5602
|
-
this._readWhitespace();
|
|
5603
|
-
return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null);
|
|
5604
|
-
},
|
|
5605
|
-
_media_feature: function() {
|
|
5606
|
-
var tokenStream = this._tokenStream;
|
|
5607
|
-
this._readWhitespace();
|
|
5608
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5609
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
5610
|
-
},
|
|
5611
|
-
_page: function() {
|
|
5612
|
-
var tokenStream = this._tokenStream, line, col, identifier = null, pseudoPage = null;
|
|
5613
|
-
tokenStream.mustMatch(Tokens.PAGE_SYM);
|
|
5614
|
-
line = tokenStream.token().startLine;
|
|
5615
|
-
col = tokenStream.token().startCol;
|
|
5616
|
-
this._readWhitespace();
|
|
5617
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5618
|
-
identifier = tokenStream.token().value;
|
|
5619
|
-
if (identifier.toLowerCase() === "auto") {
|
|
5620
|
-
this._unexpectedToken(tokenStream.token());
|
|
5621
|
-
}
|
|
5622
|
-
}
|
|
5623
|
-
if (tokenStream.peek() === Tokens.COLON) {
|
|
5624
|
-
pseudoPage = this._pseudo_page();
|
|
5625
|
-
}
|
|
5626
|
-
this._readWhitespace();
|
|
5627
|
-
this.fire({
|
|
5628
|
-
type: "startpage",
|
|
5629
|
-
id: identifier,
|
|
5630
|
-
pseudo: pseudoPage,
|
|
5631
|
-
line,
|
|
5632
|
-
col
|
|
5633
|
-
});
|
|
5634
|
-
this._readDeclarations(true, true);
|
|
5635
|
-
this.fire({
|
|
5636
|
-
type: "endpage",
|
|
5637
|
-
id: identifier,
|
|
5638
|
-
pseudo: pseudoPage,
|
|
5639
|
-
line,
|
|
5640
|
-
col
|
|
5641
|
-
});
|
|
5642
|
-
},
|
|
5643
|
-
_margin: function() {
|
|
5644
|
-
var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym();
|
|
5645
|
-
if (marginSym) {
|
|
5646
|
-
line = tokenStream.token().startLine;
|
|
5647
|
-
col = tokenStream.token().startCol;
|
|
5648
|
-
this.fire({
|
|
5649
|
-
type: "startpagemargin",
|
|
5650
|
-
margin: marginSym,
|
|
5651
|
-
line,
|
|
5652
|
-
col
|
|
5653
|
-
});
|
|
5654
|
-
this._readDeclarations(true);
|
|
5655
|
-
this.fire({
|
|
5656
|
-
type: "endpagemargin",
|
|
5657
|
-
margin: marginSym,
|
|
5658
|
-
line,
|
|
5659
|
-
col
|
|
5660
|
-
});
|
|
5661
|
-
return true;
|
|
5662
|
-
} else {
|
|
5663
|
-
return false;
|
|
5664
|
-
}
|
|
5665
|
-
},
|
|
5666
|
-
_margin_sym: function() {
|
|
5667
|
-
var tokenStream = this._tokenStream;
|
|
5668
|
-
if (tokenStream.match([
|
|
5669
|
-
Tokens.TOPLEFTCORNER_SYM,
|
|
5670
|
-
Tokens.TOPLEFT_SYM,
|
|
5671
|
-
Tokens.TOPCENTER_SYM,
|
|
5672
|
-
Tokens.TOPRIGHT_SYM,
|
|
5673
|
-
Tokens.TOPRIGHTCORNER_SYM,
|
|
5674
|
-
Tokens.BOTTOMLEFTCORNER_SYM,
|
|
5675
|
-
Tokens.BOTTOMLEFT_SYM,
|
|
5676
|
-
Tokens.BOTTOMCENTER_SYM,
|
|
5677
|
-
Tokens.BOTTOMRIGHT_SYM,
|
|
5678
|
-
Tokens.BOTTOMRIGHTCORNER_SYM,
|
|
5679
|
-
Tokens.LEFTTOP_SYM,
|
|
5680
|
-
Tokens.LEFTMIDDLE_SYM,
|
|
5681
|
-
Tokens.LEFTBOTTOM_SYM,
|
|
5682
|
-
Tokens.RIGHTTOP_SYM,
|
|
5683
|
-
Tokens.RIGHTMIDDLE_SYM,
|
|
5684
|
-
Tokens.RIGHTBOTTOM_SYM
|
|
5685
|
-
])) {
|
|
5686
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
5687
|
-
} else {
|
|
5688
|
-
return null;
|
|
5689
|
-
}
|
|
5690
|
-
},
|
|
5691
|
-
_pseudo_page: function() {
|
|
5692
|
-
var tokenStream = this._tokenStream;
|
|
5693
|
-
tokenStream.mustMatch(Tokens.COLON);
|
|
5694
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5695
|
-
return tokenStream.token().value;
|
|
5696
|
-
},
|
|
5697
|
-
_font_face: function() {
|
|
5698
|
-
var tokenStream = this._tokenStream, line, col;
|
|
5699
|
-
tokenStream.mustMatch(Tokens.FONT_FACE_SYM);
|
|
5700
|
-
line = tokenStream.token().startLine;
|
|
5701
|
-
col = tokenStream.token().startCol;
|
|
5702
|
-
this._readWhitespace();
|
|
5703
|
-
this.fire({
|
|
5704
|
-
type: "startfontface",
|
|
5705
|
-
line,
|
|
5706
|
-
col
|
|
5707
|
-
});
|
|
5708
|
-
this._readDeclarations(true);
|
|
5709
|
-
this.fire({
|
|
5710
|
-
type: "endfontface",
|
|
5711
|
-
line,
|
|
5712
|
-
col
|
|
5713
|
-
});
|
|
5714
|
-
},
|
|
5715
|
-
_viewport: function() {
|
|
5716
|
-
var tokenStream = this._tokenStream, line, col;
|
|
5717
|
-
tokenStream.mustMatch(Tokens.VIEWPORT_SYM);
|
|
5718
|
-
line = tokenStream.token().startLine;
|
|
5719
|
-
col = tokenStream.token().startCol;
|
|
5720
|
-
this._readWhitespace();
|
|
5721
|
-
this.fire({
|
|
5722
|
-
type: "startviewport",
|
|
5723
|
-
line,
|
|
5724
|
-
col
|
|
5725
|
-
});
|
|
5726
|
-
this._readDeclarations(true);
|
|
5727
|
-
this.fire({
|
|
5728
|
-
type: "endviewport",
|
|
5729
|
-
line,
|
|
5730
|
-
col
|
|
5731
|
-
});
|
|
5732
|
-
},
|
|
5733
|
-
_document: function() {
|
|
5734
|
-
var tokenStream = this._tokenStream, token, functions = [], prefix = "";
|
|
5735
|
-
tokenStream.mustMatch(Tokens.DOCUMENT_SYM);
|
|
5736
|
-
token = tokenStream.token();
|
|
5737
|
-
if (/^@\-([^\-]+)\-/.test(token.value)) {
|
|
5738
|
-
prefix = RegExp.$1;
|
|
5739
|
-
}
|
|
5740
|
-
this._readWhitespace();
|
|
5741
|
-
functions.push(this._document_function());
|
|
5742
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5743
|
-
this._readWhitespace();
|
|
5744
|
-
functions.push(this._document_function());
|
|
5745
|
-
}
|
|
5746
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
5747
|
-
this._readWhitespace();
|
|
5748
|
-
this.fire({
|
|
5749
|
-
type: "startdocument",
|
|
5750
|
-
functions,
|
|
5751
|
-
prefix,
|
|
5752
|
-
line: token.startLine,
|
|
5753
|
-
col: token.startCol
|
|
5754
|
-
});
|
|
5755
|
-
while (true) {
|
|
5756
|
-
if (tokenStream.peek() === Tokens.PAGE_SYM) {
|
|
5757
|
-
this._page();
|
|
5758
|
-
} else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) {
|
|
5759
|
-
this._font_face();
|
|
5760
|
-
} else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) {
|
|
5761
|
-
this._viewport();
|
|
5762
|
-
} else if (tokenStream.peek() === Tokens.MEDIA_SYM) {
|
|
5763
|
-
this._media();
|
|
5764
|
-
} else if (!this._ruleset()) {
|
|
5765
|
-
break;
|
|
5766
|
-
}
|
|
5767
|
-
}
|
|
5768
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
5769
|
-
this._readWhitespace();
|
|
5770
|
-
this.fire({
|
|
5771
|
-
type: "enddocument",
|
|
5772
|
-
functions,
|
|
5773
|
-
prefix,
|
|
5774
|
-
line: token.startLine,
|
|
5775
|
-
col: token.startCol
|
|
5776
|
-
});
|
|
5777
|
-
},
|
|
5778
|
-
_document_function: function() {
|
|
5779
|
-
var tokenStream = this._tokenStream, value;
|
|
5780
|
-
if (tokenStream.match(Tokens.URI)) {
|
|
5781
|
-
value = tokenStream.token().value;
|
|
5782
|
-
this._readWhitespace();
|
|
5783
|
-
} else {
|
|
5784
|
-
value = this._function();
|
|
5785
|
-
}
|
|
5786
|
-
return value;
|
|
5787
|
-
},
|
|
5788
|
-
_operator: function(inFunction) {
|
|
5789
|
-
var tokenStream = this._tokenStream, token = null;
|
|
5790
|
-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS])) {
|
|
5791
|
-
token = tokenStream.token();
|
|
5792
|
-
this._readWhitespace();
|
|
5793
|
-
}
|
|
5794
|
-
return token ? PropertyValuePart.fromToken(token) : null;
|
|
5795
|
-
},
|
|
5796
|
-
_combinator: function() {
|
|
5797
|
-
var tokenStream = this._tokenStream, value = null, token;
|
|
5798
|
-
if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) {
|
|
5799
|
-
token = tokenStream.token();
|
|
5800
|
-
value = new Combinator(token.value, token.startLine, token.startCol);
|
|
5801
|
-
this._readWhitespace();
|
|
5802
|
-
}
|
|
5803
|
-
return value;
|
|
5804
|
-
},
|
|
5805
|
-
_unary_operator: function() {
|
|
5806
|
-
var tokenStream = this._tokenStream;
|
|
5807
|
-
if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) {
|
|
5808
|
-
return tokenStream.token().value;
|
|
5809
|
-
} else {
|
|
5810
|
-
return null;
|
|
5811
|
-
}
|
|
5812
|
-
},
|
|
5813
|
-
_property: function() {
|
|
5814
|
-
var tokenStream = this._tokenStream, value = null, hack = null, tokenValue, token, line, col;
|
|
5815
|
-
if (tokenStream.peek() === Tokens.STAR && this.options.starHack) {
|
|
5816
|
-
tokenStream.get();
|
|
5817
|
-
token = tokenStream.token();
|
|
5818
|
-
hack = token.value;
|
|
5819
|
-
line = token.startLine;
|
|
5820
|
-
col = token.startCol;
|
|
5821
|
-
}
|
|
5822
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
5823
|
-
token = tokenStream.token();
|
|
5824
|
-
tokenValue = token.value;
|
|
5825
|
-
if (tokenValue.charAt(0) === "_" && this.options.underscoreHack) {
|
|
5826
|
-
hack = "_";
|
|
5827
|
-
tokenValue = tokenValue.substring(1);
|
|
5828
|
-
}
|
|
5829
|
-
value = new PropertyName(tokenValue, hack, line || token.startLine, col || token.startCol);
|
|
5830
|
-
this._readWhitespace();
|
|
5831
|
-
}
|
|
5832
|
-
return value;
|
|
5833
|
-
},
|
|
5834
|
-
_ruleset: function() {
|
|
5835
|
-
var tokenStream = this._tokenStream, tt, selectors;
|
|
5836
|
-
try {
|
|
5837
|
-
selectors = this._selectors_group();
|
|
5838
|
-
} catch (ex) {
|
|
5839
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
5840
|
-
this.fire({
|
|
5841
|
-
type: "error",
|
|
5842
|
-
error: ex,
|
|
5843
|
-
message: ex.message,
|
|
5844
|
-
line: ex.line,
|
|
5845
|
-
col: ex.col
|
|
5846
|
-
});
|
|
5847
|
-
tt = tokenStream.advance([Tokens.RBRACE]);
|
|
5848
|
-
if (tt === Tokens.RBRACE) {
|
|
5849
|
-
} else {
|
|
5850
|
-
throw ex;
|
|
5851
|
-
}
|
|
5852
|
-
} else {
|
|
5853
|
-
throw ex;
|
|
5854
|
-
}
|
|
5855
|
-
return true;
|
|
5856
|
-
}
|
|
5857
|
-
if (selectors) {
|
|
5858
|
-
this.fire({
|
|
5859
|
-
type: "startrule",
|
|
5860
|
-
selectors,
|
|
5861
|
-
line: selectors[0].line,
|
|
5862
|
-
col: selectors[0].col
|
|
5863
|
-
});
|
|
5864
|
-
this._readDeclarations(true);
|
|
5865
|
-
this.fire({
|
|
5866
|
-
type: "endrule",
|
|
5867
|
-
selectors,
|
|
5868
|
-
line: selectors[0].line,
|
|
5869
|
-
col: selectors[0].col
|
|
5870
|
-
});
|
|
5871
|
-
}
|
|
5872
|
-
return selectors;
|
|
5873
|
-
},
|
|
5874
|
-
_selectors_group: function() {
|
|
5875
|
-
var tokenStream = this._tokenStream, selectors = [], selector;
|
|
5876
|
-
selector = this._selector();
|
|
5877
|
-
if (selector !== null) {
|
|
5878
|
-
selectors.push(selector);
|
|
5879
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
5880
|
-
this._readWhitespace();
|
|
5881
|
-
selector = this._selector();
|
|
5882
|
-
if (selector !== null) {
|
|
5883
|
-
selectors.push(selector);
|
|
5884
|
-
} else {
|
|
5885
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5886
|
-
}
|
|
5887
|
-
}
|
|
5888
|
-
}
|
|
5889
|
-
return selectors.length ? selectors : null;
|
|
5890
|
-
},
|
|
5891
|
-
_selector: function() {
|
|
5892
|
-
var tokenStream = this._tokenStream, selector = [], nextSelector = null, combinator = null, ws = null;
|
|
5893
|
-
nextSelector = this._simple_selector_sequence();
|
|
5894
|
-
if (nextSelector === null) {
|
|
5895
|
-
return null;
|
|
5896
|
-
}
|
|
5897
|
-
selector.push(nextSelector);
|
|
5898
|
-
do {
|
|
5899
|
-
combinator = this._combinator();
|
|
5900
|
-
if (combinator !== null) {
|
|
5901
|
-
selector.push(combinator);
|
|
5902
|
-
nextSelector = this._simple_selector_sequence();
|
|
5903
|
-
if (nextSelector === null) {
|
|
5904
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5905
|
-
} else {
|
|
5906
|
-
selector.push(nextSelector);
|
|
5907
|
-
}
|
|
5908
|
-
} else {
|
|
5909
|
-
if (this._readWhitespace()) {
|
|
5910
|
-
ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);
|
|
5911
|
-
combinator = this._combinator();
|
|
5912
|
-
nextSelector = this._simple_selector_sequence();
|
|
5913
|
-
if (nextSelector === null) {
|
|
5914
|
-
if (combinator !== null) {
|
|
5915
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
5916
|
-
}
|
|
5917
|
-
} else {
|
|
5918
|
-
if (combinator !== null) {
|
|
5919
|
-
selector.push(combinator);
|
|
5920
|
-
} else {
|
|
5921
|
-
selector.push(ws);
|
|
5922
|
-
}
|
|
5923
|
-
selector.push(nextSelector);
|
|
5924
|
-
}
|
|
5925
|
-
} else {
|
|
5926
|
-
break;
|
|
5927
|
-
}
|
|
5928
|
-
}
|
|
5929
|
-
} while (true);
|
|
5930
|
-
return new Selector(selector, selector[0].line, selector[0].col);
|
|
5931
|
-
},
|
|
5932
|
-
_simple_selector_sequence: function() {
|
|
5933
|
-
var tokenStream = this._tokenStream, elementName = null, modifiers = [], selectorText = "", components = [
|
|
5934
|
-
function() {
|
|
5935
|
-
return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null;
|
|
5936
|
-
},
|
|
5937
|
-
this._class,
|
|
5938
|
-
this._attrib,
|
|
5939
|
-
this._pseudo,
|
|
5940
|
-
this._negation
|
|
5941
|
-
], i = 0, len = components.length, component = null, line, col;
|
|
5942
|
-
line = tokenStream.LT(1).startLine;
|
|
5943
|
-
col = tokenStream.LT(1).startCol;
|
|
5944
|
-
elementName = this._type_selector();
|
|
5945
|
-
if (!elementName) {
|
|
5946
|
-
elementName = this._universal();
|
|
5947
|
-
}
|
|
5948
|
-
if (elementName !== null) {
|
|
5949
|
-
selectorText += elementName;
|
|
5950
|
-
}
|
|
5951
|
-
while (true) {
|
|
5952
|
-
if (tokenStream.peek() === Tokens.S) {
|
|
5953
|
-
break;
|
|
5954
|
-
}
|
|
5955
|
-
while (i < len && component === null) {
|
|
5956
|
-
component = components[i++].call(this);
|
|
5957
|
-
}
|
|
5958
|
-
if (component === null) {
|
|
5959
|
-
if (selectorText === "") {
|
|
5960
|
-
return null;
|
|
5961
|
-
} else {
|
|
5962
|
-
break;
|
|
5963
|
-
}
|
|
5964
|
-
} else {
|
|
5965
|
-
i = 0;
|
|
5966
|
-
modifiers.push(component);
|
|
5967
|
-
selectorText += component.toString();
|
|
5968
|
-
component = null;
|
|
5969
|
-
}
|
|
5970
|
-
}
|
|
5971
|
-
return selectorText !== "" ? new SelectorPart(elementName, modifiers, selectorText, line, col) : null;
|
|
5972
|
-
},
|
|
5973
|
-
_type_selector: function() {
|
|
5974
|
-
var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name();
|
|
5975
|
-
if (!elementName) {
|
|
5976
|
-
if (ns) {
|
|
5977
|
-
tokenStream.unget();
|
|
5978
|
-
if (ns.length > 1) {
|
|
5979
|
-
tokenStream.unget();
|
|
5980
|
-
}
|
|
5981
|
-
}
|
|
5982
|
-
return null;
|
|
5983
|
-
} else {
|
|
5984
|
-
if (ns) {
|
|
5985
|
-
elementName.text = ns + elementName.text;
|
|
5986
|
-
elementName.col -= ns.length;
|
|
5987
|
-
}
|
|
5988
|
-
return elementName;
|
|
5989
|
-
}
|
|
5990
|
-
},
|
|
5991
|
-
_class: function() {
|
|
5992
|
-
var tokenStream = this._tokenStream, token;
|
|
5993
|
-
if (tokenStream.match(Tokens.DOT)) {
|
|
5994
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
5995
|
-
token = tokenStream.token();
|
|
5996
|
-
return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1);
|
|
5997
|
-
} else {
|
|
5998
|
-
return null;
|
|
5999
|
-
}
|
|
6000
|
-
},
|
|
6001
|
-
_element_name: function() {
|
|
6002
|
-
var tokenStream = this._tokenStream, token;
|
|
6003
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
6004
|
-
token = tokenStream.token();
|
|
6005
|
-
return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol);
|
|
6006
|
-
} else {
|
|
6007
|
-
return null;
|
|
6008
|
-
}
|
|
6009
|
-
},
|
|
6010
|
-
_namespace_prefix: function() {
|
|
6011
|
-
var tokenStream = this._tokenStream, value = "";
|
|
6012
|
-
if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) {
|
|
6013
|
-
if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) {
|
|
6014
|
-
value += tokenStream.token().value;
|
|
6015
|
-
}
|
|
6016
|
-
tokenStream.mustMatch(Tokens.PIPE);
|
|
6017
|
-
value += "|";
|
|
6018
|
-
}
|
|
6019
|
-
return value.length ? value : null;
|
|
6020
|
-
},
|
|
6021
|
-
_universal: function() {
|
|
6022
|
-
var tokenStream = this._tokenStream, value = "", ns;
|
|
6023
|
-
ns = this._namespace_prefix();
|
|
6024
|
-
if (ns) {
|
|
6025
|
-
value += ns;
|
|
6026
|
-
}
|
|
6027
|
-
if (tokenStream.match(Tokens.STAR)) {
|
|
6028
|
-
value += "*";
|
|
6029
|
-
}
|
|
6030
|
-
return value.length ? value : null;
|
|
6031
|
-
},
|
|
6032
|
-
_attrib: function() {
|
|
6033
|
-
var tokenStream = this._tokenStream, value = null, ns, token;
|
|
6034
|
-
if (tokenStream.match(Tokens.LBRACKET)) {
|
|
6035
|
-
token = tokenStream.token();
|
|
6036
|
-
value = token.value;
|
|
6037
|
-
value += this._readWhitespace();
|
|
6038
|
-
ns = this._namespace_prefix();
|
|
6039
|
-
if (ns) {
|
|
6040
|
-
value += ns;
|
|
6041
|
-
}
|
|
6042
|
-
tokenStream.mustMatch(Tokens.IDENT);
|
|
6043
|
-
value += tokenStream.token().value;
|
|
6044
|
-
value += this._readWhitespace();
|
|
6045
|
-
if (tokenStream.match([
|
|
6046
|
-
Tokens.PREFIXMATCH,
|
|
6047
|
-
Tokens.SUFFIXMATCH,
|
|
6048
|
-
Tokens.SUBSTRINGMATCH,
|
|
6049
|
-
Tokens.EQUALS,
|
|
6050
|
-
Tokens.INCLUDES,
|
|
6051
|
-
Tokens.DASHMATCH
|
|
6052
|
-
])) {
|
|
6053
|
-
value += tokenStream.token().value;
|
|
6054
|
-
value += this._readWhitespace();
|
|
6055
|
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
|
6056
|
-
value += tokenStream.token().value;
|
|
6057
|
-
value += this._readWhitespace();
|
|
6058
|
-
}
|
|
6059
|
-
tokenStream.mustMatch(Tokens.RBRACKET);
|
|
6060
|
-
return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol);
|
|
6061
|
-
} else {
|
|
6062
|
-
return null;
|
|
6063
|
-
}
|
|
6064
|
-
},
|
|
6065
|
-
_pseudo: function() {
|
|
6066
|
-
var tokenStream = this._tokenStream, pseudo = null, colons = ":", line, col;
|
|
6067
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
6068
|
-
if (tokenStream.match(Tokens.COLON)) {
|
|
6069
|
-
colons += ":";
|
|
6070
|
-
}
|
|
6071
|
-
if (tokenStream.match(Tokens.IDENT)) {
|
|
6072
|
-
pseudo = tokenStream.token().value;
|
|
6073
|
-
line = tokenStream.token().startLine;
|
|
6074
|
-
col = tokenStream.token().startCol - colons.length;
|
|
6075
|
-
} else if (tokenStream.peek() === Tokens.FUNCTION) {
|
|
6076
|
-
line = tokenStream.LT(1).startLine;
|
|
6077
|
-
col = tokenStream.LT(1).startCol - colons.length;
|
|
6078
|
-
pseudo = this._functional_pseudo();
|
|
6079
|
-
}
|
|
6080
|
-
if (pseudo) {
|
|
6081
|
-
pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col);
|
|
6082
|
-
}
|
|
6083
|
-
}
|
|
6084
|
-
return pseudo;
|
|
6085
|
-
},
|
|
6086
|
-
_functional_pseudo: function() {
|
|
6087
|
-
var tokenStream = this._tokenStream, value = null;
|
|
6088
|
-
if (tokenStream.match(Tokens.FUNCTION)) {
|
|
6089
|
-
value = tokenStream.token().value;
|
|
6090
|
-
value += this._readWhitespace();
|
|
6091
|
-
value += this._expression();
|
|
6092
|
-
tokenStream.mustMatch(Tokens.RPAREN);
|
|
6093
|
-
value += ")";
|
|
6094
|
-
}
|
|
6095
|
-
return value;
|
|
6096
|
-
},
|
|
6097
|
-
_expression: function() {
|
|
6098
|
-
var tokenStream = this._tokenStream, value = "";
|
|
6099
|
-
while (tokenStream.match([
|
|
6100
|
-
Tokens.PLUS,
|
|
6101
|
-
Tokens.MINUS,
|
|
6102
|
-
Tokens.DIMENSION,
|
|
6103
|
-
Tokens.NUMBER,
|
|
6104
|
-
Tokens.STRING,
|
|
6105
|
-
Tokens.IDENT,
|
|
6106
|
-
Tokens.LENGTH,
|
|
6107
|
-
Tokens.FREQ,
|
|
6108
|
-
Tokens.ANGLE,
|
|
6109
|
-
Tokens.TIME,
|
|
6110
|
-
Tokens.RESOLUTION,
|
|
6111
|
-
Tokens.SLASH
|
|
6112
|
-
])) {
|
|
6113
|
-
value += tokenStream.token().value;
|
|
6114
|
-
value += this._readWhitespace();
|
|
6115
|
-
}
|
|
6116
|
-
return value.length ? value : null;
|
|
6117
|
-
},
|
|
6118
|
-
_negation: function() {
|
|
6119
|
-
var tokenStream = this._tokenStream, line, col, value = "", arg, subpart = null;
|
|
6120
|
-
if (tokenStream.match(Tokens.NOT)) {
|
|
6121
|
-
value = tokenStream.token().value;
|
|
6122
|
-
line = tokenStream.token().startLine;
|
|
6123
|
-
col = tokenStream.token().startCol;
|
|
6124
|
-
value += this._readWhitespace();
|
|
6125
|
-
arg = this._negation_arg();
|
|
6126
|
-
value += arg;
|
|
6127
|
-
value += this._readWhitespace();
|
|
6128
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6129
|
-
value += tokenStream.token().value;
|
|
6130
|
-
subpart = new SelectorSubPart(value, "not", line, col);
|
|
6131
|
-
subpart.args.push(arg);
|
|
6132
|
-
}
|
|
6133
|
-
return subpart;
|
|
6134
|
-
},
|
|
6135
|
-
_negation_arg: function() {
|
|
6136
|
-
var tokenStream = this._tokenStream, args = [
|
|
6137
|
-
this._type_selector,
|
|
6138
|
-
this._universal,
|
|
6139
|
-
function() {
|
|
6140
|
-
return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null;
|
|
6141
|
-
},
|
|
6142
|
-
this._class,
|
|
6143
|
-
this._attrib,
|
|
6144
|
-
this._pseudo
|
|
6145
|
-
], arg = null, i = 0, len = args.length, line, col, part;
|
|
6146
|
-
line = tokenStream.LT(1).startLine;
|
|
6147
|
-
col = tokenStream.LT(1).startCol;
|
|
6148
|
-
while (i < len && arg === null) {
|
|
6149
|
-
arg = args[i].call(this);
|
|
6150
|
-
i++;
|
|
6151
|
-
}
|
|
6152
|
-
if (arg === null) {
|
|
6153
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6154
|
-
}
|
|
6155
|
-
if (arg.type === "elementName") {
|
|
6156
|
-
part = new SelectorPart(arg, [], arg.toString(), line, col);
|
|
6157
|
-
} else {
|
|
6158
|
-
part = new SelectorPart(null, [arg], arg.toString(), line, col);
|
|
6159
|
-
}
|
|
6160
|
-
return part;
|
|
6161
|
-
},
|
|
6162
|
-
_declaration: function() {
|
|
6163
|
-
var tokenStream = this._tokenStream, property = null, expr = null, prio = null, invalid = null, propertyName = "";
|
|
6164
|
-
property = this._property();
|
|
6165
|
-
if (property !== null) {
|
|
6166
|
-
tokenStream.mustMatch(Tokens.COLON);
|
|
6167
|
-
this._readWhitespace();
|
|
6168
|
-
expr = this._expr();
|
|
6169
|
-
if (!expr || expr.length === 0) {
|
|
6170
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6171
|
-
}
|
|
6172
|
-
prio = this._prio();
|
|
6173
|
-
propertyName = property.toString();
|
|
6174
|
-
if (this.options.starHack && property.hack === "*" || this.options.underscoreHack && property.hack === "_") {
|
|
6175
|
-
propertyName = property.text;
|
|
6176
|
-
}
|
|
6177
|
-
try {
|
|
6178
|
-
this._validateProperty(propertyName, expr);
|
|
6179
|
-
} catch (ex) {
|
|
6180
|
-
invalid = ex;
|
|
6181
|
-
}
|
|
6182
|
-
this.fire({
|
|
6183
|
-
type: "property",
|
|
6184
|
-
property,
|
|
6185
|
-
value: expr,
|
|
6186
|
-
important: prio,
|
|
6187
|
-
line: property.line,
|
|
6188
|
-
col: property.col,
|
|
6189
|
-
invalid
|
|
6190
|
-
});
|
|
6191
|
-
return true;
|
|
6192
|
-
} else {
|
|
6193
|
-
return false;
|
|
6194
|
-
}
|
|
6195
|
-
},
|
|
6196
|
-
_prio: function() {
|
|
6197
|
-
var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM);
|
|
6198
|
-
this._readWhitespace();
|
|
6199
|
-
return result;
|
|
6200
|
-
},
|
|
6201
|
-
_expr: function(inFunction) {
|
|
6202
|
-
var values = [], value = null, operator = null;
|
|
6203
|
-
value = this._term(inFunction);
|
|
6204
|
-
if (value !== null) {
|
|
6205
|
-
values.push(value);
|
|
6206
|
-
do {
|
|
6207
|
-
operator = this._operator(inFunction);
|
|
6208
|
-
if (operator) {
|
|
6209
|
-
values.push(operator);
|
|
6210
|
-
}
|
|
6211
|
-
value = this._term(inFunction);
|
|
6212
|
-
if (value === null) {
|
|
6213
|
-
break;
|
|
6214
|
-
} else {
|
|
6215
|
-
values.push(value);
|
|
6216
|
-
}
|
|
6217
|
-
} while (true);
|
|
6218
|
-
}
|
|
6219
|
-
return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;
|
|
6220
|
-
},
|
|
6221
|
-
_term: function(inFunction) {
|
|
6222
|
-
var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, token, line, col;
|
|
6223
|
-
unary = this._unary_operator();
|
|
6224
|
-
if (unary !== null) {
|
|
6225
|
-
line = tokenStream.token().startLine;
|
|
6226
|
-
col = tokenStream.token().startCol;
|
|
6227
|
-
}
|
|
6228
|
-
if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) {
|
|
6229
|
-
value = this._ie_function();
|
|
6230
|
-
if (unary === null) {
|
|
6231
|
-
line = tokenStream.token().startLine;
|
|
6232
|
-
col = tokenStream.token().startCol;
|
|
6233
|
-
}
|
|
6234
|
-
} else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) {
|
|
6235
|
-
token = tokenStream.token();
|
|
6236
|
-
endChar = token.endChar;
|
|
6237
|
-
value = token.value + this._expr(inFunction).text;
|
|
6238
|
-
if (unary === null) {
|
|
6239
|
-
line = tokenStream.token().startLine;
|
|
6240
|
-
col = tokenStream.token().startCol;
|
|
6241
|
-
}
|
|
6242
|
-
tokenStream.mustMatch(Tokens.type(endChar));
|
|
6243
|
-
value += endChar;
|
|
6244
|
-
this._readWhitespace();
|
|
6245
|
-
} else if (tokenStream.match([
|
|
6246
|
-
Tokens.NUMBER,
|
|
6247
|
-
Tokens.PERCENTAGE,
|
|
6248
|
-
Tokens.LENGTH,
|
|
6249
|
-
Tokens.ANGLE,
|
|
6250
|
-
Tokens.TIME,
|
|
6251
|
-
Tokens.FREQ,
|
|
6252
|
-
Tokens.STRING,
|
|
6253
|
-
Tokens.IDENT,
|
|
6254
|
-
Tokens.URI,
|
|
6255
|
-
Tokens.UNICODE_RANGE
|
|
6256
|
-
])) {
|
|
6257
|
-
value = tokenStream.token().value;
|
|
6258
|
-
if (unary === null) {
|
|
6259
|
-
line = tokenStream.token().startLine;
|
|
6260
|
-
col = tokenStream.token().startCol;
|
|
6261
|
-
}
|
|
6262
|
-
this._readWhitespace();
|
|
6263
|
-
} else {
|
|
6264
|
-
token = this._hexcolor();
|
|
6265
|
-
if (token === null) {
|
|
6266
|
-
if (unary === null) {
|
|
6267
|
-
line = tokenStream.LT(1).startLine;
|
|
6268
|
-
col = tokenStream.LT(1).startCol;
|
|
6269
|
-
}
|
|
6270
|
-
if (value === null) {
|
|
6271
|
-
if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) {
|
|
6272
|
-
value = this._ie_function();
|
|
6273
|
-
} else {
|
|
6274
|
-
value = this._function();
|
|
6275
|
-
}
|
|
6276
|
-
}
|
|
6277
|
-
} else {
|
|
6278
|
-
value = token.value;
|
|
6279
|
-
if (unary === null) {
|
|
6280
|
-
line = token.startLine;
|
|
6281
|
-
col = token.startCol;
|
|
6282
|
-
}
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
return value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null;
|
|
6286
|
-
},
|
|
6287
|
-
_function: function() {
|
|
6288
|
-
var tokenStream = this._tokenStream, functionText = null, expr = null, lt;
|
|
6289
|
-
if (tokenStream.match(Tokens.FUNCTION)) {
|
|
6290
|
-
functionText = tokenStream.token().value;
|
|
6291
|
-
this._readWhitespace();
|
|
6292
|
-
expr = this._expr(true);
|
|
6293
|
-
functionText += expr;
|
|
6294
|
-
if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) {
|
|
6295
|
-
do {
|
|
6296
|
-
if (this._readWhitespace()) {
|
|
6297
|
-
functionText += tokenStream.token().value;
|
|
6298
|
-
}
|
|
6299
|
-
if (tokenStream.LA(0) === Tokens.COMMA) {
|
|
6300
|
-
functionText += tokenStream.token().value;
|
|
6301
|
-
}
|
|
6302
|
-
tokenStream.match(Tokens.IDENT);
|
|
6303
|
-
functionText += tokenStream.token().value;
|
|
6304
|
-
tokenStream.match(Tokens.EQUALS);
|
|
6305
|
-
functionText += tokenStream.token().value;
|
|
6306
|
-
lt = tokenStream.peek();
|
|
6307
|
-
while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {
|
|
6308
|
-
tokenStream.get();
|
|
6309
|
-
functionText += tokenStream.token().value;
|
|
6310
|
-
lt = tokenStream.peek();
|
|
6311
|
-
}
|
|
6312
|
-
} while (tokenStream.match([Tokens.COMMA, Tokens.S]));
|
|
6313
|
-
}
|
|
6314
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6315
|
-
functionText += ")";
|
|
6316
|
-
this._readWhitespace();
|
|
6317
|
-
}
|
|
6318
|
-
return functionText;
|
|
6319
|
-
},
|
|
6320
|
-
_ie_function: function() {
|
|
6321
|
-
var tokenStream = this._tokenStream, functionText = null, lt;
|
|
6322
|
-
if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) {
|
|
6323
|
-
functionText = tokenStream.token().value;
|
|
6324
|
-
do {
|
|
6325
|
-
if (this._readWhitespace()) {
|
|
6326
|
-
functionText += tokenStream.token().value;
|
|
6327
|
-
}
|
|
6328
|
-
if (tokenStream.LA(0) === Tokens.COMMA) {
|
|
6329
|
-
functionText += tokenStream.token().value;
|
|
6330
|
-
}
|
|
6331
|
-
tokenStream.match(Tokens.IDENT);
|
|
6332
|
-
functionText += tokenStream.token().value;
|
|
6333
|
-
tokenStream.match(Tokens.EQUALS);
|
|
6334
|
-
functionText += tokenStream.token().value;
|
|
6335
|
-
lt = tokenStream.peek();
|
|
6336
|
-
while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {
|
|
6337
|
-
tokenStream.get();
|
|
6338
|
-
functionText += tokenStream.token().value;
|
|
6339
|
-
lt = tokenStream.peek();
|
|
6340
|
-
}
|
|
6341
|
-
} while (tokenStream.match([Tokens.COMMA, Tokens.S]));
|
|
6342
|
-
tokenStream.match(Tokens.RPAREN);
|
|
6343
|
-
functionText += ")";
|
|
6344
|
-
this._readWhitespace();
|
|
6345
|
-
}
|
|
6346
|
-
return functionText;
|
|
6347
|
-
},
|
|
6348
|
-
_hexcolor: function() {
|
|
6349
|
-
var tokenStream = this._tokenStream, token = null, color;
|
|
6350
|
-
if (tokenStream.match(Tokens.HASH)) {
|
|
6351
|
-
token = tokenStream.token();
|
|
6352
|
-
color = token.value;
|
|
6353
|
-
if (!/#[a-f0-9]{3,6}/i.test(color)) {
|
|
6354
|
-
throw new SyntaxError2("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
6355
|
-
}
|
|
6356
|
-
this._readWhitespace();
|
|
6357
|
-
}
|
|
6358
|
-
return token;
|
|
6359
|
-
},
|
|
6360
|
-
_keyframes: function() {
|
|
6361
|
-
var tokenStream = this._tokenStream, token, tt, name, prefix = "";
|
|
6362
|
-
tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);
|
|
6363
|
-
token = tokenStream.token();
|
|
6364
|
-
if (/^@\-([^\-]+)\-/.test(token.value)) {
|
|
6365
|
-
prefix = RegExp.$1;
|
|
6366
|
-
}
|
|
6367
|
-
this._readWhitespace();
|
|
6368
|
-
name = this._keyframe_name();
|
|
6369
|
-
this._readWhitespace();
|
|
6370
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
6371
|
-
this.fire({
|
|
6372
|
-
type: "startkeyframes",
|
|
6373
|
-
name,
|
|
6374
|
-
prefix,
|
|
6375
|
-
line: token.startLine,
|
|
6376
|
-
col: token.startCol
|
|
6377
|
-
});
|
|
6378
|
-
this._readWhitespace();
|
|
6379
|
-
tt = tokenStream.peek();
|
|
6380
|
-
while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) {
|
|
6381
|
-
this._keyframe_rule();
|
|
6382
|
-
this._readWhitespace();
|
|
6383
|
-
tt = tokenStream.peek();
|
|
6384
|
-
}
|
|
6385
|
-
this.fire({
|
|
6386
|
-
type: "endkeyframes",
|
|
6387
|
-
name,
|
|
6388
|
-
prefix,
|
|
6389
|
-
line: token.startLine,
|
|
6390
|
-
col: token.startCol
|
|
6391
|
-
});
|
|
6392
|
-
this._readWhitespace();
|
|
6393
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
6394
|
-
},
|
|
6395
|
-
_keyframe_name: function() {
|
|
6396
|
-
var tokenStream = this._tokenStream;
|
|
6397
|
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
|
6398
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
6399
|
-
},
|
|
6400
|
-
_keyframe_rule: function() {
|
|
6401
|
-
var keyList = this._key_list();
|
|
6402
|
-
this.fire({
|
|
6403
|
-
type: "startkeyframerule",
|
|
6404
|
-
keys: keyList,
|
|
6405
|
-
line: keyList[0].line,
|
|
6406
|
-
col: keyList[0].col
|
|
6407
|
-
});
|
|
6408
|
-
this._readDeclarations(true);
|
|
6409
|
-
this.fire({
|
|
6410
|
-
type: "endkeyframerule",
|
|
6411
|
-
keys: keyList,
|
|
6412
|
-
line: keyList[0].line,
|
|
6413
|
-
col: keyList[0].col
|
|
6414
|
-
});
|
|
6415
|
-
},
|
|
6416
|
-
_key_list: function() {
|
|
6417
|
-
var tokenStream = this._tokenStream, keyList = [];
|
|
6418
|
-
keyList.push(this._key());
|
|
6419
|
-
this._readWhitespace();
|
|
6420
|
-
while (tokenStream.match(Tokens.COMMA)) {
|
|
6421
|
-
this._readWhitespace();
|
|
6422
|
-
keyList.push(this._key());
|
|
6423
|
-
this._readWhitespace();
|
|
6424
|
-
}
|
|
6425
|
-
return keyList;
|
|
6426
|
-
},
|
|
6427
|
-
_key: function() {
|
|
6428
|
-
var tokenStream = this._tokenStream, token;
|
|
6429
|
-
if (tokenStream.match(Tokens.PERCENTAGE)) {
|
|
6430
|
-
return SyntaxUnit.fromToken(tokenStream.token());
|
|
6431
|
-
} else if (tokenStream.match(Tokens.IDENT)) {
|
|
6432
|
-
token = tokenStream.token();
|
|
6433
|
-
if (/from|to/i.test(token.value)) {
|
|
6434
|
-
return SyntaxUnit.fromToken(token);
|
|
6435
|
-
}
|
|
6436
|
-
tokenStream.unget();
|
|
6437
|
-
}
|
|
6438
|
-
this._unexpectedToken(tokenStream.LT(1));
|
|
6439
|
-
},
|
|
6440
|
-
_skipCruft: function() {
|
|
6441
|
-
while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) {
|
|
6442
|
-
}
|
|
6443
|
-
},
|
|
6444
|
-
_readDeclarations: function(checkStart, readMargins) {
|
|
6445
|
-
var tokenStream = this._tokenStream, tt;
|
|
6446
|
-
this._readWhitespace();
|
|
6447
|
-
if (checkStart) {
|
|
6448
|
-
tokenStream.mustMatch(Tokens.LBRACE);
|
|
6449
|
-
}
|
|
6450
|
-
this._readWhitespace();
|
|
6451
|
-
try {
|
|
6452
|
-
while (true) {
|
|
6453
|
-
if (tokenStream.match(Tokens.SEMICOLON) || readMargins && this._margin()) {
|
|
6454
|
-
} else if (this._declaration()) {
|
|
6455
|
-
if (!tokenStream.match(Tokens.SEMICOLON)) {
|
|
6456
|
-
break;
|
|
6457
|
-
}
|
|
6458
|
-
} else {
|
|
6459
|
-
break;
|
|
6460
|
-
}
|
|
6461
|
-
this._readWhitespace();
|
|
6462
|
-
}
|
|
6463
|
-
tokenStream.mustMatch(Tokens.RBRACE);
|
|
6464
|
-
this._readWhitespace();
|
|
6465
|
-
} catch (ex) {
|
|
6466
|
-
if (ex instanceof SyntaxError2 && !this.options.strict) {
|
|
6467
|
-
this.fire({
|
|
6468
|
-
type: "error",
|
|
6469
|
-
error: ex,
|
|
6470
|
-
message: ex.message,
|
|
6471
|
-
line: ex.line,
|
|
6472
|
-
col: ex.col
|
|
6473
|
-
});
|
|
6474
|
-
tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
|
|
6475
|
-
if (tt === Tokens.SEMICOLON) {
|
|
6476
|
-
this._readDeclarations(false, readMargins);
|
|
6477
|
-
} else if (tt !== Tokens.RBRACE) {
|
|
6478
|
-
throw ex;
|
|
6479
|
-
}
|
|
6480
|
-
} else {
|
|
6481
|
-
throw ex;
|
|
6482
|
-
}
|
|
6483
|
-
}
|
|
6484
|
-
},
|
|
6485
|
-
_readWhitespace: function() {
|
|
6486
|
-
var tokenStream = this._tokenStream, ws = "";
|
|
6487
|
-
while (tokenStream.match(Tokens.S)) {
|
|
6488
|
-
ws += tokenStream.token().value;
|
|
6489
|
-
}
|
|
6490
|
-
return ws;
|
|
6491
|
-
},
|
|
6492
|
-
_unexpectedToken: function(token) {
|
|
6493
|
-
throw new SyntaxError2("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
|
6494
|
-
},
|
|
6495
|
-
_verifyEnd: function() {
|
|
6496
|
-
if (this._tokenStream.LA(1) !== Tokens.EOF) {
|
|
6497
|
-
this._unexpectedToken(this._tokenStream.LT(1));
|
|
6498
|
-
}
|
|
6499
|
-
},
|
|
6500
|
-
_validateProperty: function(property, value) {
|
|
6501
|
-
Validation.validate(property, value);
|
|
6502
|
-
},
|
|
6503
|
-
parse: function(input) {
|
|
6504
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6505
|
-
this._stylesheet();
|
|
6506
|
-
},
|
|
6507
|
-
parseStyleSheet: function(input) {
|
|
6508
|
-
return this.parse(input);
|
|
6509
|
-
},
|
|
6510
|
-
parseMediaQuery: function(input) {
|
|
6511
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6512
|
-
var result = this._media_query();
|
|
6513
|
-
this._verifyEnd();
|
|
6514
|
-
return result;
|
|
6515
|
-
},
|
|
6516
|
-
parsePropertyValue: function(input) {
|
|
6517
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6518
|
-
this._readWhitespace();
|
|
6519
|
-
var result = this._expr();
|
|
6520
|
-
this._readWhitespace();
|
|
6521
|
-
this._verifyEnd();
|
|
6522
|
-
return result;
|
|
6523
|
-
},
|
|
6524
|
-
parseRule: function(input) {
|
|
6525
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6526
|
-
this._readWhitespace();
|
|
6527
|
-
var result = this._ruleset();
|
|
6528
|
-
this._readWhitespace();
|
|
6529
|
-
this._verifyEnd();
|
|
6530
|
-
return result;
|
|
6531
|
-
},
|
|
6532
|
-
parseSelector: function(input) {
|
|
6533
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6534
|
-
this._readWhitespace();
|
|
6535
|
-
var result = this._selector();
|
|
6536
|
-
this._readWhitespace();
|
|
6537
|
-
this._verifyEnd();
|
|
6538
|
-
return result;
|
|
6539
|
-
},
|
|
6540
|
-
parseStyleAttribute: function(input) {
|
|
6541
|
-
input += "}";
|
|
6542
|
-
this._tokenStream = new TokenStream(input, Tokens);
|
|
6543
|
-
this._readDeclarations();
|
|
6544
|
-
}
|
|
6545
|
-
};
|
|
6546
|
-
for (prop in additions) {
|
|
6547
|
-
if (Object.prototype.hasOwnProperty.call(additions, prop)) {
|
|
6548
|
-
proto[prop] = additions[prop];
|
|
6549
|
-
}
|
|
6550
|
-
}
|
|
6551
|
-
return proto;
|
|
6552
|
-
}();
|
|
6553
|
-
var Properties = {
|
|
6554
|
-
__proto__: null,
|
|
6555
|
-
"align-items": "flex-start | flex-end | center | baseline | stretch",
|
|
6556
|
-
"align-content": "flex-start | flex-end | center | space-between | space-around | stretch",
|
|
6557
|
-
"align-self": "auto | flex-start | flex-end | center | baseline | stretch",
|
|
6558
|
-
"-webkit-align-items": "flex-start | flex-end | center | baseline | stretch",
|
|
6559
|
-
"-webkit-align-content": "flex-start | flex-end | center | space-between | space-around | stretch",
|
|
6560
|
-
"-webkit-align-self": "auto | flex-start | flex-end | center | baseline | stretch",
|
|
6561
|
-
"alignment-adjust": "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
|
|
6562
|
-
"alignment-baseline": "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6563
|
-
"animation": 1,
|
|
6564
|
-
"animation-delay": { multi: "<time>", comma: true },
|
|
6565
|
-
"animation-direction": { multi: "normal | alternate", comma: true },
|
|
6566
|
-
"animation-duration": { multi: "<time>", comma: true },
|
|
6567
|
-
"animation-fill-mode": { multi: "none | forwards | backwards | both", comma: true },
|
|
6568
|
-
"animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6569
|
-
"animation-name": { multi: "none | <ident>", comma: true },
|
|
6570
|
-
"animation-play-state": { multi: "running | paused", comma: true },
|
|
6571
|
-
"animation-timing-function": 1,
|
|
6572
|
-
"-moz-animation-delay": { multi: "<time>", comma: true },
|
|
6573
|
-
"-moz-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6574
|
-
"-moz-animation-duration": { multi: "<time>", comma: true },
|
|
6575
|
-
"-moz-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6576
|
-
"-moz-animation-name": { multi: "none | <ident>", comma: true },
|
|
6577
|
-
"-moz-animation-play-state": { multi: "running | paused", comma: true },
|
|
6578
|
-
"-ms-animation-delay": { multi: "<time>", comma: true },
|
|
6579
|
-
"-ms-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6580
|
-
"-ms-animation-duration": { multi: "<time>", comma: true },
|
|
6581
|
-
"-ms-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6582
|
-
"-ms-animation-name": { multi: "none | <ident>", comma: true },
|
|
6583
|
-
"-ms-animation-play-state": { multi: "running | paused", comma: true },
|
|
6584
|
-
"-webkit-animation-delay": { multi: "<time>", comma: true },
|
|
6585
|
-
"-webkit-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6586
|
-
"-webkit-animation-duration": { multi: "<time>", comma: true },
|
|
6587
|
-
"-webkit-animation-fill-mode": { multi: "none | forwards | backwards | both", comma: true },
|
|
6588
|
-
"-webkit-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6589
|
-
"-webkit-animation-name": { multi: "none | <ident>", comma: true },
|
|
6590
|
-
"-webkit-animation-play-state": { multi: "running | paused", comma: true },
|
|
6591
|
-
"-o-animation-delay": { multi: "<time>", comma: true },
|
|
6592
|
-
"-o-animation-direction": { multi: "normal | alternate", comma: true },
|
|
6593
|
-
"-o-animation-duration": { multi: "<time>", comma: true },
|
|
6594
|
-
"-o-animation-iteration-count": { multi: "<number> | infinite", comma: true },
|
|
6595
|
-
"-o-animation-name": { multi: "none | <ident>", comma: true },
|
|
6596
|
-
"-o-animation-play-state": { multi: "running | paused", comma: true },
|
|
6597
|
-
"appearance": "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit",
|
|
6598
|
-
"azimuth": function(expression) {
|
|
6599
|
-
var simple = "<angle> | leftwards | rightwards | inherit", direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", behind = false, valid = false, part;
|
|
6600
|
-
if (!ValidationTypes.isAny(expression, simple)) {
|
|
6601
|
-
if (ValidationTypes.isAny(expression, "behind")) {
|
|
6602
|
-
behind = true;
|
|
6603
|
-
valid = true;
|
|
6604
|
-
}
|
|
6605
|
-
if (ValidationTypes.isAny(expression, direction)) {
|
|
6606
|
-
valid = true;
|
|
6607
|
-
if (!behind) {
|
|
6608
|
-
ValidationTypes.isAny(expression, "behind");
|
|
6609
|
-
}
|
|
6610
|
-
}
|
|
6611
|
-
}
|
|
6612
|
-
if (expression.hasNext()) {
|
|
6613
|
-
part = expression.next();
|
|
6614
|
-
if (valid) {
|
|
6615
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6616
|
-
} else {
|
|
6617
|
-
throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col);
|
|
6618
|
-
}
|
|
6619
|
-
}
|
|
6620
|
-
},
|
|
6621
|
-
"backface-visibility": "visible | hidden",
|
|
6622
|
-
"background": 1,
|
|
6623
|
-
"background-attachment": { multi: "<attachment>", comma: true },
|
|
6624
|
-
"background-clip": { multi: "<box>", comma: true },
|
|
6625
|
-
"background-color": "<color> | inherit",
|
|
6626
|
-
"background-image": { multi: "<bg-image>", comma: true },
|
|
6627
|
-
"background-origin": { multi: "<box>", comma: true },
|
|
6628
|
-
"background-position": { multi: "<bg-position>", comma: true },
|
|
6629
|
-
"background-repeat": { multi: "<repeat-style>" },
|
|
6630
|
-
"background-size": { multi: "<bg-size>", comma: true },
|
|
6631
|
-
"baseline-shift": "baseline | sub | super | <percentage> | <length>",
|
|
6632
|
-
"behavior": 1,
|
|
6633
|
-
"binding": 1,
|
|
6634
|
-
"bleed": "<length>",
|
|
6635
|
-
"bookmark-label": "<content> | <attr> | <string>",
|
|
6636
|
-
"bookmark-level": "none | <integer>",
|
|
6637
|
-
"bookmark-state": "open | closed",
|
|
6638
|
-
"bookmark-target": "none | <uri> | <attr>",
|
|
6639
|
-
"border": "<border-width> || <border-style> || <color>",
|
|
6640
|
-
"border-bottom": "<border-width> || <border-style> || <color>",
|
|
6641
|
-
"border-bottom-color": "<color> | inherit",
|
|
6642
|
-
"border-bottom-left-radius": "<x-one-radius>",
|
|
6643
|
-
"border-bottom-right-radius": "<x-one-radius>",
|
|
6644
|
-
"border-bottom-style": "<border-style>",
|
|
6645
|
-
"border-bottom-width": "<border-width>",
|
|
6646
|
-
"border-collapse": "collapse | separate | inherit",
|
|
6647
|
-
"border-color": { multi: "<color> | inherit", max: 4 },
|
|
6648
|
-
"border-image": 1,
|
|
6649
|
-
"border-image-outset": { multi: "<length> | <number>", max: 4 },
|
|
6650
|
-
"border-image-repeat": { multi: "stretch | repeat | round", max: 2 },
|
|
6651
|
-
"border-image-slice": function(expression) {
|
|
6652
|
-
var valid = false, numeric = "<number> | <percentage>", fill = false, count = 0, max = 4, part;
|
|
6653
|
-
if (ValidationTypes.isAny(expression, "fill")) {
|
|
6654
|
-
fill = true;
|
|
6655
|
-
valid = true;
|
|
6656
|
-
}
|
|
6657
|
-
while (expression.hasNext() && count < max) {
|
|
6658
|
-
valid = ValidationTypes.isAny(expression, numeric);
|
|
6659
|
-
if (!valid) {
|
|
6660
|
-
break;
|
|
6661
|
-
}
|
|
6662
|
-
count++;
|
|
6663
|
-
}
|
|
6664
|
-
if (!fill) {
|
|
6665
|
-
ValidationTypes.isAny(expression, "fill");
|
|
6666
|
-
} else {
|
|
6667
|
-
valid = true;
|
|
6668
|
-
}
|
|
6669
|
-
if (expression.hasNext()) {
|
|
6670
|
-
part = expression.next();
|
|
6671
|
-
if (valid) {
|
|
6672
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6673
|
-
} else {
|
|
6674
|
-
throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '" + part + "'.", part.line, part.col);
|
|
6675
|
-
}
|
|
6676
|
-
}
|
|
6677
|
-
},
|
|
6678
|
-
"border-image-source": "<image> | none",
|
|
6679
|
-
"border-image-width": { multi: "<length> | <percentage> | <number> | auto", max: 4 },
|
|
6680
|
-
"border-left": "<border-width> || <border-style> || <color>",
|
|
6681
|
-
"border-left-color": "<color> | inherit",
|
|
6682
|
-
"border-left-style": "<border-style>",
|
|
6683
|
-
"border-left-width": "<border-width>",
|
|
6684
|
-
"border-radius": function(expression) {
|
|
6685
|
-
var valid = false, simple = "<length> | <percentage> | inherit", slash = false, count = 0, max = 8, part;
|
|
6686
|
-
while (expression.hasNext() && count < max) {
|
|
6687
|
-
valid = ValidationTypes.isAny(expression, simple);
|
|
6688
|
-
if (!valid) {
|
|
6689
|
-
if (String(expression.peek()) === "/" && count > 0 && !slash) {
|
|
6690
|
-
slash = true;
|
|
6691
|
-
max = count + 5;
|
|
6692
|
-
expression.next();
|
|
6693
|
-
} else {
|
|
6694
|
-
break;
|
|
6695
|
-
}
|
|
6696
|
-
}
|
|
6697
|
-
count++;
|
|
6698
|
-
}
|
|
6699
|
-
if (expression.hasNext()) {
|
|
6700
|
-
part = expression.next();
|
|
6701
|
-
if (valid) {
|
|
6702
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6703
|
-
} else {
|
|
6704
|
-
throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col);
|
|
6705
|
-
}
|
|
6706
|
-
}
|
|
6707
|
-
},
|
|
6708
|
-
"border-right": "<border-width> || <border-style> || <color>",
|
|
6709
|
-
"border-right-color": "<color> | inherit",
|
|
6710
|
-
"border-right-style": "<border-style>",
|
|
6711
|
-
"border-right-width": "<border-width>",
|
|
6712
|
-
"border-spacing": { multi: "<length> | inherit", max: 2 },
|
|
6713
|
-
"border-style": { multi: "<border-style>", max: 4 },
|
|
6714
|
-
"border-top": "<border-width> || <border-style> || <color>",
|
|
6715
|
-
"border-top-color": "<color> | inherit",
|
|
6716
|
-
"border-top-left-radius": "<x-one-radius>",
|
|
6717
|
-
"border-top-right-radius": "<x-one-radius>",
|
|
6718
|
-
"border-top-style": "<border-style>",
|
|
6719
|
-
"border-top-width": "<border-width>",
|
|
6720
|
-
"border-width": { multi: "<border-width>", max: 4 },
|
|
6721
|
-
"bottom": "<margin-width> | inherit",
|
|
6722
|
-
"-moz-box-align": "start | end | center | baseline | stretch",
|
|
6723
|
-
"-moz-box-decoration-break": "slice |clone",
|
|
6724
|
-
"-moz-box-direction": "normal | reverse | inherit",
|
|
6725
|
-
"-moz-box-flex": "<number>",
|
|
6726
|
-
"-moz-box-flex-group": "<integer>",
|
|
6727
|
-
"-moz-box-lines": "single | multiple",
|
|
6728
|
-
"-moz-box-ordinal-group": "<integer>",
|
|
6729
|
-
"-moz-box-orient": "horizontal | vertical | inline-axis | block-axis | inherit",
|
|
6730
|
-
"-moz-box-pack": "start | end | center | justify",
|
|
6731
|
-
"-o-box-decoration-break": "slice | clone",
|
|
6732
|
-
"-webkit-box-align": "start | end | center | baseline | stretch",
|
|
6733
|
-
"-webkit-box-decoration-break": "slice |clone",
|
|
6734
|
-
"-webkit-box-direction": "normal | reverse | inherit",
|
|
6735
|
-
"-webkit-box-flex": "<number>",
|
|
6736
|
-
"-webkit-box-flex-group": "<integer>",
|
|
6737
|
-
"-webkit-box-lines": "single | multiple",
|
|
6738
|
-
"-webkit-box-ordinal-group": "<integer>",
|
|
6739
|
-
"-webkit-box-orient": "horizontal | vertical | inline-axis | block-axis | inherit",
|
|
6740
|
-
"-webkit-box-pack": "start | end | center | justify",
|
|
6741
|
-
"box-decoration-break": "slice | clone",
|
|
6742
|
-
"box-shadow": function(expression) {
|
|
6743
|
-
var part;
|
|
6744
|
-
if (!ValidationTypes.isAny(expression, "none")) {
|
|
6745
|
-
Validation.multiProperty("<shadow>", expression, true, Infinity);
|
|
6746
|
-
} else {
|
|
6747
|
-
if (expression.hasNext()) {
|
|
6748
|
-
part = expression.next();
|
|
6749
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
6750
|
-
}
|
|
6751
|
-
}
|
|
6752
|
-
},
|
|
6753
|
-
"box-sizing": "content-box | border-box | inherit",
|
|
6754
|
-
"break-after": "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
|
6755
|
-
"break-before": "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
|
6756
|
-
"break-inside": "auto | avoid | avoid-page | avoid-column",
|
|
6757
|
-
"caption-side": "top | bottom | inherit",
|
|
6758
|
-
"clear": "none | right | left | both | inherit",
|
|
6759
|
-
"clip": 1,
|
|
6760
|
-
"color": "<color> | inherit",
|
|
6761
|
-
"color-profile": 1,
|
|
6762
|
-
"column-count": "<integer> | auto",
|
|
6763
|
-
"column-fill": "auto | balance",
|
|
6764
|
-
"column-gap": "<length> | normal",
|
|
6765
|
-
"column-rule": "<border-width> || <border-style> || <color>",
|
|
6766
|
-
"column-rule-color": "<color>",
|
|
6767
|
-
"column-rule-style": "<border-style>",
|
|
6768
|
-
"column-rule-width": "<border-width>",
|
|
6769
|
-
"column-span": "none | all",
|
|
6770
|
-
"column-width": "<length> | auto",
|
|
6771
|
-
"columns": 1,
|
|
6772
|
-
"content": 1,
|
|
6773
|
-
"counter-increment": 1,
|
|
6774
|
-
"counter-reset": 1,
|
|
6775
|
-
"crop": "<shape> | auto",
|
|
6776
|
-
"cue": "cue-after | cue-before | inherit",
|
|
6777
|
-
"cue-after": 1,
|
|
6778
|
-
"cue-before": 1,
|
|
6779
|
-
"cursor": 1,
|
|
6780
|
-
"direction": "ltr | rtl | inherit",
|
|
6781
|
-
"display": "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex",
|
|
6782
|
-
"dominant-baseline": 1,
|
|
6783
|
-
"drop-initial-after-adjust": "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
|
|
6784
|
-
"drop-initial-after-align": "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6785
|
-
"drop-initial-before-adjust": "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>",
|
|
6786
|
-
"drop-initial-before-align": "caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
|
6787
|
-
"drop-initial-size": "auto | line | <length> | <percentage>",
|
|
6788
|
-
"drop-initial-value": "initial | <integer>",
|
|
6789
|
-
"elevation": "<angle> | below | level | above | higher | lower | inherit",
|
|
6790
|
-
"empty-cells": "show | hide | inherit",
|
|
6791
|
-
"filter": 1,
|
|
6792
|
-
"fit": "fill | hidden | meet | slice",
|
|
6793
|
-
"fit-position": 1,
|
|
6794
|
-
"flex": "<flex>",
|
|
6795
|
-
"flex-basis": "<width>",
|
|
6796
|
-
"flex-direction": "row | row-reverse | column | column-reverse",
|
|
6797
|
-
"flex-flow": "<flex-direction> || <flex-wrap>",
|
|
6798
|
-
"flex-grow": "<number>",
|
|
6799
|
-
"flex-shrink": "<number>",
|
|
6800
|
-
"flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6801
|
-
"-webkit-flex": "<flex>",
|
|
6802
|
-
"-webkit-flex-basis": "<width>",
|
|
6803
|
-
"-webkit-flex-direction": "row | row-reverse | column | column-reverse",
|
|
6804
|
-
"-webkit-flex-flow": "<flex-direction> || <flex-wrap>",
|
|
6805
|
-
"-webkit-flex-grow": "<number>",
|
|
6806
|
-
"-webkit-flex-shrink": "<number>",
|
|
6807
|
-
"-webkit-flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6808
|
-
"-ms-flex": "<flex>",
|
|
6809
|
-
"-ms-flex-align": "start | end | center | stretch | baseline",
|
|
6810
|
-
"-ms-flex-direction": "row | row-reverse | column | column-reverse | inherit",
|
|
6811
|
-
"-ms-flex-order": "<number>",
|
|
6812
|
-
"-ms-flex-pack": "start | end | center | justify",
|
|
6813
|
-
"-ms-flex-wrap": "nowrap | wrap | wrap-reverse",
|
|
6814
|
-
"float": "left | right | none | inherit",
|
|
6815
|
-
"float-offset": 1,
|
|
6816
|
-
"font": 1,
|
|
6817
|
-
"font-family": 1,
|
|
6818
|
-
"font-feature-settings": "<feature-tag-value> | normal | inherit",
|
|
6819
|
-
"font-kerning": "auto | normal | none | initial | inherit | unset",
|
|
6820
|
-
"font-size": "<absolute-size> | <relative-size> | <length> | <percentage> | inherit",
|
|
6821
|
-
"font-size-adjust": "<number> | none | inherit",
|
|
6822
|
-
"font-stretch": "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit",
|
|
6823
|
-
"font-style": "normal | italic | oblique | inherit",
|
|
6824
|
-
"font-variant": "normal | small-caps | inherit",
|
|
6825
|
-
"font-variant-caps": "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
|
|
6826
|
-
"font-variant-position": "normal | sub | super | inherit | initial | unset",
|
|
6827
|
-
"font-weight": "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
|
|
6828
|
-
"grid": 1,
|
|
6829
|
-
"grid-area": 1,
|
|
6830
|
-
"grid-auto-columns": 1,
|
|
6831
|
-
"grid-auto-flow": 1,
|
|
6832
|
-
"grid-auto-position": 1,
|
|
6833
|
-
"grid-auto-rows": 1,
|
|
6834
|
-
"grid-cell-stacking": "columns | rows | layer",
|
|
6835
|
-
"grid-column": 1,
|
|
6836
|
-
"grid-columns": 1,
|
|
6837
|
-
"grid-column-align": "start | end | center | stretch",
|
|
6838
|
-
"grid-column-sizing": 1,
|
|
6839
|
-
"grid-column-start": 1,
|
|
6840
|
-
"grid-column-end": 1,
|
|
6841
|
-
"grid-column-span": "<integer>",
|
|
6842
|
-
"grid-flow": "none | rows | columns",
|
|
6843
|
-
"grid-layer": "<integer>",
|
|
6844
|
-
"grid-row": 1,
|
|
6845
|
-
"grid-rows": 1,
|
|
6846
|
-
"grid-row-align": "start | end | center | stretch",
|
|
6847
|
-
"grid-row-start": 1,
|
|
6848
|
-
"grid-row-end": 1,
|
|
6849
|
-
"grid-row-span": "<integer>",
|
|
6850
|
-
"grid-row-sizing": 1,
|
|
6851
|
-
"grid-template": 1,
|
|
6852
|
-
"grid-template-areas": 1,
|
|
6853
|
-
"grid-template-columns": 1,
|
|
6854
|
-
"grid-template-rows": 1,
|
|
6855
|
-
"hanging-punctuation": 1,
|
|
6856
|
-
"height": "<margin-width> | <content-sizing> | inherit",
|
|
6857
|
-
"hyphenate-after": "<integer> | auto",
|
|
6858
|
-
"hyphenate-before": "<integer> | auto",
|
|
6859
|
-
"hyphenate-character": "<string> | auto",
|
|
6860
|
-
"hyphenate-lines": "no-limit | <integer>",
|
|
6861
|
-
"hyphenate-resource": 1,
|
|
6862
|
-
"hyphens": "none | manual | auto",
|
|
6863
|
-
"icon": 1,
|
|
6864
|
-
"image-orientation": "angle | auto",
|
|
6865
|
-
"image-rendering": 1,
|
|
6866
|
-
"image-resolution": 1,
|
|
6867
|
-
"ime-mode": "auto | normal | active | inactive | disabled | inherit",
|
|
6868
|
-
"inline-box-align": "initial | last | <integer>",
|
|
6869
|
-
"justify-content": "flex-start | flex-end | center | space-between | space-around",
|
|
6870
|
-
"-webkit-justify-content": "flex-start | flex-end | center | space-between | space-around",
|
|
6871
|
-
"left": "<margin-width> | inherit",
|
|
6872
|
-
"letter-spacing": "<length> | normal | inherit",
|
|
6873
|
-
"line-height": "<number> | <length> | <percentage> | normal | inherit",
|
|
6874
|
-
"line-break": "auto | loose | normal | strict",
|
|
6875
|
-
"line-stacking": 1,
|
|
6876
|
-
"line-stacking-ruby": "exclude-ruby | include-ruby",
|
|
6877
|
-
"line-stacking-shift": "consider-shifts | disregard-shifts",
|
|
6878
|
-
"line-stacking-strategy": "inline-line-height | block-line-height | max-height | grid-height",
|
|
6879
|
-
"list-style": 1,
|
|
6880
|
-
"list-style-image": "<uri> | none | inherit",
|
|
6881
|
-
"list-style-position": "inside | outside | inherit",
|
|
6882
|
-
"list-style-type": "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit",
|
|
6883
|
-
"margin": { multi: "<margin-width> | inherit", max: 4 },
|
|
6884
|
-
"margin-bottom": "<margin-width> | inherit",
|
|
6885
|
-
"margin-left": "<margin-width> | inherit",
|
|
6886
|
-
"margin-right": "<margin-width> | inherit",
|
|
6887
|
-
"margin-top": "<margin-width> | inherit",
|
|
6888
|
-
"mark": 1,
|
|
6889
|
-
"mark-after": 1,
|
|
6890
|
-
"mark-before": 1,
|
|
6891
|
-
"marks": 1,
|
|
6892
|
-
"marquee-direction": 1,
|
|
6893
|
-
"marquee-play-count": 1,
|
|
6894
|
-
"marquee-speed": 1,
|
|
6895
|
-
"marquee-style": 1,
|
|
6896
|
-
"max-height": "<length> | <percentage> | <content-sizing> | none | inherit",
|
|
6897
|
-
"max-width": "<length> | <percentage> | <content-sizing> | none | inherit",
|
|
6898
|
-
"min-height": "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
|
6899
|
-
"min-width": "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
|
6900
|
-
"move-to": 1,
|
|
6901
|
-
"nav-down": 1,
|
|
6902
|
-
"nav-index": 1,
|
|
6903
|
-
"nav-left": 1,
|
|
6904
|
-
"nav-right": 1,
|
|
6905
|
-
"nav-up": 1,
|
|
6906
|
-
"object-fit": "fill | contain | cover | none | scale-down",
|
|
6907
|
-
"object-position": "<bg-position>",
|
|
6908
|
-
"opacity": "<number> | inherit",
|
|
6909
|
-
"order": "<integer>",
|
|
6910
|
-
"-webkit-order": "<integer>",
|
|
6911
|
-
"orphans": "<integer> | inherit",
|
|
6912
|
-
"outline": 1,
|
|
6913
|
-
"outline-color": "<color> | invert | inherit",
|
|
6914
|
-
"outline-offset": 1,
|
|
6915
|
-
"outline-style": "<border-style> | inherit",
|
|
6916
|
-
"outline-width": "<border-width> | inherit",
|
|
6917
|
-
"overflow": "visible | hidden | scroll | auto | inherit",
|
|
6918
|
-
"overflow-style": 1,
|
|
6919
|
-
"overflow-wrap": "normal | break-word",
|
|
6920
|
-
"overflow-x": 1,
|
|
6921
|
-
"overflow-y": 1,
|
|
6922
|
-
"padding": { multi: "<padding-width> | inherit", max: 4 },
|
|
6923
|
-
"padding-bottom": "<padding-width> | inherit",
|
|
6924
|
-
"padding-left": "<padding-width> | inherit",
|
|
6925
|
-
"padding-right": "<padding-width> | inherit",
|
|
6926
|
-
"padding-top": "<padding-width> | inherit",
|
|
6927
|
-
"page": 1,
|
|
6928
|
-
"page-break-after": "auto | always | avoid | left | right | inherit",
|
|
6929
|
-
"page-break-before": "auto | always | avoid | left | right | inherit",
|
|
6930
|
-
"page-break-inside": "auto | avoid | inherit",
|
|
6931
|
-
"page-policy": 1,
|
|
6932
|
-
"pause": 1,
|
|
6933
|
-
"pause-after": 1,
|
|
6934
|
-
"pause-before": 1,
|
|
6935
|
-
"perspective": 1,
|
|
6936
|
-
"perspective-origin": 1,
|
|
6937
|
-
"phonemes": 1,
|
|
6938
|
-
"pitch": 1,
|
|
6939
|
-
"pitch-range": 1,
|
|
6940
|
-
"play-during": 1,
|
|
6941
|
-
"pointer-events": "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
|
|
6942
|
-
"position": "static | relative | absolute | fixed | inherit",
|
|
6943
|
-
"presentation-level": 1,
|
|
6944
|
-
"punctuation-trim": 1,
|
|
6945
|
-
"quotes": 1,
|
|
6946
|
-
"rendering-intent": 1,
|
|
6947
|
-
"resize": 1,
|
|
6948
|
-
"rest": 1,
|
|
6949
|
-
"rest-after": 1,
|
|
6950
|
-
"rest-before": 1,
|
|
6951
|
-
"richness": 1,
|
|
6952
|
-
"right": "<margin-width> | inherit",
|
|
6953
|
-
"rotation": 1,
|
|
6954
|
-
"rotation-point": 1,
|
|
6955
|
-
"ruby-align": 1,
|
|
6956
|
-
"ruby-overhang": 1,
|
|
6957
|
-
"ruby-position": 1,
|
|
6958
|
-
"ruby-span": 1,
|
|
6959
|
-
"size": 1,
|
|
6960
|
-
"speak": "normal | none | spell-out | inherit",
|
|
6961
|
-
"speak-header": "once | always | inherit",
|
|
6962
|
-
"speak-numeral": "digits | continuous | inherit",
|
|
6963
|
-
"speak-punctuation": "code | none | inherit",
|
|
6964
|
-
"speech-rate": 1,
|
|
6965
|
-
"src": 1,
|
|
6966
|
-
"stress": 1,
|
|
6967
|
-
"string-set": 1,
|
|
6968
|
-
"table-layout": "auto | fixed | inherit",
|
|
6969
|
-
"tab-size": "<integer> | <length>",
|
|
6970
|
-
"target": 1,
|
|
6971
|
-
"target-name": 1,
|
|
6972
|
-
"target-new": 1,
|
|
6973
|
-
"target-position": 1,
|
|
6974
|
-
"text-align": "left | right | center | justify | match-parent | start | end | inherit",
|
|
6975
|
-
"text-align-last": 1,
|
|
6976
|
-
"text-decoration": 1,
|
|
6977
|
-
"text-emphasis": 1,
|
|
6978
|
-
"text-height": 1,
|
|
6979
|
-
"text-indent": "<length> | <percentage> | inherit",
|
|
6980
|
-
"text-justify": "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
|
|
6981
|
-
"text-outline": 1,
|
|
6982
|
-
"text-overflow": 1,
|
|
6983
|
-
"text-rendering": "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
|
|
6984
|
-
"text-shadow": 1,
|
|
6985
|
-
"text-transform": "capitalize | uppercase | lowercase | none | inherit",
|
|
6986
|
-
"text-wrap": "normal | none | avoid",
|
|
6987
|
-
"top": "<margin-width> | inherit",
|
|
6988
|
-
"-ms-touch-action": "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation",
|
|
6989
|
-
"touch-action": "auto | none | pan-x | pan-y | pan-left | pan-right | pan-up | pan-down | manipulation",
|
|
6990
|
-
"transform": 1,
|
|
6991
|
-
"transform-origin": 1,
|
|
6992
|
-
"transform-style": 1,
|
|
6993
|
-
"transition": 1,
|
|
6994
|
-
"transition-delay": 1,
|
|
6995
|
-
"transition-duration": 1,
|
|
6996
|
-
"transition-property": 1,
|
|
6997
|
-
"transition-timing-function": 1,
|
|
6998
|
-
"unicode-bidi": "normal | embed | isolate | bidi-override | isolate-override | plaintext | inherit",
|
|
6999
|
-
"user-modify": "read-only | read-write | write-only | inherit",
|
|
7000
|
-
"user-select": "none | text | toggle | element | elements | all | inherit",
|
|
7001
|
-
"vertical-align": "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length> | inherit",
|
|
7002
|
-
"visibility": "visible | hidden | collapse | inherit",
|
|
7003
|
-
"voice-balance": 1,
|
|
7004
|
-
"voice-duration": 1,
|
|
7005
|
-
"voice-family": 1,
|
|
7006
|
-
"voice-pitch": 1,
|
|
7007
|
-
"voice-pitch-range": 1,
|
|
7008
|
-
"voice-rate": 1,
|
|
7009
|
-
"voice-stress": 1,
|
|
7010
|
-
"voice-volume": 1,
|
|
7011
|
-
"volume": 1,
|
|
7012
|
-
"white-space": "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap",
|
|
7013
|
-
"white-space-collapse": 1,
|
|
7014
|
-
"widows": "<integer> | inherit",
|
|
7015
|
-
"width": "<length> | <percentage> | <content-sizing> | auto | inherit",
|
|
7016
|
-
"will-change": { multi: "<ident>", comma: true },
|
|
7017
|
-
"word-break": "normal | keep-all | break-all",
|
|
7018
|
-
"word-spacing": "<length> | normal | inherit",
|
|
7019
|
-
"word-wrap": "normal | break-word",
|
|
7020
|
-
"writing-mode": "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit",
|
|
7021
|
-
"z-index": "<integer> | auto | inherit",
|
|
7022
|
-
"zoom": "<number> | <percentage> | normal"
|
|
7023
|
-
};
|
|
7024
|
-
function PropertyName(text, hack, line, col) {
|
|
7025
|
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_NAME_TYPE);
|
|
7026
|
-
this.hack = hack;
|
|
7027
|
-
}
|
|
7028
|
-
PropertyName.prototype = new SyntaxUnit();
|
|
7029
|
-
PropertyName.prototype.constructor = PropertyName;
|
|
7030
|
-
PropertyName.prototype.toString = function() {
|
|
7031
|
-
return (this.hack ? this.hack : "") + this.text;
|
|
7032
|
-
};
|
|
7033
|
-
function PropertyValue(parts, line, col) {
|
|
7034
|
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.PROPERTY_VALUE_TYPE);
|
|
7035
|
-
this.parts = parts;
|
|
7036
|
-
}
|
|
7037
|
-
PropertyValue.prototype = new SyntaxUnit();
|
|
7038
|
-
PropertyValue.prototype.constructor = PropertyValue;
|
|
7039
|
-
function PropertyValueIterator(value) {
|
|
7040
|
-
this._i = 0;
|
|
7041
|
-
this._parts = value.parts;
|
|
7042
|
-
this._marks = [];
|
|
7043
|
-
this.value = value;
|
|
7044
|
-
}
|
|
7045
|
-
PropertyValueIterator.prototype.count = function() {
|
|
7046
|
-
return this._parts.length;
|
|
7047
|
-
};
|
|
7048
|
-
PropertyValueIterator.prototype.isFirst = function() {
|
|
7049
|
-
return this._i === 0;
|
|
7050
|
-
};
|
|
7051
|
-
PropertyValueIterator.prototype.hasNext = function() {
|
|
7052
|
-
return this._i < this._parts.length;
|
|
7053
|
-
};
|
|
7054
|
-
PropertyValueIterator.prototype.mark = function() {
|
|
7055
|
-
this._marks.push(this._i);
|
|
7056
|
-
};
|
|
7057
|
-
PropertyValueIterator.prototype.peek = function(count) {
|
|
7058
|
-
return this.hasNext() ? this._parts[this._i + (count || 0)] : null;
|
|
7059
|
-
};
|
|
7060
|
-
PropertyValueIterator.prototype.next = function() {
|
|
7061
|
-
return this.hasNext() ? this._parts[this._i++] : null;
|
|
7062
|
-
};
|
|
7063
|
-
PropertyValueIterator.prototype.previous = function() {
|
|
7064
|
-
return this._i > 0 ? this._parts[--this._i] : null;
|
|
7065
|
-
};
|
|
7066
|
-
PropertyValueIterator.prototype.restore = function() {
|
|
7067
|
-
if (this._marks.length) {
|
|
7068
|
-
this._i = this._marks.pop();
|
|
7069
|
-
}
|
|
7070
|
-
};
|
|
7071
|
-
function PropertyValuePart(text, line, col) {
|
|
7072
|
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_VALUE_PART_TYPE);
|
|
7073
|
-
this.type = "unknown";
|
|
7074
|
-
var temp;
|
|
7075
|
-
if (/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)) {
|
|
7076
|
-
this.type = "dimension";
|
|
7077
|
-
this.value = +RegExp.$1;
|
|
7078
|
-
this.units = RegExp.$2;
|
|
7079
|
-
switch (this.units.toLowerCase()) {
|
|
7080
|
-
case "em":
|
|
7081
|
-
case "rem":
|
|
7082
|
-
case "ex":
|
|
7083
|
-
case "px":
|
|
7084
|
-
case "cm":
|
|
7085
|
-
case "mm":
|
|
7086
|
-
case "in":
|
|
7087
|
-
case "pt":
|
|
7088
|
-
case "pc":
|
|
7089
|
-
case "ch":
|
|
7090
|
-
case "vh":
|
|
7091
|
-
case "vw":
|
|
7092
|
-
case "vmax":
|
|
7093
|
-
case "vmin":
|
|
7094
|
-
this.type = "length";
|
|
7095
|
-
break;
|
|
7096
|
-
case "fr":
|
|
7097
|
-
this.type = "grid";
|
|
7098
|
-
break;
|
|
7099
|
-
case "deg":
|
|
7100
|
-
case "rad":
|
|
7101
|
-
case "grad":
|
|
7102
|
-
this.type = "angle";
|
|
7103
|
-
break;
|
|
7104
|
-
case "ms":
|
|
7105
|
-
case "s":
|
|
7106
|
-
this.type = "time";
|
|
7107
|
-
break;
|
|
7108
|
-
case "hz":
|
|
7109
|
-
case "khz":
|
|
7110
|
-
this.type = "frequency";
|
|
7111
|
-
break;
|
|
7112
|
-
case "dpi":
|
|
7113
|
-
case "dpcm":
|
|
7114
|
-
this.type = "resolution";
|
|
7115
|
-
break;
|
|
7116
|
-
}
|
|
7117
|
-
} else if (/^([+\-]?[\d\.]+)%$/i.test(text)) {
|
|
7118
|
-
this.type = "percentage";
|
|
7119
|
-
this.value = +RegExp.$1;
|
|
7120
|
-
} else if (/^([+\-]?\d+)$/i.test(text)) {
|
|
7121
|
-
this.type = "integer";
|
|
7122
|
-
this.value = +RegExp.$1;
|
|
7123
|
-
} else if (/^([+\-]?[\d\.]+)$/i.test(text)) {
|
|
7124
|
-
this.type = "number";
|
|
7125
|
-
this.value = +RegExp.$1;
|
|
7126
|
-
} else if (/^#([a-f0-9]{3,6})/i.test(text)) {
|
|
7127
|
-
this.type = "color";
|
|
7128
|
-
temp = RegExp.$1;
|
|
7129
|
-
if (temp.length === 3) {
|
|
7130
|
-
this.red = parseInt(temp.charAt(0) + temp.charAt(0), 16);
|
|
7131
|
-
this.green = parseInt(temp.charAt(1) + temp.charAt(1), 16);
|
|
7132
|
-
this.blue = parseInt(temp.charAt(2) + temp.charAt(2), 16);
|
|
7133
|
-
} else {
|
|
7134
|
-
this.red = parseInt(temp.substring(0, 2), 16);
|
|
7135
|
-
this.green = parseInt(temp.substring(2, 4), 16);
|
|
7136
|
-
this.blue = parseInt(temp.substring(4, 6), 16);
|
|
7137
|
-
}
|
|
7138
|
-
} else if (/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)) {
|
|
7139
|
-
this.type = "color";
|
|
7140
|
-
this.red = +RegExp.$1;
|
|
7141
|
-
this.green = +RegExp.$2;
|
|
7142
|
-
this.blue = +RegExp.$3;
|
|
7143
|
-
} else if (/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) {
|
|
7144
|
-
this.type = "color";
|
|
7145
|
-
this.red = +RegExp.$1 * 255 / 100;
|
|
7146
|
-
this.green = +RegExp.$2 * 255 / 100;
|
|
7147
|
-
this.blue = +RegExp.$3 * 255 / 100;
|
|
7148
|
-
} else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7149
|
-
this.type = "color";
|
|
7150
|
-
this.red = +RegExp.$1;
|
|
7151
|
-
this.green = +RegExp.$2;
|
|
7152
|
-
this.blue = +RegExp.$3;
|
|
7153
|
-
this.alpha = +RegExp.$4;
|
|
7154
|
-
} else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7155
|
-
this.type = "color";
|
|
7156
|
-
this.red = +RegExp.$1 * 255 / 100;
|
|
7157
|
-
this.green = +RegExp.$2 * 255 / 100;
|
|
7158
|
-
this.blue = +RegExp.$3 * 255 / 100;
|
|
7159
|
-
this.alpha = +RegExp.$4;
|
|
7160
|
-
} else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)) {
|
|
7161
|
-
this.type = "color";
|
|
7162
|
-
this.hue = +RegExp.$1;
|
|
7163
|
-
this.saturation = +RegExp.$2 / 100;
|
|
7164
|
-
this.lightness = +RegExp.$3 / 100;
|
|
7165
|
-
} else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)) {
|
|
7166
|
-
this.type = "color";
|
|
7167
|
-
this.hue = +RegExp.$1;
|
|
7168
|
-
this.saturation = +RegExp.$2 / 100;
|
|
7169
|
-
this.lightness = +RegExp.$3 / 100;
|
|
7170
|
-
this.alpha = +RegExp.$4;
|
|
7171
|
-
} else if (/^url\(["']?([^\)"']+)["']?\)/i.test(text)) {
|
|
7172
|
-
this.type = "uri";
|
|
7173
|
-
this.uri = RegExp.$1;
|
|
7174
|
-
} else if (/^([^\(]+)\(/i.test(text)) {
|
|
7175
|
-
this.type = "function";
|
|
7176
|
-
this.name = RegExp.$1;
|
|
7177
|
-
this.value = text;
|
|
7178
|
-
} else if (/^"([^\n\r\f\\"]|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*"/i.test(text)) {
|
|
7179
|
-
this.type = "string";
|
|
7180
|
-
this.value = PropertyValuePart.parseString(text);
|
|
7181
|
-
} else if (/^'([^\n\r\f\\']|\\\r\n|\\[^\r0-9a-f]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)*'/i.test(text)) {
|
|
7182
|
-
this.type = "string";
|
|
7183
|
-
this.value = PropertyValuePart.parseString(text);
|
|
7184
|
-
} else if (Colors[text.toLowerCase()]) {
|
|
7185
|
-
this.type = "color";
|
|
7186
|
-
temp = Colors[text.toLowerCase()].substring(1);
|
|
7187
|
-
this.red = parseInt(temp.substring(0, 2), 16);
|
|
7188
|
-
this.green = parseInt(temp.substring(2, 4), 16);
|
|
7189
|
-
this.blue = parseInt(temp.substring(4, 6), 16);
|
|
7190
|
-
} else if (/^[\,\/]$/.test(text)) {
|
|
7191
|
-
this.type = "operator";
|
|
7192
|
-
this.value = text;
|
|
7193
|
-
} else if (/^[a-z\-_\u0080-\uFFFF][a-z0-9\-_\u0080-\uFFFF]*$/i.test(text)) {
|
|
7194
|
-
this.type = "identifier";
|
|
7195
|
-
this.value = text;
|
|
7196
|
-
}
|
|
7197
|
-
}
|
|
7198
|
-
PropertyValuePart.prototype = new SyntaxUnit();
|
|
7199
|
-
PropertyValuePart.prototype.constructor = PropertyValuePart;
|
|
7200
|
-
PropertyValuePart.parseString = function(str) {
|
|
7201
|
-
str = str.slice(1, -1);
|
|
7202
|
-
var replacer = function(match, esc) {
|
|
7203
|
-
if (/^(\n|\r\n|\r|\f)$/.test(esc)) {
|
|
7204
|
-
return "";
|
|
7205
|
-
}
|
|
7206
|
-
var m = /^[0-9a-f]{1,6}/i.exec(esc);
|
|
7207
|
-
if (m) {
|
|
7208
|
-
var codePoint = parseInt(m[0], 16);
|
|
7209
|
-
if (String.fromCodePoint) {
|
|
7210
|
-
return String.fromCodePoint(codePoint);
|
|
7211
|
-
} else {
|
|
7212
|
-
return String.fromCharCode(codePoint);
|
|
7213
|
-
}
|
|
7214
|
-
}
|
|
7215
|
-
return esc;
|
|
7216
|
-
};
|
|
7217
|
-
return str.replace(
|
|
7218
|
-
/\\(\r\n|[^\r0-9a-f]|[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?)/ig,
|
|
7219
|
-
replacer
|
|
7220
|
-
);
|
|
7221
|
-
};
|
|
7222
|
-
PropertyValuePart.serializeString = function(value) {
|
|
7223
|
-
var replacer = function(match, c) {
|
|
7224
|
-
if (c === '"') {
|
|
7225
|
-
return "\\" + c;
|
|
7226
|
-
}
|
|
7227
|
-
var cp = String.codePointAt ? String.codePointAt(0) : String.charCodeAt(0);
|
|
7228
|
-
return "\\" + cp.toString(16) + " ";
|
|
7229
|
-
};
|
|
7230
|
-
return '"' + value.replace(/["\r\n\f]/g, replacer) + '"';
|
|
7231
|
-
};
|
|
7232
|
-
PropertyValuePart.fromToken = function(token) {
|
|
7233
|
-
return new PropertyValuePart(token.value, token.startLine, token.startCol);
|
|
7234
|
-
};
|
|
7235
|
-
var Pseudos = {
|
|
7236
|
-
__proto__: null,
|
|
7237
|
-
":first-letter": 1,
|
|
7238
|
-
":first-line": 1,
|
|
7239
|
-
":before": 1,
|
|
7240
|
-
":after": 1
|
|
7241
|
-
};
|
|
7242
|
-
Pseudos.ELEMENT = 1;
|
|
7243
|
-
Pseudos.CLASS = 2;
|
|
7244
|
-
Pseudos.isElement = function(pseudo) {
|
|
7245
|
-
return pseudo.indexOf("::") === 0 || Pseudos[pseudo.toLowerCase()] === Pseudos.ELEMENT;
|
|
7246
|
-
};
|
|
7247
|
-
function Selector(parts, line, col) {
|
|
7248
|
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.SELECTOR_TYPE);
|
|
7249
|
-
this.parts = parts;
|
|
7250
|
-
this.specificity = Specificity.calculate(this);
|
|
7251
|
-
}
|
|
7252
|
-
Selector.prototype = new SyntaxUnit();
|
|
7253
|
-
Selector.prototype.constructor = Selector;
|
|
7254
|
-
function SelectorPart(elementName, modifiers, text, line, col) {
|
|
7255
|
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_PART_TYPE);
|
|
7256
|
-
this.elementName = elementName;
|
|
7257
|
-
this.modifiers = modifiers;
|
|
7258
|
-
}
|
|
7259
|
-
SelectorPart.prototype = new SyntaxUnit();
|
|
7260
|
-
SelectorPart.prototype.constructor = SelectorPart;
|
|
7261
|
-
function SelectorSubPart(text, type, line, col) {
|
|
7262
|
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
|
|
7263
|
-
this.type = type;
|
|
7264
|
-
this.args = [];
|
|
7265
|
-
}
|
|
7266
|
-
SelectorSubPart.prototype = new SyntaxUnit();
|
|
7267
|
-
SelectorSubPart.prototype.constructor = SelectorSubPart;
|
|
7268
|
-
function Specificity(a, b, c, d) {
|
|
7269
|
-
this.a = a;
|
|
7270
|
-
this.b = b;
|
|
7271
|
-
this.c = c;
|
|
7272
|
-
this.d = d;
|
|
7273
|
-
}
|
|
7274
|
-
Specificity.prototype = {
|
|
7275
|
-
constructor: Specificity,
|
|
7276
|
-
compare: function(other) {
|
|
7277
|
-
var comps = ["a", "b", "c", "d"], i, len;
|
|
7278
|
-
for (i = 0, len = comps.length; i < len; i++) {
|
|
7279
|
-
if (this[comps[i]] < other[comps[i]]) {
|
|
7280
|
-
return -1;
|
|
7281
|
-
} else if (this[comps[i]] > other[comps[i]]) {
|
|
7282
|
-
return 1;
|
|
7283
|
-
}
|
|
7284
|
-
}
|
|
7285
|
-
return 0;
|
|
7286
|
-
},
|
|
7287
|
-
valueOf: function() {
|
|
7288
|
-
return this.a * 1e3 + this.b * 100 + this.c * 10 + this.d;
|
|
7289
|
-
},
|
|
7290
|
-
toString: function() {
|
|
7291
|
-
return this.a + "," + this.b + "," + this.c + "," + this.d;
|
|
7292
|
-
}
|
|
7293
|
-
};
|
|
7294
|
-
Specificity.calculate = function(selector) {
|
|
7295
|
-
var i, len, part, b = 0, c = 0, d = 0;
|
|
7296
|
-
function updateValues(part2) {
|
|
7297
|
-
var i2, j, len2, num, elementName = part2.elementName ? part2.elementName.text : "", modifier;
|
|
7298
|
-
if (elementName && elementName.charAt(elementName.length - 1) !== "*") {
|
|
7299
|
-
d++;
|
|
7300
|
-
}
|
|
7301
|
-
for (i2 = 0, len2 = part2.modifiers.length; i2 < len2; i2++) {
|
|
7302
|
-
modifier = part2.modifiers[i2];
|
|
7303
|
-
switch (modifier.type) {
|
|
7304
|
-
case "class":
|
|
7305
|
-
case "attribute":
|
|
7306
|
-
c++;
|
|
7307
|
-
break;
|
|
7308
|
-
case "id":
|
|
7309
|
-
b++;
|
|
7310
|
-
break;
|
|
7311
|
-
case "pseudo":
|
|
7312
|
-
if (Pseudos.isElement(modifier.text)) {
|
|
7313
|
-
d++;
|
|
7314
|
-
} else {
|
|
7315
|
-
c++;
|
|
7316
|
-
}
|
|
7317
|
-
break;
|
|
7318
|
-
case "not":
|
|
7319
|
-
for (j = 0, num = modifier.args.length; j < num; j++) {
|
|
7320
|
-
updateValues(modifier.args[j]);
|
|
7321
|
-
}
|
|
7322
|
-
}
|
|
7323
|
-
}
|
|
7324
|
-
}
|
|
7325
|
-
for (i = 0, len = selector.parts.length; i < len; i++) {
|
|
7326
|
-
part = selector.parts[i];
|
|
7327
|
-
if (part instanceof SelectorPart) {
|
|
7328
|
-
updateValues(part);
|
|
7329
|
-
}
|
|
7330
|
-
}
|
|
7331
|
-
return new Specificity(0, b, c, d);
|
|
7332
|
-
};
|
|
7333
|
-
var h = /^[0-9a-fA-F]$/, nl = /\n|\r\n|\r|\f/;
|
|
7334
|
-
function isHexDigit(c) {
|
|
7335
|
-
return c !== null && h.test(c);
|
|
7336
|
-
}
|
|
7337
|
-
function isDigit(c) {
|
|
7338
|
-
return c !== null && /\d/.test(c);
|
|
7339
|
-
}
|
|
7340
|
-
function isWhitespace(c) {
|
|
7341
|
-
return c !== null && /\s/.test(c);
|
|
7342
|
-
}
|
|
7343
|
-
function isNewLine(c) {
|
|
7344
|
-
return c !== null && nl.test(c);
|
|
7345
|
-
}
|
|
7346
|
-
function isNameStart(c) {
|
|
7347
|
-
return c !== null && /[a-z_\u0080-\uFFFF\\]/i.test(c);
|
|
7348
|
-
}
|
|
7349
|
-
function isNameChar(c) {
|
|
7350
|
-
return c !== null && (isNameStart(c) || /[0-9\-\\]/.test(c));
|
|
7351
|
-
}
|
|
7352
|
-
function isIdentStart(c) {
|
|
7353
|
-
return c !== null && (isNameStart(c) || /\-\\/.test(c));
|
|
7354
|
-
}
|
|
7355
|
-
function mix(receiver, supplier) {
|
|
7356
|
-
for (var prop in supplier) {
|
|
7357
|
-
if (Object.prototype.hasOwnProperty.call(supplier, prop)) {
|
|
7358
|
-
receiver[prop] = supplier[prop];
|
|
7359
|
-
}
|
|
7360
|
-
}
|
|
7361
|
-
return receiver;
|
|
7362
|
-
}
|
|
7363
|
-
function TokenStream(input) {
|
|
7364
|
-
TokenStreamBase.call(this, input, Tokens);
|
|
7365
|
-
}
|
|
7366
|
-
TokenStream.prototype = mix(new TokenStreamBase(), {
|
|
7367
|
-
_getToken: function(channel) {
|
|
7368
|
-
var c, reader = this._reader, token = null, startLine = reader.getLine(), startCol = reader.getCol();
|
|
7369
|
-
c = reader.read();
|
|
7370
|
-
while (c) {
|
|
7371
|
-
switch (c) {
|
|
7372
|
-
case "/":
|
|
7373
|
-
if (reader.peek() === "*") {
|
|
7374
|
-
token = this.commentToken(c, startLine, startCol);
|
|
7375
|
-
} else {
|
|
7376
|
-
token = this.charToken(c, startLine, startCol);
|
|
7377
|
-
}
|
|
7378
|
-
break;
|
|
7379
|
-
case "|":
|
|
7380
|
-
case "~":
|
|
7381
|
-
case "^":
|
|
7382
|
-
case "$":
|
|
7383
|
-
case "*":
|
|
7384
|
-
if (reader.peek() === "=") {
|
|
7385
|
-
token = this.comparisonToken(c, startLine, startCol);
|
|
7386
|
-
} else {
|
|
7387
|
-
token = this.charToken(c, startLine, startCol);
|
|
7388
|
-
}
|
|
7389
|
-
break;
|
|
7390
|
-
case '"':
|
|
7391
|
-
case "'":
|
|
7392
|
-
token = this.stringToken(c, startLine, startCol);
|
|
7393
|
-
break;
|
|
7394
|
-
case "#":
|
|
7395
|
-
if (isNameChar(reader.peek())) {
|
|
7396
|
-
token = this.hashToken(c, startLine, startCol);
|
|
7397
|
-
} else {
|
|
7398
|
-
token = this.charToken(c, startLine, startCol);
|
|
7399
|
-
}
|
|
7400
|
-
break;
|
|
7401
|
-
case ".":
|
|
7402
|
-
if (isDigit(reader.peek())) {
|
|
7403
|
-
token = this.numberToken(c, startLine, startCol);
|
|
7404
|
-
} else {
|
|
7405
|
-
token = this.charToken(c, startLine, startCol);
|
|
7406
|
-
}
|
|
7407
|
-
break;
|
|
7408
|
-
case "-":
|
|
7409
|
-
if (reader.peek() === "-") {
|
|
7410
|
-
token = this.htmlCommentEndToken(c, startLine, startCol);
|
|
7411
|
-
} else if (isNameStart(reader.peek())) {
|
|
7412
|
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
|
7413
|
-
} else {
|
|
7414
|
-
token = this.charToken(c, startLine, startCol);
|
|
7415
|
-
}
|
|
7416
|
-
break;
|
|
7417
|
-
case "!":
|
|
7418
|
-
token = this.importantToken(c, startLine, startCol);
|
|
7419
|
-
break;
|
|
7420
|
-
case "@":
|
|
7421
|
-
token = this.atRuleToken(c, startLine, startCol);
|
|
7422
|
-
break;
|
|
7423
|
-
case ":":
|
|
7424
|
-
token = this.notToken(c, startLine, startCol);
|
|
7425
|
-
break;
|
|
7426
|
-
case "<":
|
|
7427
|
-
token = this.htmlCommentStartToken(c, startLine, startCol);
|
|
7428
|
-
break;
|
|
7429
|
-
case "U":
|
|
7430
|
-
case "u":
|
|
7431
|
-
if (reader.peek() === "+") {
|
|
7432
|
-
token = this.unicodeRangeToken(c, startLine, startCol);
|
|
7433
|
-
break;
|
|
7434
|
-
}
|
|
7435
|
-
default:
|
|
7436
|
-
if (isDigit(c)) {
|
|
7437
|
-
token = this.numberToken(c, startLine, startCol);
|
|
7438
|
-
} else if (isWhitespace(c)) {
|
|
7439
|
-
token = this.whitespaceToken(c, startLine, startCol);
|
|
7440
|
-
} else if (isIdentStart(c)) {
|
|
7441
|
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
|
7442
|
-
} else {
|
|
7443
|
-
token = this.charToken(c, startLine, startCol);
|
|
7444
|
-
}
|
|
7445
|
-
}
|
|
7446
|
-
break;
|
|
7447
|
-
}
|
|
7448
|
-
if (!token && c === null) {
|
|
7449
|
-
token = this.createToken(Tokens.EOF, null, startLine, startCol);
|
|
7450
|
-
}
|
|
7451
|
-
return token;
|
|
7452
|
-
},
|
|
7453
|
-
createToken: function(tt, value, startLine, startCol, options) {
|
|
7454
|
-
var reader = this._reader;
|
|
7455
|
-
options = options || {};
|
|
7456
|
-
return {
|
|
7457
|
-
value,
|
|
7458
|
-
type: tt,
|
|
7459
|
-
channel: options.channel,
|
|
7460
|
-
endChar: options.endChar,
|
|
7461
|
-
hide: options.hide || false,
|
|
7462
|
-
startLine,
|
|
7463
|
-
startCol,
|
|
7464
|
-
endLine: reader.getLine(),
|
|
7465
|
-
endCol: reader.getCol()
|
|
7466
|
-
};
|
|
7467
|
-
},
|
|
7468
|
-
atRuleToken: function(first, startLine, startCol) {
|
|
7469
|
-
var rule = first, reader = this._reader, tt = Tokens.CHAR, ident;
|
|
7470
|
-
reader.mark();
|
|
7471
|
-
ident = this.readName();
|
|
7472
|
-
rule = first + ident;
|
|
7473
|
-
tt = Tokens.type(rule.toLowerCase());
|
|
7474
|
-
if (tt === Tokens.CHAR || tt === Tokens.UNKNOWN) {
|
|
7475
|
-
if (rule.length > 1) {
|
|
7476
|
-
tt = Tokens.UNKNOWN_SYM;
|
|
7477
|
-
} else {
|
|
7478
|
-
tt = Tokens.CHAR;
|
|
7479
|
-
rule = first;
|
|
7480
|
-
reader.reset();
|
|
7481
|
-
}
|
|
7482
|
-
}
|
|
7483
|
-
return this.createToken(tt, rule, startLine, startCol);
|
|
7484
|
-
},
|
|
7485
|
-
charToken: function(c, startLine, startCol) {
|
|
7486
|
-
var tt = Tokens.type(c);
|
|
7487
|
-
var opts = {};
|
|
7488
|
-
if (tt === -1) {
|
|
7489
|
-
tt = Tokens.CHAR;
|
|
7490
|
-
} else {
|
|
7491
|
-
opts.endChar = Tokens[tt].endChar;
|
|
7492
|
-
}
|
|
7493
|
-
return this.createToken(tt, c, startLine, startCol, opts);
|
|
7494
|
-
},
|
|
7495
|
-
commentToken: function(first, startLine, startCol) {
|
|
7496
|
-
var comment = this.readComment(first);
|
|
7497
|
-
return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
|
|
7498
|
-
},
|
|
7499
|
-
comparisonToken: function(c, startLine, startCol) {
|
|
7500
|
-
var reader = this._reader, comparison = c + reader.read(), tt = Tokens.type(comparison) || Tokens.CHAR;
|
|
7501
|
-
return this.createToken(tt, comparison, startLine, startCol);
|
|
7502
|
-
},
|
|
7503
|
-
hashToken: function(first, startLine, startCol) {
|
|
7504
|
-
var name = this.readName(first);
|
|
7505
|
-
return this.createToken(Tokens.HASH, name, startLine, startCol);
|
|
7506
|
-
},
|
|
7507
|
-
htmlCommentStartToken: function(first, startLine, startCol) {
|
|
7508
|
-
var reader = this._reader, text = first;
|
|
7509
|
-
reader.mark();
|
|
7510
|
-
text += reader.readCount(3);
|
|
7511
|
-
if (text === "<!--") {
|
|
7512
|
-
return this.createToken(Tokens.CDO, text, startLine, startCol);
|
|
7513
|
-
} else {
|
|
7514
|
-
reader.reset();
|
|
7515
|
-
return this.charToken(first, startLine, startCol);
|
|
7516
|
-
}
|
|
7517
|
-
},
|
|
7518
|
-
htmlCommentEndToken: function(first, startLine, startCol) {
|
|
7519
|
-
var reader = this._reader, text = first;
|
|
7520
|
-
reader.mark();
|
|
7521
|
-
text += reader.readCount(2);
|
|
7522
|
-
if (text === "-->") {
|
|
7523
|
-
return this.createToken(Tokens.CDC, text, startLine, startCol);
|
|
7524
|
-
} else {
|
|
7525
|
-
reader.reset();
|
|
7526
|
-
return this.charToken(first, startLine, startCol);
|
|
7527
|
-
}
|
|
7528
|
-
},
|
|
7529
|
-
identOrFunctionToken: function(first, startLine, startCol) {
|
|
7530
|
-
var reader = this._reader, ident = this.readName(first), tt = Tokens.IDENT, uriFns = ["url(", "url-prefix(", "domain("];
|
|
7531
|
-
if (reader.peek() === "(") {
|
|
7532
|
-
ident += reader.read();
|
|
7533
|
-
if (uriFns.indexOf(ident.toLowerCase()) > -1) {
|
|
7534
|
-
tt = Tokens.URI;
|
|
7535
|
-
ident = this.readURI(ident);
|
|
7536
|
-
if (uriFns.indexOf(ident.toLowerCase()) > -1) {
|
|
7537
|
-
tt = Tokens.FUNCTION;
|
|
7538
|
-
}
|
|
7539
|
-
} else {
|
|
7540
|
-
tt = Tokens.FUNCTION;
|
|
7541
|
-
}
|
|
7542
|
-
} else if (reader.peek() === ":") {
|
|
7543
|
-
if (ident.toLowerCase() === "progid") {
|
|
7544
|
-
ident += reader.readTo("(");
|
|
7545
|
-
tt = Tokens.IE_FUNCTION;
|
|
7546
|
-
}
|
|
7547
|
-
}
|
|
7548
|
-
return this.createToken(tt, ident, startLine, startCol);
|
|
7549
|
-
},
|
|
7550
|
-
importantToken: function(first, startLine, startCol) {
|
|
7551
|
-
var reader = this._reader, important = first, tt = Tokens.CHAR, temp, c;
|
|
7552
|
-
reader.mark();
|
|
7553
|
-
c = reader.read();
|
|
7554
|
-
while (c) {
|
|
7555
|
-
if (c === "/") {
|
|
7556
|
-
if (reader.peek() !== "*") {
|
|
7557
|
-
break;
|
|
7558
|
-
} else {
|
|
7559
|
-
temp = this.readComment(c);
|
|
7560
|
-
if (temp === "") {
|
|
7561
|
-
break;
|
|
7562
|
-
}
|
|
7563
|
-
}
|
|
7564
|
-
} else if (isWhitespace(c)) {
|
|
7565
|
-
important += c + this.readWhitespace();
|
|
7566
|
-
} else if (/i/i.test(c)) {
|
|
7567
|
-
temp = reader.readCount(8);
|
|
7568
|
-
if (/mportant/i.test(temp)) {
|
|
7569
|
-
important += c + temp;
|
|
7570
|
-
tt = Tokens.IMPORTANT_SYM;
|
|
7571
|
-
}
|
|
7572
|
-
break;
|
|
7573
|
-
} else {
|
|
7574
|
-
break;
|
|
7575
|
-
}
|
|
7576
|
-
c = reader.read();
|
|
7577
|
-
}
|
|
7578
|
-
if (tt === Tokens.CHAR) {
|
|
7579
|
-
reader.reset();
|
|
7580
|
-
return this.charToken(first, startLine, startCol);
|
|
7581
|
-
} else {
|
|
7582
|
-
return this.createToken(tt, important, startLine, startCol);
|
|
7583
|
-
}
|
|
7584
|
-
},
|
|
7585
|
-
notToken: function(first, startLine, startCol) {
|
|
7586
|
-
var reader = this._reader, text = first;
|
|
7587
|
-
reader.mark();
|
|
7588
|
-
text += reader.readCount(4);
|
|
7589
|
-
if (text.toLowerCase() === ":not(") {
|
|
7590
|
-
return this.createToken(Tokens.NOT, text, startLine, startCol);
|
|
7591
|
-
} else {
|
|
7592
|
-
reader.reset();
|
|
7593
|
-
return this.charToken(first, startLine, startCol);
|
|
7594
|
-
}
|
|
7595
|
-
},
|
|
7596
|
-
numberToken: function(first, startLine, startCol) {
|
|
7597
|
-
var reader = this._reader, value = this.readNumber(first), ident, tt = Tokens.NUMBER, c = reader.peek();
|
|
7598
|
-
if (isIdentStart(c)) {
|
|
7599
|
-
ident = this.readName(reader.read());
|
|
7600
|
-
value += ident;
|
|
7601
|
-
if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)) {
|
|
7602
|
-
tt = Tokens.LENGTH;
|
|
7603
|
-
} else if (/^deg|^rad$|^grad$/i.test(ident)) {
|
|
7604
|
-
tt = Tokens.ANGLE;
|
|
7605
|
-
} else if (/^ms$|^s$/i.test(ident)) {
|
|
7606
|
-
tt = Tokens.TIME;
|
|
7607
|
-
} else if (/^hz$|^khz$/i.test(ident)) {
|
|
7608
|
-
tt = Tokens.FREQ;
|
|
7609
|
-
} else if (/^dpi$|^dpcm$/i.test(ident)) {
|
|
7610
|
-
tt = Tokens.RESOLUTION;
|
|
7611
|
-
} else {
|
|
7612
|
-
tt = Tokens.DIMENSION;
|
|
7613
|
-
}
|
|
7614
|
-
} else if (c === "%") {
|
|
7615
|
-
value += reader.read();
|
|
7616
|
-
tt = Tokens.PERCENTAGE;
|
|
7617
|
-
}
|
|
7618
|
-
return this.createToken(tt, value, startLine, startCol);
|
|
7619
|
-
},
|
|
7620
|
-
stringToken: function(first, startLine, startCol) {
|
|
7621
|
-
var delim = first, string = first, reader = this._reader, prev = first, tt = Tokens.STRING, c = reader.read();
|
|
7622
|
-
while (c) {
|
|
7623
|
-
string += c;
|
|
7624
|
-
if (c === delim && prev !== "\\") {
|
|
7625
|
-
break;
|
|
7626
|
-
}
|
|
7627
|
-
if (isNewLine(reader.peek()) && c !== "\\") {
|
|
7628
|
-
tt = Tokens.INVALID;
|
|
7629
|
-
break;
|
|
7630
|
-
}
|
|
7631
|
-
prev = c;
|
|
7632
|
-
c = reader.read();
|
|
7633
|
-
}
|
|
7634
|
-
if (c === null) {
|
|
7635
|
-
tt = Tokens.INVALID;
|
|
7636
|
-
}
|
|
7637
|
-
return this.createToken(tt, string, startLine, startCol);
|
|
7638
|
-
},
|
|
7639
|
-
unicodeRangeToken: function(first, startLine, startCol) {
|
|
7640
|
-
var reader = this._reader, value = first, temp, tt = Tokens.CHAR;
|
|
7641
|
-
if (reader.peek() === "+") {
|
|
7642
|
-
reader.mark();
|
|
7643
|
-
value += reader.read();
|
|
7644
|
-
value += this.readUnicodeRangePart(true);
|
|
7645
|
-
if (value.length === 2) {
|
|
7646
|
-
reader.reset();
|
|
7647
|
-
} else {
|
|
7648
|
-
tt = Tokens.UNICODE_RANGE;
|
|
7649
|
-
if (value.indexOf("?") === -1) {
|
|
7650
|
-
if (reader.peek() === "-") {
|
|
7651
|
-
reader.mark();
|
|
7652
|
-
temp = reader.read();
|
|
7653
|
-
temp += this.readUnicodeRangePart(false);
|
|
7654
|
-
if (temp.length === 1) {
|
|
7655
|
-
reader.reset();
|
|
7656
|
-
} else {
|
|
7657
|
-
value += temp;
|
|
7658
|
-
}
|
|
7659
|
-
}
|
|
7660
|
-
}
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
return this.createToken(tt, value, startLine, startCol);
|
|
7664
|
-
},
|
|
7665
|
-
whitespaceToken: function(first, startLine, startCol) {
|
|
7666
|
-
var value = first + this.readWhitespace();
|
|
7667
|
-
return this.createToken(Tokens.S, value, startLine, startCol);
|
|
7668
|
-
},
|
|
7669
|
-
readUnicodeRangePart: function(allowQuestionMark) {
|
|
7670
|
-
var reader = this._reader, part = "", c = reader.peek();
|
|
7671
|
-
while (isHexDigit(c) && part.length < 6) {
|
|
7672
|
-
reader.read();
|
|
7673
|
-
part += c;
|
|
7674
|
-
c = reader.peek();
|
|
7675
|
-
}
|
|
7676
|
-
if (allowQuestionMark) {
|
|
7677
|
-
while (c === "?" && part.length < 6) {
|
|
7678
|
-
reader.read();
|
|
7679
|
-
part += c;
|
|
7680
|
-
c = reader.peek();
|
|
7681
|
-
}
|
|
7682
|
-
}
|
|
7683
|
-
return part;
|
|
7684
|
-
},
|
|
7685
|
-
readWhitespace: function() {
|
|
7686
|
-
var reader = this._reader, whitespace = "", c = reader.peek();
|
|
7687
|
-
while (isWhitespace(c)) {
|
|
7688
|
-
reader.read();
|
|
7689
|
-
whitespace += c;
|
|
7690
|
-
c = reader.peek();
|
|
7691
|
-
}
|
|
7692
|
-
return whitespace;
|
|
7693
|
-
},
|
|
7694
|
-
readNumber: function(first) {
|
|
7695
|
-
var reader = this._reader, number = first, hasDot = first === ".", c = reader.peek();
|
|
7696
|
-
while (c) {
|
|
7697
|
-
if (isDigit(c)) {
|
|
7698
|
-
number += reader.read();
|
|
7699
|
-
} else if (c === ".") {
|
|
7700
|
-
if (hasDot) {
|
|
7701
|
-
break;
|
|
7702
|
-
} else {
|
|
7703
|
-
hasDot = true;
|
|
7704
|
-
number += reader.read();
|
|
7705
|
-
}
|
|
7706
|
-
} else {
|
|
7707
|
-
break;
|
|
7708
|
-
}
|
|
7709
|
-
c = reader.peek();
|
|
7710
|
-
}
|
|
7711
|
-
return number;
|
|
7712
|
-
},
|
|
7713
|
-
readString: function() {
|
|
7714
|
-
var reader = this._reader, delim = reader.read(), string = delim, prev = delim, c = reader.peek();
|
|
7715
|
-
while (c) {
|
|
7716
|
-
c = reader.read();
|
|
7717
|
-
string += c;
|
|
7718
|
-
if (c === delim && prev !== "\\") {
|
|
7719
|
-
break;
|
|
7720
|
-
}
|
|
7721
|
-
if (isNewLine(reader.peek()) && c !== "\\") {
|
|
7722
|
-
string = "";
|
|
7723
|
-
break;
|
|
7724
|
-
}
|
|
7725
|
-
prev = c;
|
|
7726
|
-
c = reader.peek();
|
|
7727
|
-
}
|
|
7728
|
-
if (c === null) {
|
|
7729
|
-
string = "";
|
|
7730
|
-
}
|
|
7731
|
-
return string;
|
|
7732
|
-
},
|
|
7733
|
-
readURI: function(first) {
|
|
7734
|
-
var reader = this._reader, uri = first, inner = "", c = reader.peek();
|
|
7735
|
-
reader.mark();
|
|
7736
|
-
while (c && isWhitespace(c)) {
|
|
7737
|
-
reader.read();
|
|
7738
|
-
c = reader.peek();
|
|
7739
|
-
}
|
|
7740
|
-
if (c === "'" || c === '"') {
|
|
7741
|
-
inner = this.readString();
|
|
7742
|
-
} else {
|
|
7743
|
-
inner = this.readURL();
|
|
7744
|
-
}
|
|
7745
|
-
c = reader.peek();
|
|
7746
|
-
while (c && isWhitespace(c)) {
|
|
7747
|
-
reader.read();
|
|
7748
|
-
c = reader.peek();
|
|
7749
|
-
}
|
|
7750
|
-
if (inner === "" || c !== ")") {
|
|
7751
|
-
uri = first;
|
|
7752
|
-
reader.reset();
|
|
7753
|
-
} else {
|
|
7754
|
-
uri += inner + reader.read();
|
|
7755
|
-
}
|
|
7756
|
-
return uri;
|
|
7757
|
-
},
|
|
7758
|
-
readURL: function() {
|
|
7759
|
-
var reader = this._reader, url = "", c = reader.peek();
|
|
7760
|
-
while (/^[!#$%&\\*-~]$/.test(c)) {
|
|
7761
|
-
url += reader.read();
|
|
7762
|
-
c = reader.peek();
|
|
7763
|
-
}
|
|
7764
|
-
return url;
|
|
7765
|
-
},
|
|
7766
|
-
readName: function(first) {
|
|
7767
|
-
var reader = this._reader, ident = first || "", c = reader.peek();
|
|
7768
|
-
while (true) {
|
|
7769
|
-
if (c === "\\") {
|
|
7770
|
-
ident += this.readEscape(reader.read());
|
|
7771
|
-
c = reader.peek();
|
|
7772
|
-
} else if (c && isNameChar(c)) {
|
|
7773
|
-
ident += reader.read();
|
|
7774
|
-
c = reader.peek();
|
|
7775
|
-
} else {
|
|
7776
|
-
break;
|
|
7777
|
-
}
|
|
7778
|
-
}
|
|
7779
|
-
return ident;
|
|
7780
|
-
},
|
|
7781
|
-
readEscape: function(first) {
|
|
7782
|
-
var reader = this._reader, cssEscape = first || "", i = 0, c = reader.peek();
|
|
7783
|
-
if (isHexDigit(c)) {
|
|
7784
|
-
do {
|
|
7785
|
-
cssEscape += reader.read();
|
|
7786
|
-
c = reader.peek();
|
|
7787
|
-
} while (c && isHexDigit(c) && ++i < 6);
|
|
7788
|
-
}
|
|
7789
|
-
if (cssEscape.length === 3 && /\s/.test(c) || cssEscape.length === 7 || cssEscape.length === 1) {
|
|
7790
|
-
reader.read();
|
|
7791
|
-
} else {
|
|
7792
|
-
c = "";
|
|
7793
|
-
}
|
|
7794
|
-
return cssEscape + c;
|
|
7795
|
-
},
|
|
7796
|
-
readComment: function(first) {
|
|
7797
|
-
var reader = this._reader, comment = first || "", c = reader.read();
|
|
7798
|
-
if (c === "*") {
|
|
7799
|
-
while (c) {
|
|
7800
|
-
comment += c;
|
|
7801
|
-
if (comment.length > 2 && c === "*" && reader.peek() === "/") {
|
|
7802
|
-
comment += reader.read();
|
|
7803
|
-
break;
|
|
7804
|
-
}
|
|
7805
|
-
c = reader.read();
|
|
7806
|
-
}
|
|
7807
|
-
return comment;
|
|
7808
|
-
} else {
|
|
7809
|
-
return "";
|
|
7810
|
-
}
|
|
7811
|
-
}
|
|
7812
|
-
});
|
|
7813
|
-
var Tokens = [
|
|
7814
|
-
{ name: "CDO" },
|
|
7815
|
-
{ name: "CDC" },
|
|
7816
|
-
{ name: "S", whitespace: true },
|
|
7817
|
-
{ name: "COMMENT", comment: true, hide: true, channel: "comment" },
|
|
7818
|
-
{ name: "INCLUDES", text: "~=" },
|
|
7819
|
-
{ name: "DASHMATCH", text: "|=" },
|
|
7820
|
-
{ name: "PREFIXMATCH", text: "^=" },
|
|
7821
|
-
{ name: "SUFFIXMATCH", text: "$=" },
|
|
7822
|
-
{ name: "SUBSTRINGMATCH", text: "*=" },
|
|
7823
|
-
{ name: "STRING" },
|
|
7824
|
-
{ name: "IDENT" },
|
|
7825
|
-
{ name: "HASH" },
|
|
7826
|
-
{ name: "IMPORT_SYM", text: "@import" },
|
|
7827
|
-
{ name: "PAGE_SYM", text: "@page" },
|
|
7828
|
-
{ name: "MEDIA_SYM", text: "@media" },
|
|
7829
|
-
{ name: "FONT_FACE_SYM", text: "@font-face" },
|
|
7830
|
-
{ name: "CHARSET_SYM", text: "@charset" },
|
|
7831
|
-
{ name: "NAMESPACE_SYM", text: "@namespace" },
|
|
7832
|
-
{ name: "VIEWPORT_SYM", text: ["@viewport", "@-ms-viewport", "@-o-viewport"] },
|
|
7833
|
-
{ name: "DOCUMENT_SYM", text: ["@document", "@-moz-document"] },
|
|
7834
|
-
{ name: "UNKNOWN_SYM" },
|
|
7835
|
-
{ name: "KEYFRAMES_SYM", text: ["@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes"] },
|
|
7836
|
-
{ name: "IMPORTANT_SYM" },
|
|
7837
|
-
{ name: "LENGTH" },
|
|
7838
|
-
{ name: "ANGLE" },
|
|
7839
|
-
{ name: "TIME" },
|
|
7840
|
-
{ name: "FREQ" },
|
|
7841
|
-
{ name: "DIMENSION" },
|
|
7842
|
-
{ name: "PERCENTAGE" },
|
|
7843
|
-
{ name: "NUMBER" },
|
|
7844
|
-
{ name: "URI" },
|
|
7845
|
-
{ name: "FUNCTION" },
|
|
7846
|
-
{ name: "UNICODE_RANGE" },
|
|
7847
|
-
{ name: "INVALID" },
|
|
7848
|
-
{ name: "PLUS", text: "+" },
|
|
7849
|
-
{ name: "GREATER", text: ">" },
|
|
7850
|
-
{ name: "COMMA", text: "," },
|
|
7851
|
-
{ name: "TILDE", text: "~" },
|
|
7852
|
-
{ name: "NOT" },
|
|
7853
|
-
{ name: "TOPLEFTCORNER_SYM", text: "@top-left-corner" },
|
|
7854
|
-
{ name: "TOPLEFT_SYM", text: "@top-left" },
|
|
7855
|
-
{ name: "TOPCENTER_SYM", text: "@top-center" },
|
|
7856
|
-
{ name: "TOPRIGHT_SYM", text: "@top-right" },
|
|
7857
|
-
{ name: "TOPRIGHTCORNER_SYM", text: "@top-right-corner" },
|
|
7858
|
-
{ name: "BOTTOMLEFTCORNER_SYM", text: "@bottom-left-corner" },
|
|
7859
|
-
{ name: "BOTTOMLEFT_SYM", text: "@bottom-left" },
|
|
7860
|
-
{ name: "BOTTOMCENTER_SYM", text: "@bottom-center" },
|
|
7861
|
-
{ name: "BOTTOMRIGHT_SYM", text: "@bottom-right" },
|
|
7862
|
-
{ name: "BOTTOMRIGHTCORNER_SYM", text: "@bottom-right-corner" },
|
|
7863
|
-
{ name: "LEFTTOP_SYM", text: "@left-top" },
|
|
7864
|
-
{ name: "LEFTMIDDLE_SYM", text: "@left-middle" },
|
|
7865
|
-
{ name: "LEFTBOTTOM_SYM", text: "@left-bottom" },
|
|
7866
|
-
{ name: "RIGHTTOP_SYM", text: "@right-top" },
|
|
7867
|
-
{ name: "RIGHTMIDDLE_SYM", text: "@right-middle" },
|
|
7868
|
-
{ name: "RIGHTBOTTOM_SYM", text: "@right-bottom" },
|
|
7869
|
-
{ name: "RESOLUTION", state: "media" },
|
|
7870
|
-
{ name: "IE_FUNCTION" },
|
|
7871
|
-
{ name: "CHAR" },
|
|
7872
|
-
{
|
|
7873
|
-
name: "PIPE",
|
|
7874
|
-
text: "|"
|
|
7875
|
-
},
|
|
7876
|
-
{
|
|
7877
|
-
name: "SLASH",
|
|
7878
|
-
text: "/"
|
|
7879
|
-
},
|
|
7880
|
-
{
|
|
7881
|
-
name: "MINUS",
|
|
7882
|
-
text: "-"
|
|
7883
|
-
},
|
|
7884
|
-
{
|
|
7885
|
-
name: "STAR",
|
|
7886
|
-
text: "*"
|
|
7887
|
-
},
|
|
7888
|
-
{
|
|
7889
|
-
name: "LBRACE",
|
|
7890
|
-
endChar: "}",
|
|
7891
|
-
text: "{"
|
|
7892
|
-
},
|
|
7893
|
-
{
|
|
7894
|
-
name: "RBRACE",
|
|
7895
|
-
text: "}"
|
|
7896
|
-
},
|
|
7897
|
-
{
|
|
7898
|
-
name: "LBRACKET",
|
|
7899
|
-
endChar: "]",
|
|
7900
|
-
text: "["
|
|
7901
|
-
},
|
|
7902
|
-
{
|
|
7903
|
-
name: "RBRACKET",
|
|
7904
|
-
text: "]"
|
|
7905
|
-
},
|
|
7906
|
-
{
|
|
7907
|
-
name: "EQUALS",
|
|
7908
|
-
text: "="
|
|
7909
|
-
},
|
|
7910
|
-
{
|
|
7911
|
-
name: "COLON",
|
|
7912
|
-
text: ":"
|
|
7913
|
-
},
|
|
7914
|
-
{
|
|
7915
|
-
name: "SEMICOLON",
|
|
7916
|
-
text: ";"
|
|
7917
|
-
},
|
|
7918
|
-
{
|
|
7919
|
-
name: "LPAREN",
|
|
7920
|
-
endChar: ")",
|
|
7921
|
-
text: "("
|
|
7922
|
-
},
|
|
7923
|
-
{
|
|
7924
|
-
name: "RPAREN",
|
|
7925
|
-
text: ")"
|
|
7926
|
-
},
|
|
7927
|
-
{
|
|
7928
|
-
name: "DOT",
|
|
7929
|
-
text: "."
|
|
7930
|
-
}
|
|
7931
|
-
];
|
|
7932
|
-
(function() {
|
|
7933
|
-
var nameMap = [], typeMap = /* @__PURE__ */ Object.create(null);
|
|
7934
|
-
Tokens.UNKNOWN = -1;
|
|
7935
|
-
Tokens.unshift({ name: "EOF" });
|
|
7936
|
-
for (var i = 0, len = Tokens.length; i < len; i++) {
|
|
7937
|
-
nameMap.push(Tokens[i].name);
|
|
7938
|
-
Tokens[Tokens[i].name] = i;
|
|
7939
|
-
if (Tokens[i].text) {
|
|
7940
|
-
if (Tokens[i].text instanceof Array) {
|
|
7941
|
-
for (var j = 0; j < Tokens[i].text.length; j++) {
|
|
7942
|
-
typeMap[Tokens[i].text[j]] = i;
|
|
7943
|
-
}
|
|
7944
|
-
} else {
|
|
7945
|
-
typeMap[Tokens[i].text] = i;
|
|
7946
|
-
}
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
Tokens.name = function(tt) {
|
|
7950
|
-
return nameMap[tt];
|
|
7951
|
-
};
|
|
7952
|
-
Tokens.type = function(c) {
|
|
7953
|
-
return typeMap[c] || -1;
|
|
7954
|
-
};
|
|
7955
|
-
})();
|
|
7956
|
-
var Validation = {
|
|
7957
|
-
validate: function(property, value) {
|
|
7958
|
-
var name = property.toString().toLowerCase(), expression = new PropertyValueIterator(value), spec = Properties[name];
|
|
7959
|
-
if (!spec) {
|
|
7960
|
-
if (name.indexOf("-") !== 0) {
|
|
7961
|
-
throw new ValidationError("Unknown property '" + property + "'.", property.line, property.col);
|
|
7962
|
-
}
|
|
7963
|
-
} else if (typeof spec !== "number") {
|
|
7964
|
-
if (typeof spec === "string") {
|
|
7965
|
-
if (spec.indexOf("||") > -1) {
|
|
7966
|
-
this.groupProperty(spec, expression);
|
|
7967
|
-
} else {
|
|
7968
|
-
this.singleProperty(spec, expression, 1);
|
|
7969
|
-
}
|
|
7970
|
-
} else if (spec.multi) {
|
|
7971
|
-
this.multiProperty(spec.multi, expression, spec.comma, spec.max || Infinity);
|
|
7972
|
-
} else if (typeof spec === "function") {
|
|
7973
|
-
spec(expression);
|
|
7974
|
-
}
|
|
7975
|
-
}
|
|
7976
|
-
},
|
|
7977
|
-
singleProperty: function(types, expression, max, partial) {
|
|
7978
|
-
var result = false, value = expression.value, count = 0, part;
|
|
7979
|
-
while (expression.hasNext() && count < max) {
|
|
7980
|
-
result = ValidationTypes.isAny(expression, types);
|
|
7981
|
-
if (!result) {
|
|
7982
|
-
break;
|
|
7983
|
-
}
|
|
7984
|
-
count++;
|
|
7985
|
-
}
|
|
7986
|
-
if (!result) {
|
|
7987
|
-
if (expression.hasNext() && !expression.isFirst()) {
|
|
7988
|
-
part = expression.peek();
|
|
7989
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
7990
|
-
} else {
|
|
7991
|
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
|
7992
|
-
}
|
|
7993
|
-
} else if (expression.hasNext()) {
|
|
7994
|
-
part = expression.next();
|
|
7995
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
7996
|
-
}
|
|
7997
|
-
},
|
|
7998
|
-
multiProperty: function(types, expression, comma, max) {
|
|
7999
|
-
var result = false, value = expression.value, count = 0, part;
|
|
8000
|
-
while (expression.hasNext() && !result && count < max) {
|
|
8001
|
-
if (ValidationTypes.isAny(expression, types)) {
|
|
8002
|
-
count++;
|
|
8003
|
-
if (!expression.hasNext()) {
|
|
8004
|
-
result = true;
|
|
8005
|
-
} else if (comma) {
|
|
8006
|
-
if (String(expression.peek()) === ",") {
|
|
8007
|
-
part = expression.next();
|
|
8008
|
-
} else {
|
|
8009
|
-
break;
|
|
8010
|
-
}
|
|
8011
|
-
}
|
|
8012
|
-
} else {
|
|
8013
|
-
break;
|
|
8014
|
-
}
|
|
8015
|
-
}
|
|
8016
|
-
if (!result) {
|
|
8017
|
-
if (expression.hasNext() && !expression.isFirst()) {
|
|
8018
|
-
part = expression.peek();
|
|
8019
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8020
|
-
} else {
|
|
8021
|
-
part = expression.previous();
|
|
8022
|
-
if (comma && String(part) === ",") {
|
|
8023
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8024
|
-
} else {
|
|
8025
|
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
|
8026
|
-
}
|
|
8027
|
-
}
|
|
8028
|
-
} else if (expression.hasNext()) {
|
|
8029
|
-
part = expression.next();
|
|
8030
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8031
|
-
}
|
|
8032
|
-
},
|
|
8033
|
-
groupProperty: function(types, expression, comma) {
|
|
8034
|
-
var result = false, value = expression.value, typeCount = types.split("||").length, groups = { count: 0 }, partial = false, name, part;
|
|
8035
|
-
while (expression.hasNext() && !result) {
|
|
8036
|
-
name = ValidationTypes.isAnyOfGroup(expression, types);
|
|
8037
|
-
if (name) {
|
|
8038
|
-
if (groups[name]) {
|
|
8039
|
-
break;
|
|
8040
|
-
} else {
|
|
8041
|
-
groups[name] = 1;
|
|
8042
|
-
groups.count++;
|
|
8043
|
-
partial = true;
|
|
8044
|
-
if (groups.count === typeCount || !expression.hasNext()) {
|
|
8045
|
-
result = true;
|
|
8046
|
-
}
|
|
8047
|
-
}
|
|
8048
|
-
} else {
|
|
8049
|
-
break;
|
|
8050
|
-
}
|
|
8051
|
-
}
|
|
8052
|
-
if (!result) {
|
|
8053
|
-
if (partial && expression.hasNext()) {
|
|
8054
|
-
part = expression.peek();
|
|
8055
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8056
|
-
} else {
|
|
8057
|
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
|
8058
|
-
}
|
|
8059
|
-
} else if (expression.hasNext()) {
|
|
8060
|
-
part = expression.next();
|
|
8061
|
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
|
8062
|
-
}
|
|
8063
|
-
}
|
|
8064
|
-
};
|
|
8065
|
-
function ValidationError(message, line, col) {
|
|
8066
|
-
this.col = col;
|
|
8067
|
-
this.line = line;
|
|
8068
|
-
this.message = message;
|
|
8069
|
-
}
|
|
8070
|
-
ValidationError.prototype = new Error();
|
|
8071
|
-
var ValidationTypes = {
|
|
8072
|
-
isLiteral: function(part, literals) {
|
|
8073
|
-
var text = part.text.toString().toLowerCase(), args = literals.split(" | "), i, len, found = false;
|
|
8074
|
-
for (i = 0, len = args.length; i < len && !found; i++) {
|
|
8075
|
-
if (text === args[i].toLowerCase()) {
|
|
8076
|
-
found = true;
|
|
8077
|
-
}
|
|
8078
|
-
}
|
|
8079
|
-
return found;
|
|
8080
|
-
},
|
|
8081
|
-
isSimple: function(type) {
|
|
8082
|
-
return !!this.simple[type];
|
|
8083
|
-
},
|
|
8084
|
-
isComplex: function(type) {
|
|
8085
|
-
return !!this.complex[type];
|
|
8086
|
-
},
|
|
8087
|
-
isAny: function(expression, types) {
|
|
8088
|
-
var args = types.split(" | "), i, len, found = false;
|
|
8089
|
-
for (i = 0, len = args.length; i < len && !found && expression.hasNext(); i++) {
|
|
8090
|
-
found = this.isType(expression, args[i]);
|
|
8091
|
-
}
|
|
8092
|
-
return found;
|
|
8093
|
-
},
|
|
8094
|
-
isAnyOfGroup: function(expression, types) {
|
|
8095
|
-
var args = types.split(" || "), i, len, found = false;
|
|
8096
|
-
for (i = 0, len = args.length; i < len && !found; i++) {
|
|
8097
|
-
found = this.isType(expression, args[i]);
|
|
8098
|
-
}
|
|
8099
|
-
return found ? args[i - 1] : false;
|
|
8100
|
-
},
|
|
8101
|
-
isType: function(expression, type) {
|
|
8102
|
-
var part = expression.peek(), result = false;
|
|
8103
|
-
if (type.charAt(0) !== "<") {
|
|
8104
|
-
result = this.isLiteral(part, type);
|
|
8105
|
-
if (result) {
|
|
8106
|
-
expression.next();
|
|
8107
|
-
}
|
|
8108
|
-
} else if (this.simple[type]) {
|
|
8109
|
-
result = this.simple[type](part);
|
|
8110
|
-
if (result) {
|
|
8111
|
-
expression.next();
|
|
8112
|
-
}
|
|
8113
|
-
} else {
|
|
8114
|
-
result = this.complex[type](expression);
|
|
8115
|
-
}
|
|
8116
|
-
return result;
|
|
8117
|
-
},
|
|
8118
|
-
simple: {
|
|
8119
|
-
__proto__: null,
|
|
8120
|
-
"<absolute-size>": function(part) {
|
|
8121
|
-
return ValidationTypes.isLiteral(part, "xx-small | x-small | small | medium | large | x-large | xx-large");
|
|
8122
|
-
},
|
|
8123
|
-
"<attachment>": function(part) {
|
|
8124
|
-
return ValidationTypes.isLiteral(part, "scroll | fixed | local");
|
|
8125
|
-
},
|
|
8126
|
-
"<attr>": function(part) {
|
|
8127
|
-
return part.type === "function" && part.name === "attr";
|
|
8128
|
-
},
|
|
8129
|
-
"<bg-image>": function(part) {
|
|
8130
|
-
return this["<image>"](part) || this["<gradient>"](part) || String(part) === "none";
|
|
8131
|
-
},
|
|
8132
|
-
"<gradient>": function(part) {
|
|
8133
|
-
return part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
|
|
8134
|
-
},
|
|
8135
|
-
"<box>": function(part) {
|
|
8136
|
-
return ValidationTypes.isLiteral(part, "padding-box | border-box | content-box");
|
|
8137
|
-
},
|
|
8138
|
-
"<content>": function(part) {
|
|
8139
|
-
return part.type === "function" && part.name === "content";
|
|
8140
|
-
},
|
|
8141
|
-
"<relative-size>": function(part) {
|
|
8142
|
-
return ValidationTypes.isLiteral(part, "smaller | larger");
|
|
8143
|
-
},
|
|
8144
|
-
"<ident>": function(part) {
|
|
8145
|
-
return part.type === "identifier";
|
|
8146
|
-
},
|
|
8147
|
-
"<length>": function(part) {
|
|
8148
|
-
if (part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)) {
|
|
8149
|
-
return true;
|
|
8150
|
-
} else {
|
|
8151
|
-
return part.type === "length" || part.type === "number" || part.type === "integer" || String(part) === "0";
|
|
8152
|
-
}
|
|
8153
|
-
},
|
|
8154
|
-
"<color>": function(part) {
|
|
8155
|
-
return part.type === "color" || String(part) === "transparent" || String(part) === "currentColor";
|
|
8156
|
-
},
|
|
8157
|
-
"<number>": function(part) {
|
|
8158
|
-
return part.type === "number" || this["<integer>"](part);
|
|
8159
|
-
},
|
|
8160
|
-
"<integer>": function(part) {
|
|
8161
|
-
return part.type === "integer";
|
|
8162
|
-
},
|
|
8163
|
-
"<line>": function(part) {
|
|
8164
|
-
return part.type === "integer";
|
|
8165
|
-
},
|
|
8166
|
-
"<angle>": function(part) {
|
|
8167
|
-
return part.type === "angle";
|
|
8168
|
-
},
|
|
8169
|
-
"<uri>": function(part) {
|
|
8170
|
-
return part.type === "uri";
|
|
8171
|
-
},
|
|
8172
|
-
"<image>": function(part) {
|
|
8173
|
-
return this["<uri>"](part);
|
|
8174
|
-
},
|
|
8175
|
-
"<percentage>": function(part) {
|
|
8176
|
-
return part.type === "percentage" || String(part) === "0";
|
|
8177
|
-
},
|
|
8178
|
-
"<border-width>": function(part) {
|
|
8179
|
-
return this["<length>"](part) || ValidationTypes.isLiteral(part, "thin | medium | thick");
|
|
8180
|
-
},
|
|
8181
|
-
"<border-style>": function(part) {
|
|
8182
|
-
return ValidationTypes.isLiteral(part, "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");
|
|
8183
|
-
},
|
|
8184
|
-
"<content-sizing>": function(part) {
|
|
8185
|
-
return ValidationTypes.isLiteral(part, "fill-available | -moz-available | -webkit-fill-available | max-content | -moz-max-content | -webkit-max-content | min-content | -moz-min-content | -webkit-min-content | fit-content | -moz-fit-content | -webkit-fit-content");
|
|
8186
|
-
},
|
|
8187
|
-
"<margin-width>": function(part) {
|
|
8188
|
-
return this["<length>"](part) || this["<percentage>"](part) || ValidationTypes.isLiteral(part, "auto");
|
|
8189
|
-
},
|
|
8190
|
-
"<padding-width>": function(part) {
|
|
8191
|
-
return this["<length>"](part) || this["<percentage>"](part);
|
|
8192
|
-
},
|
|
8193
|
-
"<shape>": function(part) {
|
|
8194
|
-
return part.type === "function" && (part.name === "rect" || part.name === "inset-rect");
|
|
8195
|
-
},
|
|
8196
|
-
"<time>": function(part) {
|
|
8197
|
-
return part.type === "time";
|
|
8198
|
-
},
|
|
8199
|
-
"<flex-grow>": function(part) {
|
|
8200
|
-
return this["<number>"](part);
|
|
8201
|
-
},
|
|
8202
|
-
"<flex-shrink>": function(part) {
|
|
8203
|
-
return this["<number>"](part);
|
|
8204
|
-
},
|
|
8205
|
-
"<width>": function(part) {
|
|
8206
|
-
return this["<margin-width>"](part);
|
|
8207
|
-
},
|
|
8208
|
-
"<flex-basis>": function(part) {
|
|
8209
|
-
return this["<width>"](part);
|
|
8210
|
-
},
|
|
8211
|
-
"<flex-direction>": function(part) {
|
|
8212
|
-
return ValidationTypes.isLiteral(part, "row | row-reverse | column | column-reverse");
|
|
8213
|
-
},
|
|
8214
|
-
"<flex-wrap>": function(part) {
|
|
8215
|
-
return ValidationTypes.isLiteral(part, "nowrap | wrap | wrap-reverse");
|
|
8216
|
-
},
|
|
8217
|
-
"<feature-tag-value>": function(part) {
|
|
8218
|
-
return part.type === "function" && /^[A-Z0-9]{4}$/i.test(part);
|
|
8219
|
-
}
|
|
8220
|
-
},
|
|
8221
|
-
complex: {
|
|
8222
|
-
__proto__: null,
|
|
8223
|
-
"<bg-position>": function(expression) {
|
|
8224
|
-
var result = false, numeric = "<percentage> | <length>", xDir = "left | right", yDir = "top | bottom", count = 0;
|
|
8225
|
-
while (expression.peek(count) && expression.peek(count).text !== ",") {
|
|
8226
|
-
count++;
|
|
8227
|
-
}
|
|
8228
|
-
if (count < 3) {
|
|
8229
|
-
if (ValidationTypes.isAny(expression, xDir + " | center | " + numeric)) {
|
|
8230
|
-
result = true;
|
|
8231
|
-
ValidationTypes.isAny(expression, yDir + " | center | " + numeric);
|
|
8232
|
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
|
8233
|
-
result = true;
|
|
8234
|
-
ValidationTypes.isAny(expression, xDir + " | center");
|
|
8235
|
-
}
|
|
8236
|
-
} else {
|
|
8237
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8238
|
-
if (ValidationTypes.isAny(expression, yDir)) {
|
|
8239
|
-
result = true;
|
|
8240
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8241
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8242
|
-
if (ValidationTypes.isAny(expression, yDir)) {
|
|
8243
|
-
result = true;
|
|
8244
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8245
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8246
|
-
result = true;
|
|
8247
|
-
}
|
|
8248
|
-
}
|
|
8249
|
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
|
8250
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8251
|
-
result = true;
|
|
8252
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8253
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8254
|
-
if (ValidationTypes.isAny(expression, xDir)) {
|
|
8255
|
-
result = true;
|
|
8256
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8257
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8258
|
-
result = true;
|
|
8259
|
-
}
|
|
8260
|
-
}
|
|
8261
|
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
|
8262
|
-
if (ValidationTypes.isAny(expression, xDir + " | " + yDir)) {
|
|
8263
|
-
result = true;
|
|
8264
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8265
|
-
}
|
|
8266
|
-
}
|
|
8267
|
-
}
|
|
8268
|
-
return result;
|
|
8269
|
-
},
|
|
8270
|
-
"<bg-size>": function(expression) {
|
|
8271
|
-
var result = false, numeric = "<percentage> | <length> | auto";
|
|
8272
|
-
if (ValidationTypes.isAny(expression, "cover | contain")) {
|
|
8273
|
-
result = true;
|
|
8274
|
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
|
8275
|
-
result = true;
|
|
8276
|
-
ValidationTypes.isAny(expression, numeric);
|
|
8277
|
-
}
|
|
8278
|
-
return result;
|
|
8279
|
-
},
|
|
8280
|
-
"<repeat-style>": function(expression) {
|
|
8281
|
-
var result = false, values = "repeat | space | round | no-repeat", part;
|
|
8282
|
-
if (expression.hasNext()) {
|
|
8283
|
-
part = expression.next();
|
|
8284
|
-
if (ValidationTypes.isLiteral(part, "repeat-x | repeat-y")) {
|
|
8285
|
-
result = true;
|
|
8286
|
-
} else if (ValidationTypes.isLiteral(part, values)) {
|
|
8287
|
-
result = true;
|
|
8288
|
-
if (expression.hasNext() && ValidationTypes.isLiteral(expression.peek(), values)) {
|
|
8289
|
-
expression.next();
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
}
|
|
8293
|
-
return result;
|
|
8294
|
-
},
|
|
8295
|
-
"<shadow>": function(expression) {
|
|
8296
|
-
var result = false, count = 0, inset = false, color = false;
|
|
8297
|
-
if (expression.hasNext()) {
|
|
8298
|
-
if (ValidationTypes.isAny(expression, "inset")) {
|
|
8299
|
-
inset = true;
|
|
8300
|
-
}
|
|
8301
|
-
if (ValidationTypes.isAny(expression, "<color>")) {
|
|
8302
|
-
color = true;
|
|
8303
|
-
}
|
|
8304
|
-
while (ValidationTypes.isAny(expression, "<length>") && count < 4) {
|
|
8305
|
-
count++;
|
|
8306
|
-
}
|
|
8307
|
-
if (expression.hasNext()) {
|
|
8308
|
-
if (!color) {
|
|
8309
|
-
ValidationTypes.isAny(expression, "<color>");
|
|
8310
|
-
}
|
|
8311
|
-
if (!inset) {
|
|
8312
|
-
ValidationTypes.isAny(expression, "inset");
|
|
8313
|
-
}
|
|
8314
|
-
}
|
|
8315
|
-
result = count >= 2 && count <= 4;
|
|
4762
|
+
|
|
4763
|
+
// external/npm/node_modules/domino/lib/events.js
|
|
4764
|
+
var require_events = __commonJS({
|
|
4765
|
+
"external/npm/node_modules/domino/lib/events.js"(exports, module) {
|
|
4766
|
+
"use strict";
|
|
4767
|
+
module.exports = {
|
|
4768
|
+
Event: require_Event(),
|
|
4769
|
+
UIEvent: require_UIEvent(),
|
|
4770
|
+
MouseEvent: require_MouseEvent(),
|
|
4771
|
+
CustomEvent: require_CustomEvent()
|
|
4772
|
+
};
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
|
|
4776
|
+
// external/npm/node_modules/domino/lib/style_parser.js
|
|
4777
|
+
var require_style_parser = __commonJS({
|
|
4778
|
+
"external/npm/node_modules/domino/lib/style_parser.js"(exports) {
|
|
4779
|
+
"use strict";
|
|
4780
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4781
|
+
exports.hyphenate = exports.parse = void 0;
|
|
4782
|
+
function parse(value) {
|
|
4783
|
+
const styles = [];
|
|
4784
|
+
let i = 0;
|
|
4785
|
+
let parenDepth = 0;
|
|
4786
|
+
let quote = 0;
|
|
4787
|
+
let valueStart = 0;
|
|
4788
|
+
let propStart = 0;
|
|
4789
|
+
let currentProp = null;
|
|
4790
|
+
while (i < value.length) {
|
|
4791
|
+
const token = value.charCodeAt(i++);
|
|
4792
|
+
switch (token) {
|
|
4793
|
+
case 40:
|
|
4794
|
+
parenDepth++;
|
|
4795
|
+
break;
|
|
4796
|
+
case 41:
|
|
4797
|
+
parenDepth--;
|
|
4798
|
+
break;
|
|
4799
|
+
case 39:
|
|
4800
|
+
if (quote === 0) {
|
|
4801
|
+
quote = 39;
|
|
4802
|
+
} else if (quote === 39 && value.charCodeAt(i - 1) !== 92) {
|
|
4803
|
+
quote = 0;
|
|
8316
4804
|
}
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
if (
|
|
8322
|
-
|
|
8323
|
-
ValidationTypes.isAny(expression, simple);
|
|
4805
|
+
break;
|
|
4806
|
+
case 34:
|
|
4807
|
+
if (quote === 0) {
|
|
4808
|
+
quote = 34;
|
|
4809
|
+
} else if (quote === 34 && value.charCodeAt(i - 1) !== 92) {
|
|
4810
|
+
quote = 0;
|
|
8324
4811
|
}
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
result = true;
|
|
8331
|
-
} else {
|
|
8332
|
-
if (ValidationTypes.isType(expression, "<flex-grow>")) {
|
|
8333
|
-
if (expression.peek()) {
|
|
8334
|
-
if (ValidationTypes.isType(expression, "<flex-shrink>")) {
|
|
8335
|
-
if (expression.peek()) {
|
|
8336
|
-
result = ValidationTypes.isType(expression, "<flex-basis>");
|
|
8337
|
-
} else {
|
|
8338
|
-
result = true;
|
|
8339
|
-
}
|
|
8340
|
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
|
8341
|
-
result = expression.peek() === null;
|
|
8342
|
-
}
|
|
8343
|
-
} else {
|
|
8344
|
-
result = true;
|
|
8345
|
-
}
|
|
8346
|
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
|
8347
|
-
result = true;
|
|
8348
|
-
}
|
|
4812
|
+
break;
|
|
4813
|
+
case 58:
|
|
4814
|
+
if (!currentProp && parenDepth === 0 && quote === 0) {
|
|
4815
|
+
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
4816
|
+
valueStart = i;
|
|
8349
4817
|
}
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
4818
|
+
break;
|
|
4819
|
+
case 59:
|
|
4820
|
+
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0) {
|
|
4821
|
+
const styleVal = value.substring(valueStart, i - 1).trim();
|
|
4822
|
+
styles.push(currentProp, styleVal);
|
|
4823
|
+
propStart = i;
|
|
4824
|
+
valueStart = 0;
|
|
4825
|
+
currentProp = null;
|
|
8353
4826
|
}
|
|
8354
|
-
|
|
8355
|
-
}
|
|
4827
|
+
break;
|
|
8356
4828
|
}
|
|
8357
|
-
};
|
|
8358
|
-
parserlib.css = {
|
|
8359
|
-
__proto__: null,
|
|
8360
|
-
Colors,
|
|
8361
|
-
Combinator,
|
|
8362
|
-
Parser,
|
|
8363
|
-
PropertyName,
|
|
8364
|
-
PropertyValue,
|
|
8365
|
-
PropertyValuePart,
|
|
8366
|
-
MediaFeature,
|
|
8367
|
-
MediaQuery,
|
|
8368
|
-
Selector,
|
|
8369
|
-
SelectorPart,
|
|
8370
|
-
SelectorSubPart,
|
|
8371
|
-
Specificity,
|
|
8372
|
-
TokenStream,
|
|
8373
|
-
Tokens,
|
|
8374
|
-
ValidationError
|
|
8375
|
-
};
|
|
8376
|
-
})();
|
|
8377
|
-
(function() {
|
|
8378
|
-
for (var prop in parserlib) {
|
|
8379
|
-
exports[prop] = parserlib[prop];
|
|
8380
4829
|
}
|
|
8381
|
-
|
|
4830
|
+
if (currentProp && valueStart) {
|
|
4831
|
+
const styleVal = value.slice(valueStart).trim();
|
|
4832
|
+
styles.push(currentProp, styleVal);
|
|
4833
|
+
}
|
|
4834
|
+
return styles;
|
|
4835
|
+
}
|
|
4836
|
+
exports.parse = parse;
|
|
4837
|
+
function hyphenate(value) {
|
|
4838
|
+
return value.replace(/[a-z][A-Z]/g, (v) => {
|
|
4839
|
+
return v.charAt(0) + "-" + v.charAt(1);
|
|
4840
|
+
}).toLowerCase();
|
|
4841
|
+
}
|
|
4842
|
+
exports.hyphenate = hyphenate;
|
|
8382
4843
|
}
|
|
8383
4844
|
});
|
|
8384
4845
|
|
|
@@ -8386,23 +4847,33 @@ var require_cssparser = __commonJS({
|
|
|
8386
4847
|
var require_CSSStyleDeclaration = __commonJS({
|
|
8387
4848
|
"external/npm/node_modules/domino/lib/CSSStyleDeclaration.js"(exports, module) {
|
|
8388
4849
|
"use strict";
|
|
8389
|
-
var
|
|
4850
|
+
var { parse } = require_style_parser();
|
|
8390
4851
|
module.exports = CSSStyleDeclaration;
|
|
8391
4852
|
function CSSStyleDeclaration(elt) {
|
|
8392
4853
|
this._element = elt;
|
|
8393
4854
|
}
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
4855
|
+
var IMPORTANT_BANG = "!important";
|
|
4856
|
+
function parseStyles(value) {
|
|
4857
|
+
const result = {
|
|
4858
|
+
property: {},
|
|
4859
|
+
priority: {}
|
|
4860
|
+
};
|
|
4861
|
+
if (!value) {
|
|
4862
|
+
return result;
|
|
4863
|
+
}
|
|
4864
|
+
const styleValues = parse(value);
|
|
4865
|
+
if (styleValues.length < 2) {
|
|
4866
|
+
return result;
|
|
4867
|
+
}
|
|
4868
|
+
for (let i = 0; i < styleValues.length; i += 2) {
|
|
4869
|
+
const name = styleValues[i];
|
|
4870
|
+
let value2 = styleValues[i + 1];
|
|
4871
|
+
if (value2.endsWith(IMPORTANT_BANG)) {
|
|
4872
|
+
result.priority[name] = "important";
|
|
4873
|
+
value2 = value2.slice(0, -IMPORTANT_BANG.length).trim();
|
|
4874
|
+
}
|
|
4875
|
+
result.property[name] = value2;
|
|
4876
|
+
}
|
|
8406
4877
|
return result;
|
|
8407
4878
|
}
|
|
8408
4879
|
var NO_CHANGE = {};
|
|
@@ -8469,6 +4940,7 @@ var require_CSSStyleDeclaration = __commonJS({
|
|
|
8469
4940
|
if (value !== NO_CHANGE) {
|
|
8470
4941
|
value = "" + value;
|
|
8471
4942
|
}
|
|
4943
|
+
value = value.trim();
|
|
8472
4944
|
if (value === "") {
|
|
8473
4945
|
this.removeProperty(property);
|
|
8474
4946
|
return;
|
|
@@ -19958,976 +16430,12 @@ var require_lib = __commonJS({
|
|
|
19958
16430
|
exports.impl = impl;
|
|
19959
16431
|
}
|
|
19960
16432
|
});
|
|
19961
|
-
|
|
19962
|
-
/*!
|
|
19963
|
-
Parser-Lib
|
|
19964
|
-
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
|
|
19965
|
-
|
|
19966
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19967
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
19968
|
-
in the Software without restriction, including without limitation the rights
|
|
19969
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19970
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
19971
|
-
furnished to do so, subject to the following conditions:
|
|
19972
|
-
|
|
19973
|
-
The above copyright notice and this permission notice shall be included in
|
|
19974
|
-
all copies or substantial portions of the Software.
|
|
19975
|
-
|
|
19976
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19977
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19978
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19979
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19980
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19981
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19982
|
-
THE SOFTWARE.
|
|
19983
|
-
|
|
19984
|
-
*/
|
|
19985
|
-
|
|
19986
|
-
function setDomTypes() {
|
|
19987
|
-
// Make all Domino types available in the global env.
|
|
19988
|
-
Object.assign(global, domino.impl);
|
|
19989
|
-
global['KeyboardEvent'] = domino.impl.Event;
|
|
19990
|
-
}
|
|
19991
|
-
/**
|
|
19992
|
-
* Parses a document string to a Document object.
|
|
19993
|
-
*/
|
|
19994
|
-
function parseDocument(html, url = '/') {
|
|
19995
|
-
let window = domino.createWindow(html, url);
|
|
19996
|
-
let doc = window.document;
|
|
19997
|
-
return doc;
|
|
19998
|
-
}
|
|
19999
|
-
/**
|
|
20000
|
-
* Serializes a document to string.
|
|
20001
|
-
*/
|
|
20002
|
-
function serializeDocument(doc) {
|
|
20003
|
-
return doc.serialize();
|
|
20004
|
-
}
|
|
20005
|
-
/**
|
|
20006
|
-
* DOM Adapter for the server platform based on https://github.com/fgnass/domino.
|
|
20007
|
-
*/
|
|
20008
|
-
class DominoAdapter extends ɵBrowserDomAdapter {
|
|
20009
|
-
constructor() {
|
|
20010
|
-
super(...arguments);
|
|
20011
|
-
this.supportsDOMEvents = false;
|
|
20012
|
-
}
|
|
20013
|
-
static makeCurrent() {
|
|
20014
|
-
setDomTypes();
|
|
20015
|
-
ɵsetRootDomAdapter(new DominoAdapter());
|
|
20016
|
-
}
|
|
20017
|
-
createHtmlDocument() {
|
|
20018
|
-
return parseDocument('<html><head><title>fakeTitle</title></head><body></body></html>');
|
|
20019
|
-
}
|
|
20020
|
-
getDefaultDocument() {
|
|
20021
|
-
if (!DominoAdapter.defaultDoc) {
|
|
20022
|
-
DominoAdapter.defaultDoc = domino.createDocument();
|
|
20023
|
-
}
|
|
20024
|
-
return DominoAdapter.defaultDoc;
|
|
20025
|
-
}
|
|
20026
|
-
isElementNode(node) {
|
|
20027
|
-
return node ? node.nodeType === DominoAdapter.defaultDoc.ELEMENT_NODE : false;
|
|
20028
|
-
}
|
|
20029
|
-
isShadowRoot(node) {
|
|
20030
|
-
return node.shadowRoot == node;
|
|
20031
|
-
}
|
|
20032
|
-
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
|
20033
|
-
getGlobalEventTarget(doc, target) {
|
|
20034
|
-
if (target === 'window') {
|
|
20035
|
-
return doc.defaultView;
|
|
20036
|
-
}
|
|
20037
|
-
if (target === 'document') {
|
|
20038
|
-
return doc;
|
|
20039
|
-
}
|
|
20040
|
-
if (target === 'body') {
|
|
20041
|
-
return doc.body;
|
|
20042
|
-
}
|
|
20043
|
-
return null;
|
|
20044
|
-
}
|
|
20045
|
-
getBaseHref(doc) {
|
|
20046
|
-
// TODO(alxhub): Need relative path logic from BrowserDomAdapter here?
|
|
20047
|
-
return doc.documentElement.querySelector('base')?.getAttribute('href') || '';
|
|
20048
|
-
}
|
|
20049
|
-
dispatchEvent(el, evt) {
|
|
20050
|
-
el.dispatchEvent(evt);
|
|
20051
|
-
// Dispatch the event to the window also.
|
|
20052
|
-
const doc = el.ownerDocument || el;
|
|
20053
|
-
const win = doc.defaultView;
|
|
20054
|
-
if (win) {
|
|
20055
|
-
win.dispatchEvent(evt);
|
|
20056
|
-
}
|
|
20057
|
-
}
|
|
20058
|
-
getUserAgent() {
|
|
20059
|
-
return 'Fake user agent';
|
|
20060
|
-
}
|
|
20061
|
-
getCookie(name) {
|
|
20062
|
-
throw new Error('getCookie has not been implemented');
|
|
20063
|
-
}
|
|
20064
|
-
}
|
|
20065
|
-
|
|
20066
|
-
/**
|
|
20067
|
-
* Representation of the current platform state.
|
|
20068
|
-
*
|
|
20069
|
-
* @publicApi
|
|
20070
|
-
*/
|
|
20071
|
-
class PlatformState {
|
|
20072
|
-
constructor(_doc) {
|
|
20073
|
-
this._doc = _doc;
|
|
20074
|
-
}
|
|
20075
|
-
/**
|
|
20076
|
-
* Renders the current state of the platform to string.
|
|
20077
|
-
*/
|
|
20078
|
-
renderToString() {
|
|
20079
|
-
return serializeDocument(this._doc);
|
|
20080
|
-
}
|
|
20081
|
-
/**
|
|
20082
|
-
* Returns the current DOM state.
|
|
20083
|
-
*/
|
|
20084
|
-
getDocument() {
|
|
20085
|
-
return this._doc;
|
|
20086
|
-
}
|
|
20087
|
-
}
|
|
20088
|
-
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20089
|
-
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: PlatformState });
|
|
20090
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: PlatformState, decorators: [{
|
|
20091
|
-
type: Injectable
|
|
20092
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20093
|
-
type: Inject,
|
|
20094
|
-
args: [DOCUMENT]
|
|
20095
|
-
}] }]; } });
|
|
20096
|
-
|
|
20097
|
-
/**
|
|
20098
|
-
* The DI token for setting the initial config for the platform.
|
|
20099
|
-
*
|
|
20100
|
-
* @publicApi
|
|
20101
|
-
*/
|
|
20102
|
-
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
20103
|
-
/**
|
|
20104
|
-
* A function that will be executed when calling `renderApplication` or
|
|
20105
|
-
* `renderModule` just before current platform state is rendered to string.
|
|
20106
|
-
*
|
|
20107
|
-
* @publicApi
|
|
20108
|
-
*/
|
|
20109
|
-
const BEFORE_APP_SERIALIZED = new InjectionToken('Server.RENDER_MODULE_HOOK');
|
|
20110
|
-
|
|
20111
|
-
// @see https://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#URI-syntax
|
|
20112
|
-
const isAbsoluteUrl = /^[a-zA-Z\-\+.]+:\/\//;
|
|
20113
|
-
class ServerXhr {
|
|
20114
|
-
build() {
|
|
20115
|
-
return new xhr2.XMLHttpRequest();
|
|
20116
|
-
}
|
|
20117
|
-
}
|
|
20118
|
-
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20119
|
-
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerXhr });
|
|
20120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerXhr, decorators: [{
|
|
20121
|
-
type: Injectable
|
|
20122
|
-
}] });
|
|
20123
|
-
class ZoneMacroTaskWrapper {
|
|
20124
|
-
wrap(request) {
|
|
20125
|
-
return new Observable((observer) => {
|
|
20126
|
-
let task = null;
|
|
20127
|
-
let scheduled = false;
|
|
20128
|
-
let sub = null;
|
|
20129
|
-
let savedResult = null;
|
|
20130
|
-
let savedError = null;
|
|
20131
|
-
const scheduleTask = (_task) => {
|
|
20132
|
-
task = _task;
|
|
20133
|
-
scheduled = true;
|
|
20134
|
-
const delegate = this.delegate(request);
|
|
20135
|
-
sub = delegate.subscribe(res => savedResult = res, err => {
|
|
20136
|
-
if (!scheduled) {
|
|
20137
|
-
throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.');
|
|
20138
|
-
}
|
|
20139
|
-
savedError = err;
|
|
20140
|
-
scheduled = false;
|
|
20141
|
-
task.invoke();
|
|
20142
|
-
}, () => {
|
|
20143
|
-
if (!scheduled) {
|
|
20144
|
-
throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.');
|
|
20145
|
-
}
|
|
20146
|
-
scheduled = false;
|
|
20147
|
-
task.invoke();
|
|
20148
|
-
});
|
|
20149
|
-
};
|
|
20150
|
-
const cancelTask = (_task) => {
|
|
20151
|
-
if (!scheduled) {
|
|
20152
|
-
return;
|
|
20153
|
-
}
|
|
20154
|
-
scheduled = false;
|
|
20155
|
-
if (sub) {
|
|
20156
|
-
sub.unsubscribe();
|
|
20157
|
-
sub = null;
|
|
20158
|
-
}
|
|
20159
|
-
};
|
|
20160
|
-
const onComplete = () => {
|
|
20161
|
-
if (savedError !== null) {
|
|
20162
|
-
observer.error(savedError);
|
|
20163
|
-
}
|
|
20164
|
-
else {
|
|
20165
|
-
observer.next(savedResult);
|
|
20166
|
-
observer.complete();
|
|
20167
|
-
}
|
|
20168
|
-
};
|
|
20169
|
-
// MockBackend for Http is synchronous, which means that if scheduleTask is by
|
|
20170
|
-
// scheduleMacroTask, the request will hit MockBackend and the response will be
|
|
20171
|
-
// sent, causing task.invoke() to be called.
|
|
20172
|
-
const _task = Zone.current.scheduleMacroTask('ZoneMacroTaskWrapper.subscribe', onComplete, {}, () => null, cancelTask);
|
|
20173
|
-
scheduleTask(_task);
|
|
20174
|
-
return () => {
|
|
20175
|
-
if (scheduled && task) {
|
|
20176
|
-
task.zone.cancelTask(task);
|
|
20177
|
-
scheduled = false;
|
|
20178
|
-
}
|
|
20179
|
-
if (sub) {
|
|
20180
|
-
sub.unsubscribe();
|
|
20181
|
-
sub = null;
|
|
20182
|
-
}
|
|
20183
|
-
};
|
|
20184
|
-
});
|
|
20185
|
-
}
|
|
20186
|
-
}
|
|
20187
|
-
class ZoneClientBackend extends ZoneMacroTaskWrapper {
|
|
20188
|
-
constructor(backend, platformLocation, config) {
|
|
20189
|
-
super();
|
|
20190
|
-
this.backend = backend;
|
|
20191
|
-
this.platformLocation = platformLocation;
|
|
20192
|
-
this.config = config;
|
|
20193
|
-
}
|
|
20194
|
-
handle(request) {
|
|
20195
|
-
const { href, protocol, hostname, port } = this.platformLocation;
|
|
20196
|
-
if (this.config.useAbsoluteUrl && !isAbsoluteUrl.test(request.url) &&
|
|
20197
|
-
isAbsoluteUrl.test(href)) {
|
|
20198
|
-
const baseHref = this.platformLocation.getBaseHrefFromDOM() || href;
|
|
20199
|
-
const urlPrefix = `${protocol}//${hostname}` + (port ? `:${port}` : '');
|
|
20200
|
-
const baseUrl = new URL(baseHref, urlPrefix);
|
|
20201
|
-
const url = new URL(request.url, baseUrl);
|
|
20202
|
-
return this.wrap(request.clone({ url: url.toString() }));
|
|
20203
|
-
}
|
|
20204
|
-
return this.wrap(request);
|
|
20205
|
-
}
|
|
20206
|
-
delegate(request) {
|
|
20207
|
-
return this.backend.handle(request);
|
|
20208
|
-
}
|
|
20209
|
-
}
|
|
20210
|
-
function zoneWrappedInterceptorHandler(platformLocation, config) {
|
|
20211
|
-
return new ZoneClientBackend(new ɵHttpInterceptorHandler(inject(HttpBackend), inject(EnvironmentInjector)), platformLocation, config);
|
|
20212
|
-
}
|
|
20213
|
-
const SERVER_HTTP_PROVIDERS = [
|
|
20214
|
-
{ provide: XhrFactory, useClass: ServerXhr }, {
|
|
20215
|
-
provide: HttpHandler,
|
|
20216
|
-
useFactory: zoneWrappedInterceptorHandler,
|
|
20217
|
-
deps: [PlatformLocation, INITIAL_CONFIG]
|
|
20218
|
-
}
|
|
20219
|
-
];
|
|
20220
|
-
|
|
20221
|
-
function parseUrl(urlStr) {
|
|
20222
|
-
const parsedUrl = url.parse(urlStr);
|
|
20223
|
-
return {
|
|
20224
|
-
hostname: parsedUrl.hostname || '',
|
|
20225
|
-
protocol: parsedUrl.protocol || '',
|
|
20226
|
-
port: parsedUrl.port || '',
|
|
20227
|
-
pathname: parsedUrl.pathname || '',
|
|
20228
|
-
search: parsedUrl.search || '',
|
|
20229
|
-
hash: parsedUrl.hash || '',
|
|
20230
|
-
};
|
|
20231
|
-
}
|
|
20232
|
-
/**
|
|
20233
|
-
* Server-side implementation of URL state. Implements `pathname`, `search`, and `hash`
|
|
20234
|
-
* but not the state stack.
|
|
20235
|
-
*/
|
|
20236
|
-
class ServerPlatformLocation {
|
|
20237
|
-
constructor(_doc, _config) {
|
|
20238
|
-
this._doc = _doc;
|
|
20239
|
-
this.href = '/';
|
|
20240
|
-
this.hostname = '/';
|
|
20241
|
-
this.protocol = '/';
|
|
20242
|
-
this.port = '/';
|
|
20243
|
-
this.pathname = '/';
|
|
20244
|
-
this.search = '';
|
|
20245
|
-
this.hash = '';
|
|
20246
|
-
this._hashUpdate = new Subject();
|
|
20247
|
-
const config = _config;
|
|
20248
|
-
if (!config) {
|
|
20249
|
-
return;
|
|
20250
|
-
}
|
|
20251
|
-
if (config.url) {
|
|
20252
|
-
const url = parseUrl(config.url);
|
|
20253
|
-
this.protocol = url.protocol;
|
|
20254
|
-
this.hostname = url.hostname;
|
|
20255
|
-
this.port = url.port;
|
|
20256
|
-
this.pathname = url.pathname;
|
|
20257
|
-
this.search = url.search;
|
|
20258
|
-
this.hash = url.hash;
|
|
20259
|
-
this.href = _doc.location.href;
|
|
20260
|
-
}
|
|
20261
|
-
if (config.useAbsoluteUrl) {
|
|
20262
|
-
if (!config.baseUrl) {
|
|
20263
|
-
throw new Error(`"PlatformConfig.baseUrl" must be set if "useAbsoluteUrl" is true`);
|
|
20264
|
-
}
|
|
20265
|
-
const url = parseUrl(config.baseUrl);
|
|
20266
|
-
this.protocol = url.protocol;
|
|
20267
|
-
this.hostname = url.hostname;
|
|
20268
|
-
this.port = url.port;
|
|
20269
|
-
}
|
|
20270
|
-
}
|
|
20271
|
-
getBaseHrefFromDOM() {
|
|
20272
|
-
return ɵgetDOM().getBaseHref(this._doc);
|
|
20273
|
-
}
|
|
20274
|
-
onPopState(fn) {
|
|
20275
|
-
// No-op: a state stack is not implemented, so
|
|
20276
|
-
// no events will ever come.
|
|
20277
|
-
return () => { };
|
|
20278
|
-
}
|
|
20279
|
-
onHashChange(fn) {
|
|
20280
|
-
const subscription = this._hashUpdate.subscribe(fn);
|
|
20281
|
-
return () => subscription.unsubscribe();
|
|
20282
|
-
}
|
|
20283
|
-
get url() {
|
|
20284
|
-
return `${this.pathname}${this.search}${this.hash}`;
|
|
20285
|
-
}
|
|
20286
|
-
setHash(value, oldUrl) {
|
|
20287
|
-
if (this.hash === value) {
|
|
20288
|
-
// Don't fire events if the hash has not changed.
|
|
20289
|
-
return;
|
|
20290
|
-
}
|
|
20291
|
-
this.hash = value;
|
|
20292
|
-
const newUrl = this.url;
|
|
20293
|
-
scheduleMicroTask(() => this._hashUpdate.next({ type: 'hashchange', state: null, oldUrl, newUrl }));
|
|
20294
|
-
}
|
|
20295
|
-
replaceState(state, title, newUrl) {
|
|
20296
|
-
const oldUrl = this.url;
|
|
20297
|
-
const parsedUrl = parseUrl(newUrl);
|
|
20298
|
-
this.pathname = parsedUrl.pathname;
|
|
20299
|
-
this.search = parsedUrl.search;
|
|
20300
|
-
this.setHash(parsedUrl.hash, oldUrl);
|
|
20301
|
-
}
|
|
20302
|
-
pushState(state, title, newUrl) {
|
|
20303
|
-
this.replaceState(state, title, newUrl);
|
|
20304
|
-
}
|
|
20305
|
-
forward() {
|
|
20306
|
-
throw new Error('Not implemented');
|
|
20307
|
-
}
|
|
20308
|
-
back() {
|
|
20309
|
-
throw new Error('Not implemented');
|
|
20310
|
-
}
|
|
20311
|
-
// History API isn't available on server, therefore return undefined
|
|
20312
|
-
getState() {
|
|
20313
|
-
return undefined;
|
|
20314
|
-
}
|
|
20315
|
-
}
|
|
20316
|
-
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20317
|
-
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerPlatformLocation });
|
|
20318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
20319
|
-
type: Injectable
|
|
20320
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20321
|
-
type: Inject,
|
|
20322
|
-
args: [DOCUMENT]
|
|
20323
|
-
}] }, { type: undefined, decorators: [{
|
|
20324
|
-
type: Optional
|
|
20325
|
-
}, {
|
|
20326
|
-
type: Inject,
|
|
20327
|
-
args: [INITIAL_CONFIG]
|
|
20328
|
-
}] }]; } });
|
|
20329
|
-
function scheduleMicroTask(fn) {
|
|
20330
|
-
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
|
20331
|
-
}
|
|
20332
|
-
|
|
20333
|
-
class ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ {
|
|
20334
|
-
constructor(doc) {
|
|
20335
|
-
this.doc = doc;
|
|
20336
|
-
}
|
|
20337
|
-
// Handle all events on the server.
|
|
20338
|
-
supports(eventName) {
|
|
20339
|
-
return true;
|
|
20340
|
-
}
|
|
20341
|
-
addEventListener(element, eventName, handler) {
|
|
20342
|
-
return ɵgetDOM().onAndCancel(element, eventName, handler);
|
|
20343
|
-
}
|
|
20344
|
-
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
|
20345
|
-
addGlobalEventListener(element, eventName, handler) {
|
|
20346
|
-
const target = ɵgetDOM().getGlobalEventTarget(this.doc, element);
|
|
20347
|
-
if (!target) {
|
|
20348
|
-
throw new Error(`Unsupported event target ${target} for event ${eventName}`);
|
|
20349
|
-
}
|
|
20350
|
-
return this.addEventListener(target, eventName, handler);
|
|
20351
|
-
}
|
|
20352
|
-
}
|
|
20353
|
-
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20354
|
-
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
|
|
20355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
|
|
20356
|
-
type: Injectable
|
|
20357
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20358
|
-
type: Inject,
|
|
20359
|
-
args: [DOCUMENT]
|
|
20360
|
-
}] }]; } });
|
|
20361
|
-
|
|
20362
|
-
const EMPTY_ARRAY = [];
|
|
20363
|
-
const DEFAULT_SCHEMA = new DomElementSchemaRegistry();
|
|
20364
|
-
class ServerRendererFactory2 {
|
|
20365
|
-
constructor(eventManager, ngZone, document, sharedStylesHost, appId) {
|
|
20366
|
-
this.eventManager = eventManager;
|
|
20367
|
-
this.ngZone = ngZone;
|
|
20368
|
-
this.document = document;
|
|
20369
|
-
this.sharedStylesHost = sharedStylesHost;
|
|
20370
|
-
this.appId = appId;
|
|
20371
|
-
this.rendererByCompId = new Map();
|
|
20372
|
-
this.schema = DEFAULT_SCHEMA;
|
|
20373
|
-
this.defaultRenderer = new DefaultServerRenderer2(eventManager, document, ngZone, this.schema);
|
|
20374
|
-
}
|
|
20375
|
-
createRenderer(element, type) {
|
|
20376
|
-
if (!element || !type) {
|
|
20377
|
-
return this.defaultRenderer;
|
|
20378
|
-
}
|
|
20379
|
-
switch (type.encapsulation) {
|
|
20380
|
-
case ViewEncapsulation.Emulated: {
|
|
20381
|
-
let renderer = this.rendererByCompId.get(type.id);
|
|
20382
|
-
if (!renderer) {
|
|
20383
|
-
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type, this.appId);
|
|
20384
|
-
this.rendererByCompId.set(type.id, renderer);
|
|
20385
|
-
}
|
|
20386
|
-
renderer.applyToHost(element);
|
|
20387
|
-
return renderer;
|
|
20388
|
-
}
|
|
20389
|
-
default: {
|
|
20390
|
-
if (!this.rendererByCompId.has(type.id)) {
|
|
20391
|
-
const styles = ɵshimStyles(type.id, type.styles);
|
|
20392
|
-
this.sharedStylesHost.addStyles(styles);
|
|
20393
|
-
this.rendererByCompId.set(type.id, this.defaultRenderer);
|
|
20394
|
-
}
|
|
20395
|
-
return this.defaultRenderer;
|
|
20396
|
-
}
|
|
20397
|
-
}
|
|
20398
|
-
}
|
|
20399
|
-
begin() { }
|
|
20400
|
-
end() { }
|
|
20401
|
-
}
|
|
20402
|
-
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerRendererFactory2, deps: [{ token: i1.EventManager }, { token: i0.NgZone }, { token: DOCUMENT }, { token: i1.ɵSharedStylesHost }, { token: APP_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20403
|
-
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerRendererFactory2 });
|
|
20404
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerRendererFactory2, decorators: [{
|
|
20405
|
-
type: Injectable
|
|
20406
|
-
}], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: Document, decorators: [{
|
|
20407
|
-
type: Inject,
|
|
20408
|
-
args: [DOCUMENT]
|
|
20409
|
-
}] }, { type: i1.ɵSharedStylesHost }, { type: undefined, decorators: [{
|
|
20410
|
-
type: Inject,
|
|
20411
|
-
args: [APP_ID]
|
|
20412
|
-
}] }]; } });
|
|
20413
|
-
class DefaultServerRenderer2 {
|
|
20414
|
-
constructor(eventManager, document, ngZone, schema) {
|
|
20415
|
-
this.eventManager = eventManager;
|
|
20416
|
-
this.document = document;
|
|
20417
|
-
this.ngZone = ngZone;
|
|
20418
|
-
this.schema = schema;
|
|
20419
|
-
this.data = Object.create(null);
|
|
20420
|
-
this.destroyNode = null;
|
|
20421
|
-
}
|
|
20422
|
-
destroy() { }
|
|
20423
|
-
createElement(name, namespace) {
|
|
20424
|
-
if (namespace) {
|
|
20425
|
-
const doc = this.document || ɵgetDOM().getDefaultDocument();
|
|
20426
|
-
return doc.createElementNS(ɵNAMESPACE_URIS[namespace], name);
|
|
20427
|
-
}
|
|
20428
|
-
return ɵgetDOM().createElement(name, this.document);
|
|
20429
|
-
}
|
|
20430
|
-
createComment(value) {
|
|
20431
|
-
return ɵgetDOM().getDefaultDocument().createComment(value);
|
|
20432
|
-
}
|
|
20433
|
-
createText(value) {
|
|
20434
|
-
const doc = ɵgetDOM().getDefaultDocument();
|
|
20435
|
-
return doc.createTextNode(value);
|
|
20436
|
-
}
|
|
20437
|
-
appendChild(parent, newChild) {
|
|
20438
|
-
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
20439
|
-
targetParent.appendChild(newChild);
|
|
20440
|
-
}
|
|
20441
|
-
insertBefore(parent, newChild, refChild) {
|
|
20442
|
-
if (parent) {
|
|
20443
|
-
const targetParent = isTemplateNode(parent) ? parent.content : parent;
|
|
20444
|
-
targetParent.insertBefore(newChild, refChild);
|
|
20445
|
-
}
|
|
20446
|
-
}
|
|
20447
|
-
removeChild(parent, oldChild) {
|
|
20448
|
-
if (parent) {
|
|
20449
|
-
parent.removeChild(oldChild);
|
|
20450
|
-
}
|
|
20451
|
-
}
|
|
20452
|
-
selectRootElement(selectorOrNode, preserveContent) {
|
|
20453
|
-
const el = typeof selectorOrNode === 'string' ? this.document.querySelector(selectorOrNode) :
|
|
20454
|
-
selectorOrNode;
|
|
20455
|
-
if (!el) {
|
|
20456
|
-
throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
|
|
20457
|
-
}
|
|
20458
|
-
if (!preserveContent) {
|
|
20459
|
-
while (el.firstChild) {
|
|
20460
|
-
el.removeChild(el.firstChild);
|
|
20461
|
-
}
|
|
20462
|
-
}
|
|
20463
|
-
return el;
|
|
20464
|
-
}
|
|
20465
|
-
parentNode(node) {
|
|
20466
|
-
return node.parentNode;
|
|
20467
|
-
}
|
|
20468
|
-
nextSibling(node) {
|
|
20469
|
-
return node.nextSibling;
|
|
20470
|
-
}
|
|
20471
|
-
setAttribute(el, name, value, namespace) {
|
|
20472
|
-
if (namespace) {
|
|
20473
|
-
el.setAttributeNS(ɵNAMESPACE_URIS[namespace], namespace + ':' + name, value);
|
|
20474
|
-
}
|
|
20475
|
-
else {
|
|
20476
|
-
el.setAttribute(name, value);
|
|
20477
|
-
}
|
|
20478
|
-
}
|
|
20479
|
-
removeAttribute(el, name, namespace) {
|
|
20480
|
-
if (namespace) {
|
|
20481
|
-
el.removeAttributeNS(ɵNAMESPACE_URIS[namespace], name);
|
|
20482
|
-
}
|
|
20483
|
-
else {
|
|
20484
|
-
el.removeAttribute(name);
|
|
20485
|
-
}
|
|
20486
|
-
}
|
|
20487
|
-
addClass(el, name) {
|
|
20488
|
-
el.classList.add(name);
|
|
20489
|
-
}
|
|
20490
|
-
removeClass(el, name) {
|
|
20491
|
-
el.classList.remove(name);
|
|
20492
|
-
}
|
|
20493
|
-
setStyle(el, style, value, flags) {
|
|
20494
|
-
style = style.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
20495
|
-
value = value == null ? '' : `${value}`.trim();
|
|
20496
|
-
const styleMap = _readStyleAttribute(el);
|
|
20497
|
-
if (flags & RendererStyleFlags2.Important) {
|
|
20498
|
-
value += ' !important';
|
|
20499
|
-
}
|
|
20500
|
-
styleMap[style] = value;
|
|
20501
|
-
_writeStyleAttribute(el, styleMap);
|
|
20502
|
-
}
|
|
20503
|
-
removeStyle(el, style, flags) {
|
|
20504
|
-
// IE requires '' instead of null
|
|
20505
|
-
// see https://github.com/angular/angular/issues/7916
|
|
20506
|
-
this.setStyle(el, style, '', flags);
|
|
20507
|
-
}
|
|
20508
|
-
// The value was validated already as a property binding, against the property name.
|
|
20509
|
-
// To know this value is safe to use as an attribute, the security context of the
|
|
20510
|
-
// attribute with the given name is checked against that security context of the
|
|
20511
|
-
// property.
|
|
20512
|
-
_isSafeToReflectProperty(tagName, propertyName) {
|
|
20513
|
-
return this.schema.securityContext(tagName, propertyName, true) ===
|
|
20514
|
-
this.schema.securityContext(tagName, propertyName, false);
|
|
20515
|
-
}
|
|
20516
|
-
setProperty(el, name, value) {
|
|
20517
|
-
checkNoSyntheticProp(name, 'property');
|
|
20518
|
-
if (name === 'innerText') {
|
|
20519
|
-
// Domino does not support innerText. Just map it to textContent.
|
|
20520
|
-
el.textContent = value;
|
|
20521
|
-
}
|
|
20522
|
-
el[name] = value;
|
|
20523
|
-
// Mirror property values for known HTML element properties in the attributes.
|
|
20524
|
-
// Skip `innerhtml` which is conservatively marked as an attribute for security
|
|
20525
|
-
// purposes but is not actually an attribute.
|
|
20526
|
-
const tagName = el.tagName.toLowerCase();
|
|
20527
|
-
if (value != null && (typeof value === 'number' || typeof value == 'string') &&
|
|
20528
|
-
name.toLowerCase() !== 'innerhtml' && this.schema.hasElement(tagName, EMPTY_ARRAY) &&
|
|
20529
|
-
this.schema.hasProperty(tagName, name, EMPTY_ARRAY) &&
|
|
20530
|
-
this._isSafeToReflectProperty(tagName, name)) {
|
|
20531
|
-
this.setAttribute(el, name, value.toString());
|
|
20532
|
-
}
|
|
20533
|
-
}
|
|
20534
|
-
setValue(node, value) {
|
|
20535
|
-
node.textContent = value;
|
|
20536
|
-
}
|
|
20537
|
-
listen(target, eventName, callback) {
|
|
20538
|
-
checkNoSyntheticProp(eventName, 'listener');
|
|
20539
|
-
if (typeof target === 'string') {
|
|
20540
|
-
return this.eventManager.addGlobalEventListener(target, eventName, this.decoratePreventDefault(callback));
|
|
20541
|
-
}
|
|
20542
|
-
return this.eventManager.addEventListener(target, eventName, this.decoratePreventDefault(callback));
|
|
20543
|
-
}
|
|
20544
|
-
decoratePreventDefault(eventHandler) {
|
|
20545
|
-
return (event) => {
|
|
20546
|
-
// Ivy uses `Function` as a special token that allows us to unwrap the function
|
|
20547
|
-
// so that it can be invoked programmatically by `DebugNode.triggerEventHandler`.
|
|
20548
|
-
if (event === Function) {
|
|
20549
|
-
return eventHandler;
|
|
20550
|
-
}
|
|
20551
|
-
// Run the event handler inside the ngZone because event handlers are not patched
|
|
20552
|
-
// by Zone on the server. This is required only for tests.
|
|
20553
|
-
const allowDefaultBehavior = this.ngZone.runGuarded(() => eventHandler(event));
|
|
20554
|
-
if (allowDefaultBehavior === false) {
|
|
20555
|
-
event.preventDefault();
|
|
20556
|
-
event.returnValue = false;
|
|
20557
|
-
}
|
|
20558
|
-
return undefined;
|
|
20559
|
-
};
|
|
20560
|
-
}
|
|
20561
|
-
}
|
|
20562
|
-
const AT_CHARCODE = '@'.charCodeAt(0);
|
|
20563
|
-
function checkNoSyntheticProp(name, nameKind) {
|
|
20564
|
-
if (name.charCodeAt(0) === AT_CHARCODE) {
|
|
20565
|
-
throw new Error(`Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
|
20566
|
-
- Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application.
|
|
20567
|
-
- There is corresponding configuration for the animation named \`${name}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.io/api/core/Component#animations).`);
|
|
20568
|
-
}
|
|
20569
|
-
}
|
|
20570
|
-
function isTemplateNode(node) {
|
|
20571
|
-
return node.tagName === 'TEMPLATE' && node.content !== undefined;
|
|
20572
|
-
}
|
|
20573
|
-
class EmulatedEncapsulationServerRenderer2 extends DefaultServerRenderer2 {
|
|
20574
|
-
constructor(eventManager, document, ngZone, sharedStylesHost, schema, component, appId) {
|
|
20575
|
-
super(eventManager, document, ngZone, schema);
|
|
20576
|
-
this.component = component;
|
|
20577
|
-
const componentShortId = appId + '-' + this.component.id;
|
|
20578
|
-
const styles = ɵshimStyles(componentShortId, this.component.styles);
|
|
20579
|
-
sharedStylesHost.addStyles(styles);
|
|
20580
|
-
this.contentAttr = ɵshimContentAttribute(componentShortId);
|
|
20581
|
-
this.hostAttr = ɵshimHostAttribute(componentShortId);
|
|
20582
|
-
}
|
|
20583
|
-
applyToHost(element) {
|
|
20584
|
-
super.setAttribute(element, this.hostAttr, '');
|
|
20585
|
-
}
|
|
20586
|
-
createElement(parent, name) {
|
|
20587
|
-
const el = super.createElement(parent, name);
|
|
20588
|
-
super.setAttribute(el, this.contentAttr, '');
|
|
20589
|
-
return el;
|
|
20590
|
-
}
|
|
20591
|
-
}
|
|
20592
|
-
function _readStyleAttribute(element) {
|
|
20593
|
-
const styleMap = {};
|
|
20594
|
-
const styleAttribute = element.getAttribute('style');
|
|
20595
|
-
if (styleAttribute) {
|
|
20596
|
-
const styleList = styleAttribute.split(/;+/g);
|
|
20597
|
-
for (let i = 0; i < styleList.length; i++) {
|
|
20598
|
-
const style = styleList[i].trim();
|
|
20599
|
-
if (style.length > 0) {
|
|
20600
|
-
const colonIndex = style.indexOf(':');
|
|
20601
|
-
if (colonIndex === -1) {
|
|
20602
|
-
throw new Error(`Invalid CSS style: ${style}`);
|
|
20603
|
-
}
|
|
20604
|
-
const name = style.slice(0, colonIndex).trim();
|
|
20605
|
-
styleMap[name] = style.slice(colonIndex + 1).trim();
|
|
20606
|
-
}
|
|
20607
|
-
}
|
|
20608
|
-
}
|
|
20609
|
-
return styleMap;
|
|
20610
|
-
}
|
|
20611
|
-
function _writeStyleAttribute(element, styleMap) {
|
|
20612
|
-
// We have to construct the `style` attribute ourselves, instead of going through
|
|
20613
|
-
// `element.style.setProperty` like the other renderers, because `setProperty` won't
|
|
20614
|
-
// write newer CSS properties that Domino doesn't know about like `clip-path`.
|
|
20615
|
-
let styleAttrValue = '';
|
|
20616
|
-
for (const key in styleMap) {
|
|
20617
|
-
const newValue = styleMap[key];
|
|
20618
|
-
if (newValue != null && newValue !== '') {
|
|
20619
|
-
styleAttrValue += key + ':' + newValue + ';';
|
|
20620
|
-
}
|
|
20621
|
-
}
|
|
20622
|
-
if (styleAttrValue) {
|
|
20623
|
-
element.setAttribute('style', styleAttrValue);
|
|
20624
|
-
}
|
|
20625
|
-
else {
|
|
20626
|
-
element.removeAttribute('style');
|
|
20627
|
-
}
|
|
20628
|
-
}
|
|
20629
|
-
|
|
20630
|
-
const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [{
|
|
20631
|
-
provide: BEFORE_APP_SERIALIZED,
|
|
20632
|
-
useFactory: serializeTransferStateFactory,
|
|
20633
|
-
deps: [DOCUMENT, APP_ID, TransferState],
|
|
20634
|
-
multi: true,
|
|
20635
|
-
}];
|
|
20636
|
-
function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
20637
|
-
return () => {
|
|
20638
|
-
// The `.toJSON` here causes the `onSerialize` callbacks to be called.
|
|
20639
|
-
// These callbacks can be used to provide the value for a given key.
|
|
20640
|
-
const content = transferStore.toJson();
|
|
20641
|
-
if (transferStore.isEmpty) {
|
|
20642
|
-
// The state is empty, nothing to transfer,
|
|
20643
|
-
// avoid creating an extra `<script>` tag in this case.
|
|
20644
|
-
return;
|
|
20645
|
-
}
|
|
20646
|
-
const script = doc.createElement('script');
|
|
20647
|
-
script.id = appId + '-state';
|
|
20648
|
-
script.setAttribute('type', 'application/json');
|
|
20649
|
-
script.textContent = ɵescapeTransferStateContent(content);
|
|
20650
|
-
// It is intentional that we add the script at the very bottom. Angular CLI script tags for
|
|
20651
|
-
// bundles are always `type="module"`. These are deferred by default and cause the transfer
|
|
20652
|
-
// transfer data to be queried only after the browser has finished parsing the DOM.
|
|
20653
|
-
doc.body.appendChild(script);
|
|
20654
|
-
};
|
|
20655
|
-
}
|
|
20656
|
-
/**
|
|
20657
|
-
* NgModule to install on the server side while using the `TransferState` to transfer state from
|
|
20658
|
-
* server to client.
|
|
20659
|
-
*
|
|
20660
|
-
* Note: this module is not needed if the `renderApplication` function is used.
|
|
20661
|
-
* The `renderApplication` makes all providers from this module available in the application.
|
|
20662
|
-
*
|
|
20663
|
-
* @publicApi
|
|
20664
|
-
* @deprecated no longer needed, you can inject the `TransferState` in an app without providing
|
|
20665
|
-
* this module.
|
|
20666
|
-
*/
|
|
20667
|
-
class ServerTransferStateModule {
|
|
20668
|
-
}
|
|
20669
|
-
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20670
|
-
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule });
|
|
20671
|
-
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule });
|
|
20672
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule, decorators: [{
|
|
20673
|
-
type: NgModule,
|
|
20674
|
-
args: [{}]
|
|
20675
|
-
}] });
|
|
20676
|
-
|
|
20677
|
-
const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
20678
|
-
{ provide: DOCUMENT, useFactory: _document, deps: [Injector] },
|
|
20679
|
-
{ provide: PLATFORM_ID, useValue: ɵPLATFORM_SERVER_ID },
|
|
20680
|
-
{ provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true }, {
|
|
20681
|
-
provide: PlatformLocation,
|
|
20682
|
-
useClass: ServerPlatformLocation,
|
|
20683
|
-
deps: [DOCUMENT, [Optional, INITIAL_CONFIG]]
|
|
20684
|
-
},
|
|
20685
|
-
{ provide: PlatformState, deps: [DOCUMENT] },
|
|
20686
|
-
// Add special provider that allows multiple instances of platformServer* to be created.
|
|
20687
|
-
{ provide: ɵALLOW_MULTIPLE_PLATFORMS, useValue: true }
|
|
20688
|
-
];
|
|
20689
|
-
function initDominoAdapter() {
|
|
20690
|
-
return () => {
|
|
20691
|
-
DominoAdapter.makeCurrent();
|
|
20692
|
-
};
|
|
20693
|
-
}
|
|
20694
|
-
function instantiateServerRendererFactory(renderer, engine, zone) {
|
|
20695
|
-
return new ɵAnimationRendererFactory(renderer, engine, zone);
|
|
20696
|
-
}
|
|
20697
|
-
const SERVER_RENDER_PROVIDERS = [
|
|
20698
|
-
ServerRendererFactory2,
|
|
20699
|
-
{
|
|
20700
|
-
provide: RendererFactory2,
|
|
20701
|
-
useFactory: instantiateServerRendererFactory,
|
|
20702
|
-
deps: [ServerRendererFactory2, ɵAnimationEngine, NgZone]
|
|
20703
|
-
},
|
|
20704
|
-
{ provide: EVENT_MANAGER_PLUGINS, multi: true, useClass: ServerEventManagerPlugin },
|
|
20705
|
-
];
|
|
20706
|
-
const PLATFORM_SERVER_PROVIDERS = [
|
|
20707
|
-
TRANSFER_STATE_SERIALIZATION_PROVIDERS,
|
|
20708
|
-
SERVER_RENDER_PROVIDERS,
|
|
20709
|
-
SERVER_HTTP_PROVIDERS,
|
|
20710
|
-
{ provide: Testability, useValue: null },
|
|
20711
|
-
{ provide: ɵTESTABILITY, useValue: null },
|
|
20712
|
-
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20713
|
-
];
|
|
20714
|
-
/**
|
|
20715
|
-
* The ng module for the server.
|
|
20716
|
-
*
|
|
20717
|
-
* @publicApi
|
|
20718
|
-
*/
|
|
20719
|
-
class ServerModule {
|
|
20720
|
-
}
|
|
20721
|
-
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20722
|
-
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
|
|
20723
|
-
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
20724
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, decorators: [{
|
|
20725
|
-
type: NgModule,
|
|
20726
|
-
args: [{
|
|
20727
|
-
exports: [BrowserModule],
|
|
20728
|
-
imports: [HttpClientModule, NoopAnimationsModule],
|
|
20729
|
-
providers: PLATFORM_SERVER_PROVIDERS,
|
|
20730
|
-
}]
|
|
20731
|
-
}] });
|
|
20732
|
-
function _document(injector) {
|
|
20733
|
-
const config = injector.get(INITIAL_CONFIG, null);
|
|
20734
|
-
let document;
|
|
20735
|
-
if (config && config.document) {
|
|
20736
|
-
document = typeof config.document === 'string' ? parseDocument(config.document, config.url) :
|
|
20737
|
-
config.document;
|
|
20738
|
-
}
|
|
20739
|
-
else {
|
|
20740
|
-
document = ɵgetDOM().createHtmlDocument();
|
|
20741
|
-
}
|
|
20742
|
-
// Tell ivy about the global document
|
|
20743
|
-
ɵsetDocument(document);
|
|
20744
|
-
return document;
|
|
20745
|
-
}
|
|
20746
|
-
/**
|
|
20747
|
-
* @publicApi
|
|
20748
|
-
*/
|
|
20749
|
-
const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
20750
|
-
/**
|
|
20751
|
-
* The server platform that supports the runtime compiler.
|
|
20752
|
-
*
|
|
20753
|
-
* @publicApi
|
|
20754
|
-
*/
|
|
20755
|
-
const platformDynamicServer = createPlatformFactory(ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
20756
|
-
|
|
20757
|
-
/**
|
|
20758
|
-
* Sets up providers necessary to enable server rendering functionality for the application.
|
|
20759
|
-
*
|
|
20760
|
-
* @usageNotes
|
|
20761
|
-
*
|
|
20762
|
-
* Basic example of how you can add server support to your application:
|
|
20763
|
-
* ```ts
|
|
20764
|
-
* bootstrapApplication(AppComponent, {
|
|
20765
|
-
* providers: [provideServerSupport()]
|
|
20766
|
-
* });
|
|
20767
|
-
* ```
|
|
20768
|
-
*
|
|
20769
|
-
* @publicApi
|
|
20770
|
-
* @returns A set of providers to setup the server.
|
|
20771
|
-
*/
|
|
20772
|
-
function provideServerSupport() {
|
|
20773
|
-
return makeEnvironmentProviders([
|
|
20774
|
-
provideHttpClient(withInterceptorsFromDi()),
|
|
20775
|
-
provideNoopAnimations(),
|
|
20776
|
-
...PLATFORM_SERVER_PROVIDERS,
|
|
20777
|
-
]);
|
|
20778
|
-
}
|
|
20779
|
-
|
|
20780
|
-
function _getPlatform(platformFactory, options) {
|
|
20781
|
-
const extraProviders = options.platformProviders ?? [];
|
|
20782
|
-
return platformFactory([
|
|
20783
|
-
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
20784
|
-
extraProviders
|
|
20785
|
-
]);
|
|
20786
|
-
}
|
|
20787
|
-
/**
|
|
20788
|
-
* Adds the `ng-server-context` attribute to host elements of all bootstrapped components
|
|
20789
|
-
* within a given application.
|
|
20790
|
-
*/
|
|
20791
|
-
function appendServerContextInfo(serverContext, applicationRef) {
|
|
20792
|
-
applicationRef.components.forEach(componentRef => {
|
|
20793
|
-
const renderer = componentRef.injector.get(Renderer2);
|
|
20794
|
-
const element = componentRef.location.nativeElement;
|
|
20795
|
-
if (element) {
|
|
20796
|
-
renderer.setAttribute(element, 'ng-server-context', serverContext);
|
|
20797
|
-
}
|
|
20798
|
-
});
|
|
20799
|
-
}
|
|
20800
|
-
function _render(platform, bootstrapPromise) {
|
|
20801
|
-
return bootstrapPromise.then((moduleOrApplicationRef) => {
|
|
20802
|
-
const environmentInjector = moduleOrApplicationRef.injector;
|
|
20803
|
-
const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
|
|
20804
|
-
moduleOrApplicationRef :
|
|
20805
|
-
environmentInjector.get(ApplicationRef);
|
|
20806
|
-
const serverContext = sanitizeServerContext(environmentInjector.get(SERVER_CONTEXT, DEFAULT_SERVER_CONTEXT));
|
|
20807
|
-
return applicationRef.isStable.pipe((first((isStable) => isStable)))
|
|
20808
|
-
.toPromise()
|
|
20809
|
-
.then(() => {
|
|
20810
|
-
appendServerContextInfo(serverContext, applicationRef);
|
|
20811
|
-
const platformState = platform.injector.get(PlatformState);
|
|
20812
|
-
const asyncPromises = [];
|
|
20813
|
-
if (applicationRef.injector.get(ɵIS_HYDRATION_FEATURE_ENABLED, false)) {
|
|
20814
|
-
ɵannotateForHydration(applicationRef, platformState.getDocument());
|
|
20815
|
-
}
|
|
20816
|
-
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
20817
|
-
const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
|
|
20818
|
-
if (callbacks) {
|
|
20819
|
-
for (const callback of callbacks) {
|
|
20820
|
-
try {
|
|
20821
|
-
const callbackResult = callback();
|
|
20822
|
-
if (ɵisPromise(callbackResult)) {
|
|
20823
|
-
// TODO: in TS3.7, callbackResult is void.
|
|
20824
|
-
asyncPromises.push(callbackResult);
|
|
20825
|
-
}
|
|
20826
|
-
}
|
|
20827
|
-
catch (e) {
|
|
20828
|
-
// Ignore exceptions.
|
|
20829
|
-
console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);
|
|
20830
|
-
}
|
|
20831
|
-
}
|
|
20832
|
-
}
|
|
20833
|
-
const complete = () => {
|
|
20834
|
-
const output = platformState.renderToString();
|
|
20835
|
-
platform.destroy();
|
|
20836
|
-
return output;
|
|
20837
|
-
};
|
|
20838
|
-
if (asyncPromises.length === 0) {
|
|
20839
|
-
return complete();
|
|
20840
|
-
}
|
|
20841
|
-
return Promise
|
|
20842
|
-
.all(asyncPromises.map(asyncPromise => {
|
|
20843
|
-
return asyncPromise.catch(e => {
|
|
20844
|
-
console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);
|
|
20845
|
-
});
|
|
20846
|
-
}))
|
|
20847
|
-
.then(complete);
|
|
20848
|
-
});
|
|
20849
|
-
});
|
|
20850
|
-
}
|
|
20851
|
-
/**
|
|
20852
|
-
* Specifies the value that should be used if no server context value has been provided.
|
|
20853
|
-
*/
|
|
20854
|
-
const DEFAULT_SERVER_CONTEXT = 'other';
|
|
20855
|
-
/**
|
|
20856
|
-
* An internal token that allows providing extra information about the server context
|
|
20857
|
-
* (e.g. whether SSR or SSG was used). The value is a string and characters other
|
|
20858
|
-
* than [a-zA-Z0-9\-] are removed. See the default value in `DEFAULT_SERVER_CONTEXT` const.
|
|
20859
|
-
*/
|
|
20860
|
-
const SERVER_CONTEXT = new InjectionToken('SERVER_CONTEXT');
|
|
20861
|
-
/**
|
|
20862
|
-
* Sanitizes provided server context:
|
|
20863
|
-
* - removes all characters other than a-z, A-Z, 0-9 and `-`
|
|
20864
|
-
* - returns `other` if nothing is provided or the string is empty after sanitization
|
|
20865
|
-
*/
|
|
20866
|
-
function sanitizeServerContext(serverContext) {
|
|
20867
|
-
const context = serverContext.replace(/[^a-zA-Z0-9\-]/g, '');
|
|
20868
|
-
return context.length > 0 ? context : DEFAULT_SERVER_CONTEXT;
|
|
20869
|
-
}
|
|
20870
|
-
/**
|
|
20871
|
-
* Bootstraps an application using provided NgModule and serializes the page content to string.
|
|
20872
|
-
*
|
|
20873
|
-
* @param moduleType A reference to an NgModule that should be used for bootstrap.
|
|
20874
|
-
* @param options Additional configuration for the render operation:
|
|
20875
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
20876
|
-
* as a reference to the `document` instance.
|
|
20877
|
-
* - `url` - the URL for the current render request.
|
|
20878
|
-
* - `extraProviders` - set of platform level providers for the current render request.
|
|
20879
|
-
*
|
|
20880
|
-
* @publicApi
|
|
20881
|
-
*/
|
|
20882
|
-
function renderModule(moduleType, options) {
|
|
20883
|
-
const { document, url, extraProviders: platformProviders } = options;
|
|
20884
|
-
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
20885
|
-
return _render(platform, platform.bootstrapModule(moduleType));
|
|
20886
|
-
}
|
|
16433
|
+
export default require_lib();
|
|
20887
16434
|
/**
|
|
20888
|
-
*
|
|
20889
|
-
|
|
20890
|
-
* ```typescript
|
|
20891
|
-
* const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
|
|
20892
|
-
* const output: string = await renderApplication(bootstrap);
|
|
20893
|
-
* ```
|
|
20894
|
-
*
|
|
20895
|
-
* @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
|
|
20896
|
-
* instance once resolved.
|
|
20897
|
-
* @param options Additional configuration for the render operation:
|
|
20898
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
20899
|
-
* as a reference to the `document` instance.
|
|
20900
|
-
* - `url` - the URL for the current render request.
|
|
20901
|
-
* - `platformProviders` - the platform level providers for the current render request.
|
|
16435
|
+
* @license
|
|
16436
|
+
* Copyright Google LLC All Rights Reserved.
|
|
20902
16437
|
*
|
|
20903
|
-
*
|
|
20904
|
-
*
|
|
20905
|
-
* @publicApi
|
|
20906
|
-
* @developerPreview
|
|
20907
|
-
*/
|
|
20908
|
-
function renderApplication(bootstrap, options) {
|
|
20909
|
-
const platform = _getPlatform(platformDynamicServer, options);
|
|
20910
|
-
return _render(platform, bootstrap());
|
|
20911
|
-
}
|
|
20912
|
-
|
|
20913
|
-
/**
|
|
20914
|
-
* @module
|
|
20915
|
-
* @description
|
|
20916
|
-
* Entry point for all public APIs of the platform-server package.
|
|
16438
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
16439
|
+
* found in the LICENSE file at https://angular.io/license
|
|
20917
16440
|
*/
|
|
20918
|
-
|
|
20919
|
-
* @publicApi
|
|
20920
|
-
*/
|
|
20921
|
-
const VERSION = new Version('16.0.0-next.4');
|
|
20922
|
-
|
|
20923
|
-
/// <reference types="node" />
|
|
20924
|
-
// This file only reexports content of the `src` folder. Keep it that way.
|
|
20925
|
-
|
|
20926
|
-
// This file is not used to build this module. It is only used during editing
|
|
20927
|
-
|
|
20928
|
-
/**
|
|
20929
|
-
* Generated bundle index. Do not edit.
|
|
20930
|
-
*/
|
|
20931
|
-
|
|
20932
|
-
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, provideServerSupport, renderApplication, renderModule, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, ServerRendererFactory2 as ɵServerRendererFactory2, setDomTypes as ɵsetDomTypes };
|
|
20933
|
-
//# sourceMappingURL=platform-server.mjs.map
|
|
16441
|
+
//# sourceMappingURL=bundled-domino.mjs.map
|