-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Move meter data to definition package
Moves the meter data types from the legacy_definition package to the definition package. This change simplifies the codebase by removing the redundant legacy_definition package. Additionally, this change refactors the DesignCompose code to use the new meter data types. # Conflicts: # crates/figma_import/tests/layout-unit-tests.dcf # designcompose/src/main/assets/figma/DesignSwitcherDoc_Ljph4e3sC0lHcynfXpoh9f.dcf # integration-tests/validation/src/main/assets/figma/AlignmentTestDoc_JIjE9oKQbq8ipi66ab5UaK.dcf # integration-tests/validation/src/main/assets/figma/BattleshipDoc_RfGl9SWnBEvdg8T1Ex6ZAR.dcf # integration-tests/validation/src/main/assets/figma/BlendModeTestDoc_ZqX5i5g6inv9tANIwMMXUV.dcf # integration-tests/validation/src/main/assets/figma/ComponentReplaceDoc_bQVVy2GSZJ8veYaJUrG6Ni.dcf # integration-tests/validation/src/main/assets/figma/ComponentReplaceRelayoutDoc_qIh0IOQTCtgeAWZFF5gYSk.dcf # integration-tests/validation/src/main/assets/figma/DialsGaugesTestDoc_lZj6E9GtIQQE4HNLpzgETw.dcf # integration-tests/validation/src/main/assets/figma/FancyFillTestDoc_xQ9cunHt8VUm6xqJJ2Pjb2.dcf # integration-tests/validation/src/main/assets/figma/GridLayoutDoc_MBNjjSbzzKeN7nBjVoewsl.dcf # integration-tests/validation/src/main/assets/figma/GridLayoutTestDoc_JOSOEvsrjvMqanyQa5OpNR.dcf # integration-tests/validation/src/main/assets/figma/GridWidgetTestDoc_OBhNItd9i9J2LwVYuLxEIx.dcf # integration-tests/validation/src/main/assets/figma/HelloVersionDoc_v62Vwlxa4Bb6nopJiAxQAQ_5668177823.dcf # integration-tests/validation/src/main/assets/figma/ImageUpdateTestDoc_oQw7kiy94fvdVouCYBC9T0.dcf # integration-tests/validation/src/main/assets/figma/InteractionTestDoc_8Zg9viyjYTnyN29pbkR1CE.dcf # integration-tests/validation/src/main/assets/figma/LayoutReplacementTestDoc_dwk2GF7RiNvlbbAKPjqldx.dcf # integration-tests/validation/src/main/assets/figma/LayoutTestsDoc_Gv63fYTzpeH2ZtxP4go31E.dcf # integration-tests/validation/src/main/assets/figma/ListWidgetTestDoc_9ev0MBNHFrgTqJOrAGcEpV.dcf # integration-tests/validation/src/main/assets/figma/MaskTestDoc_mEmdUVEIjvBBbV0kELPy37.dcf # integration-tests/validation/src/main/assets/figma/ModuleExampleDoc_hPEGkrF0LUqNYEZObXqjXZ.dcf # integration-tests/validation/src/main/assets/figma/OpenLinkTestDoc_r7m4tqyKv6y9DWcg7QBEDf.dcf # integration-tests/validation/src/main/assets/figma/RecursiveCustomizationsDoc_o0GWzcqdOWEgzj4kIeIlAu.dcf # integration-tests/validation/src/main/assets/figma/ShadowsTestDoc_OqK58Y46IqP4wIgKCWys48.dcf # integration-tests/validation/src/main/assets/figma/SmartAnimateTestDoc_RW3lFurXCoVDeqY2Y7bf4v.dcf # integration-tests/validation/src/main/assets/figma/TelltaleTestDoc_TZgHrKWx8wvQM7UPTyEpmz.dcf # integration-tests/validation/src/main/assets/figma/VariableBorderTestDoc_MWnVAfW3FupV4VMLNR1m67.dcf # integration-tests/validation/src/main/assets/figma/VariablesTestDoc_HhGxvL4aHhP8ALsLNz56TP.dcf # integration-tests/validation/src/main/assets/figma/VariantAnimationTestDoc_pghyUUhlzJNoxxSK86ngiw.dcf # integration-tests/validation/src/main/assets/figma/VariantAnimationTimelineTestDoc_vJRf4zxY4QX4zzSSUd1nJ5.dcf # integration-tests/validation/src/main/assets/figma/VariantAsteriskTestDoc_gQeYHGCSaBE4zYSFpBrhre.dcf # integration-tests/validation/src/main/assets/figma/VariantInteractionsTestDoc_WcsgoLR4aDRSkZHY29Qdhq.dcf # integration-tests/validation/src/main/assets/figma/VariantPropertiesTestDoc_4P7zDdrQxj7FZsKJoIQcx1.dcf # integration-tests/validation/src/main/assets/figma/VectorRenderingTestDoc_Z3ucY0wMAbIwZIa6mLEWIK.dcf # reference-apps/tutorial/app/src/main/assets/figma/TutorialDoc_3z4xExq0INrL9vxPhj9tl7.dcf
- Loading branch information
1 parent
2b00867
commit 168cb48
Showing
46 changed files
with
238 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
90 changes: 0 additions & 90 deletions
90
crates/dc_bundle/src/legacy_definition/plugin/meter_data.rs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! `toolkit_style` contains all of the style-related types that `toolkit_schema::View` | ||
//! uses. | ||
use crate::figma_schema; | ||
|
||
use dc_bundle::definition::plugin::meter_data::MeterData; | ||
use dc_bundle::definition::plugin::{ | ||
ArcMeterData, ProgressBarMeterData, ProgressMarkerMeterData, ProgressVectorMeterData, | ||
RotationMeterData, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
use dc_bundle::definition::element::Path; | ||
use dc_bundle::legacy_definition::view::view_style::ViewStyle; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct RotationMeterJson { | ||
pub enabled: bool, | ||
pub start: f32, | ||
pub end: f32, | ||
pub discrete: bool, | ||
pub discrete_value: f32, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ArcMeterJson { | ||
pub enabled: bool, | ||
pub start: f32, | ||
pub end: f32, | ||
pub discrete: bool, | ||
pub discrete_value: f32, | ||
pub corner_radius: f32, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ProgressBarMeterJson { | ||
pub enabled: bool, | ||
pub discrete: bool, | ||
pub discrete_value: f32, | ||
#[serde(default)] | ||
pub vertical: bool, | ||
#[serde(default)] | ||
pub end_x: f32, | ||
#[serde(default)] | ||
pub end_y: f32, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ProgressMarkerMeterJson { | ||
pub enabled: bool, | ||
pub discrete: bool, | ||
pub discrete_value: f32, | ||
#[serde(default)] | ||
pub vertical: bool, | ||
#[serde(default)] | ||
pub start_x: f32, | ||
#[serde(default)] | ||
pub end_x: f32, | ||
#[serde(default)] | ||
pub start_y: f32, | ||
#[serde(default)] | ||
pub end_y: f32, | ||
} | ||
|
||
// // Schema for progress vector data that we write to serialized data | ||
// #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
// #[serde(rename_all = "camelCase")] | ||
// pub struct ProgressVectorMeterJson { | ||
// pub enabled: bool, | ||
// pub discrete: bool, | ||
// pub discrete_value: f32, | ||
// } | ||
|
||
// Schema for progress vector data that we read from Figma plugin data | ||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ProgressVectorMeterJson { | ||
pub enabled: bool, | ||
pub discrete: bool, | ||
pub discrete_value: f32, | ||
pub paths: Vec<figma_schema::Path>, | ||
} | ||
|
||
// Schema for dials & gauges Figma plugin data | ||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub enum MeterJson { | ||
ArcJson(ArcMeterJson), | ||
RotationJson(RotationMeterJson), | ||
ProgressBarJson(ProgressBarMeterJson), | ||
ProgressMarkerJson(ProgressMarkerMeterJson), | ||
ProgressVectorJson(ProgressVectorMeterJson), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.