@stacksjs/stx 0.2.793 → 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-a4cse2tj.js → chunk-2bvaakcv.js} +3 -3
- package/dist/{chunk-1z9hbzpk.js → chunk-2e5tvryz.js} +1 -1
- package/dist/{chunk-66r0f799.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-6jzqzap6.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-vj59es75.js → chunk-7y73txmp.js} +1 -1
- package/dist/{chunk-gg71gm25.js → chunk-88acqv2r.js} +4 -4
- package/dist/{chunk-4de6rhaj.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-c2qwbej3.js → chunk-9b9tvhmh.js} +5 -5
- package/dist/{chunk-bb2zfgwf.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-m997knnz.js → chunk-aksrh8je.js} +3 -3
- package/dist/{chunk-6v4b0xc1.js → chunk-ata5wp2m.js} +4 -4
- package/dist/{chunk-a1ynjj47.js → chunk-axjfaere.js} +1226 -449
- package/dist/chunk-axq3c7cb.js +2 -0
- package/dist/{chunk-2hwwmn7c.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-55j4jxwe.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-0ykteae5.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-j4s5k8sp.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-syheccfj.js → chunk-hnbx1t3t.js} +2 -2
- package/dist/{chunk-g89fx9rq.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-r2nvxbjc.js → chunk-m081078c.js} +2 -2
- package/dist/{chunk-spt5kmb2.js → chunk-mcj5qtpp.js} +1 -1
- package/dist/chunk-me71d5w5.js +2 -0
- package/dist/{chunk-6h7yhyb8.js → chunk-njk5db1q.js} +4 -4
- package/dist/chunk-nvytej81.js +2 -0
- package/dist/{chunk-xc0vws7m.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-6jx0trea.js → chunk-pm8a4kdf.js} +6 -6
- package/dist/{chunk-56yhvhjq.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-g3z2g6hm.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-hs9fzxn0.js → chunk-w6e30qkz.js} +13 -13
- package/dist/{chunk-3gn1t0pa.js → chunk-w76cve9j.js} +9 -9
- package/dist/{chunk-7yb8943c.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-xadd911n.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-628jcm1d.js → chunk-y2jqx5k4.js} +1 -1
- package/dist/{chunk-g7anxh36.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-4cffjp4f.js → chunk-zmr0pvcd.js} +113 -105
- package/dist/{chunk-44ep7dkr.js → chunk-zv3zpmv1.js} +1 -1
- package/dist/{chunk-bxxgr5c5.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 +14 -8
- 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 +219 -94
- 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-0a9ceqa8.js +0 -2
- package/dist/chunk-0cm94ksp.js +0 -2
- package/dist/chunk-0ppx28f6.js +0 -2
- package/dist/chunk-1aent61q.js +0 -2
- package/dist/chunk-1brkqd5f.js +0 -2
- package/dist/chunk-1pbyr47e.js +0 -2
- package/dist/chunk-1tvb2stj.js +0 -2
- package/dist/chunk-22z2cwhv.js +0 -2
- package/dist/chunk-276e3d0g.js +0 -3
- package/dist/chunk-27vn4674.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-44tq4d62.js +0 -2
- package/dist/chunk-499v1ade.js +0 -2
- package/dist/chunk-4gx5ze56.js +0 -2
- package/dist/chunk-4v22nj67.js +0 -2
- package/dist/chunk-55wsqxfk.js +0 -2
- package/dist/chunk-5pe7wcvh.js +0 -2
- package/dist/chunk-5y5k6x3r.js +0 -2
- package/dist/chunk-699t603m.js +0 -2
- package/dist/chunk-6f6xqzhb.js +0 -2
- package/dist/chunk-7fx8p9w5.js +0 -2
- package/dist/chunk-8698v9gf.js +0 -2
- package/dist/chunk-8pphy0p1.js +0 -2
- package/dist/chunk-98308vtv.js +0 -20
- package/dist/chunk-ad2fk303.js +0 -2
- package/dist/chunk-ajj56vrw.js +0 -2
- package/dist/chunk-brqcepmv.js +0 -2
- package/dist/chunk-d5e47gr4.js +0 -2
- package/dist/chunk-d910ytt2.js +0 -2
- package/dist/chunk-d9p7xaj7.js +0 -2
- package/dist/chunk-ddbkw53b.js +0 -2
- package/dist/chunk-dtnyrjcj.js +0 -2
- package/dist/chunk-dyp0kgmr.js +0 -177
- package/dist/chunk-fc384a2h.js +0 -2
- package/dist/chunk-fkkdt6sj.js +0 -2
- package/dist/chunk-fxy0cq7h.js +0 -2
- package/dist/chunk-g6smtcc0.js +0 -2
- package/dist/chunk-gnydrw29.js +0 -2
- package/dist/chunk-jkm34gec.js +0 -2
- package/dist/chunk-js5zve3p.js +0 -2
- package/dist/chunk-k3mcb700.js +0 -3
- package/dist/chunk-kn38mjpp.js +0 -2
- package/dist/chunk-kvmpc0sg.js +0 -2
- package/dist/chunk-ncxed9r1.js +0 -2
- package/dist/chunk-nf2bzqaw.js +0 -2
- package/dist/chunk-nptp3x62.js +0 -2
- package/dist/chunk-qd9f47ds.js +0 -2
- package/dist/chunk-s1wdzttg.js +0 -2
- package/dist/chunk-t8vtf522.js +0 -2
- package/dist/chunk-t9744tty.js +0 -2
- package/dist/chunk-th5afzmv.js +0 -2
- package/dist/chunk-vaqqch06.js +0 -2
- package/dist/chunk-vgzfsh1z.js +0 -2
- package/dist/chunk-wr3adhd8.js +0 -2
- package/dist/chunk-zdwnzq78.js +0 -2
- package/dist/chunk-zsjw2jgy.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,17 +438,22 @@ 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
|
}
|
|
445
|
+
let resolvingId = "";
|
|
446
|
+
const reportStyle = (diagnostic) => {
|
|
447
|
+
console.warn(`[STX Native] ${diagnostic.kind}: ${resolvingId}: ${diagnostic.name}`);
|
|
448
|
+
}, NO_LAYERS = [];
|
|
411
449
|
function resolveStyle(record, id) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
};
|
|
450
|
+
resolvingId = id;
|
|
451
|
+
const report = reportStyle;
|
|
415
452
|
let inherited = record.inheritedVariables;
|
|
416
|
-
|
|
417
|
-
|
|
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;
|
|
418
457
|
const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
|
|
419
458
|
record.variables = resolved.variables;
|
|
420
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 };
|
|
@@ -423,7 +462,7 @@ export function createNativeHost(options) {
|
|
|
423
462
|
if (layer.max !== void 0)
|
|
424
463
|
widthBounds.max.add(layer.max);
|
|
425
464
|
}
|
|
426
|
-
const responsive =
|
|
465
|
+
const responsive = classes.responsive?.length ? classes.responsive.filter((layer) => viewportWidth >= layer.min && (layer.max === void 0 || viewportWidth <= layer.max)) : NO_LAYERS;
|
|
427
466
|
for (const layer of responsive)
|
|
428
467
|
Object.assign(classStyle, layer.style);
|
|
429
468
|
if (colorScheme === "dark") {
|
|
@@ -431,28 +470,32 @@ export function createNativeHost(options) {
|
|
|
431
470
|
for (const layer of responsive)
|
|
432
471
|
Object.assign(classStyle, layer.dark);
|
|
433
472
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
473
|
+
if (classes.states) {
|
|
474
|
+
for (const [attribute, layer] of Object.entries(classes.states))
|
|
475
|
+
if (ariaState(record.props[attribute]))
|
|
476
|
+
Object.assign(classStyle, layer.style, colorScheme === "dark" ? layer.dark : {});
|
|
477
|
+
}
|
|
437
478
|
if (classes.disabled && disabled(record))
|
|
438
479
|
Object.assign(classStyle, classes.disabled.style, colorScheme === "dark" ? classes.disabled.dark : {});
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
480
|
+
if (record.focusWithin || record.focused)
|
|
481
|
+
for (const layer of [record.focusWithin && classes.focusWithin, record.focused && classes.focus]) {
|
|
482
|
+
if (!layer)
|
|
483
|
+
continue;
|
|
484
|
+
const focused = { ...layer.style, ...colorScheme === "dark" ? layer.dark : {} };
|
|
485
|
+
if (classStyle.transform && focused.transform) {
|
|
486
|
+
const overridden = new Set(focused.transform.flatMap((step) => Object.keys(step)));
|
|
487
|
+
focused.transform = [...classStyle.transform.filter((step) => !Object.keys(step).some((key) => overridden.has(key))), ...focused.transform];
|
|
488
|
+
}
|
|
489
|
+
Object.assign(classStyle, focused);
|
|
446
490
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
return { ...style, ...pointer, ...record.visible && !isHiddenInput(record) ? {} : { display: "none" } };
|
|
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;
|
|
456
499
|
}
|
|
457
500
|
function refreshFocusChain(node) {
|
|
458
501
|
for (let current = node;current; current = current.__stxOwner) {
|
|
@@ -470,15 +513,32 @@ export function createNativeHost(options) {
|
|
|
470
513
|
return;
|
|
471
514
|
const record = recordOf(node), before = record.variables;
|
|
472
515
|
record.inheritedVariables = inherited;
|
|
516
|
+
if (!record.materialized) {
|
|
517
|
+
record.styleDirty = !0;
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
473
520
|
applyClasses(node.__stxId, record, !0);
|
|
474
521
|
const after = record.variables;
|
|
475
|
-
if (!appearanceChanged && before
|
|
522
|
+
if (!appearanceChanged && before !== void 0 && sameVariables(before, after))
|
|
476
523
|
return;
|
|
477
524
|
for (const child of record.children)
|
|
478
525
|
refreshStyleTree(child, after, appearanceChanged);
|
|
479
526
|
}
|
|
527
|
+
function sameVariables(before, after) {
|
|
528
|
+
if (before === after)
|
|
529
|
+
return !0;
|
|
530
|
+
if (before.size !== after.size)
|
|
531
|
+
return !1;
|
|
532
|
+
for (const [name, value] of after)
|
|
533
|
+
if (!before.has(name) || before.get(name) !== value)
|
|
534
|
+
return !1;
|
|
535
|
+
return !0;
|
|
536
|
+
}
|
|
480
537
|
function forwardedHostRoot(node, name) {
|
|
481
|
-
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))
|
|
482
542
|
return;
|
|
483
543
|
const find = (candidate) => {
|
|
484
544
|
if (candidate !== node && isBindingNode(candidate) && candidate.hasAttribute("data-stx-native-host-owner"))
|
|
@@ -501,8 +561,11 @@ export function createNativeHost(options) {
|
|
|
501
561
|
const bindings = node.getAttribute("data-stx-parent-bindings");
|
|
502
562
|
if (!bindings)
|
|
503
563
|
return !1;
|
|
504
|
-
const
|
|
505
|
-
|
|
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;
|
|
506
569
|
}
|
|
507
570
|
function applyForwardedStyle(node, name, value) {
|
|
508
571
|
const record = recordOf(node);
|
|
@@ -531,19 +594,34 @@ export function createNativeHost(options) {
|
|
|
531
594
|
notifyAttributes(node, name);
|
|
532
595
|
}
|
|
533
596
|
function applyClasses(id, record, onlyIfChanged = !1) {
|
|
534
|
-
|
|
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
|
+
}
|
|
535
613
|
record.style = style;
|
|
536
|
-
|
|
537
|
-
emit({ op: "updateNode", id, patch: { style: { ...patch, ...style } } });
|
|
538
|
-
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);
|
|
539
615
|
record.divide = classes.divide;
|
|
540
616
|
if (divideChanged || record.divide)
|
|
541
617
|
refreshDividersOf(record);
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
618
|
+
if (classes.unknown.length || record.reportedClasses?.size) {
|
|
619
|
+
const unsupported = new Set(classes.unknown);
|
|
620
|
+
for (const name of unsupported)
|
|
621
|
+
if (!record.reportedClasses?.has(name))
|
|
622
|
+
console.warn(`[STX Native] unknown-class: ${id}: ${name}`);
|
|
623
|
+
record.reportedClasses = unsupported;
|
|
624
|
+
}
|
|
547
625
|
if (record.type === "Icon" && classes.icon) {
|
|
548
626
|
const icon = resolveNodeIcon(id, record, classes.icon);
|
|
549
627
|
record.props.symbol = icon.symbol;
|
|
@@ -731,6 +809,80 @@ export function createNativeHost(options) {
|
|
|
731
809
|
installLinkListener(node);
|
|
732
810
|
return node;
|
|
733
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
|
+
}
|
|
734
886
|
const overlayPresenter = createNativeOverlayPresenter({
|
|
735
887
|
canFocus: options.views?.capabilities.focus === !0,
|
|
736
888
|
canPresentNonModal: options.views?.capabilities.nonModalPresentation === !0,
|
|
@@ -1205,10 +1357,12 @@ export function createNativeHost(options) {
|
|
|
1205
1357
|
record.baseStyle.display = record.shownDisplay;
|
|
1206
1358
|
record.shownDisplay = void 0;
|
|
1207
1359
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1360
|
+
if (record.materialized) {
|
|
1361
|
+
record.style = resolveStyle(record, node.__stxId);
|
|
1362
|
+
const display = visible ? irDisplay(record.style.display) : "none";
|
|
1211
1363
|
emit({ op: "updateNode", id: node.__stxId, patch: { style: { display } } });
|
|
1364
|
+
} else
|
|
1365
|
+
record.styleDirty = !0;
|
|
1212
1366
|
if (was !== visible)
|
|
1213
1367
|
refreshDividers(node.__stxOwner);
|
|
1214
1368
|
return was;
|
|
@@ -1219,56 +1373,27 @@ export function createNativeHost(options) {
|
|
|
1219
1373
|
return anchor;
|
|
1220
1374
|
},
|
|
1221
1375
|
clone(node) {
|
|
1222
|
-
const source = descriptorOf(node),
|
|
1223
|
-
|
|
1224
|
-
copy.__stxOwner = node.__stxOwner;
|
|
1225
|
-
decoratePosition(copy);
|
|
1226
|
-
if (node.__stxScope !== void 0)
|
|
1227
|
-
copy.__stxScope = node.__stxScope;
|
|
1228
|
-
const descriptor = source ?? {
|
|
1229
|
-
type: "View",
|
|
1230
|
-
props: {},
|
|
1231
|
-
style: {},
|
|
1232
|
-
baseStyle: {},
|
|
1233
|
-
classes: "",
|
|
1234
|
-
events: {},
|
|
1235
|
-
children: [],
|
|
1236
|
-
visible: !0,
|
|
1237
|
-
materialized: !0
|
|
1238
|
-
};
|
|
1239
|
-
records.set(copy.__stxId, {
|
|
1240
|
-
type: descriptor.type,
|
|
1241
|
-
key: descriptor.key,
|
|
1242
|
-
props: { ...descriptor.props, __stxId: copy.__stxId },
|
|
1243
|
-
style: { ...descriptor.style },
|
|
1244
|
-
baseStyle: { ...descriptor.baseStyle },
|
|
1245
|
-
layoutDefaults: { ...descriptor.layoutDefaults },
|
|
1246
|
-
styleSource: descriptor.styleSource,
|
|
1247
|
-
styleAncestors: descriptor.styleAncestors,
|
|
1248
|
-
inheritedVariables: descriptor.inheritedVariables,
|
|
1249
|
-
variables: descriptor.variables,
|
|
1250
|
-
boundStyle: descriptor.boundStyle,
|
|
1251
|
-
classes: descriptor.classes,
|
|
1252
|
-
forwardedClasses: descriptor.forwardedClasses,
|
|
1253
|
-
forwardedStyle: descriptor.forwardedStyle,
|
|
1254
|
-
events: { ...descriptor.events },
|
|
1255
|
-
text: descriptor.text,
|
|
1256
|
-
children: [],
|
|
1257
|
-
visible: descriptor.visible,
|
|
1258
|
-
materialized: !1,
|
|
1259
|
-
controlDefaults: descriptor.controlDefaults
|
|
1260
|
-
});
|
|
1261
|
-
decorateControl(copy, descriptor.type);
|
|
1262
|
-
setConnected(copy, !1);
|
|
1263
|
-
installLinkListener(copy);
|
|
1264
|
-
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 ?? []) {
|
|
1265
1378
|
const childCopy = this.clone(child);
|
|
1266
1379
|
this.insert(copy, childCopy);
|
|
1267
1380
|
}
|
|
1268
1381
|
return copy;
|
|
1269
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
|
+
},
|
|
1270
1390
|
insert(parent, node, before) {
|
|
1271
|
-
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;
|
|
1272
1397
|
if (existing !== -1) {
|
|
1273
1398
|
record.children.splice(existing, 1);
|
|
1274
1399
|
if (isView && record.viewCount !== void 0)
|
|
@@ -1300,7 +1425,7 @@ export function createNativeHost(options) {
|
|
|
1300
1425
|
notifyChildren(parent);
|
|
1301
1426
|
if (node.__stxAnchor !== void 0 || !record.materialized)
|
|
1302
1427
|
return;
|
|
1303
|
-
materialize(node);
|
|
1428
|
+
materialize(node, record.variables);
|
|
1304
1429
|
let nativeIndex = 0;
|
|
1305
1430
|
if (index <= record.children.length >> 1) {
|
|
1306
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}
|