8000 zk/zkthemelab at master · zkoss/zk · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History

zkthemelab

README.md

zkthemelab — the Marble preview host

A WAR that serves the ZUL preview pages against the live zk / zkcml sources, so you can see what Marble actually renders. settings.gradle is a composite build that substitutes org.zkoss.zk:zul (and its siblings) with the :zul project in ../../zk, so the pages show your working tree, not a published jar.

Marble needs no registration here — it is zul's core theme. The IceBlue theme jar is also on the class path (for the iceblue Playwright project), so WEB-INF/zk.xml sets org.zkoss.theme.preferred=marble; a zktheme=iceblue cookie serves IceBlue instead. To confirm which theme is being served, read the reset stylesheet href in the served HTML: Marble carries no theme segment (/zkres/web/<v>/zul/css/reset.css) and precedes zk.wcs.

Start it

./start.sh            # http://127.0.0.1:8085
./start.sh 9090       # other port

The home page is index.zul — a link to every page below, generated from disk.

start.sh carries the three gotchas as comments (appRun not appStart; 127.0.0.1 not localhost; first start is slow and there is no live reload). Read them before working around a server that seems not to come up.

The ways to reach a page

Form URL Use it for
Index http://127.0.0.1:8085/ (or /index.zul) The home page: a flat link list of all pages, grouped by directory. Built by PageIndexVM, which scans /web per request, so a new page shows up without editing anything.
Direct http://127.0.0.1:8085/<page>.zul One component in isolation. The stable address — every Playwright spec uses this form. A filter forwards /<page>.zul to /web/<page>.zul.
Use-case SPA http://127.0.0.1:8085/usecase/index.zul#<bookmark> Browsing with the nav tree; deep-linking a screen. The bookmark is the target's path under the web root minus .zul — #button, #usecase/ops-dashboard, #utility/colors. Hash-based, so it survives redirects.
All-on-one-page http://127.0.0.1:8085/preview.zul Scanning every root-level page in one scroll. ZulListVM inlines all of them except coachmark.zul, which links out because it distorts the host page.

smoke.zul is kept as the second welcome file and as a link on the index: five widgets that prove the server and the theme came up, with nothing else to go wrong.

Pages, by unit

Use cases — whole screens

Realistic compositions, the pages to look at when judging whether Marble hangs together rather than whether one widget is correct. Under web/usecase/.

Page Nav label What it exercises
usecase/inventory-table.zul Inventory List Dense data grid, toolbar, paging
usecase/item-editor.zul Item Detail Form-heavy detail view
usecase/ticket-inbox.zul Support Ticket Inbox List/detail split, status chips
usecase/ops-dashboard.zul Operations Dashboard Tiles, meters, mixed density
usecase/onboarding-wizard.zul Onboarding Wizard Stepbar-driven multi-step flow
usecase/account-settings.zul Account Settings Tabbed settings, grouped inputs
usecase/sign-in.zul Sign-In Centred single-purpose card
usecase/brand-switcher.zul Brand Presets Seed-colour override at runtime (BrandSwitcherVM)

Components — one widget per page

