Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
db75d11
feature #220 [WIP][TwigComponent] add component attribute system/help…
weaverryan Jan 31, 2022
a27fdd3
[Live] Fixing bug where inputs would not re-render if the value changed
weaverryan Jan 28, 2022
0c6423c
feature #250 [Live] Fixing bug where inputs would not re-render if th…
weaverryan Feb 1, 2022
6906cc6
Rebuild js dist files
norkunas Feb 1, 2022
9f9cabc
minor #256 Rebuild js dist files (norkunas)
kbond Feb 1, 2022
952725c
Ensure JS dist files are current in CI
kbond Feb 1, 2022
2c599ca
minor #257 Ensure JS dist files are current in CI (kbond)
kbond Feb 1, 2022
c8b3a28
[Live] Re-extracting form data after submit
weaverryan Jan 28, 2022
6715a03
feature #254 [Live] Re-extracting form data after submit (weaverryan)
weaverryan Feb 2, 2022
6772737
Renaming Fixture -> Fixtures
weaverryan Feb 2, 2022
e3e2d84
Cache deps where possible
kbond Feb 1, 2022
96c4ba0
minor #258 Cache deps where possible (kbond)
weaverryan Feb 2, 2022
e2df324
minor #262 Renaming Fixture/ -> Fixtures/ (weaverryan)
weaverryan Feb 2, 2022
2b808ea
Send data back and forth as JSON
weaverryan Feb 2, 2022
bb5b7c7
feature #264 Send data back and forth as JSON (weaverryan)
weaverryan Feb 3, 2022
e18f3e6
fix build-packages.php in CI
kbond Feb 3, 2022
b12ca0e
minor #267 [Live] fix build-packages.php in CI (kbond)
kbond Feb 3, 2022
c1e484b
[Twig][Live] null attribute values render without value (ie autofocus)
kbond Feb 2, 2022
2d429b0
[Live] refactor AddLiveAttributesSubscriber
kbond Feb 3, 2022
ae73e5a
minor #268 [Live] refactor AddLiveAttributesSubscriber (kbond)
weaverryan Feb 3, 2022
9f50cbb
bug #261 [Twig][Live] null attribute values render without value (ie …
weaverryan Feb 4, 2022
37acff2
[Twig][Live] make attributes a "native" feature
kbond Jan 28, 2022
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
46 changes: 7 additions & 39 deletions .github/workflows/test-turbo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,9 @@ jobs:
php-version: '8.0'
extensions: zip

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
- uses: ramsey/composer-install@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
working-directory: src/Turbo
run: composer install --prefer-dist
working-directory: src/Turbo

- name: Install PHPUnit dependencies
working-directory: src/Turbo
Expand Down Expand Up @@ -71,20 +60,9 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: zip, pdo_sqlite

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache PHP dependencies
uses: actions/cache@v2
- uses: ramsey/composer-install@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install PHP dependencies
working-directory: src/Turbo
run: composer install --prefer-dist
working-directory: src/Turbo

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down Expand Up @@ -143,20 +121,10 @@ jobs:
php-version: '8.0'
extensions: zip, pdo_sqlite

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache PHP dependencies
uses: actions/cache@v2
- uses: ramsey/composer-install@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install PHP dependencies
working-directory: src/Turbo
run: composer update --prefer-dist --prefer-lowest --prefer-stable
working-directory: src/Turbo
dependency-versions: lowest

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
211 changes: 149 additions & 62 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,88 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn check-lint
- run: yarn check-format

js-dist-current:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn && yarn build
- name: Check if js dist files are current
id: changes
uses: UnicornGlobal/[email protected]

- name: Ensure no changes
if: steps.changes.outputs.changed == 1
run: |
echo "JS dist files need to be rebuilt"
exit 1

tests-php-low-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
- name: Chartjs
run: |
cd src/Chartjs
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: Cropperjs
run: |
cd src/Cropperjs
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: Dropzone
run: |
cd src/Dropzone
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: LazyImage
run: |
cd src/LazyImage
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit

- name: Chartjs Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Chartjs
dependency-versions: lowest
- name: Chartjs Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Chartjs

- name: Cropperjs Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Cropperjs
dependency-versions: lowest
- name: Cropperjs Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Cropperjs

- name: Dropzone Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Dropzone
dependency-versions: lowest
- name: Dropzone Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Dropzone

