@stacksjs/stx 0.2.606 → 0.2.611
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-02dcqhzy.js +2 -0
- package/dist/{chunk-vw62fjpv.js → chunk-0ff64x1p.js} +3 -3
- package/dist/chunk-0fgp13q4.js +2 -0
- package/dist/chunk-0gpjks6k.js +2 -0
- package/dist/chunk-1239cnda.js +2 -0
- package/dist/chunk-1qx531pp.js +2 -0
- package/dist/chunk-24tx4ysv.js +2 -0
- package/dist/{chunk-zs3ezqy3.js → chunk-2h8xmmtk.js} +1 -1
- package/dist/{chunk-6xsm53pz.js → chunk-2pgvbe5x.js} +4 -4
- package/dist/chunk-2pkx524z.js +2 -0
- package/dist/{chunk-0v89nfz1.js → chunk-2y0qy214.js} +2 -2
- package/dist/chunk-2y80c34h.js +2 -0
- package/dist/{chunk-tbsjg23k.js → chunk-2z56183d.js} +4 -4
- package/dist/{chunk-vntpfbwy.js → chunk-34x22hbs.js} +1 -1
- package/dist/{chunk-qh07a85k.js → chunk-39fqkzyb.js} +3 -3
- package/dist/{chunk-81qmj3sd.js → chunk-3d658f6n.js} +7 -7
- package/dist/{chunk-tyb481p0.js → chunk-3v862v2c.js} +1 -1
- package/dist/{chunk-5s47qfp6.js → chunk-3wmt7ykt.js} +2 -2
- package/dist/chunk-4j3fmxeg.js +2 -0
- package/dist/{chunk-y54fz9rk.js → chunk-4rtxkqwh.js} +2 -2
- package/dist/chunk-5f330rrj.js +2 -0
- package/dist/{chunk-s4pjf2pc.js → chunk-5rtatjwq.js} +2 -2
- package/dist/{chunk-wzjf33es.js → chunk-5vnx8dmz.js} +2 -2
- package/dist/chunk-5ys7azpj.js +2 -0
- package/dist/chunk-64vnwrkw.js +2 -0
- package/dist/chunk-65jsp5fd.js +3 -0
- package/dist/{chunk-bsy8v1xj.js → chunk-66e4ga0z.js} +3 -3
- package/dist/{chunk-4tj0ap61.js → chunk-6yrjyrc2.js} +5 -5
- package/dist/{chunk-td5100fz.js → chunk-70n1t4ht.js} +7 -7
- package/dist/chunk-7446n6a3.js +2 -0
- package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
- package/dist/chunk-76ebcf61.js +2 -0
- package/dist/chunk-7aa4qncj.js +2 -0
- package/dist/chunk-7awf2gqs.js +2 -0
- package/dist/{chunk-vm2d4hap.js → chunk-7g47wdd9.js} +3 -3
- package/dist/{chunk-m9h7pmkh.js → chunk-8211vr9v.js} +5 -5
- package/dist/chunk-84f8tft8.js +2 -0
- package/dist/{chunk-yzj55rfs.js → chunk-8f616tym.js} +3 -3
- package/dist/chunk-8t8wf1w2.js +2 -0
- package/dist/chunk-961nvcxw.js +43 -0
- package/dist/{chunk-xjxc4q3w.js → chunk-999d4sns.js} +21 -21
- package/dist/{chunk-r4h8fg1x.js → chunk-9dx519z6.js} +1 -1
- package/dist/{chunk-dnqq1ze0.js → chunk-9kzdk4na.js} +3 -3
- package/dist/chunk-9mmy9m0y.js +2 -0
- package/dist/{chunk-bhf9yt2w.js → chunk-9n7ehv7w.js} +2 -2
- package/dist/{chunk-dmdhbwmn.js → chunk-9nh7vxk1.js} +3 -3
- package/dist/chunk-9vxdjpn5.js +2 -0
- package/dist/chunk-aw79nm5c.js +127 -0
- package/dist/chunk-brbybne9.js +2 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-azpkje69.js → chunk-cjrfazzb.js} +34 -10
- package/dist/chunk-cjvq46n8.js +3 -0
- package/dist/chunk-cwvazqab.js +2 -0
- package/dist/{chunk-67tpacz0.js → chunk-cwxkgbck.js} +1 -1
- package/dist/chunk-d17mhbz9.js +2850 -0
- package/dist/{chunk-vp3fzjsc.js → chunk-det49x62.js} +2 -2
- package/dist/{chunk-tydv84gj.js → chunk-dtt7k0bz.js} +2 -2
- package/dist/{chunk-5taenpfg.js → chunk-e98jqwnf.js} +1 -1
- package/dist/{chunk-y9a9cvke.js → chunk-eg5yfnrn.js} +33 -33
- package/dist/chunk-ekfmad19.js +2 -0
- package/dist/{chunk-ghdyqt98.js → chunk-ewsd3apq.js} +2 -2
- package/dist/chunk-exwjabr5.js +2 -0
- package/dist/chunk-f19bzr36.js +2 -0
- package/dist/{chunk-5e182xqt.js → chunk-f8tts10s.js} +1 -1
- package/dist/chunk-fa0aa98d.js +2 -0
- package/dist/chunk-fgrjv29d.js +18 -0
- package/dist/chunk-fjx1sbg2.js +2 -0
- package/dist/{chunk-sswjv8p9.js → chunk-g22q68ds.js} +2 -2
- package/dist/chunk-g24kapd5.js +2 -0
- package/dist/{chunk-9734nkc8.js → chunk-gbk2dbt1.js} +4 -4
- package/dist/{chunk-rmv35cx0.js → chunk-gk4c8d1c.js} +2 -2
- package/dist/{chunk-mtxs4fya.js → chunk-gn75qghq.js} +1 -1
- package/dist/chunk-gvv4d0tp.js +2 -0
- package/dist/chunk-h3fr7c5y.js +2 -0
- package/dist/{chunk-mn7a5b55.js → chunk-h3tzc41t.js} +2 -2
- package/dist/{chunk-vehtypx0.js → chunk-h7y89m22.js} +2 -2
- package/dist/{chunk-1jxdkp8x.js → chunk-hj49vk9e.js} +6 -6
- package/dist/chunk-hjp38m0w.js +3 -0
- package/dist/chunk-hwt7pyqt.js +2 -0
- package/dist/{chunk-x8q5przn.js → chunk-hxzy2t7r.js} +11 -11
- package/dist/{chunk-tcd2zez3.js → chunk-j18z5nxq.js} +2 -2
- package/dist/chunk-jp1xjh1f.js +2 -0
- package/dist/chunk-jrccxnbt.js +2 -0
- package/dist/chunk-jv3rdes9.js +2 -0
- package/dist/chunk-k36ve5ct.js +2 -0
- package/dist/chunk-k5vytrbx.js +2 -0
- package/dist/chunk-k7vg01vv.js +2 -0
- package/dist/chunk-kayh4pcw.js +2 -0
- package/dist/chunk-myg6gz76.js +2 -0
- package/dist/{chunk-jpxekhdh.js → chunk-n05hxy7w.js} +3 -3
- package/dist/{chunk-t9t66sz4.js → chunk-n1qr6n92.js} +6 -6
- package/dist/{chunk-4dfqgmgs.js → chunk-n4f3fzp5.js} +85 -85
- package/dist/chunk-n6tspwf9.js +2 -0
- package/dist/{chunk-w67rrd1f.js → chunk-nd8yx3qq.js} +10 -10
- package/dist/chunk-nfdma5hp.js +2 -0
- package/dist/chunk-ng819bkf.js +2 -0
- package/dist/{chunk-kxjd6e2h.js → chunk-pc15w7bb.js} +2 -2
- package/dist/{chunk-z8fhtym2.js → chunk-pkgmyg4r.js} +2 -2
- package/dist/{chunk-53y4z4p2.js → chunk-pm1gnjs5.js} +3 -3
- package/dist/{chunk-6by8dtan.js → chunk-pmpqzqq8.js} +2 -2
- package/dist/chunk-pnyxqze0.js +2 -0
- package/dist/{chunk-cfpenvc7.js → chunk-pyqrj2wk.js} +3 -3
- package/dist/chunk-qa5c5x2n.js +2 -0
- package/dist/chunk-qqenm7pg.js +40 -0
- package/dist/{chunk-rg7wvcqw.js → chunk-r4xnqag4.js} +2 -2
- package/dist/chunk-r8a96bbd.js +2 -0
- package/dist/{chunk-3cnwstra.js → chunk-s5s1w8na.js} +2 -2
- package/dist/chunk-sakagfdq.js +2 -0
- package/dist/chunk-sj0bkdy8.js +2 -0
- package/dist/chunk-spkwmfbm.js +2 -0
- package/dist/chunk-swv69q75.js +4 -0
- package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
- package/dist/{chunk-htf3z9et.js → chunk-tk50q4zs.js} +12 -12
- package/dist/chunk-v6xk1q66.js +2 -0
- package/dist/{chunk-zs3tmd12.js → chunk-vep8d57h.js} +1 -1
- package/dist/chunk-vfk3vn6j.js +2 -0
- package/dist/{chunk-vvfpb3k3.js → chunk-vyjwag3f.js} +9 -9
- package/dist/{chunk-w8g2ppnr.js → chunk-w0h27sf8.js} +2 -2
- package/dist/chunk-w1szscbz.js +2 -0
- package/dist/{chunk-20k77e2a.js → chunk-wa26bn4s.js} +4 -4
- package/dist/chunk-wb9rbwb1.js +2 -0
- package/dist/{chunk-td30jg06.js → chunk-wdy6y0fq.js} +2 -2
- package/dist/chunk-wkx2m2br.js +2 -0
- package/dist/{chunk-mvwcf4xy.js → chunk-wyndxr8w.js} +4 -4
- package/dist/chunk-x73w6v8m.js +2 -0
- package/dist/{chunk-fwp1en28.js → chunk-x8y7yqwh.js} +7 -7
- package/dist/{chunk-7095f0hb.js → chunk-xap2cbkd.js} +9 -9
- package/dist/{chunk-s45envb5.js → chunk-xh98677z.js} +5 -5
- package/dist/chunk-yagzr2ry.js +2 -0
- package/dist/chunk-yda8t21j.js +2 -0
- package/dist/{chunk-efy3038a.js → chunk-ydz9j0d3.js} +2 -2
- package/dist/chunk-yydx0sfy.js +2 -0
- package/dist/{chunk-r69jfs59.js → chunk-z79gnz6z.js} +1 -1
- package/dist/{chunk-vhajhs44.js → chunk-z7ezxqmg.js} +5 -5
- package/dist/{chunk-k3f4044e.js → chunk-zatgmkx7.js} +2 -2
- package/dist/chunk-zg0z8qt6.js +2 -0
- package/dist/{chunk-y6gj9jq8.js → chunk-znwnacwz.js} +5 -5
- package/dist/cli.js +46 -46
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/expressions.d.ts +0 -23
- package/dist/expressions.js +14 -11
- package/dist/includes.js +6 -0
- package/dist/native/compiler/component-mapping.js +1 -0
- package/dist/native/compiler/headwind-to-style.js +17 -0
- package/dist/native/compiler/html-to-ir.js +2 -0
- package/dist/native/compiler/inline-style.js +2 -0
- package/dist/native/compiler/ir.d.ts +3 -1
- package/dist/native/components/primitives.d.ts +66 -20
- package/dist/native/components/primitives.js +1 -0
- package/dist/native/event-names.js +1 -0
- package/dist/native/primitives/MapPolygon.stx +2 -0
- package/dist/native/prop-names.js +4 -4
- package/dist/native/runtime/craft-bridge.js +22 -1
- package/dist/native/runtime/craft.d.ts +10 -0
- package/dist/process.js +3 -2
- package/dist/pwa.js +3 -3
- package/dist/script-validation.js +4 -4
- package/dist/serve.js +5 -1
- package/dist/server-bindings.js +5 -2
- package/dist/ssg.js +13 -13
- package/dist/utils.js +15 -2
- package/package.json +5 -5
- package/dist/chunk-06wv8qwy.js +0 -40
- package/dist/chunk-0d6b3eeb.js +0 -2
- package/dist/chunk-1e28n9q2.js +0 -2
- package/dist/chunk-1fdrhfc0.js +0 -2
- package/dist/chunk-1veeefpn.js +0 -2
- package/dist/chunk-2r4an7bh.js +0 -2
- package/dist/chunk-304vaxnk.js +0 -2
- package/dist/chunk-327bt8zb.js +0 -2
- package/dist/chunk-36n8yz6t.js +0 -2
- package/dist/chunk-3gm6013p.js +0 -2
- package/dist/chunk-3ttnn4t3.js +0 -2
- package/dist/chunk-3yttgk0s.js +0 -2
- package/dist/chunk-4ck2xc8m.js +0 -2
- package/dist/chunk-4jasfhh6.js +0 -2
- package/dist/chunk-605c6zks.js +0 -2
- package/dist/chunk-61d0gr5b.js +0 -2
- package/dist/chunk-7renf4zp.js +0 -2
- package/dist/chunk-8t3c2myr.js +0 -2
- package/dist/chunk-8x2ejkcc.js +0 -2
- package/dist/chunk-915s0may.js +0 -2
- package/dist/chunk-93na8hh0.js +0 -2
- package/dist/chunk-9fpnnfr3.js +0 -2
- package/dist/chunk-9zwdpa7p.js +0 -18
- package/dist/chunk-ajd5w5c4.js +0 -2
- package/dist/chunk-b4tbqz8r.js +0 -2
- package/dist/chunk-be2kmw0p.js +0 -2
- package/dist/chunk-bkjre6xk.js +0 -127
- package/dist/chunk-bnpb6ez9.js +0 -2
- package/dist/chunk-c0h9cxew.js +0 -2
- package/dist/chunk-cw76y2p5.js +0 -2
- package/dist/chunk-d0kes50w.js +0 -2
- package/dist/chunk-dzbkgsv8.js +0 -4
- package/dist/chunk-dzekcand.js +0 -2
- package/dist/chunk-en388k3h.js +0 -2
- package/dist/chunk-ewkza45r.js +0 -2
- package/dist/chunk-fcgf8d5k.js +0 -2
- package/dist/chunk-fese2cf6.js +0 -2
- package/dist/chunk-gk7mmc2e.js +0 -2
- package/dist/chunk-gw2dvp35.js +0 -2
- package/dist/chunk-h9drxwva.js +0 -2
- package/dist/chunk-hrr7k1qc.js +0 -2
- package/dist/chunk-j04brkj0.js +0 -2
- package/dist/chunk-jbvwg4gs.js +0 -2
- package/dist/chunk-jshj69dy.js +0 -2
- package/dist/chunk-k7spjpr0.js +0 -2
- package/dist/chunk-kgvm5ytn.js +0 -2
- package/dist/chunk-km9a5gp4.js +0 -2
- package/dist/chunk-m95zjk91.js +0 -3
- package/dist/chunk-mfery7a4.js +0 -2
- package/dist/chunk-n35yc890.js +0 -3
- package/dist/chunk-n882b1fy.js +0 -2
- package/dist/chunk-p8sv5fqs.js +0 -2
- package/dist/chunk-pndhb1nk.js +0 -2
- package/dist/chunk-pt7e0be5.js +0 -2
- package/dist/chunk-q40ahbjs.js +0 -2
- package/dist/chunk-qjxxhdv7.js +0 -2
- package/dist/chunk-qygr4pv8.js +0 -2
- package/dist/chunk-r4wqh5fd.js +0 -2845
- package/dist/chunk-rp93n4z7.js +0 -3
- package/dist/chunk-rrw2jg26.js +0 -2
- package/dist/chunk-wjhhb6dn.js +0 -2
- package/dist/chunk-wm8w2721.js +0 -2
- package/dist/chunk-wy53pys4.js +0 -43
- package/dist/chunk-y2wr7c9e.js +0 -2
- package/dist/chunk-y8jjmwa9.js +0 -2
- package/dist/chunk-yn2d8x8m.js +0 -3
- package/dist/chunk-z8mdsjzw.js +0 -2
- package/dist/chunk-zg87pybq.js +0 -2
package/dist/expressions.d.ts
CHANGED
|
@@ -101,29 +101,6 @@ export declare function escapeHtml(unsafe: string): string;
|
|
|
101
101
|
* decodes references before anything reads them.
|
|
102
102
|
*/
|
|
103
103
|
export declare function escapeHtmlValue(unsafe: string): string;
|
|
104
|
-
/**
|
|
105
|
-
* A zero-width, non-breaking character, written as a reference.
|
|
106
|
-
*
|
|
107
|
-
* The character references alone stop the *server* reading a value as a
|
|
108
|
-
* template, and they are not enough: the browser decodes them, so the DOM text
|
|
109
|
-
* says `{{ 6*7 }}` again and the client runtime - which binds by scanning text
|
|
110
|
-
* for mustaches - evaluates it in the visitor's browser. Server-side injection
|
|
111
|
-
* becomes cross-site scripting, from the same stored value.
|
|
112
|
-
*
|
|
113
|
-
* A word joiner between the braces breaks the pattern for both sides while
|
|
114
|
-
* changing nothing a reader sees: it has no width, no line-breaking behaviour,
|
|
115
|
-
* and copies as an invisible character. The alternative is teaching the runtime
|
|
116
|
-
* to bind only what the compiler recorded, which is the better shape and a much
|
|
117
|
-
* larger change than a security fix should carry.
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* Check if a template uses signals (state, derived, effect) in its script blocks
|
|
121
|
-
* or has reactive attributes (@if, @for) with function call expressions
|
|
122
|
-
*
|
|
123
|
-
* `filePath` lets a script that factors its signals into an imported module be
|
|
124
|
-
* recognised too. Without it the scan is text-only, which is what every caller
|
|
125
|
-
* did before and is still correct for a script that declares its own signals.
|
|
126
|
-
*/
|
|
127
104
|
export declare function usesSignalsInScript(template: string, filePath?: string): boolean;
|
|
128
105
|
/**
|
|
129
106
|
* Where each client-side loop in `html` is, and the names it binds.
|
package/dist/expressions.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import { isDevelopment } from "./env.js";
|
|
3
3
|
import { stripCommentsAndLiterals } from "./strip-literals.js";
|
|
4
4
|
import { createSafeFunction, getExpressionSafetyRule, safeEvaluate } from "./safe-evaluator.js";
|
|
5
|
-
import { createDetailedErrorMessage } from "./utils.js";
|
|
5
|
+
import { componentClientSignalNames, createDetailedErrorMessage } from "./utils.js";
|
|
6
6
|
import { createPlaceholder } from "./placeholder.js";
|
|
7
7
|
import { neutralizeTemplateSyntax } from "./template-syntax-escape.js";
|
|
8
8
|
import { classifyHtmlInterpolation, UnsafeInterpolationContextError } from "./interpolation-context.js";
|
|
@@ -347,13 +347,15 @@ function escapeInterpolatedHtmlValue(source, offset, raw, attributeFragment = !1
|
|
|
347
347
|
return UNSAFE_URL_PREFIX + escaped;
|
|
348
348
|
return sanitizeSubstitutedUrl(schemeWindow(source, offset), raw, escaped);
|
|
349
349
|
}
|
|
350
|
+
function clientScriptBodies(scripts) {
|
|
351
|
+
return scripts.flatMap((script) => {
|
|
352
|
+
const match = script.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);
|
|
353
|
+
return !match || /\bserver\b|\bsrc\s*=/.test(match[1]) ? [] : [match[2]];
|
|
354
|
+
});
|
|
355
|
+
}
|
|
350
356
|
export function usesSignalsInScript(template, filePath) {
|
|
351
357
|
const { scripts } = stashScriptElements(template);
|
|
352
|
-
for (const
|
|
353
|
-
const match = script.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);
|
|
354
|
-
if (!match || /\bserver\b|\bsrc\s*=/.test(match[1]))
|
|
355
|
-
continue;
|
|
356
|
-
const content = match[2];
|
|
358
|
+
for (const content of clientScriptBodies(scripts)) {
|
|
357
359
|
if (/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(content))
|
|
358
360
|
return !0;
|
|
359
361
|
if (importsSignalDeclarations(content, filePath))
|
|
@@ -565,7 +567,10 @@ export function processExpressions(template, context, filePath) {
|
|
|
565
567
|
output = maskInto(output, styleMatcher, styleBlocks, (n) => `<!--__STX_STYLE_${n}__-->`);
|
|
566
568
|
const scriptBlocks = [];
|
|
567
569
|
output = maskInto(output, matchScriptElement, scriptBlocks, (n) => `<!--__STX_SCRIPT_EXPR_${n}__-->`);
|
|
568
|
-
const hasSignals = context?.__stx_signals_gate === !0 || usesSignalsInScript(template), clientSignalNames = new Set(
|
|
570
|
+
const hasSignals = context?.__stx_signals_gate === !0 || usesSignalsInScript(template), clientSignalNames = new Set([
|
|
571
|
+
...Array.isArray(context?.__stx_client_signal_names) ? context.__stx_client_signal_names : [],
|
|
572
|
+
...componentClientSignalNames(clientScriptBodies(scriptBlocks))
|
|
573
|
+
]), preservedClientExpressions = new Set(Array.isArray(context?.__stx_preserved_client_expressions) ? context.__stx_preserved_client_expressions : []);
|
|
569
574
|
output = replaceInterpolations(output, (match, expr, offset) => {
|
|
570
575
|
try {
|
|
571
576
|
const value = evaluateExpression(expr, context, !1, (r) => warnRejectedExpression(r, match, filePath, template));
|
|
@@ -607,13 +612,13 @@ export function processExpressions(template, context, filePath) {
|
|
|
607
612
|
const jsBuiltins = ["parseInt", "parseFloat", "String", "Number", "Boolean", "Array", "Object", "JSON", "Math", "Date", "encodeURIComponent", "decodeURIComponent", "encodeURI", "decodeURI", "true", "false", "null", "undefined"], identifierPattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)/, firstVarName = trimmedExpr.match(identifierPattern)?.[1], firstVarInContext = firstVarName && ((firstVarName in context) || jsBuiltins.includes(firstVarName)), firstVarIsClientSignal = Boolean(firstVarName && clientSignalNames.has(firstVarName)), directFunctionCall = /^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/, directFuncMatch = trimmedExpr.match(directFunctionCall), isLikelySignal = directFuncMatch && !jsBuiltins.includes(directFuncMatch[1]) && !(directFuncMatch[1] in context);
|
|
608
613
|
if (/^__[A-Z_]+__$/.test(trimmedExpr))
|
|
609
614
|
return "";
|
|
615
|
+
if (firstVarIsClientSignal)
|
|
616
|
+
return match;
|
|
610
617
|
let rejection;
|
|
611
618
|
try {
|
|
612
619
|
const value = evaluateExpression(expr, context, !1, (r) => {
|
|
613
620
|
rejection = r;
|
|
614
621
|
});
|
|
615
|
-
if (firstVarIsClientSignal)
|
|
616
|
-
return match;
|
|
617
622
|
if (hasSignals && !expressionUsesOnlyContextVars(trimmedExpr, context))
|
|
618
623
|
return match;
|
|
619
624
|
if (rejection)
|
|
@@ -627,8 +632,6 @@ export function processExpressions(template, context, filePath) {
|
|
|
627
632
|
} catch (error) {
|
|
628
633
|
if (error instanceof UnsafeInterpolationContextError)
|
|
629
634
|
throw error;
|
|
630
|
-
if (firstVarIsClientSignal)
|
|
631
|
-
return match;
|
|
632
635
|
if (hasSignals && !expressionUsesOnlyContextVars(trimmedExpr, context))
|
|
633
636
|
return match;
|
|
634
637
|
if (isLikelySignal)
|
package/dist/includes.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { StxValidationError } from "./errors/types.js";
|
|
2
|
+
import { validateClientScript } from "./script-validation.js";
|
|
1
3
|
import { findSfcTemplateBlock } from "./sfc-template.js";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import { existsSync } from "node:fs";
|
|
@@ -663,6 +665,8 @@ export async function processIncludes(template, context, filePath, options, depe
|
|
|
663
665
|
if (isDataBlockScript(scriptAttrs))
|
|
664
666
|
continue;
|
|
665
667
|
const isServerScript = scriptAttrs.includes("server"), shouldTranspile = shouldTranspileTypeScript(scriptAttrs);
|
|
668
|
+
if (!isServerScript && !/\bsrc\s*=/i.test(scriptAttrs))
|
|
669
|
+
validateClientScript(scriptContent, includeFilePath, options.strict);
|
|
666
670
|
if (!isServerScript && scriptContent.trim()) {
|
|
667
671
|
const { interpolateScriptExpressions } = await import("./expressions.js");
|
|
668
672
|
scriptContent = interpolateScriptExpressions(scriptContent, includeContext, includePath);
|
|
@@ -777,6 +781,8 @@ ${scriptContent}`;
|
|
|
777
781
|
` + preservedScript;
|
|
778
782
|
return processedContent;
|
|
779
783
|
} catch (error) {
|
|
784
|
+
if (error instanceof StxValidationError)
|
|
785
|
+
throw error;
|
|
780
786
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
781
787
|
return includeFailure(includePath, `Error processing include ${includePath}: ${errorMessage}`, templateStr, offsetPos);
|
|
782
788
|
}
|
|
@@ -503,6 +503,18 @@ const classParsers = {
|
|
|
503
503
|
style.flexShrink = 0;
|
|
504
504
|
return !0;
|
|
505
505
|
},
|
|
506
|
+
"order-first": (_, style) => {
|
|
507
|
+
style.order = -9999;
|
|
508
|
+
return !0;
|
|
509
|
+
},
|
|
510
|
+
"order-last": (_, style) => {
|
|
511
|
+
style.order = 9999;
|
|
512
|
+
return !0;
|
|
513
|
+
},
|
|
514
|
+
"order-none": (_, style) => {
|
|
515
|
+
style.order = 0;
|
|
516
|
+
return !0;
|
|
517
|
+
},
|
|
506
518
|
"justify-start": (_, style) => {
|
|
507
519
|
style.justifyContent = "flex-start";
|
|
508
520
|
return !0;
|
|
@@ -1303,6 +1315,11 @@ export function compileHeadwindToStyle(classes, unknown) {
|
|
|
1303
1315
|
continue;
|
|
1304
1316
|
if (parseGridColumns(className, style))
|
|
1305
1317
|
continue;
|
|
1318
|
+
const order = /^order-\[(-?\d+)\]$/.exec(className) ?? /^order-(-?\d+)$/.exec(className);
|
|
1319
|
+
if (order) {
|
|
1320
|
+
style.order = Number(order[1]);
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1306
1323
|
if (parsePosition(className, style))
|
|
1307
1324
|
continue;
|
|
1308
1325
|
if (parseTranslation(className, style))
|
|
@@ -12,6 +12,7 @@ import { createDocument, createNode } from "./ir.js";
|
|
|
12
12
|
const DROP_SUBTREE = new Set(["script", "style", "head", "meta", "link", "title", "base", "noscript"]), UNWRAP = new Set(["template", "body", "html", "main", "fragment"]), BOX_ONLY = new Set;
|
|
13
13
|
export const NATIVE_EVENTS = new Set([
|
|
14
14
|
"onBlur",
|
|
15
|
+
"onChange",
|
|
15
16
|
"onChangeText",
|
|
16
17
|
"onDismiss",
|
|
17
18
|
"onEnd",
|
|
@@ -65,6 +66,7 @@ const NATIVE_TYPES = new Set([
|
|
|
65
66
|
"Video",
|
|
66
67
|
"Map",
|
|
67
68
|
"MapPolyline",
|
|
69
|
+
"MapPolygon",
|
|
68
70
|
"MapMarker",
|
|
69
71
|
"FlatList",
|
|
70
72
|
"SectionList",
|
|
@@ -16,6 +16,7 @@ const STYLE_KEYS = new Set([
|
|
|
16
16
|
"flexBasis",
|
|
17
17
|
"flexDirection",
|
|
18
18
|
"flexWrap",
|
|
19
|
+
"order",
|
|
19
20
|
"justifyContent",
|
|
20
21
|
"alignItems",
|
|
21
22
|
"alignSelf",
|
|
@@ -102,6 +103,7 @@ const STYLE_KEYS = new Set([
|
|
|
102
103
|
"flex",
|
|
103
104
|
"flexGrow",
|
|
104
105
|
"flexShrink",
|
|
106
|
+
"order",
|
|
105
107
|
"zIndex",
|
|
106
108
|
"aspectRatio",
|
|
107
109
|
"gap",
|
|
@@ -54,6 +54,7 @@ export declare interface STXStyle {
|
|
|
54
54
|
flexBasis?: number | string
|
|
55
55
|
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
56
56
|
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse'
|
|
57
|
+
order?: number
|
|
57
58
|
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
58
59
|
alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'
|
|
59
60
|
alignSelf?: 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'
|
|
@@ -130,7 +131,7 @@ export declare interface STXStyle {
|
|
|
130
131
|
textDecorationLine?: 'none' | 'underline' | 'line-through' | 'underline line-through'
|
|
131
132
|
textDecorationColor?: string
|
|
132
133
|
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
133
|
-
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
134
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
134
135
|
tintColor?: string
|
|
135
136
|
transform?: Array<
|
|
136
137
|
| { perspective: number }
|
|
@@ -215,6 +216,7 @@ export type STXComponentType = | 'Sidebar'
|
|
|
215
216
|
| 'Video'
|
|
216
217
|
| 'Map'
|
|
217
218
|
| 'MapPolyline'
|
|
219
|
+
| 'MapPolygon'
|
|
218
220
|
| 'MapMarker'
|
|
219
221
|
// Lists
|
|
220
222
|
| 'FlatList'
|
|
@@ -23,6 +23,7 @@ export declare const ComponentRegistry: {
|
|
|
23
23
|
Video: 'Video';
|
|
24
24
|
Map: 'Map';
|
|
25
25
|
MapPolyline: 'MapPolyline';
|
|
26
|
+
MapPolygon: 'MapPolygon';
|
|
26
27
|
MapMarker: 'MapMarker';
|
|
27
28
|
FlatList: 'FlatList';
|
|
28
29
|
SectionList: 'SectionList';
|
|
@@ -41,29 +42,41 @@ export declare interface BaseProps {
|
|
|
41
42
|
testID?: string
|
|
42
43
|
accessibilityLabel?: string
|
|
43
44
|
accessibilityHint?: string
|
|
45
|
+
accessibilityValue?: string | number
|
|
46
|
+
accessibilityState?: AccessibilityState
|
|
44
47
|
accessibilityRole?: AccessibilityRole
|
|
45
48
|
listRole?: 'header' | 'item' | 'separator' | 'empty' | 'footer'
|
|
46
49
|
transitionID?: string
|
|
47
50
|
}
|
|
51
|
+
export declare interface AccessibilityState {
|
|
52
|
+
disabled?: boolean
|
|
53
|
+
selected?: boolean
|
|
54
|
+
checked?: boolean
|
|
55
|
+
}
|
|
48
56
|
// ============================================================================
|
|
49
57
|
// Layout Components
|
|
50
58
|
// ============================================================================
|
|
51
59
|
export declare interface ViewProps extends BaseProps {
|
|
52
60
|
onPress?: () => void
|
|
61
|
+
onClick?: () => void
|
|
53
62
|
onLongPress?: () => void
|
|
54
63
|
onLayout?: (event: LayoutEvent) => void
|
|
55
|
-
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only'
|
|
56
64
|
}
|
|
57
65
|
export declare interface ScrollViewProps extends ViewProps {
|
|
58
66
|
horizontal?: boolean
|
|
59
67
|
showsHorizontalScrollIndicator?: boolean
|
|
60
68
|
showsVerticalScrollIndicator?: boolean
|
|
61
69
|
bounces?: boolean
|
|
70
|
+
alwaysBounceHorizontal?: boolean
|
|
71
|
+
alwaysBounceVertical?: boolean
|
|
62
72
|
onScroll?: (event: ScrollEvent) => void
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
onScrollBeginDrag?: (event: ScrollEvent) => void
|
|
74
|
+
onScrollEndDrag?: (event: ScrollEvent) => void
|
|
75
|
+
onMomentumScrollBegin?: (event: ScrollEvent) => void
|
|
76
|
+
onMomentumScrollEnd?: (event: ScrollEvent) => void
|
|
65
77
|
contentContainerStyle?: STXStyle
|
|
66
78
|
keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'
|
|
79
|
+
keyboardShouldPersistTaps?: 'always' | 'handled' | 'never'
|
|
67
80
|
refreshControl?: RefreshControlProps
|
|
68
81
|
stickyHeaderIndices?: number[]
|
|
69
82
|
scrollTarget?: string | { id: string, key?: string | number, animated?: boolean } | null
|
|
@@ -85,6 +98,7 @@ export declare interface TextProps extends BaseProps {
|
|
|
85
98
|
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip'
|
|
86
99
|
selectable?: boolean
|
|
87
100
|
onPress?: () => void
|
|
101
|
+
onClick?: () => void
|
|
88
102
|
onLongPress?: () => void
|
|
89
103
|
}
|
|
90
104
|
export declare interface TextInputProps extends BaseProps {
|
|
@@ -93,9 +107,11 @@ export declare interface TextInputProps extends BaseProps {
|
|
|
93
107
|
placeholder?: string
|
|
94
108
|
placeholderTextColor?: string
|
|
95
109
|
onChangeText?: (text: string) => void
|
|
110
|
+
onChange?: (text: string) => void
|
|
96
111
|
onFocus?: () => void
|
|
97
112
|
onBlur?: () => void
|
|
98
113
|
onSubmitEditing?: () => void
|
|
114
|
+
onEndEditing?: () => void
|
|
99
115
|
keyboardType?: KeyboardType
|
|
100
116
|
returnKeyType?: ReturnKeyType
|
|
101
117
|
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
|
|
@@ -104,6 +120,7 @@ export declare interface TextInputProps extends BaseProps {
|
|
|
104
120
|
secureTextEntry?: boolean
|
|
105
121
|
maxLength?: number
|
|
106
122
|
multiline?: boolean
|
|
123
|
+
numberOfLines?: number
|
|
107
124
|
editable?: boolean
|
|
108
125
|
selectionColor?: string
|
|
109
126
|
textContentType?: string
|
|
@@ -116,6 +133,7 @@ export declare interface TextInputProps extends BaseProps {
|
|
|
116
133
|
export declare interface ButtonProps extends BaseProps {
|
|
117
134
|
title?: string
|
|
118
135
|
onPress?: () => void
|
|
136
|
+
onClick?: () => void
|
|
119
137
|
disabled?: boolean
|
|
120
138
|
color?: string
|
|
121
139
|
}
|
|
@@ -125,6 +143,7 @@ export declare interface LinkProps extends BaseProps {
|
|
|
125
143
|
to?: string
|
|
126
144
|
title?: string
|
|
127
145
|
onPress?: () => void
|
|
146
|
+
onClick?: () => void
|
|
128
147
|
disabled?: boolean
|
|
129
148
|
color?: string
|
|
130
149
|
}
|
|
@@ -143,17 +162,11 @@ export declare interface PressableProps extends ViewProps {
|
|
|
143
162
|
disabled?: boolean
|
|
144
163
|
onPressIn?: () => void
|
|
145
164
|
onPressOut?: () => void
|
|
146
|
-
hitSlop?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
147
|
-
pressRetentionOffset?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
148
|
-
android_ripple?: {
|
|
149
|
-
color?: string
|
|
150
|
-
borderless?: boolean
|
|
151
|
-
radius?: number
|
|
152
|
-
}
|
|
153
165
|
}
|
|
154
166
|
export declare interface SwitchProps extends BaseProps {
|
|
155
167
|
value?: boolean
|
|
156
168
|
onValueChange?: (value: boolean) => void
|
|
169
|
+
onChange?: (value: boolean) => void
|
|
157
170
|
disabled?: boolean
|
|
158
171
|
trackColor?: { false?: string; true?: string }
|
|
159
172
|
thumbColor?: string
|
|
@@ -166,6 +179,7 @@ export declare interface CheckboxProps extends BaseProps {
|
|
|
166
179
|
indeterminate?: boolean
|
|
167
180
|
label?: string
|
|
168
181
|
onValueChange?: (value: boolean) => void
|
|
182
|
+
onChange?: (value: boolean) => void
|
|
169
183
|
disabled?: boolean
|
|
170
184
|
color?: string
|
|
171
185
|
}
|
|
@@ -175,6 +189,7 @@ export declare interface SliderProps extends BaseProps {
|
|
|
175
189
|
maximumValue?: number
|
|
176
190
|
step?: number
|
|
177
191
|
onValueChange?: (value: number) => void
|
|
192
|
+
onChange?: (value: number) => void
|
|
178
193
|
onSlidingComplete?: (value: number) => void
|
|
179
194
|
disabled?: boolean
|
|
180
195
|
minimumTrackTintColor?: string
|
|
@@ -189,6 +204,7 @@ export declare interface PickerProps extends BaseProps {
|
|
|
189
204
|
items: PickerOption[]
|
|
190
205
|
selectedValue?: string | number
|
|
191
206
|
onValueChange?: (value: string | number, index: number) => void
|
|
207
|
+
onChange?: (value: string | number, index: number) => void
|
|
192
208
|
disabled?: boolean
|
|
193
209
|
}
|
|
194
210
|
/** A value as `<input type="date|time|datetime-local">` writes it. */
|
|
@@ -205,6 +221,7 @@ export declare interface DatePickerProps extends BaseProps {
|
|
|
205
221
|
minuteInterval?: number
|
|
206
222
|
display?: 'compact' | 'inline' | 'wheels'
|
|
207
223
|
onValueChange?: (event: DatePickerChange) => void
|
|
224
|
+
onChange?: (event: DatePickerChange) => void
|
|
208
225
|
disabled?: boolean
|
|
209
226
|
}
|
|
210
227
|
/** Iconify or SF Symbol rendered by the platform's native icon view. */
|
|
@@ -215,20 +232,27 @@ export declare interface IconProps extends BaseProps {
|
|
|
215
232
|
}
|
|
216
233
|
export declare interface ImageProps extends BaseProps {
|
|
217
234
|
source: ImageSource
|
|
218
|
-
|
|
235
|
+
alt?: string
|
|
236
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
219
237
|
onLoad?: () => void
|
|
220
238
|
onLoadStart?: () => void
|
|
221
239
|
onLoadEnd?: () => void
|
|
222
|
-
onError?: (
|
|
223
|
-
blurRadius?: number
|
|
224
|
-
fadeDuration?: number
|
|
240
|
+
onError?: (event: ImageErrorEvent) => void
|
|
225
241
|
defaultSource?: ImageSource
|
|
226
242
|
}
|
|
243
|
+
export declare interface ImageErrorEvent {
|
|
244
|
+
nativeEvent: {
|
|
245
|
+
error: {
|
|
246
|
+
message: string
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
227
250
|
/** A video drawn by the platform's player (AVPlayer on iOS). */
|
|
228
251
|
export declare interface VideoProps extends BaseProps {
|
|
229
252
|
source?: string | { uri: string }
|
|
230
253
|
src?: string
|
|
231
254
|
controls?: boolean
|
|
255
|
+
autoPlay?: boolean
|
|
232
256
|
autoplay?: boolean
|
|
233
257
|
loop?: boolean
|
|
234
258
|
muted?: boolean
|
|
@@ -271,6 +295,21 @@ export declare interface MapRegion {
|
|
|
271
295
|
center: MapCoordinate
|
|
272
296
|
span: { latitudeDelta: number; longitudeDelta: number }
|
|
273
297
|
}
|
|
298
|
+
/** A keyed polyline overlay for large map collections. */
|
|
299
|
+
export declare interface MapPolylineOverlay {
|
|
300
|
+
id: string
|
|
301
|
+
geometry: number[]
|
|
302
|
+
strokeColor?: string
|
|
303
|
+
strokeWidth?: number
|
|
304
|
+
}
|
|
305
|
+
/** A keyed marker overlay for large map collections. */
|
|
306
|
+
export declare interface MapMarkerOverlay {
|
|
307
|
+
id: string
|
|
308
|
+
geometry: number[]
|
|
309
|
+
title?: string
|
|
310
|
+
pinColor?: string
|
|
311
|
+
bearing?: number
|
|
312
|
+
}
|
|
274
313
|
export declare interface MapProps extends BaseProps {
|
|
275
314
|
region?: MapRegion
|
|
276
315
|
initialRegion?: MapRegion
|
|
@@ -282,11 +321,13 @@ export declare interface MapProps extends BaseProps {
|
|
|
282
321
|
zoomEnabled?: boolean
|
|
283
322
|
rotateEnabled?: boolean
|
|
284
323
|
pitchEnabled?: boolean
|
|
285
|
-
mapType?: 'standard' | 'satellite' | 'hybrid'
|
|
324
|
+
mapType?: 'standard' | 'satellite' | 'hybrid'
|
|
286
325
|
showsCompass?: boolean
|
|
287
326
|
showsScale?: boolean
|
|
288
327
|
cameraPitch?: number
|
|
289
328
|
cameraHeading?: number
|
|
329
|
+
polylines?: MapPolylineOverlay[]
|
|
330
|
+
markers?: MapMarkerOverlay[]
|
|
290
331
|
onPress?: (event: { nativeEvent: MapCoordinate }) => void
|
|
291
332
|
onRegionChangeComplete?: (event: { nativeEvent: MapRegion & { heading: number, pitch: number } }) => void
|
|
292
333
|
onMarkerPress?: (event: { nativeEvent: { id: string } }) => void
|
|
@@ -296,6 +337,12 @@ export declare interface MapPolylineProps extends BaseProps {
|
|
|
296
337
|
strokeColor?: string
|
|
297
338
|
strokeWidth?: number
|
|
298
339
|
}
|
|
340
|
+
export declare interface MapPolygonProps extends BaseProps {
|
|
341
|
+
geometry: number[]
|
|
342
|
+
fillColor?: string
|
|
343
|
+
strokeColor?: string
|
|
344
|
+
strokeWidth?: number
|
|
345
|
+
}
|
|
299
346
|
export declare interface MapMarkerProps extends BaseProps {
|
|
300
347
|
geometry: number[]
|
|
301
348
|
id: string
|
|
@@ -323,13 +370,14 @@ export declare interface SectionListProps<T> extends ScrollViewProps {
|
|
|
323
370
|
// ============================================================================
|
|
324
371
|
export declare interface ModalProps extends BaseProps {
|
|
325
372
|
visible?: boolean
|
|
373
|
+
nonModal?: boolean
|
|
374
|
+
dismissOnOutsideTap?: boolean
|
|
326
375
|
animationType?: 'none' | 'slide' | 'fade'
|
|
327
376
|
presentationStyle?: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
|
|
328
377
|
transparent?: boolean
|
|
329
378
|
onRequestClose?: () => void
|
|
330
379
|
onShow?: () => void
|
|
331
380
|
onDismiss?: () => void
|
|
332
|
-
statusBarTranslucent?: boolean
|
|
333
381
|
}
|
|
334
382
|
export declare interface ActivityIndicatorProps extends BaseProps {
|
|
335
383
|
animating?: boolean
|
|
@@ -342,10 +390,7 @@ export declare interface ActivityIndicatorProps extends BaseProps {
|
|
|
342
390
|
// ============================================================================
|
|
343
391
|
export declare interface StatusBarProps {
|
|
344
392
|
barStyle?: 'default' | 'light-content' | 'dark-content'
|
|
345
|
-
backgroundColor?: string
|
|
346
393
|
hidden?: boolean
|
|
347
|
-
animated?: boolean
|
|
348
|
-
translucent?: boolean
|
|
349
394
|
}
|
|
350
395
|
export declare interface RefreshControlProps {
|
|
351
396
|
refreshing: boolean
|
|
@@ -394,6 +439,7 @@ export type AccessibilityRole = | 'none'
|
|
|
394
439
|
| 'progressbar'
|
|
395
440
|
| 'radio'
|
|
396
441
|
| 'radiogroup'
|
|
442
|
+
| 'list'
|
|
397
443
|
| 'scrollbar'
|
|
398
444
|
| 'spinbutton'
|
|
399
445
|
| 'switch'
|
|
@@ -425,5 +471,5 @@ export type ReturnKeyType = | 'done'
|
|
|
425
471
|
| 'emergency-call'
|
|
426
472
|
| 'default';
|
|
427
473
|
export type ImageSource = | { uri: string; width?: number; height?: number; headers?: Record<string, string> }
|
|
428
|
-
|
|
|
474
|
+
| string;
|
|
429
475
|
export type ComponentName = keyof typeof ComponentRegistry;
|
|
@@ -14,18 +14,16 @@ const NATIVE_PROP_NAMES = [
|
|
|
14
14
|
"autoComplete",
|
|
15
15
|
"autoCorrect",
|
|
16
16
|
"autoFocus",
|
|
17
|
-
"blurRadius",
|
|
18
17
|
"contentContainerStyle",
|
|
19
18
|
"currentTime",
|
|
20
19
|
"defaultSource",
|
|
21
20
|
"defaultValue",
|
|
22
21
|
"ellipsizeMode",
|
|
23
|
-
"fadeDuration",
|
|
24
22
|
"hidesWhenStopped",
|
|
25
23
|
"hitSlop",
|
|
26
24
|
"imageStyle",
|
|
27
25
|
"initialNumToRender",
|
|
28
|
-
"
|
|
26
|
+
"ios_backgroundColor",
|
|
29
27
|
"keyboardDismissMode",
|
|
30
28
|
"keyboardShouldPersistTaps",
|
|
31
29
|
"keyboardType",
|
|
@@ -64,7 +62,6 @@ const NATIVE_PROP_NAMES = [
|
|
|
64
62
|
"selectionColor",
|
|
65
63
|
"showsHorizontalScrollIndicator",
|
|
66
64
|
"showsVerticalScrollIndicator",
|
|
67
|
-
"statusBarTranslucent",
|
|
68
65
|
"stickyHeaderIndices",
|
|
69
66
|
"testID",
|
|
70
67
|
"textContentType",
|
|
@@ -83,6 +80,7 @@ const NATIVE_PROP_NAMES = [
|
|
|
83
80
|
"rotateEnabled",
|
|
84
81
|
"pitchEnabled",
|
|
85
82
|
"mapType",
|
|
83
|
+
"fillColor",
|
|
86
84
|
"strokeColor",
|
|
87
85
|
"pinColor",
|
|
88
86
|
"showsCompass",
|
|
@@ -95,6 +93,8 @@ const NATIVE_PROP_NAMES = [
|
|
|
95
93
|
"transitionID"
|
|
96
94
|
];
|
|
97
95
|
export const NATIVE_BOOLEAN_PROPS = new Set([
|
|
96
|
+
"alwaysBounceHorizontal",
|
|
97
|
+
"alwaysBounceVertical",
|
|
98
98
|
"animating",
|
|
99
99
|
"autoCorrect",
|
|
100
100
|
"autoFocus",
|
|
@@ -48,6 +48,7 @@ function capabilityFlags(capabilities) {
|
|
|
48
48
|
deviceInfo: capabilities.has("device"),
|
|
49
49
|
fetch: capabilities.has("fetch"),
|
|
50
50
|
badge: capabilities.has("badge"),
|
|
51
|
+
wallet: capabilities.has("wallet"),
|
|
51
52
|
appReview: !1,
|
|
52
53
|
health: capabilities.has("health"),
|
|
53
54
|
dialogs: capabilities.has("dialog"),
|
|
@@ -561,7 +562,21 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
561
562
|
saveMindfulSession: (session) => request("Health", "saveMindfulSession", [session]),
|
|
562
563
|
getMindfulSessions: (options = {}) => request("Health", "getMindfulSessions", [options]),
|
|
563
564
|
startHeartRateUpdates: (options = {}) => request("Health", "startHeartRateUpdates", [{ since: typeof options.since === "number" ? options.since : null }]),
|
|
564
|
-
stopHeartRateUpdates: () => request("Health", "stopHeartRateUpdates", [{}])
|
|
565
|
+
stopHeartRateUpdates: () => request("Health", "stopHeartRateUpdates", [{}]),
|
|
566
|
+
startWorkout: (options = {}) => request("Health", "startWorkout", [{
|
|
567
|
+
type: typeof options.type === "string" ? options.type : "",
|
|
568
|
+
...typeof options.location === "string" ? { location: options.location } : {}
|
|
569
|
+
}]),
|
|
570
|
+
pauseWorkout: () => request("Health", "pauseWorkout", []),
|
|
571
|
+
resumeWorkout: () => request("Health", "resumeWorkout", []),
|
|
572
|
+
endWorkout: () => request("Health", "endWorkout", []),
|
|
573
|
+
onWorkout: (callback) => {
|
|
574
|
+
if (typeof callback !== "function")
|
|
575
|
+
throw TypeError("health.onWorkout needs a function");
|
|
576
|
+
const handler = (event) => callback(event.detail || {});
|
|
577
|
+
target.addEventListener?.("craftHealthWorkout", handler);
|
|
578
|
+
return () => target.removeEventListener?.("craftHealthWorkout", handler);
|
|
579
|
+
}
|
|
565
580
|
};
|
|
566
581
|
if (capabilities.has("healthAvailability")) {
|
|
567
582
|
craft.health.availability = () => request("Health", "availability", []);
|
|
@@ -569,6 +584,12 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
569
584
|
craft.health.openSettings = () => ask("Health", "openSettings", []).then(Boolean);
|
|
570
585
|
}
|
|
571
586
|
}
|
|
587
|
+
if (capabilities.has("wallet"))
|
|
588
|
+
craft.wallet = {
|
|
589
|
+
isAvailable: () => request("Wallet", "isAvailable", []).then(Boolean),
|
|
590
|
+
add: (source) => request("Wallet", "add", [source]).then(Boolean),
|
|
591
|
+
has: (serialNumber) => request("Wallet", "has", [serialNumber]).then(Boolean)
|
|
592
|
+
};
|
|
572
593
|
craft.scheduleNotification = craft.notifications.schedule;
|
|
573
594
|
craft.cancelNotification = craft.notifications.cancel;
|
|
574
595
|
craft.cancelAllNotifications = craft.notifications.cancelAll;
|
|
@@ -237,10 +237,20 @@ export declare interface NativeCraft {
|
|
|
237
237
|
getMindfulSessions: (options?: { startDate?: number, endDate?: number, limit?: number }) => Promise<Array<Record<string, unknown>>>
|
|
238
238
|
startHeartRateUpdates: (options?: { since?: number }) => Promise<boolean>
|
|
239
239
|
stopHeartRateUpdates: () => Promise<boolean>
|
|
240
|
+
startWorkout: (options: { type: string, location?: 'indoor' | 'outdoor' | 'unknown' }) => Promise<{ id: string, type: string, startDate: number }>
|
|
241
|
+
pauseWorkout: () => Promise<boolean>
|
|
242
|
+
resumeWorkout: () => Promise<boolean>
|
|
243
|
+
endWorkout: () => Promise<{ id: string, workoutId: string, endDate: number, durationSeconds: number }>
|
|
244
|
+
onWorkout: (callback: (event: Record<string, unknown>) => unknown) => () => void
|
|
240
245
|
availability?: () => Promise<'available' | 'updateRequired' | 'unavailable'>
|
|
241
246
|
grantedTypes?: () => Promise<string[]>
|
|
242
247
|
openSettings?: () => Promise<boolean>
|
|
243
248
|
}
|
|
249
|
+
wallet?: {
|
|
250
|
+
isAvailable: () => Promise<boolean>
|
|
251
|
+
add: (source: { data?: string, url?: string }) => Promise<boolean>
|
|
252
|
+
has: (serialNumber: string) => Promise<boolean>
|
|
253
|
+
}
|
|
244
254
|
scheduledWorkouts?: {
|
|
245
255
|
isSupported: () => Promise<boolean>
|
|
246
256
|
authorization: () => Promise<'authorized' | 'denied' | 'notDetermined' | 'restricted' | 'unsupported'>
|
package/dist/process.js
CHANGED
|
@@ -628,8 +628,9 @@ ${joined}` : joined;
|
|
|
628
628
|
${output}`;
|
|
629
629
|
return unmaskHtmlComments(output);
|
|
630
630
|
} catch (error) {
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
if (error instanceof StxValidationError)
|
|
632
|
+
throw error;
|
|
633
|
+
throw new StxRuntimeError(`Error processing layout ${layoutPath}: ${error instanceof Error ? error.message : String(error)}`, filePath);
|
|
633
634
|
}
|
|
634
635
|
return unmaskHtmlComments(await processOtherDirectives(output, context, filePath, resolvedOptions, dependencies));
|
|
635
636
|
}
|