Skip to content

Commit

Permalink
Update dependencies, fix errors, various adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
RSSchermer committed Mar 22, 2022
1 parent 9a3ec85 commit 365bb68
Show file tree
Hide file tree
Showing 127 changed files with 509 additions and 365 deletions.
17 changes: 8 additions & 9 deletions arwa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.1"
description = "A Rusty interface around the web-sys APIs."
keywords = ["web", "wasm"]
authors = ["RSSchermer <roland0507@gmail.com>"]
edition = "2018"
edition = "2021"
repository = "https://github.com/RSSchermer/ARWA"
homepage = "https://github.com/RSSchermer/ARWA"
license = "MIT"
Expand All @@ -13,20 +13,19 @@ readme = "../README.md"
[dependencies]
arwa_macro = { version = "0.1.0", path = "../arwa_macro" }
arwa_parse = { version = "0.1.0", path = "../arwa_parse" }
bitflags = "1.2.1"
delegate = "0.3.0"
bitflags = "1.3.2"
delegate = "0.6.2"
form_urlencoded = "1.0.1"
futures = "0.3.19"
js-sys = "0.3.55"
futures = "0.3.21"
js-sys = "0.3.56"
lazycell = "1.3.0"
lazy_static = "1.4.0"
mime_4 = { version = "0.4.0-a.0", features = ["macro"] }
oxilangtag = "0.1.2"
wasm-bindgen = "0.2.78"
wasm-bindgen-futures = "0.4.28"
wasm-bindgen = "0.2.79"
wasm-bindgen-futures = "0.4.29"

