Major changes: - New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind - 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理 - Data catalog with charts (DMS/ADAS/Lane 3-tab view) - Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance - Audit enhancements: batch operations, rejection categories, Feishu notifications - Operation audit log (操作日志) - World model simulation studio (仿真工坊) - Dataset version management with snapshots and diff - ADAS 7-class dataset integration (138K images organized + compressed) - User management with Feishu integration and pagination - CRUD/search/filter on all pages, card layout redesign - PIL-optimized image overlay rendering - Auto-snapshot on build, in_review workflow stage - Removed embedded algorithm code (now in workspace)
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
|