-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworking the
elements
package (#12557)
* Moved types around and converted elements package * WIP: convert element-library package * Re-moved types to relevant packages and untyped the element-library * Updating package.json * Feedback improvements * Fixed more from PR feedback * Fix lint error * Moved element definitions to element library package and updated dependencies * Fixed React-17 React.FC issue and resource id reference * Removed Page.type property as it is redundant Also fixed a test. Note that there are many more instance of type:"page" in the code, but most are related to tests that will probably still work fine or templates, which will also work fine with an extra unused property. Should we add a migration though? * Fix imports of background audio prop type * Fixed a karma test * Finally fixed that annoying bg-shape-element copy thingy * Added a comment to make sense of it * Fix eyedropper * Target correct element * Updated type references for config providers * Missing types in package.json? * Reorganized data types to elements package Co-authored-by: Marcin Pietruszka <marcin@webskill.pl>
- Loading branch information
Showing
117 changed files
with
823 additions
and
833 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
29 changes: 29 additions & 0 deletions
29
packages/element-library/src/types/elements/productElement.ts
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,29 @@ | ||
/* | ||
* Copyright 2022 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import type { | ||
Element, | ||
ElementType, | ||
ProductData, | ||
} from '@googleforcreators/elements'; | ||
|
||
export interface ProductElement extends Element { | ||
type: ElementType.Product; | ||
product: ProductData; | ||
} |
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
50 changes: 50 additions & 0 deletions
50
packages/element-library/src/types/elements/textElement.ts
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,50 @@ | ||
/* | ||
* Copyright 2022 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import type { Pattern } from '@googleforcreators/patterns'; | ||
import type { | ||
Element, | ||
ElementType, | ||
FontData, | ||
} from '@googleforcreators/elements'; | ||
|
||
export interface Padding { | ||
horizontal?: number; | ||
vertical?: number; | ||
locked?: boolean; | ||
hasHiddenPadding?: boolean; | ||
} | ||
|
||
export type TextAlign = 'left' | 'center' | 'right' | 'justify' | 'initial'; | ||
export type BackgroundTextMode = 'NONE' | 'FILL' | 'HIGHLIGHT'; | ||
|
||
export interface TextElement extends Element { | ||
type: ElementType.Text; | ||
content: string; | ||
font: FontData; | ||
|
||
backgroundTextMode?: BackgroundTextMode; | ||
backgroundColor?: Pattern; | ||
fontSize?: number; | ||
lineHeight?: number; | ||
textAlign?: TextAlign; | ||
tagName?: 'h1' | 'h2' | 'h3' | 'p'; | ||
padding?: Padding; | ||
marginOffset?: number; | ||
} |
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
Oops, something went wrong.