Plugin Directory

Changeset 3797232


Ignore:
Timestamp:
11/11/2026 11:24:12 PM (4 days ago)
Author:
pristadigital
Message:

TokenForge 0.56.0: Bricks Style Manager scales and settings, AI guidance on BEM and global classes, BEM names in any alphabet

Location:
tokenforge
Files:
2 added
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tokenforge/tags/0.56.0/CHANGELOG.md

    r3794418 r3797232  
    22
    33All the changes to TokenForge, newest first.
     4
     5## 0.56.0
     6
     7Bricks Style Manager: TokenForge now fills its Typography and Spacing panels. The text sizes (--text-xs to --text-xxl) and headings (--h6 to --h1) are two typography scales, and --space-xs to --space-xxl is a spacing scale, each with TokenForge's base size, ratio and per-step values (steps you set by hand under Scales show as manual values). The Settings panel gets TokenForge's HTML font size, min and max screen width and default mode. It works both ways: change a scale's base size, ratio or step values, or a setting, in the Style Manager and TokenForge takes it over and rebuilds. A builder tab opened before a TokenForge save never undoes that save (what you change in it still counts; with two tabs editing the same scale, the last save wins), and when the builder regenerates the scale variables with its own rounding, TokenForge's exact values are put back. Only administrators change TokenForge from there; what other builder users change is put back. Pressing Generate variables on a TokenForge scale keeps TokenForge's variables (no duplicates). All of this follows the "Tokens to builder global variables" switch (Options, Builder sync); switching it off, or deleting TokenForge, gives the Style Manager back the settings it had before. The Framework panel stays empty: it is a one-time paste importer and TokenForge already registers its variables and classes directly.
     8
     9AI agents: the framework guide and the builder's start-here guide now spell out BEM naming for an agent's own classes (block__element--modifier, named after the component, no site prefix, elements one level deep, layout from TokenForge classes) and, on Bricks, how classes are added: as global classes in the element's global class list, never typed into the CSS classes field or written as element custom CSS. The readme FAQ and Options, AI agents explain how to connect an AI client through the MCP Adapter.
     10
     11Fixed: the BEM class generator in the builder gave empty element names (block__) when the builder runs in a language with another alphabet, such as Bulgarian. Labels are now transliterated into Latin letters, an element without its own label is named by its type (block__image, block__text, block__heading), and an unnamed root suggests "block" for you to rename. Deleting TokenForge now also removes its short-lived upgrade lock. The TokenForge menu in the admin bar shows the TokenForge icon, as in the side menu, instead of a palette icon.
    412
    513## 0.55.0
  • tokenforge/tags/0.56.0/assets/admin/admin.js

    r3794418 r3797232  
    312312                        P( __( 'Block editor', 'tokenforge' ), 'settings', [ S( 'gutenberg_palette', __( 'Colour palette', 'tokenforge' ), [ [ 'off', __( 'Theme palette', 'tokenforge' ) ], [ 'add', __( 'Add TokenForge colours', 'tokenforge' ) ], [ 'replace', __( 'Replace with TokenForge colours', 'tokenforge' ) ] ] ) ] ),
    313313                        P( __( 'TokenForge window', 'tokenforge' ), 'settings', [ K( 'panel_shortcut', __( 'Open / close shortcut', 'tokenforge' ), { h: __( 'Click the field, then press the keys (e.g. Alt+Shift+T). Works in the builder (also with the canvas focused) and on the site\u2019s pages.', 'tokenforge' ) } ), B( 'canvas_panel', __( 'Show in builder canvas while editing', 'tokenforge' ), { needs: 'canvas_tools' } ), B( 'frontend_panel', __( 'On the site\u2019s pages (administrators only)', 'tokenforge' ) ), B( 'frontend_launcher', __( 'Floating TokenForge button on the site\u2019s pages', 'tokenforge' ) ) ], { d: __( 'The dashboard as a dockable window. In the builder it opens with the shortcut or the TokenForge button; on the site\u2019s pages with the shortcut or the admin-bar TokenForge link (Ctrl/Cmd-click goes to wp-admin).', 'tokenforge' ) } ),
    314                         P( __( 'AI agents', 'tokenforge' ), 'settings', [ B( 'ai_abilities', __( 'TokenForge abilities for AI agents (MCP tools)', 'tokenforge' ) ), B( 'ai_guidance', __( 'Tell AI agents to build with TokenForge', 'tokenforge' ) ) ], { d: __( 'When an AI builds this site through the WordPress MCP Adapter or the builder’s AI abilities, it gets the tools <code>tokenforge-get-framework</code>, <code>tokenforge-search</code>, <code>tokenforge-check-css</code>, and <code>tokenforge-get-recipe</code>, and is told to use TokenForge classes and variables instead of hard-coded CSS.', 'tokenforge' ) } ),
     314                        P( __( 'AI agents', 'tokenforge' ), 'settings', [ B( 'ai_abilities', __( 'TokenForge abilities for AI agents (MCP tools)', 'tokenforge' ) ), B( 'ai_guidance', __( 'Tell AI agents to build with TokenForge', 'tokenforge' ) ) ], { d: __( 'When an AI builds this site through the WordPress MCP Adapter or the builder’s AI abilities, it gets the tools <code>tokenforge-get-framework</code>, <code>tokenforge-search</code>, <code>tokenforge-check-css</code>, and <code>tokenforge-get-recipe</code>, and is told to use TokenForge classes and variables instead of hard-coded CSS, and to name its own classes in BEM. To connect an AI client: install the MCP Adapter plugin (the builder’s AI screen can do it for you), create an application password under Users, Profile, and add the site to the client as an MCP server. The readme FAQ has the steps.', 'tokenforge' ) } ),
    315315                        P( __( 'Performance', 'tokenforge' ), 'settings', [ B( 'inline_css', __( 'Inline the stylesheet', 'tokenforge' ) ), B( 'hot_reload', __( 'Hot-reload CSS in open tabs after Save', 'tokenforge' ) ), B( 'admin_bar_link', __( 'Admin bar link', 'tokenforge' ) ) ] ),
    316316                        P( __( 'Breakpoints', 'tokenforge' ), 'scss', [ N( 'bp_xs', __( 'xs (px)', 'tokenforge' ) ), N( 'bp_s', __( 's (px)', 'tokenforge' ) ), N( 'bp_m', __( 'm (px)', 'tokenforge' ) ), N( 'bp_l', __( 'l (px)', 'tokenforge' ) ), N( 'bp_xl', __( 'xl (px)', 'tokenforge' ) ), N( 'bp_xxl', __( 'xxl (px)', 'tokenforge' ) ) ], { d: __( 'Widths in px for the breakpoint names (xs to xxl) used by the <code>?breakpoint-*</code> recipes and the responsive data attributes.', 'tokenforge' ) } ),
  • tokenforge/tags/0.56.0/assets/admin/tips.js

    r3794418 r3797232  
    474474
    475475                // ---- Settings ----
    476                 'settings.sync_bricks_vars': __( 'Copies every token into the builder’s global variables, so they appear in its variable picker.', 'tokenforge' ),
     476                'settings.sync_bricks_vars': __( 'Copies every token into the builder’s global variables, so they appear in its variable picker. The text, heading and space sizes also show as typography and spacing scales in its style manager, with the HTML font size, screen widths and default mode in its settings. A scale or setting you change there comes back into TokenForge.', 'tokenforge' ),
    477477                'settings.vars_trans': __( 'Sends the transparent steps of every colour (primary-trans-10 … 90, white-trans-50 …) to the builder\x27s variable list. About 400 variables.', 'tokenforge' ),
    478478                'settings.vars_channels': __( 'Sends the parts colours are built from (primary-hex, primary-rgb, primary-h, primary-s …) to the builder\x27s variable list. You rarely pick these by hand. About 400 variables.', 'tokenforge' ),
  • tokenforge/tags/0.56.0/assets/builder/bem-generator.js

    r3784841 r3797232  
    2727        function content( g ) { var s = unref( g.$_state ); return ( s && s.content ) || []; }
    2828        function classes( g ) { var s = unref( g.$_state ); return unref( g.$_globalClasses ) || ( s && unref( s.globalClasses ) ) || []; } // $_globalClasses and $_state.globalClasses are the same list
    29         function kebab( s ) { return ( s || '' ).toString().trim().toLowerCase().replace( /[^a-z0-9]+/g, '-' ).replace( /^-|-$/g, '' ); }
     29        // Cyrillic to Latin (Bulgarian streamlined system, plus the other common letters); other accents are stripped.
     30        var CYR = { 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh', 'щ': 'sht', 'ъ': 'a', 'ь': 'y', 'ю': 'yu', 'я': 'ya', 'ё': 'yo', 'ы': 'y', 'э': 'e', 'є': 'ye', 'і': 'i', 'ї': 'yi', 'ґ': 'g', 'ў': 'u', 'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz', 'ѓ': 'gj', 'ќ': 'kj', 'ѕ': 'dz' };
     31        function latin( s ) {
     32                s = ( s || '' ).toString().toLowerCase().replace( /[Ѐ-ӿ]/g, function ( c ) { return CYR[ c ] != null ? CYR[ c ] : ''; } );
     33                return s.normalize ? s.normalize( 'NFD' ).replace( /[̀-ͯ]/g, '' ) : s;
     34        }
     35        function kebab( s ) { return latin( s ).trim().replace( /[^a-z0-9]+/g, '-' ).replace( /^-|-$/g, '' ); }
     36        // Element part for an element the user has not renamed: its type in English, so a translated builder still gives card__image.
     37        var TYPE_PART = { 'text-basic': 'text', 'rich-text': 'text', 'text-link': 'link', 'nav-menu': 'nav', 'nav-nested': 'nav', 'div': 'content', 'block': 'content', 'container': 'content' };
     38        function partOf( g, el ) {
     39                var named = kebab( el.label );
     40                if ( named ) { return named; }
     41                var type = kebab( el.name );
     42                return TYPE_PART[ type ] || type || kebab( labelOf( g, el ) ) || 'item';
     43        }
    3044        function rid() { var s = ''; while ( s.length < 6 ) { s += Math.random().toString( 36 ).slice( 2 ); } return s.slice( 0, 6 ); }
    3145        function userId() { try { return ( window.bricksData && bricksData.user && bricksData.user.id ) || 0; } catch ( e ) { return 0; } }
    … …  
    88102                closeDialog();
    89103
    90                 var block = kebab( labelOf( g, root ) ) || 'block';
     104                var block = kebab( root.label ) || 'block'; // an unnamed Div gives "block", selected below for typing
    91105                var kids = descendants( g, root );
    92106
    … …  
    98112                                        '<label class="tf-bem-lbl">Block name</label>' +
    99113                                        '<input class="tf-bem-block" type="text" value="' + esc( block ) + '">' +
    100                                         '<div class="tf-bem-hint">' + ( kids.length ) + ' descendant element(s). Each gets <code>block__&lt;label&gt;</code>. Edit any class below.</div>' +
     114                                        '<div class="tf-bem-hint">' + ( kids.length ) + ' descendant element(s). Each gets <code>block__element</code> from its label, or its type when it has no label of its own. Edit any class below.</div>' +
    101115                                        '<div class="tf-bem-rows"></div>' +
    102116                                '</div>' +
    … …  
    111125                // row model: {id, label, custom:false, cls}
    112126                var rows = [ { id: root.id, label: labelOf( g, root ), isRoot: true } ].concat(
    113                         kids.map( function ( k ) { return { id: k.id, label: labelOf( g, k ), isRoot: false }; } )
     127                        kids.map( function ( k ) { return { id: k.id, label: labelOf( g, k ), part: partOf( g, k ), isRoot: false }; } )
    114128                );
    115129
    116130                function classFor( r ) {
    117131                        if ( r.custom != null ) { return r.custom; }
    118                         return r.isRoot ? blockInput.value.trim() : ( blockInput.value.trim() + '__' + kebab( r.label ) );
     132                        var b = kebab( blockInput.value ) || 'block';
     133                        return r.isRoot ? b : ( b + '__' + r.part );
    119134                }
    120135                function renderRows() {
  • tokenforge/tags/0.56.0/includes/class-ai.php

    r3794418 r3797232  
    7878        public static function pointer() {
    7979                return 'This site is styled with the TokenForge CSS framework. Before creating or styling pages, call the tool tokenforge-get-framework once, then build with its classes and var(--tokens) instead of hard-coded colours, sizes and spacing. Check new CSS with tokenforge-check-css; look things up with tokenforge-search.';
     80        }
     81
     82        /**
     83         * How to name your own classes (BEM).
     84         *
     85         * @return string
     86         */
     87        public static function bem_rule() {
     88                return 'Name it BEM: `block__element--modifier`, all lowercase Latin letters, digits and hyphens. The block is what the component is (`case-study`, `pricing`, `team`), never a site or project prefix (`pd-`, `site-`) and never a layout word a TokenForge class already covers (`grid`, `row`, `stack`). Elements are one level only (`case-study__title`, not `case-study__header__title`); a variant is a modifier class next to the base class (`case-study case-study--featured`). Layout, spacing, colour and text size come from TokenForge classes on the same element (`case-study grid-2 gap-m`), so a BEM class holds only what is unique to the component.';
     89        }
     90
     91        /**
     92         * How classes reach elements in Bricks.
     93         *
     94         * @return string
     95         */
     96        public static function bricks_class_rule() {
     97                return 'Every class is a Bricks global class. When you send HTML to the import tools, class names in `class=""` are matched to global classes. When you write element settings yourself, put global class ids in `_cssGlobalClasses` (create new BEM classes first with bricks-batch-create-global-classes, after bricks-list-global-classes, and give them their CSS there), never class names in `_cssClasses` (the "CSS classes" text field) and never component styles in an element\'s own custom CSS (`_cssCustom`, `%root%`).';
    8098        }
    8199
    … …  
    557575                        '1. **No hard-coded design values.** Colours, font sizes, spacing, radius, shadows and widths come from tokens: `var(--primary)`, `var(--base-dark)`, `var(--text-l)`, `var(--h2)`, `var(--space-m)`, `var(--section-space-l)`, `var(--radius)`, `var(--shadow-2)`, `var(--content-width)`. Run `tokenforge-check-css` on your CSS to catch misses.',
    558576                        '2. **Use framework classes first.** Buttons `btn--primary`, cards `card`, section spacing `section--l`, backgrounds `bg--dark`, text sizes `text--l`, heading looks `h3`, grids `grid-3`, gaps `gap-m`, padding `pad-m`. Look anything up with `tokenforge-search` (e.g. "outline button").',
    559                         '3. **Never restyle or redefine a TokenForge class** and never create a class or variable with a TokenForge name. For custom styling add your own BEM class (block__element--modifier) and use tokens inside it.',
     577                        '3. **Never restyle or redefine a TokenForge class** and never create a class or variable with a TokenForge name. For custom styling add your own BEM class and use tokens inside it. ' . self::bem_rule(),
    560578                        '4. **Let the automatic layout work.** Top-level `<section>` elements already get side gutters (`var(--gutter)`) and vertical padding (`var(--section-space-m)`)' . ( ! empty( $c['auto_container_gap'] ) ? '; their children are spaced by `var(--container-gap)`' : '' ) . ( ! empty( $c['auto_content_gap'] ) ? ', and children of containers/blocks/divs by `var(--content-gap)`' : '' ) . '. Do not add margins between stacked elements or padding to sections unless the design needs a different size: then use `section--{size}` or `section--{a}-to-{b}`.',
    561579                        '5. **Typography is global.** Body text and h1 to h6 already have fonts, fluid sizes, line heights and colours. Do not set font-family, font-size or line-height on headings or paragraphs; to make any element look like a heading use the class `h2`, for bigger body text `text--l`.',
    … …  
    574592                        '## Page structure',
    575593                        $bricks
    576                                 ? 'Bricks: `<section>` (full width, gets gutters and padding) → `<div class="brxe-container">` (' . ( ! empty( $c['container_width'] ) ? 'centred at the content width' : 'Bricks container' ) . ') → content. Put TokenForge class names straight into `class=""`: they already exist as Bricks global classes, so do not send CSS rules for them and do not recreate them.'
     594                                ? 'Bricks: `<section>` (full width, gets gutters and padding) → `<div class="brxe-container">` (' . ( ! empty( $c['container_width'] ) ? 'centred at the content width' : 'Bricks container' ) . ') → content. Put TokenForge class names straight into `class=""`: they already exist as Bricks global classes, so do not send CSS rules for them and do not recreate them. ' . self::bricks_class_rule()
    577595                                : 'Use `<section>` for full-width bands (they get gutters and padding) and a `<div class="container">` inside to centre content at the content width.',
    578596                        'Content grid: `content-grid` on a section makes children sit in a centred column; `content--feature`, `content--feature-max`, `content--full` break out wider.',
    … …  
    10731091         */
    10741092        public function bricks_start_here( $text ) {
    1075                 return rtrim( (string) $text ) . "\n\n## TokenForge (this site’s CSS framework)\n\n" . self::pointer() . "\n\n- Put TokenForge class names (btn--primary, card, section--l, bg--dark, grid-3 …) directly in the HTML class attribute; they already exist as global classes, so send no CSS for them and never recreate them.\n- In your own classes use var(--tokens) for every colour, size, spacing, radius and shadow.\n- Sections already get gutters and padding, and stacked children get automatic gaps: do not add margins or section padding unless the design needs a different size.\n- Headings and body text are styled globally: do not set font-family, font-size or line-height on them.\n";
     1093                return rtrim( (string) $text ) . "\n\n## TokenForge (this site’s CSS framework)\n\n" . self::pointer() . "\n\n- Put TokenForge class names (btn--primary, card, section--l, bg--dark, grid-3 …) directly in the HTML class attribute; they already exist as global classes, so send no CSS for them and never recreate them.\n- " . self::bricks_class_rule() . "\n- Your own classes: " . self::bem_rule() . "\n- In your own classes use var(--tokens) for every colour, size, spacing, radius and shadow.\n- Sections already get gutters and padding, and stacked children get automatic gaps: do not add margins or section padding unless the design needs a different size.\n- Headings and body text are styled globally: do not set font-family, font-size or line-height on them.\n";
    10761094        }
    10771095
    … …  
    10981116                                        'Use TokenForge classes in HTML as they are (btn--primary, card, section--l, bg--dark, grid-3, gap-m, text--l, h2); do not send CSS for them or recreate them.',
    10991117                                        'Use var(--tokens) for every colour, font size, spacing, radius, shadow and width in custom CSS.',
     1118                                        'Your own classes: ' . self::bem_rule(),
     1119                                        self::bricks_class_rule(),
    11001120                                        'Sections get gutters and padding, stacked children get gaps, headings and text are styled globally.',
    11011121                                ),
  • tokenforge/tags/0.56.0/includes/class-frontend.php

    r3794418 r3797232  
    221221                        array(
    222222                                'id'    => 'tokenforge',
    223                                 'title' => '<span class="ab-icon dashicons dashicons-art" style="top:2px"></span>' . esc_html__( 'TokenForge', 'tokenforge' ),
     223                                'title' => '<span class="ab-icon" aria-hidden="true" style="top:2px;width:20px;height:20px;background:url(' . esc_url( TOKENFORGE_URL . 'assets/admin/tokenforge-icon.svg' ) . ') center/20px no-repeat !important"></span>' . esc_html__( 'TokenForge', 'tokenforge' ),
    224224                                'href'  => admin_url( 'admin.php?page=tokenforge' ),
    225225                        )
  • tokenforge/tags/0.56.0/includes/class-plugin.php

    r3794418 r3797232  
    7979                        new Features\Form_Submissions(); // the builder's submissions screen, extended (when switched on).
    8080                        new Platforms\Bricks_Theme(); // TokenForge <-> the site's Bricks theme style.
     81                        new Platforms\Bricks_Style_Manager(); // TokenForge <-> the Style Manager's scales and settings.
    8182                        new Font_Convert(); // Bricks font manager: TTF/OTF faces get a WOFF2 (or WOFF) file.
    8283                }
  • tokenforge/tags/0.56.0/includes/platforms/class-bricks.php

    r3794418 r3797232  
    128128        public static function is_ours( $entry ) {
    129129                return isset( $entry['id'] ) && 0 === strpos( (string) $entry['id'], self::VAR_ID_PREFIX )
    130                         && isset( $entry['category'] ) && self::CATEGORY_ID === $entry['category'];
     130                        && isset( $entry['category'] ) && ( self::CATEGORY_ID === $entry['category'] || isset( Bricks_Style_Manager::scales()[ $entry['category'] ] ) );
    131131        }
    132132
    … …  
    302302         */
    303303        private function sync_variables( $tokens, $category_name, $prune = false ) {
    304                 $vars = (array) get_option( 'bricks_global_variables', array() );
     304                $vars = Bricks_Style_Manager::adopt( (array) get_option( 'bricks_global_variables', array() ) ); // Rows the builder re-created get our ids back.
    305305                $cats = (array) get_option( 'bricks_global_variables_categories', array() );
    306306
    … …  
    350350                                'category' => self::CATEGORY_ID,
    351351                        );
     352                        // Scale steps sit in the Style Manager's scale categories (Bricks_Style_Manager).
     353                        $scale = Bricks_Style_Manager::scale_of( $t['name'] );
     354                        if ( $scale ) {
     355                                $entry['category'] = $scale[0];
     356                                $entry['scale']    = array(
     357                                        'scale'     => $scale[1],
     358                                        'scaleName' => $scale[2],
     359                                );
     360                        }
    352361                        if ( isset( $by_id[ $id ] ) ) {
    353362                                $vars[ $by_id[ $id ] ] = $entry;
    … …  
    357366                }
    358367
    359                 update_option( 'bricks_global_variables', array_values( $vars ) );
     368                update_option( 'bricks_global_variables', self::scale_order( array_values( $vars ) ) );
     369        }
     370
     371        /**
     372         * Put each scale's variables in step order (small to large) in the slots
     373         * they already take: the builder regenerates a scale by position.
     374         *
     375         * @param array $vars Variables.
     376         * @return array
     377         */
     378        public static function scale_order( $vars ) {
     379                $slots = array();
     380                foreach ( $vars as $i => $v ) {
     381                        if ( isset( $v['category'], $v['scale']['scale'] ) && isset( Bricks_Style_Manager::scales()[ $v['category'] ] ) ) {
     382                                $slots[ $v['category'] ][] = $i;
     383                        }
     384                }
     385                foreach ( $slots as $idx ) {
     386                        $rows = array();
     387                        foreach ( $idx as $i ) {
     388                                $rows[] = $vars[ $i ];
     389                        }
     390                        usort(
     391                                $rows,
     392                                function ( $a, $b ) {
     393                                        $d = $a['scale']['scale'] - $b['scale']['scale'];
     394                                        return 0 !== $d ? $d : strcmp( (string) $a['id'], (string) $b['id'] );
     395                                }
     396                        );
     397                        foreach ( $idx as $n => $i ) {
     398                                $vars[ $i ] = $rows[ $n ];
     399                        }
     400                }
     401                return $vars;
    360402        }
    361403
  • tokenforge/tags/0.56.0/readme.txt

    r3794418 r3797232  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.55.0
     7Stable tag: 0.56.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    174174The accessibility checker (axe-core, MPL 2.0) is bundled with the plugin and runs only in the builder when an administrator presses Run check. Nothing else is contacted.
    175175
     176= How do I connect an AI agent (Claude, ChatGPT, Cursor) to TokenForge? =
     177
     178TokenForge's tools for AI agents are on by default (Options, AI agents). They reach your AI client through the WordPress MCP Adapter, the same connection the builder's own AI tools use:
     179
     1801. Install and activate the MCP Adapter plugin (https://github.com/WordPress/mcp-adapter). With Bricks 2.4 or later, Bricks > AI installs it for you and walks you through every step.
     1812. Create an application password for your user (Users > Profile > Application Passwords).
     1823. Add the site to your AI client as an MCP server that runs `npx -y @automattic/mcp-wordpress-remote@latest`, with three environment values: WP_API_URL (your site's `/wp-json/mcp/mcp-adapter-default-server`), WP_API_USERNAME (your user name) and WP_API_PASSWORD (the application password). Bricks > AI shows this setup ready to copy for each client.
     183
     184The agent then sees `tokenforge-get-framework`, `tokenforge-search`, `tokenforge-check-css` and `tokenforge-get-recipe`. The server instructions and, on Bricks, the builder's own start-here guide tell it to call `tokenforge-get-framework` first. That guide covers the tokens, the classes, BEM naming for its own classes (block__element--modifier, no site prefix) and, on Bricks, how classes are added: as global classes, never typed into an element's CSS classes field.
     185
    176186= Can I translate TokenForge? =
    177187
    … …  
    193203
    194204The full history is in CHANGELOG.md, also shown from the Changelog link next to TokenForge on the Plugins screen.
     205
     206= 0.56.0 =
     207* Bricks Style Manager: the text, heading and space sizes show as typography and spacing scales, and the HTML font size, screen widths and default mode fill its Settings. Changes made there come back into TokenForge.
     208* AI agents: the guide now covers BEM naming for an agent's own classes and, on Bricks, adding classes as global classes. The FAQ explains how to connect an AI client through the MCP Adapter.
     209* Fixed: the BEM class generator gave empty names in a builder shown in another alphabet (such as Bulgarian); labels are transliterated and unnamed elements are named by type.
     210* Deleting TokenForge also removes its short upgrade lock. The admin bar menu shows the TokenForge icon.
    195211
    196212= 0.55.0 =
  • tokenforge/tags/0.56.0/tokenforge.php

    r3794418 r3797232  
    44 * Plugin URI:        https://pristadigital.com
    55 * Description:       Design tokens, fluid scales and utility classes for any WordPress site, block editor included. With Bricks active it also syncs variables, colours, classes and a theme style both ways, and adds the dashboard inside the builder.
    6  * Version:           0.55.0
     6 * Version:           0.56.0
    77 * Requires at least: 5.9
    88 * Requires PHP:      7.4
    … …  
    1919defined( 'ABSPATH' ) || exit;
    2020
    21 define( 'TOKENFORGE_VERSION', '0.55.0' );
     21define( 'TOKENFORGE_VERSION', '0.56.0' );
    2222define( 'TOKENFORGE_FILE', __FILE__ );
    2323define( 'TOKENFORGE_DIR', plugin_dir_path( __FILE__ ) );
    … …  
    2929        function ( $class_name ) {
    3030                $map = array(
    31                         'TokenForge\\Plugin'                         => 'includes/class-plugin.php',
    32                         'TokenForge\\Settings'                       => 'includes/class-settings.php',
    33                         'TokenForge\\Css_Generator'                  => 'includes/class-css-generator.php',
    34                         'TokenForge\\Frontend'                       => 'includes/class-frontend.php',
    35                         'TokenForge\\Admin'                          => 'includes/class-admin.php',
    36                         'TokenForge\\Rest'                           => 'includes/class-rest.php',
    37                         'TokenForge\\Tokens'                         => 'includes/class-tokens.php',
    38                         'TokenForge\\Color_Engine'                   => 'includes/class-color-engine.php',
    39                         'TokenForge\\Scale_Engine'                   => 'includes/class-scale-engine.php',
    40                         'TokenForge\\Util'                           => 'includes/class-util.php',
    41                         'TokenForge\\Util_Grid'                      => 'includes/class-util-grid.php',
    42                         'TokenForge\\Util_Layout'                    => 'includes/class-util-layout.php',
    43                         'TokenForge\\Util_Text'                      => 'includes/class-util-text.php',
    44                         'TokenForge\\Defaults'                       => 'includes/class-defaults.php',
    45                         'TokenForge\\Components'                     => 'includes/class-components.php',
    46                         'TokenForge\\Scheme'                         => 'includes/class-scheme.php',
    47                         'TokenForge\\Extras'                         => 'includes/class-extras.php',
    48                         'TokenForge\\Content'                        => 'includes/class-content.php',
    49                         'TokenForge\\Width'                          => 'includes/class-width.php',
    50                         'TokenForge\\Motion'                         => 'includes/class-motion.php',
    51                         'TokenForge\\Overlays'                       => 'includes/class-overlays.php',
    52                         'TokenForge\\Attributes'                     => 'includes/class-attributes.php',
    53                         'TokenForge\\Blocks'                         => 'includes/class-blocks.php',
    54                         'TokenForge\\Acss_Import'                    => 'includes/class-acss-import.php',
    55                         'TokenForge\\Framework'                      => 'includes/class-framework.php',
    56                         'TokenForge\\Scss'                           => 'includes/class-scss.php',
    57                         'TokenForge\\Palette'                        => 'includes/class-palette.php',
    58                         'TokenForge\\Fonts'                          => 'includes/class-fonts.php',
    59                         'TokenForge\\Font_Convert'                   => 'includes/class-font-convert.php',
    60                         'TokenForge\\Modules'                        => 'includes/class-modules.php',
    61                         'TokenForge\\Factory'                        => 'includes/class-factory.php',
    62                         'TokenForge\\Token_Catalog'                  => 'includes/class-token-catalog.php',
    63                         'TokenForge\\Token_Usage'                    => 'includes/class-token-usage.php',
    64                         'TokenForge\\Class_Usage'                    => 'includes/class-class-usage.php',
    65                         'TokenForge\\Attribute_Usage'                => 'includes/class-attribute-usage.php',
    66                         'TokenForge\\Setup_Wizard'                   => 'includes/class-setup-wizard.php',
    67                         'TokenForge\\Starter'                        => 'includes/class-starter.php',
    68                         'TokenForge\\Transfer'                       => 'includes/class-transfer.php',
    69                         'TokenForge\\History'                        => 'includes/class-history.php',
    70                         'TokenForge\\Contrast'                       => 'includes/class-contrast.php',
    71                         'TokenForge\\Token_Files'                    => 'includes/class-token-files.php',
    72                         'TokenForge\\Changelog'                      => 'includes/class-changelog.php',
    73                         'TokenForge\\Woo'                            => 'includes/class-woo.php',
    74                         'TokenForge\\Platforms\\Bricks_Theme'        => 'includes/platforms/class-bricks-theme.php',
    75                         'TokenForge\\Recipes'                        => 'includes/class-recipes.php',
    76                         'TokenForge\\Cheatsheet'                     => 'includes/class-cheatsheet.php',
    77                         'TokenForge\\Ai'                             => 'includes/class-ai.php',
    78                         'TokenForge\\Platforms\\Bricks'              => 'includes/platforms/class-bricks.php',
    79                         'TokenForge\\Platforms\\Platforms'           => 'includes/platforms/class-platforms.php',
    80                         'TokenForge\\Features\\Bem_Generator'        => 'includes/features/class-bem-generator.php',
    81                         'TokenForge\\Features\\Builder_Panel'        => 'includes/features/class-builder-panel.php',
    82                         'TokenForge\\Features\\A11y'                 => 'includes/features/class-a11y.php',
    83                         'TokenForge\\Features\\Check'                => 'includes/features/class-check.php',
    84                         'TokenForge\\Features\\Builder_Enhancements' => 'includes/features/class-builder-enhancements.php',
    85                         'TokenForge\\Features\\Template_Classes'     => 'includes/features/class-template-classes.php',
    86                         'TokenForge\\Features\\Form_Extras'          => 'includes/features/class-form-extras.php',
    87                         'TokenForge\\Features\\Form_Fields'          => 'includes/features/class-form-fields.php',
    88                         'TokenForge\\Features\\Form_Rules'           => 'includes/features/class-form-rules.php',
    89                         'TokenForge\\Features\\Form_Presets'         => 'includes/features/class-form-presets.php',
    90                         'TokenForge\\Features\\Form_Submissions'     => 'includes/features/class-form-submissions.php',
     31                        'TokenForge\\Plugin'                          => 'includes/class-plugin.php',
     32                        'TokenForge\\Settings'                        => 'includes/class-settings.php',
     33                        'TokenForge\\Css_Generator'                   => 'includes/class-css-generator.php',
     34                        'TokenForge\\Frontend'                        => 'includes/class-frontend.php',
     35                        'TokenForge\\Admin'                           => 'includes/class-admin.php',
     36                        'TokenForge\\Rest'                            => 'includes/class-rest.php',
     37                        'TokenForge\\Tokens'                          => 'includes/class-tokens.php',
     38                        'TokenForge\\Color_Engine'                    => 'includes/class-color-engine.php',
     39                        'TokenForge\\Scale_Engine'                    => 'includes/class-scale-engine.php',
     40                        'TokenForge\\Util'                            => 'includes/class-util.php',
     41                        'TokenForge\\Util_Grid'                       => 'includes/class-util-grid.php',
     42                        'TokenForge\\Util_Layout'                     => 'includes/class-util-layout.php',
     43                        'TokenForge\\Util_Text'                       => 'includes/class-util-text.php',
     44                        'TokenForge\\Defaults'                        => 'includes/class-defaults.php',
     45                        'TokenForge\\Components'                      => 'includes/class-components.php',
     46                        'TokenForge\\Scheme'                          => 'includes/class-scheme.php',
     47                        'TokenForge\\Extras'                          => 'includes/class-extras.php',
     48                        'TokenForge\\Content'                         => 'includes/class-content.php',
     49                        'TokenForge\\Width'                           => 'includes/class-width.php',
     50                        'TokenForge\\Motion'                          => 'includes/class-motion.php',
     51                        'TokenForge\\Overlays'                        => 'includes/class-overlays.php',
     52                        'TokenForge\\Attributes'                      => 'includes/class-attributes.php',
     53                        'TokenForge\\Blocks'                          => 'includes/class-blocks.php',
     54                        'TokenForge\\Acss_Import'                     => 'includes/class-acss-import.php',
     55                        'TokenForge\\Framework'                       => 'includes/class-framework.php',
     56                        'TokenForge\\Scss'                            => 'includes/class-scss.php',
     57                        'TokenForge\\Palette'                         => 'includes/class-palette.php',
     58                        'TokenForge\\Fonts'                           => 'includes/class-fonts.php',
     59                        'TokenForge\\Font_Convert'                    => 'includes/class-font-convert.php',
     60                        'TokenForge\\Modules'                         => 'includes/class-modules.php',
     61                        'TokenForge\\Factory'                         => 'includes/class-factory.php',
     62                        'TokenForge\\Token_Catalog'                   => 'includes/class-token-catalog.php',
     63                        'TokenForge\\Token_Usage'                     => 'includes/class-token-usage.php',
     64                        'TokenForge\\Class_Usage'                     => 'includes/class-class-usage.php',
     65                        'TokenForge\\Attribute_Usage'                 => 'includes/class-attribute-usage.php',
     66                        'TokenForge\\Setup_Wizard'                    => 'includes/class-setup-wizard.php',
     67                        'TokenForge\\Starter'                         => 'includes/class-starter.php',
     68                        'TokenForge\\Transfer'                        => 'includes/class-transfer.php',
     69                        'TokenForge\\History'                         => 'includes/class-history.php',
     70                        'TokenForge\\Contrast'                        => 'includes/class-contrast.php',
     71                        'TokenForge\\Token_Files'                     => 'includes/class-token-files.php',
     72                        'TokenForge\\Changelog'                       => 'includes/class-changelog.php',
     73                        'TokenForge\\Woo'                             => 'includes/class-woo.php',
     74                        'TokenForge\\Platforms\\Bricks_Theme'         => 'includes/platforms/class-bricks-theme.php',
     75                        'TokenForge\\Platforms\\Bricks_Style_Manager' => 'includes/platforms/class-bricks-style-manager.php',
     76                        'TokenForge\\Recipes'                         => 'includes/class-recipes.php',
     77                        'TokenForge\\Cheatsheet'                      => 'includes/class-cheatsheet.php',
     78                        'TokenForge\\Ai'                              => 'includes/class-ai.php',
     79                        'TokenForge\\Platforms\\Bricks'               => 'includes/platforms/class-bricks.php',
     80                        'TokenForge\\Platforms\\Platforms'            => 'includes/platforms/class-platforms.php',
     81                        'TokenForge\\Features\\Bem_Generator'         => 'includes/features/class-bem-generator.php',
     82                        'TokenForge\\Features\\Builder_Panel'         => 'includes/features/class-builder-panel.php',
     83                        'TokenForge\\Features\\A11y'                  => 'includes/features/class-a11y.php',
     84                        'TokenForge\\Features\\Check'                 => 'includes/features/class-check.php',
     85                        'TokenForge\\Features\\Builder_Enhancements'  => 'includes/features/class-builder-enhancements.php',
     86                        'TokenForge\\Features\\Template_Classes'      => 'includes/features/class-template-classes.php',
     87                        'TokenForge\\Features\\Form_Extras'           => 'includes/features/class-form-extras.php',
     88                        'TokenForge\\Features\\Form_Fields'           => 'includes/features/class-form-fields.php',
     89                        'TokenForge\\Features\\Form_Rules'            => 'includes/features/class-form-rules.php',
     90                        'TokenForge\\Features\\Form_Presets'          => 'includes/features/class-form-presets.php',
     91                        'TokenForge\\Features\\Form_Submissions'      => 'includes/features/class-form-submissions.php',
    9192                        'TokenForge\\Features\\Form_Submissions_Screen' => 'includes/features/class-form-submissions-screen.php',
    9293                        'TokenForge\\Features\\Form_Submissions_Export' => 'includes/features/class-form-submissions-export.php',
    93                         'TokenForge\\Features\\A11y_Auto'            => 'includes/features/class-a11y-auto.php',
    94                         'TokenForge\\Features\\Attr_Front'           => 'includes/features/class-attr-front.php',
    95                         'TokenForge\\Cli'                            => 'includes/class-cli.php',
     94                        'TokenForge\\Features\\A11y_Auto'             => 'includes/features/class-a11y-auto.php',
     95                        'TokenForge\\Features\\Attr_Front'            => 'includes/features/class-attr-front.php',
     96                        'TokenForge\\Cli'                             => 'includes/class-cli.php',
    9697                );
    9798                if ( isset( $map[ $class_name ] ) ) {
  • tokenforge/tags/0.56.0/uninstall.php

    r3784841 r3797232  
    1919function tokenforge_uninstall_site() {
    2020        global $wpdb;
     21        // 0) The builder's style manager settings go back to what they were before TokenForge.
     22        $tf_sm = get_option( 'tokenforge_style_manager_sync' );
     23        $bsm   = get_option( 'bricks_style_manager' );
     24        if ( is_array( $tf_sm ) && isset( $tf_sm['backup'] ) && is_array( $tf_sm['backup'] ) && empty( $tf_sm['off'] ) && is_array( $bsm ) ) { // With the sync off they are back already.
     25                update_option( 'bricks_style_manager', array_merge( array_diff_key( $bsm, array_flip( array( 'htmlFontSize', 'minScreenWidth', 'maxScreenWidth', 'defaultMode' ) ) ), $tf_sm['backup'] ) );
     26        }
    2127        // 1) Delete our own options.
    2228        delete_option( 'tokenforge_tokens' );
    … …  
    2430        delete_option( 'tokenforge_css_meta' );
    2531        delete_option( 'tokenforge_acss_names' );
    26         foreach ( array( 'framework', 'scales', 'components', 'scheme', 'extras', 'defaults', 'content', 'width', 'motion', 'overlays', 'enhancements', 'scss', 'scss_build', 'scss_sync', 'recipes', 'palette', 'fonts', 'woo', 'modules', 'theme_sync', 'setup_pending', 'version', 'token_usage', 'class_usage', 'attribute_usage', 'builder_settings_backup', 'setup_wizard', 'history', 'form_sends', 'form_presets', 'subs_db', 'subs_base', 'subs_ack', 'subs_last' ) as $tf_opt ) {
     32        foreach ( array( 'framework', 'scales', 'components', 'scheme', 'extras', 'defaults', 'content', 'width', 'motion', 'overlays', 'enhancements', 'scss', 'scss_build', 'scss_sync', 'recipes', 'palette', 'fonts', 'woo', 'modules', 'theme_sync', 'style_manager_sync', 'setup_pending', 'version', 'token_usage', 'class_usage', 'attribute_usage', 'builder_settings_backup', 'setup_wizard', 'history', 'form_sends', 'form_presets', 'subs_db', 'subs_base', 'subs_ack', 'subs_last' ) as $tf_opt ) {
    2733                delete_option( 'tokenforge_' . $tf_opt );
    2834        }
     35        delete_transient( 'tokenforge_upgrading' ); // The upgrade lock (Plugin::maybe_upgrade), two minutes at most.
    2936        // Form submissions (Features\Form_Submissions): our status/notes table and auto-delete.
    3037        // The builder's own submissions table stays.
    … …  
    7986                                $vcats,
    8087                                function ( $c ) {
    81                                         return empty( $c['id'] ) || 'tokenforge' !== $c['id'];
     88                                        return empty( $c['id'] ) || 0 !== strpos( $c['id'], 'tokenforge' ); // Ours and the scale categories (tokenforge_text …).
    8289                                }
    8390                        )
    … …  
    125132                update_option( 'bricks_global_classes_categories', $ccats );
    126133        }
     134        // The builder's style manager CSS file still holds our scale variables until it is rebuilt.
     135        if ( is_callable( array( '\Bricks\Ajax', 'generate_style_manager_css_file' ) ) ) {
     136                \Bricks\Ajax::generate_style_manager_css_file();
     137        }
    127138}
    128139
  • tokenforge/trunk/CHANGELOG.md

    r3794418 r3797232  
    22
    33All the changes to TokenForge, newest first.
     4
     5## 0.56.0
     6
     7Bricks Style Manager: TokenForge now fills its Typography and Spacing panels. The text sizes (--text-xs to --text-xxl) and headings (--h6 to --h1) are two typography scales, and --space-xs to --space-xxl is a spacing scale, each with TokenForge's base size, ratio and per-step values (steps you set by hand under Scales show as manual values). The Settings panel gets TokenForge's HTML font size, min and max screen width and default mode. It works both ways: change a scale's base size, ratio or step values, or a setting, in the Style Manager and TokenForge takes it over and rebuilds. A builder tab opened before a TokenForge save never undoes that save (what you change in it still counts; with two tabs editing the same scale, the last save wins), and when the builder regenerates the scale variables with its own rounding, TokenForge's exact values are put back. Only administrators change TokenForge from there; what other builder users change is put back. Pressing Generate variables on a TokenForge scale keeps TokenForge's variables (no duplicates). All of this follows the "Tokens to builder global variables" switch (Options, Builder sync); switching it off, or deleting TokenForge, gives the Style Manager back the settings it had before. The Framework panel stays empty: it is a one-time paste importer and TokenForge already registers its variables and classes directly.
     8
     9AI agents: the framework guide and the builder's start-here guide now spell out BEM naming for an agent's own classes (block__element--modifier, named after the component, no site prefix, elements one level deep, layout from TokenForge classes) and, on Bricks, how classes are added: as global classes in the element's global class list, never typed into the CSS classes field or written as element custom CSS. The readme FAQ and Options, AI agents explain how to connect an AI client through the MCP Adapter.
     10
     11Fixed: the BEM class generator in the builder gave empty element names (block__) when the builder runs in a language with another alphabet, such as Bulgarian. Labels are now transliterated into Latin letters, an element without its own label is named by its type (block__image, block__text, block__heading), and an unnamed root suggests "block" for you to rename. Deleting TokenForge now also removes its short-lived upgrade lock. The TokenForge menu in the admin bar shows the TokenForge icon, as in the side menu, instead of a palette icon.
    412
    513## 0.55.0
  • tokenforge/trunk/assets/admin/admin.js

    r3794418 r3797232  
    312312                        P( __( 'Block editor', 'tokenforge' ), 'settings', [ S( 'gutenberg_palette', __( 'Colour palette', 'tokenforge' ), [ [ 'off', __( 'Theme palette', 'tokenforge' ) ], [ 'add', __( 'Add TokenForge colours', 'tokenforge' ) ], [ 'replace', __( 'Replace with TokenForge colours', 'tokenforge' ) ] ] ) ] ),
    313313                        P( __( 'TokenForge window', 'tokenforge' ), 'settings', [ K( 'panel_shortcut', __( 'Open / close shortcut', 'tokenforge' ), { h: __( 'Click the field, then press the keys (e.g. Alt+Shift+T). Works in the builder (also with the canvas focused) and on the site\u2019s pages.', 'tokenforge' ) } ), B( 'canvas_panel', __( 'Show in builder canvas while editing', 'tokenforge' ), { needs: 'canvas_tools' } ), B( 'frontend_panel', __( 'On the site\u2019s pages (administrators only)', 'tokenforge' ) ), B( 'frontend_launcher', __( 'Floating TokenForge button on the site\u2019s pages', 'tokenforge' ) ) ], { d: __( 'The dashboard as a dockable window. In the builder it opens with the shortcut or the TokenForge button; on the site\u2019s pages with the shortcut or the admin-bar TokenForge link (Ctrl/Cmd-click goes to wp-admin).', 'tokenforge' ) } ),
    314                         P( __( 'AI agents', 'tokenforge' ), 'settings', [ B( 'ai_abilities', __( 'TokenForge abilities for AI agents (MCP tools)', 'tokenforge' ) ), B( 'ai_guidance', __( 'Tell AI agents to build with TokenForge', 'tokenforge' ) ) ], { d: __( 'When an AI builds this site through the WordPress MCP Adapter or the builder’s AI abilities, it gets the tools <code>tokenforge-get-framework</code>, <code>tokenforge-search</code>, <code>tokenforge-check-css</code>, and <code>tokenforge-get-recipe</code>, and is told to use TokenForge classes and variables instead of hard-coded CSS.', 'tokenforge' ) } ),
     314                        P( __( 'AI agents', 'tokenforge' ), 'settings', [ B( 'ai_abilities', __( 'TokenForge abilities for AI agents (MCP tools)', 'tokenforge' ) ), B( 'ai_guidance', __( 'Tell AI agents to build with TokenForge', 'tokenforge' ) ) ], { d: __( 'When an AI builds this site through the WordPress MCP Adapter or the builder’s AI abilities, it gets the tools <code>tokenforge-get-framework</code>, <code>tokenforge-search</code>, <code>tokenforge-check-css</code>, and <code>tokenforge-get-recipe</code>, and is told to use TokenForge classes and variables instead of hard-coded CSS, and to name its own classes in BEM. To connect an AI client: install the MCP Adapter plugin (the builder’s AI screen can do it for you), create an application password under Users, Profile, and add the site to the client as an MCP server. The readme FAQ has the steps.', 'tokenforge' ) } ),
    315315                        P( __( 'Performance', 'tokenforge' ), 'settings', [ B( 'inline_css', __( 'Inline the stylesheet', 'tokenforge' ) ), B( 'hot_reload', __( 'Hot-reload CSS in open tabs after Save', 'tokenforge' ) ), B( 'admin_bar_link', __( 'Admin bar link', 'tokenforge' ) ) ] ),
    316316                        P( __( 'Breakpoints', 'tokenforge' ), 'scss', [ N( 'bp_xs', __( 'xs (px)', 'tokenforge' ) ), N( 'bp_s', __( 's (px)', 'tokenforge' ) ), N( 'bp_m', __( 'm (px)', 'tokenforge' ) ), N( 'bp_l', __( 'l (px)', 'tokenforge' ) ), N( 'bp_xl', __( 'xl (px)', 'tokenforge' ) ), N( 'bp_xxl', __( 'xxl (px)', 'tokenforge' ) ) ], { d: __( 'Widths in px for the breakpoint names (xs to xxl) used by the <code>?breakpoint-*</code> recipes and the responsive data attributes.', 'tokenforge' ) } ),
  • tokenforge/trunk/assets/admin/tips.js

    r3794418 r3797232  
    474474
    475475                // ---- Settings ----
    476                 'settings.sync_bricks_vars': __( 'Copies every token into the builder’s global variables, so they appear in its variable picker.', 'tokenforge' ),
     476                'settings.sync_bricks_vars': __( 'Copies every token into the builder’s global variables, so they appear in its variable picker. The text, heading and space sizes also show as typography and spacing scales in its style manager, with the HTML font size, screen widths and default mode in its settings. A scale or setting you change there comes back into TokenForge.', 'tokenforge' ),
    477477                'settings.vars_trans': __( 'Sends the transparent steps of every colour (primary-trans-10 … 90, white-trans-50 …) to the builder\x27s variable list. About 400 variables.', 'tokenforge' ),
    478478                'settings.vars_channels': __( 'Sends the parts colours are built from (primary-hex, primary-rgb, primary-h, primary-s …) to the builder\x27s variable list. You rarely pick these by hand. About 400 variables.', 'tokenforge' ),
  • tokenforge/trunk/assets/builder/bem-generator.js

    r3784841 r3797232  
    2727        function content( g ) { var s = unref( g.$_state ); return ( s && s.content ) || []; }
    2828        function classes( g ) { var s = unref( g.$_state ); return unref( g.$_globalClasses ) || ( s && unref( s.globalClasses ) ) || []; } // $_globalClasses and $_state.globalClasses are the same list
    29         function kebab( s ) { return ( s || '' ).toString().trim().toLowerCase().replace( /[^a-z0-9]+/g, '-' ).replace( /^-|-$/g, '' ); }
     29        // Cyrillic to Latin (Bulgarian streamlined system, plus the other common letters); other accents are stripped.
     30        var CYR = { 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh', 'щ': 'sht', 'ъ': 'a', 'ь': 'y', 'ю': 'yu', 'я': 'ya', 'ё': 'yo', 'ы': 'y', 'э': 'e', 'є': 'ye', 'і': 'i', 'ї': 'yi', 'ґ': 'g', 'ў': 'u', 'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz', 'ѓ': 'gj', 'ќ': 'kj', 'ѕ': 'dz' };
     31        function latin( s ) {
     32                s = ( s || '' ).toString().toLowerCase().replace( /[Ѐ-ӿ]/g, function ( c ) { return CYR[ c ] != null ? CYR[ c ] : ''; } );
     33                return s.normalize ? s.normalize( 'NFD' ).replace( /[̀-ͯ]/g, '' ) : s;
     34        }
     35        function kebab( s ) { return latin( s ).trim().replace( /[^a-z0-9]+/g, '-' ).replace( /^-|-$/g, '' ); }
     36        // Element part for an element the user has not renamed: its type in English, so a translated builder still gives card__image.
     37        var TYPE_PART = { 'text-basic': 'text', 'rich-text': 'text', 'text-link': 'link', 'nav-menu': 'nav', 'nav-nested': 'nav', 'div': 'content', 'block': 'content', 'container': 'content' };
     38        function partOf( g, el ) {
     39                var named = kebab( el.label );
     40                if ( named ) { return named; }
     41                var type = kebab( el.name );
     42                return TYPE_PART[ type ] || type || kebab( labelOf( g, el ) ) || 'item';
     43        }
    3044        function rid() { var s = ''; while ( s.length < 6 ) { s += Math.random().toString( 36 ).slice( 2 ); } return s.slice( 0, 6 ); }
    3145        function userId() { try { return ( window.bricksData && bricksData.user && bricksData.user.id ) || 0; } catch ( e ) { return 0; } }
    … …  
    88102                closeDialog();
    89103
    90                 var block = kebab( labelOf( g, root ) ) || 'block';
     104                var block = kebab( root.label ) || 'block'; // an unnamed Div gives "block", selected below for typing
    91105                var kids = descendants( g, root );
    92106
    … …  
    98112                                        '<label class="tf-bem-lbl">Block name</label>' +
    99113                                        '<input class="tf-bem-block" type="text" value="' + esc( block ) + '">' +
    100                                         '<div class="tf-bem-hint">' + ( kids.length ) + ' descendant element(s). Each gets <code>block__&lt;label&gt;</code>. Edit any class below.</div>' +
     114                                        '<div class="tf-bem-hint">' + ( kids.length ) + ' descendant element(s). Each gets <code>block__element</code> from its label, or its type when it has no label of its own. Edit any class below.</div>' +
    101115                                        '<div class="tf-bem-rows"></div>' +
    102116                                '</div>' +
    … …  
    111125                // row model: {id, label, custom:false, cls}
    112126                var rows = [ { id: root.id, label: labelOf( g, root ), isRoot: true } ].concat(
    113                         kids.map( function ( k ) { return { id: k.id, label: labelOf( g, k ), isRoot: false }; } )
     127                        kids.map( function ( k ) { return { id: k.id, label: labelOf( g, k ), part: partOf( g, k ), isRoot: false }; } )
    114128                );
    115129
    116130                function classFor( r ) {
    117131                        if ( r.custom != null ) { return r.custom; }
    118                         return r.isRoot ? blockInput.value.trim() : ( blockInput.value.trim() + '__' + kebab( r.label ) );
     132                        var b = kebab( blockInput.value ) || 'block';
     133                        return r.isRoot ? b : ( b + '__' + r.part );
    119134                }
    120135                function renderRows() {
  • tokenforge/trunk/includes/class-ai.php

    r3794418 r3797232  
    7878        public static function pointer() {
    7979                return 'This site is styled with the TokenForge CSS framework. Before creating or styling pages, call the tool tokenforge-get-framework once, then build with its classes and var(--tokens) instead of hard-coded colours, sizes and spacing. Check new CSS with tokenforge-check-css; look things up with tokenforge-search.';
     80        }
     81
     82        /**
     83         * How to name your own classes (BEM).
     84         *
     85         * @return string
     86         */
     87        public static function bem_rule() {
     88                return 'Name it BEM: `block__element--modifier`, all lowercase Latin letters, digits and hyphens. The block is what the component is (`case-study`, `pricing`, `team`), never a site or project prefix (`pd-`, `site-`) and never a layout word a TokenForge class already covers (`grid`, `row`, `stack`). Elements are one level only (`case-study__title`, not `case-study__header__title`); a variant is a modifier class next to the base class (`case-study case-study--featured`). Layout, spacing, colour and text size come from TokenForge classes on the same element (`case-study grid-2 gap-m`), so a BEM class holds only what is unique to the component.';
     89        }
     90
     91        /**
     92         * How classes reach elements in Bricks.
     93         *
     94         * @return string
     95         */
     96        public static function bricks_class_rule() {
     97                return 'Every class is a Bricks global class. When you send HTML to the import tools, class names in `class=""` are matched to global classes. When you write element settings yourself, put global class ids in `_cssGlobalClasses` (create new BEM classes first with bricks-batch-create-global-classes, after bricks-list-global-classes, and give them their CSS there), never class names in `_cssClasses` (the "CSS classes" text field) and never component styles in an element\'s own custom CSS (`_cssCustom`, `%root%`).';
    8098        }
    8199
    … …  
    557575                        '1. **No hard-coded design values.** Colours, font sizes, spacing, radius, shadows and widths come from tokens: `var(--primary)`, `var(--base-dark)`, `var(--text-l)`, `var(--h2)`, `var(--space-m)`, `var(--section-space-l)`, `var(--radius)`, `var(--shadow-2)`, `var(--content-width)`. Run `tokenforge-check-css` on your CSS to catch misses.',
    558576                        '2. **Use framework classes first.** Buttons `btn--primary`, cards `card`, section spacing `section--l`, backgrounds `bg--dark`, text sizes `text--l`, heading looks `h3`, grids `grid-3`, gaps `gap-m`, padding `pad-m`. Look anything up with `tokenforge-search` (e.g. "outline button").',
    559                         '3. **Never restyle or redefine a TokenForge class** and never create a class or variable with a TokenForge name. For custom styling add your own BEM class (block__element--modifier) and use tokens inside it.',
     577                        '3. **Never restyle or redefine a TokenForge class** and never create a class or variable with a TokenForge name. For custom styling add your own BEM class and use tokens inside it. ' . self::bem_rule(),
    560578                        '4. **Let the automatic layout work.** Top-level `<section>` elements already get side gutters (`var(--gutter)`) and vertical padding (`var(--section-space-m)`)' . ( ! empty( $c['auto_container_gap'] ) ? '; their children are spaced by `var(--container-gap)`' : '' ) . ( ! empty( $c['auto_content_gap'] ) ? ', and children of containers/blocks/divs by `var(--content-gap)`' : '' ) . '. Do not add margins between stacked elements or padding to sections unless the design needs a different size: then use `section--{size}` or `section--{a}-to-{b}`.',
    561579                        '5. **Typography is global.** Body text and h1 to h6 already have fonts, fluid sizes, line heights and colours. Do not set font-family, font-size or line-height on headings or paragraphs; to make any element look like a heading use the class `h2`, for bigger body text `text--l`.',
    … …  
    574592                        '## Page structure',
    575593                        $bricks
    576                                 ? 'Bricks: `<section>` (full width, gets gutters and padding) → `<div class="brxe-container">` (' . ( ! empty( $c['container_width'] ) ? 'centred at the content width' : 'Bricks container' ) . ') → content. Put TokenForge class names straight into `class=""`: they already exist as Bricks global classes, so do not send CSS rules for them and do not recreate them.'
     594                                ? 'Bricks: `<section>` (full width, gets gutters and padding) → `<div class="brxe-container">` (' . ( ! empty( $c['container_width'] ) ? 'centred at the content width' : 'Bricks container' ) . ') → content. Put TokenForge class names straight into `class=""`: they already exist as Bricks global classes, so do not send CSS rules for them and do not recreate them. ' . self::bricks_class_rule()
    577595                                : 'Use `<section>` for full-width bands (they get gutters and padding) and a `<div class="container">` inside to centre content at the content width.',
    578596                        'Content grid: `content-grid` on a section makes children sit in a centred column; `content--feature`, `content--feature-max`, `content--full` break out wider.',
    … …  
    10731091         */
    10741092        public function bricks_start_here( $text ) {
    1075                 return rtrim( (string) $text ) . "\n\n## TokenForge (this site’s CSS framework)\n\n" . self::pointer() . "\n\n- Put TokenForge class names (btn--primary, card, section--l, bg--dark, grid-3 …) directly in the HTML class attribute; they already exist as global classes, so send no CSS for them and never recreate them.\n- In your own classes use var(--tokens) for every colour, size, spacing, radius and shadow.\n- Sections already get gutters and padding, and stacked children get automatic gaps: do not add margins or section padding unless the design needs a different size.\n- Headings and body text are styled globally: do not set font-family, font-size or line-height on them.\n";
     1093                return rtrim( (string) $text ) . "\n\n## TokenForge (this site’s CSS framework)\n\n" . self::pointer() . "\n\n- Put TokenForge class names (btn--primary, card, section--l, bg--dark, grid-3 …) directly in the HTML class attribute; they already exist as global classes, so send no CSS for them and never recreate them.\n- " . self::bricks_class_rule() . "\n- Your own classes: " . self::bem_rule() . "\n- In your own classes use var(--tokens) for every colour, size, spacing, radius and shadow.\n- Sections already get gutters and padding, and stacked children get automatic gaps: do not add margins or section padding unless the design needs a different size.\n- Headings and body text are styled globally: do not set font-family, font-size or line-height on them.\n";
    10761094        }
    10771095
    … …  
    10981116                                        'Use TokenForge classes in HTML as they are (btn--primary, card, section--l, bg--dark, grid-3, gap-m, text--l, h2); do not send CSS for them or recreate them.',
    10991117                                        'Use var(--tokens) for every colour, font size, spacing, radius, shadow and width in custom CSS.',
     1118                                        'Your own classes: ' . self::bem_rule(),
     1119                                        self::bricks_class_rule(),
    11001120                                        'Sections get gutters and padding, stacked children get gaps, headings and text are styled globally.',
    11011121                                ),
  • tokenforge/trunk/includes/class-frontend.php

    r3794418 r3797232  
    221221                        array(
    222222                                'id'    => 'tokenforge',
    223                                 'title' => '<span class="ab-icon dashicons dashicons-art" style="top:2px"></span>' . esc_html__( 'TokenForge', 'tokenforge' ),
     223                                'title' => '<span class="ab-icon" aria-hidden="true" style="top:2px;width:20px;height:20px;background:url(' . esc_url( TOKENFORGE_URL . 'assets/admin/tokenforge-icon.svg' ) . ') center/20px no-repeat !important"></span>' . esc_html__( 'TokenForge', 'tokenforge' ),
    224224                                'href'  => admin_url( 'admin.php?page=tokenforge' ),
    225225                        )
  • tokenforge/trunk/includes/class-plugin.php

    r3794418 r3797232  
    7979                        new Features\Form_Submissions(); // the builder's submissions screen, extended (when switched on).
    8080                        new Platforms\Bricks_Theme(); // TokenForge <-> the site's Bricks theme style.
     81                        new Platforms\Bricks_Style_Manager(); // TokenForge <-> the Style Manager's scales and settings.
    8182                        new Font_Convert(); // Bricks font manager: TTF/OTF faces get a WOFF2 (or WOFF) file.
    8283                }
  • tokenforge/trunk/includes/platforms/class-bricks.php

    r3794418 r3797232  
    128128        public static function is_ours( $entry ) {
    129129                return isset( $entry['id'] ) && 0 === strpos( (string) $entry['id'], self::VAR_ID_PREFIX )
    130                         && isset( $entry['category'] ) && self::CATEGORY_ID === $entry['category'];
     130                        && isset( $entry['category'] ) && ( self::CATEGORY_ID === $entry['category'] || isset( Bricks_Style_Manager::scales()[ $entry['category'] ] ) );
    131131        }
    132132
    … …  
    302302         */
    303303        private function sync_variables( $tokens, $category_name, $prune = false ) {
    304                 $vars = (array) get_option( 'bricks_global_variables', array() );
     304                $vars = Bricks_Style_Manager::adopt( (array) get_option( 'bricks_global_variables', array() ) ); // Rows the builder re-created get our ids back.
    305305                $cats = (array) get_option( 'bricks_global_variables_categories', array() );
    306306
    … …  
    350350                                'category' => self::CATEGORY_ID,
    351351                        );
     352                        // Scale steps sit in the Style Manager's scale categories (Bricks_Style_Manager).
     353                        $scale = Bricks_Style_Manager::scale_of( $t['name'] );
     354                        if ( $scale ) {
     355                                $entry['category'] = $scale[0];
     356                                $entry['scale']    = array(
     357                                        'scale'     => $scale[1],
     358                                        'scaleName' => $scale[2],
     359                                );
     360                        }
    352361                        if ( isset( $by_id[ $id ] ) ) {
    353362                                $vars[ $by_id[ $id ] ] = $entry;
    … …  
    357366                }
    358367
    359                 update_option( 'bricks_global_variables', array_values( $vars ) );
     368                update_option( 'bricks_global_variables', self::scale_order( array_values( $vars ) ) );
     369        }
     370
     371        /**
     372         * Put each scale's variables in step order (small to large) in the slots
     373         * they already take: the builder regenerates a scale by position.
     374         *
     375         * @param array $vars Variables.
     376         * @return array
     377         */
     378        public static function scale_order( $vars ) {
     379                $slots = array();
     380                foreach ( $vars as $i => $v ) {
     381                        if ( isset( $v['category'], $v['scale']['scale'] ) && isset( Bricks_Style_Manager::scales()[ $v['category'] ] ) ) {
     382                                $slots[ $v['category'] ][] = $i;
     383                        }
     384                }
     385                foreach ( $slots as $idx ) {
     386                        $rows = array();
     387                        foreach ( $idx as $i ) {
     388                                $rows[] = $vars[ $i ];
     389                        }
     390                        usort(
     391                                $rows,
     392                                function ( $a, $b ) {
     393                                        $d = $a['scale']['scale'] - $b['scale']['scale'];
     394                                        return 0 !== $d ? $d : strcmp( (string) $a['id'], (string) $b['id'] );
     395                                }
     396                        );
     397                        foreach ( $idx as $n => $i ) {
     398                                $vars[ $i ] = $rows[ $n ];
     399                        }
     400                }
     401                return $vars;
    360402        }
    361403
  • tokenforge/trunk/readme.txt

    r3794418 r3797232  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.55.0
     7Stable tag: 0.56.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    174174The accessibility checker (axe-core, MPL 2.0) is bundled with the plugin and runs only in the builder when an administrator presses Run check. Nothing else is contacted.
    175175
     176= How do I connect an AI agent (Claude, ChatGPT, Cursor) to TokenForge? =
     177
     178TokenForge's tools for AI agents are on by default (Options, AI agents). They reach your AI client through the WordPress MCP Adapter, the same connection the builder's own AI tools use:
     179
     1801. Install and activate the MCP Adapter plugin (https://github.com/WordPress/mcp-adapter). With Bricks 2.4 or later, Bricks > AI installs it for you and walks you through every step.
     1812. Create an application password for your user (Users > Profile > Application Passwords).
     1823. Add the site to your AI client as an MCP server that runs `npx -y @automattic/mcp-wordpress-remote@latest`, with three environment values: WP_API_URL (your site's `/wp-json/mcp/mcp-adapter-default-server`), WP_API_USERNAME (your user name) and WP_API_PASSWORD (the application password). Bricks > AI shows this setup ready to copy for each client.
     183
     184The agent then sees `tokenforge-get-framework`, `tokenforge-search`, `tokenforge-check-css` and `tokenforge-get-recipe`. The server instructions and, on Bricks, the builder's own start-here guide tell it to call `tokenforge-get-framework` first. That guide covers the tokens, the classes, BEM naming for its own classes (block__element--modifier, no site prefix) and, on Bricks, how classes are added: as global classes, never typed into an element's CSS classes field.
     185
    176186= Can I translate TokenForge? =
    177187
    … …  
    193203
    194204The full history is in CHANGELOG.md, also shown from the Changelog link next to TokenForge on the Plugins screen.
     205
     206= 0.56.0 =
     207* Bricks Style Manager: the text, heading and space sizes show as typography and spacing scales, and the HTML font size, screen widths and default mode fill its Settings. Changes made there come back into TokenForge.
     208* AI agents: the guide now covers BEM naming for an agent's own classes and, on Bricks, adding classes as global classes. The FAQ explains how to connect an AI client through the MCP Adapter.
     209* Fixed: the BEM class generator gave empty names in a builder shown in another alphabet (such as Bulgarian); labels are transliterated and unnamed elements are named by type.
     210* Deleting TokenForge also removes its short upgrade lock. The admin bar menu shows the TokenForge icon.
    195211
    196212= 0.55.0 =
  • tokenforge/trunk/tokenforge.php

    r3794418 r3797232  
    44 * Plugin URI:        https://pristadigital.com
    55 * Description:       Design tokens, fluid scales and utility classes for any WordPress site, block editor included. With Bricks active it also syncs variables, colours, classes and a theme style both ways, and adds the dashboard inside the builder.
    6  * Version:           0.55.0
     6 * Version:           0.56.0
    77 * Requires at least: 5.9
    88 * Requires PHP:      7.4
    … …  
    1919defined( 'ABSPATH' ) || exit;
    2020
    21 define( 'TOKENFORGE_VERSION', '0.55.0' );
     21define( 'TOKENFORGE_VERSION', '0.56.0' );
    2222define( 'TOKENFORGE_FILE', __FILE__ );
    2323define( 'TOKENFORGE_DIR', plugin_dir_path( __FILE__ ) );
    … …  
    2929        function ( $class_name ) {
    3030                $map = array(
    31                         'TokenForge\\Plugin'                         => 'includes/class-plugin.php',
    32                         'TokenForge\\Settings'                       => 'includes/class-settings.php',
    33                         'TokenForge\\Css_Generator'                  => 'includes/class-css-generator.php',
    34                         'TokenForge\\Frontend'                       => 'includes/class-frontend.php',
    35                         'TokenForge\\Admin'                          => 'includes/class-admin.php',
    36                         'TokenForge\\Rest'                           => 'includes/class-rest.php',
    37                         'TokenForge\\Tokens'                         => 'includes/class-tokens.php',
    38                         'TokenForge\\Color_Engine'                   => 'includes/class-color-engine.php',
    39                         'TokenForge\\Scale_Engine'                   => 'includes/class-scale-engine.php',
    40                         'TokenForge\\Util'                           => 'includes/class-util.php',
    41                         'TokenForge\\Util_Grid'                      => 'includes/class-util-grid.php',
    42                         'TokenForge\\Util_Layout'                    => 'includes/class-util-layout.php',
    43                         'TokenForge\\Util_Text'                      => 'includes/class-util-text.php',
    44                         'TokenForge\\Defaults'                       => 'includes/class-defaults.php',
    45                         'TokenForge\\Components'                     => 'includes/class-components.php',
    46                         'TokenForge\\Scheme'                         => 'includes/class-scheme.php',
    47                         'TokenForge\\Extras'                         => 'includes/class-extras.php',
    48                         'TokenForge\\Content'                        => 'includes/class-content.php',
    49                         'TokenForge\\Width'                          => 'includes/class-width.php',
    50                         'TokenForge\\Motion'                         => 'includes/class-motion.php',
    51                         'TokenForge\\Overlays'                       => 'includes/class-overlays.php',
    52                         'TokenForge\\Attributes'                     => 'includes/class-attributes.php',
    53                         'TokenForge\\Blocks'                         => 'includes/class-blocks.php',
    54                         'TokenForge\\Acss_Import'                    => 'includes/class-acss-import.php',
    55                         'TokenForge\\Framework'                      => 'includes/class-framework.php',
    56                         'TokenForge\\Scss'                           => 'includes/class-scss.php',
    57                         'TokenForge\\Palette'                        => 'includes/class-palette.php',
    58                         'TokenForge\\Fonts'                          => 'includes/class-fonts.php',
    59                         'TokenForge\\Font_Convert'                   => 'includes/class-font-convert.php',
    60                         'TokenForge\\Modules'                        => 'includes/class-modules.php',
    61                         'TokenForge\\Factory'                        => 'includes/class-factory.php',
    62                         'TokenForge\\Token_Catalog'                  => 'includes/class-token-catalog.php',
    63                         'TokenForge\\Token_Usage'                    => 'includes/class-token-usage.php',
    64                         'TokenForge\\Class_Usage'                    => 'includes/class-class-usage.php',
    65                         'TokenForge\\Attribute_Usage'                => 'includes/class-attribute-usage.php',
    66                         'TokenForge\\Setup_Wizard'                   => 'includes/class-setup-wizard.php',
    67                         'TokenForge\\Starter'                        => 'includes/class-starter.php',
    68                         'TokenForge\\Transfer'                       => 'includes/class-transfer.php',
    69                         'TokenForge\\History'                        => 'includes/class-history.php',
    70                         'TokenForge\\Contrast'                       => 'includes/class-contrast.php',
    71                         'TokenForge\\Token_Files'                    => 'includes/class-token-files.php',
    72                         'TokenForge\\Changelog'                      => 'includes/class-changelog.php',
    73                         'TokenForge\\Woo'                            => 'includes/class-woo.php',
    74                         'TokenForge\\Platforms\\Bricks_Theme'        => 'includes/platforms/class-bricks-theme.php',
    75                         'TokenForge\\Recipes'                        => 'includes/class-recipes.php',
    76                         'TokenForge\\Cheatsheet'                     => 'includes/class-cheatsheet.php',
    77                         'TokenForge\\Ai'                             => 'includes/class-ai.php',
    78                         'TokenForge\\Platforms\\Bricks'              => 'includes/platforms/class-bricks.php',
    79                         'TokenForge\\Platforms\\Platforms'           => 'includes/platforms/class-platforms.php',
    80                         'TokenForge\\Features\\Bem_Generator'        => 'includes/features/class-bem-generator.php',
    81                         'TokenForge\\Features\\Builder_Panel'        => 'includes/features/class-builder-panel.php',
    82                         'TokenForge\\Features\\A11y'                 => 'includes/features/class-a11y.php',
    83                         'TokenForge\\Features\\Check'                => 'includes/features/class-check.php',
    84                         'TokenForge\\Features\\Builder_Enhancements' => 'includes/features/class-builder-enhancements.php',
    85                         'TokenForge\\Features\\Template_Classes'     => 'includes/features/class-template-classes.php',
    86                         'TokenForge\\Features\\Form_Extras'          => 'includes/features/class-form-extras.php',
    87                         'TokenForge\\Features\\Form_Fields'          => 'includes/features/class-form-fields.php',
    88                         'TokenForge\\Features\\Form_Rules'           => 'includes/features/class-form-rules.php',
    89                         'TokenForge\\Features\\Form_Presets'         => 'includes/features/class-form-presets.php',
    90                         'TokenForge\\Features\\Form_Submissions'     => 'includes/features/class-form-submissions.php',
     31                        'TokenForge\\Plugin'                          => 'includes/class-plugin.php',
     32                        'TokenForge\\Settings'                        => 'includes/class-settings.php',
     33                        'TokenForge\\Css_Generator'                   => 'includes/class-css-generator.php',
     34                        'TokenForge\\Frontend'                        => 'includes/class-frontend.php',
     35                        'TokenForge\\Admin'                           => 'includes/class-admin.php',
     36                        'TokenForge\\Rest'                            => 'includes/class-rest.php',
     37                        'TokenForge\\Tokens'                          => 'includes/class-tokens.php',
     38                        'TokenForge\\Color_Engine'                    => 'includes/class-color-engine.php',
     39                        'TokenForge\\Scale_Engine'                    => 'includes/class-scale-engine.php',
     40                        'TokenForge\\Util'                            => 'includes/class-util.php',
     41                        'TokenForge\\Util_Grid'                       => 'includes/class-util-grid.php',
     42                        'TokenForge\\Util_Layout'                     => 'includes/class-util-layout.php',
     43                        'TokenForge\\Util_Text'                       => 'includes/class-util-text.php',
     44                        'TokenForge\\Defaults'                        => 'includes/class-defaults.php',
     45                        'TokenForge\\Components'                      => 'includes/class-components.php',
     46                        'TokenForge\\Scheme'                          => 'includes/class-scheme.php',
     47                        'TokenForge\\Extras'                          => 'includes/class-extras.php',
     48                        'TokenForge\\Content'                         => 'includes/class-content.php',
     49                        'TokenForge\\Width'                           => 'includes/class-width.php',
     50                        'TokenForge\\Motion'                          => 'includes/class-motion.php',
     51                        'TokenForge\\Overlays'                        => 'includes/class-overlays.php',
     52                        'TokenForge\\Attributes'                      => 'includes/class-attributes.php',
     53                        'TokenForge\\Blocks'                          => 'includes/class-blocks.php',
     54                        'TokenForge\\Acss_Import'                     => 'includes/class-acss-import.php',
     55                        'TokenForge\\Framework'                       => 'includes/class-framework.php',
     56                        'TokenForge\\Scss'                            => 'includes/class-scss.php',
     57                        'TokenForge\\Palette'                         => 'includes/class-palette.php',
     58                        'TokenForge\\Fonts'                           => 'includes/class-fonts.php',
     59                        'TokenForge\\Font_Convert'                    => 'includes/class-font-convert.php',
     60                        'TokenForge\\Modules'                         => 'includes/class-modules.php',
     61                        'TokenForge\\Factory'                         => 'includes/class-factory.php',
     62                        'TokenForge\\Token_Catalog'                   => 'includes/class-token-catalog.php',
     63                        'TokenForge\\Token_Usage'                     => 'includes/class-token-usage.php',
     64                        'TokenForge\\Class_Usage'                     => 'includes/class-class-usage.php',
     65                        'TokenForge\\Attribute_Usage'                 => 'includes/class-attribute-usage.php',
     66                        'TokenForge\\Setup_Wizard'                    => 'includes/class-setup-wizard.php',
     67                        'TokenForge\\Starter'                         => 'includes/class-starter.php',
     68                        'TokenForge\\Transfer'                        => 'includes/class-transfer.php',
     69                        'TokenForge\\History'                         => 'includes/class-history.php',
     70                        'TokenForge\\Contrast'                        => 'includes/class-contrast.php',
     71                        'TokenForge\\Token_Files'                     => 'includes/class-token-files.php',
     72                        'TokenForge\\Changelog'                       => 'includes/class-changelog.php',
     73                        'TokenForge\\Woo'                             => 'includes/class-woo.php',
     74                        'TokenForge\\Platforms\\Bricks_Theme'         => 'includes/platforms/class-bricks-theme.php',
     75                        'TokenForge\\Platforms\\Bricks_Style_Manager' => 'includes/platforms/class-bricks-style-manager.php',
     76                        'TokenForge\\Recipes'                         => 'includes/class-recipes.php',
     77                        'TokenForge\\Cheatsheet'                      => 'includes/class-cheatsheet.php',
     78                        'TokenForge\\Ai'                              => 'includes/class-ai.php',
     79                        'TokenForge\\Platforms\\Bricks'               => 'includes/platforms/class-bricks.php',
     80                        'TokenForge\\Platforms\\Platforms'            => 'includes/platforms/class-platforms.php',
     81                        'TokenForge\\Features\\Bem_Generator'         => 'includes/features/class-bem-generator.php',
     82                        'TokenForge\\Features\\Builder_Panel'         => 'includes/features/class-builder-panel.php',
     83                        'TokenForge\\Features\\A11y'                  => 'includes/features/class-a11y.php',
     84                        'TokenForge\\Features\\Check'                 => 'includes/features/class-check.php',
     85                        'TokenForge\\Features\\Builder_Enhancements'  => 'includes/features/class-builder-enhancements.php',
     86                        'TokenForge\\Features\\Template_Classes'      => 'includes/features/class-template-classes.php',
     87                        'TokenForge\\Features\\Form_Extras'           => 'includes/features/class-form-extras.php',
     88                        'TokenForge\\Features\\Form_Fields'           => 'includes/features/class-form-fields.php',
     89                        'TokenForge\\Features\\Form_Rules'            => 'includes/features/class-form-rules.php',
     90                        'TokenForge\\Features\\Form_Presets'          => 'includes/features/class-form-presets.php',
     91                        'TokenForge\\Features\\Form_Submissions'      => 'includes/features/class-form-submissions.php',
    9192                        'TokenForge\\Features\\Form_Submissions_Screen' => 'includes/features/class-form-submissions-screen.php',
    9293                        'TokenForge\\Features\\Form_Submissions_Export' => 'includes/features/class-form-submissions-export.php',
    93                         'TokenForge\\Features\\A11y_Auto'            => 'includes/features/class-a11y-auto.php',
    94                         'TokenForge\\Features\\Attr_Front'           => 'includes/features/class-attr-front.php',
    95                         'TokenForge\\Cli'                            => 'includes/class-cli.php',
     94                        'TokenForge\\Features\\A11y_Auto'             => 'includes/features/class-a11y-auto.php',
     95                        'TokenForge\\Features\\Attr_Front'            => 'includes/features/class-attr-front.php',
     96                        'TokenForge\\Cli'                             => 'includes/class-cli.php',
    9697                );
    9798                if ( isset( $map[ $class_name ] ) ) {
  • tokenforge/trunk/uninstall.php

    r3784841 r3797232  
    1919function tokenforge_uninstall_site() {
    2020        global $wpdb;
     21        // 0) The builder's style manager settings go back to what they were before TokenForge.
     22        $tf_sm = get_option( 'tokenforge_style_manager_sync' );
     23        $bsm   = get_option( 'bricks_style_manager' );
     24        if ( is_array( $tf_sm ) && isset( $tf_sm['backup'] ) && is_array( $tf_sm['backup'] ) && empty( $tf_sm['off'] ) && is_array( $bsm ) ) { // With the sync off they are back already.
     25                update_option( 'bricks_style_manager', array_merge( array_diff_key( $bsm, array_flip( array( 'htmlFontSize', 'minScreenWidth', 'maxScreenWidth', 'defaultMode' ) ) ), $tf_sm['backup'] ) );
     26        }
    2127        // 1) Delete our own options.
    2228        delete_option( 'tokenforge_tokens' );
    … …  
    2430        delete_option( 'tokenforge_css_meta' );
    2531        delete_option( 'tokenforge_acss_names' );
    26         foreach ( array( 'framework', 'scales', 'components', 'scheme', 'extras', 'defaults', 'content', 'width', 'motion', 'overlays', 'enhancements', 'scss', 'scss_build', 'scss_sync', 'recipes', 'palette', 'fonts', 'woo', 'modules', 'theme_sync', 'setup_pending', 'version', 'token_usage', 'class_usage', 'attribute_usage', 'builder_settings_backup', 'setup_wizard', 'history', 'form_sends', 'form_presets', 'subs_db', 'subs_base', 'subs_ack', 'subs_last' ) as $tf_opt ) {
     32        foreach ( array( 'framework', 'scales', 'components', 'scheme', 'extras', 'defaults', 'content', 'width', 'motion', 'overlays', 'enhancements', 'scss', 'scss_build', 'scss_sync', 'recipes', 'palette', 'fonts', 'woo', 'modules', 'theme_sync', 'style_manager_sync', 'setup_pending', 'version', 'token_usage', 'class_usage', 'attribute_usage', 'builder_settings_backup', 'setup_wizard', 'history', 'form_sends', 'form_presets', 'subs_db', 'subs_base', 'subs_ack', 'subs_last' ) as $tf_opt ) {
    2733                delete_option( 'tokenforge_' . $tf_opt );
    2834        }
     35        delete_transient( 'tokenforge_upgrading' ); // The upgrade lock (Plugin::maybe_upgrade), two minutes at most.
    2936        // Form submissions (Features\Form_Submissions): our status/notes table and auto-delete.
    3037        // The builder's own submissions table stays.
    … …  
    7986                                $vcats,
    8087                                function ( $c ) {
    81                                         return empty( $c['id'] ) || 'tokenforge' !== $c['id'];
     88                                        return empty( $c['id'] ) || 0 !== strpos( $c['id'], 'tokenforge' ); // Ours and the scale categories (tokenforge_text …).
    8289                                }
    8390                        )
    … …  
    125132                update_option( 'bricks_global_classes_categories', $ccats );
    126133        }
     134        // The builder's style manager CSS file still holds our scale variables until it is rebuilt.
     135        if ( is_callable( array( '\Bricks\Ajax', 'generate_style_manager_css_file' ) ) ) {
     136                \Bricks\Ajax::generate_style_manager_css_file();
     137        }
    127138}
    128139
Note: See TracChangeset for help on using the changeset viewer.