SuperAPI AI Directory

mol

Frontend & websites

View repository

Updated 10-15 20:05

About this skill

$mol / MAM

Load from references/ only what the task needs.

File When
STYLE.md Before any code. Always.
VIEW_TREE.md Tree syntax, bindings, reactivity, pitfalls
TROUBLESHOOTING.md The screen is blank or wrong, no errors
COMPONENTS.md Before writing your own component, how to read the sources mol/
TESTS.md When you write or fix tests
GIPER_BAZA.md Data, permissions, sync
TAURI_SETUP.md Desktop and mobile
MOL_CHAT_AUTOSCROLL.md Only autoscroll to new elements
MOL_POSITIONING.md Only comparing $mol with React/Vue/shadcn

Work order

  1. Clarify the module, whether Giper Baza and Tauri are needed. If the request is vague, suggest 2–3 concrete options.

  2. Find something ready-made. В mol/ 246 modules, in bog/ a couple dozen more. Before your own component:

    ls mol | grep -i <слово>
    grep -rl '<свойство>' mol/*/*.view.tree bog/*/*/*.view.tree
    

    In $mol, any property of any nested component is overridden by a line in view.tree. No need to fork and copy.

  3. Extract the common part. A repeated piece of the tree = a separate component in its own folder next to app/, not inside. A subfolder inside app/ drags the whole application to whoever borrows it.

  4. Write according to STYLE.md: snake_case, no comments, tree instead of TS, styles only for deviations.

  5. Write tests together with the feature: a user scenario through methods of the form, see TESTS.md.

  6. Don't start the build unless asked. The dev server is usually already running by a human: curl -s localhost:9080/<модуль>/-/web.audit.js will rebuild the module and return an audit, fix everything. No response on 9080 — ask the human to run npm start on their side. Start it yourself only if there's no human around, and only like this, in the background:

    sleep 100000 | npx mam
    

    Without an open stdin, the server prints Started and silently exits with code 0.

  7. Commit yourself: $bog_myapp_part: что изменилось, see STYLE.md.

Module files

bog/myapp/app/
  index.html
  app.view.tree      разметка и биндинги
  app.view.ts        логика, только если дерева не хватило
  app.view.css.ts    стили, только отклонения от темы
  app.view.css       raw CSS: @keyframes, content, значения css-переменных
  app.test.ts        тесты
  app.meta.tree      мета, если нужна

index.html:

<!doctype html>
<html mol_view_root>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
	</head>
	<body mol_view_root>
		<div mol_view_root="$bog_myapp_app"></div>
		<script src="web.js"></script>
	</body>
</html>

Class name = path: $bog_myapp_app lives in bog/myapp/app/. An underscore is always a folder, so folder names without _. A short globally unique name works everywhere: in code, in a CSS attribute, in a commit.

New project

npm create view-tree-lsp@latest bog/myapp -- --no-docker --no-tauri

Flags --no-docker, --no-baza, --no-tauri. Always suggest this instead of creating files manually.

Localization

@ \Текст in the tree goes into <модуль>/-view.tree/*.locale=en.json. Translations are placed alongside: <модуль>/<имя>.locale=<lang>.json, key = full property name. Split one file for the whole application by modules:

npx view-tree-lsp locale bog/myapp/app/- --exclude=mol --update

--include/--exclude by a path fragment, --update appends, --dry shows the plan. It is more convenient for the translator $yuf_localizer.

NPM packages

require('pkg') inside the method, MAM will install it itself. The whole package is bundled. For heavy $mol_import.script(url) / $mol_import.module(url). Manual package.json in the module is merged with the automatic one.

SEO

An SPA without prerendering is indexed as empty. After mam_build, before deployment:

- uses: b-on-g/mol-prerender-action@main
  with:
    base-url: "https://example.github.io/app/"
    screens: |
      campaign
      shop

Generates HTML per screen, sitemap.xml, robots.txt. route-format: #! or ?.

Tauri в CI

- uses: b-on-g/tauri-mol-workflow-template@master
  with:
    module: "bog/myapp/app"
    platform: desktop

Or a reusable workflow tauri_reusable.yml@master с mam_module_path. The rest is in TAURI_SETUP.md.

Response to the user

Minimal working edits in the target module, exact paths and commands. Example = a couple of view.tree + view.ts.

For the question "how", the order is: first the $mol concept in your own words (this is hint, this is a property, this is an override), then a link to the smalljs page https://b-on-g.github.io/smalljs/#!section=docs/page=<slug>, then the code. Pages: mental-model, troubleshooting, testing, data, views, state, rosetta, cookbook. The table of contents of the entire doc with annotations is in https://b-on-g.github.io/smalljs/llms.txt, read it when you don't know which page to link to.

If they ask about a property of someone else's component, show how you found it: the path to .view.tree and a line from it, not just the answer. The search order is in COMPONENTS.md, section "How to read the sources".