Fix code quality violations and exclude Manifest from checks

Document application modes (development/debug/production)
Add global file drop handler, order column normalization, SPA hash fix
Serve CDN assets via /_vendor/ URLs instead of merging into bundles
Add production minification with license preservation
Improve JSON formatting for debugging and production optimization
Add CDN asset caching with CSS URL inlining for production builds
Add three-mode system (development, debug, production)
Update Manifest CLAUDE.md to reflect helper class architecture
Refactor Manifest.php into helper classes for better organization
Pre-manifest-refactor checkpoint: Add app_mode documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-01-14 10:38:22 +00:00
parent bb9046af1b
commit d523f0f600
2355 changed files with 231384 additions and 32223 deletions

229
node_modules/svgo/lib/path.js generated vendored
View File

@@ -1,11 +1,17 @@
'use strict';
/**
* @typedef {import('./types').PathDataItem} PathDataItem
* @typedef {import('./types').PathDataCommand} PathDataCommand
* @fileoverview Based on https://www.w3.org/TR/SVG11/paths.html#PathDataBNF.
*/
// Based on https://www.w3.org/TR/SVG11/paths.html#PathDataBNF
import { removeLeadingZero, toFixed } from './svgo/tools.js';
/**
* @typedef {'none' | 'sign' | 'whole' | 'decimal_point' | 'decimal' | 'e' | 'exponent_sign' | 'exponent'} ReadNumberState
*
* @typedef StringifyPathDataOptions
* @property {ReadonlyArray<import('./types.js').PathDataItem>} pathData
* @property {number=} precision
* @property {boolean=} disableSpaceAfterFlags
*/
const argsCountPerCommand = {
M: 2,
@@ -31,27 +37,24 @@ const argsCountPerCommand = {
};
/**
* @type {(c: string) => c is PathDataCommand}
* @param {string} c
* @returns {c is import('./types.js').PathDataCommand}
*/
const isCommand = (c) => {
return c in argsCountPerCommand;
};
/**
* @type {(c: string) => boolean}
* @param {string} c
* @returns {boolean}
*/
const isWsp = (c) => {
const codePoint = c.codePointAt(0);
return (
codePoint === 0x20 ||
codePoint === 0x9 ||
codePoint === 0xd ||
codePoint === 0xa
);
const isWhiteSpace = (c) => {
return c === ' ' || c === '\t' || c === '\r' || c === '\n';
};
/**
* @type {(c: string) => boolean}
* @param {string} c
* @returns {boolean}
*/
const isDigit = (c) => {
const codePoint = c.codePointAt(0);
@@ -62,16 +65,15 @@ const isDigit = (c) => {
};
/**
* @typedef {'none' | 'sign' | 'whole' | 'decimal_point' | 'decimal' | 'e' | 'exponent_sign' | 'exponent'} ReadNumberState
*/
/**
* @type {(string: string, cursor: number) => [number, number | null]}
* @param {string} string
* @param {number} cursor
* @returns {[number, ?number]}
*/
const readNumber = (string, cursor) => {
let i = cursor;
let value = '';
let state = /** @type {ReadNumberState} */ ('none');
/** @type {ReadNumberState} */
let state = 'none';
for (; i < string.length; i += 1) {
const c = string[i];
if (c === '+' || c === '-') {
@@ -133,16 +135,13 @@ const readNumber = (string, cursor) => {
};
/**
* @type {(string: string) => Array<PathDataItem>}
* @param {string} string
* @returns {import('./types.js').PathDataItem[]}
*/
const parsePathData = (string) => {
/**
* @type {Array<PathDataItem>}
*/
export const parsePathData = (string) => {
/** @type {import('./types.js').PathDataItem[]} */
const pathData = [];
/**
* @type {null | PathDataCommand}
*/
/** @type {?import('./types.js').PathDataCommand} */
let command = null;
let args = /** @type {number[]} */ ([]);
let argsCount = 0;
@@ -150,7 +149,7 @@ const parsePathData = (string) => {
let hadComma = false;
for (let i = 0; i < string.length; i += 1) {
const c = string.charAt(i);
if (isWsp(c)) {
if (isWhiteSpace(c)) {
continue;
}
// allow comma only between arguments
@@ -170,11 +169,9 @@ const parsePathData = (string) => {
if (c !== 'M' && c !== 'm') {
return pathData;
}
} else {
} else if (args.length !== 0) {
// stop if previous command arguments are not flushed
if (args.length !== 0) {
return pathData;
}
return pathData;
}
command = c;
args = [];
@@ -226,7 +223,7 @@ const parsePathData = (string) => {
// flush arguments when necessary count is reached
if (args.length === argsCount) {
pathData.push({ command, args });
// subsequent moveto coordinates are threated as implicit lineto commands
// subsequent moveto coordinates are treated as implicit lineto commands
if (command === 'M') {
command = 'L';
}
@@ -238,110 +235,128 @@ const parsePathData = (string) => {
}
return pathData;
};
exports.parsePathData = parsePathData;
/**
* @type {(number: number, precision?: number) => string}
* @param {number} number
* @param {number=} precision
* @returns {{ roundedStr: string, rounded: number }}
*/
const stringifyNumber = (number, precision) => {
const roundAndStringify = (number, precision) => {
if (precision != null) {
const ratio = 10 ** precision;
number = Math.round(number * ratio) / ratio;
number = toFixed(number, precision);
}
// remove zero whole from decimal number
return number.toString().replace(/^0\./, '.').replace(/^-0\./, '-.');
return {
roundedStr: removeLeadingZero(number),
rounded: number,
};
};
/**
* Elliptical arc large-arc and sweep flags are rendered with spaces
* because many non-browser environments are not able to parse such paths
*
* @type {(
* command: string,
* args: number[],
* precision?: number,
* disableSpaceAfterFlags?: boolean
* ) => string}
* @param {string} command
* @param {ReadonlyArray<number>} args
* @param {number=} precision
* @param {boolean=} disableSpaceAfterFlags
* @returns {string}
*/
const stringifyArgs = (command, args, precision, disableSpaceAfterFlags) => {
let result = '';
let prev = '';
for (let i = 0; i < args.length; i += 1) {
const number = args[i];
const numberString = stringifyNumber(number, precision);
let previous;
for (let i = 0; i < args.length; i++) {
const { roundedStr, rounded } = roundAndStringify(args[i], precision);
if (
disableSpaceAfterFlags &&
(command === 'A' || command === 'a') &&
// consider combined arcs
(i % 7 === 4 || i % 7 === 5)
) {
result += numberString;
} else if (i === 0 || numberString.startsWith('-')) {
result += roundedStr;
} else if (i === 0 || rounded < 0) {
// avoid space before first and negative numbers
result += numberString;
} else if (prev.includes('.') && numberString.startsWith('.')) {
result += roundedStr;
} else if (!Number.isInteger(previous) && !isDigit(roundedStr[0])) {
// remove space before decimal with zero whole
// only when previous number is also decimal
result += numberString;
result += roundedStr;
} else {
result += ` ${numberString}`;
result += ` ${roundedStr}`;
}
prev = numberString;
previous = rounded;
}
return result;
};
/**
* @typedef {{
* pathData: Array<PathDataItem>;
* precision?: number;
* disableSpaceAfterFlags?: boolean;
* }} StringifyPathDataOptions
* @param {StringifyPathDataOptions} options
* @returns {string}
*/
/**
* @type {(options: StringifyPathDataOptions) => string}
*/
const stringifyPathData = ({ pathData, precision, disableSpaceAfterFlags }) => {
// combine sequence of the same commands
let combined = [];
for (let i = 0; i < pathData.length; i += 1) {
const { command, args } = pathData[i];
if (i === 0) {
combined.push({ command, args });
} else {
/**
* @type {PathDataItem}
*/
const last = combined[combined.length - 1];
// match leading moveto with following lineto
if (i === 1) {
if (command === 'L') {
last.command = 'M';
}
if (command === 'l') {
last.command = 'm';
}
}
if (
(last.command === command &&
last.command !== 'M' &&
last.command !== 'm') ||
// combine matching moveto and lineto sequences
(last.command === 'M' && command === 'L') ||
(last.command === 'm' && command === 'l')
) {
last.args = [...last.args, ...args];
} else {
combined.push({ command, args });
}
}
export const stringifyPathData = ({
pathData,
precision,
disableSpaceAfterFlags,
}) => {
if (pathData.length === 1) {
const { command, args } = pathData[0];
return (
command + stringifyArgs(command, args, precision, disableSpaceAfterFlags)
);
}
let result = '';
for (const { command, args } of combined) {
result +=
command + stringifyArgs(command, args, precision, disableSpaceAfterFlags);
let prev = { ...pathData[0] };
// match leading moveto with following lineto
if (pathData[1].command === 'L') {
prev.command = 'M';
} else if (pathData[1].command === 'l') {
prev.command = 'm';
}
for (let i = 1; i < pathData.length; i++) {
const { command, args } = pathData[i];
if (
(prev.command === command &&
prev.command !== 'M' &&
prev.command !== 'm') ||
// combine matching moveto and lineto sequences
(prev.command === 'M' && command === 'L') ||
(prev.command === 'm' && command === 'l')
) {
prev.args = [...prev.args, ...args];
if (i === pathData.length - 1) {
result +=
prev.command +
stringifyArgs(
prev.command,
prev.args,
precision,
disableSpaceAfterFlags,
);
}
} else {
result +=
prev.command +
stringifyArgs(
prev.command,
prev.args,
precision,
disableSpaceAfterFlags,
);
if (i === pathData.length - 1) {
result +=
command +
stringifyArgs(command, args, precision, disableSpaceAfterFlags);
} else {
prev = { command, args };
}
}
}
return result;
};
exports.stringifyPathData = stringifyPathData;