native-document 1.0.207 → 1.0.208

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.207",
3
+ "version": "1.0.208",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -118,8 +118,6 @@ FormControl.prototype.fields = function(fieldBuilder) {
118
118
  dirties.push(field.$description.isDirty);
119
119
  }
120
120
 
121
- console.log(dirties);
122
-
123
121
  $.computed(() => {
124
122
  const isDirty = dirties.some((item) => item.val());
125
123
  this.$description.isDirty.set(isDirty);
@@ -104,8 +104,9 @@ export const bindBooleanAttribute = (element, attributeName, value) => {
104
104
  const defaultValue = isObservable? value.val() : value;
105
105
 
106
106
  const attributeRealName = BOOL_ATTRIBUTES_NAME[attributeName] || attributeName;
107
+ const isBooleanHandling = typeof defaultValue === 'boolean' || defaultValue == null;
107
108
 
108
- if(typeof defaultValue === 'boolean') {
109
+ if(isBooleanHandling) {
109
110
  element[attributeRealName] = defaultValue;
110
111
  }
111
112
  else {
@@ -113,7 +114,7 @@ export const bindBooleanAttribute = (element, attributeName, value) => {
113
114
  }
114
115
  if(isObservable) {
115
116
  if(attributeName === 'checked') {
116
- if(typeof defaultValue === 'boolean') {
117
+ if(isBooleanHandling) {
117
118
  element.addEventListener('input', () => value.set(element[attributeRealName]));
118
119
  }
119
120
  else {
@@ -384,6 +384,7 @@ NDElement.prototype.with = function(methods) {
384
384
 
385
385
  return this;
386
386
  };
387
+ NDElement.prototype.expose = NDElement.prototype.with;
387
388
 
388
389
  /**
389
390
  * Sets a single attribute on the element.
@@ -99,7 +99,7 @@ export default function NativeFetch($baseUrl) {
99
99
 
100
100
  export const resolveData = (data) => {
101
101
  if(data?.__$Observable) {
102
- return data.resolve();
102
+ return data.val();
103
103
  }
104
104
  for(const key in data) {
105
105
  const value = data[key];
@@ -107,7 +107,7 @@ export const resolveData = (data) => {
107
107
  continue;
108
108
  }
109
109
  if(value.__$Observable) {
110
- data[key] = value.resolve();
110
+ data[key] = value.val();
111
111
  continue;
112
112
  }
113
113
  if(typeof value === 'object') {
@@ -22,6 +22,7 @@ export interface NDElement {
22
22
  ref(target: RefItem | Record<string, unknown>, name: string): this;
23
23
  refSelf(target: RefItem | Record<string, unknown>, name: string): this;
24
24
  with<T extends MethodsObject>(methods: T): this & ExtractMethods<T>;
25
+ expose<T extends MethodsObject>(methods: T): this & ExtractMethods<T>;
25
26
  extend(methods: MethodsObject): NDElement;
26
27
  extend<T extends MethodsObject>(
27
28
  methods: T