@stacksjs/stx 0.2.116 → 0.2.118
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/dist/cli.js +186 -186
- package/dist/craft-entry.d.ts +1 -0
- package/dist/database.d.ts +1 -0
- package/dist/desktop.d.ts +1 -0
- package/dist/menubar.d.ts +2 -0
- package/dist/menubar.js +2 -6
- package/dist/pwa.d.ts +1 -0
- package/dist/render.d.ts +14 -0
- package/dist/render.js +1 -1
- package/dist/ssg.d.ts +1 -0
- package/package.json +5 -5
package/dist/craft-entry.d.ts
CHANGED
package/dist/database.d.ts
CHANGED
package/dist/desktop.d.ts
CHANGED
package/dist/menubar.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./stx.d.ts" />
|
|
1
2
|
import type { Preferences, WindowOptions } from '@stacksjs/desktop';
|
|
2
3
|
/**
|
|
3
4
|
* Normalize a route key to `"<METHOD> <path>"`. A key without a method is a
|
|
@@ -30,6 +31,7 @@ export declare interface MenuBarMenuItem {
|
|
|
30
31
|
export declare interface MenuBarAppOptions<T extends Record<string, unknown>> {
|
|
31
32
|
name: string
|
|
32
33
|
template: string
|
|
34
|
+
templateSource?: string
|
|
33
35
|
preferences?: T
|
|
34
36
|
context?: (preferences: Preferences<T>) => Record<string, unknown> | Promise<Record<string, unknown>>
|
|
35
37
|
routes?: Routes<T>
|
package/dist/menubar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPreferences, createWindow, setAutoLaunch } from "@stacksjs/desktop";
|
|
2
|
-
import { renderTemplate } from "./render.js";
|
|
2
|
+
import { renderTemplate, renderTemplateString } from "./render.js";
|
|
3
3
|
const MENU_BAR_WINDOW = {
|
|
4
4
|
width: 320,
|
|
5
5
|
height: 640,
|
|
@@ -42,11 +42,7 @@ export function createMenuBarApp(options) {
|
|
|
42
42
|
routes.set(key, handler);
|
|
43
43
|
let server = null, window = null, url = null;
|
|
44
44
|
async function renderPopup() {
|
|
45
|
-
const
|
|
46
|
-
context,
|
|
47
|
-
wrapInDocument: !0,
|
|
48
|
-
title: options.name
|
|
49
|
-
});
|
|
45
|
+
const renderOptions = { context: await options.context?.(preferences) ?? {}, wrapInDocument: !0, title: options.name }, html = options.templateSource ? await renderTemplateString(options.templateSource, options.template, renderOptions) : await renderTemplate(options.template, renderOptions);
|
|
50
46
|
return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8" } });
|
|
51
47
|
}
|
|
52
48
|
function serve() {
|
package/dist/pwa.d.ts
CHANGED
package/dist/render.d.ts
CHANGED
|
@@ -24,6 +24,20 @@ export declare function renderTemplate(filePath: string, renderOptions?: RenderO
|
|
|
24
24
|
* @returns The rendered HTML string
|
|
25
25
|
*/
|
|
26
26
|
export declare function renderString(template: string, context?: Record<string, unknown>, options?: { templateOnly?: boolean }): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Render template content that is already in memory, resolving includes and
|
|
29
|
+
* components relative to `filePath`.
|
|
30
|
+
*
|
|
31
|
+
* Use this when the template cannot be read from disk at runtime — most often an
|
|
32
|
+
* app compiled to a single binary, where the `.stx` file is embedded at build
|
|
33
|
+
* time via `import source from './app.stx' with { type: 'text' }` and
|
|
34
|
+
* `filePath` only anchors relative lookups.
|
|
35
|
+
*
|
|
36
|
+
* @param content - The stx template source
|
|
37
|
+
* @param filePath - Path the template came from, used to resolve relative includes
|
|
38
|
+
* @param renderOptions - Additional rendering options
|
|
39
|
+
*/
|
|
40
|
+
export declare function renderTemplateString(content: string, filePath: string, renderOptions?: RenderOptions): Promise<string>;
|
|
27
41
|
// ============================================================================
|
|
28
42
|
// Types
|
|
29
43
|
// ============================================================================
|
package/dist/render.js
CHANGED
|
@@ -89,7 +89,7 @@ export async function renderTemplate(filePath, renderOptions = {}) {
|
|
|
89
89
|
export async function renderString(template, context = {}, options) {
|
|
90
90
|
return renderTemplateString(template, process.cwd(), { context, ...options });
|
|
91
91
|
}
|
|
92
|
-
async function renderTemplateString(content, filePath, renderOptions = {}) {
|
|
92
|
+
export async function renderTemplateString(content, filePath, renderOptions = {}) {
|
|
93
93
|
const { templateContent, serverScripts, clientScripts } = parseTemplate(content), options = {
|
|
94
94
|
...defaultConfig,
|
|
95
95
|
...renderOptions.options
|
package/dist/ssg.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.118",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.12",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.118",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.118",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.118",
|
|
124
124
|
"bunfig": "^0.15.15",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.118",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|