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

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ wp-includes/
.DS_Store
node_modules/
.env
build/
dist/
package-lock.json
yarn.lock

View File

@ -1,10 +1,17 @@
document.addEventListener('DOMContentLoaded', function () {
console.log('DOMContentLoaded event triggered');
const installButtons = document.querySelectorAll('.install-btn');
const uninstallButtons = document.querySelectorAll('.uninstall-btn');
console.log('Install buttons:', installButtons);
console.log('Uninstall buttons:', uninstallButtons);
// Handle Install button click
installButtons.forEach(function (button) {
button.addEventListener('click', function () {
console.log('Adding install listener to button', button);
button.addEventListener('click', function (event) {
event.preventDefault(); // Prevent default form submission or page reload
console.log('Install button clicked');
const iconSetId = this.getAttribute('data-icon-set-id');
console.log('Icon Set ID:', iconSetId);
@ -36,7 +43,9 @@ document.addEventListener('DOMContentLoaded', function () {
// Handle Uninstall button click
uninstallButtons.forEach(function (button) {
button.addEventListener('click', function () {
console.log('Adding uninstall listener to button', button);
button.addEventListener('click', function (event) {
event.preventDefault(); // Prevent default form submission or page reload
console.log('Uninstall button clicked');
const iconSetId = this.getAttribute('data-icon-set-id');
console.log('Icon Set ID for uninstall:', iconSetId);

View File

@ -229,10 +229,7 @@ function mytheme_display_icon_sets() {
// Enqueue the dashboard styles only on the icon-management page
function mytheme_enqueue_dashboard_styles($hook) {
// Only load the styles on the icon-management page
if ($hook != 'toplevel_page_icon-management') {
return;
}
// Enqueue CSS for the dashboard
wp_enqueue_style(
@ -354,9 +351,7 @@ function mytheme_create_icons_table() {
function mytheme_enqueue_dashboard_scripts($hook) {
// Only load the script on the icon-management page
if ($hook != 'toplevel_page_icon-management') {
return;
}
// Enqueue JavaScript for AJAX
wp_enqueue_script(

View File

@ -0,0 +1,101 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/button",
"version": "0.1.0",
"title": "Button",
"category": "widgets",
"icon": "smiley",
"description": "A button for various functions or custom urls",
"example": {},
"supports": {
"html": false
},
"attributes": {
"buttonAction": {
"type": "string",
"default": "customUrl"
},
"customUrl": {
"type": "string",
"default": "#"
},
"buttonText": {
"type": "string",
"default": "Button Text"
},
"displayIcon": {
"type": "boolean",
"default": true
},
"iconSource": {
"type": "string",
"default": "manualSvgPath"
},
"iconSvgPath": {
"type": "string",
"default": ""
},
"iconSvgId": {
"type": "string",
"default": ""
},
"iconSvgViewbox": {
"type": "string",
"default": "0 0 510 510"
},
"popUpId": {
"type": "number"
},
"manualIconSvgPath": {
"type": "string",
"default": ""
},
"buttonHeight": {
"type": "string",
"default": ""
},
"buttonPadding": {
"type": "object",
"default": {
"extraLarge": {
"top": "10px",
"right": "10px",
"bottom": "10px",
"left": "10px"
},
"large": {
"top": "10px",
"right": "10px",
"bottom": "10px",
"left": "10px"
},
"medium": {
"top": "10px",
"right": "10px",
"bottom": "10px",
"left": "10px"
},
"small": {
"top": "10px",
"right": "10px",
"bottom": "10px",
"left": "10px"
}
}
},
"iconHeight": {
"type": "string",
"default": ""
},
"iconWidth": {
"type": "string",
"default": ""
}
},
"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-button{border:1px dotted red}.lcp-button{background-color:var(--wp--preset--color--accent);border:none;color:#fff;cursor:pointer;display:inline-block;font-size:var(--wp--preset--font-size--small);font-weight:700;margin:auto 5px;padding:10px;text-decoration:none;white-space:nowrap}.lcp-button .lcp-icon{height:1.2em;margin-left:10px;max-height:100%;vertical-align:middle;width:auto;fill:#fff}

View File

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

View File

@ -0,0 +1 @@
.wp-block-create-block-button{border:1px dotted red}.lcp-button{background-color:var(--wp--preset--color--accent);border:none;color:#fff;cursor:pointer;display:inline-block;font-size:var(--wp--preset--font-size--small);font-weight:700;margin:auto 5px;padding:10px;text-decoration:none;white-space:nowrap}.lcp-button .lcp-icon{height:1.2em;margin-right:10px;max-height:100%;vertical-align:middle;width:auto;fill:#fff}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.wp-block-create-block-button{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-button{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-button block)");

View File

@ -0,0 +1,96 @@
import { __ } from '@wordpress/i18n';
import { BaseControl, __experimentalNumberControl as NumberControl, SelectControl, __experimentalHStack as HStack } from '@wordpress/components';
import { useState, useEffect } from 'react';
/**
* Control component with a number input and a select dropdown for units (px, rem, em, % etc.).
* Accepts a default value as a string (e.g., "15px", "10rem", etc.).
* Includes an optional 'auto' unit if includeAuto is true, and handles autoReturnsNull behavior.
*/
export function DimensionValueControl({ value = '10px', onChange, includeAuto = false, autoReturnsNull = false }) {
// Options for select control (CSS units) including 'auto' if enabled
const unitOptions = [
{ label: __('px'), value: 'px' },
{ label: __('%'), value: '%' },
{ label: __('em'), value: 'em' },
{ label: __('rem'), value: 'rem' },
{ label: __('vw'), value: 'vw' },
{ label: __('vh'), value: 'vh' },
...(includeAuto ? [{ label: __('auto'), value: 'auto' }] : []), // Add 'auto' option if includeAuto is true
];
// Parse the value string into a number and unit
const parseValue = (value) => {
const regex = /([0-9]+)([a-zA-Z%]+)?/; // Capture the number and the unit
const match = value.match(regex);
if (match) {
return {
numberValue: parseInt(match[1], 10), // Number part
unitValue: match[2] || 'px' // Unit part (default to 'px' if no unit found)
};
}
return { numberValue: 0, unitValue: 'px' }; // Fallback if invalid format
};
// Use the parsed value to set initial state
const { numberValue: initialNumber, unitValue: initialUnit } = parseValue(value);
const [numberValue, setNumberValue] = useState(initialNumber);
const [unitValue, setUnitValue] = useState(initialUnit);
// Combine the number and unit into a string like "15px"
const dimensionValue = `${numberValue}${unitValue}`;
// Handle number change
const onNumberChange = (newValue) => {
setNumberValue(newValue);
if (onChange && unitValue !== 'auto') {
onChange(`${newValue}${unitValue}`); // Pass updated value back to parent
}
};
// Handle unit change
const onUnitChange = (newUnit) => {
if (newUnit === 'auto') {
setNumberValue(null); // Reset the number value when 'auto' is selected
}
setUnitValue(newUnit);
if (onChange) {
const updatedValue = newUnit === 'auto'
? (autoReturnsNull ? null : 'auto')
: `${numberValue}${newUnit}`; // Pass 'auto' or null or updated value back to parent
onChange(updatedValue);
}
};
// Effect to handle when value prop changes (useful for syncing)
useEffect(() => {
const { numberValue, unitValue } = parseValue(value);
setNumberValue(numberValue);
setUnitValue(unitValue);
}, [value]);
return (
<BaseControl className="lcp-dimension-value-control">
<HStack>
{/* Number input control, disabled when 'auto' is selected */}
<NumberControl
className="lcp-number-control"
value={numberValue || ''}
onChange={onNumberChange}
min={0}
step={0.1}
spinControls={'none'}
disabled={unitValue === 'auto'} // Disable number input if 'auto' is selected
/>
{/* Select dropdown control for units */}
<SelectControl
className="lcp-select-control"
value={unitValue}
options={unitOptions}
onChange={onUnitChange}
/>
</HStack>
</BaseControl>
);
}

View File

@ -0,0 +1,59 @@
import { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import { SelectControl } from '@wordpress/components';
export function IconSelectControl(props) {
const { iconSvgId, onIconChange } = props;
const [iconData, setIconData] = useState([]);
useEffect(() => {
const fetchIconData = async () => {
try {
const response = await fetch('/wp-json/lcp/v1/icons');
const data = await response.json();
if (Array.isArray(data) && data.length > 0) {
setIconData(data); // Set the fetched data directly
}
} catch (error) {
console.error('Error fetching icons:', error);
}
};
fetchIconData();
}, []);
const handleIconChange = (selectedIconId) => {
const selectedIcon = iconData.find(icon => icon.iconSvgId === selectedIconId);
if (selectedIcon && onIconChange) {
// Send both icon ID and path (SVG) to the parent component
onIconChange({
iconSvgId: selectedIcon.iconSvgId, // Pass icon ID to parent
iconSvgPath: selectedIcon.iconSvgPaths, // Pass icon paths to parent
viewbox: selectedIcon.selectedIconViewbox // Pass the viewbox to parent
});
console.log("Selected Icon ID:", selectedIcon.iconSvgId); // Debugging output
console.log("Selected Icon Path:", selectedIcon.iconSvgPaths); // Debugging output
console.log("Selected Icon Viewbox:", selectedIcon.selectedIconViewbox); // Debugging output
}
};
if (iconData.length === 0) {
return <p>{__('Loading icons...', 'lcp')}</p>; // Loading state
}
const iconOptions = iconData.map((icon) => ({
value: icon.iconSvgId, // Use icon ID as value for the SelectControl
label: icon.name, // Directly use the icon's name as the label
}));
return (
<SelectControl
label={__('Select Icon', 'lcp')}
value={iconSvgId} // Current selected icon ID
options={iconOptions}
onChange={handleIconChange} // Handle icon change
/>
);
}

View File

@ -0,0 +1,103 @@
import { __ } from '@wordpress/i18n';
import { BaseControl, Button, RangeControl, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
import { DimensionValueControl } from './DimensionValueControl';
/**
* Padding Control component to manage padding values for different screen sizes.
*/
export function PaddingControl() {
return (
<BaseControl className="lcp-padding-control">
{/* Padding label and Unlink button */}
<HStack>
<span>{__('Padding')}</span>
<Button
variant="secondary"
aria-label={__('Unlink sides')}
onClick={() => {}}
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
<path d="M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"></path>
</svg>
</Button>
</HStack>
{/* Extra Large Padding Controls */}
{/* Will update all padding values for all screen sizes if updateAllScreenSizes is true */}
{/* Top and Bottom HStack */}
<HStack style={{ flex: 1 }}>
{/* Top and Bottom Icon */}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" className="spacing-sizes-control__icon" aria-hidden="true" focusable="false">
<path d="m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" style={{ opacity: 0.25 }}></path>
<path d="m7.5 6h9v-1.5h-9z"></path>
<path d="m7.5 19.5h9v-1.5h-9z"></path>
</svg>
{/* RangeControl wrapped in HStack with flex: 1 applied to its parent */}
<HStack style={{ flex: 1 }}>
<DimensionValueControl/>
<RangeControl
withInputField={false}
value={10} // Placeholder value
onChange={() => {}}
min={0}
max={50}
/>
</HStack>
{/* Custom Padding Button */}
<Button
style={{padding:0,background:'none',color:'var(--wp-components-color-foreground)'} }
variant="primary"
onClick={() => {}}
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"></path>
<path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"></path>
</svg>
</Button>
</HStack>
{/* Left and Right HStack */}
<HStack style={{ flex: 1 }}>
{/* Left and Right Icon */}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" className="spacing-sizes-control__icon" aria-hidden="true" focusable="false">
<path d="m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" style={{ opacity: 0.25 }}></path>
<path d="m7.5 6h9v-1.5h-9z"></path>
<path d="m4.5 7.5v9h1.5v-9z"></path>
<path d="m18 7.5v9h1.5v-9z"></path>
</svg>
{/* RangeControl wrapped in HStack with flex: 1 applied to its parent */}
<RangeControl
withInputField={false}
value={10} // Placeholder value
onChange={() => {}}
min={0}
max={50}
/>
{/* Custom Padding Button */}
<Button
variant="primary"
onClick={() => {}}
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"></path>
<path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"></path>
</svg>
</Button>
</HStack>
{/* Additional controls can be added here in a VStack */}
<VStack>
{/* Placeholder for additional components */}
</VStack>
</BaseControl>
);
}

View File

@ -6,17 +6,10 @@
"title": "Button",
"category": "widgets",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"description": "A button for various functions or custom urls",
"example": {},
"supports": {
"html": false,
"color": {
"background": true,
"link": true,
"text": true,
"gradients": true,
"button": true
}
"html": false
},
"attributes": {
"buttonAction": {
@ -32,14 +25,16 @@
"default": "Button Text"
},
"displayIcon": {
"type": "boolean"
"type": "boolean",
"default": true
},
"iconSource": {
"type": "string",
"default": "manualSvgPath"
},
"iconSvgPath": {
"type": "string"
"type": "string",
"default": ""
},
"iconSvgId": {
"type": "string",
@ -53,10 +48,12 @@
"type": "number"
},
"manualIconSvgPath":{
"type": "string"
"type": "string",
"default": ""
},
"buttonHeight":{
"type": "string"
"type": "string",
"default": ""
},
"buttonPadding":{
"type": "object",
@ -88,10 +85,12 @@
}
},
"iconHeight": {
"type": "string"
"type": "string",
"default": ""
},
"iconWidth": {
"type": "string"
"type": "string",
"default": ""
}
},
"textdomain": "lcp",

View File

@ -2,7 +2,7 @@ import { useBlockProps } from '@wordpress/block-editor';
export default function save(props) {
const { attributes } = props;
const { buttonText, buttonPadding,iconHeight,iconSvgPath, iconSvgViewbox, buttonAction, customUrl } = attributes; // Destructure buttonText, iconSvgPath, and iconSvgViewbox
const {displayIcon, buttonText, buttonPadding,iconHeight,iconSvgPath, iconSvgViewbox, buttonAction, customUrl } = attributes; // Destructure buttonText, iconSvgPath, and iconSvgViewbox
// Get the block props for the button
const blockProps = useBlockProps.save();
@ -10,7 +10,7 @@ export default function save(props) {
// Conditionally render the link or button based on buttonAction
return (
<div {...useBlockProps()}>
<div {...blockProps}>
{buttonAction === 'customUrl' ? (
<a href={customUrl} className="lcp-button" style={{ padding: buttonPadding || '10px' }}>
{displayIcon && iconSvgPath && (

View File

@ -0,0 +1,141 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/dynamic-container",
"version": "0.1.0",
"title": "Dynamic Container",
"category": "widgets",
"icon": "smiley",
"description": "A general purpose container that uses dynamic rendering",
"example": {},
"supports": {
"anchor": true,
"align": [
"left",
"right",
"wide",
"full"
],
"background": {
"backgroundImage": true,
"backgroundSize": true,
"__experimentalDefaultControls": {
"backgroundImage": true
}
},
"color": {
"gradients": true,
"background": true,
"link": true,
"__experimentalDefaultControls": {
"background": true,
"text": true
}
}
},
"attributes": {
"maxWidthExtraLarge": {
"type": "string"
},
"maxWidthLarge": {
"type": "string"
},
"maxWidthMedium": {
"type": "string"
},
"maxWidthSmall": {
"type": "string"
},
"minHeightExtraLarge": {
"type": "string"
},
"minHeightLarge": {
"type": "string"
},
"minHeightMedium": {
"type": "string"
},
"minHeightSmall": {
"type": "string"
},
"isBox": {
"type": "boolean",
"default": false
},
"backgroundColor": {
"type": "string"
},
"entranceAnimation": {
"type": "string"
},
"exitAnimation": {
"type": "string"
},
"overflow": {
"type": "string"
},
"padding": {
"type": "object",
"default": {
"extraLarge": {
"top": "0",
"right": "0",
"bottom": "0",
"left": "0"
},
"large": {
"top": "0",
"right": "0",
"bottom": "0",
"left": "0"
},
"medium": {
"top": "0",
"right": "0",
"bottom": "0",
"left": "0"
},
"small": {
"top": "0",
"right": "0",
"bottom": "0",
"left": "0"
}
}
},
"margin": {
"type": "object",
"default": {
"extraLarge": {
"top": "12px",
"right": "0",
"bottom": "12px",
"left": "0"
},
"large": {
"top": "12px",
"right": "0",
"bottom": "12px",
"left": "0"
},
"medium": {
"top": "12px",
"right": "0",
"bottom": "12px",
"left": "0"
},
"small": {
"top": "12px",
"right": "0",
"bottom": "12px",
"left": "0"
}
}
}
},
"textdomain": "lcp",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js"
}

View File

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

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-lcp-viewport block)");

View File

@ -0,0 +1,384 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/lcp-gallery",
"version": "0.1.0",
"title": "LCP Gallery",
"category": "widgets",
"icon": "",
"description": "A dynamic or static gallery based on the Lightgallery javascript plugin",
"example": {},
"supports": {
"html": false
},
"attributes": {
"parseElementForItems": {
"type": "boolean",
"default": false
},
"parsedTargetElement": {
"type": "string",
"default": ""
},
"parsedExcludedElements": {
"type": "string",
"default": ""
},
"lgSettings": {
"type": "object",
"default": {
"zoom": false,
"thumbnail": false,
"toggleThumb": false,
"thumbWidth": 120,
"thumbHeight": "80px",
"thumbMargin": 4,
"hash": false,
"galleryId": "1",
"dynamic": false,
"mode": "lg-fade",
"cssEasing": "ease",
"rotate": false,
"fullScreen": false,
"autoplay": false,
"download": false,
"loop": true,
"closeOnTap": true,
"enableDrag": true,
"enableSwipe": true,
"escKey": true,
"getCaptionFromTitleOrAlt ": true,
"hideBarsDelay": 0,
"hideControlOnEnd": false,
"hideScrollbar ": false,
"controls": true,
"counter": true,
"container": "",
"closable": true,
"zoomFromOrigin": false,
"showMaximizeIcon": false,
"plugins": []
}
},
"hashGalleryId": {
"type": "string",
"default": ""
},
"source": {
"type": "string",
"default": "manual"
},
"galleryItems": {
"type": "array"
},
"sourceMetaField": {
"type": "string",
"default": ""
},
"sourceTable": {
"type": "string",
"default": ""
},
"sourceColumn": {
"type": "string",
"default": ""
},
"includePostThumbnail": {
"type": "boolean",
"default": false
},
"initialLayout": {
"type": "string",
"default": "grid"
},
"initialLayoutLarge": {
"type": "string",
"default": "inline"
},
"initialLayoutSmall": {
"type": "string",
"default": "inline"
},
"justifiedRowHeightSmall": {
"type": "string",
"default": "150px"
},
"justifiedRowHeightMedium": {
"type": "string",
"default": "150px"
},
"justifiedRowHeightLarge": {
"type": "string",
"default": "150px"
},
"justifiedLastRow": {
"type": "string",
"default": "justify"
},
"maxInitialItems": {
"type": "number",
"default": 0
},
"initialImageSize": {
"type": "string",
"default": "medium-large"
},
"inlineHeightSmall": {
"type": "string",
"default": "300px"
},
"inlineHeightMedium": {
"type": "string",
"default": "400px"
},
"inlineHeightLarge": {
"type": "string",
"default": "500px"
},
"containerWidthDesktop": {
"type": "string",
"default": "100%"
},
"containerWidthTablet": {
"type": "string",
"default": "100%"
},
"containerWidthMobile": {
"type": "string",
"default": "100%"
},
"itemsAspectRatio": {
"type": "string",
"default": "1-1"
},
"gridColumns": {
"type": "number",
"default": 4
},
"gridColumnsLarge": {
"type": "number",
"default": 4
},
"gridColumnsMedium": {
"type": "number",
"default": 3
},
"gridColumnsSmall": {
"type": "number",
"default": 2
},
"gridGapLarge": {
"type": "number",
"default": 10
},
"gridGapMedium": {
"type": "number",
"default": 10
},
"gridGapSmall": {
"type": "number",
"default": 10
},
"downloadLimitRoles": {
"type": "array",
"default": ""
},
"allowHideThumbnails": {
"type": "boolean",
"default": false
},
"thumbnailsStyle": {
"type": "string",
"default": ""
},
"thumbnailActiveStyle": {
"type": "string",
"default": ""
},
"thumbnailBorders": {
"type": "object"
},
"thumbnailBordersSelected": {
"type": "object"
},
"thumbsBackgroundColor": {
"type": "string"
},
"backdropBackgroundColor": {
"type": "string"
},
"showCaptions": {
"type": "boolean"
},
"showItemTitle": {
"type": "boolean"
},
"showItemDescription": {
"type": "boolean"
},
"lgMode": {
"type": "string",
"default": "lg-slide"
},
"downloadSize": {
"type": "string",
"default": "full"
},
"allowShare": {
"type": "boolean",
"default": true
},
"lgVideo": {
"type": "boolean",
"default": "true"
},
"dynamic": {
"type": "boolean",
"default": false
},
"loop": {
"type": "boolean",
"default": true
},
"speed": {
"type": "number",
"default": 500
},
"slideDelay": {
"type": "number",
"default": 200
},
"hash": {
"type": "boolean",
"default": false
},
"allowZoom": {
"type": "boolean",
"default": false
},
"closable": {
"type": "boolean",
"default": true
},
"closeOnTap": {
"type": "boolean",
"default": true
},
"container": {
"type": "string",
"default": ""
},
"showControls": {
"type": "boolean",
"default": true
},
"showCounter": {
"type": "boolean",
"default": true
},
"showMaximizeIcon": {
"type": "boolean",
"default": true
},
"easing": {
"type": "string",
"default": "ease"
},
"download": {
"type": "boolean",
"default": false
},
"appendThumbnailsTo": {
"type": "string",
"default": ".lg-components"
},
"appendSubHtmlTo": {
"type": "string",
"default": ".lg-item"
},
"thumbWidth": {
"type": "string",
"default": "80px"
},
"thumbHeight": {
"type": "string",
"default": "80px"
},
"thumbnailsBorders": {
"type": "object",
"default": {
"top": {
"color": "#000000",
"style": "solid",
"width": "10px"
},
"right": {
"color": "#000000",
"style": "solid",
"width": "10px"
},
"bottom": {
"color": "#000000",
"style": "solid",
"width": "10px"
},
"left": {
"color": "#000000",
"style": "solid",
"width": "10px"
}
}
},
"thumbnailsBordersSelected": {
"type": "object",
"default": {
"top": {
"color": "#000000",
"style": "solid",
"width": "1px"
},
"right": {
"color": "#000000",
"style": "solid",
"width": "1px"
},
"bottom": {
"color": "#000000",
"style": "solid",
"width": "1px"
},
"left": {
"color": "#000000",
"style": "solid",
"width": "1px"
}
}
},
"thumbMargin": {
"type": "number",
"default": 5
},
"toggleThumb": {
"type": "boolean",
"default": false
},
"numberOfSlideItemsInDom": {
"type": "number",
"default": 10
},
"galleryCustomStyles": {
"type": "string",
"default": ""
}
},
"textdomain": "lcp",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": [
"file:./view.js"
],
"viewStyle": [
"file:./lightgallery-bundle.min.css"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.wp-block-create-block-gallery{background-color:#21759b;color:#fff;padding:2px}.admin-bar .lg-container:not(.lg-inline) .lg-outer{height:calc(100% - 32px)!important;top:32px}.lcp-inline-gallery{height:500px;position:relative;width:100%}.lcp-inline-gallery .lcp-gallery-item .img-fluid{display:none}.lcp-gallery .gallery-item,.lcp-gallery .gallery-item>img{width:100%}.lcp-gallery .gallery-item.last:after{background:red;content:"";height:100%;right:0;opacity:.5;position:absolute;top:0;width:100%}.lg-thumbnail-active-grayscale .lg-thumb-item.active img,.lg-thumbnail-grayscale .lg-thumb-item:not(.active) img{filter:grayscale(100%)}.lg-thumbnail-active-blur .lg-thumb-item.active img,.lg-thumbnail-blur .lg-thumb-item:not(.active) img{filter:blur(1px)}.lg-outer{background:none}.lcp-display-none{display:none}.gallery-item{position:relative}span.gallery-more{color:#fff;font-size:40px;right:50%;position:absolute;top:50%;transform:translate3d(50%,-50%,0);z-index:10}.lcp-gallery.aspect-1-1 .lcp-gallery-item{aspect-ratio:1/1}.lcp-gallery.aspect-2-3 .lcp-gallery-item{aspect-ratio:2/3}.lcp-gallery.aspect-3-4 .lcp-gallery-item{aspect-ratio:3/4}.lcp-gallery.aspect-4-5 .lcp-gallery-item{aspect-ratio:4/5}.lcp-gallery.aspect-5-7 .lcp-gallery-item{aspect-ratio:5/7}.lcp-gallery.aspect-3-2 .lcp-gallery-item{aspect-ratio:3/2}.lcp-gallery.aspect-16-9 .lcp-gallery-item{aspect-ratio:16/9}.gallery-item img{-o-object-fit:cover;object-fit:cover}.lcp-gallery.grid{display:grid}.lcp-gallery.grid .gallery-item img{height:100%;-o-object-fit:cover;object-fit:cover}.lcp-gallery.grid{gap:1rem;grid-template-columns:1fr 1fr 1fr 1fr}@media only screen and (min-width:1167px){.lcp-gallery.grid.large-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.large-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.large-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.large-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}@media only screen and (min-width:768px)and (max-width:1166px){.lcp-gallery.grid.medium-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.medium-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.medium-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.medium-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}@media only screen and (max-width:767px){.lcp-gallery.grid.small-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.small-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.small-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.small-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}.lcp-gallery.grid>a>img{display:block;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}

View File

@ -0,0 +1 @@
.wp-block-create-block-gallery{background-color:#21759b;color:#fff;padding:2px}.admin-bar .lg-container:not(.lg-inline) .lg-outer{height:calc(100% - 32px)!important;top:32px}.lcp-inline-gallery{height:500px;position:relative;width:100%}.lcp-inline-gallery .lcp-gallery-item .img-fluid{display:none}.lcp-gallery .gallery-item,.lcp-gallery .gallery-item>img{width:100%}.lcp-gallery .gallery-item.last:after{background:red;content:"";height:100%;left:0;opacity:.5;position:absolute;top:0;width:100%}.lg-thumbnail-active-grayscale .lg-thumb-item.active img,.lg-thumbnail-grayscale .lg-thumb-item:not(.active) img{filter:grayscale(100%)}.lg-thumbnail-active-blur .lg-thumb-item.active img,.lg-thumbnail-blur .lg-thumb-item:not(.active) img{filter:blur(1px)}.lg-outer{background:none}.lcp-display-none{display:none}.gallery-item{position:relative}span.gallery-more{color:#fff;font-size:40px;left:50%;position:absolute;top:50%;transform:translate3d(-50%,-50%,0);z-index:10}.lcp-gallery.aspect-1-1 .lcp-gallery-item{aspect-ratio:1/1}.lcp-gallery.aspect-2-3 .lcp-gallery-item{aspect-ratio:2/3}.lcp-gallery.aspect-3-4 .lcp-gallery-item{aspect-ratio:3/4}.lcp-gallery.aspect-4-5 .lcp-gallery-item{aspect-ratio:4/5}.lcp-gallery.aspect-5-7 .lcp-gallery-item{aspect-ratio:5/7}.lcp-gallery.aspect-3-2 .lcp-gallery-item{aspect-ratio:3/2}.lcp-gallery.aspect-16-9 .lcp-gallery-item{aspect-ratio:16/9}.gallery-item img{-o-object-fit:cover;object-fit:cover}.lcp-gallery.grid{display:grid}.lcp-gallery.grid .gallery-item img{height:100%;-o-object-fit:cover;object-fit:cover}.lcp-gallery.grid{gap:1rem;grid-template-columns:1fr 1fr 1fr 1fr}@media only screen and (min-width:1167px){.lcp-gallery.grid.large-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.large-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.large-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.large-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.large-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}@media only screen and (min-width:768px)and (max-width:1166px){.lcp-gallery.grid.medium-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.medium-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.medium-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.medium-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.medium-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}@media only screen and (max-width:767px){.lcp-gallery.grid.small-1-columns{grid-template-columns:1fr}.lcp-gallery.grid.small-2-columns{grid-template-columns:1fr 1fr}.lcp-gallery.grid.small-3-columns{grid-template-columns:1fr 1fr 1fr}.lcp-gallery.grid.small-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-7-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-8-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}.lcp-gallery.grid.small-9-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr}}.lcp-gallery.grid>a>img{display:block;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}

View File

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

View File

@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",(()=>{"function"==typeof lightGallery?document.querySelectorAll(".lcp-gallery").forEach((l=>{const e=l.getAttribute("data-lgsettings"),t="init-on-load"===l.getAttribute("data-gallery-settings"),o=l.classList.contains("lcp-inline-gallery");if(e)try{const i=JSON.parse(e);console.log("LightGallery Settings:",i);const n={lgZoom,lgThumbnail,lgFullScreen:lgFullscreen,lgRotate,lgAutoplay,lgShare,lgComment,lgHash,lgPager,lgVideo,lgMediumZoom};Array.isArray(i.plugins)&&(i.plugins=i.plugins.map((l=>n[l]||l)));let a=null;(!l.classList.contains("lcp-inline-gallery")||t||o)&&(a=lightGallery(l,i),o&&(a.openGallery(0),l.classList.add("initialized"))),l.querySelectorAll(".lcp-gallery-item").forEach(((l,e)=>{l.addEventListener("click",(()=>{a&&"function"==typeof a.openGallery?a.openGallery(e):console.error("LightGallery instance is not initialized correctly or missing openGallery method.")}))}))}catch(l){console.error("Error parsing data-lgsettings JSON:",l)}else console.error("data-lgsettings attribute is missing for a gallery.")})):console.error("LightGallery is not defined")}));

View File

@ -0,0 +1,29 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/header-container",
"version": "0.1.0",
"title": "Header Container",
"category": "widgets",
"icon": "smiley",
"description": "Viewport container which is designed to be the parent of all other blocks",
"example": {},
"supports": {
"color": {
"background": true,
"text": false,
"link": false
}
},
"attributes": {
"sticky": {
"type": "string",
"default": "never"
}
},
"textdomain": "lcp-viewport",
"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-lcp-viewport{border:1px dotted red}

View File

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

View File

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

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,t={717:()=>{const e=window.wp.blocks,t=window.wp.i18n,n=window.wp.blockEditor,l=window.wp.components,o=window.React,r=window.ReactJSXRuntime,s=JSON.parse('{"UU":"lcp/header-container"}');(0,e.registerBlockType)(s.UU,{edit:function({attributes:e,setAttributes:s}){const[i,a]=(0,o.useState)(!1),[d,c]=(0,o.useState)("10px"),[p,h]=(0,o.useState)("10px"),[x,g]=(0,o.useState)("10px"),[u,v]=(0,o.useState)("10px"),{sticky:f}=e,j=(0,n.useBlockProps)();return(0,r.jsxs)("div",{...j,children:[(0,r.jsxs)(n.InspectorControls,{children:[(0,r.jsx)(l.SelectControl,{label:(0,t.__)("Sticky Behavior","lcp"),value:f,options:[{label:(0,t.__)("Never","lcp"),value:"never"},{label:(0,t.__)("On Scroll","lcp"),value:"onScroll"},{label:(0,t.__)("Always","lcp"),value:"always"}],onChange:e=>{s({sticky:e})}}),(0,r.jsxs)(l.BaseControl,{label:"Padding - Desktop",children:[(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[(0,r.jsx)("span",{style:{marginRight:"10px"},children:"Padding"}),(0,r.jsx)(l.ToggleControl,{label:"Use Independent Padding",checked:i,onChange:()=>{a(!i)}})]}),i?(0,r.jsxs)("div",{style:{display:"grid",padding:"10px",gridTemplateColumns:"1fr 1fr",gap:"10px",justifyItems:"center"},children:[(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Top"}),(0,r.jsx)(l.__experimentalUnitControl,{value:d,onChange:e=>{c(e),s({paddingTop:e})}})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Left"}),(0,r.jsx)(l.__experimentalUnitControl,{value:u,onChange:e=>{v(e),s({paddingLeft:e})}})]}),(0,r.jsxs)("fieldset",{children:[(0,r.jsx)("legend",{children:"Right"}),(0,r.jsx)(l.__experimentalUnitControl,{value:p,onChange:e=>{h(e),s({paddingRight:e})}})]}),(0,r.jsxs)("fieldset",{style:{gridColumn:"span 2",width:"116px"},children:[(0,r.jsx)("legend",{children:"Bottom"}),(0,r.jsx)(l.__experimentalUnitControl,{value:x,onChange:e=>{g(e),s({paddingBottom:e})}})]})]}):(0,r.jsx)(l.__experimentalUnitControl,{label:"Padding Value",value:999,onChange:e=>{s({padding:{extraLarge:{top:e,right:e,bottom:e,left:e},large:{top:e,right:e,bottom:e,left:e},medium:{top:e,right:e,bottom:e,left:e},small:{top:e,right:e,bottom:e,left:e}}})}})]})]}),(0,r.jsx)(n.InnerBlocks,{})]})},save:function({attributes:e}){const{sticky:t}=e,l=n.useBlockProps.save();let o="";"onScroll"===t?o="lcp-sticky-on-scroll":"always"===t&&(o="lcp-sticky");const s=`${l.className} ${o}`;return(0,r.jsx)("div",{...l,className:s,id:"lcp-header-container",children:(0,r.jsx)(n.InnerBlocks.Content,{})})}})}},n={};function l(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,l),r.exports}l.m=t,e=[],l.O=(t,n,o,r)=>{if(!n){var s=1/0;for(c=0;c<e.length;c++){n=e[c][0],o=e[c][1],r=e[c][2];for(var i=!0,a=0;a<n.length;a++)(!1&r||s>=r)&&Object.keys(l.O).every((e=>l.O[e](n[a])))?n.splice(a--,1):(i=!1,r<s&&(s=r));if(i){e.splice(c--,1);var d=o();void 0!==d&&(t=d)}}return t}r=r||0;for(var c=e.length;c>0&&e[c-1][2]>r;c--)e[c]=e[c-1];e[c]=[n,o,r]},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};l.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,s=n[0],i=n[1],a=n[2],d=0;if(s.some((t=>0!==e[t]))){for(o in i)l.o(i,o)&&(l.m[o]=i[o]);if(a)var c=a(l)}for(t&&t(n);d<s.length;d++)r=s[d],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(c)},n=self.webpackChunklcp_viewport=self.webpackChunklcp_viewport||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=l.O(void 0,[350],(()=>l(717)));o=l.O(o)})();

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-lcp-viewport block)");

View File

@ -142,9 +142,6 @@ export default function Edit({ attributes, setAttributes }) {
</BaseControl>
</InspectorControls>
<p>
{__('Lcp Main hello from the editor!', 'lcp')}
</p>
<InnerBlocks
// Optional: You can provide a template or allowed blocks

View File

@ -0,0 +1,41 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/key-points",
"version": "0.1.0",
"title": "Key Points",
"category": "widgets",
"icon": "smiley",
"description": "Key points meta field for single posts",
"example": {},
"supports": {
"html": false
},
"attributes": {
"heading": {
"type": "string",
"default": "Key Points"
},
"headingTag": {
"type": "string",
"default": "h3"
},
"headingFontSizeLarge": {
"type": "string",
"default": "24px"
},
"pointsFontSizeLarge": {
"type": "string",
"default": "16px"
},
"listStyleType": {
"type": "string",
"default": "disc"
}
},
"textdomain": "key-points",
"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-key-points{border:1px dotted red}

View File

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

View File

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

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,i={717:()=>{const e=window.wp.blocks,i=window.wp.i18n,t=window.wp.blockEditor,n=window.wp.components,l=window.React,o=window.ReactJSXRuntime,r=JSON.parse('{"UU":"lcp/key-points"}');(0,e.registerBlockType)(r.UU,{edit:function({attributes:e,setAttributes:r}){const{heading:a,pointsFontSizeLarge:s,headingFontSizeLarge:u,listStyleType:p}=e,c=[{name:(0,i.__)("Small","key-points"),slug:"small",size:"12px"},{name:(0,i.__)("Medium","key-points"),slug:"medium",size:"16px"},{name:(0,i.__)("Large","key-points"),slug:"large",size:"24px"},{name:(0,i.__)("Extra Large","key-points"),slug:"x-large",size:"36px"}],d=[{label:(0,i.__)("Disc","lcp"),value:"disc"},{label:(0,i.__)("Circle","lcp"),value:"circle"},{label:(0,i.__)("Square","lcp"),value:"square"},{label:(0,i.__)("None","lcp"),value:"none"}],[m,g]=(0,l.useState)(["Lorem ipsum dolor sit amet, consectetur adipiscing elit.","Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.","Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.","Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.","Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.InspectorControls,{children:[(0,o.jsx)(n.SelectControl,{label:(0,i.__)("List Style","lcp"),value:p,options:d,onChange:e=>{r({listStyleType:e})}}),(0,o.jsx)(n.TextControl,{label:(0,i.__)("Heading","lcp"),value:a||"",onChange:e=>r({heading:e})}),(0,o.jsx)(n.FontSizePicker,{fontSizes:c,units:["px","em","rem","vw","vh"],value:s,onChange:e=>{"string"==typeof e&&r({pointsFontSizeLarge:e})},fallbackFontSize:"16px"}),(0,o.jsx)(n.FontSizePicker,{fontSizes:c,units:["px","em","rem","vw","vh"],value:u,onChange:e=>{"string"==typeof e&&r({headingFontSizeLarge:e})},fallbackFontSize:"24px"})]}),(0,o.jsx)("p",{...(0,t.useBlockProps)(),children:(0,i.__)("Key Points hello from the editor!","lcp")}),a&&(0,o.jsx)("h2",{children:a}),m&&m.length>0&&(0,o.jsx)("ul",{style:{listStyleType:p},children:m.map(((e,i)=>(0,o.jsx)("li",{style:{fontSize:s},children:e},i)))})]})},save:function(){return null}})}},t={};function n(e){var l=t[e];if(void 0!==l)return l.exports;var o=t[e]={exports:{}};return i[e](o,o.exports,n),o.exports}n.m=i,e=[],n.O=(i,t,l,o)=>{if(!t){var r=1/0;for(p=0;p<e.length;p++){t=e[p][0],l=e[p][1],o=e[p][2];for(var a=!0,s=0;s<t.length;s++)(!1&o||r>=o)&&Object.keys(n.O).every((e=>n.O[e](t[s])))?t.splice(s--,1):(a=!1,o<r&&(r=o));if(a){e.splice(p--,1);var u=l();void 0!==u&&(i=u)}}return i}o=o||0;for(var p=e.length;p>0&&e[p-1][2]>o;p--)e[p]=e[p-1];e[p]=[t,l,o]},n.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var e={57:0,350:0};n.O.j=i=>0===e[i];var i=(i,t)=>{var l,o,r=t[0],a=t[1],s=t[2],u=0;if(r.some((i=>0!==e[i]))){for(l in a)n.o(a,l)&&(n.m[l]=a[l]);if(s)var p=s(n)}for(i&&i(t);u<r.length;u++)o=r[u],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(p)},t=self.webpackChunkkey_points=self.webpackChunkkey_points||[];t.forEach(i.bind(null,0)),t.push=i.bind(null,t.push.bind(t))})();var l=n.O(void 0,[350],(()=>n(717)));l=n.O(l)})();

View File

@ -0,0 +1 @@
.wp-block-create-block-key-points{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-key-points{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-key-points block)");

View File

@ -0,0 +1,25 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/main-area",
"version": "0.1.0",
"title": "Main Content",
"category": "widgets",
"icon": "smiley",
"description": "Viewport container which is designed to be the parent of all other blocks",
"example": {},
"supports": {
"html": false
},
"attributes": {
"maxWidth": {
"type": "string",
"default": "100%"
}
},
"textdomain": "lcp-viewport",
"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-lcp-viewport{border:1px dotted red}#lcp-main-wrap{margin-right:340px}

View File

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

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{border:1px dotted red}#lcp-main-wrap{margin-left:340px}

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,t={998:()=>{const e=window.wp.blocks,t=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.components,i=window.ReactJSXRuntime,o=JSON.parse('{"UU":"lcp/main-area"}');(0,e.registerBlockType)(o.UU,{edit:function(e){const{attributes:o,setAttributes:s}=e,{maxWidth:a="100%"}=o,l=(0,n.useBlockProps)(),c=(0,n.useInnerBlocksProps)(l);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.InspectorControls,{children:(0,i.jsx)(r.PanelBody,{title:(0,t.__)("Max Width Settings","lcp"),initialOpen:!0,children:(0,i.jsx)("div",{className:"max-width-settings",children:(0,i.jsx)(r.__experimentalUnitControl,{onChange:e=>{s({maxWidth:e})},value:a,defaultUnit:"px"})})})}),(0,i.jsx)("div",{...c,id:"lcp-main-wrap",children:(0,i.jsx)(n.InnerBlocks,{...c})})]})},save:function({attributes:e}){const{maxWidth:t="100%"}=e,r=n.useBlockProps.save(),o={maxWidth:t};return(0,i.jsx)("div",{...r,id:"lcp-main-wrap",style:o,children:(0,i.jsx)(n.InnerBlocks.Content,{})})}})}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,i,o)=>{if(!n){var s=1/0;for(p=0;p<e.length;p++){n=e[p][0],i=e[p][1],o=e[p][2];for(var a=!0,l=0;l<n.length;l++)(!1&o||s>=o)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(a=!1,o<s&&(s=o));if(a){e.splice(p--,1);var c=i();void 0!==c&&(t=c)}}return t}o=o||0;for(var p=e.length;p>0&&e[p-1][2]>o;p--)e[p]=e[p-1];e[p]=[n,i,o]},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var i,o,s=n[0],a=n[1],l=n[2],c=0;if(s.some((t=>0!==e[t]))){for(i in a)r.o(a,i)&&(r.m[i]=a[i]);if(l)var p=l(r)}for(t&&t(n);c<s.length;c++)o=s[c],r.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return r.O(p)},n=self.webpackChunklcp_viewport=self.webpackChunklcp_viewport||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var i=r.O(void 0,[350],(()=>r(998)));i=r.O(i)})();

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-viewport{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-lcp-viewport block)");

View File

@ -0,0 +1,22 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/sidecontent",
"version": "0.1.0",
"title": "Sidecontent",
"category": "widgets",
"icon": "smiley",
"description": "A separate content area to be nested inside the LCP viewport",
"example": {},
"supports": {
"color": {
"background": true,
"text": 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-lcp-sidecontent{border:1px dotted red}#lcp-sidecontent{background:#fff;border-left:2px solid #eee;height:100%;right:0;outline:0;overflow:scroll;position:absolute;top:var(--my-top);width:340px;z-index:2}

View File

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

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-sidecontent{border:1px dotted red}#lcp-sidecontent{background:#fff;border-right:2px solid #eee;height:100%;left:0;outline:0;overflow:scroll;position:absolute;top:var(--my-top);width:340px;z-index:2}

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,n={650:()=>{const e=window.wp.blocks,n=(window.wp.i18n,window.wp.blockEditor),r=window.ReactJSXRuntime,o=JSON.parse('{"UU":"lcp/sidecontent"}');(0,e.registerBlockType)(o.UU,{edit:function(){return(0,n.useBlockProps)(),(0,r.jsx)("div",{...n.useBlockProps,children:(0,r.jsx)("div",{id:"lcp-sidecontent",children:(0,r.jsx)(n.InnerBlocks,{renderAppender:()=>(0,r.jsx)(n.InnerBlocks.ButtonBlockAppender,{})})})})},save:function(){const e=n.useBlockProps.save();return(0,r.jsxs)("div",{...e,id:"lcp-sidecontent",children:[(0,r.jsx)("div",{id:"lcp-sidecontent-inner",children:(0,r.jsx)(n.InnerBlocks.Content,{})}),(0,r.jsx)("div",{id:"lcp-scroll-track",children:(0,r.jsx)("div",{id:"lcp-scroll-bar"})})]})}})}},r={};function o(e){var i=r[e];if(void 0!==i)return i.exports;var s=r[e]={exports:{}};return n[e](s,s.exports,o),s.exports}o.m=n,e=[],o.O=(n,r,i,s)=>{if(!r){var t=1/0;for(p=0;p<e.length;p++){r=e[p][0],i=e[p][1],s=e[p][2];for(var c=!0,l=0;l<r.length;l++)(!1&s||t>=s)&&Object.keys(o.O).every((e=>o.O[e](r[l])))?r.splice(l--,1):(c=!1,s<t&&(t=s));if(c){e.splice(p--,1);var d=i();void 0!==d&&(n=d)}}return n}s=s||0;for(var p=e.length;p>0&&e[p-1][2]>s;p--)e[p]=e[p-1];e[p]=[r,i,s]},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={57:0,350:0};o.O.j=n=>0===e[n];var n=(n,r)=>{var i,s,t=r[0],c=r[1],l=r[2],d=0;if(t.some((n=>0!==e[n]))){for(i in c)o.o(c,i)&&(o.m[i]=c[i]);if(l)var p=l(o)}for(n&&n(r);d<t.length;d++)s=t[d],o.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return o.O(p)},r=self.webpackChunklcp_sidecontent=self.webpackChunklcp_sidecontent||[];r.forEach(n.bind(null,0)),r.push=n.bind(null,r.push.bind(r))})();var i=o.O(void 0,[350],(()=>o(650)));i=o.O(i)})();

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-sidecontent{background-color:#21759b;color:#fff;padding:2px}

View File

@ -0,0 +1 @@
.wp-block-create-block-lcp-sidecontent{background-color:#21759b;color:#fff;padding:2px}

View File

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

View File

@ -0,0 +1,29 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lcp/viewport",
"version": "0.1.0",
"title": "Viewport",
"category": "widgets",
"icon": "smiley",
"description": "Viewport container which is designed to be the parent of all other blocks",
"example": {},
"supports": {
"color": {
"background": true,
"text": false,
"link": false
}
},
"attributes": {
"hasSidecontent": {
"type": "boolean",
"default": true
}
},
"textdomain": "lcp-viewport",
"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-lcp-viewport{border:1px dotted red}

View File

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

View File

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

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,n={998:()=>{const e=window.wp.blocks,n=window.wp.i18n,r=window.wp.blockEditor,t=window.wp.components,o=window.ReactJSXRuntime,i=JSON.parse('{"UU":"lcp/viewport"}');(0,e.registerBlockType)(i.UU,{edit:function({attributes:e,setAttributes:i}){const{hasSidecontent:s}=e,c=(0,r.useBlockProps)({className:s?"has-sidecontent":""}),l=[s&&["lcp/sidecontent"],["lcp/main-area"]].filter(Boolean);return(0,o.jsxs)("div",{...c,children:[(0,o.jsx)(r.InspectorControls,{children:(0,o.jsx)(t.ToggleControl,{label:(0,n.__)("Include Side Content","lcp-viewport"),checked:s,onChange:e=>i({hasSidecontent:e})})}),(0,o.jsx)("div",{id:"lcp-viewport-outer",children:(0,o.jsx)("div",{id:"lcp-viewport-inner",children:(0,o.jsx)(r.InnerBlocks,{template:l,renderAppender:()=>(0,o.jsx)(r.InnerBlocks.ButtonBlockAppender,{})})})})]})},save:function({attributes:e}){const{hasSidecontent:n}=e,t=(r.useBlockProps.save(),n?"has-sidecontent":"");return(0,o.jsx)("div",{class:t,id:"lcp-viewport-outer",children:(0,o.jsx)("div",{id:"lcp-viewport-inner",class:t,children:(0,o.jsx)(r.InnerBlocks.Content,{})})})}})}},r={};function t(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,t),i.exports}t.m=n,e=[],t.O=(n,r,o,i)=>{if(!r){var s=1/0;for(d=0;d<e.length;d++){r=e[d][0],o=e[d][1],i=e[d][2];for(var c=!0,l=0;l<r.length;l++)(!1&i||s>=i)&&Object.keys(t.O).every((e=>t.O[e](r[l])))?r.splice(l--,1):(c=!1,i<s&&(s=i));if(c){e.splice(d--,1);var p=o();void 0!==p&&(n=p)}}return n}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[r,o,i]},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={57:0,350:0};t.O.j=n=>0===e[n];var n=(n,r)=>{var o,i,s=r[0],c=r[1],l=r[2],p=0;if(s.some((n=>0!==e[n]))){for(o in c)t.o(c,o)&&(t.m[o]=c[o]);if(l)var d=l(t)}for(n&&n(r);p<s.length;p++)i=s[p],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(d)},r=self.webpackChunklcp_viewport=self.webpackChunklcp_viewport||[];r.forEach(n.bind(null,0)),r.push=n.bind(null,r.push.bind(r))})();var o=t.O(void 0,[350],(()=>t(998)));o=t.O(o)})();

View File

@ -0,0 +1 @@
#lcp-viewport-inner{display:block;position:relative;width:100%}

View File

@ -0,0 +1 @@
#lcp-viewport-inner{display:block;position:relative;width:100%}

View File

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

View File

@ -0,0 +1 @@
console.log("Hello World! (from create-block-lcp-viewport block)");

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)}))}))}));

View File

@ -14,15 +14,7 @@ function lcp_backend_pages() {
);
// Register the Custom Code settings page
add_menu_page(
'Custom Code Inserter', // Page title
'Code Inserter', // Menu title
'manage_options', // Capability required - admin only
'lcp-code-inserter', // Menu slug
'custom-code-inserter', // Callback function
'', // Icon
25
);
}
add_action( 'admin_menu', 'lcp_backend_pages' );
// Function to render the theme settings page
@ -169,44 +161,6 @@ function lcp_enable_highlight_to_share() {
// The callback function to display the custom code inserterpage content
function lcp_custom_code_inserter_page() {
// Get the stored options from wp_options
$custom_code = get_option( 'custom_code_options', array() );
?>
<div class="wrap">
<h1>Custom Code Settings</h1>
<form method="post" action="options.php">
<?php settings_fields( 'custom_code_group' );
if (defined('LCP_DISABLE_CODE_INSERTER') && LCP_DISABLE_CODE_INSERTER === true) {
echo "<h2 style=\"margin:10px 5px\"> LCP Custom Code Inserter is currently disabled. </h2>
<h3 style=\"margin:5px 5px\"> You can add and modify code snippets, but they will not be in effect. </h3> ";
}
?>
<table class="form-table">
<tr valign="top">
<th scope="row">CSS in Header</th>
<td><textarea name="custom_code_options[css_header]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['css_header'] ) ? $custom_code['css_header'] : '' ); ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row">JavaScript in Header</th>
<td><textarea name="custom_code_options[js_header]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['js_header'] ) ? $custom_code['js_header'] : '' ); ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row">JavaScript in Footer</th>
<td><textarea name="custom_code_options[js_footer]" rows="10" cols="50"><?php echo esc_textarea( isset( $custom_code['js_footer'] ) ? $custom_code['js_footer'] : '' ); ?></textarea></td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}
// Register a custom code setting in wp_options to store the custom code snippets
function lcp_custom_code_settings_init() {
@ -303,6 +257,7 @@ function render_lcp_theme_settings_page() {
// Output necessary settings fields for the 'Icons' tab
settings_fields('lcp_theme_settings_group');
do_settings_sections('lcp_theme_settings_page'); // This outputs all the fields defined by add_settings_field
mytheme_display_icon_sets();
?>
<?php submit_button(); ?>
@ -368,3 +323,9 @@ function lcp_wp_head_hooks(){
}
add_action('wp_head', 'lcp_wp_head_hooks');
/* ICONS */

View File

@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Function to handle the scroll event
function handleScroll() {
console.log ("hey");
const scrolled = window.scrollY || document.documentElement.scrollTop;
// Check if the page has scrolled past the height of the header
@ -110,65 +110,6 @@ const innerContent = document.getElementById("lcp-sidecontent-inner");
const scrollTrack = document.getElementById("lcp-scroll-track");
const scrollBar = document.getElementById("lcp-scroll-bar");
let isDragging = false;
let startY = 0;
let startScrollTop = 0;
// Update the custom scrollbar position based on the content's scroll position
function updateCustomScrollbar() {
const contentHeight = innerContent.scrollHeight;
const visibleHeight = innerContent.clientHeight;
const scrollTrackHeight = scrollTrack.clientHeight;
// Calculate the proportion of visible content to total content
const thumbHeight = (visibleHeight / contentHeight) * scrollTrackHeight;
scrollBar.style.height = `${thumbHeight}px`;
// Calculate the scroll ratio (position of the content relative to its height)
const scrollRatio = innerContent.scrollTop / (contentHeight - visibleHeight);
// Position the scrollbar thumb based on the scroll ratio
scrollBar.style.top = `${scrollRatio * (scrollTrackHeight - thumbHeight)}px`;
}
// Handle the mouse down event to begin dragging the scrollbar
scrollBar.addEventListener("mousedown", (e) => {
isDragging = true;
startY = e.clientY;
startScrollTop = innerContent.scrollTop;
document.body.style.userSelect = "none"; // Disable text selection while dragging
});
// Handle mouse movement to drag the scrollbar and simulate scrolling
document.addEventListener("mousemove", (e) => {
if (!isDragging) return;
const deltaY = e.clientY - startY;
const contentHeight = innerContent.scrollHeight;
const visibleHeight = innerContent.clientHeight;
const scrollTrackHeight = scrollTrack.clientHeight;
const thumbHeight = scrollBar.clientHeight;
const scrollableDistance = contentHeight - visibleHeight;
const thumbDistance = scrollTrackHeight - thumbHeight;
// Calculate new scroll position for content based on dragging
const newScrollTop = (deltaY / thumbDistance) * scrollableDistance + startScrollTop;
innerContent.scrollTop = newScrollTop;
updateCustomScrollbar();
});
// Handle mouse up event to stop dragging
document.addEventListener("mouseup", () => {
isDragging = false;
document.body.style.userSelect = ""; // Enable text selection again
});
// Handle scroll events on the content to update the custom scrollbar
innerContent.addEventListener("scroll", updateCustomScrollbar);
// Initialize the custom scrollbar position when the page loads
updateCustomScrollbar();