survos/mobile-bundle

Bundle with utilities for creating a Symfony-based mobile app

Fund package maintenance!
kbond

Installs: 179

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.5.394 2024-11-21 23:47 UTC

This package is auto-updated.

Last update: 2024-11-21 23:47:34 UTC


README

A collection of tools to help create Symfony-based mobile apps.

  • OnsenUI
  • pwa-bundle
  • Dexie

Work in Progress. See survos-sites/pokemon to see this in action.

Notes

These need to be cleaned up, but they're useful to me during development.

Twig

The application can be run as an SPA. The initial page must extend the base page

{% extends "@SurvosMobile/base.html.twig" %}

create app_controller and extend it from

If using the OnsenUI documentation, replace

onclick="loadPage('whatever')"

with

  {{ stimulus_action(_app_sc, 'loadPage', 'click', {
      route: 'whatever'
  }) }}

_app_sc should be set to 'app', someday this may change (hotwired/stimulus#641)

Stimulus Helpers

https://github.com/symfony/ux/blob/2.x/src/StimulusBundle/src/Dto/StimulusAttributes.php

tests: https://github.com/symfony/ux/blob/2.x/src/StimulusBundle/tests/Twig/StimulusTwigExtensionTest.php

I need a create and publish an es6 package that exports 3 functions produce the exact same result as their PHP counterpart.

For example,

import {stimulus_controller, stimulus_target, stimulus_action} from 'stimulus-twig';

let str = stimulus_controller('my-controller',  {myValue: 'scalar-value'});
console.assert(str == 'data-controller="my-controller" data-my-controller-my-value-value="scalar-value"');

All of the tests can be found (in PHP) at https://github.com/symfony/ux/blob/2.x/src/StimulusBundle/tests/Twig/StimulusTwigExtensionTest.php The PHP code is at https://github.com/symfony/ux/blob/2.x/src/StimulusBundle/src/Dto/StimulusAttributes.php The methods should be able to return an array and a string, exactly as the PHP code does. Fortunately, the PHP code is very well written

This job consists of the following:

  • Convert the PHP unit tests to javascript, using Jest or another testing packing.
  • Convert the PHP code to an es6 class that exports the 3 methods and passes the tests
  • Push the code to a github repo
  • Publish the package to npmjs, and make sure it works with package bundlers like jsdelivr and unpkg

Please point to a package on npmjs that you've written