Plugin Directory

Changeset 2887836


Ignore:
Timestamp:
03/27/2023 07:34:54 PM (3 years ago)
Author:
thatdevgirl
Message:

block update and version supports update

Location:
besan-block
Files:
32 added
6 edited

Legend:

Unmodified
Added
Removed
  • besan-block/trunk/besan-block.php

    r2662402 r2887836  
    44 * Plugin Name: Besan Block
    55 * Description: This WordPress plugin adds a charting block to the post editor.
    6  * Version: 1.2.1
     6 * Version: 1.3
    77 * Author: Joni Halabi
    88 * Author URI: https://jhalabi.com
  • besan-block/trunk/build/besan-block.min.js

    r2809361 r2887836  
    1 !function l(n,c,r){function o(t,e){if(!c[t]){if(!n[t]){var a="function"==typeof require&&require;if(!e&&a)return a(t,!0);if(i)return i(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}a=c[t]={exports:{}},n[t][0].call(a.exports,function(e){return o(n[t][1][e]||e)},a,a.exports,l,n,c,r)}return c[t].exports}for(var i="function"==typeof require&&require,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var p=(e=e("./icons.js"))&&e.__esModule?e:{default:e};a.default=function(e){var t=wp.blockEditor.InspectorControls,a=wp.components,l=a.ColorPicker,n=a.Panel,c=a.PanelBody,r=a.SelectControl,a=a.TextControl,o=wp.element.Fragment,i=e.setAttributes,e=e.attributes,s=e.data,h=e.column,u=e.type,d=e.title,m=e.caption,e=e.color;return React.createElement(o,null,React.createElement(t,null,React.createElement(n,null,React.createElement(c,{title:"Data source"},React.createElement("p",{className:"besan-editor-note info"},"Enter your Google Sheet URL and the letter of the column to be included in this chart. The Google Sheet ",React.createElement("em",null,"must")," be publicly viewable."),!besanOptions.apiKey&&React.createElement("p",{className:"besan-editor-note warning"},React.createElement("strong",null,"Important!")," ",React.createElement("br",null),"You have no Google Sheets API key defined. The chart will not display without this key. Please enter your API key on the",React.createElement("a",{href:"/wp-admin/options-general.php?page=besan_options"},"Besan Block settings page"),"."),React.createElement(a,{label:"Google Sheets URL",value:s,onChange:function(e){i({data:e})}}),React.createElement(a,{label:"Column",value:h,onChange:function(e){i({column:e})}}))),React.createElement(n,null,React.createElement(c,{title:"Display options"},React.createElement(r,{label:"Chart type",value:u,options:[{label:"Vertical Bar",value:"bar-vertical"},{label:"Horizontal Bar",value:"bar-horizontal"}],onChange:function(e){i({type:e})}}),React.createElement("label",null,"Chart color",React.createElement(l,{color:e,onChangeComplete:function(e){i({color:e.hex})},disableAlpha:!0})))),React.createElement(n,null,React.createElement(c,{title:"Accessibility"},React.createElement("p",{className:"besan-editor-note info"},"Type a short description of the chart. This should be different from the caption. The title will not be visible to sighted users, but will be used as the internal title of the chart to make it more accessible for screen reader users."),React.createElement(a,{label:"Chart title",value:d,onChange:function(e){i({title:e})}})))),React.createElement("div",{id:"besan-chart-edit"},"bar-vertical"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},p.default.barVertical),"bar-horizontal"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},p.default.barHorizontal),React.createElement(a,{value:m,placeholder:"Write chart caption...",onChange:function(e){i({caption:e})},className:"besan-edit-caption"})))}},{"./icons.js":2}],2:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,a.default={block:React.createElement("svg",{height:"20px",width:"20px",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},React.createElement("polygon",{points:"65.002,81.921 58.469,81.921 37.532,81.921 30.998,81.921 10.063,81.921 6.25,81.921 6.25,85.086 89.75,85.086 89.75,81.921 85.938,81.921"}),React.createElement("rect",{x:"11.563",y:"47.454",width:"17.936",height:"32.967"}),React.createElement("rect",{x:"66.502",y:"36.569",width:"17.936",height:"43.852"}),React.createElement("rect",{x:"39.032",y:"10.914",width:"17.937",height:"69.507"})),barVertical:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),barHorizontal:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",transform:"rotate(90)",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),pie:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M51.326 51.792l6.885 39.892c12.571-2.471 23.174-10.497 29.127-21.412l-36.012-18.48z"}),React.createElement("path",{d:"M50 92.487c2.12 0 4.203-.161 6.241-.462L49 49.987V7.513C26.027 8.048 7.5 26.888 7.5 49.987c0 23.435 19.065 42.5 42.5 42.5z"}),React.createElement("path",{d:"M51 7.513v41.864l37.253 19.117A42.242 42.242 0 0092.5 49.988c0-23.1-18.527-41.94-41.5-42.475z"})))}},{}],3:[function(e,t,a){"use strict";var l=n(e("./icons.js")),e=n(e("./edit.js"));function n(e){return e&&e.__esModule?e:{default:e}}(0,wp.blocks.registerBlockType)("tdg/chart",{title:"Chart",description:"Create a chart from data in a Google sheet.",category:"widgets",keywords:["chart","graph","data"],icon:l.default.block,edit:e.default,save:function(){return null}})},{"./edit.js":1,"./icons.js":2}]},{},[3]);
     1!function l(n,c,r){function o(t,e){if(!c[t]){if(!n[t]){var a="function"==typeof require&&require;if(!e&&a)return a(t,!0);if(i)return i(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}a=c[t]={exports:{}},n[t][0].call(a.exports,function(e){return o(n[t][1][e]||e)},a,a.exports,l,n,c,r)}return c[t].exports}for(var i="function"==typeof require&&require,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,a){t.exports={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"tdg/chart",title:"Chart",category:"widgets",description:"A block to create a chart from data in a Google sheet.",keywords:["besan block","graph","data"],attributes:{data:{type:"string",default:""},column:{type:"string",default:"A"},type:{type:"string",default:"bar-vertical"},title:{type:"string",default:""},caption:{type:"string",default:""},color:{type:"string",default:"#000000"}},example:{}}},{}],2:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var m=(e=e("./icons.js"))&&e.__esModule?e:{default:e};a.default=function(e){var t=wp.blockEditor,a=t.InspectorControls,t=t.useBlockProps,l=wp.components,n=l.ColorPicker,c=l.Panel,r=l.PanelBody,o=l.SelectControl,l=l.TextControl,i=e.setAttributes,e=e.attributes,s=e.data,h=e.column,u=e.type,d=e.title,p=e.caption,e=e.color,t=t();return React.createElement("div",t,React.createElement(a,null,React.createElement(c,null,React.createElement(r,{title:"Data source"},React.createElement("p",{className:"besan-editor-note info"},"Enter your Google Sheet URL and the letter of the column to be included in this chart. The Google Sheet ",React.createElement("em",null,"must")," be publicly viewable."),!besanOptions.apiKey&&React.createElement("p",{className:"besan-editor-note warning"},React.createElement("strong",null,"Important!")," ",React.createElement("br",null),"You have no Google Sheets API key defined. The chart will not display without this key. Please enter your API key on the",React.createElement("a",{href:"/wp-admin/options-general.php?page=besan_options"},"Besan Block settings page"),"."),React.createElement(l,{label:"Google Sheets URL",value:s,onChange:function(e){i({data:e})}}),React.createElement(l,{label:"Column",value:h,onChange:function(e){i({column:e})}}))),React.createElement(c,null,React.createElement(r,{title:"Display options"},React.createElement(o,{label:"Chart type",value:u,options:[{label:"Vertical Bar",value:"bar-vertical"},{label:"Horizontal Bar",value:"bar-horizontal"}],onChange:function(e){i({type:e})}}),React.createElement("label",null,"Chart color",React.createElement(n,{color:e,onChangeComplete:function(e){i({color:e.hex})},disableAlpha:!0})))),React.createElement(c,null,React.createElement(r,{title:"Accessibility"},React.createElement("p",{className:"besan-editor-note info"},"Type a short description of the chart. This should be different from the caption. The title will not be visible to sighted users, but will be used as the internal title of the chart to make it more accessible for screen reader users."),React.createElement(l,{label:"Chart title",value:d,onChange:function(e){i({title:e})}})))),React.createElement("div",{id:"besan-chart-edit"},"bar-vertical"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},m.default.barVertical),"bar-horizontal"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},m.default.barHorizontal),React.createElement(l,{value:p,placeholder:"Write chart caption...",onChange:function(e){i({caption:e})},className:"besan-edit-caption"})))}},{"./icons.js":3}],3:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,a.default={block:React.createElement("svg",{height:"20px",width:"20px",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},React.createElement("polygon",{points:"65.002,81.921 58.469,81.921 37.532,81.921 30.998,81.921 10.063,81.921 6.25,81.921 6.25,85.086 89.75,85.086 89.75,81.921 85.938,81.921"}),React.createElement("rect",{x:"11.563",y:"47.454",width:"17.936",height:"32.967"}),React.createElement("rect",{x:"66.502",y:"36.569",width:"17.936",height:"43.852"}),React.createElement("rect",{x:"39.032",y:"10.914",width:"17.937",height:"69.507"})),barVertical:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),barHorizontal:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",transform:"rotate(90)",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),pie:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M51.326 51.792l6.885 39.892c12.571-2.471 23.174-10.497 29.127-21.412l-36.012-18.48z"}),React.createElement("path",{d:"M50 92.487c2.12 0 4.203-.161 6.241-.462L49 49.987V7.513C26.027 8.048 7.5 26.888 7.5 49.987c0 23.435 19.065 42.5 42.5 42.5z"}),React.createElement("path",{d:"M51 7.513v41.864l37.253 19.117A42.242 42.242 0 0092.5 49.988c0-23.1-18.527-41.94-41.5-42.475z"})))}},{}],4:[function(e,t,a){"use strict";var l=c(e("./icons.js")),n=c(e("./edit.js")),e=c(e("./block.json"));function c(e){return e&&e.__esModule?e:{default:e}}(0,wp.blocks.registerBlockType)(e.default,{icon:l.default.block,edit:n.default,save:function(){return null}})},{"./block.json":1,"./edit.js":2,"./icons.js":3}]},{},[4]);
  • besan-block/trunk/readme.txt

    r2809361 r2887836  
    55Requires at least: 5.0
    66Requires PHP: 7.0
    7 Tested up to: 6.1
    8 Stable tag: 1.2
     7Tested up to: 6.2
     8Stable tag: 1.3
    99
    1010Add a responsive and accessible data chart block to posts and pages.
     
    5454== Changelog ==
    5555
     56= 1.3 =
     57* Tested plugin with WordPress core 6.2.
     58* Block code refactoring to keep up with current Gutenberg API standards.
     59
    5660= 1.2 =
    5761* Tested plugin with WordPress core 5.7.
  • besan-block/trunk/source/blocks/chart/edit.js

    r2447722 r2887836  
    77const besanEdit = ( props ) => {
    88
    9   const { InspectorControls } = wp.blockEditor;
     9  const { InspectorControls, useBlockProps } = wp.blockEditor;
    1010  const { ColorPicker, Panel, PanelBody, SelectControl, TextControl } = wp.components;
    11   const { Fragment } = wp.element;
    1211
    1312  // Get the values needed from props.
    1413  const { setAttributes } = props;
    1514  const { data, column, type, title, caption, color } = props.attributes;
     15  const blockProps = useBlockProps();
    1616
    1717  // Declare change event handlers.
     
    2525  // Return the edit UI.
    2626  return (
    27     <Fragment>
     27    <div { ...blockProps }>
    2828
    2929      <InspectorControls>
     
    142142      </div>
    143143
    144     </Fragment>
     144    </div>
    145145  );
    146146};
  • besan-block/trunk/source/blocks/chart/index.js

    r2447722 r2887836  
    33 */
    44
    5 import besanIcons from './icons.js';
    6 import besanEdit from './edit.js';
     5import { default as Icons } from './icons.js';
     6import { default as Edit } from './edit.js';
     7import { default as Metadata } from './block.json';
    78
    89( function() {
     
    1011  const { registerBlockType } = wp.blocks;
    1112
    12   registerBlockType( 'tdg/chart', {
    13     title: 'Chart',
    14     description: 'Create a chart from data in a Google sheet.',
    15     category: 'widgets',
    16     keywords: [ 'chart', 'graph', 'data' ],
    17     icon: besanIcons.block,
    18     edit: besanEdit,
     13  registerBlockType( Metadata, {
     14    icon: Icons.block,
     15    edit: Edit,
    1916    save: () => { return null; }
    2017  } );
  • besan-block/trunk/source/blocks/chart/register.php

    r2447722 r2887836  
    3131   */
    3232  public function register(): void {
    33     register_block_type( 'tdg/chart', [
    34       // Set up block attributes.
    35       'attributes' => [
    36         'data'    => [ 'type' => 'string', 'default' => '' ],
    37         'column'  => [ 'type' => 'string', 'default' => 'A' ],
    38         'type'    => [ 'type' => 'string', 'default' => 'bar-vertical' ],
    39         'title'   => [ 'type' => 'string', 'default' => '' ],
    40         'caption' => [ 'type' => 'string', 'default' => '' ],
    41         'color'   => [ 'type' => 'string', 'default' => '#000000' ]
    42       ],
    43 
    44       // Declare render callback function.
     33    register_block_type( __DIR__, [
    4534      'render_callback' => [ $this, 'render' ]
    4635    ] );
Note: See TracChangeset for help on using the changeset viewer.