fix most typos, add crate-ci/typos to CI (#2653)
* fix most typos, add crate-ci/typos to CI --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
841b447d2a
commit
9167cd9dec
83 files changed
+258
-203
No files matched your search
@@ -1 +1 @@
|
||||
[6449103750905854967, 12029349297046688094, 14626980229647476238, 8716623267269178440, 5336385715226370016, 14456089431355876478, 3589298972260118311, 5052021921702764563, 2745859031945642653, 5638004933879392817]
|
||||
[6449103750905854967, 12029349297046688094, 13069001215487072322, 8716623267269178440, 5336385715226370016, 14456089431355876478, 17683787366271106808, 5052021921702764563, 16478152596505612522, 5638004933879392817]
|
||||
@@ -1 +1 @@
|
||||
function retriveValues(event,target){let contents={values:{}},form=target.closest("form");if(form){if(event.type==="input"||event.type==="change"||event.type==="submit"||event.type==="reset"||event.type==="click")contents=retrieveFormValues(form)}return contents}function retrieveFormValues(form){const formData=new FormData(form),contents={};return formData.forEach((value,key)=>{if(contents[key])contents[key].push(value);else contents[key]=[value]}),{valid:form.checkValidity(),values:contents}}function retriveSelectValue(target){let options=target.selectedOptions,values=[];for(let i=0;i<options.length;i++)values.push(options[i].value);return values}function serializeEvent(event,target){let contents={},extend=(obj)=>contents={...contents,...obj};if(event instanceof WheelEvent)extend(serializeWheelEvent(event));if(event instanceof MouseEvent)extend(serializeMouseEvent(event));if(event instanceof KeyboardEvent)extend(serializeKeyboardEvent(event));if(event instanceof InputEvent)extend(serializeInputEvent(event,target));if(event instanceof PointerEvent)extend(serializePointerEvent(event));if(event instanceof AnimationEvent)extend(serializeAnimationEvent(event));if(event instanceof TransitionEvent)extend({property_name:event.propertyName,elapsed_time:event.elapsedTime,pseudo_element:event.pseudoElement});if(event instanceof CompositionEvent)extend({data:event.data});if(event instanceof DragEvent)extend(serializeDragEvent(event));if(event instanceof FocusEvent)extend({});if(event instanceof ClipboardEvent)extend({});if(typeof TouchEvent!=="undefined"&&event instanceof TouchEvent)extend(serializeTouchEvent(event));if(event.type==="submit"||event.type==="reset"||event.type==="click"||event.type==="change"||event.type==="input")extend(serializeInputEvent(event,target));if(event instanceof DragEvent);return contents}var serializeInputEvent=function(event,target){let contents={};if(target instanceof HTMLElement){let values=retriveValues(event,target);contents.values=values.values,contents.valid=values.valid}if(event.target instanceof HTMLInputElement){let target2=event.target,value=target2.value??target2.textContent??"";if(target2.type==="checkbox")value=target2.checked?"true":"false";else if(target2.type==="radio")value=target2.value;contents.value=value}if(event.target instanceof HTMLTextAreaElement)contents.value=event.target.value;if(event.target instanceof HTMLSelectElement)contents.value=retriveSelectValue(event.target).join(",");if(contents.value===void 0)contents.value="";return contents},serializeWheelEvent=function(event){return{delta_x:event.deltaX,delta_y:event.deltaY,delta_z:event.deltaZ,delta_mode:event.deltaMode}},serializeTouchEvent=function(event){return{alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,shift_key:event.shiftKey,changed_touches:event.changedTouches,target_touches:event.targetTouches,touches:event.touches}},serializePointerEvent=function(event){return{alt_key:event.altKey,button:event.button,buttons:event.buttons,client_x:event.clientX,client_y:event.clientY,ctrl_key:event.ctrlKey,meta_key:event.metaKey,page_x:event.pageX,page_y:event.pageY,screen_x:event.screenX,screen_y:event.screenY,shift_key:event.shiftKey,pointer_id:event.pointerId,width:event.width,height:event.height,pressure:event.pressure,tangential_pressure:event.tangentialPressure,tilt_x:event.tiltX,tilt_y:event.tiltY,twist:event.twist,pointer_type:event.pointerType,is_primary:event.isPrimary}},serializeMouseEvent=function(event){return{alt_key:event.altKey,button:event.button,buttons:event.buttons,client_x:event.clientX,client_y:event.clientY,ctrl_key:event.ctrlKey,meta_key:event.metaKey,offset_x:event.offsetX,offset_y:event.offsetY,page_x:event.pageX,page_y:event.pageY,screen_x:event.screenX,screen_y:event.screenY,shift_key:event.shiftKey}},serializeKeyboardEvent=function(event){return{char_code:event.charCode,is_composing:event.isComposing,key:event.key,alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,key_code:event.keyCode,shift_key:event.shiftKey,location:event.location,repeat:event.repeat,which:event.which,code:event.code}},serializeAnimationEvent=function(event){return{animation_name:event.animationName,elapsed_time:event.elapsedTime,pseudo_element:event.pseudoElement}},serializeDragEvent=function(event){let files=void 0;if(event.dataTransfer&&event.dataTransfer.files&&event.dataTransfer.files.length>0)files={files:{placeholder:[]}};return{mouse:{alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,shift_key:event.shiftKey,...serializeMouseEvent(event)},files}};var getTargetId=function(target){if(!(target instanceof Node))return null;let ourTarget=target,realId=null;while(realId==null){if(ourTarget===null)return null;if(ourTarget instanceof Element)realId=ourTarget.getAttribute("data-dioxus-id");ourTarget=ourTarget.parentNode}return parseInt(realId)},JSChannel_;if(RawInterpreter!==void 0&&RawInterpreter!==null)JSChannel_=RawInterpreter;class NativeInterpreter extends JSCLine truncated
|
||||
function retrieveValues(event,target){let contents={values:{}},form=target.closest("form");if(form){if(event.type==="input"||event.type==="change"||event.type==="submit"||event.type==="reset"||event.type==="click")contents=retrieveFormValues(form)}return contents}function retrieveFormValues(form){const formData=new FormData(form),contents={};return formData.forEach((value,key)=>{if(contents[key])contents[key].push(value);else contents[key]=[value]}),{valid:form.checkValidity(),values:contents}}function retrieveSelectValue(target){let options=target.selectedOptions,values=[];for(let i=0;i<options.length;i++)values.push(options[i].value);return values}function serializeEvent(event,target){let contents={},extend=(obj)=>contents={...contents,...obj};if(event instanceof WheelEvent)extend(serializeWheelEvent(event));if(event instanceof MouseEvent)extend(serializeMouseEvent(event));if(event instanceof KeyboardEvent)extend(serializeKeyboardEvent(event));if(event instanceof InputEvent)extend(serializeInputEvent(event,target));if(event instanceof PointerEvent)extend(serializePointerEvent(event));if(event instanceof AnimationEvent)extend(serializeAnimationEvent(event));if(event instanceof TransitionEvent)extend({property_name:event.propertyName,elapsed_time:event.elapsedTime,pseudo_element:event.pseudoElement});if(event instanceof CompositionEvent)extend({data:event.data});if(event instanceof DragEvent)extend(serializeDragEvent(event));if(event instanceof FocusEvent)extend({});if(event instanceof ClipboardEvent)extend({});if(typeof TouchEvent!=="undefined"&&event instanceof TouchEvent)extend(serializeTouchEvent(event));if(event.type==="submit"||event.type==="reset"||event.type==="click"||event.type==="change"||event.type==="input")extend(serializeInputEvent(event,target));if(event instanceof DragEvent);return contents}var serializeInputEvent=function(event,target){let contents={};if(target instanceof HTMLElement){let values=retrieveValues(event,target);contents.values=values.values,contents.valid=values.valid}if(event.target instanceof HTMLInputElement){let target2=event.target,value=target2.value??target2.textContent??"";if(target2.type==="checkbox")value=target2.checked?"true":"false";else if(target2.type==="radio")value=target2.value;contents.value=value}if(event.target instanceof HTMLTextAreaElement)contents.value=event.target.value;if(event.target instanceof HTMLSelectElement)contents.value=retrieveSelectValue(event.target).join(",");if(contents.value===void 0)contents.value="";return contents},serializeWheelEvent=function(event){return{delta_x:event.deltaX,delta_y:event.deltaY,delta_z:event.deltaZ,delta_mode:event.deltaMode}},serializeTouchEvent=function(event){return{alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,shift_key:event.shiftKey,changed_touches:event.changedTouches,target_touches:event.targetTouches,touches:event.touches}},serializePointerEvent=function(event){return{alt_key:event.altKey,button:event.button,buttons:event.buttons,client_x:event.clientX,client_y:event.clientY,ctrl_key:event.ctrlKey,meta_key:event.metaKey,page_x:event.pageX,page_y:event.pageY,screen_x:event.screenX,screen_y:event.screenY,shift_key:event.shiftKey,pointer_id:event.pointerId,width:event.width,height:event.height,pressure:event.pressure,tangential_pressure:event.tangentialPressure,tilt_x:event.tiltX,tilt_y:event.tiltY,twist:event.twist,pointer_type:event.pointerType,is_primary:event.isPrimary}},serializeMouseEvent=function(event){return{alt_key:event.altKey,button:event.button,buttons:event.buttons,client_x:event.clientX,client_y:event.clientY,ctrl_key:event.ctrlKey,meta_key:event.metaKey,offset_x:event.offsetX,offset_y:event.offsetY,page_x:event.pageX,page_y:event.pageY,screen_x:event.screenX,screen_y:event.screenY,shift_key:event.shiftKey}},serializeKeyboardEvent=function(event){return{char_code:event.charCode,is_composing:event.isComposing,key:event.key,alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,key_code:event.keyCode,shift_key:event.shiftKey,location:event.location,repeat:event.repeat,which:event.which,code:event.code}},serializeAnimationEvent=function(event){return{animation_name:event.animationName,elapsed_time:event.elapsedTime,pseudo_element:event.pseudoElement}},serializeDragEvent=function(event){let files=void 0;if(event.dataTransfer&&event.dataTransfer.files&&event.dataTransfer.files.length>0)files={files:{placeholder:[]}};return{mouse:{alt_key:event.altKey,ctrl_key:event.ctrlKey,meta_key:event.metaKey,shift_key:event.shiftKey,...serializeMouseEvent(event)},files}};var getTargetId=function(target){if(!(target instanceof Node))return null;let ourTarget=target,realId=null;while(realId==null){if(ourTarget===null)return null;if(ourTarget instanceof Element)realId=ourTarget.getAttribute("data-dioxus-id");ourTarget=ourTarget.parentNode}return parseInt(realId)},JSChannel_;if(RawInterpreter!==void 0&&RawInterpreter!==null)JSChannel_=RawInterpreter;class NativeInterpreter extendsLine truncated
|
||||
@@ -5,7 +5,7 @@ type FormValues = {
|
||||
values: { [key: string]: FormDataEntryValue[] };
|
||||
}
|
||||
|
||||
export function retriveValues(event: Event, target: HTMLElement): FormValues {
|
||||
export function retrieveValues(event: Event, target: HTMLElement): FormValues {
|
||||
let contents: FormValues = {
|
||||
values: {}
|
||||
};
|
||||
@@ -47,7 +47,7 @@ export function retrieveFormValues(form: HTMLFormElement): FormValues {
|
||||
};
|
||||
}
|
||||
|
||||
export function retriveSelectValue(target: HTMLSelectElement): string[] {
|
||||
export function retrieveSelectValue(target: HTMLSelectElement): string[] {
|
||||
// there might be multiple...
|
||||
let options = target.selectedOptions;
|
||||
let values = [];
|
||||
|
||||
@@ -7,7 +7,7 @@ import { BaseInterpreter, NodeId } from "./core";
|
||||
import { SerializedEvent, serializeEvent } from "./serialize";
|
||||
|
||||
// okay so, we've got this JSChannel thing from sledgehammer, implicitly imported into our scope
|
||||
// we want to extend it, and it technically extends base intepreter. To make typescript happy,
|
||||
// we want to extend it, and it technically extends base interpreter. To make typescript happy,
|
||||
// we're going to bind the JSChannel_ object to the JSChannel object, and then extend it
|
||||
var JSChannel_: typeof BaseInterpreter;
|
||||
|
||||
@@ -209,7 +209,7 @@ export class NativeInterpreter extends JSChannel_ {
|
||||
// Liveview will still need to use this
|
||||
this.preventDefaults(event, target);
|
||||
|
||||
// liveview does not have syncronous event handling, so we need to send the event to the host
|
||||
// liveview does not have synchronous event handling, so we need to send the event to the host
|
||||
if (this.liveview) {
|
||||
// Okay, so the user might've requested some files to be read
|
||||
if (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Handle serialization of the event data across the IPC boundarytype SerialziedEvent = {};
|
||||
// Handle serialization of the event data across the IPC boundarytype SerializedEvent = {};
|
||||
|
||||
import { retriveSelectValue, retriveValues } from "./form";
|
||||
import { retrieveSelectValue, retrieveValues } from "./form";
|
||||
|
||||
export type AppTouchEvent = TouchEvent;
|
||||
|
||||
@@ -10,29 +10,66 @@ export type SerializedEvent = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export function serializeEvent(event: Event, target: EventTarget): SerializedEvent {
|
||||
export function serializeEvent(
|
||||
event: Event,
|
||||
target: EventTarget
|
||||
): SerializedEvent {
|
||||
let contents = {};
|
||||
|
||||
// merge the object into the contents
|
||||
let extend = (obj: any) => (contents = { ...contents, ...obj });
|
||||
|
||||
if (event instanceof WheelEvent) { extend(serializeWheelEvent(event)) };
|
||||
if (event instanceof MouseEvent) { extend(serializeMouseEvent(event)) }
|
||||
if (event instanceof KeyboardEvent) { extend(serializeKeyboardEvent(event)) }
|
||||
if (event instanceof WheelEvent) {
|
||||
extend(serializeWheelEvent(event));
|
||||
}
|
||||
if (event instanceof MouseEvent) {
|
||||
extend(serializeMouseEvent(event));
|
||||
}
|
||||
if (event instanceof KeyboardEvent) {
|
||||
extend(serializeKeyboardEvent(event));
|
||||
}
|
||||
|
||||
if (event instanceof InputEvent) { extend(serializeInputEvent(event, target)) }
|
||||
if (event instanceof PointerEvent) { extend(serializePointerEvent(event)) }
|
||||
if (event instanceof AnimationEvent) { extend(serializeAnimationEvent(event)) }
|
||||
if (event instanceof TransitionEvent) { extend({ property_name: event.propertyName, elapsed_time: event.elapsedTime, pseudo_element: event.pseudoElement, }) }
|
||||
if (event instanceof CompositionEvent) { extend({ data: event.data, }) }
|
||||
if (event instanceof DragEvent) { extend(serializeDragEvent(event)) }
|
||||
if (event instanceof FocusEvent) { extend({}) }
|
||||
if (event instanceof ClipboardEvent) { extend({}) }
|
||||
if (event instanceof InputEvent) {
|
||||
extend(serializeInputEvent(event, target));
|
||||
}
|
||||
if (event instanceof PointerEvent) {
|
||||
extend(serializePointerEvent(event));
|
||||
}
|
||||
if (event instanceof AnimationEvent) {
|
||||
extend(serializeAnimationEvent(event));
|
||||
}
|
||||
if (event instanceof TransitionEvent) {
|
||||
extend({
|
||||
property_name: event.propertyName,
|
||||
elapsed_time: event.elapsedTime,
|
||||
pseudo_element: event.pseudoElement,
|
||||
});
|
||||
}
|
||||
if (event instanceof CompositionEvent) {
|
||||
extend({ data: event.data });
|
||||
}
|
||||
if (event instanceof DragEvent) {
|
||||
extend(serializeDragEvent(event));
|
||||
}
|
||||
if (event instanceof FocusEvent) {
|
||||
extend({});
|
||||
}
|
||||
if (event instanceof ClipboardEvent) {
|
||||
extend({});
|
||||
}
|
||||
|
||||
// safari is quirky and doesn't have TouchEvent
|
||||
if (typeof TouchEvent !== 'undefined' && event instanceof TouchEvent) { extend(serializeTouchEvent(event)); }
|
||||
if (typeof TouchEvent !== "undefined" && event instanceof TouchEvent) {
|
||||
extend(serializeTouchEvent(event));
|
||||
}
|
||||
|
||||
if (event.type === "submit" || event.type === "reset" || event.type === "click" || event.type === "change" || event.type === "input") {
|
||||
if (
|
||||
event.type === "submit" ||
|
||||
event.type === "reset" ||
|
||||
event.type === "click" ||
|
||||
event.type === "change" ||
|
||||
event.type === "input"
|
||||
) {
|
||||
extend(serializeInputEvent(event as InputEvent, target));
|
||||
}
|
||||
|
||||
@@ -59,12 +96,15 @@ export function serializeEvent(event: Event, target: EventTarget): SerializedEve
|
||||
return contents;
|
||||
}
|
||||
|
||||
function serializeInputEvent(event: InputEvent, target: EventTarget): SerializedEvent {
|
||||
function serializeInputEvent(
|
||||
event: InputEvent,
|
||||
target: EventTarget
|
||||
): SerializedEvent {
|
||||
let contents: SerializedEvent = {};
|
||||
|
||||
// Attempt to retrieve the values from the form
|
||||
if (target instanceof HTMLElement) {
|
||||
let values = retriveValues(event, target);
|
||||
let values = retrieveValues(event, target);
|
||||
contents.values = values.values;
|
||||
contents.valid = values.valid;
|
||||
}
|
||||
@@ -87,7 +127,7 @@ function serializeInputEvent(event: InputEvent, target: EventTarget): Serialized
|
||||
}
|
||||
|
||||
if (event.target instanceof HTMLSelectElement) {
|
||||
contents.value = retriveSelectValue(event.target).join(",");
|
||||
contents.value = retrieveSelectValue(event.target).join(",");
|
||||
}
|
||||
|
||||
// Ensure the serializer isn't quirky
|
||||
@@ -95,12 +135,9 @@ function serializeInputEvent(event: InputEvent, target: EventTarget): Serialized
|
||||
contents.value = "";
|
||||
}
|
||||
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function serializeWheelEvent(event: WheelEvent): SerializedEvent {
|
||||
return {
|
||||
delta_x: event.deltaX,
|
||||
|
||||
Reference in new issue
Block a user