=== Formulix ===
Contributors: formulix
Tags: math, chemistry, equations, education, gutenberg
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.1.2
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Formulas, long-hand arithmetic, graphs and chemistry in the block editor, processed by the Formulix API.

== Description ==

Formulix adds a block to the block editor (Gutenberg) to insert and re-edit math formulas, long-hand arithmetic ("contas armadas": long division, multiplication with carries, subtraction with borrowing), function graphs and chemistry items. It is built for teachers, schools and educational publishers. 

* **Visual formulas:** fractions, roots, powers and matrices without knowing LaTeX (LaTeX is accepted too).
* **Arithmetic as it is taught:** long division, multiplication and subtraction laid out step by step, with aligned decimals.
* **Algebra:** 1st and 2nd degree equations, 2×2 systems, LCM/GCD, fractions, rule of three, tables and function studies.
* **Graphs:** up to five functions with roots, vertices and intersections, inserted as PNG and re-editable.
* **Chemistry:** equation balancing, molar mass, electron configuration, periodic table, lab glassware and carbon chains.

The interface supports Brazilian Portuguese, English, Spanish, French, German, Italian, Japanese, Simplified and Traditional Chinese and Hindi, and uses local notation (for example, decimal comma).

The plugin is free and GPL, with no trial period and no local features locked behind payment. Calculations, chemistry, graphs and insert conversions are performed by the external Formulix service, which works without an account: your site domain gets the free plan, and when it runs out you register the domain and choose a paid plan. There is a free plan and paid plans with monthly insert limits; the service does real processing and is not a license check.

Items are saved as static HTML. Formulas and tables stay in the post; graph and drawing PNGs go to the WordPress media library. Reading posts does not contact the API and does not load the editor scripts. Content stays readable if the plugin is removed.

Tested automatically on WordPress 6.8 and 7.1.3 with PHP 8.3. The classic editor is not supported.

== Installation ==

1. Install the plugin from Plugins > Add New, or upload the ZIP, and activate it.
2. Review the terms and privacy policy. Settings > Formulix comes with the official API URL `https://api.for-muli-x.com` filled in; no key is needed on the free plan.
3. When the free plan runs out, the dialog shows a link to sign up at https://painel.for-muli-x.com. Register your site domain there and choose a plan; the site keeps working without a key. An optional public key can be entered in Settings > Formulix.
4. In the block editor, insert a Formulix block and choose Formula, Arithmetic, Graph or Chemistry. To change an item later, use "Edit Formulix item".
5. PNG uploads require the upload_files capability. To stop new API requests, clear the URL in the settings.

== Frequently Asked Questions ==

= Do I need to pay for the plugin? =

No. The plugin is free. The remote processing depends on the API: Free allows 500 inserts per month, Starter 5,000, School 25,000 and Network has no monthly cap. On the free plan the limit also applies per domain. Starter costs R$49/month and School R$189/month; 12 months cost 10 monthly fees. Payment happens on the Formulix website through Mercado Pago. The plugin itself never processes payments or receives billing data.

= What counts as an insert? =

Each confirmed formula, arithmetic layout, graph or drawing counts as one insert. Live previews while typing do not count.

= When does data leave my site? =

Only while an editor uses the configured Formulix dialog. Previews may be generated before clicking Insert. See External services. Viewing a post sends nothing to the API.

= Do I need a key? =

No. Without a key, usage is counted by your site domain. Once the domain is registered in an account, it uses that account's plan.

= Is the key secret? =

No. The optional key is delivered to editors' browsers and only works from the domains registered in your account. Never put administrative tokens or passwords in that field.

= What happens on deactivation or deletion? =

Existing HTML and images are kept. Deactivating keeps the settings; deleting removes the formulix_servidor and formulix_chave options. On multisite, cleanup applies to the site where the uninstaller runs.

= Does it paste equations from Word? =

Not in this block yet. Word/MathType paste is available in the Formulix TinyMCE integration.

== Screenshots ==

1. The Formulix dialog with a visual formula and live preview.
2. Long division laid out step by step.
3. A function graph with roots and vertex.
4. Chemistry: balancing an equation.

== External services ==

This plugin relies on the Formulix API, operated by Kaio Spacini (https://for-muli-x.com, suporte@for-muli-x.com), to calculate arithmetic and expressions, solve chemistry operations, draw graphs and convert the confirmed item into HTML, MathML or SVG. When needed, the browser converts the SVG to PNG.

Endpoint: the URL in Settings > Formulix, https://api.for-muli-x.com by default (clear it to disable). There is no request on activation; requests happen only when an editor opens the Formulix dialog. The client code ships with the plugin; no code is downloaded from the API.

What is sent and when:

* POST /v1/calc: the operation, values and math/chemistry expressions typed, graph settings, language and notation, for automatic previews when panels open and while typing. Happens before the insert is confirmed and does not count against the plan.
* POST /v1/calc (op "word"): when pasting from Word into the dialog formula field, the clipboard HTML and RTF. Does not count against the plan.
* GET /v1/tabela?idioma=...: the language, when the periodic table opens. No post content is sent.
* POST /v1/inserir: item type and data (for example LaTeX, numbers, chemical equation or graph functions/points), language and notation, when an item is confirmed. This request is metered for the plan.
* When a key is configured, every request carries it in the X-Formulix-Chave header. As with any HTTP request, the operator receives the editor's IP address, the site origin and standard browser headers. Do not type personal data into the fields.

The plugin never sends the whole post, titles, user records, passwords or the media library to the API; only the data of the item being edited. PNGs are uploaded to the site's own authenticated /wp/v2/media endpoint (REST nonce and upload_files check), not to an external service.

Terms of use: https://for-muli-x.com/docs/termos.html
Privacy policy: https://for-muli-x.com/docs/privacidade.html

== Changelog ==

= 0.1.2 =
* Works without a key: the site domain uses the free plan, and the dialog links to sign-up when it runs out.
* Official API URL filled in by default.

= 0.1.1 =
* Stable release. Operator identified in the external services section.

= 0.1.0 =
* First release: formulas, arithmetic, graphs and chemistry with native media, static HTML and re-editing.
* Settings API page, interface translations, URL validation and option cleanup on uninstall.
* Dialog disabled without URL and key; upload capability checked on the client too.

== Upgrade Notice ==

= 0.1.2 =
The key is now optional.

= 0.1.1 =
Stable release.

= 0.1.0 =
Back up your posts before updating.

== Development ==

Sources and the build script ship in the plugin's source folder. Run npm install and npm run build there. The development repository is private; the shipped sources are complete for rebuilding the plugin.
