@stacksjs/stx 0.2.115 → 0.2.117
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 +454 -420
- package/dist/includes.js +2 -1
- package/dist/menubar.d.ts +1 -0
- package/dist/menubar.js +2 -6
- package/dist/pwa.js +274 -240
- package/dist/render.d.ts +14 -0
- package/dist/render.js +1 -1
- package/dist/runtime-globals.d.ts +4 -2
- package/dist/signal-processing.js +2 -2
- package/dist/signals.js +42 -8
- package/dist/ssg.js +343 -309
- package/dist/utils.js +3 -3
- package/package.json +5 -5
package/dist/includes.js
CHANGED
|
@@ -180,9 +180,10 @@ function extractExports(setupContent) {
|
|
|
180
180
|
return names.join(", ");
|
|
181
181
|
}
|
|
182
182
|
function wrapClientScript(scriptContent, tail = "") {
|
|
183
|
+
const localNames = extractExports(scriptContent).split(",").map((name) => name.trim()).filter(Boolean);
|
|
183
184
|
return `
|
|
184
185
|
(function() {
|
|
185
|
-
${buildRuntimeGlobalsDestructure("var")}
|
|
186
|
+
${buildRuntimeGlobalsDestructure("var", localNames)}
|
|
186
187
|
var __destroyHooks = [];
|
|
187
188
|
var __origOnDestroy = onDestroy;
|
|
188
189
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
package/dist/menubar.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare interface MenuBarMenuItem {
|
|
|
30
30
|
export declare interface MenuBarAppOptions<T extends Record<string, unknown>> {
|
|
31
31
|
name: string
|
|
32
32
|
template: string
|
|
33
|
+
templateSource?: string
|
|
33
34
|
preferences?: T
|
|
34
35
|
context?: (preferences: Preferences<T>) => Record<string, unknown> | Promise<Record<string, unknown>>
|
|
35
36
|
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() {
|