-
Notifications
You must be signed in to change notification settings - Fork 495
refactor: Rename Builder Variable to Builder Token, add Font tokens #676
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
surajshetty3416
wants to merge
24
commits into
frappe:develop
Choose a base branch
from
surajshetty3416:builder-tokens
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
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
f0781da
refactor!: rename Builder Variable to Builder Token
surajshetty3416 72177f6
fix: single-weight Google Font specimens fail to load
surajshetty3416 67d36cd
feat: Font design tokens - fontFamily can be var(--token)
surajshetty3416 3280e58
feat: Design System manager — token tabs for Colors, Fonts, Dimensions
surajshetty3416 d3df948
feat(builder): token count pill on each Design System tab
surajshetty3416 94a83e1
feat(builder): copy button on each token row — copies its var(--id) h…
surajshetty3416 6484eeb
feat(tokens): Font Family field mirrors the color input
surajshetty3416 8e64723
feat: keep old Builder Variable entry points working
surajshetty3416 c3429cc
fix: CSV import honors the Type column
surajshetty3416 4d04197
refactor: use frappe-ui TabButtons and Button in the Design System ma…
surajshetty3416 473e9f2
fix: token edits bust the variables.css compat cache too
surajshetty3416 796c9ef
fix: color picker lists only Color tokens
surajshetty3416 c58b6a1
fix: import pre-rename Builder Variable fixtures as Builder Token
surajshetty3416 85dc494
Merge branch 'develop' into builder-tokens
surajshetty3416 17a8d06
fix: run the UUID refactor patch against Builder Token
surajshetty3416 8f22f2d
fix: rename patch guards on the Builder Token table, not the DocType
surajshetty3416 bf9277a
Merge branch 'develop' into builder-tokens
surajshetty3416 37fdcdb
fix: guard against an unloaded user font list in the font picker
surajshetty3416 a45c2ca
fix: keep pre-rename tokens importable across sites
surajshetty3416 5c39bc1
fix: finish the token rename in user-facing copy and type handling
surajshetty3416 206d9bc
fix: stop new token rows from saving mid-keystroke, fix hover row height
stravo1 49ebc1f
fix: stop blur from swapping a selected token for a same-named one
stravo1 aa73bc6
fix: restore left rounding on token value cell boxes
stravo1 34fde8b
fix: add a way to cancel the new-token row besides Esc or reload
stravo1 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
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
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...type/builder_variable/builder_variable.js → ...er/doctype/builder_token/builder_token.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
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
36 changes: 36 additions & 0 deletions
36
builder/builder/patches/rename_builder_variable_to_builder_token.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,36 @@ | ||
| import frappe | ||
| from frappe.model.utils.rename_field import rename_field | ||
|
|
||
|
|
||
| def execute(): | ||
| """Builder Variable → Builder Token. Only the DocType and the label field are | ||
| renamed — token doc names (the CSS `--<id>` handles) are untouched, so every | ||
| existing page's var(--id) references keep resolving.""" | ||
| # guard on the table, not the DocType row: syncing the old model back (a | ||
| # downgrade, or migrating on develop) drops the Builder Token DocType but | ||
| # leaves tabBuilder Token behind, and rename_doc can't rename onto it | ||
| if frappe.db.table_exists("Builder Token"): | ||
| merge_stale_builder_variables() | ||
| return | ||
| if not frappe.db.exists("DocType", "Builder Variable"): | ||
| return | ||
| frappe.rename_doc("DocType", "Builder Variable", "Builder Token", force=True) | ||
| frappe.reload_doc("builder", "doctype", "builder_token") | ||
| rename_field("Builder Token", "variable_name", "token_name") | ||
|
|
||
|
|
||
| def merge_stale_builder_variables(): | ||
| """Both doctypes exist when a site ran the rename and later re-synced the old | ||
| model. Keep Builder Token, salvage rows only the old table has, drop the rest.""" | ||
| if frappe.db.table_exists("Builder Variable"): | ||
| frappe.db.sql( | ||
| """INSERT INTO `tabBuilder Token` | ||
| (name, creation, modified, modified_by, owner, docstatus, | ||
| token_name, type, value, dark_value, is_standard, `group`) | ||
| SELECT name, creation, modified, modified_by, owner, docstatus, | ||
| variable_name, type, value, dark_value, is_standard, `group` | ||
| FROM `tabBuilder Variable` bv | ||
| WHERE NOT EXISTS (SELECT 1 FROM `tabBuilder Token` bt WHERE bt.name = bv.name)""" | ||
| ) | ||
| frappe.delete_doc("DocType", "Builder Variable", ignore_missing=True, force=True) | ||
| frappe.db.sql_ddl("DROP TABLE IF EXISTS `tabBuilder Variable`") |
Oops, something went wrong.
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.