Changes to lcp-button

This commit is contained in:
Jeremy Rangel
2024-12-31 18:53:46 -08:00
parent 2df16e37a8
commit 741d39a962
94 changed files with 1159 additions and 138 deletions

View File

@ -0,0 +1,19 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/visualizer",
"version": "0.1.0",
"title": "Visualizer",
"category": "widgets",
"icon": "smiley",
"description": "Block for charts and data visualization",
"example": {},
"supports": {
"html": false
},
"textdomain": "lcp",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js"
}

View File

@ -0,0 +1 @@
.wp-block-create-block-todo-list{border:1px dotted red}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '449eb637586399932c7e');

View File

@ -0,0 +1 @@
.wp-block-create-block-todo-list{border:1px dotted red}

View File

@ -0,0 +1 @@
(()=>{"use strict";var r,o={650:()=>{const r=window.wp.blocks,o=window.wp.i18n,e=window.wp.blockEditor,t=window.ReactJSXRuntime,i=JSON.parse('{"UU":"lcp/visualizer"}');(0,r.registerBlockType)(i.UU,{edit:function(){return(0,t.jsx)("p",{...(0,e.useBlockProps)(),children:(0,o.__)("Todo List hello from the editor!","todo-list")})},save:function(){return null}})}},e={};function t(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return o[r](n,n.exports,t),n.exports}t.m=o,r=[],t.O=(o,e,i,n)=>{if(!e){var l=1/0;for(c=0;c<r.length;c++){for(var[e,i,n]=r[c],s=!0,a=0;a<e.length;a++)(!1&n||l>=n)&&Object.keys(t.O).every((r=>t.O[r](e[a])))?e.splice(a--,1):(s=!1,n<l&&(l=n));if(s){r.splice(c--,1);var p=i();void 0!==p&&(o=p)}}return o}n=n||0;for(var c=r.length;c>0&&r[c-1][2]>n;c--)r[c]=r[c-1];r[c]=[e,i,n]},t.o=(r,o)=>Object.prototype.hasOwnProperty.call(r,o),(()=>{var r={57:0,350:0};t.O.j=o=>0===r[o];var o=(o,e)=>{var i,n,[l,s,a]=e,p=0;if(l.some((o=>0!==r[o]))){for(i in s)t.o(s,i)&&(t.m[i]=s[i]);if(a)var c=a(t)}for(o&&o(e);p<l.length;p++)n=l[p],t.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return t.O(c)},e=globalThis.webpackChunktodo_list=globalThis.webpackChunktodo_list||[];e.forEach(o.bind(null,0)),e.push=o.bind(null,e.push.bind(e))})();var i=t.O(void 0,[350],(()=>t(650)));i=t.O(i)})();

View File

@ -0,0 +1 @@
.wp-block-create-block-todo-list{background-color:#21759b;color:#fff;padding:2px}.line{fill:none;stroke-width:2px}.hover-line{stroke-width:4px}.axis-label{font-size:12px}

View File

@ -0,0 +1 @@
.wp-block-create-block-todo-list{background-color:#21759b;color:#fff;padding:2px}.line{fill:none;stroke-width:2px}.hover-line{stroke-width:4px}.axis-label{font-size:12px}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '9504dff164e131288259');

View File

@ -0,0 +1 @@
console.log("Hello World! (from lcp-visualizer)"),document.addEventListener("DOMContentLoaded",(function(){const t=[{date:"2023-01-01",team:"Manchester City",goals:2},{date:"2023-01-01",team:"Liverpool",goals:1},{date:"2023-02-01",team:"Manchester City",goals:3},{date:"2023-02-01",team:"Liverpool",goals:2},{date:"2023-03-01",team:"Manchester City",goals:4},{date:"2023-03-01",team:"Liverpool",goals:3},{date:"2023-04-01",team:"Manchester City",goals:3},{date:"2023-04-01",team:"Liverpool",goals:4},{date:"2023-05-01",team:"Manchester City",goals:5},{date:"2023-05-01",team:"Liverpool",goals:4}],a=d3.timeParse("%Y-%m-%d");t.forEach((t=>{t.date=a(t.date),t.goals=+t.goals}));const e=Array.from(new Set(t.map((t=>t.team)))),l=d3.scaleOrdinal().domain(e).range(d3.schemeCategory10),r=d3.select(".lcp-visualizer").attr("width",800).attr("height",400).append("g").attr("transform","translate(40,20)"),o=d3.scaleTime().domain(d3.extent(t,(t=>t.date))).range([0,730]),s=d3.scaleLinear().domain([0,d3.max(t,(t=>t.goals))]).nice().range([340,0]),n=d3.line().x((t=>o(t.date))).y((t=>s(t.goals)));r.append("g").attr("transform","translate(0,340)").call(d3.axisBottom(o)),r.append("g").call(d3.axisLeft(s));const d=e.map((a=>({team:a,values:t.filter((t=>t.team===a))})));r.selectAll(".line").data(d).enter().append("path").attr("class","line").attr("d",(t=>n(t.values))).attr("stroke",(t=>l(t.team))),d.forEach((t=>{r.selectAll(`circle.${t.team}`).data(t.values).enter().append("circle").attr("class",t.team).attr("cx",(t=>o(t.date))).attr("cy",(t=>s(t.goals))).attr("r",4).attr("fill",l(t.team)).on("mouseover",(function(t,a){d3.select(this).transition().duration(200).attr("r",6).attr("fill","orange"),d3.select(`path.${a.team}`).classed("hover-line",!0)})).on("mouseout",(function(t,a){d3.select(this).transition().duration(200).attr("r",4).attr("fill",l(a.team)),d3.select(`path.${a.team}`).classed("hover-line",!1)}))}))}));