Standardize settings file naming and relocate documentation files Fix code quality violations from rsx:check Reorganize user_management directory into logical subdirectories Move Quill Bundle to core and align with Tom Select pattern Simplify Site Settings page to focus on core site information Complete Phase 5: Multi-tenant authentication with login flow and site selection Add route query parameter rule and synchronize filename validation logic Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs Implement filename convention rule and resolve VS Code auto-rename conflict Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns Implement RPC server architecture for JavaScript parsing WIP: Add RPC server infrastructure for JS parsing (partial implementation) Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation Add JQHTML-CLASS-01 rule and fix redundant class names Improve code quality rules and resolve violations Remove legacy fatal error format in favor of unified 'fatal' error type Filter internal keys from window.rsxapp output Update button styling and comprehensive form/modal documentation Add conditional fly-in animation for modals Fix non-deterministic bundle compilation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
126 lines
2.5 KiB
JavaScript
126 lines
2.5 KiB
JavaScript
let OldValue = require('./old-value')
|
|
let Prefixer = require('./prefixer')
|
|
let utils = require('./utils')
|
|
let vendor = require('./vendor')
|
|
|
|
class Value extends Prefixer {
|
|
/**
|
|
* Clone decl for each prefixed values
|
|
*/
|
|
static save(prefixes, decl) {
|
|
let prop = decl.prop
|
|
let result = []
|
|
|
|
for (let prefix in decl._autoprefixerValues) {
|
|
let value = decl._autoprefixerValues[prefix]
|
|
|
|
if (value === decl.value) {
|
|
continue
|
|
}
|
|
|
|
let item
|
|
let propPrefix = vendor.prefix(prop)
|
|
|
|
if (propPrefix === '-pie-') {
|
|
continue
|
|
}
|
|
|
|
if (propPrefix === prefix) {
|
|
item = decl.value = value
|
|
result.push(item)
|
|
continue
|
|
}
|
|
|
|
let prefixed = prefixes.prefixed(prop, prefix)
|
|
let rule = decl.parent
|
|
|
|
if (!rule.every(i => i.prop !== prefixed)) {
|
|
result.push(item)
|
|
continue
|
|
}
|
|
|
|
let trimmed = value.replace(/\s+/, ' ')
|
|
let already = rule.some(
|
|
i => i.prop === decl.prop && i.value.replace(/\s+/, ' ') === trimmed
|
|
)
|
|
|
|
if (already) {
|
|
result.push(item)
|
|
continue
|
|
}
|
|
|
|
let cloned = this.clone(decl, { value })
|
|
item = decl.parent.insertBefore(decl, cloned)
|
|
|
|
result.push(item)
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
/**
|
|
* Save values with next prefixed token
|
|
*/
|
|
add(decl, prefix) {
|
|
if (!decl._autoprefixerValues) {
|
|
decl._autoprefixerValues = {}
|
|
}
|
|
let value = decl._autoprefixerValues[prefix] || this.value(decl)
|
|
|
|
let before
|
|
do {
|
|
before = value
|
|
value = this.replace(value, prefix)
|
|
if (value === false) return
|
|
} while (value !== before)
|
|
|
|
decl._autoprefixerValues[prefix] = value
|
|
}
|
|
|
|
/**
|
|
* Is declaration need to be prefixed
|
|
*/
|
|
check(decl) {
|
|
let value = decl.value
|
|
if (!value.includes(this.name)) {
|
|
return false
|
|
}
|
|
|
|
return !!value.match(this.regexp())
|
|
}
|
|
|
|
/**
|
|
* Return function to fast find prefixed value
|
|
*/
|
|
old(prefix) {
|
|
return new OldValue(this.name, prefix + this.name)
|
|
}
|
|
|
|
/**
|
|
* Lazy regexp loading
|
|
*/
|
|
regexp() {
|
|
return this.regexpCache || (this.regexpCache = utils.regexp(this.name))
|
|
}
|
|
|
|
/**
|
|
* Add prefix to values in string
|
|
*/
|
|
replace(string, prefix) {
|
|
return string.replace(this.regexp(), `$1${prefix}$2`)
|
|
}
|
|
|
|
/**
|
|
* Get value with comments if it was not changed
|
|
*/
|
|
value(decl) {
|
|
if (decl.raws.value && decl.raws.value.value === decl.value) {
|
|
return decl.raws.value.raw
|
|
} else {
|
|
return decl.value
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = Value
|