dothtml 6.0.0-beta.44 → 6.0.0-beta.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build_module/css/css-props.js +38 -1
- package/build_module/css/css-props.js.map +1 -1
- package/build_module/css/format-css-type.d.ts +4 -3
- package/build_module/css/format-css-type.js +7 -0
- package/build_module/css/format-css-type.js.map +1 -1
- package/build_module/decoration/component.d.ts +4 -14
- package/build_module/decoration/component.js +29 -29
- package/build_module/decoration/component.js.map +1 -1
- package/build_module/dot.js +130 -68
- package/build_module/dot.js.map +1 -1
- package/build_module/events/event-manager.d.ts +14 -0
- package/build_module/events/event-manager.js +98 -0
- package/build_module/events/event-manager.js.map +1 -0
- package/build_module/events/synthetic-event.d.ts +17 -0
- package/build_module/events/synthetic-event.js +33 -0
- package/build_module/events/synthetic-event.js.map +1 -0
- package/build_module/helpers/render-stylesheet.js +18 -9
- package/build_module/helpers/render-stylesheet.js.map +1 -1
- package/build_module/index.d.ts +3 -1
- package/build_module/index.js +14 -1
- package/build_module/index.js.map +1 -1
- package/build_module/reactivity/binding.d.ts +3 -1
- package/build_module/reactivity/binding.js +8 -2
- package/build_module/reactivity/binding.js.map +1 -1
- package/build_module/reactivity/computed.d.ts +18 -0
- package/build_module/reactivity/computed.js +106 -0
- package/build_module/reactivity/computed.js.map +1 -0
- package/build_module/reactivity/priority.d.ts +6 -0
- package/build_module/reactivity/priority.js +8 -0
- package/build_module/reactivity/priority.js.map +1 -0
- package/build_module/reactivity/ref-collection.d.ts +8 -0
- package/build_module/reactivity/ref-collection.js +32 -0
- package/build_module/reactivity/ref-collection.js.map +1 -0
- package/build_module/reactivity/ref.d.ts +5 -3
- package/build_module/reactivity/ref.js +31 -2
- package/build_module/reactivity/ref.js.map +1 -1
- package/build_module/reactivity/scheduler.d.ts +22 -0
- package/build_module/reactivity/scheduler.js +124 -0
- package/build_module/reactivity/scheduler.js.map +1 -0
- package/build_module/reactivity/store.d.ts +14 -0
- package/build_module/reactivity/store.js +91 -0
- package/build_module/reactivity/store.js.map +1 -0
- package/build_module/reactivity/subscription.d.ts +2 -1
- package/build_module/reactivity/subscription.js +4 -5
- package/build_module/reactivity/subscription.js.map +1 -1
- package/build_module/reactivity/watcher.d.ts +6 -3
- package/build_module/reactivity/watcher.js +31 -10
- package/build_module/reactivity/watcher.js.map +1 -1
- package/build_module/routing/helpers.d.ts +2 -0
- package/build_module/routing/helpers.js +21 -0
- package/build_module/routing/helpers.js.map +1 -0
- package/build_module/routing/index.d.ts +5 -0
- package/build_module/routing/index.js +6 -0
- package/build_module/routing/index.js.map +1 -0
- package/build_module/routing/link.d.ts +2 -0
- package/build_module/routing/link.js +45 -0
- package/build_module/routing/link.js.map +1 -0
- package/build_module/routing/router.d.ts +23 -0
- package/build_module/routing/router.js +209 -0
- package/build_module/routing/router.js.map +1 -0
- package/build_module/routing/scroll-manager.d.ts +1 -0
- package/build_module/routing/scroll-manager.js +33 -0
- package/build_module/routing/scroll-manager.js.map +1 -0
- package/build_module/routing/state.d.ts +7 -0
- package/build_module/routing/state.js +45 -0
- package/build_module/routing/state.js.map +1 -0
- package/build_module/v-meta-nodes/style-v-node.d.ts +17 -7
- package/build_module/v-meta-nodes/style-v-node.js +181 -85
- package/build_module/v-meta-nodes/style-v-node.js.map +1 -1
- package/build_module/v-style-nodes/base-v-style.d.ts +10 -11
- package/build_module/v-style-nodes/base-v-style.js +23 -95
- package/build_module/v-style-nodes/base-v-style.js.map +1 -1
- package/build_module/v-style-nodes/css-function-builder-v-style.d.ts +0 -3
- package/build_module/v-style-nodes/css-function-builder-v-style.js +10 -5
- package/build_module/v-style-nodes/css-function-builder-v-style.js.map +1 -1
- package/build_module/v-style-nodes/style-sheet-builder.d.ts +9 -0
- package/build_module/v-style-nodes/style-sheet-builder.js +51 -0
- package/build_module/v-style-nodes/style-sheet-builder.js.map +1 -0
- package/build_module/v-style-nodes/transform-v-style.js.map +1 -1
- package/build_module/vdom-nodes/collection-vdom.d.ts +3 -1
- package/build_module/vdom-nodes/collection-vdom.js +114 -97
- package/build_module/vdom-nodes/collection-vdom.js.map +1 -1
- package/build_module/vdom-nodes/component-context.d.ts +5 -0
- package/build_module/vdom-nodes/component-context.js +5 -0
- package/build_module/vdom-nodes/component-context.js.map +1 -0
- package/build_module/vdom-nodes/component-vdom.d.ts +22 -0
- package/build_module/vdom-nodes/component-vdom.js +250 -12
- package/build_module/vdom-nodes/component-vdom.js.map +1 -1
- package/build_module/vdom-nodes/conditional-vdom.d.ts +1 -0
- package/build_module/vdom-nodes/conditional-vdom.js +14 -0
- package/build_module/vdom-nodes/conditional-vdom.js.map +1 -1
- package/build_module/vdom-nodes/container-vdom.d.ts +6 -2
- package/build_module/vdom-nodes/container-vdom.js +54 -1
- package/build_module/vdom-nodes/container-vdom.js.map +1 -1
- package/build_module/vdom-nodes/element-vdom.d.ts +2 -1
- package/build_module/vdom-nodes/element-vdom.js +72 -18
- package/build_module/vdom-nodes/element-vdom.js.map +1 -1
- package/build_module/vdom-nodes/html-vdom.d.ts +1 -0
- package/build_module/vdom-nodes/html-vdom.js +12 -0
- package/build_module/vdom-nodes/html-vdom.js.map +1 -1
- package/build_module/vdom-nodes/text-vdom.d.ts +1 -0
- package/build_module/vdom-nodes/text-vdom.js +3 -0
- package/build_module/vdom-nodes/text-vdom.js.map +1 -1
- package/build_module/vdom-nodes/vdom.d.ts +2 -0
- package/build_module/vdom-nodes/vdom.js +17 -0
- package/build_module/vdom-nodes/vdom.js.map +1 -1
- package/package.json +58 -57
- package/readme.md +32 -26
- package/build_module/css/css.d.ts +0 -0
- package/build_module/css/css.js +0 -1
- package/build_module/css/css.js.map +0 -1
- package/build_module/decoration/use-styles.d.ts +0 -14
- package/build_module/decoration/use-styles.js +0 -19
- package/build_module/decoration/use-styles.js.map +0 -1
- package/build_module/helpers/render-css.d.ts +0 -2
- package/build_module/helpers/render-css.js +0 -20
- package/build_module/helpers/render-css.js.map +0 -1
- package/build_module/helpers.d.ts +0 -3
- package/build_module/helpers.js +0 -50
- package/build_module/helpers.js.map +0 -1
- package/build_module/reactive.d.ts +0 -46
- package/build_module/reactive.js +0 -150
- package/build_module/reactive.js.map +0 -1
- package/build_module/reactivity/bound-reactive.d.ts +0 -13
- package/build_module/reactivity/bound-reactive.js +0 -20
- package/build_module/reactivity/bound-reactive.js.map +0 -1
- package/build_module/reactivity/reactive.d.ts +0 -22
- package/build_module/reactivity/reactive.js +0 -54
- package/build_module/reactivity/reactive.js.map +0 -1
|
@@ -5,131 +5,227 @@ import FilterVStyle from "../v-style-nodes/filter-v-style";
|
|
|
5
5
|
import TransformVStyle from "../v-style-nodes/transform-v-style";
|
|
6
6
|
import { formatCssLength } from "../css/format-css-type";
|
|
7
7
|
import Binding from "../reactivity/binding";
|
|
8
|
+
import BaseVStyle from "../v-style-nodes/base-v-style";
|
|
9
|
+
import { scheduler } from "../reactivity/scheduler";
|
|
10
|
+
import { Priority } from "../reactivity/priority";
|
|
11
|
+
import Watcher from "../reactivity/watcher";
|
|
8
12
|
export default class StyleVNode extends VMetaNode {
|
|
9
|
-
constructor(
|
|
13
|
+
constructor(styleSource) {
|
|
10
14
|
super();
|
|
11
15
|
this.observables = [];
|
|
12
16
|
this.observableIds = [];
|
|
13
|
-
this.
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
this.isQueued = false;
|
|
18
|
+
this.updateSubscription = {
|
|
19
|
+
active: true,
|
|
20
|
+
update: () => {
|
|
21
|
+
this.isQueued = false;
|
|
22
|
+
this.applyStyles();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.styleSource = styleSource;
|
|
26
|
+
if (this.styleSource instanceof BaseVStyle) {
|
|
27
|
+
this.styleSource._setOnUpdate(() => this.update());
|
|
28
|
+
}
|
|
29
|
+
this.extractObservables();
|
|
30
|
+
}
|
|
31
|
+
extractObservables() {
|
|
32
|
+
const source = this.styleSource instanceof BaseVStyle ? this.styleSource.getProps() : this.styleSource;
|
|
33
|
+
if (Array.isArray(source)) {
|
|
34
|
+
for (let i = 0; i < source.length; i++) {
|
|
35
|
+
let p = source[i];
|
|
36
|
+
this.processValue(p.prop, p.value, (newVal) => p.value = newVal);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let prop in source) {
|
|
41
|
+
this.processValue(prop, source[prop], (newVal) => source[prop] = newVal);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
processValue(prop, value, setter) {
|
|
46
|
+
if (!this.tryExtractObservable(value)) {
|
|
47
|
+
if (typeof value === "object" && value !== null && !(value instanceof CssFunctionBuilderVStyle)) {
|
|
48
|
+
let builder;
|
|
49
|
+
switch (prop) {
|
|
50
|
+
case "filter": {
|
|
51
|
+
builder = new FilterVStyle(prop);
|
|
52
|
+
break;
|
|
35
53
|
}
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
case "transform": {
|
|
55
|
+
builder = new TransformVStyle(prop);
|
|
56
|
+
break;
|
|
38
57
|
}
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
}
|
|
59
|
+
if (builder) {
|
|
60
|
+
let funcArray = Array.isArray(value) ? value : [value];
|
|
61
|
+
for (let funcValue of funcArray) {
|
|
41
62
|
for (let k in funcValue) {
|
|
42
63
|
let v = funcValue[k];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (let j in v) {
|
|
48
|
-
let w = v[j];
|
|
49
|
-
if (w instanceof Binding) {
|
|
50
|
-
this.observables.push(w);
|
|
51
|
-
}
|
|
64
|
+
this.tryExtractObservable(v);
|
|
65
|
+
if (Array.isArray(v)) {
|
|
66
|
+
for (let w of v) {
|
|
67
|
+
this.tryExtractObservable(w);
|
|
52
68
|
}
|
|
53
69
|
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
70
|
+
if (typeof builder[k] === "function") {
|
|
71
|
+
if (Array.isArray(v)) {
|
|
72
|
+
builder[k](...v);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
builder[k](v);
|
|
76
|
+
}
|
|
56
77
|
}
|
|
57
78
|
}
|
|
58
79
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
80
|
+
setter(builder);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
tryExtractObservable(value) {
|
|
86
|
+
if (value instanceof Binding || value instanceof Watcher) {
|
|
87
|
+
if (this.observables.indexOf(value) === -1) {
|
|
88
|
+
this.observables.push(value);
|
|
89
|
+
if (this.target) {
|
|
90
|
+
let id = value.subscribe(() => this.update());
|
|
91
|
+
this.observableIds.push(id);
|
|
62
92
|
}
|
|
63
93
|
}
|
|
94
|
+
return true;
|
|
64
95
|
}
|
|
96
|
+
return false;
|
|
65
97
|
}
|
|
66
98
|
render(target, document = window.document, shadowRoot) {
|
|
67
99
|
this.target = target;
|
|
68
100
|
this.document = document;
|
|
69
101
|
this.shadowRoot = shadowRoot;
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
102
|
+
for (let observable of this.observables) {
|
|
103
|
+
let id = observable.subscribe(() => this.update());
|
|
104
|
+
this.observableIds.push(id);
|
|
105
|
+
}
|
|
106
|
+
if (typeof target === "string") {
|
|
107
|
+
this.styleElement = this.document.createElement("style");
|
|
108
|
+
if (this.shadowRoot) {
|
|
109
|
+
this.shadowRoot.appendChild(this.styleElement);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.document.head.appendChild(this.styleElement);
|
|
75
113
|
}
|
|
76
114
|
}
|
|
77
|
-
this.
|
|
115
|
+
this.applyStyles();
|
|
78
116
|
}
|
|
79
117
|
update() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
cssValue = `${value}`;
|
|
93
|
-
}
|
|
118
|
+
if (!this.isQueued) {
|
|
119
|
+
this.isQueued = true;
|
|
120
|
+
scheduler.enqueue(this.updateSubscription, Priority.Normal);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
applyStyles() {
|
|
124
|
+
if (!this.target)
|
|
125
|
+
return;
|
|
126
|
+
if (typeof this.target === "string") {
|
|
127
|
+
if (this.styleElement) {
|
|
128
|
+
this.styleElement.textContent = `${this.target} { ${this.getStyleString()} }`;
|
|
94
129
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.extractObservables();
|
|
133
|
+
const source = this.styleSource instanceof BaseVStyle ? this.styleSource.getProps() : this.styleSource;
|
|
134
|
+
if (Array.isArray(source)) {
|
|
135
|
+
for (const p of source) {
|
|
136
|
+
const value = p.value instanceof Binding ? p.value._get() : (p.value instanceof Watcher ? p.value.value : p.value);
|
|
137
|
+
this.applySingleStyle(p.prop, value);
|
|
102
138
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
for (let prop in source) {
|
|
142
|
+
const value = source[prop] instanceof Binding ? source[prop]._get() : (source[prop] instanceof Watcher ? source[prop].value : source[prop]);
|
|
143
|
+
this.applySingleStyle(prop, value);
|
|
106
144
|
}
|
|
107
145
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
applySingleStyle(prop, value) {
|
|
149
|
+
let cssValue;
|
|
150
|
+
if (value instanceof CssFunctionBuilderVStyle) {
|
|
151
|
+
cssValue = value.toString();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
cssValue = value;
|
|
155
|
+
}
|
|
156
|
+
let cssProp = prop;
|
|
157
|
+
let cssUnit = undefined;
|
|
158
|
+
const registeredProp = cssProps[prop];
|
|
159
|
+
if (registeredProp) {
|
|
160
|
+
cssProp = registeredProp.cssName;
|
|
161
|
+
cssUnit = registeredProp.unit;
|
|
162
|
+
if (registeredProp.type === "length" && typeof cssValue === "number") {
|
|
163
|
+
cssValue = formatCssLength(cssValue, cssUnit);
|
|
113
164
|
}
|
|
114
|
-
allStylesToApply.push({ cssProp, cssValue: formattedValue });
|
|
115
165
|
}
|
|
116
166
|
if (this.target instanceof HTMLElement) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
167
|
+
this.target.style.setProperty(cssProp, `${cssValue}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
getStyleString() {
|
|
171
|
+
let styles = "";
|
|
172
|
+
const source = this.styleSource instanceof BaseVStyle ? this.styleSource.getProps() : this.styleSource;
|
|
173
|
+
if (Array.isArray(source)) {
|
|
174
|
+
for (const p of source) {
|
|
175
|
+
styles += this.formatSingleStyle(p.prop, p.value);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
for (let prop in source) {
|
|
180
|
+
styles += this.formatSingleStyle(prop, source[prop]);
|
|
120
181
|
}
|
|
121
182
|
}
|
|
122
|
-
|
|
183
|
+
return styles;
|
|
184
|
+
}
|
|
185
|
+
formatSingleStyle(prop, value) {
|
|
186
|
+
let cssValue = value instanceof Binding ? value._get() : (value instanceof Watcher ? value.value : value);
|
|
187
|
+
if (cssValue instanceof CssFunctionBuilderVStyle) {
|
|
188
|
+
cssValue = cssValue.toString();
|
|
189
|
+
}
|
|
190
|
+
let cssProp = prop;
|
|
191
|
+
let cssUnit = undefined;
|
|
192
|
+
const registeredProp = cssProps[prop];
|
|
193
|
+
if (registeredProp) {
|
|
194
|
+
cssProp = registeredProp.cssName;
|
|
195
|
+
cssUnit = registeredProp.unit;
|
|
196
|
+
if (registeredProp.type === "length" && typeof cssValue === "number") {
|
|
197
|
+
cssValue = formatCssLength(cssValue, cssUnit);
|
|
198
|
+
}
|
|
123
199
|
}
|
|
200
|
+
return `${cssProp}: ${cssValue}; `;
|
|
124
201
|
}
|
|
125
202
|
unrender() {
|
|
126
|
-
for (let i
|
|
203
|
+
for (let i = 0; i < this.observableIds.length; i++) {
|
|
127
204
|
let id = this.observableIds[i];
|
|
128
205
|
let observable = this.observables[i];
|
|
129
|
-
observable
|
|
206
|
+
if (observable instanceof Binding) {
|
|
207
|
+
observable._unsubscribe(id);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
observable._detachBinding(id);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
this.observableIds = [];
|
|
214
|
+
this.observables = [];
|
|
215
|
+
if (this.styleElement) {
|
|
216
|
+
this.styleElement.remove();
|
|
217
|
+
this.styleElement = null;
|
|
218
|
+
}
|
|
219
|
+
this.target = null;
|
|
220
|
+
this.updateSubscription.active = false;
|
|
221
|
+
}
|
|
222
|
+
toString() {
|
|
223
|
+
if (typeof this.target === "string") {
|
|
224
|
+
return `${this.target} { ${this.getStyleString()} }`;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
return this.getStyleString();
|
|
130
228
|
}
|
|
131
|
-
this.observables.length = 0;
|
|
132
229
|
}
|
|
133
|
-
toString() { }
|
|
134
230
|
}
|
|
135
231
|
//# sourceMappingURL=style-v-node.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-v-node.js","sourceRoot":"","sources":["../../src/v-meta-nodes/style-v-node.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,kBAAkB,CAAC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CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnD,IAAI,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACrC,IAAI,UAAU,YAAY,OAAO,EAAE;gBACjC,UAAkB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;aACrC;iBAAM;gBACL,UAAkB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;aACvC;SACD;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,IAAI,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SACzB;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,MAAM,GAAG,KAAK,CAAC;IACxC,CAAC;IAED,QAAQ;QACP,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE;YACpC,OAAO,GAAG,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;SACrD;aAAM;YACN,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;SAC7B;IACF,CAAC;CACD"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export default class BaseVStyle extends VStyle {
|
|
1
|
+
export default class BaseVStyle {
|
|
3
2
|
private readonly _isBase;
|
|
4
3
|
private props;
|
|
5
|
-
private
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
private onUpdate;
|
|
5
|
+
setProp(propName: string, value: any): any;
|
|
6
|
+
_setOnUpdate(callback: () => void): void;
|
|
7
|
+
variable(name: string, value: any): any;
|
|
8
|
+
v(name: string): string;
|
|
9
|
+
getProps(): {
|
|
10
|
+
prop: string;
|
|
11
|
+
value: any;
|
|
12
|
+
}[];
|
|
14
13
|
}
|
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import VStyle from "./v-style";
|
|
4
|
-
export default class BaseVStyle extends VStyle {
|
|
1
|
+
import cssProps from "../css/css-props";
|
|
2
|
+
export default class BaseVStyle {
|
|
5
3
|
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
4
|
this._isBase = false;
|
|
8
5
|
this.props = [];
|
|
9
|
-
this.subscriptions = {};
|
|
10
|
-
this.renderedSubBuilders = [];
|
|
11
|
-
}
|
|
12
|
-
_render(target) {
|
|
13
|
-
this.target = target;
|
|
14
|
-
for (let i = 0; i < this.props.length; i++) {
|
|
15
|
-
let P = this.props[i];
|
|
16
|
-
this.renderAndSetPropValue(P.prop, P.value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
_unrender() {
|
|
20
|
-
for (let i = 0; i < this.renderedSubBuilders.length; i++) {
|
|
21
|
-
let sb = this.renderedSubBuilders[i];
|
|
22
|
-
sb._unrender();
|
|
23
|
-
}
|
|
24
|
-
this.renderedSubBuilders.length = 0;
|
|
25
|
-
for (let s in this.subscriptions) {
|
|
26
|
-
let P = this.subscriptions[s];
|
|
27
|
-
P._unsubscribe(Number(s));
|
|
28
|
-
}
|
|
29
|
-
this.subscriptions = {};
|
|
30
|
-
this.target = null;
|
|
31
|
-
}
|
|
32
|
-
renderAndSetPropValue(prop, value) {
|
|
33
|
-
if (value instanceof Binding) {
|
|
34
|
-
let id = value._subscribe(new ReactiveStyle(this, prop));
|
|
35
|
-
this.subscriptions[id] = value;
|
|
36
|
-
this.updateProp(prop, value._get());
|
|
37
|
-
}
|
|
38
|
-
else if (value instanceof VStyle) {
|
|
39
|
-
this.renderedSubBuilders.push(value);
|
|
40
|
-
value._render(this.target);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.updateProp(prop, value);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
updateProp(prop, value) {
|
|
47
|
-
if (this.target) {
|
|
48
|
-
this.target.style[prop] = value;
|
|
49
|
-
}
|
|
50
6
|
}
|
|
51
7
|
setProp(propName, value) {
|
|
52
8
|
if (this._isBase) {
|
|
@@ -54,60 +10,32 @@ export default class BaseVStyle extends VStyle {
|
|
|
54
10
|
return newStyle.setProp(propName, value);
|
|
55
11
|
}
|
|
56
12
|
else {
|
|
57
|
-
if (value && value.call && value.apply) {
|
|
58
|
-
let builder;
|
|
59
|
-
switch (propName) {
|
|
60
|
-
case "transform": {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case "filter":
|
|
64
|
-
case "backdrop-filter": {
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
default: throw new Error(`${propName} does not have a builder.`);
|
|
68
|
-
}
|
|
69
|
-
value(builder);
|
|
70
|
-
value = builder;
|
|
71
|
-
if (this.target) {
|
|
72
|
-
this.renderedSubBuilders.push(builder);
|
|
73
|
-
builder._render(this.target);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
if (this.target) {
|
|
78
|
-
let observerId = value.subscribeStyle(this, propName);
|
|
79
|
-
this.subscriptions[observerId] = value;
|
|
80
|
-
this.renderAndSetPropValue(propName, value);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
13
|
this.props.push({ prop: propName, value: value });
|
|
14
|
+
if (this.onUpdate)
|
|
15
|
+
this.onUpdate();
|
|
84
16
|
return this;
|
|
85
17
|
}
|
|
86
18
|
}
|
|
19
|
+
_setOnUpdate(callback) {
|
|
20
|
+
this.onUpdate = callback;
|
|
21
|
+
}
|
|
22
|
+
variable(name, value) {
|
|
23
|
+
if (!name.startsWith("--"))
|
|
24
|
+
name = "--" + name;
|
|
25
|
+
return this.setProp(name, value);
|
|
26
|
+
}
|
|
27
|
+
v(name) {
|
|
28
|
+
if (!name.startsWith("--"))
|
|
29
|
+
name = "--" + name;
|
|
30
|
+
return `var(${name})`;
|
|
31
|
+
}
|
|
32
|
+
getProps() {
|
|
33
|
+
return this.props;
|
|
34
|
+
}
|
|
87
35
|
}
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"length": "background-Size|block-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Image-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|gap|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|line-Height|flex-Basis|font-Size|text-Indent",
|
|
92
|
-
"url": "background-Image|border-Image|list-Style-Image|content|image-Orientation",
|
|
93
|
-
"transformation": "transform",
|
|
94
|
-
"filter": "filter|backdrop-Filter",
|
|
95
|
-
"misc": "all|appearance|aspect-Ratio|opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Outset|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex|flex-Basis|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Gap|grid-Column-Start|grid-Gap|grid-Row|grid-Row-End|grid-Row-Gap|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|letter-Spacing|line-Break|overflow-Wrap|tab-Size|text-Align|text-Align-Last|text-Combine-Upright|text-Justify|text-Transform|white-Space|word-Break|word-Spacing|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|border-Spacing|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Delay|animation-Direction|animation-Duration|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Duration|transition-Timing-Function|transition-Delay|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Offset|outline-Style|outline-Width|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Gap|column-Rule|column-Rule-Style|column-Rule-Width|column-Span|column-Width|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events",
|
|
36
|
+
for (let key in cssProps) {
|
|
37
|
+
BaseVStyle.prototype[key] = function (value) {
|
|
38
|
+
return this.setProp(key, value);
|
|
96
39
|
};
|
|
97
|
-
for (let k in _allProps) {
|
|
98
|
-
let str = _allProps[k];
|
|
99
|
-
let props = str.split("|");
|
|
100
|
-
let types = k.split("|");
|
|
101
|
-
for (let t in types) {
|
|
102
|
-
for (let i = 0; i < props.length; i++) {
|
|
103
|
-
let pName = props[i];
|
|
104
|
-
let cssName = pName.toLowerCase();
|
|
105
|
-
let jsName = pName.split("-").join("");
|
|
106
|
-
BaseVStyle.prototype[jsName] = function () {
|
|
107
|
-
return this.setProp(cssName, ...arguments);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
40
|
}
|
|
113
41
|
//# sourceMappingURL=base-v-style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-v-style.js","sourceRoot":"","sources":["../../src/v-style-nodes/base-v-style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-v-style.js","sourceRoot":"","sources":["../../src/v-style-nodes/base-v-style.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AAExC,MAAM,CAAC,OAAO,OAAO,UAAU;IAA/B;QAIkB,YAAO,GAAG,KAAK,CAAC;QACzB,UAAK,GAAwC,EAAE,CAAC;IA0CzD,CAAC;IAvCA,OAAO,CAAC,QAAgB,EAAE,KAAU;QACnC,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACzC;aACI;YACJ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAClD,IAAI,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;IAED,YAAY,CAAC,QAAoB;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAOD,QAAQ,CAAC,IAAY,EAAE,KAAU;QAChC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAOD,CAAC,CAAC,IAAY;QACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC/C,OAAO,OAAO,IAAI,GAAG,CAAC;IACvB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAGD,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE;IACzB,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,KAAU;QAG/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Binding from "../reactivity/binding";
|
|
2
2
|
export default abstract class CssFunctionBuilderVStyle {
|
|
3
|
-
simpleValue: string;
|
|
4
3
|
funcs: Array<{
|
|
5
4
|
func: string;
|
|
6
5
|
args: Array<{
|
|
@@ -9,8 +8,6 @@ export default abstract class CssFunctionBuilderVStyle {
|
|
|
9
8
|
}>;
|
|
10
9
|
}>;
|
|
11
10
|
readonly propName: string;
|
|
12
|
-
subscriptions: Record<number, Binding>;
|
|
13
|
-
target: HTMLElement;
|
|
14
11
|
constructor(propName: string);
|
|
15
12
|
toString(): string;
|
|
16
13
|
appendFunction(filter: string, args: any): this;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import Binding from "../reactivity/binding";
|
|
2
|
+
import Watcher from "../reactivity/watcher";
|
|
2
3
|
export default class CssFunctionBuilderVStyle {
|
|
3
4
|
constructor(propName) {
|
|
4
5
|
this.funcs = [];
|
|
5
|
-
this.subscriptions = {};
|
|
6
6
|
this.propName = propName;
|
|
7
7
|
}
|
|
8
8
|
toString() {
|
|
9
9
|
let result = "";
|
|
10
10
|
for (let t of this.funcs) {
|
|
11
|
-
let argValues = t.args.map(arg => {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
let argValues = Array.from(t.args).map(arg => {
|
|
12
|
+
let v = arg.v !== undefined ? arg.v : arg;
|
|
13
|
+
let f = arg.f || ((val) => `${val}`);
|
|
14
|
+
if (v instanceof Binding) {
|
|
15
|
+
return f(v._get());
|
|
16
|
+
}
|
|
17
|
+
else if (v instanceof Watcher) {
|
|
18
|
+
return f(v.value);
|
|
14
19
|
}
|
|
15
20
|
else {
|
|
16
|
-
return
|
|
21
|
+
return f(v).toString().split(" ").join(", ");
|
|
17
22
|
}
|
|
18
23
|
}).join(", ");
|
|
19
24
|
result += `${t.func}(${argValues}) `;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-function-builder-v-style.js","sourceRoot":"","sources":["../../src/v-style-nodes/css-function-builder-v-style.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"css-function-builder-v-style.js","sourceRoot":"","sources":["../../src/v-style-nodes/css-function-builder-v-style.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAgB,wBAAwB;IAQrD,YAAY,QAAgB;QAN5B,UAAK,GAGA,EAAE,CAAC;QAIP,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED,QAAQ;QACP,IAAI,MAAM,GAAG,EAAE,CAAC;QAGhB,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YACzB,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC5C,IAAI,CAAC,GAAI,GAAW,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAE,GAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC5D,IAAI,CAAC,GAAI,GAAW,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;gBAE9C,IAAI,CAAC,YAAY,OAAO,EAAE;oBACzB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;iBACnB;qBAAM,IAAI,CAAC,YAAY,OAAO,EAAE;oBAChC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAClB;qBACI;oBACJ,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC7C;YACF,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAGd,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,SAAS,IAAI,CAAC;SACrC;QAED,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,cAAc,CAAC,MAAc,EAAE,IAAI;QAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACb,CAAC;CAED"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import BaseVStyle from "./base-v-style";
|
|
2
|
+
export default class StyleSheetBuilder {
|
|
3
|
+
private rules;
|
|
4
|
+
class(name: string, callback: (s: BaseVStyle) => void): this;
|
|
5
|
+
rule(selector: string, callback: (s: BaseVStyle) => void): this;
|
|
6
|
+
v(name: string): string;
|
|
7
|
+
toString(): string;
|
|
8
|
+
hasRules(): boolean;
|
|
9
|
+
}
|