vfunc.js

Examples

The 21 engine examples (layer 1) and the 7 component examples (layer 2) all run without a build, and each folder's README explains it. Every example follows the rules — CSP meta tag, external scripts, data-action / data-ref, vf.html, token-only CSS — and the repository's browser tests check for zero console errors or warnings and the main behaviour.

layer1/examplesWhat it shows
01-helloThe smallest vfunc.js page: one <script> tag and one component. esm.html shows the same component as an ES module.source
02-counterProduction: <script src="https://cdn.jsdelivr.net/npm/vfunc@1.2.0/dist/vfunc.min.js" integrity="sha384-yTR0o8US3nk+D1XIBAsv1O/lMFA5tV3V021xPo8yxyqnBNSxi1rqINVvBOykAEkK" crossorigin="anonymous"></script> · ESM: import vf from 'vfunc'source
03-todoA list with one delegated listener per event type for all rows, and escaping of user input.source
04-methods-refsProduction CDN and ESM lines: see [01 hello](../01-hello/README.md).source
05-compositionProduction CDN and ESM lines: see [01 hello](../01-hello/README.md).source
06-attach-published-html"Keep your HTML, control only what you need." The page is a publisher's static HTML. vfunc controls two areas and leaves everything else alone.source
07-formProduction CDN and ESM lines: see [01 hello](../01-hello/README.md).source
08-fetch-listProduction CDN and ESM lines: see [01 hello](../01-hello/README.md).source
09-spa-hash-routerWith npm: import vf from 'vfunc'. Script tag: see [01 hello](../01-hello/README.md).source
10-spa-appindex.html <div id="app"> + <script type="module" src="app.js">source
11-css-tokens-themesource
12-with-bootstrapExisting Bootstrap markup keeps its classes; vfunc only adds behaviour.source
13-with-tailwindsource
14-before-after-conversionThe AI prompt kit in action: layer1/ai/en/prompt-html-to-vfunc.md (Korean: ko/) applied to a publisher's dashboard.source
15-with-chartjsAny library can live inside a vfunc component with four pieces.source
16-legacy-ieThe same engine as everywhere else, from dist/vfunc.legacy.min.js (ES5 + a Promise polyfill).source
17-i18nsource
18-extend-pluginExtend vfunc without editing it (plan section I, EXTENDING.md).source
19-design-applyOne app, three skins, no JS change (plan section K).source
20-merge-publishedA common case in agency projects: the screen already works, then the publisher's HTML arrives (plan K-4 ⑤). Keep the logic, replace only the render markup, and put the existing hooks back.source
21-cache-updateWeb views, kiosks, installed PWAs and in-app browsers never reload by themselves. Four layers solve it (plan section O, D-013).source
layer2/examplesWhat it shows
custom-componentA cart made of the app's own vsPriceTag (vsBadge + vf.fmt) and vfCartLine (vfNumberInput + vsPriceTag), with a brand color and rounder buttons from CSS only.source
dashboardKey figures, an order grid and a sales chart; one switch swaps the built-in grid and chart for the Tabulator and Chart.js adapters.source
galleryEvery layer 2 component on one page, in English and Korean: the static vs markup, the vf instances and their keyboard behavior.source
landingA marketing page in plain HTML and CSS, with components only where they add something: cards, figures, a carousel, an FAQ accordion and a sign-up form.source
legacy-ieA branch report in ES5 on vfunc-all.legacy.min.js: stat cards, vfGrid with a vfModal on row click, a vfChart, English and Korean.source
settings-formvs fields in one form component, validation with the error prop, vfConfirm before a reset, vfToast after saving, in English and Korean.source
third-party-customThe same Leaflet map as L0 (direct use in one component), L1 (an app wrapper) and L2 (a contract adapter made from the template).source

To run them yourself, clone the repository, run python -m http.server 8080 at its root and open http://localhost:8080/layer1/examples/ and http://localhost:8080/layer2/examples/.