-
Notifications
You must be signed in to change notification settings - Fork 453
feat: Style presets #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Vibhuti410
wants to merge
26
commits into
frappe:develop
Choose a base branch
from
Vibhuti410:feature-style-book
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Style presets #519
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5606891
feat: add Builder Style Book doctype
Vibhuti410 eae84a5
feat: add get_style_book and update_style_book API endpoints
Vibhuti410 96869a5
feat-add style book data resource
Vibhuti410 090a79a
feat-add styleBook data resource
Vibhuti410 13022f0
feat: add Style dropdown to Typography section
Vibhuti410 e5098f5
feat: update to use Builder Style Preset doctype
Vibhuti410 563b946
feat: updated style preset
Vibhuti410 661e7a4
feat: handling null selection
Vibhuti410 1c43160
feat: syle preset inheritance with placeholder
Vibhuti410 101c324
refactor: used preStyle and stykeKeyMap for handling the preset
Vibhuti410 c6e31f9
refactor: used preStyle and stykeKeyMap for handling the preset
Vibhuti410 b293bfc
fix: map numeric value of fontWeight to label in preset placeholder
Vibhuti410 b3ea745
fix: resolved merge conflict
Vibhuti410 16af940
fix: removed unused block of code
Vibhuti410 245390d
fix: made style_map field as required
Vibhuti410 584fcfe
refactor: simplified style preset block in typography.ts
Vibhuti410 a32d516
feat: applied preset styles on page publish
Vibhuti410 8e2d61d
refactor: update preset style structure
Vibhuti410 f1efc6b
Merge branch 'develop' into feature-style-book
surajshetty3416 0e040a7
Merge branch 'develop' into feature-style-book
surajshetty3416 4be1f50
Merge branch 'develop' into feature-style-book
surajshetty3416 9612d72
feat: ship standard style preset json files
Vibhuti410 9f2fa47
Merge branch 'develop' into feature-style-book
mergify[bot] 76827e7
fix: handle preset again after manual change
Vibhuti410 04d15db
Merge branch 'feature-style-book' of https://github.com/Vibhuti410/bu…
Vibhuti410 ad07217
fix: style presets stay on refresh
Vibhuti410 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
Empty file.
8 changes: 8 additions & 0 deletions
8
builder/builder/doctype/builder_style_preset/builder_style_preset.js
This file contains hidden or 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,8 @@ | ||
| // Copyright (c) 2026, Frappe Technologies Pvt Ltd and contributors | ||
| // For license information, please see license.txt | ||
|
|
||
| // frappe.ui.form.on("Builder Style Preset", { | ||
| // refresh(frm) { | ||
|
|
||
| // }, | ||
| // }); |
68 changes: 68 additions & 0 deletions
68
builder/builder/doctype/builder_style_preset/builder_style_preset.json
This file contains hidden or 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,68 @@ | ||
| { | ||
| "actions": [], | ||
| "allow_rename": 1, | ||
| "autoname": "field:style_name", | ||
| "creation": "2026-03-04 11:58:54.158151", | ||
| "doctype": "DocType", | ||
| "engine": "InnoDB", | ||
| "field_order": [ | ||
| "style_name_section", | ||
| "style_name", | ||
| "style_map", | ||
| "sort_order" | ||
| ], | ||
| "fields": [ | ||
| { | ||
| "fieldname": "style_name_section", | ||
| "fieldtype": "Section Break", | ||
| "label": "Style Name" | ||
| }, | ||
| { | ||
| "fieldname": "style_name", | ||
| "fieldtype": "Data", | ||
| "in_list_view": 1, | ||
| "label": "Style Name", | ||
| "reqd": 1, | ||
| "unique": 1 | ||
| }, | ||
| { | ||
| "fieldname": "style_map", | ||
| "fieldtype": "JSON", | ||
| "label": "Style Map", | ||
| "reqd": 1 | ||
| }, | ||
| { | ||
| "fieldname": "sort_order", | ||
| "fieldtype": "Int", | ||
| "label": "Sort Order" | ||
| } | ||
| ], | ||
| "grid_page_length": 50, | ||
| "index_web_pages_for_search": 1, | ||
| "links": [], | ||
| "modified": "2026-03-13 12:47:52.513378", | ||
| "modified_by": "Administrator", | ||
| "module": "Builder", | ||
| "name": "Builder Style Preset", | ||
| "naming_rule": "By fieldname", | ||
| "owner": "Administrator", | ||
| "permissions": [ | ||
| { | ||
| "create": 1, | ||
| "delete": 1, | ||
| "email": 1, | ||
| "export": 1, | ||
| "print": 1, | ||
| "read": 1, | ||
| "report": 1, | ||
| "role": "System Manager", | ||
| "share": 1, | ||
| "write": 1 | ||
| } | ||
| ], | ||
| "row_format": "Dynamic", | ||
| "rows_threshold_for_grid_search": 20, | ||
| "sort_field": "creation", | ||
| "sort_order": "DESC", | ||
| "states": [] | ||
| } |
22 changes: 22 additions & 0 deletions
22
builder/builder/doctype/builder_style_preset/builder_style_preset.py
This file contains hidden or 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,22 @@ | ||
| # Copyright (c) 2026, Frappe Technologies Pvt Ltd and contributors | ||
| # For license information, please see license.txt | ||
|
|
||
| # import frappe | ||
| from frappe.model.document import Document | ||
|
|
||
|
|
||
| class BuilderStylePreset(Document): | ||
| # begin: auto-generated types | ||
| # This code is auto-generated. Do not modify anything in this block. | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: | ||
| from frappe.types import DF | ||
|
|
||
| sort_order: DF.Int | ||
| style_map: DF.JSON | ||
| style_name: DF.Data | ||
| # end: auto-generated types | ||
|
|
||
| pass |
20 changes: 20 additions & 0 deletions
20
builder/builder/doctype/builder_style_preset/test_builder_style_preset.py
This file contains hidden or 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,20 @@ | ||
| # Copyright (c) 2026, Frappe Technologies Pvt Ltd and Contributors | ||
| # See license.txt | ||
|
|
||
| # import frappe | ||
| from frappe.tests import IntegrationTestCase | ||
|
|
||
| # On IntegrationTestCase, the doctype test records and all | ||
| # link-field test record dependencies are recursively loaded | ||
| # Use these module variables to add/remove to/from that list | ||
| EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] | ||
| IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] | ||
|
|
||
|
|
||
| class IntegrationTestBuilderStylePreset(IntegrationTestCase): | ||
| """ | ||
| Integration tests for BuilderStylePreset. | ||
| Use this class for testing interactions between multiple components. | ||
| """ | ||
|
|
||
| pass |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,14 @@ | ||
| import { createListResource } from "frappe-ui"; | ||
|
|
||
| const stylePreset = createListResource({ | ||
| method: "GET", | ||
| doctype: "Builder Style Preset", | ||
| fields: ["style_name", "style_map", "sort_order"], | ||
| cache: "stylePresets", | ||
| start: 0, | ||
| pageLength: 50, | ||
| auto: true, | ||
| orderBy: "sort_order asc", | ||
| }); | ||
|
|
||
| export default stylePreset; |
This file contains hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| import blockController from "@/utils/blockController"; | ||
| import stylePreset from "@/data/stylePreset"; | ||
|
|
||
| export const getPresetMap = () => { | ||
| const presetName = blockController.getKeyValue("stylePreset"); | ||
| const preset = stylePreset.data?.find((s: any) => s.style_name === presetName); | ||
| return preset | ||
| ? (typeof preset.style_map === "string" ? JSON.parse(preset.style_map) : preset.style_map) | ||
| : null; | ||
| }; | ||
|
Vibhuti410 marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.