@wbc-ui/core2 1.0.0-r01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wissem Boughamoura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,400 @@
1
+ <p align="center">
2
+ <img src="logo/wb-core.svg" alt="@wbc-ui/core2" width="220"/>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>UI as Data. Vue 2. Unlimited.</strong><br/>
7
+ <em>Define components as JSON. Let the engine render. Ship complex UIs in minutes, not weeks.</em>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/@wbc-ui/core2"><img src="https://img.shields.io/npm/v/@wbc-ui/core2?color=1976D2" alt="npm"></a>
12
+ <a href="https://www.npmjs.com/package/@wbc-ui/core2"><img src="https://img.shields.io/npm/dm/@wbc-ui/core2?color=1976D2" alt="downloads"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/@wbc-ui/core2?color=blue" alt="license"></a>
14
+ <a href="https://vuejs.org"><img src="https://img.shields.io/badge/vue-2.7%2B-42b883" alt="vue"></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://flow.wbc-ui.com">📘 Docs</a> ·
19
+ <a href="https://github.com/wbc-ui/core2">🐙 GitHub</a> ·
20
+ <a href="https://flow.wbc-ui.com/playground">▶️ Playground</a> ·
21
+ <a href="https://wbc-ui.com">💎 Pro</a>
22
+ </p>
23
+
24
+ <p align="center">
25
+ <img src="docs/media/hero-input-output.svg"
26
+ alt="@wbc-ui/core2 — write &lt;WBC :item='...'&gt;, render real Material UI"
27
+ width="780"/>
28
+ </p>
29
+
30
+ ---
31
+
32
+ ## Why?
33
+
34
+ **@wbc-ui/core2** replaces the entire HTML/CSS/JS template stack with a single `<WBC>` tag driven by data.
35
+
36
+ ### Write 10× less code
37
+
38
+ ```javascript
39
+ // Before: 80 lines of <template>, <script>, methods, computed, v-if, v-for
40
+ // After: one line. One component.
41
+ <WBC :item="dynamicUIConfig" />
42
+ ```
43
+
44
+ The engine understands **files**, **URLs**, **Markdown**, **code**, and **rich media** natively — no wrapper components, no special handling. Pipe `|` syntax gives you styling, linking, and type-override in a single string.
45
+
46
+ ### Markdown becomes interactive
47
+
48
+ ```html
49
+ <WBC :item="'./landing.md'" />
50
+ <!-- Renders a full markdown page with TOC, syntax-highlighted code blocks,
51
+ anchor links, and copy buttons. The markdown IS the UI. -->
52
+ ```
53
+
54
+ ### Files and URLs as first-class citizens
55
+
56
+ ```javascript
57
+ <WBC :item="'./chart-data.json'" /> // JSON → rendered
58
+ <WBC :item="'./hero.png|rounded elevation-4'" /> // image with Vuetify classes
59
+ <WBC :item="'./code-sample.py'" /> // Python → syntax-colored block
60
+ <WBC :item="'https://api.example.com/data'" /> // fetch → parse → render
61
+ <WBC :item="'./slides.pdf'" /> // PDF viewer
62
+ <WBC :item="'https://youtu.be/dQw4w9WgXcQ'" />// YouTube embed
63
+ ```
64
+
65
+ ### Replace HTML · CSS · JS with JSON
66
+
67
+ ```javascript
68
+ // No <div>. No class="" strings. No event handlers in templates.
69
+ // Everything is an object. Everything is reactive.
70
+ {
71
+ comp: 'VCard',
72
+ options: {
73
+ html: (ctx) => ctx.data.intro, // dynamic HTML
74
+ class: (ctx) => ctx.dark ? 'dark-card' : null, // conditional CSS
75
+ on: { click: (ctx) => ctx.toggle('expanded') }, // reactive events
76
+ props: { elevation: 4 }
77
+ },
78
+ items: [
79
+ './logo.png|ma-auto', // file with Vuetify classes
80
+ { comp: 'VBtn', options: { html: '[[ CTA ]]' } } // WBHtml markup inside
81
+ ]
82
+ }
83
+ ```
84
+
85
+ > **One language. One component. One `<WBC>` tag.** No template files. No CSS files. No `<style scoped>`. Everything is data.
86
+
87
+ ---
88
+
89
+ ## What is @wbc-ui/core2?
90
+
91
+ A **Vue 2.7+ plugin** that implements the **"UI as Data"** paradigm. You feed it a JSON object — it recursively builds a live, reactive Vuetify/Bootstrap UI.
92
+
93
+ | Component | Role |
94
+ |---|---|
95
+ | `<WBC :item="...">` | Polymorphic rendering engine — dispatches to 6 renderers based on item type |
96
+ | `renderString` | Inline strings with pipe `|` syntax: `"text|class|link|parsedAs"` |
97
+ | `renderObject` | Component descriptors: `{ comp: 'VBtn', options: { ... } }` |
98
+ | `renderArray` | Lists/grids with inheritance, disposition, and virtual scrolling |
99
+ | `renderFile` | Images, videos, PDFs, code files |
100
+ | `renderFunction` | Lazy-evaluated render functions |
101
+ | `renderPrimitive` | Numbers, booleans, dates |
102
+
103
+ **Who's it for?** Solutions architects, full-stack devs, low-code platform builders — anyone who needs to ship complex, data-driven UIs without drowning in templates.
104
+
105
+ ---
106
+
107
+ ## Teasing Examples
108
+
109
+ ### Level 1 — Hello World
110
+ ```html
111
+ <WBC :item="'Welcome to @wbc-ui/core2|text-h3 primary--text'" />
112
+ ```
113
+ → Renders `<h3 class="primary--text">Welcome to @wbc-ui/core2</h3>`. The pipe `|` separates content from styling — ½ second of typing.
114
+
115
+
116
+ ### Level 2 — A full card
117
+ ```html
118
+ <WBC :item="{
119
+ comp: 'VCard',
120
+ options: {
121
+ props: { elevation: 4, outlined: true },
122
+ html: '<h2>{{ title }}</h2><p>{{ body }}</p><v-btn @click=\"doAction\">Go</v-btn>',
123
+ class: 'ma-4',
124
+ on: { click: (ctx) => ctx.emit('selected', ctx.data) }
125
+ }
126
+ }" />
127
+ ```
128
+
129
+ ### Level 3 — Reactive, data-driven, multilingual
130
+ ```javascript
131
+ // This object could come from an API, a CMS, or a user-built form
132
+ const pageDefinition = {
133
+ dive: true, // enable reactive mode
134
+ comp: (ctx) => ctx.lg === 'ar' // component changes by language
135
+ ? 'VSheet' : 'VContainer',
136
+ options: {
137
+ html: (ctx) => ctx.data.intro[ctx.lg], // pick localized content
138
+ class: (ctx) => ctx.wbcTier === 'pro' // tier-gated styling
139
+ ? 'gradient-hero' : 'flat-hero'
140
+ },
141
+ items: [
142
+ { comp: 'VAvatar', options: { props: { src: '/logo.png', size: 64 } } },
143
+ { comp: 'VBtn', options: { html: '{{ CTA }}', on: { click: 'goPricing' } } }
144
+ ]
145
+ };
146
+ // One <WBC :item="pageDefinition" /> renders the entire page.
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 🚀 Try it in 30 seconds
152
+
153
+ ```bash
154
+ # Starter template (coming soon — repo in development)
155
+ npx degit wbc-ui/starter my-app && cd my-app && npm install && npm run dev
156
+ ```
157
+
158
+ > While the starter template is being finalized, the easiest way to explore the engine is the live demo: **[demo.wbc-ui.com](https://www.demo.wbc-ui.com/lab)** — a multi-page app built from JSON, with live source visible alongside each example.
159
+
160
+ ---
161
+
162
+ ## Installation
163
+
164
+ ### Prerequisites
165
+
166
+ - **Node.js** ≥ 18 (the engine declares this; older versions may work but are not tested)
167
+ - **Vue 2.7.x** (the library targets Vue 2 specifically; Vue 3 support tracked separately as `@wbc-ui/core3`)
168
+ - A bundler that understands ESM exports: Vite (recommended), Webpack 5, or Vue CLI 5
169
+
170
+ ### npm (recommended)
171
+
172
+ ```bash
173
+ npm install @wbc-ui/core2
174
+
175
+ # Peer dependencies — install once per project
176
+ npm install vue@^2.7.16 vuetify@^2.7.2 vuex@^3.6.2 vue-router@^3
177
+ ```
178
+
179
+ ### Yarn / pnpm
180
+
181
+ ```bash
182
+ # Yarn
183
+ yarn add @wbc-ui/core2
184
+ yarn add vue@^2.7.16 vuetify@^2.7.2 vuex@^3.6.2 vue-router@^3
185
+
186
+ # pnpm
187
+ pnpm add @wbc-ui/core2
188
+ pnpm add vue@^2.7.16 vuetify@^2.7.2 vuex@^3.6.2 vue-router@^3
189
+ ```
190
+
191
+ > The published tarball is currently tagged `next` (see `publishConfig.tag` in `package.json`). To install the latest release explicitly: `npm install @wbc-ui/core2@next`.
192
+
193
+ ### Vite project setup
194
+
195
+ ```javascript
196
+ // vite.config.js
197
+ import { wbcVitePlugin } from '@wbc-ui/core2/vite-plugin';
198
+ export default defineConfig({
199
+ plugins: [vue(), ...wbcVitePlugin()] // ← auto-aliases, raw loaders, require.context
200
+ });
201
+ ```
202
+
203
+ ### Webpack project setup
204
+
205
+ For Webpack 5 / Vue CLI 5 projects:
206
+
207
+ ```javascript
208
+ // webpack.config.js or vue.config.js
209
+ const wbcWebpack = require('@wbc-ui/core2/wbc.webpack.js');
210
+ // See the plugin's exports for the available configuration API.
211
+ ```
212
+
213
+ ### Vue 2 plugin registration
214
+
215
+ ```javascript
216
+ // main.js
217
+ import Vue from 'vue';
218
+ import wbcCore from '@wbc-ui/core2';
219
+
220
+ Vue.use(wbcCore);
221
+ // That's it. Vuetify, Vuex, BootstrapVue, MarkdownIt are auto-installed.
222
+ // Use <WBC :item="..."> anywhere in your app.
223
+ ```
224
+
225
+ ### Named imports
226
+
227
+ ```javascript
228
+ import { WBC, WBHtml, WBLink, getVuetifyInstance } from '@wbc-ui/core2';
229
+ ```
230
+
231
+ ### Ecosystem extensions
232
+
233
+ The core engine is intentionally small. Optional functionality lives in sibling packages — each registers itself into the core after `Vue.use(wbcCore)`:
234
+
235
+ ```javascript
236
+ import Vue from 'vue';
237
+ import wbcCore from '@wbc-ui/core2'; // Always first — extensions depend on it
238
+ import wbCode from '@wbc-ui/code2'; // Code editor + syntax highlighting
239
+ import wbLatex from '@wbc-ui/latex2'; // LaTeX math rendering
240
+ import wbMermaid from '@wbc-ui/mermaid2'; // Mermaid diagrams
241
+ import wbChart from '@wbc-ui/chart2'; // ECharts data visualization
242
+
243
+ Vue.use(wbcCore);
244
+ Vue.use(wbCode);
245
+ Vue.use(wbLatex);
246
+ Vue.use(wbMermaid);
247
+ Vue.use(wbChart);
248
+ ```
249
+
250
+ Other available extensions: `@wbc-ui/alert2`, `@wbc-ui/cli2`, `@wbc-ui/dataviewer2`, `@wbc-ui/gis2`, `@wbc-ui/js2`, `@wbc-ui/office2`, `@wbc-ui/press2`. See the [Ecosystem](#-ecosystem) section below for what each one adds.
251
+
252
+ ### Troubleshooting common install errors
253
+
254
+ | Symptom | Cause | Fix |
255
+ |---|---|---|
256
+ | `Vue.use is not a function` | Two copies of Vue are loaded (typically: your app has Vue 2, but a dependency hoisted Vue 3) | Pin a single Vue version: add `"resolutions": { "vue": "^2.7.16" }` (yarn/pnpm) or use npm `overrides`. Then `rm -rf node_modules && reinstall`. |
257
+ | `Cannot find module '@wbc-ui/core2/vite-plugin'` | npm couldn't resolve the subpath export | Confirm `@wbc-ui/core2` ≥ `1.0.0-r01` is installed (the vite-plugin subpath was added then). Run `npm ls @wbc-ui/core2`. |
258
+ | `peer dep missing: vuetify@^2` | Vuetify wasn't installed — it's a peer dep, not a hard one | `npm install vuetify@^2.7.2` (and any other peer deps the warning names). |
259
+ | Components render but unstyled | Vuetify CSS isn't loaded | Import once in `main.js`: `import 'vuetify/dist/vuetify.min.css';` |
260
+ | `Multiple instances of Vue detected` warning | The bundler resolved Vue from two locations | In Vite: add an alias in `vite.config.js` mapping `vue` to a single absolute path. The `wbcVitePlugin()` does this automatically for the default setup. |
261
+
262
+ For a longer walkthrough with worked examples, see the documentation hub at [flow.wbc-ui.com](https://flow.wbc-ui.com) *(content is being migrated to match the new `@wbc-ui` scope; some pages may still show the legacy `wbc-ui2` name during the transition)*.
263
+
264
+ ---
265
+
266
+ ## ⚡ The Engine Under the Hood
267
+
268
+ <p align="center">
269
+ <img src="docs/media/engine-flow.svg" alt="@wbc-ui/core2 rendering engine flow" width="780"/>
270
+ </p>
271
+
272
+ <details>
273
+ <summary>Mermaid diagram (interactive fallback)</summary>
274
+ <div align="center">
275
+
276
+ ```mermaid
277
+ flowchart TD
278
+ Data("Input<br>(JSON / Array / String)") --> WBC["&lt;WBC :item='data' /&gt;"]
279
+ WBC --> Detect{"Detect Type"}
280
+
281
+ Detect -- "Str" --> RS[renderString]
282
+ Detect -- "Obj" --> RO[renderObject]
283
+ Detect -- "Arr" --> RA[renderArray]
284
+ Detect -- "File" --> RF[renderFile]
285
+ Detect -- "Fn" --> RFn[renderFunction]
286
+
287
+ RS & RO & RA & RF & RFn --> Chain
288
+
289
+ subgraph Chain["Decorator Chain"]
290
+ direction LR
291
+ A[Focus] --> B[RTL] --> C[Select] --> D[wbCode] --> E[Flattener]
292
+ end
293
+
294
+ Chain --> VNodes["Reactive VNodes"]
295
+ VNodes --> DOM(("DOM"))
296
+ ```
297
+
298
+ </div>
299
+ </details>
300
+
301
+ - **6 renderers** dispatch based on JavaScript type
302
+ - **Pipe `|` syntax** for inline styling: `"Hello|text-h4 primary--text|/docs|html"`
303
+ - **`dive: true`** activates reactive mode — every property becomes a function of `(ctx)` state
304
+ - **Post-processing decorators** apply focus mode, RTL, selection overlays, and code rendering
305
+
306
+ ---
307
+
308
+ ## 💎 Free vs Pro
309
+
310
+ <p align="center">
311
+ <img src="docs/media/tier-badges.svg" alt="Free vs Pro" width="480"/>
312
+ </p>
313
+
314
+ > *"Free users can **bind** states. Pro users can **command** them."*
315
+ > *"3 hooks for builders, 7 hooks for architects."*
316
+
317
+ **Open core.** The renderer (everything you see) is free. The orchestrator + extractor (everything that makes it programmable at scale) is Pro.
318
+
319
+ | Capability bucket | Free | Pro |
320
+ |---|---|---|
321
+ | Core rendering (6 renderers, pipe `\|`, `dive: true`) | ✅ Full | ✅ Full |
322
+ | Lifecycle hooks | 3 (init0 · init · updater) | **7** (+ setup · tracker · logic · `output`) |
323
+ | `that` API surface | `data`, `update`, `emit`, `toggle*` (binary) | **+ `vm`, `data0`, `val`, `get/set`, `ref`, `el`, `watch`** + precision toggles |
324
+ | Framework access | — | `store`, `router`, `routes`, `routeParams` |
325
+ | Services | dayjs (±14d), basic storage / cookies | **Full dayjs, AES-256, `markdown` bi-directional, `queryData`, `trigger()`** |
326
+ | Headless extraction (HTML · MD · VNodes) | — | ✅ |
327
+ | **Max depth per item** | 10 | ∞ |
328
+ | **Max items per collection** | 10 | ∞ |
329
+
330
+ <details>
331
+ <summary><strong>Full Pro surface — click to expand</strong></summary>
332
+
333
+ #### Identity & Data
334
+ | Property | Free | Pro |
335
+ |---|:-:|:-:|
336
+ | `userTier` · `nameEl` · `props` · `data` | ✅ | ✅ |
337
+ | `license` · `data0` · `vm` | ❌ | ✅ |
338
+
339
+ #### State Management
340
+ | Method | Free | Pro |
341
+ |---|:-:|:-:|
342
+ | `update(v)` · `emit(ev,val)` | ✅ | ✅ |
343
+ | `get(key)` · `set(val,key)` · `val(v)` | ❌ | ✅ |
344
+
345
+ #### Tiered Toggles *(binary in Free, precision in Pro)*
346
+ | Toggle | Free | Pro |
347
+ |---|:-:|:-:|
348
+ | `toggleLoad` · `toggleProtected` · `toggleFloat` · `toggleClose` · `toggleDrag` · `toggleHide` | 🔄 | 🎯 |
349
+
350
+ #### Framework Access
351
+ | Property | Free | Pro |
352
+ |---|:-:|:-:|
353
+ | `root` · `store` · `router` · `routes` · `routeParams` · `ref(name)` · `el` · `watch(p,cb)` | ❌ | ✅ |
354
+
355
+ #### Logic & Services
356
+ | Property | Free | Pro |
357
+ |---|:-:|:-:|
358
+ | `dayjs` | ±14d | Full |
359
+ | `storage` · `cookies` | Basic | Full |
360
+ | `markdown` · `aes` · `queryData` · `trigger(method)` | ❌ | ✅ |
361
+
362
+ #### Logic Injection Hooks
363
+ | Hook | Free | Pro |
364
+ |---|:-:|:-:|
365
+ | `init0` · `init` · `updater` | ✅ | ✅ |
366
+ | `setup` · `tracker` · `logic` · `@wbc-logic` · **`output`** | ❌ | ✅ |
367
+
368
+ #### Utility Functions
369
+ | Type | Free | Pro |
370
+ |---|:-:|:-:|
371
+ | Daily helpers (`randomKey`, `capitalize`, `isDate`, `isEmpty`, …) | ✅ | ✅ |
372
+ | Time-savers (`mergeObjects`, `getObjectDepth`, `clone`) | ❌ | ✅ |
373
+ | Enterprise security (`aesEnc`, `aesDec` — physically stripped from free builds) | ❌ | ✅ |
374
+
375
+ </details>
376
+
377
+ 👉 **[Compare in detail →](https://wbc-ui.com/free-vs-pro)** · **[Buy Pro →](https://wbc-ui.com/pricing)**
378
+
379
+ ---
380
+
381
+ ## 🌐 Ecosystem
382
+
383
+ `@wbc-ui/core2` is the foundation of the **@wbc-ui** monorepo. Every package below is published to npm and depends on `core2`:
384
+
385
+ | Package | What it adds | Status |
386
+ |---|---|---|
387
+ | [`@wbc-ui/code2`](https://www.npmjs.com/package/@wbc-ui/code2) | Monaco-powered code editor | 🟢 GA |
388
+ | [`@wbc-ui/chart2`](https://www.npmjs.com/package/@wbc-ui/chart2) | ECharts integration | 🟢 GA |
389
+ | [`@wbc-ui/dataviewer2`](https://www.npmjs.com/package/@wbc-ui/dataviewer2) | JSON / data-table explorer | 🟢 GA |
390
+ | [`@wbc-ui/latex2`](https://www.npmjs.com/package/@wbc-ui/latex2) | LaTeX math rendering | 🟢 GA |
391
+ | [`@wbc-ui/mermaid2`](https://www.npmjs.com/package/@wbc-ui/mermaid2) | Diagram-as-code rendering | 🟢 GA |
392
+ | [`@wbc-ui/gis2`](https://www.npmjs.com/package/@wbc-ui/gis2) | Leaflet map integration | 🟢 GA |
393
+ | [`@wbc-ui/alert2`](https://www.npmjs.com/package/@wbc-ui/alert2) | Notification / toast system | 🟢 GA |
394
+ | [`@wbc-ui/press2`](https://www.npmjs.com/package/@wbc-ui/press2) | Markdown-driven docs engine | 🟢 GA |
395
+
396
+ ---
397
+
398
+ ## 📄 License
399
+
400
+ MIT © [Wissem Boughamoura](https://github.com/wissemb11) · [wi-bg.com](https://www.wi-bg.com) · [wbc-ui.com](https://wbc-ui.com)
@@ -0,0 +1,8 @@
1
+ {
2
+ "package": "@wbc-ui/core2",
3
+ "version": "1.0.0-r01",
4
+ "tier": "free",
5
+ "builtAt": "2026-05-20T02:43:05.062Z",
6
+ "commit": null,
7
+ "node": "v24.15.0"
8
+ }