@stacksjs/stx 0.2.346 → 0.2.347
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/binding-manifest.js +2 -0
- package/dist/{chunk-1bws4afs.js → chunk-0573wv97.js} +9 -9
- package/dist/{chunk-tnm0nez5.js → chunk-0vdng9sh.js} +1 -1
- package/dist/{chunk-b08taxsf.js → chunk-16kfapt5.js} +1 -1
- package/dist/{chunk-wbp4vbm0.js → chunk-1kwtdq06.js} +1 -1
- package/dist/{chunk-jwe0cwff.js → chunk-1vtd57x6.js} +6 -6
- package/dist/{chunk-1xts7768.js → chunk-1zjh3d0f.js} +1 -1
- package/dist/{chunk-3pggfwbf.js → chunk-24rhp7ye.js} +1 -1
- package/dist/{chunk-k5hv1qqy.js → chunk-3phs970s.js} +1 -1
- package/dist/{chunk-1vyz6kr8.js → chunk-4fcvaazx.js} +2 -2
- package/dist/{chunk-s3jyec9k.js → chunk-4k8rebtb.js} +1 -1
- package/dist/{chunk-byn0ptqt.js → chunk-5d3f7rth.js} +1 -1
- package/dist/{chunk-1xayahc6.js → chunk-632jxm61.js} +1 -1
- package/dist/{chunk-dyy74sdv.js → chunk-6be9r0tz.js} +1 -1
- package/dist/{chunk-s11e8aq9.js → chunk-6h8t40zg.js} +1 -1
- package/dist/{chunk-5hhng72w.js → chunk-8753m7f0.js} +1 -1
- package/dist/{chunk-xytgvfbf.js → chunk-8b8jwbne.js} +2 -2
- package/dist/{chunk-1djdz98r.js → chunk-8cd3ws01.js} +1 -1
- package/dist/{chunk-9jbssgem.js → chunk-8m0g0h4x.js} +146 -10
- package/dist/{chunk-hfvknn03.js → chunk-9rc9gshn.js} +2 -2
- package/dist/{chunk-bxwanj4g.js → chunk-adevnpdw.js} +1 -1
- package/dist/{chunk-rf2cejt3.js → chunk-dmpexr7d.js} +1 -1
- package/dist/{chunk-rwk5hwvk.js → chunk-e6zk6ntt.js} +1 -1
- package/dist/{chunk-fvvdq3ev.js → chunk-e9sk8fqy.js} +1 -1
- package/dist/{chunk-kfkf9v2d.js → chunk-f5veee11.js} +1 -1
- package/dist/{chunk-8tghv8cf.js → chunk-fbs0x8r3.js} +1 -1
- package/dist/{chunk-k80kr2t2.js → chunk-fqp4b8k4.js} +1 -1
- package/dist/{chunk-akb6mgrb.js → chunk-gkr35yjh.js} +1 -1
- package/dist/chunk-gnb15a8d.js +32 -0
- package/dist/{chunk-zdq7emrd.js → chunk-h2sbvyr4.js} +320 -320
- package/dist/chunk-h8apy0k1.js +2 -0
- package/dist/chunk-hpr2sdfc.js +2 -0
- package/dist/{chunk-j8s9akdq.js → chunk-jxg9vnsy.js} +1 -1
- package/dist/{chunk-vw83y4we.js → chunk-nqqknczy.js} +2 -2
- package/dist/{chunk-t83m2pkm.js → chunk-ns38fhve.js} +1 -1
- package/dist/{chunk-v7aa7v85.js → chunk-p3p4d6g1.js} +1 -1
- package/dist/{chunk-1yh6pq6b.js → chunk-pwh8pbks.js} +1 -1
- package/dist/{chunk-zz2yxsf9.js → chunk-q018c92j.js} +1 -1
- package/dist/{chunk-21mmq3aj.js → chunk-qrhbqzz0.js} +1 -1
- package/dist/{chunk-864m3xp2.js → chunk-rd02ysw3.js} +1 -1
- package/dist/{chunk-maq5jag2.js → chunk-rv28743b.js} +1 -1
- package/dist/{chunk-es275g3w.js → chunk-s2rc73vk.js} +1 -1
- package/dist/{chunk-p04rck27.js → chunk-st8wkk98.js} +1 -1
- package/dist/{chunk-yg5r7bnm.js → chunk-swvm1wgn.js} +27 -3
- package/dist/{chunk-7hjjckat.js → chunk-tg56j4ka.js} +1 -1
- package/dist/{chunk-t2py7vc3.js → chunk-tshyy2br.js} +1 -1
- package/dist/{chunk-vzbcdxd5.js → chunk-vxk12k35.js} +1 -1
- package/dist/{chunk-qp7sk0ex.js → chunk-w7vyd0n0.js} +1 -1
- package/dist/{chunk-km92eab7.js → chunk-wjaqhspq.js} +1 -1
- package/dist/{chunk-q45fva8h.js → chunk-xvr9enmb.js} +1 -1
- package/dist/{chunk-1caep9rn.js → chunk-xy99vzs2.js} +1 -1
- package/dist/chunk-y8g8neeh.js +2 -0
- package/dist/{chunk-7w66sc17.js → chunk-yr634wtd.js} +1 -1
- package/dist/{chunk-ddsgfmhv.js → chunk-zrbhpfda.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/config.js +16 -4
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/dev-server/ts-css.js +16 -47
- package/dist/process.js +11 -7
- package/dist/pwa.js +1 -1
- package/dist/signals.js +146 -10
- package/dist/ssg.js +2 -2
- package/dist/stx-virtual-ts.d.ts +16 -1
- package/dist/stx-virtual-ts.js +33 -2
- package/dist/typecheck.js +2 -0
- package/dist/types/config-types.d.ts +10 -0
- package/package.json +5 -5
- package/dist/chunk-fynb9e02.js +0 -2
- package/dist/chunk-pc8np1bb.js +0 -2
- package/dist/chunk-skd72bn4.js +0 -33
- package/dist/chunk-washyj03.js +0 -2
package/dist/signals.js
CHANGED
|
@@ -6487,6 +6487,89 @@ catch (e) {} }
|
|
|
6487
6487
|
// Both return Promises and render into a temporary modal overlay.
|
|
6488
6488
|
|
|
6489
6489
|
var _dialogId = 0;
|
|
6490
|
+
|
|
6491
|
+
// Shared across every open dialog, because four of the defects in #1998 were
|
|
6492
|
+
// each dialog acting as if it were the only one.
|
|
6493
|
+
var _dialogStack = [];
|
|
6494
|
+
// What WE set inert, so restoring never clears an app's own inert.
|
|
6495
|
+
var _dialogInerted = [];
|
|
6496
|
+
// Saved once, when the first dialog opens.
|
|
6497
|
+
var _dialogScrollLock = null;
|
|
6498
|
+
|
|
6499
|
+
/*
|
|
6500
|
+
* The page behind an aria-modal dialog does not scroll and is not reachable
|
|
6501
|
+
* by a virtual cursor (stacksjs/stx#1998, items 1 and 2).
|
|
6502
|
+
*
|
|
6503
|
+
* The backdrop is position:fixed;inset:0, so it stayed put while the content
|
|
6504
|
+
* behind it scrolled away underneath - the dialog claimed to be modal and the
|
|
6505
|
+
* page moved anyway. And the Tab trap, which #1875 added, only covers the
|
|
6506
|
+
* keyboard: aria-modal support for the virtual cursor is uneven, so a screen
|
|
6507
|
+
* reader could still browse the page behind the dialog.
|
|
6508
|
+
*
|
|
6509
|
+
* inert rather than aria-hidden on the siblings: aria-hidden on an element
|
|
6510
|
+
* that contains focus is itself a violation, and inert removes the subtree
|
|
6511
|
+
* from the tab order and the accessibility tree together. Everything except
|
|
6512
|
+
* the TOPMOST dialog goes inert, which also settles the two traps competing
|
|
6513
|
+
* for Tab while both were open - a backgrounded dialog's buttons stop being
|
|
6514
|
+
* focusable at all.
|
|
6515
|
+
*/
|
|
6516
|
+
function _dialogSyncModality() {
|
|
6517
|
+
var top = _dialogStack.length ? _dialogStack[_dialogStack.length - 1] : null;
|
|
6518
|
+
|
|
6519
|
+
for (var i = 0; i < _dialogInerted.length; i++) {
|
|
6520
|
+
try { _dialogInerted[i].inert = false; }
|
|
6521
|
+
catch (_e) { /* element may be gone */ }
|
|
6522
|
+
}
|
|
6523
|
+
_dialogInerted = [];
|
|
6524
|
+
|
|
6525
|
+
if (!top) {
|
|
6526
|
+
if (_dialogScrollLock) {
|
|
6527
|
+
document.body.style.overflow = _dialogScrollLock.body;
|
|
6528
|
+
document.documentElement.style.overflow = _dialogScrollLock.html;
|
|
6529
|
+
document.body.style.paddingRight = _dialogScrollLock.pad;
|
|
6530
|
+
_dialogScrollLock = null;
|
|
6531
|
+
}
|
|
6532
|
+
return;
|
|
6533
|
+
}
|
|
6534
|
+
|
|
6535
|
+
if (!_dialogScrollLock) {
|
|
6536
|
+
_dialogScrollLock = {
|
|
6537
|
+
body: document.body.style.overflow,
|
|
6538
|
+
html: document.documentElement.style.overflow,
|
|
6539
|
+
pad: document.body.style.paddingRight
|
|
6540
|
+
};
|
|
6541
|
+
// Compensate for the scrollbar the lock removes, or the whole page shifts
|
|
6542
|
+
// sideways the moment a dialog opens.
|
|
6543
|
+
var gap = window.innerWidth - document.documentElement.clientWidth;
|
|
6544
|
+
if (gap > 0) {
|
|
6545
|
+
var existing = Number.parseFloat(window.getComputedStyle(document.body).paddingRight) || 0;
|
|
6546
|
+
document.body.style.paddingRight = (existing + gap) + 'px';
|
|
6547
|
+
}
|
|
6548
|
+
document.body.style.overflow = 'hidden';
|
|
6549
|
+
document.documentElement.style.overflow = 'hidden';
|
|
6550
|
+
}
|
|
6551
|
+
|
|
6552
|
+
var kids = document.body.children;
|
|
6553
|
+
for (var k = 0; k < kids.length; k++) {
|
|
6554
|
+
var kid = kids[k];
|
|
6555
|
+
if (kid === top || kid.inert) continue;
|
|
6556
|
+
try {
|
|
6557
|
+
kid.inert = true;
|
|
6558
|
+
_dialogInerted.push(kid);
|
|
6559
|
+
}
|
|
6560
|
+
catch (_e) { /* inert unsupported; the Tab trap still holds */ }
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6564
|
+
/** Dialogs animate unless the reader asked them not to (#1998 item 5). */
|
|
6565
|
+
function _dialogReducedMotion() {
|
|
6566
|
+
try {
|
|
6567
|
+
return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
|
6568
|
+
}
|
|
6569
|
+
catch (_e) {
|
|
6570
|
+
return false;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6490
6573
|
var _dialogIcons = {
|
|
6491
6574
|
info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
|
|
6492
6575
|
warning: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
|
|
@@ -6514,14 +6597,23 @@ catch (e) {} }
|
|
|
6514
6597
|
var icon = _dialogIcons[type] || _dialogIcons.info;
|
|
6515
6598
|
|
|
6516
6599
|
return new Promise(function(resolve) {
|
|
6600
|
+
// Inline transitions cannot be reached by a stylesheet media query, so the
|
|
6601
|
+
// preference is read here instead (#1998 item 5). One matchMedia probe
|
|
6602
|
+
// rather than usePreferredReducedMotion(): that returns a signal with a
|
|
6603
|
+
// change listener, and an imperative dialog that reads the value once at
|
|
6604
|
+
// open time would leak one listener per call.
|
|
6605
|
+
var still = _dialogReducedMotion();
|
|
6606
|
+
var fade = still ? '' : 'transition:opacity 0.2s ease;';
|
|
6607
|
+
var scale = still ? '' : 'transition:transform 0.2s ease;';
|
|
6608
|
+
|
|
6517
6609
|
var backdrop = document.createElement('div');
|
|
6518
6610
|
backdrop.id = id;
|
|
6519
|
-
backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:
|
|
6611
|
+
backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:' + (still ? '1' : '0') + ';' + fade + 'font-family:system-ui,-apple-system,sans-serif';
|
|
6520
6612
|
backdrop.setAttribute('role', 'alertdialog');
|
|
6521
6613
|
backdrop.setAttribute('aria-modal', 'true');
|
|
6522
6614
|
|
|
6523
6615
|
var panel = document.createElement('div');
|
|
6524
|
-
panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);
|
|
6616
|
+
panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(' + (still ? '1' : '0.95') + ');' + scale + 'text-align:center';
|
|
6525
6617
|
|
|
6526
6618
|
var iconDiv = document.createElement('div');
|
|
6527
6619
|
iconDiv.style.cssText = 'display:flex;justify-content:center;margin-bottom:1rem';
|
|
@@ -6562,9 +6654,25 @@ catch (e) {} }
|
|
|
6562
6654
|
if (closed) return;
|
|
6563
6655
|
closed = true;
|
|
6564
6656
|
document.removeEventListener('keydown', keyHandler, true);
|
|
6657
|
+
|
|
6658
|
+
// Out of the stack BEFORE resolving, so a caller that opens another
|
|
6659
|
+
// dialog the moment this one answers does not land under a backdrop
|
|
6660
|
+
// that is still fading.
|
|
6661
|
+
var at = _dialogStack.indexOf(backdrop);
|
|
6662
|
+
if (at !== -1) _dialogStack.splice(at, 1);
|
|
6663
|
+
|
|
6664
|
+
// The fade is 200ms and resolve() is immediate, so for those 200ms a
|
|
6665
|
+
// full-viewport element at z-index 999999 was still hit-testing at the
|
|
6666
|
+
// centre of the screen - after the caller's await had already returned
|
|
6667
|
+
// (#1998 item 6). Fading out is right; swallowing clicks is not.
|
|
6668
|
+
backdrop.style.pointerEvents = 'none';
|
|
6565
6669
|
backdrop.style.opacity = '0';
|
|
6566
|
-
panel.style.transform = 'scale(0.95)';
|
|
6567
|
-
setTimeout(function() { backdrop.remove(); }, 200);
|
|
6670
|
+
if (!still) panel.style.transform = 'scale(0.95)';
|
|
6671
|
+
setTimeout(function() { backdrop.remove(); }, still ? 0 : 200);
|
|
6672
|
+
|
|
6673
|
+
// Unlocks the page and clears inert when this was the last dialog, or
|
|
6674
|
+
// hands modality back to the one underneath when it was not.
|
|
6675
|
+
_dialogSyncModality();
|
|
6568
6676
|
if (previouslyFocused && typeof previouslyFocused.focus === 'function') {
|
|
6569
6677
|
try { previouslyFocused.focus(); }
|
|
6570
6678
|
catch (_e) { /* element may be gone; not worth failing the dialog over */ }
|
|
@@ -6572,8 +6680,11 @@ catch (e) {} }
|
|
|
6572
6680
|
resolve(result);
|
|
6573
6681
|
}
|
|
6574
6682
|
|
|
6683
|
+
// Declared out here rather than inside the branch: the focus decision
|
|
6684
|
+
// below needs to know whether a Cancel button exists at all.
|
|
6685
|
+
var cancelBtn = null;
|
|
6575
6686
|
if (isConfirm) {
|
|
6576
|
-
|
|
6687
|
+
cancelBtn = document.createElement('button');
|
|
6577
6688
|
cancelBtn.textContent = cancelText;
|
|
6578
6689
|
cancelBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid ' + (isDark ? '#374151' : '#d1d5db') + ';background:transparent;color:' + textColor + ';transition:background 0.15s';
|
|
6579
6690
|
cancelBtn.onmouseover = function() { this.style.background = isDark ? '#374151' : '#f3f4f6'; };
|
|
@@ -6594,11 +6705,15 @@ catch (e) {} }
|
|
|
6594
6705
|
panel.appendChild(btnRow);
|
|
6595
6706
|
backdrop.appendChild(panel);
|
|
6596
6707
|
document.body.appendChild(backdrop);
|
|
6708
|
+
_dialogStack.push(backdrop);
|
|
6709
|
+
_dialogSyncModality();
|
|
6597
6710
|
|
|
6598
6711
|
// Animate in
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6712
|
+
if (!still) {
|
|
6713
|
+
void backdrop.offsetHeight;
|
|
6714
|
+
backdrop.style.opacity = '1';
|
|
6715
|
+
panel.style.transform = 'scale(1)';
|
|
6716
|
+
}
|
|
6602
6717
|
|
|
6603
6718
|
// Escape, plus a real focus trap.
|
|
6604
6719
|
//
|
|
@@ -6611,6 +6726,11 @@ catch (e) {} }
|
|
|
6611
6726
|
// walked straight out into the page behind it. Capture phase so the trap
|
|
6612
6727
|
// wins over anything the page has bound.
|
|
6613
6728
|
var keyHandler = function(e) {
|
|
6729
|
+
// Every dialog binds its own capture-phase handler on document and none
|
|
6730
|
+
// of them checked whether they were on top, so ONE Escape resolved every
|
|
6731
|
+
// open dialog at once (#1998 item 4). The backgrounded dialogs are inert
|
|
6732
|
+
// too, which is what stops their traps competing for Tab.
|
|
6733
|
+
if (_dialogStack.length && _dialogStack[_dialogStack.length - 1] !== backdrop) return;
|
|
6614
6734
|
if (e.key === 'Escape') {
|
|
6615
6735
|
e.preventDefault();
|
|
6616
6736
|
cleanup(isConfirm ? false : undefined);
|
|
@@ -6640,8 +6760,24 @@ catch (e) {} }
|
|
|
6640
6760
|
};
|
|
6641
6761
|
document.addEventListener('keydown', keyHandler, true);
|
|
6642
6762
|
|
|
6643
|
-
|
|
6644
|
-
|
|
6763
|
+
/*
|
|
6764
|
+
* Initial focus, which was an unconditional okBtn.focus() (#1998 item 3).
|
|
6765
|
+
*
|
|
6766
|
+
* type: 'error' already paints that button red, so the API knows the
|
|
6767
|
+
* action is destructive - and still handed it the keyboard, where a stray
|
|
6768
|
+
* Enter or Space confirmed the delete. An error-type confirm now defaults
|
|
6769
|
+
* to Cancel, and defaultFocus overrides either way.
|
|
6770
|
+
*
|
|
6771
|
+
* An alert has only one button, so it keeps it: there is nothing
|
|
6772
|
+
* destructive to land on and focus has to go somewhere inside the trap.
|
|
6773
|
+
*/
|
|
6774
|
+
var focusTarget = okBtn;
|
|
6775
|
+
if (isConfirm && cancelBtn) {
|
|
6776
|
+
var want = opts.defaultFocus;
|
|
6777
|
+
if (want === 'cancel' || (!want && type === 'error')) focusTarget = cancelBtn;
|
|
6778
|
+
else if (want === 'confirm') focusTarget = okBtn;
|
|
6779
|
+
}
|
|
6780
|
+
focusTarget.focus();
|
|
6645
6781
|
});
|
|
6646
6782
|
}
|
|
6647
6783
|
|
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bk as Fq,wk as Uq,xk as Iq}from"./chunk-
|
|
2
|
+
import{Bk as Fq,wk as Uq,xk as Iq}from"./chunk-p3p4d6g1.js";import{Ck as Eq,Dk as Tq,Ek as Dq}from"./chunk-c0n802j1.js";import{Zk as _q,al as zq,bl as Aq}from"./chunk-0vdng9sh.js";import"./chunk-9rc9gshn.js";import"./chunk-fvsefztj.js";import{Jp as P,Sm as Oq,io as l,lo as Hq,sr as n}from"./chunk-h2sbvyr4.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import{it as Xq}from"./chunk-gnb15a8d.js";import{nt as d}from"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-qrhbqzz0.js";import"./chunk-vhta1be7.js";import{Ut as Bq}from"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import{rw as Yq,sw as Vq,tw as jq,uw as Gq,vw as Lq,ww as Nq}from"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import{Nw as y}from"./chunk-ejqpq0wc.js";import O from"fs";import j from"path";import{createHash as xq}from"crypto";function yq(q){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(q).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return q}}var Pq=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Cq(q){return Bun.hash(q).toString(16)}function Qq(q,Z={}){if(!q.includes('type="stx/island"'))return{html:q,chunks:[]};let $=new Map,Q=q.replace(Pq,(J,W,z,A)=>{let G=A.trim();if(!G)return J;if(/\bdata-stx-src=/.test(z))return J;if(Z.minify)G=yq(G);let X=Cq(G);if(!$.has(X))$.set(X,G);let B=Z.integrity?` data-stx-integrity="sha384-${xq("sha384").update(G).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${W}" data-stx-src="/_stx/islands/${X}.js"${B}${z}></script>`}),K=Array.from($,([J,W])=>({hash:J,code:W}));return{html:Q,chunks:K}}var gq=new Set(["visible","idle"]);function Zq(q){if(!q.includes("data-stx-src="))return q;let Z=new Map,$=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Q;while((Q=$.exec(q))!==null)Z.set(Q[1],Q[2]);let K=new Set,J=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,W;while((W=J.exec(q))!==null)if(gq.has(Z.get(W[1])||""))K.add(W[2]);let z=q.lastIndexOf("</head>");if(K.size===0||z===-1)return q;let A=Array.from(K).filter((G)=>!q.includes(`rel="prefetch" href="${G}"`)).map((G)=>`<link rel="prefetch" href="${G}" as="script">`).join("");if(!A)return q;return q.slice(0,z)+A+q.slice(z)}var fq=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function h(q){let Z=q.trim();if(!Z)return null;let $=/^https?:\/\//i.test(Z)?Z:`https://${Z}`;try{return new URL($).origin+new URL($).pathname.replace(/\/$/,"")}catch{return null}}function mq(q){for(let Z of fq){let $=q[Z];if(!$)continue;let Q=h($);if(Q)return{url:Q,source:"env",via:Z}}return null}function $q(q){if(!q||typeof q!=="object")return null;let Z=q,$=Z.site?.url??Z.url??Z.app?.url;return typeof $==="string"?h($):null}async function dq(q){let{existsSync:Z}=await import("fs"),$=await import("path");for(let Q of["site.config.ts","site.config.js",".config/site.config.ts"]){let K=$.resolve(q,Q);if(!Z(K))continue;try{let J=await import(K),W=$q(J.default??J);if(W)return W}catch{}}return null}async function Kq(q={}){let Z=q.cwd??process.cwd(),$=q.env??process.env;if(q.explicit){let W=h(q.explicit);if(W)return{url:W,source:"option"}}let Q=$q(q.stxConfig);if(Q)return{url:Q,source:"stx.config",via:"site.url"};let K=await dq(Z);if(K)return{url:K,source:"site.config",via:"url"};let J=mq($);if(J)return J;return{url:"http://localhost",source:"fallback"}}function Wq(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
3
|
`)}class wq{cacheDir;cache=new Map;loaded=!1;salt;constructor(q,Z=""){this.cacheDir=q,this.salt=Z}async load(){if(this.loaded)return;let q=j.join(this.cacheDir,"build-cache.json");if(await Bun.file(q).exists())try{let Z=JSON.parse(await Bun.file(q).text());for(let[$,Q]of Object.entries(Z))this.cache.set($,Q)}catch{}this.loaded=!0}async save(){await O.promises.mkdir(this.cacheDir,{recursive:!0});let q=j.join(this.cacheDir,"build-cache.json"),Z={};for(let[$,Q]of this.cache)Z[$]=Q;await Bun.write(q,JSON.stringify(Z))}getHash(q,Z){let $=O.statSync(q),Q=`${this.salt}|${q}:${$.mtimeMs}`;for(let J of Z)if(O.existsSync(J)){let W=O.statSync(J);Q+=`:${J}:${W.mtimeMs}`}let K=0;for(let J=0;J<Q.length;J++){let W=Q.charCodeAt(J);K=(K<<5)-K+W,K=K&K}return Math.abs(K).toString(36)}get(q,Z){let $=this.cache.get(q);if(!$)return null;let Q=this.getHash(Z,$.dependencies??[]);if($.hash!==Q)return this.cache.delete(q),null;return $.html}set(q,Z,$,Q){let K=this.getHash(Z,$);this.cache.set(q,{hash:K,html:Q,generatedAt:Date.now(),dependencies:$})}}class Rq{cacheDir;constructor(q){this.cacheDir=q}getFilePath(q){let Z=q.replace(/[^a-zA-Z0-9]/g,"_")+".json";return j.join(this.cacheDir,"isr",Z)}async get(q){let Z=this.getFilePath(q);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set(q,Z){let $=this.getFilePath(q);await O.promises.mkdir(j.dirname($),{recursive:!0}),await Bun.write($,JSON.stringify(Z))}async invalidate(q){let Z=this.getFilePath(q);if(await Bun.file(Z).exists())await O.promises.unlink(Z)}async invalidatePattern(q){let Z=j.join(this.cacheDir,"isr");if(!O.existsSync(Z))return;let $=await O.promises.readdir(Z);for(let Q of $){let K=Q.replace(/_/g,"/").replace(".json","");if(q.test(K))await O.promises.unlink(j.join(Z,Q))}}async needsRevalidation(q){let Z=await this.get(q);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function pq(q){try{let $=(await Bun.file(q).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!$)return null;let Q=$[1];if(!Q.includes("getStaticPaths"))return null;let K=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!K)return null;return await Function(`
|
|
4
4
|
return (async function getStaticPaths() {
|
|
5
5
|
${K[1]}
|
|
@@ -41,7 +41,7 @@ ${q.map((Q)=>{let K=new URL(Q.loc,Z).href,J=` <url>
|
|
|
41
41
|
${$.join(`
|
|
42
42
|
`)}
|
|
43
43
|
</channel>
|
|
44
|
-
</rss>`}async function aq(q={}){let Z=Date.now();Aq();let $=await n(process.cwd()),Q=$.build||{},K=await Kq({explicit:q.domain||Q.domain,stxConfig:$});if(K.source==="fallback"&&(q.sitemap??Q.sitemap??!0))console.warn(Wq());let J={router:q.router??$?.router??{},pagesDir:q.pagesDir||Q.pagesDir||"pages",outputDir:q.outputDir||Q.outputDir||"dist",baseUrl:q.baseUrl||Q.baseUrl||"/",domain:K.url,revalidate:q.revalidate??Q.revalidate??!1,sitemap:q.sitemap??Q.sitemap??!0,sitemapExclude:q.sitemapExclude||Q.sitemapExclude||[],robots:q.robots??Q.robots??!0,rss:q.rss??Q.rss??!1,concurrency:q.concurrency||Q.concurrency||10,cache:q.cache??Q.cache??!0,cacheDir:q.cacheDir||Q.cacheDir||d(process.cwd(),"ssg-cache"),contentLoaders:q.contentLoaders||[],hooks:q.hooks||{},minify:q.minify??Q.minify??!0,generate404:q.generate404??Q.generate404??!0,publicDir:q.publicDir||Q.publicDir||"public",trailingSlash:q.trailingSlash??Q.trailingSlash??!1,cleanOutput:q.cleanOutput??Q.cleanOutput??!0,cacheSalt:q.cacheSalt??"",partialsDir:q.partialsDir||$?.partialsDir||"",componentsDir:q.componentsDir||$?.componentsDir||"",failOnIncludeError:q.failOnIncludeError??!0,chunkIslands:q.chunkIslands===!0,prefetchIslands:q.prefetchIslands===!0,integrityIslands:q.integrityIslands===!0},W={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},z=new Set,A=0,G={},X={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&O.existsSync(J.outputDir))await O.promises.rm(J.outputDir,{recursive:!0});await O.promises.mkdir(J.outputDir,{recursive:!0});let L=J.cacheSalt;if(!L){let{resolveUserCssConfig:Y,fingerprintConfig:N}=await import("./chunk-
|
|
44
|
+
</rss>`}async function aq(q={}){let Z=Date.now();Aq();let $=await n(process.cwd()),Q=$.build||{},K=await Kq({explicit:q.domain||Q.domain,stxConfig:$});if(K.source==="fallback"&&(q.sitemap??Q.sitemap??!0))console.warn(Wq());let J={router:q.router??$?.router??{},pagesDir:q.pagesDir||Q.pagesDir||"pages",outputDir:q.outputDir||Q.outputDir||"dist",baseUrl:q.baseUrl||Q.baseUrl||"/",domain:K.url,revalidate:q.revalidate??Q.revalidate??!1,sitemap:q.sitemap??Q.sitemap??!0,sitemapExclude:q.sitemapExclude||Q.sitemapExclude||[],robots:q.robots??Q.robots??!0,rss:q.rss??Q.rss??!1,concurrency:q.concurrency||Q.concurrency||10,cache:q.cache??Q.cache??!0,cacheDir:q.cacheDir||Q.cacheDir||d(process.cwd(),"ssg-cache"),contentLoaders:q.contentLoaders||[],hooks:q.hooks||{},minify:q.minify??Q.minify??!0,generate404:q.generate404??Q.generate404??!0,publicDir:q.publicDir||Q.publicDir||"public",trailingSlash:q.trailingSlash??Q.trailingSlash??!1,cleanOutput:q.cleanOutput??Q.cleanOutput??!0,cacheSalt:q.cacheSalt??"",partialsDir:q.partialsDir||$?.partialsDir||"",componentsDir:q.componentsDir||$?.componentsDir||"",failOnIncludeError:q.failOnIncludeError??!0,chunkIslands:q.chunkIslands===!0,prefetchIslands:q.prefetchIslands===!0,integrityIslands:q.integrityIslands===!0},W={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},z=new Set,A=0,G={},X={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&O.existsSync(J.outputDir))await O.promises.rm(J.outputDir,{recursive:!0});await O.promises.mkdir(J.outputDir,{recursive:!0});let L=J.cacheSalt;if(!L){let{resolveUserCssConfig:Y,fingerprintConfig:N}=await import("./chunk-rd02ysw3.js");try{L=N(await Y(process.cwd()))}catch{}}let{prepareImageDelivery:_}=await import("./chunk-e631svvs.js"),F=await _(J.publicDir,J.outputDir);if(F.count>0)console.log(`Optimized ${F.count} image(s) for responsive delivery`),L=[L,F.fingerprint].filter(Boolean).join(":");let C=new wq(J.cacheDir,L);if(J.cache)await C.load();try{let{generateCss:Y}=await import("./chunk-rd02ysw3.js");await Y('<div class="bg-black"></div>')}catch{}Yq();let kq=$?.routeMiddleware?.dir||"middleware";await jq(process.cwd(),kq);let p=Vq();if(p.length>0)console.log(`Loaded ${p.length} middleware: ${p.join(", ")}`);let bq=$?.routeMiddleware?.global||[];Fq($?.layoutsDir,d(process.cwd()));let i=l(".",{pagesDir:J.pagesDir,pagesDirs:$?._layerPageDirs});console.log(`Found ${i.length} routes`);let g=[];for(let Y of i){let N=await uq(Y);for(let H of N)g.push({route:Y,url:H.url,params:H.params,props:H.props,revalidate:H.revalidate??J.revalidate})}W.totalPages=g.length,console.log(`Generating ${W.totalPages} pages...`);let b=[],s=[];for(let Y=0;Y<g.length;Y+=J.concurrency)s.push(g.slice(Y,Y+J.concurrency));for(let Y of s)await Promise.all(Y.map(async(N)=>{let{route:H,url:V,params:S,props:Sq,revalidate:a}=N;try{await J.hooks.onPageStart?.(V);let w=await Bun.file(H.filePath).text(),R=JJ(w),vq=R?.middleware?Array.isArray(R.middleware)?R.middleware:[R.middleware]:[],t=[...bq,...vq];if(t.length>0){let D=Gq(V,S,R||{}),M=Lq(D,null,void 0,{isServer:!0}),E=await Nq(t,M);if(E.redirect){let U=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,x=QJ(String(U),V),k=ZJ(V,J);await O.promises.mkdir(j.dirname(k),{recursive:!0}),await Bun.write(k,x),W.successCount++,W.pages.push({route:V,outputPath:k,size:Buffer.byteLength(x),cached:!1}),b.push({loc:V,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${V} \u2192 redirect to ${U}`);return}if(E.abort){let U=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${V} \u2014 middleware aborted: ${U}`);return}}let e=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(e)try{if(!await Function("route",`
|
|
45
45
|
const validate = ${e[1]};
|
|
46
46
|
return validate(route);
|
|
47
47
|
`)({params:S})){console.warn(`Validation failed for ${V}, skipping...`);return}}catch{}let I=null,qq=!1;if(J.cache){if(I=C.get(V,H.filePath),I)qq=!0,W.cachedCount++}if(!I){let D=await Mq(H,S,Sq,J,$);if(I=D.html,J.failOnIncludeError&&D.includeFailures.length>0)throw Error(`${D.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
package/dist/stx-virtual-ts.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface TemplateExpression {
|
|
|
62
62
|
line: number;
|
|
63
63
|
/** 1-based column of the expression's first character. */
|
|
64
64
|
column: number;
|
|
65
|
-
kind: 'interpolation' | 'directive';
|
|
65
|
+
kind: 'interpolation' | 'directive' | 'condition';
|
|
66
66
|
/** For directives, the attribute name (`:if`, `@click`, `x-text`). */
|
|
67
67
|
attribute?: string;
|
|
68
68
|
/**
|
|
@@ -86,6 +86,15 @@ export interface MappedLine {
|
|
|
86
86
|
* the start of the attribute.
|
|
87
87
|
*/
|
|
88
88
|
prefixLength?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Characters of `if (…) {` wrapper before the expression's own statement.
|
|
91
|
+
*
|
|
92
|
+
* A diagnostic inside this span is about the enclosing CONDITION, not about
|
|
93
|
+
* the expression this line carries - and the condition is checked on a line
|
|
94
|
+
* of its own, so reporting it here too would name innocent markup twice
|
|
95
|
+
* (stacksjs/stx#2013).
|
|
96
|
+
*/
|
|
97
|
+
guardPrefixLength?: number;
|
|
89
98
|
}
|
|
90
99
|
export interface VirtualFile {
|
|
91
100
|
text: string;
|
|
@@ -463,6 +472,12 @@ export interface ResolvedPosition {
|
|
|
463
472
|
column: number;
|
|
464
473
|
/** Set when the diagnostic came from a template expression. */
|
|
465
474
|
expression?: TemplateExpression;
|
|
475
|
+
/**
|
|
476
|
+
* The hit landed in the `if (…) {` wrapper that markup guards put around an
|
|
477
|
+
* expression, so it is about the CONDITION rather than this expression. The
|
|
478
|
+
* condition has a line of its own (stacksjs/stx#2013).
|
|
479
|
+
*/
|
|
480
|
+
inGuard?: boolean;
|
|
466
481
|
}
|
|
467
482
|
/**
|
|
468
483
|
* Translate a position in a virtual buffer back to the `.stx` file.
|
package/dist/stx-virtual-ts.js
CHANGED
|
@@ -173,6 +173,35 @@ export function extractTemplateExpressions(source) {
|
|
|
173
173
|
kind: "interpolation"
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
const condition = /@(if|elseif|else\s+if|unless)\b\s*\(/g;
|
|
177
|
+
while ((m = condition.exec(masked)) !== null) {
|
|
178
|
+
const open = m.index + m[0].length - 1;
|
|
179
|
+
let depth = 0, index = open;
|
|
180
|
+
for (;index < masked.length; index++) {
|
|
181
|
+
const char = masked[index];
|
|
182
|
+
if (char === "(")
|
|
183
|
+
depth++;
|
|
184
|
+
else if (char === ")") {
|
|
185
|
+
depth--;
|
|
186
|
+
if (depth === 0)
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (depth !== 0)
|
|
191
|
+
continue;
|
|
192
|
+
const raw = masked.slice(open + 1, index), code = raw.trim();
|
|
193
|
+
condition.lastIndex = index + 1;
|
|
194
|
+
if (!code)
|
|
195
|
+
continue;
|
|
196
|
+
const start = open + 1 + (raw.length - raw.trimStart().length);
|
|
197
|
+
found.push({
|
|
198
|
+
code,
|
|
199
|
+
line: lineAt(masked, start),
|
|
200
|
+
column: columnAt(masked, start),
|
|
201
|
+
offset: m.index,
|
|
202
|
+
kind: "condition"
|
|
203
|
+
});
|
|
204
|
+
}
|
|
176
205
|
DIRECTIVE_ATTR_RE.lastIndex = 0;
|
|
177
206
|
while ((m = DIRECTIVE_ATTR_RE.exec(masked)) !== null) {
|
|
178
207
|
const name = m[1], value = m[3] ?? "", base = name.replace(/\..*$/, "").replace(/^([^:].*?):.*$/, "$1");
|
|
@@ -648,7 +677,8 @@ export function buildVirtualTypeScript(source, options = {}) {
|
|
|
648
677
|
line: expression.line,
|
|
649
678
|
column: expression.column,
|
|
650
679
|
expression,
|
|
651
|
-
prefixLength: statement.prefixLength + pad.length + guardPrefix.length
|
|
680
|
+
prefixLength: statement.prefixLength + pad.length + guardPrefix.length,
|
|
681
|
+
guardPrefixLength: pad.length + guardPrefix.length
|
|
652
682
|
});
|
|
653
683
|
}
|
|
654
684
|
if (indent > 0)
|
|
@@ -689,6 +719,7 @@ export function resolvePosition(virtual, line, column) {
|
|
|
689
719
|
return {
|
|
690
720
|
line: mapped.line,
|
|
691
721
|
column: mapped.column + within,
|
|
692
|
-
expression: mapped.expression
|
|
722
|
+
expression: mapped.expression,
|
|
723
|
+
inGuard: column <= (mapped.guardPrefixLength ?? 0)
|
|
693
724
|
};
|
|
694
725
|
}
|
package/dist/typecheck.js
CHANGED
|
@@ -305,6 +305,8 @@ export async function typecheckStxFiles(files, options = {}) {
|
|
|
305
305
|
const at = resolvePosition(entry.virtual, line, column);
|
|
306
306
|
if (!at?.expression)
|
|
307
307
|
continue;
|
|
308
|
+
if (at.inGuard)
|
|
309
|
+
continue;
|
|
308
310
|
if (Number(code) === 2774)
|
|
309
311
|
continue;
|
|
310
312
|
line = at.line;
|
|
@@ -708,6 +708,16 @@ export interface StxConfig {
|
|
|
708
708
|
defaultLayout?: string;
|
|
709
709
|
/** Plugins to load — npm packages, local paths, or [path, options] tuples */
|
|
710
710
|
plugins?: Array<string | [string, Record<string, any>]>;
|
|
711
|
+
/**
|
|
712
|
+
* Installed packages whose components resolve by bare tag, with no plugin
|
|
713
|
+
* entry and no import.
|
|
714
|
+
*
|
|
715
|
+
* Each is loaded through its own `<pkg>/stx-plugin` export if the project has
|
|
716
|
+
* it installed, and is searched AFTER every project directory - so a
|
|
717
|
+
* component the app wrote still wins. Defaults to `['@stacksjs/components']`;
|
|
718
|
+
* set it to `[]` to opt out entirely (stacksjs/stx#2011).
|
|
719
|
+
*/
|
|
720
|
+
componentPackages?: string[];
|
|
711
721
|
/** Path to public/static assets directory, defaults to 'public' */
|
|
712
722
|
publicDir?: string;
|
|
713
723
|
/** Path to .env file, defaults to '.env' in project root (Bun loads this automatically) */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.347",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@stacksjs/ts-css": "^0.3.2",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.16",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.347",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.347",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.347",
|
|
124
124
|
"bunfig": "^0.15.19",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.347",
|
|
126
126
|
"ts-broadcasting": "^0.0.10",
|
|
127
127
|
"ts-images": "^0.2.22",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-fynb9e02.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wf as a}from"./chunk-ddsgfmhv.js";import"./chunk-xytgvfbf.js";import"./chunk-57atgbyq.js";import"./chunk-9jbssgem.js";import"./chunk-e4g8wz6t.js";import"./chunk-c0n802j1.js";import"./chunk-hfvknn03.js";import"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as buildForProduction};
|
package/dist/chunk-pc8np1bb.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ue as a}from"./chunk-rwk5hwvk.js";import"./chunk-57atgbyq.js";import"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as buildApp};
|
package/dist/chunk-skd72bn4.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{nt as iJ}from"./chunk-y2f41kaq.js";import{Nw as hJ}from"./chunk-ejqpq0wc.js";import z from"path";import{hasLocalConfig as dJ}from"bunfig";var BJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function p(J){return`--stx-${J}`}function m(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function LJ(J){let Q={};for(let[Z,$]of Object.entries(BJ)){let U=m(J,$.light);if(U===void 0)continue;Q[Z]=`var(${p(Z)}, ${U})`}return Q}function HJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(BJ)){let F=m(J,U.light),W=m(J,U.dark);if(F===void 0)continue;if(Q.push(` ${p($)}: ${F};`),W!==void 0)Z.push(` ${p($)}: ${W};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
|
|
3
|
-
`)}var OJ={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function KJ(J){return`--stx-radius-${J}`}function IJ(){let J={};for(let[Q,Z]of Object.entries(OJ))J[Q]=`var(${KJ(Q)}, ${Z.value})`;return J}function DJ(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(OJ).map(([J,Q])=>` ${KJ(J)}: ${Q.value};`),"}",""].join(`
|
|
4
|
-
`)}function NJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function h(J,Q){let Z={...J};for(let[$,U]of Object.entries(Q))Z[$]=NJ(U)&&NJ(Z[$])?h(Z[$],U):U;return Z}function MJ(J={},Q={}){let Z=J.theme||{},$=Q.theme||{},{extend:U,...F}=$,{extend:W,...j}=Z,X=j.colors||{};j.colors={...X,...LJ(X)};let V=j.borderRadius||{};j.borderRadius={...V,...IJ()};let q=h(j,F),G=h(W||{},U||{});if(Object.keys(G).length>0)q.extend=G;let w=[...J.safelist||[],...Q.safelist||[]],K={...J.shortcuts||{},...Q.shortcuts||{}},D=[...J.preflights||[],...Q.preflights||[]];return{config:{...J,...Q,theme:q,safelist:w,shortcuts:K,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:w,shortcuts:K,includePreflight:Q.preflight!==!1,minify:Q.minify===!0,tokenCSS:HJ(X)+DJ()}}var E=/<script\b[^>]*>/iy,c=/<\/script\s*>/ig,S=/<style\b[^>]*>/iy,l=/<\/style\s*>/ig;function PJ(J,Q,Z,$){Z.lastIndex=Q;let U=Z.exec(J);if(!U||U.index!==Q)return-1;$.lastIndex=Z.lastIndex;let F=$.exec(J);if(!F)return-1;return F.index+F[0].length}function o(J,Q){return PJ(J,Q,E,c)}function AJ(J,Q){return PJ(J,Q,S,l)}function lJ(J,Q){if(!J.startsWith("<!--",Q))return-1;let Z=J.indexOf("-->",Q+4);if(Z===-1)return-1;return Z+3}function _J(J,Q){if(J.startsWith("<!--",Q)){let U=lJ(J,Q);return U===-1?J.length:U}if(E.lastIndex=Q,E.exec(J)?.index===Q){c.lastIndex=E.lastIndex;let U=c.exec(J);return U?U.index+U[0].length:J.length}if(S.lastIndex=Q,S.exec(J)?.index===Q){l.lastIndex=S.lastIndex;let U=l.exec(J);return U?U.index+U[0].length:J.length}return-1}function oJ(J,Q){let Z=[],$=0,U=J.length,F=!1,W=null;while($<U){let j=J[$];if(F){if(W){if(j===W)W=null}else if(j==='"'||j==="'")W=j;else if(j===">")F=!1;$++;continue}if(j!=="<"){let G=J.indexOf("<",$+1);if(G===-1)break;$=G;continue}let X=Q(J,$);if(X>$){Z.push({start:$,end:X,token:J.slice($,X)}),$=X;continue}let V=_J(J,$);if(V>$){$=V;continue}let q=J.charCodeAt($+1);if(q>=65&&q<=90||q>=97&&q<=122)F=!0;$++}return Z}function kQ(J){let Q=0,Z=0,$=0,U=!1,F=null;while($<J.length){if(U){let G=J[$];if(F){if(G===F)F=null}else if(G==='"'||G==="'")F=G;else if(G===">")U=!1;$++;continue}let W=J.indexOf("<",$),j=W===-1?J.length:W;while($<j){let G=J[$++];if(G==="{")Q++;else if(G==="}")Z++;if(Q>=2&&Z>=2)return!0}if(W===-1)break;let X=_J(J,W);if(X>W){$=X;continue}let V=J.charCodeAt(W+1),q=V===47?J.charCodeAt(W+2):V;if(q>=65&&q<=90||q>=97&&q<=122)U=!0;$=W+1}return!1}function vJ(J,Q){while(J.size>=Q){let Z=J.keys().next();if(Z.done)return;J.delete(Z.value)}}var aJ=65536,sJ=12,i=new Map;function a(J,Q,Z,$){let U=$!==void 0&&J.length>=aJ,F=U?`${$}\x00${J}`:"";if(U){let q=i.get(F);if(q)return{output:q.output,tokens:q.tokens.slice()}}let W=oJ(J,Q);if(W.length===0)return{output:J,tokens:[]};let j=W.map((q)=>q.token),X="",V=0;for(let q=0;q<W.length;q++){let G=W[q];X+=J.slice(V,G.start),X+=Z(G.token,q),V=G.end}if(X+=J.slice(V),U)return vJ(i,sJ),i.set(F,{output:X,tokens:j}),{output:X,tokens:j.slice()};return{output:X,tokens:j}}var tJ=65536,eJ=4,r=new Map;function n(J,Q,Z){return{output:Q,scripts:Z,restore:($)=>$===Q?J:JQ($,Z)}}function xQ(J){let Q=J.length>=tJ;if(Q){let U=r.get(J);if(U)return n(J,U.output,U.scripts.slice())}let{output:Z,tokens:$}=a(J,o,(U,F)=>`\x00STX_SCRIPT_${F}\x00`);if(Q)return vJ(r,eJ),r.set(J,{output:Z,scripts:$}),n(J,Z,$.slice());return n(J,Z,$)}function JQ(J,Q){if(Q.length===0)return J;return J.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,$)=>Q[+$]??"")}function RJ(J,Q=""){let Z=`${J}${Q}`,$=0;for(let U=0;U<Z.length;U++){let F=Z.charCodeAt(U);$=($<<5)-$+F,$=$&$}return`stx-${Math.abs($).toString(36)}`}function TJ(J,Q,Z={}){let{prefix:$="",preserveHost:U=!0,scopeKeyframes:F=!0,scopeCustomProperties:W=!1}=Z;if(!J.trim())return"";let j=s(J),X=[],V=new Map;if(F)for(let q of j){let G=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let w=G[1],K=`${Q}_${w}`;V.set(w,K)}}for(let q of j){let G=bJ(q,Q,$,U,V,W);X.push(G)}return X.join(`
|
|
5
|
-
|
|
6
|
-
`)}function s(J){let Q=[],Z=J.replace(/\/\*[\s\S]*?\*\//g,""),$=0,U="",F=!1,W="";for(let j=0;j<Z.length;j++){let X=Z[j];if(X==="@"&&$===0)F=!0;if(X==="{")$++;else if(X==="}"){if($--,$===0){if(F){W+=X;let V=W.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,q,G,w]=V;if(q==="keyframes")Q.push({selector:`@keyframes ${G.trim()}`,declarations:w.trim()});else if(q==="media"||q==="supports"||q==="container"){let K=s(w);Q.push({selector:`@${q} ${G.trim()}`,declarations:K.map((D)=>`${D.selector} { ${D.declarations} }`).join(`
|
|
7
|
-
`)})}else Q.push({selector:`@${q} ${G.trim()}`,declarations:w.trim()})}W="",F=!1}else if(U.trim()){U+=X;let V=U.match(/([^{]+)\{([^}]*)\}/);if(V)Q.push({selector:V[1].trim(),declarations:V[2].trim()});U=""}continue}}if(F)W+=X;else U+=X}return Q}function bJ(J,Q,Z,$,U,F){let{selector:W,declarations:j}=J;if(W.startsWith("@")){if(W.startsWith("@keyframes")){let q=W.replace("@keyframes ","").trim();return`@keyframes ${U.get(q)||q} { ${j} }`}if(W.startsWith("@media")||W.startsWith("@supports")||W.startsWith("@container")){let G=s(`x { ${j} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((w)=>bJ(w,Q,Z,$,U,F)).join(`
|
|
8
|
-
`);return`${W} {
|
|
9
|
-
${G}
|
|
10
|
-
}`}return`${W} { ${j} }`}let X=QQ(W,Q,Z,$),V=j;for(let[q,G]of U)V=V.replace(new RegExp(`\\b${q}\\b`,"g"),G);if(F)V=V.replace(/--([a-z-]+)/gi,`--${Q}-$1`);return`${X} { ${V} }`}function QQ(J,Q,Z,$){let U=J.split(",").map((W)=>W.trim()),F=[];for(let W of U){if(W.startsWith(":host")){if($)F.push(W);else{let V=W.replace(/:host(\([^)]*\))?/,`.${Q}$1`);F.push(V)}continue}if(W.includes("::slotted")){F.push(W);continue}if(W===":root"){F.push(`:root .${Q}`);continue}let j=Z?`${Z} .${Q}`:`.${Q}`;F.push(`${j} ${W}`);let X=$Q(W,Q);if(X)F.push(Z?`${Z} ${X}`:X)}return F.join(", ")}function $Q(J,Q){let Z=0,$=J.length;for(let X=0;X<J.length;X++){let V=J[X];if(V==="["||V==="(")Z++;else if(V==="]"||V===")")Z--;else if(Z===0&&(V===" "||V===">"||V==="+"||V==="~")){$=X;break}}let U=J.slice(0,$),F=J.slice($);if(!U)return"";let W=U.length,j=0;for(let X=0;X<U.length;X++){let V=U[X];if(V==="["||V==="(")j++;else if(V==="]"||V===")")j--;else if(Z===0&&j===0&&V===":"){W=X;break}}return`${U.slice(0,W)}.${Q}${U.slice(W)}${F}`}var EJ=String.raw`(?<![\w-])scoped(?![\w-])`,t=/<style\s+([^>]*)>/gi,kJ=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,SJ=new RegExp(EJ,"i"),ZQ=new RegExp(EJ,"gi"),e=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function UQ(J){t.lastIndex=0;let Q=t.exec(J);while(Q!==null){if(SJ.test(Q[1]))return!0;Q=t.exec(J)}return!1}function JJ(J){let Q=new Set,Z=[];e.lastIndex=0;let $=e.exec(J);while($!==null){let U=$[0].trim();if(Q.has(U))Z.push({start:$.index,end:$.index+$[0].length});else Q.add(U);$=e.exec(J)}return Z}function QJ(J){let Q=JJ(J);if(Q.length===0)return J;let Z=Array(Q.length+1),$=0;for(let U=0;U<Q.length;U++){let F=Q[U];Z[U]=J.slice($,F.start),$=F.end}return Z[Q.length]=J.slice($),Z.join("")}function CQ(J,Q){if(!UQ(J))return{html:J,hasScoped:!1};let Z=RJ(Q),$=`data-v-${Z}`,U=J,F=!1;if(kJ.lastIndex=0,U=U.replace(kJ,(W,j,X)=>{if(!SJ.test(j))return W;F=!0;let V=FQ(X,$),q=j.replace(ZQ,"").trim(),G=q?` ${q}`:"";return`<style data-stx-scoped="${Z}"${G}>${V}</style>`}),!F)return{html:J,hasScoped:!1};return U=XQ(U,$),{html:U,hasScoped:!0}}function FQ(J,Q){return TJ(J,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Q}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Q}]`)}var WQ=(J)=>`\x00stx-scope-mask-${J}\x00`,xJ=/\u0000stx-scope-mask-(\d+)\u0000/g;function XQ(J,Q){let Z=a(J,(U,F)=>{let W=o(U,F);return W>F?W:AJ(U,F)},(U,F)=>WQ(F)),$=jQ(Z.output,Q);return xJ.lastIndex=0,$.replace(xJ,(U,F)=>Z.tokens[Number(F)])}function jQ(J,Q){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return J.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,($,U,F)=>{if(Z.has(U.toLowerCase()))return $;if($.includes(Q))return $;if(U.toLowerCase()==="style"||U.toLowerCase()==="script")return $;if(F)return $.replace(`<${U}${F}`,`<${U} ${Q}${F}`);if($.endsWith("/>"))return`<${U} ${Q} />`;return`<${U} ${Q}>`})}var Y={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import CJ from"fs";class ZJ{cache=new Map;maxSize;options;sizes;bytes=0;constructor(J=100,Q){this.maxSize=J,this.options=Q??null,this.sizes=Q?new Map:null}get byteSize(){return this.bytes}setMaxBytes(J){if(!this.options)return;this.options={...this.options,maxBytes:J};while(this.bytes>J&&this.cache.size>0){let Q=this.cache.keys().next().value;if(Q===void 0)break;this.delete(Q)}}get(J){if(!this.cache.has(J))return;let Q=this.cache.get(J);return this.cache.delete(J),this.cache.set(J,Q),Q}set(J,Q){if(this.cache.has(J))this.delete(J);let Z=this.options?this.options.sizeOf(Q):0;if(this.options&&Z>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+Z>this.options.maxBytes)){let $=this.cache.keys().next().value;if($===void 0)break;this.delete($)}if(this.cache.set(J,Q),this.sizes)this.sizes.set(J,Z),this.bytes+=Z}has(J){return this.cache.has(J)}delete(J){if(this.sizes){let Q=this.sizes.get(J);if(Q!==void 0)this.bytes-=Q,this.sizes.delete(J)}return this.cache.delete(J)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P=new Map,VQ=500;function dQ(J,Q){if(Q?.includes("g"))return new RegExp(J,Q);let Z=`${J}:${Q||""}`;if(!P.has(Z)){if(P.size>=VQ){let $=P.keys().next().value;if($)P.delete($)}P.set(Z,new RegExp(J,Q))}return P.get(Z)}class yJ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(J){let Q=Array.from(new Set(J)),Z=Q.sort().join(","),$=this.pool.find((j)=>j.context.join(",")===Z);if($)return $.func;let U=this.fnCache,F=this.fnCacheMaxSize,W=(...j)=>{return(X)=>{try{let V=`${Z}:${X}`,q=U.get(V);if(!q){if(U.size>=F){let G=U.keys().next().value;if(G)U.delete(G)}q=Function(...Q,`
|
|
11
|
-
'use strict';
|
|
12
|
-
try {
|
|
13
|
-
return ${X};
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
throw e;
|
|
20
|
-
}
|
|
21
|
-
`),U.set(V,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var pQ=new yJ;class fJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let X of this.violationHandlers)try{X(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function qQ(){if(!$J)$J=new fJ;return $J}var mQ=new Proxy({},{get(J,Q){return qQ()[Q]}});var gJ=[];function uJ(J){let Q=new ZJ(J);return gJ.push(Q),Q}function nQ(){for(let J of gJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function cQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:CJ.statSync(Z).mtimeMs})}catch{}return Q}function lQ(J){for(let Q of J)try{if(CJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var H=null,WJ=!1,L=null,T="",A=!1,rJ=256,N=new Map,O=new Map,M=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(N.has(J))N.delete(J);else if(N.size>=rJ)N.delete(N.keys().next().value);N.set(J,Q)}function GQ(J){let Q=y(J);if(O.has(Q))O.delete(Q);else if(O.size>=rJ)O.delete(O.keys().next().value);return O.set(Q,J),Q}function Z0(J){let Q=O.get(J);if(Q===void 0)return;return O.delete(J),O.set(J,Q),Q}async function zQ(J){if(!M)return null;try{let Q=Bun.file(z.join(M,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function YQ(J,Q){if(!M)return;try{if(!fs.existsSync(M))fs.mkdirSync(M,{recursive:!0});await Bun.write(z.join(M,`cw-${y(J)}.css`),Q)}catch{}}async function pJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var wQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],BQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function LQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of wQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function HQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function nJ(){if(WJ)return H;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await pJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return H=F,H}let Q=await J(LQ());if(Q)return H=Q,H;let Z=BQ;for(let U of Z){let F=await pJ(U);if(F){if(H=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return H}}let $=await J(HQ());if($)return H=$,H;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function U0(){XJ.clear(),H=null,WJ=!1,L=null,T="",N.clear(),O.clear(),b=null}var mJ=!1;async function cJ(J){try{let Q=dJ({name:"css",cwd:J})?"css":dJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mJ)mJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function OQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-3pggfwbf.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await cJ(J)}function KQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function IQ(J){if(A)return T;A=!0;try{let Q=await nJ();if(!Q||!Q.build)return A=!1,"";if(!L)L=await cJ(J);if(!L)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=L.theme||{},U={...Q.defaultConfig,...L,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let X=z.isAbsolute(U.output)?U.output:z.join(J,U.output),V=z.dirname(X);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(X,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function F0(J){L=null,await IQ(J)}function W0(){return T}function DQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let X of j.slice(1,-1).split(/\s+/))if(X.trim())Q.add(X.trim())}F=U.exec(J)}return Q}var XJ=uJ(64);async function NQ(J,Q){let Z=XJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await MQ(J,Q);if($)XJ.set(UJ(J,Q,b),$);return $}async function MQ(J,Q){try{let Z=await nJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):DQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!M)M=iJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=N.get(W);if(j!==void 0)return FJ(W,j),j;let X=await zQ(W);if(X!==null)return FJ(W,X),X;if(!L)L=await OQ(U),b=KQ(L);let V=Z.defaultConfig||Z.config,q=L||{},G=MJ(V,q),{safelist:w,includePreflight:K,minify:D,tokenCSS:jJ}=G,VJ=G.config,_=new Z.CSSGenerator(VJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,D),qJ=VJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(qJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,D);let v=I.split(`
|
|
22
|
-
`);for(let[B,f]of Object.entries(qJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean),R=[],g=[];for(let u of C){let GJ=u.startsWith("dark:"),zJ=`.${(GJ?u.slice(5):u).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<v.length;k++){let YJ=v[k].trim();if(YJ===`${zJ} {`||YJ.startsWith(`${zJ} {`)){let x=k,wJ="";while(x<v.length){if(wJ+=v[x],v[x].includes("}"))break;x++}let d=wJ.match(/\{([^}]+)\}/);if(d)if(GJ)g.push(d[1].trim());else R.push(d[1].trim());break}}}if(R.length)I+=`
|
|
23
|
-
.${B} { ${R.join(" ")} }`;if(g.length)I+=`
|
|
24
|
-
@media (prefers-color-scheme: dark) { .dark .${B} { ${g.join(" ")} } }`}return I=jJ+I,FJ(W,I),YQ(W,I),I}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function X0(J,Q,Z=!1,$=!1){let U=await NQ(J,Q);if(!U)return $?QJ(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${GQ(U)}.css">`:`<style data-css="generated">
|
|
25
|
-
${U}
|
|
26
|
-
</style>`;if($)return PQ(J,F);let W=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(W.test(J)){let j=!1;return J.replace(W,()=>{if(j)return"";return j=!0,F})}if(J.includes("</head>"))return J.replace("</head>",`${F}
|
|
27
|
-
</head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
|
|
28
|
-
${F}`);return F+J}function PQ(J,Q){let Z=JJ(J).map((X)=>({...X,replacement:""})),$=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,U=$.exec(J);if(U!==null){let X=!0;while(U!==null)Z.push({start:U.index,end:U.index+U[0].length,replacement:X?Q:""}),X=!1,U=$.exec(J)}else{let X=J.indexOf("</head>");if(X!==-1)Z.push({start:X,end:X,replacement:`${Q}
|
|
29
|
-
`});else{let V=J.match(/<body([^>]*)>/);if(V?.index!==void 0)Z.push({start:V.index,end:V.index+V[0].length,replacement:`${V[0]}
|
|
30
|
-
${Q}`});else Z.push({start:0,end:0,replacement:Q})}}Z.sort((X,V)=>X.start-V.start||X.end-V.end);for(let X=1;X<Z.length;X++)if(Z[X].start<Z[X-1].end)return AQ(QJ(J),Q);let F=Array(Z.length*2+1),W=0,j=0;for(let X of Z)F[j++]=J.slice(W,X.start),F[j++]=X.replacement,W=X.end;return F[j]=J.slice(W),F.join("")}function AQ(J,Q){let Z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(Z.test(J)){let $=!1;return J.replace(Z,()=>{if($)return"";return $=!0,Q})}if(J.includes("</head>"))return J.replace("</head>",`${Q}
|
|
31
|
-
</head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
|
|
32
|
-
${Q}`);return Q+J}
|
|
33
|
-
export{ZJ as Cs,dQ as Ds,mQ as Es,uJ as Fs,nQ as Gs,UJ as Hs,cQ as Is,lQ as Js,o as Ks,AJ as Ls,lJ as Ms,oJ as Ns,kQ as Os,vJ as Ps,a as Qs,xQ as Rs,JQ as Ss,h as Ts,MJ as Us,JJ as Vs,QJ as Ws,CQ as Xs,Y as Ys,Z0 as Zs,nJ as _s,U0 as $s,cJ as at,OQ as bt,KQ as ct,IQ as dt,F0 as et,W0 as ft,DQ as gt,NQ as ht,X0 as it};
|
package/dist/chunk-washyj03.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ye as a}from"./chunk-s3jyec9k.js";import"./chunk-xytgvfbf.js";import"./chunk-57atgbyq.js";import"./chunk-hfvknn03.js";import"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startProductionServer};
|