veles 0.0.3 → 0.0.5
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/dist/{jsx-runtime-C2XLvZ55.d.cts → fragment-CHmQ0MhU.d.cts} +6 -1
- package/dist/{jsx-runtime-C2XLvZ55.d.ts → fragment-CHmQ0MhU.d.ts} +6 -1
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +4 -3
- package/dist/jsx-runtime.d.cts +3255 -1
- package/dist/jsx-runtime.d.ts +3255 -1
- package/package.json +1 -1
|
@@ -248,10 +248,15 @@ type ComponentFunction = (
|
|
|
248
248
|
componentAPI: ComponentAPI
|
|
249
249
|
) => VelesElement | VelesComponent | string | null;
|
|
250
250
|
|
|
251
|
+
type AttributeHelper<T> = {
|
|
252
|
+
(htmlElement: HTMLElement, attributeName: string, node: VelesElement): T;
|
|
253
|
+
velesAttribute: boolean;
|
|
254
|
+
};
|
|
255
|
+
|
|
251
256
|
declare function createElement(element: string | ComponentFunction, props?: VelesElementProps): VelesElement | VelesComponent;
|
|
252
257
|
|
|
253
258
|
declare function Fragment({ children }: {
|
|
254
259
|
children: VelesChildren;
|
|
255
260
|
}): VelesComponent | VelesElement;
|
|
256
261
|
|
|
257
|
-
export { Fragment as F, type VelesElement as V, type VelesComponent as a, type VelesStringElement as b, createElement as c };
|
|
262
|
+
export { type AttributeHelper as A, Fragment as F, type VelesElement as V, type VelesComponent as a, type VelesStringElement as b, createElement as c, type VelesChildren as d };
|
|
@@ -248,10 +248,15 @@ type ComponentFunction = (
|
|
|
248
248
|
componentAPI: ComponentAPI
|
|
249
249
|
) => VelesElement | VelesComponent | string | null;
|
|
250
250
|
|
|
251
|
+
type AttributeHelper<T> = {
|
|
252
|
+
(htmlElement: HTMLElement, attributeName: string, node: VelesElement): T;
|
|
253
|
+
velesAttribute: boolean;
|
|
254
|
+
};
|
|
255
|
+
|
|
251
256
|
declare function createElement(element: string | ComponentFunction, props?: VelesElementProps): VelesElement | VelesComponent;
|
|
252
257
|
|
|
253
258
|
declare function Fragment({ children }: {
|
|
254
259
|
children: VelesChildren;
|
|
255
260
|
}): VelesComponent | VelesElement;
|
|
256
261
|
|
|
257
|
-
export { Fragment as F, type VelesElement as V, type VelesComponent as a, type VelesStringElement as b, createElement as c };
|
|
262
|
+
export { type AttributeHelper as A, Fragment as F, type VelesElement as V, type VelesComponent as a, type VelesStringElement as b, createElement as c, type VelesChildren as d };
|
package/dist/index.cjs
CHANGED
|
@@ -438,7 +438,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
438
438
|
return wrapperComponent;
|
|
439
439
|
},
|
|
440
440
|
useAttribute: (cb) => {
|
|
441
|
-
const attributeValue = cb ? cb(value) :
|
|
441
|
+
const attributeValue = cb ? cb(value) : value;
|
|
442
442
|
const attributeHelper = (htmlElement, attributeName, node) => {
|
|
443
443
|
const trackingElement = { cb, htmlElement, attributeName };
|
|
444
444
|
trackingAttributes.push(trackingElement);
|
|
@@ -518,7 +518,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
518
518
|
}
|
|
519
519
|
);
|
|
520
520
|
trackingAttributes.forEach(({ cb, htmlElement, attributeName }) => {
|
|
521
|
-
const newAttributeValue = cb ? cb(value) :
|
|
521
|
+
const newAttributeValue = cb ? cb(value) : value;
|
|
522
522
|
htmlElement.setAttribute(attributeName, newAttributeValue);
|
|
523
523
|
});
|
|
524
524
|
trackingEffects.forEach((trackingEffect) => {
|
|
@@ -528,6 +528,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
530
|
cb(newSelectedValue);
|
|
531
|
+
trackingEffect.selectedValue = newSelectedValue;
|
|
531
532
|
});
|
|
532
533
|
trackingIterators.forEach((trackingIterator) => {
|
|
533
534
|
const {
|
|
@@ -705,7 +706,7 @@ function combineState(...states) {
|
|
|
705
706
|
states.forEach((state) => {
|
|
706
707
|
state.trackValue(() => {
|
|
707
708
|
const updatedValue = states.map((state2) => state2.getValue());
|
|
708
|
-
combinedState.setValue(
|
|
709
|
+
combinedState.setValue(updatedValue);
|
|
709
710
|
});
|
|
710
711
|
});
|
|
711
712
|
return combinedState;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { V as VelesElement, a as VelesComponent, b as VelesStringElement } from './
|
|
2
|
-
export { F as Fragment, c as createElement } from './
|
|
1
|
+
import { V as VelesElement, a as VelesComponent, b as VelesStringElement, A as AttributeHelper } from './fragment-CHmQ0MhU.cjs';
|
|
2
|
+
export { F as Fragment, c as createElement } from './fragment-CHmQ0MhU.cjs';
|
|
3
3
|
|
|
4
4
|
declare function attachComponent({ htmlElement, component, }: {
|
|
5
5
|
htmlElement: HTMLElement;
|
|
6
6
|
component: VelesElement | VelesComponent;
|
|
7
7
|
}): () => void;
|
|
8
8
|
|
|
9
|
-
type AttributeHelper = {
|
|
10
|
-
(htmlElement: HTMLElement, attributeName: string, node: VelesElement): string;
|
|
11
|
-
velesAttribute: boolean;
|
|
12
|
-
};
|
|
13
9
|
type State<ValueType> = {
|
|
14
10
|
trackValue(cb: (value: ValueType) => void | Function, options?: {
|
|
15
11
|
callOnMount?: boolean;
|
|
@@ -23,7 +19,7 @@ type State<ValueType> = {
|
|
|
23
19
|
}): void;
|
|
24
20
|
useValue(cb?: (value: ValueType) => VelesElement | VelesComponent | string | undefined | null, comparator?: (value1: ValueType, value2: ValueType) => boolean): VelesElement | VelesComponent | VelesStringElement;
|
|
25
21
|
useValueSelector<SelectorValueType>(selector: (value: ValueType) => SelectorValueType, cb?: (value: SelectorValueType) => VelesElement | VelesComponent | string | undefined | null, comparator?: (value1: SelectorValueType, value2: SelectorValueType) => boolean): VelesElement | VelesComponent | VelesStringElement;
|
|
26
|
-
useAttribute(cb?: (value: ValueType) =>
|
|
22
|
+
useAttribute(cb?: (value: ValueType) => any): AttributeHelper<any>;
|
|
27
23
|
useValueIterator<Element>(options: {
|
|
28
24
|
key: string | ((options: {
|
|
29
25
|
element: Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { V as VelesElement, a as VelesComponent, b as VelesStringElement } from './
|
|
2
|
-
export { F as Fragment, c as createElement } from './
|
|
1
|
+
import { V as VelesElement, a as VelesComponent, b as VelesStringElement, A as AttributeHelper } from './fragment-CHmQ0MhU.js';
|
|
2
|
+
export { F as Fragment, c as createElement } from './fragment-CHmQ0MhU.js';
|
|
3
3
|
|
|
4
4
|
declare function attachComponent({ htmlElement, component, }: {
|
|
5
5
|
htmlElement: HTMLElement;
|
|
6
6
|
component: VelesElement | VelesComponent;
|
|
7
7
|
}): () => void;
|
|
8
8
|
|
|
9
|
-
type AttributeHelper = {
|
|
10
|
-
(htmlElement: HTMLElement, attributeName: string, node: VelesElement): string;
|
|
11
|
-
velesAttribute: boolean;
|
|
12
|
-
};
|
|
13
9
|
type State<ValueType> = {
|
|
14
10
|
trackValue(cb: (value: ValueType) => void | Function, options?: {
|
|
15
11
|
callOnMount?: boolean;
|
|
@@ -23,7 +19,7 @@ type State<ValueType> = {
|
|
|
23
19
|
}): void;
|
|
24
20
|
useValue(cb?: (value: ValueType) => VelesElement | VelesComponent | string | undefined | null, comparator?: (value1: ValueType, value2: ValueType) => boolean): VelesElement | VelesComponent | VelesStringElement;
|
|
25
21
|
useValueSelector<SelectorValueType>(selector: (value: ValueType) => SelectorValueType, cb?: (value: SelectorValueType) => VelesElement | VelesComponent | string | undefined | null, comparator?: (value1: SelectorValueType, value2: SelectorValueType) => boolean): VelesElement | VelesComponent | VelesStringElement;
|
|
26
|
-
useAttribute(cb?: (value: ValueType) =>
|
|
22
|
+
useAttribute(cb?: (value: ValueType) => any): AttributeHelper<any>;
|
|
27
23
|
useValueIterator<Element>(options: {
|
|
28
24
|
key: string | ((options: {
|
|
29
25
|
element: Element;
|
package/dist/index.js
CHANGED
|
@@ -151,7 +151,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
151
151
|
return wrapperComponent;
|
|
152
152
|
},
|
|
153
153
|
useAttribute: (cb) => {
|
|
154
|
-
const attributeValue = cb ? cb(value) :
|
|
154
|
+
const attributeValue = cb ? cb(value) : value;
|
|
155
155
|
const attributeHelper = (htmlElement, attributeName, node) => {
|
|
156
156
|
const trackingElement = { cb, htmlElement, attributeName };
|
|
157
157
|
trackingAttributes.push(trackingElement);
|
|
@@ -231,7 +231,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
231
231
|
}
|
|
232
232
|
);
|
|
233
233
|
trackingAttributes.forEach(({ cb, htmlElement, attributeName }) => {
|
|
234
|
-
const newAttributeValue = cb ? cb(value) :
|
|
234
|
+
const newAttributeValue = cb ? cb(value) : value;
|
|
235
235
|
htmlElement.setAttribute(attributeName, newAttributeValue);
|
|
236
236
|
});
|
|
237
237
|
trackingEffects.forEach((trackingEffect) => {
|
|
@@ -241,6 +241,7 @@ function createState(initialValue, subscribeCallback) {
|
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
cb(newSelectedValue);
|
|
244
|
+
trackingEffect.selectedValue = newSelectedValue;
|
|
244
245
|
});
|
|
245
246
|
trackingIterators.forEach((trackingIterator) => {
|
|
246
247
|
const {
|
|
@@ -418,7 +419,7 @@ function combineState(...states) {
|
|
|
418
419
|
states.forEach((state) => {
|
|
419
420
|
state.trackValue(() => {
|
|
420
421
|
const updatedValue = states.map((state2) => state2.getValue());
|
|
421
|
-
combinedState.setValue(
|
|
422
|
+
combinedState.setValue(updatedValue);
|
|
422
423
|
});
|
|
423
424
|
});
|
|
424
425
|
return combinedState;
|