diff --git a/assets/fonts/pt-serif/PTSerif-Bold.woff2 b/assets/fonts/pt-serif/PTSerif-Bold.woff2 new file mode 100644 index 0000000..e8be6de Binary files /dev/null and b/assets/fonts/pt-serif/PTSerif-Bold.woff2 differ diff --git a/assets/fonts/pt-serif/PTSerif-BoldItalic.woff2 b/assets/fonts/pt-serif/PTSerif-BoldItalic.woff2 new file mode 100644 index 0000000..eb95344 Binary files /dev/null and b/assets/fonts/pt-serif/PTSerif-BoldItalic.woff2 differ diff --git a/assets/fonts/pt-serif/PTSerif-Italic.woff2 b/assets/fonts/pt-serif/PTSerif-Italic.woff2 new file mode 100644 index 0000000..987d68a Binary files /dev/null and b/assets/fonts/pt-serif/PTSerif-Italic.woff2 differ diff --git a/assets/fonts/pt-serif/PTSerif-Regular.woff2 b/assets/fonts/pt-serif/PTSerif-Regular.woff2 new file mode 100644 index 0000000..38711fc Binary files /dev/null and b/assets/fonts/pt-serif/PTSerif-Regular.woff2 differ diff --git a/assets/fonts/work-sans/WorkSans-Bold.woff2 b/assets/fonts/work-sans/WorkSans-Bold.woff2 new file mode 100644 index 0000000..b8e1ead Binary files /dev/null and b/assets/fonts/work-sans/WorkSans-Bold.woff2 differ diff --git a/assets/fonts/work-sans/WorkSans-Italic.woff2 b/assets/fonts/work-sans/WorkSans-Italic.woff2 new file mode 100644 index 0000000..501a57c Binary files /dev/null and b/assets/fonts/work-sans/WorkSans-Italic.woff2 differ diff --git a/assets/fonts/work-sans/WorkSans-Regular.woff2 b/assets/fonts/work-sans/WorkSans-Regular.woff2 new file mode 100644 index 0000000..a110cf2 Binary files /dev/null and b/assets/fonts/work-sans/WorkSans-Regular.woff2 differ diff --git a/assets/fonts/work-sans/WorkSans-SemiBold.woff2 b/assets/fonts/work-sans/WorkSans-SemiBold.woff2 new file mode 100644 index 0000000..a508a44 Binary files /dev/null and b/assets/fonts/work-sans/WorkSans-SemiBold.woff2 differ diff --git a/assets/js/backend-script.js b/assets/js/backend-script.js index 452c9cb..4db6144 100644 --- a/assets/js/backend-script.js +++ b/assets/js/backend-script.js @@ -55,4 +55,62 @@ document.addEventListener('DOMContentLoaded', function() { }); }); }); -}); \ No newline at end of file +}); + + + + + + + +// REPEATERS + // Example html: + //
tag + function isSelectionInParagraph(selection) { + const range = selection.getRangeAt(0); // Get the selected range + const paragraphs = document.querySelectorAll('p'); // Get all
elements + + for (let p of paragraphs) { + // Check if the selected range intersects with this
tag + const pRect = p.getBoundingClientRect(); + const rangeRect = range.getBoundingClientRect(); + + // Check if the range and the
element's bounding boxes overlap + if (rangeRect.top < pRect.bottom && rangeRect.bottom > pRect.top && + rangeRect.left < pRect.right && rangeRect.right > pRect.left) { + return true; // Selection intersects with this
tag + } + } + + return false; // No intersection with any
tag + } + + // Function to show the popup near the selected text + function showPopup(e) { + const selection = window.getSelection(); + + // Check if any text is selected and if it is inside or intersects with a
tag + if (selection.toString().length > 0 && isSelectionInParagraph(selection)) { + // Get the bounding rectangle of the selected text + const range = selection.getRangeAt(0); + const rect = range.getBoundingClientRect(); + + // Position the popup above the selection (adjust for spacing) + popup.style.left = `${rect.left + window.scrollX}px`; + popup.style.top = `${rect.top + window.scrollY - popup.offsetHeight - 5}px`; + + // Show the popup + popup.style.display = 'block'; + + // Set up share links with the selected text and page URL + const selectedText = selection.toString(); + const pageUrl = window.location.href; + + // Facebook share link + facebookShareLink.setAttribute('href', `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(pageUrl)}"e=${encodeURIComponent(selectedText)}`); + + // Twitter/X share link + twitterShareLink.setAttribute('href', `https://twitter.com/intent/tweet?text=${encodeURIComponent(selectedText)}&url=${encodeURIComponent(pageUrl)}`); + } else { + // Hide the popup if no text is selected or it's not inside or overlapping a
tag
+ popup.style.display = 'none';
+ }
+ }
+
+ // Listen for mouse-up event (when selection ends)
+ document.addEventListener('mouseup', showPopup);
+
+ // Optionally, listen for touchend event for mobile devices
+ document.addEventListener('touchend', showPopup);
+
+ // Hide the popup if user clicks anywhere else
+ document.addEventListener('click', function(event) {
+ if (!popup.contains(event.target) && !window.getSelection().toString()) {
+ popup.style.display = 'none';
+ }
+ });
+});
diff --git a/assets/json/icons.json b/assets/json/icons.json
new file mode 100644
index 0000000..2b60c0c
--- /dev/null
+++ b/assets/json/icons.json
@@ -0,0 +1,23 @@
+[
+ {
+ "family": "Font Awesome",
+ "svgs": [
+ {
+ "id": "comment-dots",
+ "name": "Comment Dots",
+ "path": "
{__('Loading icons...', 'lcp')}
; // Loading state + } + + const iconOptions = iconData.map((icon) => ({ + value: icon.id, // Use icon ID as value for the SelectControl + label: ( +0?d[i-1]:l,v.x1=i
0)for(i=0;i=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function tt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e =0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=un);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o >1)+h+t+M+S.slice(A);break;default:t=S+h+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:l,formatPrefix:function(t,n){var e=l(((t=Jc(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Zc(n)/3))),i=Math.pow(10,-r),o=uf[8+r/3];return function(t){return e(i*t)+o}}}}function ff(n){return of=cf(n),t.format=of.format,t.formatPrefix=of.formatPrefix,of}function sf(t){return Math.max(0,-Zc(Math.abs(t)))}function lf(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Zc(n)/3)))-Zc(Math.abs(t)))}function hf(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Zc(n)-Zc(t))+1}t.format=void 0,t.formatPrefix=void 0,ff({thousands:",",grouping:[3],currency:["$",""]});var df=1e-6,pf=1e-12,gf=Math.PI,yf=gf/2,vf=gf/4,_f=2*gf,bf=180/gf,mf=gf/180,xf=Math.abs,wf=Math.atan,Mf=Math.atan2,Tf=Math.cos,Af=Math.ceil,Sf=Math.exp,Ef=Math.hypot,Nf=Math.log,kf=Math.pow,Cf=Math.sin,Pf=Math.sign||function(t){return t>0?1:t<0?-1:0},zf=Math.sqrt,$f=Math.tan;function Df(t){return t>1?0:t<-1?gf:Math.acos(t)}function Rf(t){return t>1?yf:t<-1?-yf:Math.asin(t)}function Ff(t){return(t=Cf(t/2))*t}function qf(){}function Uf(t,n){t&&Of.hasOwnProperty(t.type)&&Of[t.type](t,n)}var If={Feature:function(t,n){Uf(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,o=Tf(n=(n*=mf)/2+vf),a=Cf(n),u=Vf*a,c=Gf*o+u*Tf(i),f=u*r*Cf(i);as.add(Mf(f,c)),Xf=t,Gf=o,Vf=a}function ds(t){return[Mf(t[1],t[0]),Rf(t[2])]}function ps(t){var n=t[0],e=t[1],r=Tf(e);return[r*Tf(n),r*Cf(n),Cf(e)]}function gs(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function ys(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function vs(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function _s(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function bs(t){var n=zf(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var ms,xs,ws,Ms,Ts,As,Ss,Es,Ns,ks,Cs,Ps,zs,$s,Ds,Rs,Fs={point:qs,lineStart:Is,lineEnd:Os,polygonStart:function(){Fs.point=Bs,Fs.lineStart=Ys,Fs.lineEnd=Ls,rs=new T,cs.polygonStart()},polygonEnd:function(){cs.polygonEnd(),Fs.point=qs,Fs.lineStart=Is,Fs.lineEnd=Os,as<0?(Wf=-(Kf=180),Zf=-(Qf=90)):rs>df?Qf=90:rs<-df&&(Zf=-90),os[0]=Wf,os[1]=Kf},sphere:function(){Wf=-(Kf=180),Zf=-(Qf=90)}};function qs(t,n){is.push(os=[Wf=t,Kf=t]),n t.r&&(t.r=t[n].r)}function c(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r >>1;f[g]
+ { __( 'Todo List – hello from the editor!', 'todo-list' ) }
+ 1;)i-=2;for(let t=2;t0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)this.xmax?2:0)|(n9999?"+"+Ku(n,6):Ku(n,4))+"-"+Ku(t.getUTCMonth()+1,2)+"-"+Ku(t.getUTCDate(),2)+(o?"T"+Ku(e,2)+":"+Ku(r,2)+":"+Ku(i,2)+"."+Ku(o,3)+"Z":i?"T"+Ku(e,2)+":"+Ku(r,2)+":"+Ku(i,2)+"Z":r||e?"T"+Ku(e,2)+":"+Ku(r,2)+"Z":"")}function Ju(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,c=o<=0,f=!1;function s(){if(c)return Hu;if(f)return f=!1,ju;var n,r,i=a;if(t.charCodeAt(i)===Xu){for(;a++=v)<<1|t>=y)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var _=t-+this._x.call(null,g.data),b=n-+this._y.call(null,g.data),m=_*_+b*b;if(m=u)){(t.data!==n||t.next)&&(0===l&&(p+=(l=Uc(e))*l),0===h&&(p+=(h=Uc(e))*h),p(t=(Lc*t+jc)%Hc)/Hc}();function l(){h(),f.call("tick",n),e1?(f.on(t,e),n):f.on(t)}}},t.forceX=function(t){var n,e,r,i=qc(.1);function o(t){for(var i,o=0,a=n.length;o=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),c.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++ejs(r[0],r[1])&&(r[1]=i[1]),js(i[0],r[1])>js(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=js(r[1],i[0]))>a&&(a=u,Wf=i[0],Kf=r[1])}return is=os=null,Wf===1/0||Zf===1/0?[[NaN,NaN],[NaN,NaN]]:[[Wf,Zf],[Kf,Qf]]},t.geoCentroid=function(t){ms=xs=ws=Ms=Ts=As=Ss=Es=0,Ns=new T,ks=new T,Cs=new T,Lf(t,Gs);var n=+Ns,e=+ks,r=+Cs,i=Ef(n,e,r);return i 0, 'y' => 10],
+ ['x' => 1, 'y' => 20],
+ ['x' => 2, 'y' => 15],
+ ['x' => 3, 'y' => 25],
+ ['x' => 4, 'y' => 30],
+ ['x' => 5, 'y' => 40],
+ ['x' => 6, 'y' => 45],
+ ]);
+
+ return '';
+
+}
+
+
+function lcp_visualizer_block_init() {
+ register_block_type( __DIR__ . '/build', array(
+ 'render_callback' => 'render_lcp_visualizer_block',
+ ));
+
+}
+add_action( 'init', 'lcp_visualizer_block_init' );
+
+
+function enqueue_d3_js() {
+ // Define the path to the D3.js file
+ $d3_js_path = get_template_directory_uri() . '/includes/blocks/lcp-visualizer/assets/js/d3.v7.min.js';
+
+ // Enqueue the D3.js file
+ wp_enqueue_script('d3-js', $d3_js_path, array(), null, false);
+}
+add_action('wp_enqueue_scripts', 'enqueue_d3_js');
\ No newline at end of file
diff --git a/includes/blocks/lcp-visualizer/package.json b/includes/blocks/lcp-visualizer/package.json
new file mode 100644
index 0000000..942842b
--- /dev/null
+++ b/includes/blocks/lcp-visualizer/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "todo-list",
+ "version": "0.1.0",
+ "description": "Example block scaffolded with Create Block tool.",
+ "author": "The WordPress Contributors",
+ "license": "GPL-2.0-or-later",
+ "main": "build/index.js",
+ "scripts": {
+ "build": "wp-scripts build",
+ "format": "wp-scripts format",
+ "lint:css": "wp-scripts lint-style",
+ "lint:js": "wp-scripts lint-js",
+ "packages-update": "wp-scripts packages-update",
+ "plugin-zip": "wp-scripts plugin-zip",
+ "start": "wp-scripts start"
+ },
+ "devDependencies": {
+ "@wordpress/scripts": "^30.7.0"
+ }
+}
diff --git a/includes/blocks/lcp-visualizer/readme.txt b/includes/blocks/lcp-visualizer/readme.txt
new file mode 100644
index 0000000..787d594
--- /dev/null
+++ b/includes/blocks/lcp-visualizer/readme.txt
@@ -0,0 +1,55 @@
+=== Todo List ===
+Contributors: The WordPress Contributors
+Tags: block
+Tested up to: 6.6
+Stable tag: 0.1.0
+License: GPL-2.0-or-later
+License URI: https://www.gnu.org/licenses/gpl-2.0.html
+
+Example block scaffolded with Create Block tool.
+
+== Description ==
+
+This is the long description. No limit, and you can use Markdown (as well as in the following sections).
+
+For backwards compatibility, if this section is missing, the full length of the short description will be used, and
+Markdown parsed.
+
+== Installation ==
+
+This section describes how to install the plugin and get it working.
+
+e.g.
+
+1. Upload the plugin files to the `/wp-content/plugins/todo-list` directory, or install the plugin through the WordPress plugins screen directly.
+1. Activate the plugin through the 'Plugins' screen in WordPress
+
+
+== Frequently Asked Questions ==
+
+= A question that someone might have =
+
+An answer to that question.
+
+= What about foo bar? =
+
+Answer to foo bar dilemma.
+
+== Screenshots ==
+
+1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
+the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
+directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
+(or jpg, jpeg, gif).
+2. This is the second screen shot
+
+== Changelog ==
+
+= 0.1.0 =
+* Release
+
+== Arbitrary section ==
+
+You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
+plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
+"installation." Arbitrary sections will be shown below the built-in sections outlined above.
diff --git a/includes/blocks/lcp-visualizer/src/block.json b/includes/blocks/lcp-visualizer/src/block.json
new file mode 100644
index 0000000..bbb0772
--- /dev/null
+++ b/includes/blocks/lcp-visualizer/src/block.json
@@ -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"
+}
diff --git a/includes/blocks/lcp-visualizer/src/edit.js b/includes/blocks/lcp-visualizer/src/edit.js
new file mode 100644
index 0000000..e327d39
--- /dev/null
+++ b/includes/blocks/lcp-visualizer/src/edit.js
@@ -0,0 +1,38 @@
+/**
+ * Retrieves the translation of text.
+ *
+ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
+ */
+import { __ } from '@wordpress/i18n';
+
+/**
+ * React hook that is used to mark the block wrapper element.
+ * It provides all the necessary props like the class name.
+ *
+ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
+ */
+import { useBlockProps } from '@wordpress/block-editor';
+
+/**
+ * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
+ * Those files can contain any CSS code that gets applied to the editor.
+ *
+ * @see https://www.npmjs.com/package/@wordpress/scripts#using-css
+ */
+import './editor.scss';
+
+/**
+ * The edit function describes the structure of your block in the context of the
+ * editor. This represents what the editor will render when the block is used.
+ *
+ * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
+ *
+ * @return {Element} Element to render.
+ */
+export default function Edit() {
+ return (
+