Migration 0.20 to 0.22
What changes for an application when it moves from @ziyarago/ui 0.20.x to 0.22.1 (and @ziyarago/ui-pro to the same version). The public API of the components did not change: no prop was renamed. The changes are in how modules are bundled and registered, what the server HTML contains and a few behaviours. Exact wording of every release is in the Changelog.
What changed
Every component is a separate definition with its own dependencies and strings; the Vue and React adapters wrap a component only when it is imported. A Vue app with only UiButton dropped from 32 KB to 4.7 KB gzip. Named imports (import { UiButton } from "@ziyarago/ui/vue") get the full benefit. app.use(ui) still registers every core component and so keeps all of them in the bundle.
package.json now lists as side-effectful only the CSS files, src/i18n/index.js and src/i18n/components/index.js. Everything else can be dropped by the bundler when unused. Do not override sideEffects for @ziyarago/ui in your bundler config, and do not deep-import files from src/ for their side effects.
New defineUiComponent(name, def) in the Vue and React adapters wraps ONE definition and registers it; defineUiComponents(defs) still works. @ziyarago/ui/internal exports every built-in <Name>Def (and pageDefinition), so a package declares deps: () => ({ Button: ButtonDef }). @ziyarago/ui/internal is semi-internal and can change in a minor release.
In @ziyarago/ui-pro 0.22 each export is /*#__PURE__*/ defineUiComponent(...). Importing the package registers nothing by itself. app.use(ui) sees the core components plus only the Pro components that are imported in the bundle. A Pro tag that was never imported is not registered. The Nuxt module and the Vite resolver generate the import per tag, so they are not affected.
The Pro tarball has the same version as the core and its peer range for @ziyarago/ui starts at the exact core version it was built against and ends before the next minor (for 0.22.1: >=0.22.1 <0.23.0). Update both packages together. Pro sideEffects shrank to the CSS files and languages/index.js.
Server HTML of core and Pro components carries classes and data-zg-p attributes instead of style="...". The rules live in csp.css and csp-pro.css, which are part of @ziyarago/ui/style.css, so the stylesheet must be loaded. Percentages are rounded in data-zg-p for the server HTML and set exactly after mount. Values outside the finite sets (for example gap="1.5rem") and a style prop you pass yourself are still inline. See the CSP checklist in Integration.
The font files were removed from the package for licence reasons. In RTL the Arabic stack falls back to a system font until you self-host Thmanyah; @ziyarago/ui/thmanyah.css gives ready @font-face rules for /fonts/thmanyah/. See Fonts.
Documented callbacks without arguments (Modal, Drawer, Alert, Snackbar, Chip, Tag, ConfirmDialog and more) are called without the DOM event. If your handler read the first argument, it is undefined now.
About 100 icons the components use are built in and need no request. Other icon names are still fetched from unpkg: self-host with setIconBase or register with registerIcons. Small font subsets are emitted as files, not data: URIs.
Select, Combobox, MultiSelect, DatePicker, Dropdown, Menu, ContextMenu, Popover, Popconfirm and Pro GroupedSelect, TreeSelect, NotificationBell render in document.body with position: fixed. In tests query the list by role=listbox or aria-controls, not inside the component root.
Visual fixes for chat height, ImageUpload text, Kanban badges and AuthShowcase contrast. Pro 0.22.1 also fixes the visible name of TreeSelect and GroupedSelect when the selected label is null.
Checklist
- Update @ziyarago/ui to 0.22.1 and, if you use Pro, install the Pro tarball of the same version. Do not mix minors.
- Replace import ui from "@ziyarago/ui/vue" + app.use(ui) with named imports where bundle size matters, or keep it and accept the full core.
- Make sure every Pro component you use in a template is imported (named import, Nuxt module plugins: ["@ziyarago/ui-pro"], or ZiyaragoUiResolver({ plugins: ["@ziyarago/ui-pro"] })).
- Keep import "@ziyarago/ui/style.css" in the entry file; the CSP classes of core and Pro components come from it. Import @ziyarago/ui-pro/style.css after it if you did before.
- If you have a bundler rule or package.json that overrides sideEffects for @ziyarago/ui or @ziyarago/ui-pro, remove it.
- Search your code for handlers of Modal, Drawer, Alert, Snackbar, Chip, Tag and ConfirmDialog that read an event argument.
- RTL apps: self-host Thmanyah and import @ziyarago/ui/thmanyah.css, or accept the system Arabic font.
- Strict CSP: re-run the app under your policy, check the server HTML for style attributes, and self-host icons (setIconBase) or register them.
- Tests that look for popup content inside the component root must query the document (role=listbox, aria-controls).
- Pro languages: import "@ziyarago/ui-pro/languages" once before mount if you use uz, tg, tr, fr, fa, hi, ur, bn, id, kk, ky, ms or ha.
- Build the production bundle and compare its size with the previous one.
Common errors
Symptom: Vue warns "Failed to resolve component: UiLineChart" (any Pro tag) with app.use(ui)
Cause: The Pro component is not imported anywhere, so it is not registered.
Fix: Import it (import { UiLineChart } from "@ziyarago/ui-pro/vue"), or use the Nuxt module / Vite resolver with plugins: ["@ziyarago/ui-pro"].
Symptom: Error: @ziyarago/ui: component "X" is already registered (pass { override: true } to replace it)
Cause: A definition with this name is already in the registry: a built-in one, or a different definition registered earlier.
Fix: Rename your component, or pass { override: true } to defineUiComponents when replacing it on purpose. Registering the very same definition twice is fine.
Symptom: Import error about defineUiComponent (or @ziyarago/ui/internal) when Pro loads
Cause: Pro 0.22 runs against a core older than 0.22.0.
Fix: Update @ziyarago/ui to the same version as the Pro tarball.
Symptom: npm reports a peer dependency conflict for @ziyarago/ui when installing the Pro tarball
Cause: The peer range covers one minor: from the version the tarball was built against up to the next minor.
Fix: Install the core and Pro of the same 0.x line, for example 0.22.1 and 0.22.1.
Symptom: The bundle is still large
Cause: app.use(ui) or a default import pulls the whole core; the 13-language pack is a side-effect import.
Fix: Import components by name; import @ziyarago/ui-pro/languages only if you need those languages.
Symptom: Nuxt warns "plugin @ziyarago/ui-pro: cannot load @ziyarago/ui-pro/names"
Cause: Pro is not installed in the project that runs Nuxt (for example in CI without access to the package).
Fix: Install the tarball in that environment, or remove the plugin from ziyarago.plugins there.
Symptom: CSP violation or an unstyled block in server HTML
Cause: The stylesheet is not loaded, or the value is outside the finite sets and rendered as a style attribute.
Fix: Load @ziyarago/ui/style.css; use values from the sets (sizes xs..xl, gap 0..48, columns 1..12) or add style-src-attr 'unsafe-inline'.
Symptom: Arabic text looks different from before
Cause: The Thmanyah files are not shipped any more.
Fix: Self-host the font and import @ziyarago/ui/thmanyah.css, see Fonts.
Symptom: A handler gets undefined instead of an event
Cause: Callbacks documented without arguments are called without the DOM event since 0.20.7.
Fix: Do not read the argument; use your own @click on a wrapper if you need the event.
Symptom: A test cannot find the options of a Select or the items of a Menu
Cause: Popups render in document.body.
Fix: Query the document by role=listbox or aria-controls.
See also: Pro, Integration, Fonts, Localization, Changelog.