Remove the feature of auto-regsitering custom properties

This commit is contained in:
yuanchuan 2022-01-14 10:53:49 +08:00
parent 6f86c5ba29
commit b69ae02daa
3 changed files with 0 additions and 41 deletions

View File

@ -12,8 +12,6 @@ import { maybe, cell_id, is_nil, get_value } from './utils/index';
import List from './utils/list';
let { join, make_array, remove_empty_values } = List();
import get_definition from './utils/get-definition';
function is_host_selector(s) {
return /^\:(host|doodle)/.test(s);
}
@ -566,14 +564,6 @@ class Rules {
});
});
let definitions = [];
Object.keys(this.custom_properties).forEach(name => {
let def = get_definition(name);
if (def) {
definitions.push(def);
}
});
return {
props: this.props,
styles: this.styles,
@ -583,7 +573,6 @@ class Rules {
paths: this.paths,
canvas: this.canvas,
pattern: this.pattern,
definitions: definitions,
uniforms: this.uniforms
}
}

View File

@ -406,13 +406,11 @@ class Doodle extends HTMLElement {
}
// might be removed in the future
const definitions = compiled.definitions;
if (window.CSS && window.CSS.registerProperty) {
try {
if (uniforms.time) {
this.register_uniform_time();
}
definitions.forEach(CSS.registerProperty);
} catch (e) { }
}
}

View File

@ -1,28 +0,0 @@
const initial = {
length: '0px',
number: 0,
color: 'black',
url: 'url()',
image: 'url()',
integer: 0,
angle: '0deg',
time: '0ms',
resolution: '0dpi',
percentage: '0%',
'length-percentage': '0%',
'transform-function': 'translate(0)',
'transform-list': 'translate(0)',
'custom-ident': '_'
};
export default function get_definition(name) {
let type = String(name).substr(2).split('-')[0];
if (initial[type] !== undefined) {
return {
name: name,
syntax: `<${type}> | <${type}>+ | <${type}>#`,
initialValue: initial[type],
inherits: false
}
}
}