[dependencies.web-sys]
version = "0.3.55"
version = "0.3.56"
features = [
"console",
"AbortController",
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/animation/animation_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ macro_rules! animation_event {

impl<T> AnimationEvent for $event<T> {
delegate! {
target self.inner {
to self.inner {
fn animation_name(&self) -> String;

fn elapsed_time(&self) -> f32;
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_counter_style_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct CssCounterStyleRule {

impl CssCounterStyleRule {
delegate! {
target self.inner {
to self.inner {
pub fn name(&self) -> String;

pub fn set_name(&self, value: &str);
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_font_feature_values_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct CssFontFeatureValuesRule {

impl CssFontFeatureValuesRule {
delegate! {
target self.inner {
to self.inner {
pub fn font_family(&self) -> String;

pub fn set_font_family(&self, value: &str);
Expand Down
14 changes: 8 additions & 6 deletions arwa/src/cssom/css_grouping_rule.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use wasm_bindgen::{JsCast, UnwrapThrowExt};
use wasm_bindgen::{throw_val, JsCast};

use crate::collection::{Collection, Sequence};
use crate::cssom::{DynamicCssRule, InsertRuleError, RemoveRuleError};
Expand Down Expand Up @@ -28,10 +28,10 @@ pub struct CssGroupedRules {
}

impl CssGroupedRules {
pub fn insert(&self, index: u32, rule: &str) -> u32 {
self.grouping_rule
.insert_rule_with_index(rule, index)
.unwrap_throw()
pub fn insert(&self, index: u32, rule: &str) {
if let Err(err) = self.grouping_rule.insert_rule_with_index(rule, index) {
throw_val(err)
}
}

pub fn try_insert(&self, index: u32, rule: &str) -> Result<u32, InsertRuleError> {
Expand All @@ -41,7 +41,9 @@ impl CssGroupedRules {
}

pub fn remove(&self, index: u32) {
self.grouping_rule.delete_rule(index).unwrap_throw();
if let Err(err) = self.grouping_rule.delete_rule(index) {
throw_val(err)
}
}

pub fn try_remove(&self, index: u32) -> Result<(), RemoveRuleError> {
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_import_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct CssImportRule {

impl CssImportRule {
delegate! {
target self.inner {
to self.inner {
pub fn href(&self) -> String;
}
}
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_keyframe_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct CssKeyframeRule {

impl CssKeyframeRule {
delegate! {
target self.inner {
to self.inner {
pub fn key_text(&self) -> String;

pub fn set_key_text(&self, value: &str);
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_keyframes_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct CssKeyframesRule {

impl CssKeyframesRule {
delegate! {
target self.inner {
to self.inner {
pub fn name(&self) -> String;

pub fn set_name(&self, value: &str);
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_namespace_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct CssNamespaceRule {

impl CssNamespaceRule {
delegate! {
target self.inner {
to self.inner {
pub fn namespace_uri(&self) -> String;

pub fn prefix(&self) -> String;
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ macro_rules! impl_css_rule_traits {
}
}

impl std::convert::TryFrom<$crate::cssom::DynamicCssRule> for $rule {
impl TryFrom<$crate::cssom::DynamicCssRule> for $rule {
type Error = $crate::InvalidCast<$crate::cssom::DynamicCssRule, $rule>;

fn try_from(value: $crate::cssom::DynamicCssRule) -> Result<Self, Self::Error> {
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/css_style_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl CssStyleRule {
// cssom::Selector would always be valid.

delegate! {
target self.inner {
to self.inner {
pub fn selector_text(&self) -> String;

pub fn set_selector_text(&self, value: &str);
Expand Down
21 changes: 14 additions & 7 deletions arwa/src/cssom/css_style_sheet.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use wasm_bindgen::{JsCast, UnwrapThrowExt};
use wasm_bindgen::{throw_val, JsCast};

use crate::collection::{Collection, Sequence};
use crate::cssom::{CssImportRule, DynamicCssRule, InsertRuleError, RemoveRuleError};
Expand Down Expand Up @@ -60,9 +60,14 @@ impl CssStyleSheet {
}

pub fn resolve_rules(&self) -> CssStyleSheetRules {
let rules = match self.inner.css_rules() {
Ok(rules) => rules,
Err(err) => throw_val(err),
};

CssStyleSheetRules {
style_sheet: self.inner.clone(),
rules: self.inner.css_rules().unwrap_throw(),
rules,
}
}

Expand Down Expand Up @@ -100,10 +105,10 @@ pub struct CssStyleSheetRules {
}

impl CssStyleSheetRules {
pub fn insert(&self, index: u32, rule: &str) -> u32 {
self.style_sheet
.insert_rule_with_index(rule, index)
.unwrap_throw()
pub fn insert(&self, index: u32, rule: &str) {
if let Err(err) = self.style_sheet.insert_rule_with_index(rule, index) {
throw_val(err)
}
}

pub fn try_insert(&self, index: u32, rule: &str) -> Result<u32, InsertRuleError> {
Expand All @@ -113,7 +118,9 @@ impl CssStyleSheetRules {
}

pub fn remove(&self, index: u32) {
self.style_sheet.delete_rule(index).unwrap_throw();
if let Err(err) = self.style_sheet.delete_rule(index) {
throw_val(err)
}
}

pub fn try_remove(&self, index: u32) -> Result<(), RemoveRuleError> {
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/cssom/transition/transition_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ macro_rules! transition_event {

impl<T> TransitionEvent for $event<T> {
delegate! {
target self.inner {
to self.inner {
fn property_name(&self) -> String;

fn elapsed_time(&self) -> f32;
Expand Down
2 changes: 1 addition & 1 deletion arwa/src/dom/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl Attribute {
}

delegate! {
target self.inner {
to self.inner {
pub fn namespace_uri(&self) -> Option<String>;

pub fn value(&self) -> String;
Expand Down
48 changes: 30 additions & 18 deletions arwa/src/dom/child_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ macro_rules! impl_child_node_for_element {
T: $crate::dom::ChildNode,
{
use crate::dom::element_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_element()
if let Err(err) = self
.as_web_sys_element()
.replace_with_with_node_1(replacement.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_replace_with<T>(
Expand All @@ -131,11 +133,13 @@ macro_rules! impl_child_node_for_element {
T: $crate::dom::ChildNode,
{
use crate::dom::element_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_element()
if let Err(err) = self
.as_web_sys_element()
.before_with_node_1(node.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_before_insert_node<T>(
Expand Down Expand Up @@ -170,11 +174,13 @@ macro_rules! impl_child_node_for_element {
T: $crate::dom::ChildNode,
{
use crate::dom::element_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_element()
if let Err(err) = self
.as_web_sys_element()
.after_with_node_1(node.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_after_insert_node<T>(
Expand Down Expand Up @@ -229,11 +235,13 @@ macro_rules! impl_child_node_for_character_data {
T: $crate::dom::ChildNode,
{
use crate::dom::character_data_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_character_data()
if let Err(err) = self
.as_web_sys_character_data()
.replace_with_with_node_1(replacement.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_replace_with<T>(
Expand All @@ -255,11 +263,13 @@ macro_rules! impl_child_node_for_character_data {
T: $crate::dom::ChildNode,
{
use crate::dom::character_data_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_character_data()
if let Err(err) = self
.as_web_sys_character_data()
.before_with_node_1(node.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_before_insert_node<T>(
Expand Down Expand Up @@ -294,11 +304,13 @@ macro_rules! impl_child_node_for_character_data {
T: $crate::dom::ChildNode,
{
use crate::dom::character_data_seal::Seal;
use wasm_bindgen::UnwrapThrowExt;

self.as_web_sys_character_data()
if let Err(err) = self
.as_web_sys_character_data()
.after_with_node_1(node.as_web_sys_node())
.unwrap_throw();
{
wasm_bindgen::throw_val(err)
}
}

fn try_after_insert_node<T>(
Expand Down
37 changes: 23 additions & 14 deletions arwa/src/dom/document.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use wasm_bindgen::{JsCast, UnwrapThrowExt};
use wasm_bindgen::{throw_val, JsCast, UnwrapThrowExt};

use crate::connection::{connection_event_target_seal, ConnectionEventTarget};
use crate::cssom::{styled_seal, StyleSheets, Styled};
Expand Down Expand Up @@ -187,10 +187,13 @@ pub trait Document: document_seal::Seal + Sized {
qualified_name: &QualifiedName,
namespace: &str,
) -> Attribute {
self.as_web_sys_document()
match self
.as_web_sys_document()
.create_attribute_ns(Some(namespace), qualified_name.as_ref())
.unwrap_throw()
.into()
{
Ok(attr) => attr.into(),
Err(err) => throw_val(err),
}
}

fn try_create_attribute_namespaced(
Expand All @@ -216,10 +219,13 @@ pub trait Document: document_seal::Seal + Sized {
qualified_name: &QualifiedName,
namespace: &str,
) -> DynamicElement {
self.as_web_sys_document()
match self
.as_web_sys_document()
.create_element_ns(Some(namespace), qualified_name.as_ref())
.unwrap_throw()
.into()
{
Ok(element) => element.into(),
Err(err) => throw_val(err),
}
}

fn try_create_element_namespaced(
Expand All @@ -235,10 +241,10 @@ pub trait Document: document_seal::Seal + Sized {

#[allow(non_snake_case)]
fn create_CDATA_section(&self, data: &str) -> CDataSection {
self.as_web_sys_document()
.create_cdata_section(data)
.unwrap_throw()
.into()
match self.as_web_sys_document().create_cdata_section(data) {
Ok(cdata) => cdata.into(),
Err(err) => throw_val(err),
}
}

#[allow(non_snake_case)]
Expand All @@ -254,10 +260,13 @@ pub trait Document: document_seal::Seal + Sized {
}

fn create_processing_instruction(&self, target: &str, data: &str) -> ProcessingInstruction {
self.as_web_sys_document()
match self
.as_web_sys_document()
.create_processing_instruction(target, data)
.unwrap_throw()
.into()
{
Ok(instruction) => instruction.into(),
Err(err) => throw_val(err),
}
}

fn try_create_processing_instruction(
Expand Down
Loading

0 comments on commit 365bb68

Please sign in to comment.