Plugin Directory

Changeset 3446267


Ignore:
Timestamp:
01/24/2026 07:55:55 PM (2 months ago)
Author:
mrinal013
Message:

make lighter

Location:
word-switch/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • word-switch/trunk/build/css/word-switch-styles-rtl.css

    r3442402 r3446267  
    1 /*!***************************************************************************************************************************************************************************************************************************************************************!*\
    2   !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./resources/scss/word-switch-styles.scss ***!
    3   \***************************************************************************************************************************************************************************************************************************************************************/
    4 .word-switch {
    5   transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    6   display: inline-block;
    7   transform-origin: center;
    8   position: relative;
    9   opacity: 1;
    10   will-change: opacity, transform;
    11   transform: scale(1) rotateY(0deg);
    12 }
    13 .word-switch.fade {
    14   opacity: 0;
    15   transform: scale(0.7) rotateY(-90deg);
    16 }
    17 .word-switch:not(.fade) {
    18   opacity: 0;
    19   transform: scale(0.7) rotateY(90deg);
    20   animation: flipIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    21 }
    22 @keyframes flipIn {
    23   0% {
    24     opacity: 0;
    25     transform: scale(0.7) rotateY(90deg);
    26   }
    27   60% {
    28     transform: scale(1.05) rotateY(-10deg);
    29   }
    30   100% {
    31     opacity: 1;
    32     transform: scale(1) rotateY(0deg);
    33   }
    34 }
     1.word-switch{display:inline-block;opacity:1;position:relative;transform:scale(1) rotateY(0deg);transform-origin:center;transition:all .4s cubic-bezier(.34,1.56,.64,1);will-change:opacity,transform}.word-switch.fade{opacity:0;transform:scale(.7) rotateY(-90deg)}.word-switch:not(.fade){animation:flipIn .5s cubic-bezier(.34,1.56,.64,1) forwards;opacity:0;transform:scale(.7) rotateY(90deg)}@keyframes flipIn{0%{opacity:0;transform:scale(.7) rotateY(90deg)}60%{transform:scale(1.05) rotateY(-10deg)}to{opacity:1;transform:scale(1) rotateY(0deg)}}
  • word-switch/trunk/build/css/word-switch-styles.asset.php

    r3442402 r3446267  
    1 <?php return array('dependencies' => array(), 'version' => '6429fe3e97beb24c775c');
     1<?php return array('dependencies' => array(), 'version' => '55e5651178634d234199');
  • word-switch/trunk/build/css/word-switch-styles.css

    r3442402 r3446267  
    1 /*!***************************************************************************************************************************************************************************************************************************************************************!*\
    2   !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./resources/scss/word-switch-styles.scss ***!
    3   \***************************************************************************************************************************************************************************************************************************************************************/
    4 .word-switch {
    5   transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    6   display: inline-block;
    7   transform-origin: center;
    8   position: relative;
    9   opacity: 1;
    10   will-change: opacity, transform;
    11   transform: scale(1) rotateY(0deg);
    12 }
    13 .word-switch.fade {
    14   opacity: 0;
    15   transform: scale(0.7) rotateY(90deg);
    16 }
    17 .word-switch:not(.fade) {
    18   opacity: 0;
    19   transform: scale(0.7) rotateY(-90deg);
    20   animation: flipIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    21 }
    22 @keyframes flipIn {
    23   0% {
    24     opacity: 0;
    25     transform: scale(0.7) rotateY(-90deg);
    26   }
    27   60% {
    28     transform: scale(1.05) rotateY(10deg);
    29   }
    30   100% {
    31     opacity: 1;
    32     transform: scale(1) rotateY(0deg);
    33   }
    34 }
    35 
    36 /*# sourceMappingURL=word-switch-styles.css.map*/
     1.word-switch{display:inline-block;opacity:1;position:relative;transform:scale(1) rotateY(0deg);transform-origin:center;transition:all .4s cubic-bezier(.34,1.56,.64,1);will-change:opacity,transform}.word-switch.fade{opacity:0;transform:scale(.7) rotateY(90deg)}.word-switch:not(.fade){animation:flipIn .5s cubic-bezier(.34,1.56,.64,1) forwards;opacity:0;transform:scale(.7) rotateY(-90deg)}@keyframes flipIn{0%{opacity:0;transform:scale(.7) rotateY(-90deg)}60%{transform:scale(1.05) rotateY(10deg)}to{opacity:1;transform:scale(1) rotateY(0deg)}}
  • word-switch/trunk/build/css/word-switch-styles.js

    r3442402 r3446267  
    1 /******/ (() => { // webpackBootstrap
    2 /******/    "use strict";
    3 /******/    // The require scope
    4 /******/    var __webpack_require__ = {};
    5 /******/   
    6 /************************************************************************/
    7 /******/    /* webpack/runtime/make namespace object */
    8 /******/    (() => {
    9 /******/        // define __esModule on exports
    10 /******/        __webpack_require__.r = (exports) => {
    11 /******/            if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    12 /******/                Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    13 /******/            }
    14 /******/            Object.defineProperty(exports, '__esModule', { value: true });
    15 /******/        };
    16 /******/    })();
    17 /******/   
    18 /************************************************************************/
    19 var __webpack_exports__ = {};
    20 /*!************************************************!*\
    21   !*** ./resources/scss/word-switch-styles.scss ***!
    22   \************************************************/
    23 __webpack_require__.r(__webpack_exports__);
    24 // extracted by mini-css-extract-plugin
    25 
    26 /******/ })()
    27 ;
    28 //# sourceMappingURL=word-switch-styles.js.map
  • word-switch/trunk/build/js/register-format-type.asset.php

    r3442402 r3446267  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-rich-text'), 'version' => '59a7b643d9f81aefe9f5');
     1<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-rich-text'), 'version' => '2adfc67cdf12d2a50f14');
  • word-switch/trunk/build/js/register-format-type.js

    r3442402 r3446267  
    1 /******/ (() => { // webpackBootstrap
    2 /******/    "use strict";
    3 /******/    var __webpack_modules__ = ({
    4 
    5 /***/ "@wordpress/block-editor"
    6 /*!*************************************!*\
    7   !*** external ["wp","blockEditor"] ***!
    8   \*************************************/
    9 (module) {
    10 
    11 module.exports = window["wp"]["blockEditor"];
    12 
    13 /***/ },
    14 
    15 /***/ "@wordpress/rich-text"
    16 /*!**********************************!*\
    17   !*** external ["wp","richText"] ***!
    18   \**********************************/
    19 (module) {
    20 
    21 module.exports = window["wp"]["richText"];
    22 
    23 /***/ },
    24 
    25 /***/ "react/jsx-runtime"
    26 /*!**********************************!*\
    27   !*** external "ReactJSXRuntime" ***!
    28   \**********************************/
    29 (module) {
    30 
    31 module.exports = window["ReactJSXRuntime"];
    32 
    33 /***/ }
    34 
    35 /******/    });
    36 /************************************************************************/
    37 /******/    // The module cache
    38 /******/    var __webpack_module_cache__ = {};
    39 /******/   
    40 /******/    // The require function
    41 /******/    function __webpack_require__(moduleId) {
    42 /******/        // Check if module is in cache
    43 /******/        var cachedModule = __webpack_module_cache__[moduleId];
    44 /******/        if (cachedModule !== undefined) {
    45 /******/            return cachedModule.exports;
    46 /******/        }
    47 /******/        // Check if module exists (development only)
    48 /******/        if (__webpack_modules__[moduleId] === undefined) {
    49 /******/            var e = new Error("Cannot find module '" + moduleId + "'");
    50 /******/            e.code = 'MODULE_NOT_FOUND';
    51 /******/            throw e;
    52 /******/        }
    53 /******/        // Create a new module (and put it into the cache)
    54 /******/        var module = __webpack_module_cache__[moduleId] = {
    55 /******/            // no module.id needed
    56 /******/            // no module.loaded needed
    57 /******/            exports: {}
    58 /******/        };
    59 /******/   
    60 /******/        // Execute the module function
    61 /******/        __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
    62 /******/   
    63 /******/        // Return the exports of the module
    64 /******/        return module.exports;
    65 /******/    }
    66 /******/   
    67 /************************************************************************/
    68 /******/    /* webpack/runtime/compat get default export */
    69 /******/    (() => {
    70 /******/        // getDefaultExport function for compatibility with non-harmony modules
    71 /******/        __webpack_require__.n = (module) => {
    72 /******/            var getter = module && module.__esModule ?
    73 /******/                () => (module['default']) :
    74 /******/                () => (module);
    75 /******/            __webpack_require__.d(getter, { a: getter });
    76 /******/            return getter;
    77 /******/        };
    78 /******/    })();
    79 /******/   
    80 /******/    /* webpack/runtime/define property getters */
    81 /******/    (() => {
    82 /******/        // define getter functions for harmony exports
    83 /******/        __webpack_require__.d = (exports, definition) => {
    84 /******/            for(var key in definition) {
    85 /******/                if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    86 /******/                    Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    87 /******/                }
    88 /******/            }
    89 /******/        };
    90 /******/    })();
    91 /******/   
    92 /******/    /* webpack/runtime/hasOwnProperty shorthand */
    93 /******/    (() => {
    94 /******/        __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
    95 /******/    })();
    96 /******/   
    97 /******/    /* webpack/runtime/make namespace object */
    98 /******/    (() => {
    99 /******/        // define __esModule on exports
    100 /******/        __webpack_require__.r = (exports) => {
    101 /******/            if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    102 /******/                Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    103 /******/            }
    104 /******/            Object.defineProperty(exports, '__esModule', { value: true });
    105 /******/        };
    106 /******/    })();
    107 /******/   
    108 /************************************************************************/
    109 var __webpack_exports__ = {};
    110 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
    111 (() => {
    112 /*!**********************************************!*\
    113   !*** ./resources/js/register-format-type.js ***!
    114   \**********************************************/
    115 __webpack_require__.r(__webpack_exports__);
    116 /* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
    117 /* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_0__);
    118 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
    119 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
    120 /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
    121 /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
    122 
    123 
    124 
    125 const WORD_SWITCH_FORMAT_TYPE = "word-switch/format-type-delimiter";
    126 (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_0__.registerFormatType)(WORD_SWITCH_FORMAT_TYPE, {
    127   title: "Word Switch",
    128   tagName: "span",
    129   className: "word-switch",
    130   edit: ({
    131     isActive,
    132     onChange,
    133     value
    134   }) => {
    135     return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichTextToolbarButton, {
    136       icon: "update",
    137       title: "Mark as Word Switcher Area",
    138       onClick: () => {
    139         onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_0__.toggleFormat)(value, {
    140           type: WORD_SWITCH_FORMAT_TYPE
    141         }));
    142       },
    143       isActive: isActive
    144     });
    145   }
    146 });
    147 })();
    148 
    149 /******/ })()
    150 ;
    151 //# sourceMappingURL=register-format-type.js.map
     1(()=>{"use strict";const t=window.wp.richText,e=window.wp.blockEditor,i=window.ReactJSXRuntime,a="word-switch/format-type-delimiter",r="word-switch/format-type-wrap";(0,t.registerFormatType)(a,{title:"Content",tagName:"span",className:"word-switch",edit:({isActive:o,value:s,onChange:n})=>{const c={words:s.text.substring(s.start,s.end).split(","),currentIndex:0,isFading:!1},d=JSON.stringify(c);return(0,i.jsx)(e.RichTextToolbarButton,{icon:"editor-code",onClick:()=>{let e=(0,t.toggleFormat)(s,{type:r,attributes:{"data-wp-interactive":"wpdevagent/word-switch","data-wp-init":"callbacks.init","data-wp-context":d}});e=(0,t.toggleFormat)(e,{type:a,attributes:{"data-wp-text":"state.currentWord","data-wp-class--fade":"context.isFading"}}),n(e)},title:"Word Switch",isActive:o})}}),(0,t.registerFormatType)(r,{title:"Wrap",tagName:"span",className:"word-switch-wrap",edit:null})})();
  • word-switch/trunk/build/js/register-format-type.js.map

    r3442402 r3446267  
    1 {"version":3,"file":"js/register-format-type.js","mappings":";;;;;;;;;;AAAA,6C;;;;;;;;;;ACAA,0C;;;;;;;;;;ACAA,2C;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;ACNwE;AACR;AAAA;AAEhE,MAAMK,uBAAuB,GAAG,mCAAmC;AAEnEJ,wEAAkB,CAACI,uBAAuB,EAAE;EAC1CC,KAAK,EAAE,aAAa;EACpBC,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,aAAa;EACxBC,IAAI,EAAEA,CAAC;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAM,CAAC,KAAK;IACvC,oBACER,sDAAA,CAACF,0EAAqB;MACpBW,IAAI,EAAC,QAAQ;MACbP,KAAK,EAAC,4BAA4B;MAClCQ,OAAO,EAAEA,CAAA,KAAM;QACbH,QAAQ,CACNX,kEAAY,CAACY,KAAK,EAAE;UAClBG,IAAI,EAAEV;QACR,CAAC,CACH,CAAC;MACH,CAAE;MACFK,QAAQ,EAAEA;IAAS,CACpB,CAAC;EAEN;AACF,CAAC,CAAC,C","sources":["webpack://word-switch/external window [\"wp\",\"blockEditor\"]","webpack://word-switch/external window [\"wp\",\"richText\"]","webpack://word-switch/external window \"ReactJSXRuntime\"","webpack://word-switch/webpack/bootstrap","webpack://word-switch/webpack/runtime/compat get default export","webpack://word-switch/webpack/runtime/define property getters","webpack://word-switch/webpack/runtime/hasOwnProperty shorthand","webpack://word-switch/webpack/runtime/make namespace object","webpack://word-switch/./resources/js/register-format-type.js"],"sourcesContent":["module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"richText\"];","module.exports = window[\"ReactJSXRuntime\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { toggleFormat, registerFormatType } from \"@wordpress/rich-text\";\nimport { RichTextToolbarButton } from \"@wordpress/block-editor\";\n\nconst WORD_SWITCH_FORMAT_TYPE = \"word-switch/format-type-delimiter\";\n\nregisterFormatType(WORD_SWITCH_FORMAT_TYPE, {\n  title: \"Word Switch\",\n  tagName: \"span\",\n  className: \"word-switch\",\n  edit: ({ isActive, onChange, value }) => {\n    return (\n      <RichTextToolbarButton\n        icon=\"update\"\n        title=\"Mark as Word Switcher Area\"\n        onClick={() => {\n          onChange(\n            toggleFormat(value, {\n              type: WORD_SWITCH_FORMAT_TYPE,\n            })\n          );\n        }}\n        isActive={isActive}\n      />\n    );\n  },\n});\n"],"names":["toggleFormat","registerFormatType","RichTextToolbarButton","jsx","_jsx","WORD_SWITCH_FORMAT_TYPE","title","tagName","className","edit","isActive","onChange","value","icon","onClick","type"],"ignoreList":[],"sourceRoot":""}
     1{"version":3,"file":"js/register-format-type.js","mappings":";;;;;;;;;;AAAA,6C;;;;;;;;;;ACAA,0C;;;;;;;;;;ACAA,2C;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;;;ACNwE;AACR;AAAA;AAEhE,MAAMK,uBAAuB,GAAG,mCAAmC;AACnE,MAAMC,4BAA4B,GAAG,8BAA8B;AAEnE,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAK;EAC1D,MAAMC,cAAc,GAAGF,KAAK,CAACG,IAAI,CAACC,SAAS,CAACJ,KAAK,CAACK,KAAK,EAAEL,KAAK,CAACM,GAAG,CAAC;EACnE,MAAMC,UAAU,GAAGL,cAAc,CAACM,KAAK,CAAC,GAAG,CAAC;EAC5C,MAAMC,GAAG,GAAG;IACVC,KAAK,EAAEH,UAAU;IACjBI,YAAY,EAAE,CAAC;IACfC,QAAQ,EAAE;EACZ,CAAC;EAED,MAAMC,SAAS,GAAGC,IAAI,CAACC,SAAS,CAACN,GAAG,CAAC;EAErC,MAAMO,QAAQ,GAAGA,CAAA,KAAM;IACrB;IACA,IAAIC,SAAS,GAAG1B,kEAAY,CAACS,KAAK,EAAE;MAClCkB,IAAI,EAAErB,4BAA4B;MAClCsB,UAAU,EAAE;QACV,qBAAqB,EAAE,wBAAwB;QAC/C,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAEN;MACrB;IACF,CAAC,CAAC;IACF;IACAI,SAAS,GAAG1B,kEAAY,CAAC0B,SAAS,EAAE;MAClCC,IAAI,EAAEtB,uBAAuB;MAC7BuB,UAAU,EAAE;QACV,cAAc,EAAE,mBAAmB;QACnC,qBAAqB,EAAE;MACzB;IACF,CAAC,CAAC;IAEFlB,QAAQ,CAACgB,SAAS,CAAC;EACrB,CAAC;EAED,oBACEtB,sDAAA,CAACF,0EAAqB;IACpB2B,IAAI,EAAC,aAAa;IAClBC,OAAO,EAAEL,QAAS;IAClBM,KAAK,EAAC,aAAa;IACnBvB,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAEDP,wEAAkB,CAACI,uBAAuB,EAAE;EAC1C0B,KAAK,EAAE,SAAS;EAChBC,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,aAAa;EACxBC,IAAI,EAAE3B;AACR,CAAC,CAAC;AAEFN,wEAAkB,CAACK,4BAA4B,EAAE;EAC/CyB,KAAK,EAAE,MAAM;EACbC,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,kBAAkB;EAC7BC,IAAI,EAAE;AACR,CAAC,CAAC,C","sources":["webpack://word-switch/external window [\"wp\",\"blockEditor\"]","webpack://word-switch/external window [\"wp\",\"richText\"]","webpack://word-switch/external window \"ReactJSXRuntime\"","webpack://word-switch/webpack/bootstrap","webpack://word-switch/webpack/runtime/compat get default export","webpack://word-switch/webpack/runtime/define property getters","webpack://word-switch/webpack/runtime/hasOwnProperty shorthand","webpack://word-switch/webpack/runtime/make namespace object","webpack://word-switch/./resources/js/register-format-type.js"],"sourcesContent":["module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"richText\"];","module.exports = window[\"ReactJSXRuntime\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { toggleFormat, registerFormatType } from \"@wordpress/rich-text\";\nimport { RichTextToolbarButton } from \"@wordpress/block-editor\";\n\nconst WORD_SWITCH_FORMAT_TYPE = \"word-switch/format-type-delimiter\";\nconst WORD_SWITCH_FORMAT_TYPE_WRAP = \"word-switch/format-type-wrap\";\n\nconst MyMultiTagButton = ({ isActive, value, onChange }) => {\n  const selectedString = value.text.substring(value.start, value.end);\n  const wordsArray = selectedString.split(\",\");\n  const obj = {\n    words: wordsArray,\n    currentIndex: 0,\n    isFading: false,\n  };\n\n  const objString = JSON.stringify(obj);\n\n  const onToggle = () => {\n    // Apply the first format\n    let nextValue = toggleFormat(value, {\n      type: WORD_SWITCH_FORMAT_TYPE_WRAP,\n      attributes: {\n        \"data-wp-interactive\": \"wpdevagent/word-switch\",\n        \"data-wp-init\": \"callbacks.init\",\n        \"data-wp-context\": objString,\n      },\n    });\n    // Apply the second format to the result of the first\n    nextValue = toggleFormat(nextValue, {\n      type: WORD_SWITCH_FORMAT_TYPE,\n      attributes: {\n        \"data-wp-text\": \"state.currentWord\",\n        \"data-wp-class--fade\": \"context.isFading\",\n      },\n    });\n\n    onChange(nextValue);\n  };\n\n  return (\n    <RichTextToolbarButton\n      icon=\"editor-code\"\n      onClick={onToggle}\n      title=\"Word Switch\"\n      isActive={isActive}\n    />\n  );\n};\n\nregisterFormatType(WORD_SWITCH_FORMAT_TYPE, {\n  title: \"Content\",\n  tagName: \"span\",\n  className: \"word-switch\",\n  edit: MyMultiTagButton,\n});\n\nregisterFormatType(WORD_SWITCH_FORMAT_TYPE_WRAP, {\n  title: \"Wrap\",\n  tagName: \"span\",\n  className: \"word-switch-wrap\",\n  edit: null,\n});\n"],"names":["toggleFormat","registerFormatType","RichTextToolbarButton","jsx","_jsx","WORD_SWITCH_FORMAT_TYPE","WORD_SWITCH_FORMAT_TYPE_WRAP","MyMultiTagButton","isActive","value","onChange","selectedString","text","substring","start","end","wordsArray","split","obj","words","currentIndex","isFading","objString","JSON","stringify","onToggle","nextValue","type","attributes","icon","onClick","title","tagName","className","edit"],"ignoreList":[],"sourceRoot":""}
  • word-switch/trunk/build/js/word-switch-store.asset.php

    r3442402 r3446267  
    1 <?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => 'f97ff8d895e40003266e', 'type' => 'module');
     1<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '2476574a4e3803bf15f4', 'type' => 'module');
  • word-switch/trunk/build/js/word-switch-store.js

    r3442402 r3446267  
    1 import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
    2 /******/ var __webpack_modules__ = ({
    3 
    4 /***/ "@wordpress/interactivity"
    5 /*!*******************************************!*\
    6   !*** external "@wordpress/interactivity" ***!
    7   \*******************************************/
    8 (module) {
    9 
    10 module.exports = __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__;
    11 
    12 /***/ }
    13 
    14 /******/ });
    15 /************************************************************************/
    16 /******/ // The module cache
    17 /******/ var __webpack_module_cache__ = {};
    18 /******/
    19 /******/ // The require function
    20 /******/ function __webpack_require__(moduleId) {
    21 /******/    // Check if module is in cache
    22 /******/    var cachedModule = __webpack_module_cache__[moduleId];
    23 /******/    if (cachedModule !== undefined) {
    24 /******/        return cachedModule.exports;
    25 /******/    }
    26 /******/    // Check if module exists (development only)
    27 /******/    if (__webpack_modules__[moduleId] === undefined) {
    28 /******/        var e = new Error("Cannot find module '" + moduleId + "'");
    29 /******/        e.code = 'MODULE_NOT_FOUND';
    30 /******/        throw e;
    31 /******/    }
    32 /******/    // Create a new module (and put it into the cache)
    33 /******/    var module = __webpack_module_cache__[moduleId] = {
    34 /******/        // no module.id needed
    35 /******/        // no module.loaded needed
    36 /******/        exports: {}
    37 /******/    };
    38 /******/
    39 /******/    // Execute the module function
    40 /******/    __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
    41 /******/
    42 /******/    // Return the exports of the module
    43 /******/    return module.exports;
    44 /******/ }
    45 /******/
    46 /************************************************************************/
    47 /******/ /* webpack/runtime/make namespace object */
    48 /******/ (() => {
    49 /******/    // define __esModule on exports
    50 /******/    __webpack_require__.r = (exports) => {
    51 /******/        if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    52 /******/            Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    53 /******/        }
    54 /******/        Object.defineProperty(exports, '__esModule', { value: true });
    55 /******/    };
    56 /******/ })();
    57 /******/
    58 /************************************************************************/
    59 var __webpack_exports__ = {};
    60 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
    61 (() => {
    62 /*!*******************************************!*\
    63   !*** ./resources/js/word-switch-store.js ***!
    64   \*******************************************/
    65 __webpack_require__.r(__webpack_exports__);
    66 /* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/interactivity */ "@wordpress/interactivity");
    67 
    68 (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.store)("wpdevagent/word-switch", {
    69   state: {
    70     get currentWord() {
    71       const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
    72       return context.words[context.currentIndex];
    73     }
    74   },
    75   callbacks: {
    76     init() {
    77       const context = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getContext)();
    78       setInterval(() => {
    79         context.isFading = true;
    80         setTimeout(() => {
    81           context.isFading = false;
    82           context.currentIndex = (context.currentIndex + 1) % context.words.length;
    83         }, 500);
    84       }, 5000);
    85     }
    86   }
    87 });
    88 })();
    89 
    90 
    91 //# sourceMappingURL=word-switch-store.js.map
     1import{getContext as t,store as e}from"@wordpress/interactivity";e("wpdevagent/word-switch",{state:{get currentWord(){const e=t();return e.words[e.currentIndex]}},callbacks:{init(){const e=t();setInterval(()=>{e.isFading=!0,setTimeout(()=>{e.isFading=!1,e.currentIndex=(e.currentIndex+1)%e.words.length},500)},5e3)}}});
  • word-switch/trunk/readme.txt

    r3442402 r3446267  
    44Requires at least: 6.7
    55Tested up to: 6.9
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.2
    77Requires PHP: 7.4
    8 License: GPLv2
     8License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
     
    1515== Changelog ==
    1616
     17== 1.0.2 ==
     18- Change prefix WS to WORD_SWITCH
     19- Made zip for wordpress.org
     20
    1721== 1.0.1 ==
    1822- Change prefix WS to WORD_SWITCH
  • word-switch/trunk/word-switch.php

    r3442402 r3446267  
    33 * Plugin Name:         Word Switch
    44 * Description:         Add word switching capability.
    5  * Version:             1.0.1
     5 * Version:             1.0.2
    66 * Requires at least:   6.7
    77 * Requires PHP:        7.4
    88 * Author:              mrinal013
     9 * Author URI:          https://www.wpdevagent.com
    910 * License:             GPLv2
    1011 * Text Domain:         word-switch
     
    6768
    6869function word_switch_render_block( $block_content, $block ) {
    69     if ( strpos( $block_content, 'class="word-switch' ) === false ) {
     70    if ( strpos( $block_content, 'class="word-switch-wrap' ) === false ) {
    7071        return $block_content;
    7172    }
    7273
    7374    $processor = new WP_HTML_Tag_Processor( $block_content );
    74 
    75     // Find the first tag (the block wrapper)
    76     if ( ! $processor->next_tag() ) {
    77         return $block_content;
    78     }
    79 
    80     $processor->set_bookmark( 'parent' );
    81     $words = array();
    82 
    83     while ( $processor->next_tag(
    84         array(
    85             'tag_name'   => 'span',
    86             'class_name' => 'word-switch',
    87         )
    88     ) ) {
    89         // Add Interactivity API directives
    90         $processor->set_attribute( 'data-wp-text', 'state.currentWord' );
    91         $processor->set_attribute( 'data-wp-class--fade', 'context.isFading' );
    92 
    93         // Extract the comma-seperated words
    94         if ( $processor->next_token() ) {
    95             $text_content = $processor->get_modifiable_text();
    96             if ( $text_content ) {
    97                 $words = array_filter( array_map( 'trim', explode( ', ', $text_content ) ) );
    98             }
    99         }
    100     }
    101 
    102     // Return to parent and add Interactivity API attributes.
    103     $processor->seek( 'parent' );
    104     $processor->set_attribute( 'data-wp-interactive', 'wpdevagent/word-switch' );
    105     $processor->set_attribute( 'data-wp-init', 'callbacks.init' );
    106     $processor->set_attribute(
    107         'data-wp-context',
    108         wp_json_encode(
    109             array(
    110                 'words'        => $words,
    111                 'currentIndex' => 0,
    112                 'isFading'     => false,
    113             )
    114         )
    115     );
    11675
    11776    if ( ! is_admin() ) {
Note: See TracChangeset for help on using the changeset viewer.