Fix async lifecycle ordering, add _spa_init boot phase, update to jqhtml _load_only/_load_render_only flags

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-03-06 22:33:38 +00:00
parent 11c95a2886
commit d1ac456279
2718 changed files with 70593 additions and 6320 deletions

View File

@@ -10,23 +10,31 @@ function appendOrSet(a, b) {
return b || null;
}
function sliceProps(obj, props) {
function extractProps(obj, props) {
const result = Object.create(null);
for (const [key, value] of Object.entries(obj)) {
if (value) {
result[key] = {};
for (const prop of Object.keys(value)) {
if (props.includes(prop)) {
result[key][prop] = value[prop];
}
}
for (const prop of Object.keys(obj)) {
if (props.includes(prop)) {
result[prop] = obj[prop];
}
}
return result;
}
function mergeDicts(base, ext, fields) {
const result = { ...base };
for (const [key, props] of Object.entries(ext)) {
result[key] = {
...result[key],
...fields ? extractProps(props, fields) : props
};
}
return result;
}
function mix(dest, src) {
const result = { ...dest };
@@ -89,14 +97,6 @@ function mix(dest, src) {
}
break;
case 'scope':
case 'features':
result[prop] = { ...dest[prop] };
for (const [name, props] of Object.entries(value)) {
result[prop][name] = { ...result[prop][name], ...props };
}
break;
case 'parseContext':
result[prop] = {
...dest[prop],
@@ -104,19 +104,18 @@ function mix(dest, src) {
};
break;
case 'scope':
case 'features':
result[prop] = mergeDicts(dest[prop], value);
break;
case 'atrule':
case 'pseudo':
result[prop] = {
...dest[prop],
...sliceProps(value, ['parse'])
};
result[prop] = mergeDicts(dest[prop], value, ['parse']);
break;
case 'node':
result[prop] = {
...dest[prop],
...sliceProps(value, ['name', 'structure', 'parse', 'generate', 'walkContext'])
};
result[prop] = mergeDicts(dest[prop], value, ['name', 'structure', 'parse', 'generate', 'walkContext']);
break;
}
}

View File

@@ -1,34 +0,0 @@
'use strict';
const types = require('../../tokenizer/types.cjs');
const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
const name = 'LayerName';
const structure = {
name: String
};
function parse() {
let name = this.consume(types.Ident);
while (this.isDelim(FULLSTOP)) {
this.eat(types.Delim);
name += '.' + this.consume(types.Ident);
}
return {
type: 'LayerName',
loc: this.getLocation(this.tokenStart, this.tokenEnd),
name
};
}
function generate(node) {
this.tokenize(node.name);
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;

View File

@@ -1,42 +0,0 @@
'use strict';
const types = require('../../tokenizer/types.cjs');
const name = 'LayerNameList';
const structure = {
children: [[
'MediaQuery'
]]
};
function parse() {
const children = this.createList();
this.skipSC();
while (!this.eof) {
children.push(this.LayerName());
if (this.tokenType !== types.Comma) {
break;
}
this.next();
this.skipSC();
}
return {
type: 'LayerNameList',
loc: this.getLocationFromList(children),
children
};
}
function generate(node) {
this.children(node, () => this.token(types.Comma, ','));
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;

View File

@@ -1,70 +0,0 @@
'use strict';
const types = require('../../tokenizer/types.cjs');
const MediaFeatureToken = new Set([types.Colon, types.RightParenthesis, types.EOF]);
const name = 'MediaCondition';
const structure = {
children: [[
'Identifier',
'MediaFeature',
'MediaFeatureRange'
]]
};
function parse() {
const children = this.createList();
scan: while (!this.eof) {
switch (this.tokenType) {
case types.Comment:
case types.WhiteSpace:
this.next();
continue;
case types.Ident:
children.push(this.Identifier());
break;
case types.LeftParenthesis:
if (this.lookupTypeNonSC(1) === types.Ident && MediaFeatureToken.has(this.lookupTypeNonSC(2))) {
children.push(this.MediaFeature());
} else if (this.lookupTypeNonSC(1) === types.LeftParenthesis || this.lookupTypeNonSC(2) === types.LeftParenthesis) {
this.next();
children.push(this.MediaCondition());
this.eat(types.RightParenthesis);
} else {
children.push(this.MediaFeatureRange());
}
break;
default:
break scan;
}
}
return {
type: 'MediaCondition',
loc: this.getLocationFromList(children),
children
};
}
function generate(node) {
node.children.forEach(child => {
if (child.type === 'MediaCondition') {
this.token(types.LeftParenthesis, '(');
this.node(child);
this.token(types.RightParenthesis, ')');
} else {
this.node(child);
}
});
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;

View File

@@ -1,76 +0,0 @@
'use strict';
const types = require('../../tokenizer/types.cjs');
const name = 'MediaFeature';
const structure = {
name: String,
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
};
function parse() {
const start = this.tokenStart;
let name;
let value = null;
this.eat(types.LeftParenthesis);
this.skipSC();
name = this.consume(types.Ident);
this.skipSC();
if (this.tokenType !== types.RightParenthesis) {
this.eat(types.Colon);
this.skipSC();
switch (this.tokenType) {
case types.Number:
if (this.lookupNonWSType(1) === types.Delim) {
value = this.Ratio();
} else {
value = this.Number();
}
break;
case types.Dimension:
value = this.Dimension();
break;
case types.Ident:
value = this.Identifier();
break;
default:
this.error('Number, dimension, ratio or identifier is expected');
}
this.skipSC();
}
this.eat(types.RightParenthesis);
return {
type: 'MediaFeature',
loc: this.getLocation(start, this.tokenStart),
name,
value
};
}
function generate(node) {
this.token(types.LeftParenthesis, '(');
this.token(types.Ident, node.name);
if (node.value !== null) {
this.token(types.Colon, ':');
this.node(node.value);
}
this.token(types.RightParenthesis, ')');
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;

View File

@@ -1,11 +0,0 @@
'use strict';
const featureRange = require('./common/feature-range.cjs');
const name = 'MediaFeatureRange';
const parse = featureRange.createParse(name);
exports.generate = featureRange.generate;
exports.structure = featureRange.structure;
exports.name = name;
exports.parse = parse;

View File

@@ -1,69 +0,0 @@
'use strict';
const types = require('../../tokenizer/types.cjs');
const name = 'SupportsDeclaration';
const structure = {
feature: String,
value: 'Declaration'
};
function parse() {
const start = this.tokenStart;
let featureName = 'declaration';
let valueParser = this.Declaration;
if (this.tokenType === types.Function) {
featureName = this.consumeFunctionName();
valueParser = this.supportsFeature[featureName.toLowerCase()];
if (!valueParser) {
this.error(`Unknown supports feature ${featureName.toLowerCase()}()`);
}
} else {
this.eat(types.LeftParenthesis);
}
this.skipSC();
const value = this.parseWithFallback(
() => {
const startValueToken = this.tokenIndex;
const value = valueParser.call(this);
if (this.eof === false &&
this.isBalanceEdge(startValueToken) === false) {
this.error();
}
return value;
},
(startToken) => this.Raw(startToken, null, false)
);
if (!this.eof) {
this.eat(types.RightParenthesis);
}
return {
type: 'SupportsDeclaration',
loc: this.getLocation(start, this.tokenStart),
feature: featureName,
value
};
}
function generate(node) {
if (node.feature !== 'declaration') {
this.token(types.Function, node.feature + '(');
} else {
this.token(types.LeftParenthesis, '(');
}
this.node(node.value);
this.token(types.RightParenthesis, ')');
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;

View File

@@ -1,112 +0,0 @@
'use strict';
const types = require('../../../tokenizer/types.cjs');
const LESSTHANSIGN = 60; // <
const EQUALSIGN = 61; // =
const GREATERTHANSIGN = 62; // >
const structure = {
left: ['Identifier', 'Number', 'Dimension', 'Ratio'],
leftComparison: String,
middle: ['Identifier', 'Number', 'Dimension', 'Ratio'],
rightComparison: [String, null],
right: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
};
function readTerm() {
this.skipSC();
switch (this.tokenType) {
case types.Number:
if (this.lookupNonWSType(1) === types.Delim) {
return this.Ratio();
} else {
return this.Number();
}
case types.Dimension:
return this.Dimension();
case types.Ident:
return this.Identifier();
default:
this.error('Number, dimension, ratio or identifier is expected');
}
}
function readComparison(expectColon) {
this.skipSC();
if (this.isDelim(LESSTHANSIGN) ||
this.isDelim(GREATERTHANSIGN)) {
const value = this.source[this.tokenStart];
this.next();
if (this.isDelim(EQUALSIGN)) {
this.next();
return value + '=';
}
return value;
}
if (this.isDelim(EQUALSIGN)) {
return '=';
}
this.error(`Expected ${expectColon ? '":", ' : ''}"<", ">", "=" or ")"`);
}
function createParse(type) {
return function parse() {
const start = this.tokenStart;
this.skipSC();
this.eat(types.LeftParenthesis);
const left = readTerm.call(this);
const leftComparison = readComparison.call(this, left.type === 'Identifier');
const middle = readTerm.call(this);
let rightComparison = null;
let right = null;
if (this.lookupNonWSType(0) !== types.RightParenthesis) {
rightComparison = readComparison.call(this);
right = readTerm.call(this);
}
this.skipSC();
this.eat(types.RightParenthesis);
return {
type,
loc: this.getLocation(start, this.tokenStart),
left,
leftComparison,
middle,
rightComparison,
right
};
};
}
function generate(node) {
this.token(types.LeftParenthesis, '(');
this.node(node.left);
this.tokenize(node.leftComparison);
this.node(node.middle);
if (node.right) {
this.tokenize(node.rightComparison);
this.node(node.right);
}
this.token(types.RightParenthesis, ')');
}
exports.createParse = createParse;
exports.generate = generate;
exports.structure = structure;

View File

@@ -1,76 +0,0 @@
'use strict';
const types = require('../../../tokenizer/types.cjs');
const structure = {
name: String,
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
};
function createParse(type) {
return function parse() {
const start = this.tokenStart;
let name;
let value = null;
this.eat(types.LeftParenthesis);
this.skipSC();
name = this.consume(types.Ident);
this.skipSC();
if (this.tokenType !== types.RightParenthesis) {
this.eat(types.Colon);
this.skipSC();
switch (this.tokenType) {
case types.Number:
if (this.lookupNonWSType(1) === types.Delim) {
value = this.Ratio();
} else {
value = this.Number();
}
break;
case types.Dimension:
value = this.Dimension();
break;
case types.Ident:
value = this.Identifier();
break;
default:
this.error('Number, dimension, ratio or identifier is expected');
}
this.skipSC();
}
this.eat(types.RightParenthesis);
return {
type,
loc: this.getLocation(start, this.tokenStart),
name,
value
};
};
}
function generate(node) {
this.token(types.LeftParenthesis, '(');
this.token(types.Ident, node.name);
if (node.value !== null) {
this.token(types.Colon, ':');
this.node(node.value);
}
this.token(types.RightParenthesis, ')');
}
exports.createParse = createParse;
exports.generate = generate;
exports.structure = structure;