@stacksjs/stx 0.2.794 → 0.2.795
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/chunk-027hdpgv.js +2 -0
- package/dist/chunk-054h7ktz.js +2 -0
- package/dist/chunk-09nyt9c5.js +2 -0
- package/dist/chunk-0d3ncyqh.js +2 -0
- package/dist/{chunk-2gqhfge6.js → chunk-12jjf2me.js} +2 -2
- package/dist/{chunk-jdj1358b.js → chunk-1hq3y7ss.js} +2 -2
- package/dist/{chunk-b4r7d6me.js → chunk-1q16p7t2.js} +5 -5
- package/dist/chunk-1yew6rw9.js +2 -0
- package/dist/chunk-211kxm18.js +2 -0
- package/dist/chunk-26y92p8r.js +2 -0
- package/dist/{chunk-ssh2gycr.js → chunk-2bvaakcv.js} +3 -3
- package/dist/{chunk-vav9ktgm.js → chunk-2e5tvryz.js} +1 -1
- package/dist/{chunk-15ckxpq7.js → chunk-2xprqx2v.js} +5 -5
- package/dist/{chunk-dhqp3z4w.js → chunk-3em44jbm.js} +2 -2
- package/dist/chunk-3ep9h16p.js +2 -0
- package/dist/{chunk-ne69yaak.js → chunk-3f8w1x6w.js} +10 -10
- package/dist/{chunk-14ft0zc7.js → chunk-3vpgr6nk.js} +6 -6
- package/dist/{chunk-8nb8b0nf.js → chunk-427mhgje.js} +1 -1
- package/dist/chunk-49tn6yst.js +2 -0
- package/dist/chunk-4b7dwwn6.js +2 -0
- package/dist/chunk-4ncbq4bx.js +2 -0
- package/dist/{chunk-985afhhy.js → chunk-4p5g7v9g.js} +2 -2
- package/dist/{chunk-7pk3t82j.js → chunk-4s0ye933.js} +2 -2
- package/dist/chunk-4srnxp3b.js +2 -0
- package/dist/chunk-538d185r.js +3 -0
- package/dist/{chunk-605b93pe.js → chunk-53v4cby3.js} +4 -4
- package/dist/{chunk-94gyfwpz.js → chunk-624xpap6.js} +12 -12
- package/dist/{chunk-kr8qdg0r.js → chunk-6s9bk98p.js} +2 -2
- package/dist/{chunk-q14d714d.js → chunk-6wpwpk3c.js} +4 -4
- package/dist/chunk-6z4bza9z.js +2 -0
- package/dist/chunk-75y9heas.js +2 -0
- package/dist/chunk-7ckdvsmj.js +3 -0
- package/dist/{chunk-rrb9m2q2.js → chunk-7k6hd10j.js} +5 -5
- package/dist/{chunk-1y9ez7nz.js → chunk-7s1kerhs.js} +2 -2
- package/dist/{chunk-k4bdf0dw.js → chunk-7xs45trj.js} +2 -2
- package/dist/{chunk-kce6pzmj.js → chunk-7y29q1ng.js} +3 -3
- package/dist/{chunk-t3ptzpfc.js → chunk-7y73txmp.js} +1 -1
- package/dist/{chunk-j6255z7f.js → chunk-88acqv2r.js} +4 -4
- package/dist/{chunk-efrc97by.js → chunk-8t8e75xm.js} +4 -4
- package/dist/chunk-8w1wxr96.js +2 -0
- package/dist/{chunk-7gdwvnwc.js → chunk-8zf87cc5.js} +2 -2
- package/dist/{chunk-gv3bfkdm.js → chunk-90zswh9v.js} +5 -5
- package/dist/chunk-98kjk52z.js +2 -0
- package/dist/{chunk-yyr7vb7k.js → chunk-9b9tvhmh.js} +5 -5
- package/dist/{chunk-66b56g2z.js → chunk-9jcqbgq9.js} +5 -5
- package/dist/chunk-9sea317f.js +2 -0
- package/dist/chunk-9tpv4cg7.js +2 -0
- package/dist/{chunk-qzb0v08n.js → chunk-ak10vygz.js} +1 -1
- package/dist/{chunk-wk6xsyv3.js → chunk-aksrh8je.js} +3 -3
- package/dist/{chunk-6v4b0xc1.js → chunk-ata5wp2m.js} +4 -4
- package/dist/{chunk-nwbq8qvb.js → chunk-axjfaere.js} +1214 -445
- package/dist/chunk-axq3c7cb.js +2 -0
- package/dist/{chunk-w6taxq7d.js → chunk-ayd635jf.js} +5 -5
- package/dist/{chunk-qv85c3qy.js → chunk-azqf0ps0.js} +2 -2
- package/dist/{chunk-gb65t4n1.js → chunk-b58n1kfe.js} +2 -2
- package/dist/{chunk-c0ejyxfj.js → chunk-baj6w8ja.js} +2 -2
- package/dist/{chunk-es006emk.js → chunk-bwf8b4e4.js} +3 -3
- package/dist/{chunk-h0jnatd4.js → chunk-bzhzp4f4.js} +2 -2
- package/dist/chunk-c5trhqpg.js +2 -0
- package/dist/{chunk-bmfk3b29.js → chunk-c5vzr1va.js} +2 -2
- package/dist/chunk-c692kj5v.js +2 -0
- package/dist/{chunk-8ztgy5y4.js → chunk-cepctq7e.js} +108 -108
- package/dist/{chunk-0r61tkfe.js → chunk-cfbpvm5e.js} +2 -2
- package/dist/chunk-cfr7cd88.js +2 -0
- package/dist/{chunk-bwcj9z19.js → chunk-d50vw81s.js} +4 -4
- package/dist/chunk-dsh5q9bg.js +2 -0
- package/dist/{chunk-e3wmnjz8.js → chunk-dstzvtvk.js} +3 -3
- package/dist/{chunk-2p4yad7w.js → chunk-dxe94pwy.js} +4 -4
- package/dist/{chunk-rgz797k3.js → chunk-ectx5ar9.js} +3 -3
- package/dist/chunk-emnphnz7.js +2 -0
- package/dist/chunk-ennzzth4.js +177 -0
- package/dist/chunk-epcdgn78.js +2 -0
- package/dist/chunk-etegf4zj.js +2 -0
- package/dist/chunk-ewzdsksb.js +2 -0
- package/dist/chunk-ey8bgg6x.js +2 -0
- package/dist/chunk-f03sg8b0.js +2 -0
- package/dist/{chunk-w5hhqjwr.js → chunk-f4j7nsj1.js} +1 -1
- package/dist/{chunk-fpn4dren.js → chunk-fcqxa38q.js} +1 -1
- package/dist/{chunk-enep9r03.js → chunk-g4n0bjfb.js} +52 -52
- package/dist/chunk-gf04pgaa.js +2 -0
- package/dist/chunk-ghn8vhet.js +2 -0
- package/dist/chunk-gywp6kd8.js +2 -0
- package/dist/{chunk-tnn0br4w.js → chunk-h656zg6k.js} +3 -3
- package/dist/{chunk-8e23zh2y.js → chunk-hnbx1t3t.js} +2 -2
- package/dist/{chunk-2m5h2mtr.js → chunk-hp10khyy.js} +41 -41
- package/dist/{chunk-d18xd9x5.js → chunk-hwcfgs3e.js} +3 -3
- package/dist/{chunk-5a92srn2.js → chunk-jmbh26gv.js} +1 -1
- package/dist/chunk-k6sjqb7g.js +2 -0
- package/dist/{chunk-vrbcdds3.js → chunk-ka8sk5qa.js} +1 -1
- package/dist/{chunk-1stvxcjv.js → chunk-m081078c.js} +2 -2
- package/dist/{chunk-hh9t97hr.js → chunk-mcj5qtpp.js} +1 -1
- package/dist/chunk-me71d5w5.js +2 -0
- package/dist/{chunk-e0wxcst7.js → chunk-njk5db1q.js} +4 -4
- package/dist/chunk-nvytej81.js +2 -0
- package/dist/{chunk-488kx8j5.js → chunk-nyer6v3y.js} +5 -5
- package/dist/chunk-p1txw41y.js +2 -0
- package/dist/{chunk-agtvdtx4.js → chunk-p3ej3954.js} +2 -2
- package/dist/chunk-p8gekf4b.js +2 -0
- package/dist/{chunk-nps2whkz.js → chunk-pm8a4kdf.js} +6 -6
- package/dist/{chunk-y0pqpch2.js → chunk-pnddmgjf.js} +7 -7
- package/dist/chunk-px0qsd38.js +2 -0
- package/dist/{chunk-27rzdq3n.js → chunk-qnxctfdf.js} +2 -2
- package/dist/chunk-qr23snrp.js +2 -0
- package/dist/{chunk-v8rfeev5.js → chunk-r1vkk7qp.js} +2 -2
- package/dist/{chunk-qp3xd98j.js → chunk-r3a15pax.js} +2 -2
- package/dist/{chunk-pa9zfbh6.js → chunk-rdymnn2t.js} +2 -2
- package/dist/{chunk-8q63njnd.js → chunk-reb7rddz.js} +1 -1
- package/dist/chunk-s151a2dj.js +2 -0
- package/dist/{chunk-v1z6n7wz.js → chunk-sphc7xzx.js} +4 -4
- package/dist/chunk-sqettc34.js +2 -0
- package/dist/chunk-srgbv05n.js +2 -0
- package/dist/chunk-t0d4rsfx.js +2 -0
- package/dist/chunk-t0k0yk24.js +2 -0
- package/dist/chunk-tdcgskyy.js +2 -0
- package/dist/chunk-te3hr6d7.js +2 -0
- package/dist/chunk-tes8fdv6.js +2 -0
- package/dist/{chunk-9tqa8xvf.js → chunk-thpwk6ya.js} +2 -2
- package/dist/{chunk-w9nwb8r3.js → chunk-tmfrq4nq.js} +7 -7
- package/dist/{chunk-tnkxww7b.js → chunk-tqvw1673.js} +5 -5
- package/dist/chunk-v6j5vkce.js +2 -0
- package/dist/chunk-vmp876q6.js +2 -0
- package/dist/{chunk-4s5q1aea.js → chunk-vpzdqbw7.js} +4 -4
- package/dist/{chunk-tktkj2dc.js → chunk-vwp5fchy.js} +1 -1
- package/dist/{chunk-1hajf3wc.js → chunk-w6e30qkz.js} +13 -13
- package/dist/{chunk-3gn1t0pa.js → chunk-w76cve9j.js} +9 -9
- package/dist/{chunk-7fr038wx.js → chunk-wa7fzgw7.js} +4 -4
- package/dist/chunk-wes5fdpe.js +2 -0
- package/dist/chunk-wfnfb4fr.js +2 -0
- package/dist/{chunk-cdsv4yrv.js → chunk-wfrqwtar.js} +1 -1
- package/dist/chunk-wzwfbehm.js +20 -0
- package/dist/{chunk-j56mg28d.js → chunk-x8ghjw9b.js} +2 -2
- package/dist/{chunk-74rf78w8.js → chunk-x8h81amr.js} +2 -2
- package/dist/chunk-xbhb8102.js +2 -0
- package/dist/{chunk-5j619xgb.js → chunk-xqjat573.js} +2 -2
- package/dist/chunk-xv4paxmt.js +2 -0
- package/dist/{chunk-5gppagt3.js → chunk-y2jqx5k4.js} +1 -1
- package/dist/{chunk-d6arvs57.js → chunk-y64f5t74.js} +5 -5
- package/dist/chunk-yeaqebnd.js +2 -0
- package/dist/chunk-yj20tq3s.js +2 -0
- package/dist/chunk-yjm7c78z.js +2 -0
- package/dist/{chunk-h0c6jtrj.js → chunk-yjnaqahd.js} +4 -4
- package/dist/{chunk-epcy3r18.js → chunk-zmr0pvcd.js} +113 -105
- package/dist/{chunk-6pt4158p.js → chunk-zv3zpmv1.js} +1 -1
- package/dist/{chunk-7sartb04.js → chunk-zva4a7xq.js} +2 -2
- package/dist/cli.js +19 -19
- package/dist/client/signals-authoring-runtime.js +2 -2
- package/dist/client/signals-binding-utils-runtime.js +2 -4
- package/dist/client/signals-component-props-runtime.js +8 -2
- package/dist/client/signals-expression-compiler-runtime.js +1 -1
- package/dist/client/signals-for-runtime.js +34 -0
- package/dist/client/signals-handler-runtime.js +43 -20
- package/dist/client/signals-helpers-runtime.js +39 -0
- package/dist/client/signals-native-row-runtime.d.ts +26 -0
- package/dist/client/signals-native-row-runtime.js +626 -0
- package/dist/client/signals-process-element-runtime.js +305 -287
- package/dist/client/signals-proxy-runtime.js +56 -31
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/accessibility.js +8 -0
- package/dist/native/compiler/bundle.js +1 -1
- package/dist/native/compiler/inline-style.js +38 -1
- package/dist/native/compiler/style-variables.js +9 -1
- package/dist/native/event-names.js +1 -0
- package/dist/native/prop-names.js +9 -1
- package/dist/native/runtime/binding-tree.d.ts +2 -0
- package/dist/native/runtime/binding-tree.js +12 -1
- package/dist/native/runtime/craft-bridge.js +66 -0
- package/dist/native/runtime/craft.d.ts +78 -2
- package/dist/native/runtime/native-host.d.ts +2 -0
- package/dist/native/runtime/native-host.js +179 -76
- package/dist/pwa.js +3 -3
- package/dist/signals.d.ts +13 -10
- package/dist/signals.js +5 -3
- package/dist/ssg.js +15 -15
- package/dist/stx-virtual-ts.d.ts +25 -1
- package/dist/stx-virtual-ts.js +109 -6
- package/dist/typecheck.d.ts +3 -1
- package/dist/typecheck.js +28 -11
- package/package.json +5 -5
- package/dist/chunk-0675z8hj.js +0 -177
- package/dist/chunk-1brkqd5f.js +0 -2
- package/dist/chunk-1ds97d9m.js +0 -2
- package/dist/chunk-1tvb2stj.js +0 -2
- package/dist/chunk-2vxh8b8g.js +0 -2
- package/dist/chunk-33na85q2.js +0 -2
- package/dist/chunk-3t4t655h.js +0 -2
- package/dist/chunk-43ynckvh.js +0 -2
- package/dist/chunk-4v22nj67.js +0 -2
- package/dist/chunk-5v5w0cd2.js +0 -2
- package/dist/chunk-699t603m.js +0 -2
- package/dist/chunk-6f6xqzhb.js +0 -2
- package/dist/chunk-7mrr4ke5.js +0 -2
- package/dist/chunk-7tzzzvdg.js +0 -2
- package/dist/chunk-8a5txj4f.js +0 -2
- package/dist/chunk-8pphy0p1.js +0 -2
- package/dist/chunk-8rmb79zw.js +0 -2
- package/dist/chunk-8rwnzmvb.js +0 -2
- package/dist/chunk-90pxjq62.js +0 -2
- package/dist/chunk-9s4ggstz.js +0 -2
- package/dist/chunk-9xdz8r73.js +0 -2
- package/dist/chunk-agvykxs8.js +0 -2
- package/dist/chunk-ajj56vrw.js +0 -2
- package/dist/chunk-ay4ep67v.js +0 -2
- package/dist/chunk-bwfncfe1.js +0 -3
- package/dist/chunk-d5e47gr4.js +0 -2
- package/dist/chunk-d910ytt2.js +0 -2
- package/dist/chunk-d9p7xaj7.js +0 -2
- package/dist/chunk-dsrn2vgp.js +0 -2
- package/dist/chunk-fkkdt6sj.js +0 -2
- package/dist/chunk-fpw03bhv.js +0 -2
- package/dist/chunk-fxy0cq7h.js +0 -2
- package/dist/chunk-g6smtcc0.js +0 -2
- package/dist/chunk-g747k4gg.js +0 -3
- package/dist/chunk-gryrg1c0.js +0 -2
- package/dist/chunk-gvj862m1.js +0 -2
- package/dist/chunk-h5nrnen8.js +0 -2
- package/dist/chunk-hagk74x6.js +0 -2
- package/dist/chunk-hv0whj8t.js +0 -2
- package/dist/chunk-k2brrhf8.js +0 -2
- package/dist/chunk-k6ncb5qm.js +0 -2
- package/dist/chunk-kn38mjpp.js +0 -2
- package/dist/chunk-kvmpc0sg.js +0 -2
- package/dist/chunk-nbjgytem.js +0 -2
- package/dist/chunk-nf2bzqaw.js +0 -2
- package/dist/chunk-nt7wqqax.js +0 -2
- package/dist/chunk-pq1qs7bp.js +0 -2
- package/dist/chunk-pvw58x2j.js +0 -20
- package/dist/chunk-qk9v0emh.js +0 -2
- package/dist/chunk-qnj444zc.js +0 -2
- package/dist/chunk-s1wdzttg.js +0 -2
- package/dist/chunk-sq0qc9sk.js +0 -2
- package/dist/chunk-th5afzmv.js +0 -2
- package/dist/chunk-vgzfsh1z.js +0 -2
- package/dist/chunk-wmh4yxcs.js +0 -2
- package/dist/chunk-wr3adhd8.js +0 -2
- package/dist/chunk-xmae29mn.js +0 -2
- package/dist/chunk-zdwnzq78.js +0 -2
- package/dist/chunk-zssf9fdg.js +0 -2
- package/dist/chunk-zyf6737j.js +0 -2
|
@@ -8,7 +8,7 @@ import { affectsGeometry, applySvgAnimation, parseSvgMarkup, parseViewBox, SVG_A
|
|
|
8
8
|
import { NATIVE_EVENT_NAMES } from "../event-names.js";
|
|
9
9
|
import { nativePropName } from "../prop-names.js";
|
|
10
10
|
import { authoredTextEntryProps, projectTextEntry, TEXT_ENTRY_SOURCES, textEntryChanges } from "../text-entry.js";
|
|
11
|
-
import { BindingElement, cloneNativeBindingNode } from "./binding-tree.js";
|
|
11
|
+
import { BindingElement, cloneNativeBindingNode, cloneNativeBindingNodeWith } from "./binding-tree.js";
|
|
12
12
|
import { NATIVE_FORM_ENTRIES } from "./jsc-globals.js";
|
|
13
13
|
import { createNativeOverlayPresenter } from "./overlay-presenter.js";
|
|
14
14
|
import { prepareInitialMedia } from "./initial-media-mutations.js";
|
|
@@ -60,9 +60,31 @@ export const HOST_METHODS = [
|
|
|
60
60
|
"descendants",
|
|
61
61
|
"scopesIn"
|
|
62
62
|
];
|
|
63
|
+
const wordLists = new Map;
|
|
64
|
+
function words(text) {
|
|
65
|
+
let list = wordLists.get(text);
|
|
66
|
+
if (list === void 0) {
|
|
67
|
+
list = text.split(/\s+/).filter(Boolean);
|
|
68
|
+
if (wordLists.size >= 2000)
|
|
69
|
+
wordLists.clear();
|
|
70
|
+
wordLists.set(text, list);
|
|
71
|
+
}
|
|
72
|
+
return list;
|
|
73
|
+
}
|
|
74
|
+
const flatNames = new Map;
|
|
75
|
+
function flatName(name) {
|
|
76
|
+
let flat = flatNames.get(name);
|
|
77
|
+
if (flat === void 0) {
|
|
78
|
+
flat = name.replace(/-/g, "").toLowerCase();
|
|
79
|
+
if (flatNames.size >= 2000)
|
|
80
|
+
flatNames.clear();
|
|
81
|
+
flatNames.set(name, flat);
|
|
82
|
+
}
|
|
83
|
+
return flat;
|
|
84
|
+
}
|
|
63
85
|
function followsHref() {}
|
|
64
86
|
export function createNativeHost(options) {
|
|
65
|
-
const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap;
|
|
87
|
+
const records = new Map, attributeObservers = new WeakMap, childObservers = new WeakMap, handlers = new Map, eventRegistrations = new WeakMap, componentListeners = new WeakMap, controlsWithDefaultListeners = new WeakSet, implicitSubmitListeners = new WeakMap, formResetCallbacks = new WeakMap, boundHrefs = new WeakMap;
|
|
66
88
|
let queue = [], mediaFlushTimer, scheduled = !1, counter = 0, colorScheme = options.colorScheme ?? "light", viewportWidth = Number.isFinite(options.viewportWidth) ? Math.max(0, options.viewportWidth) : 0;
|
|
67
89
|
const widthBounds = { min: new Set, max: new Set }, crossesWidthBound = (from, to) => {
|
|
68
90
|
for (const min of widthBounds.min)
|
|
@@ -175,11 +197,17 @@ export function createNativeHost(options) {
|
|
|
175
197
|
return value.trim();
|
|
176
198
|
return null;
|
|
177
199
|
}
|
|
178
|
-
function installLinkListener(node) {
|
|
200
|
+
function installLinkListener(node, authored = node) {
|
|
179
201
|
markCurrentLink(node);
|
|
180
202
|
if (!followLink)
|
|
181
203
|
return;
|
|
182
|
-
|
|
204
|
+
let bound = boundHrefs.get(authored);
|
|
205
|
+
if (bound === void 0 || authored === node) {
|
|
206
|
+
bound = isBindingNode(authored) && authored.attributes.some((attribute) => attribute.name.endsWith("href") && /^(?::|x-bind:|@bind:|x-)href$/.test(attribute.name));
|
|
207
|
+
if (authored !== node)
|
|
208
|
+
boundHrefs.set(authored, bound);
|
|
209
|
+
}
|
|
210
|
+
if (bound || typeof descriptorOf(node)?.props.href === "string")
|
|
183
211
|
host.listen(node, "click", followsHref);
|
|
184
212
|
}
|
|
185
213
|
function markCurrentLink(node) {
|
|
@@ -235,7 +263,10 @@ export function createNativeHost(options) {
|
|
|
235
263
|
return record;
|
|
236
264
|
}
|
|
237
265
|
function decorateControl(node, type) {
|
|
238
|
-
const
|
|
266
|
+
const own = descriptorOf(node);
|
|
267
|
+
if (type !== "TextInput" && type !== "Picker" && type !== "Checkbox" && own?.props.type !== "hidden" && !own?.props["data-stx-form"])
|
|
268
|
+
return;
|
|
269
|
+
const htmlCheckbox = type === "Checkbox" && own?.props.type === "checkbox", hidden = own?.props.type === "hidden";
|
|
239
270
|
if (type === "TextInput" || type === "Picker" || htmlCheckbox || hidden) {
|
|
240
271
|
Object.defineProperty(node, "value", {
|
|
241
272
|
configurable: !0,
|
|
@@ -381,12 +412,15 @@ export function createNativeHost(options) {
|
|
|
381
412
|
}
|
|
382
413
|
}
|
|
383
414
|
}
|
|
384
|
-
function materialize(node) {
|
|
415
|
+
function materialize(node, inherited) {
|
|
385
416
|
const record = recordOf(node);
|
|
386
417
|
if (record.materialized || node.__stxAnchor !== void 0)
|
|
387
418
|
return;
|
|
388
419
|
installControlListeners(node);
|
|
389
|
-
|
|
420
|
+
if (inherited !== void 0)
|
|
421
|
+
record.inheritedVariables = inherited;
|
|
422
|
+
record.styleDirty = !1;
|
|
423
|
+
resolveClasses(node.__stxId, record, !1);
|
|
390
424
|
record.materialized = !0;
|
|
391
425
|
emit({
|
|
392
426
|
op: "createNode",
|
|
@@ -404,7 +438,7 @@ export function createNativeHost(options) {
|
|
|
404
438
|
for (const child of record.children) {
|
|
405
439
|
if (child.__stxAnchor !== void 0)
|
|
406
440
|
continue;
|
|
407
|
-
materialize(child);
|
|
441
|
+
materialize(child, record.variables);
|
|
408
442
|
emit({ op: "insertChild", parentId: node.__stxId, childId: child.__stxId, index: index++ });
|
|
409
443
|
}
|
|
410
444
|
}
|
|
@@ -416,8 +450,10 @@ export function createNativeHost(options) {
|
|
|
416
450
|
resolvingId = id;
|
|
417
451
|
const report = reportStyle;
|
|
418
452
|
let inherited = record.inheritedVariables;
|
|
419
|
-
|
|
420
|
-
|
|
453
|
+
const ancestors = record.styleAncestors;
|
|
454
|
+
if (ancestors)
|
|
455
|
+
for (let i = 0;i < ancestors.length; i++)
|
|
456
|
+
inherited = parseNativeStyleLayers([ancestors[i]], inherited, report).variables;
|
|
421
457
|
const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
|
|
422
458
|
record.variables = resolved.variables;
|
|
423
459
|
const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 }), classStyle = { ...classes.style };
|
|
@@ -452,13 +488,14 @@ export function createNativeHost(options) {
|
|
|
452
488
|
}
|
|
453
489
|
Object.assign(classStyle, focused);
|
|
454
490
|
}
|
|
455
|
-
const style = applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), pointer =
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
491
|
+
const style = applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), hover = classes.pointer?.hover, active = classes.pointer?.active;
|
|
492
|
+
if (hover)
|
|
493
|
+
style.hoverStyle = { ...hover.style, ...colorScheme === "dark" ? hover.dark : {} };
|
|
494
|
+
if (active)
|
|
495
|
+
style.pressStyle = { ...active.style, ...colorScheme === "dark" ? active.dark : {} };
|
|
496
|
+
if (!record.visible || isHiddenInput(record))
|
|
497
|
+
style.display = "none";
|
|
498
|
+
return style;
|
|
462
499
|
}
|
|
463
500
|
function refreshFocusChain(node) {
|
|
464
501
|
for (let current = node;current; current = current.__stxOwner) {
|
|
@@ -476,6 +513,10 @@ export function createNativeHost(options) {
|
|
|
476
513
|
return;
|
|
477
514
|
const record = recordOf(node), before = record.variables;
|
|
478
515
|
record.inheritedVariables = inherited;
|
|
516
|
+
if (!record.materialized) {
|
|
517
|
+
record.styleDirty = !0;
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
479
520
|
applyClasses(node.__stxId, record, !0);
|
|
480
521
|
const after = record.variables;
|
|
481
522
|
if (!appearanceChanged && before !== void 0 && sameVariables(before, after))
|
|
@@ -494,7 +535,10 @@ export function createNativeHost(options) {
|
|
|
494
535
|
return !0;
|
|
495
536
|
}
|
|
496
537
|
function forwardedHostRoot(node, name) {
|
|
497
|
-
if (!isBindingNode(node)
|
|
538
|
+
if (!isBindingNode(node))
|
|
539
|
+
return;
|
|
540
|
+
const forward = node.getAttribute("data-stx-native-forward");
|
|
541
|
+
if (!forward || !words(forward).includes(name))
|
|
498
542
|
return;
|
|
499
543
|
const find = (candidate) => {
|
|
500
544
|
if (candidate !== node && isBindingNode(candidate) && candidate.hasAttribute("data-stx-native-host-owner"))
|
|
@@ -517,8 +561,11 @@ export function createNativeHost(options) {
|
|
|
517
561
|
const bindings = node.getAttribute("data-stx-parent-bindings");
|
|
518
562
|
if (!bindings)
|
|
519
563
|
return !1;
|
|
520
|
-
const
|
|
521
|
-
|
|
564
|
+
const wanted = flatName(name), names = words(bindings);
|
|
565
|
+
for (let i = 0;i < names.length; i++)
|
|
566
|
+
if (flatName(names[i]) === wanted)
|
|
567
|
+
return !0;
|
|
568
|
+
return !1;
|
|
522
569
|
}
|
|
523
570
|
function applyForwardedStyle(node, name, value) {
|
|
524
571
|
const record = recordOf(node);
|
|
@@ -547,15 +594,24 @@ export function createNativeHost(options) {
|
|
|
547
594
|
notifyAttributes(node, name);
|
|
548
595
|
}
|
|
549
596
|
function applyClasses(id, record, onlyIfChanged = !1) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
597
|
+
if (!record.materialized) {
|
|
598
|
+
record.styleDirty = !0;
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
resolveClasses(id, record, onlyIfChanged);
|
|
602
|
+
}
|
|
603
|
+
function resolveClasses(id, record, onlyIfChanged) {
|
|
604
|
+
const style = resolveStyle(record, id);
|
|
605
|
+
if (record.materialized) {
|
|
606
|
+
const patch = {};
|
|
607
|
+
for (const key in record.style)
|
|
608
|
+
if (!(key in style))
|
|
609
|
+
patch[key] = null;
|
|
610
|
+
if (!onlyIfChanged || JSON.stringify(record.style) !== JSON.stringify(style))
|
|
611
|
+
emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
|
|
612
|
+
}
|
|
555
613
|
record.style = style;
|
|
556
|
-
|
|
557
|
-
emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
|
|
558
|
-
const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules }), divideChanged = JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
|
|
614
|
+
const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules }), divideChanged = classes.divide !== record.divide && JSON.stringify(classes.divide) !== JSON.stringify(record.divide);
|
|
559
615
|
record.divide = classes.divide;
|
|
560
616
|
if (divideChanged || record.divide)
|
|
561
617
|
refreshDividersOf(record);
|
|
@@ -753,6 +809,80 @@ export function createNativeHost(options) {
|
|
|
753
809
|
installLinkListener(node);
|
|
754
810
|
return node;
|
|
755
811
|
}
|
|
812
|
+
function placesQuietly(parent, record, node) {
|
|
813
|
+
if (record.divide || record.hadDividers)
|
|
814
|
+
return !1;
|
|
815
|
+
if (node.__stxAnchor === void 0) {
|
|
816
|
+
const own = descriptorOf(node);
|
|
817
|
+
if (own && (own.materialized || own.focusWithin))
|
|
818
|
+
return !1;
|
|
819
|
+
}
|
|
820
|
+
for (let current = parent;current; current = current.__stxOwner)
|
|
821
|
+
if (childObservers.has(current))
|
|
822
|
+
return !1;
|
|
823
|
+
return !0;
|
|
824
|
+
}
|
|
825
|
+
function placeDetached(parent, record, node, index) {
|
|
826
|
+
record.children.splice(index, 0, node);
|
|
827
|
+
const isView = node.__stxAnchor === void 0;
|
|
828
|
+
if (isView && record.viewCount !== void 0)
|
|
829
|
+
record.viewCount++;
|
|
830
|
+
node.__stxOwner = parent;
|
|
831
|
+
if (isView) {
|
|
832
|
+
const own = recordOf(node);
|
|
833
|
+
own.inheritedVariables = record.variables;
|
|
834
|
+
own.styleDirty = !0;
|
|
835
|
+
}
|
|
836
|
+
insertIntoBindingParent(parent, node, index);
|
|
837
|
+
setConnected(node, !1);
|
|
838
|
+
}
|
|
839
|
+
function copyNode(node, source, copy) {
|
|
840
|
+
if (!isBindingNode(node))
|
|
841
|
+
copy.__stxOwner = node.__stxOwner;
|
|
842
|
+
decoratePosition(copy);
|
|
843
|
+
if (node.__stxScope !== void 0)
|
|
844
|
+
copy.__stxScope = node.__stxScope;
|
|
845
|
+
const descriptor = source ?? {
|
|
846
|
+
type: "View",
|
|
847
|
+
props: {},
|
|
848
|
+
style: {},
|
|
849
|
+
baseStyle: {},
|
|
850
|
+
classes: "",
|
|
851
|
+
events: {},
|
|
852
|
+
children: [],
|
|
853
|
+
visible: !0,
|
|
854
|
+
materialized: !0
|
|
855
|
+
};
|
|
856
|
+
records.set(copy.__stxId, {
|
|
857
|
+
type: descriptor.type,
|
|
858
|
+
key: descriptor.key,
|
|
859
|
+
props: { ...descriptor.props, __stxId: copy.__stxId },
|
|
860
|
+
style: { ...descriptor.style },
|
|
861
|
+
baseStyle: { ...descriptor.baseStyle },
|
|
862
|
+
layoutDefaults: descriptor.layoutDefaults === void 0 ? void 0 : { ...descriptor.layoutDefaults },
|
|
863
|
+
styleSource: descriptor.styleSource,
|
|
864
|
+
styleAncestors: descriptor.styleAncestors,
|
|
865
|
+
inheritedVariables: descriptor.inheritedVariables,
|
|
866
|
+
variables: descriptor.variables,
|
|
867
|
+
boundStyle: descriptor.boundStyle,
|
|
868
|
+
classes: descriptor.classes,
|
|
869
|
+
forwardedClasses: descriptor.forwardedClasses,
|
|
870
|
+
forwardedStyle: descriptor.forwardedStyle,
|
|
871
|
+
events: { ...descriptor.events },
|
|
872
|
+
text: descriptor.text,
|
|
873
|
+
children: [],
|
|
874
|
+
visible: descriptor.visible,
|
|
875
|
+
materialized: !1,
|
|
876
|
+
controlDefaults: descriptor.controlDefaults,
|
|
877
|
+
divide: descriptor.divide,
|
|
878
|
+
styleDirty: !0
|
|
879
|
+
});
|
|
880
|
+
decorateControl(copy, descriptor.type);
|
|
881
|
+
if (!isBindingNode(copy) || copy.isConnected)
|
|
882
|
+
setConnected(copy, !1);
|
|
883
|
+
installLinkListener(copy, node);
|
|
884
|
+
return copy;
|
|
885
|
+
}
|
|
756
886
|
const overlayPresenter = createNativeOverlayPresenter({
|
|
757
887
|
canFocus: options.views?.capabilities.focus === !0,
|
|
758
888
|
canPresentNonModal: options.views?.capabilities.nonModalPresentation === !0,
|
|
@@ -1227,10 +1357,12 @@ export function createNativeHost(options) {
|
|
|
1227
1357
|
record.baseStyle.display = record.shownDisplay;
|
|
1228
1358
|
record.shownDisplay = void 0;
|
|
1229
1359
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1360
|
+
if (record.materialized) {
|
|
1361
|
+
record.style = resolveStyle(record, node.__stxId);
|
|
1362
|
+
const display = visible ? irDisplay(record.style.display) : "none";
|
|
1233
1363
|
emit({ op: "updateNode", id: node.__stxId, patch: { style: { display } } });
|
|
1364
|
+
} else
|
|
1365
|
+
record.styleDirty = !0;
|
|
1234
1366
|
if (was !== visible)
|
|
1235
1367
|
refreshDividers(node.__stxOwner);
|
|
1236
1368
|
return was;
|
|
@@ -1241,56 +1373,27 @@ export function createNativeHost(options) {
|
|
|
1241
1373
|
return anchor;
|
|
1242
1374
|
},
|
|
1243
1375
|
clone(node) {
|
|
1244
|
-
const source = descriptorOf(node),
|
|
1245
|
-
|
|
1246
|
-
copy.__stxOwner = node.__stxOwner;
|
|
1247
|
-
decoratePosition(copy);
|
|
1248
|
-
if (node.__stxScope !== void 0)
|
|
1249
|
-
copy.__stxScope = node.__stxScope;
|
|
1250
|
-
const descriptor = source ?? {
|
|
1251
|
-
type: "View",
|
|
1252
|
-
props: {},
|
|
1253
|
-
style: {},
|
|
1254
|
-
baseStyle: {},
|
|
1255
|
-
classes: "",
|
|
1256
|
-
events: {},
|
|
1257
|
-
children: [],
|
|
1258
|
-
visible: !0,
|
|
1259
|
-
materialized: !0
|
|
1260
|
-
};
|
|
1261
|
-
records.set(copy.__stxId, {
|
|
1262
|
-
type: descriptor.type,
|
|
1263
|
-
key: descriptor.key,
|
|
1264
|
-
props: { ...descriptor.props, __stxId: copy.__stxId },
|
|
1265
|
-
style: { ...descriptor.style },
|
|
1266
|
-
baseStyle: { ...descriptor.baseStyle },
|
|
1267
|
-
layoutDefaults: { ...descriptor.layoutDefaults },
|
|
1268
|
-
styleSource: descriptor.styleSource,
|
|
1269
|
-
styleAncestors: descriptor.styleAncestors,
|
|
1270
|
-
inheritedVariables: descriptor.inheritedVariables,
|
|
1271
|
-
variables: descriptor.variables,
|
|
1272
|
-
boundStyle: descriptor.boundStyle,
|
|
1273
|
-
classes: descriptor.classes,
|
|
1274
|
-
forwardedClasses: descriptor.forwardedClasses,
|
|
1275
|
-
forwardedStyle: descriptor.forwardedStyle,
|
|
1276
|
-
events: { ...descriptor.events },
|
|
1277
|
-
text: descriptor.text,
|
|
1278
|
-
children: [],
|
|
1279
|
-
visible: descriptor.visible,
|
|
1280
|
-
materialized: !1,
|
|
1281
|
-
controlDefaults: descriptor.controlDefaults
|
|
1282
|
-
});
|
|
1283
|
-
decorateControl(copy, descriptor.type);
|
|
1284
|
-
setConnected(copy, !1);
|
|
1285
|
-
installLinkListener(copy);
|
|
1286
|
-
for (const child of descriptor.children) {
|
|
1376
|
+
const source = descriptorOf(node), copy = copyNode(node, source, isBindingNode(node) ? cloneNativeBindingNode(node, nextId("n"), void 0, HostElement) : plainNode(nextId("n")));
|
|
1377
|
+
for (const child of source?.children ?? []) {
|
|
1287
1378
|
const childCopy = this.clone(child);
|
|
1288
1379
|
this.insert(copy, childCopy);
|
|
1289
1380
|
}
|
|
1290
1381
|
return copy;
|
|
1291
1382
|
},
|
|
1383
|
+
append(parent, node) {
|
|
1384
|
+
this.insert(parent, node);
|
|
1385
|
+
},
|
|
1386
|
+
cloneElement(node, attributes) {
|
|
1387
|
+
const source = descriptorOf(node);
|
|
1388
|
+
return copyNode(node, source, isBindingNode(node) ? cloneNativeBindingNodeWith(node, nextId("n"), attributes, HostElement) : plainNode(nextId("n")));
|
|
1389
|
+
},
|
|
1292
1390
|
insert(parent, node, before) {
|
|
1293
|
-
const record = recordOf(parent), oldOwner = node.__stxOwner
|
|
1391
|
+
const record = recordOf(parent), oldOwner = node.__stxOwner;
|
|
1392
|
+
if (!oldOwner && !record.materialized && placesQuietly(parent, record, node)) {
|
|
1393
|
+
placeDetached(parent, record, node, before ? Math.max(0, lastIndexOfChild(record.children, before.__stxId)) : record.children.length);
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
const isView = node.__stxAnchor === void 0, existing = oldOwner === parent ? record.children.findIndex((child) => child.__stxId === node.__stxId) : -1;
|
|
1294
1397
|
if (existing !== -1) {
|
|
1295
1398
|
record.children.splice(existing, 1);
|
|
1296
1399
|
if (isView && record.viewCount !== void 0)
|
|
@@ -1322,7 +1425,7 @@ export function createNativeHost(options) {
|
|
|
1322
1425
|
notifyChildren(parent);
|
|
1323
1426
|
if (node.__stxAnchor !== void 0 || !record.materialized)
|
|
1324
1427
|
return;
|
|
1325
|
-
materialize(node);
|
|
1428
|
+
materialize(node, record.variables);
|
|
1326
1429
|
let nativeIndex = 0;
|
|
1327
1430
|
if (index <= record.children.length >> 1) {
|
|
1328
1431
|
for (let i = 0;i < index; i++)
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{Qs,Ht,xl,kg}from"./chunk-d50vw81s.js";import{Zs,Pi,vg,xg,Sg}from"./chunk-vpzdqbw7.js";import{bl,wl,vl,bg,wg}from"./chunk-3em44jbm.js";import{Ue,Tn,Ii}from"./chunk-7xs45trj.js";import{_g,Cg,Eg,Tg,eo,uy}from"./chunk-4s0ye933.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-etegf4zj.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Qs(n,t);if(a){let s=Ht(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Pi(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,wl as auditBuildOutput,bl as auditConfig,re as buildPwaAssets,vl as calculateAuditResult,wg as formatAuditResult,Ii as formatSize,j as generateManifest,_ as generateManifestJson,xg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Zs as generatePwaTags,Qs as generateServiceWorker,kg as generateServiceWorkerAuto,vg as generateSwRegistrationScript,Sg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Pi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,xl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,eo as pwaDirectives,_g as pwaInstallDirective,Eg as pwaOfflineDirective,Tg as pwaPushDirective,Cg as pwaUpdateDirective,uy as registerPwaDirectives,bg as runPwaAudit,D as validateManifest};
|
package/dist/signals.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { state, derived, effect, batch, onMount, onDestroy, isSignal, isDerived, untrack, peek } from './signals-api';
|
|
2
|
-
|
|
3
|
-
* Generates the browser runtime for STX signals.
|
|
4
|
-
*
|
|
5
|
-
* This runtime is automatically injected into pages that use signals.
|
|
6
|
-
* It provides the full reactivity system and template binding.
|
|
7
|
-
*
|
|
8
|
-
* @returns Minified JavaScript runtime code
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateSignalsRuntime(): string;
|
|
2
|
+
export declare function generateSignalsRuntime(options?: SignalsRuntimeOptions): string;
|
|
11
3
|
/**
|
|
12
4
|
* Generates readable (non-minified) runtime for development.
|
|
13
5
|
*
|
|
14
6
|
* @returns Human-readable JavaScript runtime code
|
|
15
7
|
*/
|
|
16
|
-
export declare function generateSignalsRuntimeDev(): string;
|
|
8
|
+
export declare function generateSignalsRuntimeDev(options?: SignalsRuntimeOptions): string;
|
|
17
9
|
declare const __dtsx_default_export__: {
|
|
18
10
|
state: typeof state;
|
|
19
11
|
derived: typeof derived;
|
|
@@ -28,6 +20,17 @@ declare const __dtsx_default_export__: {
|
|
|
28
20
|
generateSignalsRuntime: typeof generateSignalsRuntime;
|
|
29
21
|
generateSignalsRuntimeDev: typeof generateSignalsRuntimeDev
|
|
30
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Generates the browser runtime for STX signals.
|
|
25
|
+
*
|
|
26
|
+
* This runtime is automatically injected into pages that use signals.
|
|
27
|
+
* It provides the full reactivity system and template binding.
|
|
28
|
+
*
|
|
29
|
+
* @returns Minified JavaScript runtime code
|
|
30
|
+
*/
|
|
31
|
+
export declare interface SignalsRuntimeOptions {
|
|
32
|
+
native?: boolean
|
|
33
|
+
}
|
|
31
34
|
export * from './signals-api';
|
|
32
35
|
// =============================================================================
|
|
33
36
|
// Default Export
|
package/dist/signals.js
CHANGED
|
@@ -30,6 +30,7 @@ import { SIGNALS_EXPRESSION_RUNTIME } from "./client/signals-expression-runtime.
|
|
|
30
30
|
import { SIGNALS_FETCH_TRANSPORT_RUNTIME } from "./client/signals-fetch-transport-runtime.js";
|
|
31
31
|
import { signalsFetchRuntime } from "./client/signals-fetch-runtime.js";
|
|
32
32
|
import { SIGNALS_FOR_RUNTIME } from "./client/signals-for-runtime.js";
|
|
33
|
+
import { SIGNALS_NATIVE_ROW_RUNTIME } from "./client/signals-native-row-runtime.js";
|
|
33
34
|
import { SIGNALS_GLOBALS_RUNTIME } from "./client/signals-globals-runtime.js";
|
|
34
35
|
import { SIGNALS_HANDLER_RUNTIME } from "./client/signals-handler-runtime.js";
|
|
35
36
|
import { SIGNALS_HEAD_RUNTIME } from "./client/signals-head-runtime.js";
|
|
@@ -76,8 +77,8 @@ import { SIGNALS_TRANSITION_GROUP_RUNTIME } from "./client/signals-transition-gr
|
|
|
76
77
|
import { SIGNALS_WEBSOCKET_RUNTIME } from "./client/signals-websocket-runtime.js";
|
|
77
78
|
|
|
78
79
|
export * from "./signals-api.js";
|
|
79
|
-
export function generateSignalsRuntime() {
|
|
80
|
-
const stripped = stripConsoleLog(generateSignalsRuntimeDev());
|
|
80
|
+
export function generateSignalsRuntime(options = {}) {
|
|
81
|
+
const stripped = stripConsoleLog(generateSignalsRuntimeDev(options));
|
|
81
82
|
try {
|
|
82
83
|
let minified = new Bun.Transpiler({ loader: "js", minifyWhitespace: !0 }).transformSync(stripped);
|
|
83
84
|
minified = minified.replace(/\}(var |let |const |function )/g, "};$1");
|
|
@@ -122,7 +123,7 @@ function stripConsoleLog(src) {
|
|
|
122
123
|
}
|
|
123
124
|
return out.join("");
|
|
124
125
|
}
|
|
125
|
-
export function generateSignalsRuntimeDev() {
|
|
126
|
+
export function generateSignalsRuntimeDev(options = {}) {
|
|
126
127
|
return `${SIGNALS_PREAMBLE_RUNTIME}${SIGNALS_HOST_RUNTIME}
|
|
127
128
|
${signalsReactiveCoreBootstrapRuntime(SIGNALS_CLOAK_RUNTIME, SIGNALS_EXPRESSION_COMPILER_RUNTIME, SIGNALS_FETCH_TRANSPORT_RUNTIME)}
|
|
128
129
|
|
|
@@ -162,6 +163,7 @@ ${SIGNALS_LOOP_COMPONENT_REMAP_RUNTIME}
|
|
|
162
163
|
${SIGNALS_COMPONENT_HYDRATION_RUNTIME}
|
|
163
164
|
${SIGNALS_LOOP_ROW_RUNTIME}
|
|
164
165
|
${SIGNALS_FOR_RUNTIME}
|
|
166
|
+
${options.native ? SIGNALS_NATIVE_ROW_RUNTIME : ""}
|
|
165
167
|
${SIGNALS_LOOP_CONDITIONAL_RUNTIME}
|
|
166
168
|
${SIGNALS_CONDITIONAL_CHAIN_RUNTIME}
|
|
167
169
|
${SIGNALS_IF_CHAIN_RUNTIME}
|