- name: LazyImage Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/LazyImage
dependency-versions: lowest
- name: LazyImage Tests
run: php vendor/bin/simple-phpunit
working-directory: src/LazyImage

tests-php8-low-deps:
runs-on: ubuntu-latest
Expand All @@ -57,17 +108,25 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: TwigComponent
run: |
cd src/TwigComponent
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: LiveComponent
run: |
cd src/LiveComponent
php ../../.github/build-packages.php
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- run: php .github/build-packages.php

- name: TwigComponent Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/TwigComponent
dependency-versions: lowest
- name: TwigComponent Tests
run: php vendor/bin/simple-phpunit
working-directory: src/TwigComponent

- name: LiveComponent Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/LiveComponent
dependency-versions: lowest
- name: LiveComponent Tests
working-directory: src/LiveComponent
run: php vendor/bin/simple-phpunit

tests-php-high-deps:
runs-on: ubuntu-latest
Expand All @@ -76,41 +135,69 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Chartjs
run: |
cd src/Chartjs
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: Cropperjs
run: |
cd src/Cropperjs
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: Dropzone
run: |
cd src/Dropzone
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: LazyImage
run: |
cd src/LazyImage
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: TwigComponent
run: |
cd src/TwigComponent
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- name: LiveComponent
run: |
cd src/LiveComponent
php ../../.github/build-packages.php
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
- run: php .github/build-packages.php

- name: Chartjs Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Chartjs
- name: Chartjs Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Chartjs

- name: Cropperjs Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Cropperjs
- name: Cropperjs Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Cropperjs

- name: Dropzone Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/Dropzone
- name: Dropzone Tests
run: php vendor/bin/simple-phpunit
working-directory: src/Dropzone

- name: LazyImage Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/LazyImage
- name: LazyImage Tests
run: php vendor/bin/simple-phpunit
working-directory: src/LazyImage

- name: TwigComponent Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/TwigComponent
- name: TwigComponent Tests
run: php vendor/bin/simple-phpunit
working-directory: src/TwigComponent

- name: LiveComponent Dependencies
uses: ramsey/composer-install@v2
with:
working-directory: src/LiveComponent
- name: LiveComponent Tests
working-directory: src/LiveComponent
run: php vendor/bin/simple-phpunit

tests-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn test
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
->append([__FILE__])
->notPath('#/Fixtures/#')
->notPath('#/app/var/#')
->notPath('#/var/cache/#')
->notPath('Turbo/Attribute/Broadcast.php') // Need https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702
)
;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off"
},
"env": {
"browser": true
Expand Down
2 changes: 1 addition & 1 deletion src/Dropzone/Resources/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class default_1 extends Controller {
});
reader.readAsDataURL(file);
}
_dispatchEvent(name, payload) {
_dispatchEvent(name, payload = {}) {
this.element.dispatchEvent(new CustomEvent(name, { detail: payload }));
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/LazyImage/Resources/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { Controller } from '@hotwired/stimulus';
class default_1 extends Controller {
connect() {
const hd = new Image();
const element = this.element;
const srcsetString = this._calculateSrcsetString();
hd.addEventListener('load', () => {
this.element.src = this.srcValue;
element.src = this.srcValue;
if (srcsetString) {
this.element.srcset = srcsetString;
element.srcset = srcsetString;
}
this._dispatchEvent('lazy-image:ready', { image: hd });
});
Expand Down
15 changes: 14 additions & 1 deletion src/LiveComponent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@

## 2.1.0

- Your component's live "data" is now send over Ajax as a JSON string.
Previously data was sent as pure query parameters or as pure POST data.
However, this made it impossible to keep certain data types, like
distinguishing between `null` and `''`. This has no impact on end-users.

- Added `data-live-ignore` attribute. If included in an element, that element
will not be updated on re-render.

- `ComponentWithFormTrait` no longer has a `setForm()` method. But there
is also no need to call it anymore. To pass an already-built form to
your component, pass it as a `form` var to `component()`. If you have
a custom `mount()`, you no longer need to call `setForm()` or anything else.

- The Live Component AJAX endpoints now return HTML in all situations
instead of JSON.

- Send live action arguments to backend
- Ability to send live action arguments to backend

- [BC BREAK] Remove `init_live_component()` twig function, use `{{ attributes }}` instead:
```diff
Expand Down
Loading