Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SVG-based Stretchy Type block #32

Draft
wants to merge 27 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
19562c1
Initial commit.
jffng Jun 10, 2024
2c67694
Wire up editable text.
jffng Jun 10, 2024
d5581bc
Working demo.
jffng Jun 12, 2024
6444a93
Implement better stretching function.
jffng Jun 26, 2024
c274e34
Use iAPI instead on front-end.
jffng Jun 26, 2024
39c604b
Rename inView callback.
jffng Jun 26, 2024
d912eac
Disable line breaks.
jffng Jun 26, 2024
11e3f0c
Fix width computing bug.
jffng Jun 27, 2024
12fa29d
Add color support and remove console statement.
jffng Jun 27, 2024
e8fd5f1
Account for font weight, text deco, and letter case
jffng Jun 27, 2024
a797bc0
Remove iAPI as it is overkill and causes a FOUC.
jffng Jun 27, 2024
c31e73d
Remove unneeded styles and lower specificity.
jffng Jun 27, 2024
28ef92e
Fix width calc bug again.
jffng Jun 27, 2024
0bb63b2
Adjust font size on blockprops!
jffng Jun 28, 2024
4f9b8cd
Implement auto-updater.
jffng Jul 1, 2024
114a536
Use SVG and ResizeObserver
DAreRodz Oct 24, 2024
b4d4605
Rename dimensions attr to viewBox
DAreRodz Oct 24, 2024
fc2474f
Fix style format
DAreRodz Oct 25, 2024
8bcdf1e
Run lint:js --fix
DAreRodz Oct 25, 2024
4c027f7
Run lint:css --fix
DAreRodz Oct 25, 2024
fefcc3f
Fix lint:js errors
DAreRodz Oct 25, 2024
2da4881
Remove extra utils
SantosGuillamot Oct 25, 2024
3c2b29b
Remove duplicated style
SantosGuillamot Oct 25, 2024
5e230cd
Inherit supports from paragraph
SantosGuillamot Oct 25, 2024
71cbd20
Add transforms
SantosGuillamot Oct 25, 2024
02e398a
Delete build files
DAreRodz Oct 25, 2024
0ea1c2c
Add condition
DAreRodz Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions stretchy-type/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{yml,yaml}]
indent_style = space
indent_size = 2
30 changes: 30 additions & 0 deletions stretchy-type/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of `npm pack`
*.tgz

# Output of `wp-scripts plugin-zip`
*.zip

# dotenv environment variables file
.env
80 changes: 80 additions & 0 deletions stretchy-type/classes/class-wpsp-blocks-self-update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/**
* Plugin Autoupdate Filter Self Update class.
* sets up autoupdates for this GitHub-hosted plugin.
*
* @package wpsp
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

class WPSP_Blocks_Self_Update {

public static $instance;

/**
* Get instance of this class.
*
* @return WPSP_Blocks_Self_Update
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}

return self::$instance;
}

/**
* Initialize WordPress hooks
*/
public function hooks() {
add_filter( 'update_plugins_opsoasis-develop.mystagingwebsite.com', array( $this, 'self_update' ), 10, 3 );
}

/**
* Check for updates to this plugin
*
* @param array $update Array of update data.
* @param array $plugin_data Array of plugin data.
* @param string $plugin_file Path to plugin file.
*
* @return array|bool Array of update data or false if no update available.
*/
public function self_update( $update, array $plugin_data, string $plugin_file ) {
// Already completed update check elsewhere.
if ( ! empty( $update ) ) {
return $update;
}

$plugin_filename_parts = explode( '/', $plugin_file );

// Ask opsoasis.mystagingwebsite.com if there's an update.
$response = wp_remote_get(
'https://opsoasis-develop.mystagingwebsite.com/wp-json/opsoasis-blocks-version-manager/v1/update-check',
array(
'body' => array(
'plugin' => $plugin_filename_parts[0],
'version' => $plugin_data['Version'],
),
)
);

// Bail if this plugin wasn't found on opsoasis.mystagingwebsite.com.
if ( 404 === wp_remote_retrieve_response_code( $response ) || 202 === wp_remote_retrieve_response_code( $response ) ) {
return $update;
}

$updated_version = wp_remote_retrieve_body( $response );
$updated_array = json_decode( $updated_version, true );

return array(
'slug' => $updated_array['slug'],
'version' => $updated_array['version'],
'url' => $updated_array['package_url'],
'package' => $updated_array['package_url'],
);
}
}
Loading