Each page shows one component across its states and variants, named after the component (web/<component>.zul). Widget ids are prefixed pv- so specs can target them. The nav tree in usecase/index.zul groups them as Inputs, Data, Navigation, Containers, Layout, Feedback, and Media & Upload; list the pages with ls src/main/webapp/web/*.zul.

Nav labels mostly match the filename; the ones that do not: Link → a.zul, Drag & Drop → dnd.zul, and Error → runtime-error.zul.

Utility CSS — the token and utility-class catalogues

Not components. These render the design system itself, and are what you check after touching a token. Under web/utility/; list them with ls src/main/webapp/web/utility.

Reachable only by direct URL — not in the SPA nav

Page What it is
icons-lucide.zul All Lucide icons with their z-icon-<name> class names
overview.zul Older mixed-widget sampler, pre-dates the per-component pages
preview.zul The all-on-one-page index itself

Supporting files, not pages to review

  • web/pv/*.zul — the input snippets: the popup content each input page loads (bandbox-content.zul, combobox-content.zul, …) plus pv/matrix.zul. Opening one directly shows a snippet out of context; that is expected. index.zul groups them under "Input snippets".
  • web/img/, web/media/video.mp4, web/link-annotation.pdf — page assets.
  • src/main/java/zk/example/ — the models, composers and ViewModels the pages bind to (UseCaseVM drives the SPA's @Init restore, navigate command and handleBookmarkChange).
  • src/main/java/org/zkoss/zkthemelab/http/ — PreviewPathFilter (the /web forward) and ZKPreviewServlet.
  • src/main/webapp/index.zul + PageIndexVM — the home page link index. It lives at the webapp root next to smoke.zul, not under /web, so it is not itself one of the preview pages. PageIndexVM scans the filesystem rather than carrying a curated list, so it cannot drift.

Source of truth, and keeping this list honest

The tables above are a snapshot for orientation. Authoritative:

  • What pages exist — the filesystem: ls src/main/webapp/web/*.zul
  • What the nav offers — the <navitem> entries in src/main/webapp/web/usecase/index.zul

The root index.zul is the live, always-current answer to "what pages exist" — it reads the same filesystem. The shell below is for when the server is not running, or to spot pages that exist but have no nav entry:

cd src/main/webapp/web
comm -23 <(ls *.zul | sed 's/\.zul$//' | sort) <(grep -o "page='~\./[a-z0-9-]*\.zul" usecase/index.zul | sed "s|page='~\./||;s|\.zul||" | sort -u)   # pages with no nav entry

Not covered here

This file is the page inventory only. For everything else, read the marble-theme skill:

Question Read
How the Playwright suite is built, which spec a new test belongs in, which tests a change needs doc/test-matrix.html
Launch details, ports, Playwright projects, screenshot baselines .claude/skills/marble-theme/reference/verification.md
Rules for writing or fixing a preview page (utilities not page-local CSS, parse traps that look like 404s, hflex vs flex-direction) .claude/skills/marble-theme/reference/zul-authoring.md
Tokens, @layer, .css.dsp wiring, brand overrides the other files under .claude/skills/marble-theme/reference/

Playwright specs live in src/test/playwright/ and drive this app over the direct URL form; doc/focus-ring-known-clips.json is their tracked allow-list and doc/focus-ring-outline-selectors.json the focus-ring scan's selector list.

Verify Marble with one command

PREVIEW_URL=http://127.0.0.1:8085 node scripts/verify-playwright.mjs [--url <preview url>] [--out <dir>] [spec file ...]

--url overrides PREVIEW_URL.

scripts/verify-playwright.mjs runs the fixed verification and reports only what is new. Run 1 is chromium and compact with the screenshots compared; run 2 is every other project in playwright.config.ts except forced-colors-gallery, with --ignore-snapshots. Both use --update-snapshots=none, so nothing is written to doc/screenshots. The script has no -g, no --update-snapshots and no project option, and refuses to run while UPDATE_FONT_BASELINE, FOCUS_SCAN_UPDATE, POPUP_MAX_DIFF, POPUP_THRESHOLD or CSS_COVERAGE is set (they rewrite baselines, loosen the comparison or write files). The JSON reports and the Playwright output go to --out (default test-results/verify/; not inside doc or src). --report-only <dir> compares the run1.json and run2.json of an earlier run without running anything; it takes no --out. The script fails (exit 1) instead of reporting OK when Playwright dies, a run is interrupted (Ctrl-C), a run leaves no report or the report holds errors; it never reads an old report, and a run that ran 0 tests fails too.

With no arguments this is the full suite. Per "Which tests to run after a change" in .claude/skills/marble-theme/reference/verification.md, starting a full run is the Marble maintainer's call. When select-tests.mjs answers partial, run the command it prints (--project ... -g ...) directly; it carries --update-snapshots=none, so a missing screenshot baseline is not written. Do not go through this script. Spec file paths narrow both runs to those files; the script then prints that it is a PARTIAL run, first and last, because a partial run is not the full verification.

It prints the totals per run and then four lists: new failures (up to MAX_RERUNS (set at the top of the script) are rerun once, so a flaky test shows as PASSED on rerun), known failures that failed as expected, expected entries that passed, and intermittent entries that failed. The exit code is 0 only when there is no new failure.

src/test/playwright/known-failures.json holds the failures that are accepted. An entry is matched on project, file and the full title (describe titles and test title joined with ›, as npx playwright test --list prints them), and has a kind and a reason:

  • expected: always fails for the stated reason. When it passes, the script says so; delete the entry.
  • intermittent: fails now and then. A failure is listed but does not fail the run.

To add an entry, copy the project, file and title from the NEW failures line. Do it only for a failure the maintainer has accepted, and give the reason.

The scripts themselves are tested with npm run test:scripts (Node's built-in test runner, about 15 seconds, no preview server and no browser; the select-tests.mjs tests only list tests with playwright test --list).

0