@arkstack/view 0.19.2 → 0.19.3
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/README.md +10 -10
- package/dist/app.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{plugins-Dnz7jf8I.js → plugins-BmizdA9l.js} +36 -36
- package/dist/setup.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
View module for Arkstack, providing template rendering and view integration utilities.
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import { View, view } from '@arkstack/view'
|
|
8
|
+
import { View, view } from '@arkstack/view'
|
|
9
9
|
|
|
10
|
-
View.share({ appName: 'Arkstack' })
|
|
11
|
-
View.share('year', new Date().getFullYear())
|
|
10
|
+
View.share({ appName: 'Arkstack' })
|
|
11
|
+
View.share('year', new Date().getFullYear())
|
|
12
12
|
|
|
13
13
|
View.composer('welcome', (view) => {
|
|
14
|
-
view.with({ title: 'Welcome' })
|
|
15
|
-
})
|
|
14
|
+
view.with({ title: 'Welcome' })
|
|
15
|
+
})
|
|
16
16
|
|
|
17
17
|
class WelcomeComposer {
|
|
18
18
|
compose(view) {
|
|
19
|
-
view.with('message', 'Your app is ready.')
|
|
19
|
+
view.with('message', 'Your app is ready.')
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
View.composer('welcome', WelcomeComposer)
|
|
23
|
+
View.composer('welcome', WelcomeComposer)
|
|
24
24
|
|
|
25
|
-
const html = await view('welcome').with('name', 'Ada')
|
|
25
|
+
const html = await view('welcome').with('name', 'Ada')
|
|
26
26
|
|
|
27
|
-
const dashboard = await View.make('dashboard').with({ user }).render()
|
|
27
|
+
const dashboard = await View.make('dashboard').with({ user }).render()
|
|
28
28
|
|
|
29
|
-
const email = await view('~org/package-name.mail', { user })
|
|
29
|
+
const email = await view('~org/package-name.mail', { user })
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Views are resolved from `src/resources/views` by default. Use `View.mount()` to add or replace mounted view directories.
|
package/dist/app.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as normalizeViewErrors, a as viteReactRefresh, c as collectViewData, d as runWithViewData, f as ViewInstance, g as ViewErrorBag, h as view, i as registerViteTag, l as enterViewData, m as resolvePackageViewsPath, n as View, o as viteTags, p as parsePackageViewName, r as ViewFactory, s as clearViewData, t as clearRouterViewPlugin, u as getViewData } from "./plugins-
|
|
1
|
+
import { _ as normalizeViewErrors, a as viteReactRefresh, c as collectViewData, d as runWithViewData, f as ViewInstance, g as ViewErrorBag, h as view, i as registerViteTag, l as enterViewData, m as resolvePackageViewsPath, n as View, o as viteTags, p as parsePackageViewName, r as ViewFactory, s as clearViewData, t as clearRouterViewPlugin, u as getViewData } from "./plugins-BmizdA9l.js";
|
|
2
2
|
import edge, { Edge } from "edge.js";
|
|
3
3
|
export { Edge, View, ViewErrorBag, ViewFactory, ViewInstance, clearRouterViewPlugin, clearViewData, collectViewData, edge, enterViewData, getViewData, normalizeViewErrors, parsePackageViewName, registerViteTag, resolvePackageViewsPath, runWithViewData, view, viteReactRefresh, viteTags };
|
|
@@ -341,10 +341,10 @@ const productionTags = (entries, manifestPath, buildDir) => {
|
|
|
341
341
|
* at the Vite dev server and includes the `@vite/client`. In production it reads
|
|
342
342
|
* the build manifest and emits the hashed asset tags (including any CSS a chunk
|
|
343
343
|
* imports). Backs the `@vite(...)` Edge tag.
|
|
344
|
-
*
|
|
345
|
-
* @param entries
|
|
346
|
-
* @param options
|
|
347
|
-
* @returns
|
|
344
|
+
*
|
|
345
|
+
* @param entries
|
|
346
|
+
* @param options
|
|
347
|
+
* @returns
|
|
348
348
|
*/
|
|
349
349
|
const viteTags = (entries, options = {}) => {
|
|
350
350
|
const list = (Array.isArray(entries) ? entries : [entries]).filter(Boolean);
|
|
@@ -413,10 +413,10 @@ var ViewFactory = class {
|
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
415
415
|
* Create a new view instance for the given view name and data.
|
|
416
|
-
*
|
|
417
|
-
* @param name
|
|
418
|
-
* @param data
|
|
419
|
-
* @returns
|
|
416
|
+
*
|
|
417
|
+
* @param name
|
|
418
|
+
* @param data
|
|
419
|
+
* @returns
|
|
420
420
|
*/
|
|
421
421
|
make(name, data = {}) {
|
|
422
422
|
const edgeName = this.resolveName(name);
|
|
@@ -428,10 +428,10 @@ var ViewFactory = class {
|
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
430
|
* Render the first view that exists from the given list of names.
|
|
431
|
-
*
|
|
432
|
-
* @param names
|
|
433
|
-
* @param data
|
|
434
|
-
* @returns
|
|
431
|
+
*
|
|
432
|
+
* @param names
|
|
433
|
+
* @param data
|
|
434
|
+
* @returns
|
|
435
435
|
*/
|
|
436
436
|
first(names, data = {}) {
|
|
437
437
|
const name = names.find((candidate) => this.exists(candidate));
|
|
@@ -440,9 +440,9 @@ var ViewFactory = class {
|
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
442
|
* Check if a view exists.
|
|
443
|
-
*
|
|
444
|
-
* @param name
|
|
445
|
-
* @returns
|
|
443
|
+
*
|
|
444
|
+
* @param name
|
|
445
|
+
* @returns
|
|
446
446
|
*/
|
|
447
447
|
exists(name) {
|
|
448
448
|
const edgeName = this.resolveName(name);
|
|
@@ -458,13 +458,13 @@ var ViewFactory = class {
|
|
|
458
458
|
return this;
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
|
-
* Register a view composer for the given view name(s).
|
|
462
|
-
* A view composer is a function or object that is called when a view is
|
|
461
|
+
* Register a view composer for the given view name(s).
|
|
462
|
+
* A view composer is a function or object that is called when a view is
|
|
463
463
|
* rendered, allowing you to modify the view's data or perform other actions.
|
|
464
|
-
*
|
|
465
|
-
* @param names
|
|
466
|
-
* @param composer
|
|
467
|
-
* @returns
|
|
464
|
+
*
|
|
465
|
+
* @param names
|
|
466
|
+
* @param composer
|
|
467
|
+
* @returns
|
|
468
468
|
*/
|
|
469
469
|
composer(names, composer) {
|
|
470
470
|
for (const name of Array.isArray(names) ? names : [names]) this.composers.set(name, [...this.composers.get(name) ?? [], composer]);
|
|
@@ -480,23 +480,23 @@ var ViewFactory = class {
|
|
|
480
480
|
}
|
|
481
481
|
/**
|
|
482
482
|
* Register a raw template with the given name and contents.
|
|
483
|
-
*
|
|
484
|
-
* @param name
|
|
485
|
-
* @param contents
|
|
486
|
-
* @returns
|
|
483
|
+
*
|
|
484
|
+
* @param name
|
|
485
|
+
* @param contents
|
|
486
|
+
* @returns
|
|
487
487
|
*/
|
|
488
488
|
raw(name, contents) {
|
|
489
489
|
this.edge.registerTemplate(name, { template: contents });
|
|
490
490
|
return this;
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
|
-
* Register a custom tag with the given name, block type, seekable type,
|
|
493
|
+
* Register a custom tag with the given name, block type, seekable type,
|
|
494
494
|
* and compiler function.
|
|
495
|
-
*
|
|
496
|
-
* @param tagName
|
|
497
|
-
* @param block
|
|
498
|
-
* @param seekable
|
|
499
|
-
* @param compiler
|
|
495
|
+
*
|
|
496
|
+
* @param tagName
|
|
497
|
+
* @param block
|
|
498
|
+
* @param seekable
|
|
499
|
+
* @param compiler
|
|
500
500
|
*/
|
|
501
501
|
tag(tagName, block, seekable, compiler) {
|
|
502
502
|
const tag = {
|
|
@@ -509,18 +509,18 @@ var ViewFactory = class {
|
|
|
509
509
|
}
|
|
510
510
|
/**
|
|
511
511
|
* Flush all shared data. This will remove all data that has been shared with all views.
|
|
512
|
-
*
|
|
513
|
-
* @returns
|
|
512
|
+
*
|
|
513
|
+
* @returns
|
|
514
514
|
*/
|
|
515
515
|
flushShared() {
|
|
516
516
|
this.sharedData = {};
|
|
517
517
|
return this;
|
|
518
518
|
}
|
|
519
519
|
/**
|
|
520
|
-
* Flush all registered composers. This will remove all composers that have
|
|
520
|
+
* Flush all registered composers. This will remove all composers that have
|
|
521
521
|
* been registered for any view.
|
|
522
|
-
*
|
|
523
|
-
* @returns
|
|
522
|
+
*
|
|
523
|
+
* @returns
|
|
524
524
|
*/
|
|
525
525
|
flushComposers() {
|
|
526
526
|
this.composers.clear();
|
package/dist/setup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/view",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "View module for Arkstack, providing template rendering and view integration utilities.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net/guide/views",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"edge.js": "^6.5.0",
|
|
37
|
-
"@arkstack/contract": "^0.19.
|
|
37
|
+
"@arkstack/contract": "^0.19.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@h3ravel/musket": "^2.2.13",
|
|
41
41
|
"clear-router": "^2.9.3",
|
|
42
|
-
"@arkstack/common": "^0.19.
|
|
43
|
-
"@arkstack/foundry": "^0.19.
|
|
42
|
+
"@arkstack/common": "^0.19.3",
|
|
43
|
+
"@arkstack/foundry": "^0.19.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@h3ravel/musket": {
|