@stacksjs/stx 0.2.153 → 0.2.155
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/animation.js +6 -6
- package/dist/app-shell.js +1 -27
- package/dist/build-message.d.ts +10 -0
- package/dist/build-message.js +26 -0
- package/dist/builtins/attrs.js +6 -1
- package/dist/cli.js +1481 -1231
- package/dist/client-script-bundler.js +2 -4
- package/dist/client-script.d.ts +29 -0
- package/dist/client-script.js +140 -95
- package/dist/color-mode-boot.d.ts +31 -0
- package/dist/color-mode-boot.js +41 -5
- package/dist/component-renderer.js +10 -21
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/use-clipboard.d.ts +1 -5
- package/dist/composables/use-clipboard.js +57 -46
- package/dist/composables/use-color-mode.js +13 -5
- package/dist/composables/use-router.d.ts +28 -11
- package/dist/composables/use-router.js +63 -9
- package/dist/config.js +22 -7
- package/dist/craft.js +1029 -789
- package/dist/dev-server/crosswind.js +8 -6
- package/dist/dev-server/serve-app.js +4 -2
- package/dist/dev-server/serve-markdown.js +4 -1
- package/dist/dev-server/serve-multi.js +32 -20
- package/dist/document-shell.d.ts +65 -0
- package/dist/document-shell.js +59 -12
- package/dist/dynamic-components.js +123 -4
- package/dist/events.d.ts +26 -49
- package/dist/events.js +23 -9
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.js +3 -3
- package/dist/framework-composables.d.ts +41 -0
- package/dist/framework-composables.js +115 -0
- package/dist/hot-reload.js +8 -2
- package/dist/includes.js +2 -2
- package/dist/isolated-build.d.ts +12 -0
- package/dist/isolated-build.js +18 -0
- package/dist/plugin-system.d.ts +1 -1
- package/dist/process.js +40 -10
- package/dist/production-server.js +4 -1
- package/dist/prop-sentinels.d.ts +31 -0
- package/dist/prop-sentinels.js +7 -0
- package/dist/pwa.js +966 -726
- package/dist/reactive.js +1 -1
- package/dist/reactivity.d.ts +0 -15
- package/dist/reactivity.js +15 -6
- package/dist/runtime-globals.d.ts +40 -2
- package/dist/runtime-globals.js +90 -0
- package/dist/runtime-injection.d.ts +51 -0
- package/dist/runtime-injection.js +13 -0
- package/dist/script-emit.d.ts +20 -0
- package/dist/script-emit.js +11 -0
- package/dist/script-validation.js +12 -7
- package/dist/signal-processing.js +25 -40
- package/dist/signals-api.d.ts +30 -0
- package/dist/signals-api.js +18 -0
- package/dist/signals.js +258 -47
- package/dist/site-builder/build.js +21 -7
- package/dist/site-builder/seo.js +19 -10
- package/dist/site-builder/theme.js +5 -4
- package/dist/site-builder/types.d.ts +1 -0
- package/dist/ssg.js +986 -746
- package/dist/state-management.js +4 -1
- package/dist/store-loader.d.ts +0 -11
- package/dist/store-loader.js +27 -3
- package/dist/strict-lint.d.ts +9 -6
- package/dist/strict-lint.js +2 -21
- package/dist/stx.d.ts +111 -16
- package/dist/unresolved-identifiers.d.ts +50 -0
- package/dist/unresolved-identifiers.js +146 -0
- package/dist/utils.js +3 -3
- package/dist/variable-extractor.js +17 -1
- package/dist/x-element.js +1 -1
- package/package.json +5 -5
- package/stx.d.ts +111 -16
package/dist/animation.js
CHANGED
|
@@ -62,7 +62,7 @@ function generateTransitionCSS(type, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
function generateMotionPreferencesScript() {
|
|
64
64
|
return `
|
|
65
|
-
<script data-stx-scoped>
|
|
65
|
+
<script data-stx-scoped data-stx-run="once">
|
|
66
66
|
// Motion preferences handling
|
|
67
67
|
(function() {
|
|
68
68
|
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -107,7 +107,7 @@ function hasAnimationDirectives(template) {
|
|
|
107
107
|
}
|
|
108
108
|
function generateIntersectionObserverScript(threshold = 0.1, rootMargin = "0px") {
|
|
109
109
|
return `
|
|
110
|
-
<script data-stx-scoped>
|
|
110
|
+
<script data-stx-scoped data-stx-run="always">
|
|
111
111
|
// Intersection Observer for scroll animations
|
|
112
112
|
(function() {
|
|
113
113
|
const initObserver = () => {
|
|
@@ -272,7 +272,7 @@ function generateBaseAnimationStyles() {
|
|
|
272
272
|
function generateAnimationGroup(groupName, elements, options = {}) {
|
|
273
273
|
const { staggerDelay = 50, sequence = !1 } = options;
|
|
274
274
|
return `
|
|
275
|
-
<script data-stx-scoped>
|
|
275
|
+
<script data-stx-scoped data-stx-run="always">
|
|
276
276
|
// Animation Group: ${groupName}
|
|
277
277
|
(function() {
|
|
278
278
|
const elements = ${JSON.stringify(elements)};
|
|
@@ -444,7 +444,7 @@ export const keyframeDirective = {
|
|
|
444
444
|
};
|
|
445
445
|
function generateStaggerScript(containerId, childSelector, baseDelay, staggerDelay, animationClass) {
|
|
446
446
|
return `
|
|
447
|
-
<script data-stx-scoped>
|
|
447
|
+
<script data-stx-scoped data-stx-run="always">
|
|
448
448
|
(function() {
|
|
449
449
|
const container = document.getElementById('${containerId}');
|
|
450
450
|
if (!container) return;
|
|
@@ -522,7 +522,7 @@ export const springDirective = {
|
|
|
522
522
|
export function createAnimationTimeline(entries) {
|
|
523
523
|
const _timelineId = `stx-timeline-${Math.random().toString(36).slice(2, 9)}`;
|
|
524
524
|
return `
|
|
525
|
-
<script data-stx-scoped>
|
|
525
|
+
<script data-stx-scoped data-stx-run="always">
|
|
526
526
|
(function() {
|
|
527
527
|
const timeline = ${JSON.stringify(entries)};
|
|
528
528
|
|
|
@@ -599,7 +599,7 @@ export function parseAnimationShorthand(shorthand) {
|
|
|
599
599
|
}
|
|
600
600
|
export function generateAnimationRuntime() {
|
|
601
601
|
return `
|
|
602
|
-
<script data-stx-scoped>
|
|
602
|
+
<script data-stx-scoped data-stx-run="once">
|
|
603
603
|
window.__stxAnimation = {
|
|
604
604
|
// Registry of animations
|
|
605
605
|
animations: new Map(),
|
package/dist/app-shell.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var {require}=import.meta;import path from "node:path";
|
|
2
2
|
import { classifyAllScripts } from "./script-classifier.js";
|
|
3
|
+
import { startsDocument } from "./document-shell.js";
|
|
3
4
|
export { extractLayoutMetadata } from "stx-router/layout-metadata";
|
|
4
5
|
const PAGE_HEAD_MARKER = "stx-page-head:", PAGE_HEAD_MARKER_RE = /<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/;
|
|
5
6
|
let _cachedRouterScript = null;
|
|
@@ -114,33 +115,6 @@ ${routerScript}
|
|
|
114
115
|
</body>
|
|
115
116
|
</html>`;
|
|
116
117
|
}
|
|
117
|
-
function startsDocument(html) {
|
|
118
|
-
let i = 0;
|
|
119
|
-
while (i < html.length) {
|
|
120
|
-
const rest = html.slice(i), ws = rest.match(/^\s+/);
|
|
121
|
-
if (ws) {
|
|
122
|
-
i += ws[0].length;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
if (rest.startsWith("<!--")) {
|
|
126
|
-
const end = html.indexOf("-->", i);
|
|
127
|
-
if (end === -1)
|
|
128
|
-
return !1;
|
|
129
|
-
i = end + 3;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
const scriptOpen = rest.match(/^<script\b[^>]*>/i);
|
|
133
|
-
if (scriptOpen) {
|
|
134
|
-
const end = html.toLowerCase().indexOf("</script>", i + scriptOpen[0].length);
|
|
135
|
-
if (end === -1)
|
|
136
|
-
return !1;
|
|
137
|
-
i = end + 9;
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
return /^<!DOCTYPE\b/i.test(rest) || /^<html[\s>]/i.test(rest);
|
|
141
|
-
}
|
|
142
|
-
return !1;
|
|
143
|
-
}
|
|
144
118
|
export function stripDocumentWrapper(html, options = {}) {
|
|
145
119
|
const trimmed = html.trim();
|
|
146
120
|
if (!startsDocument(trimmed))
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a build failure as `path:line:column: message`, falling back to the
|
|
3
|
+
* plain message when no position is available.
|
|
4
|
+
*
|
|
5
|
+
* @param error whatever was thrown — BuildMessage, AggregateError, Error, or
|
|
6
|
+
* anything else
|
|
7
|
+
* @param sourcePath the real file being compiled. Preferred over the position's
|
|
8
|
+
* own `file`, which is a synthetic entry name on the transpiler path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatBuildFailure(error: unknown, sourcePath?: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function isBuildMessageLike(value) {
|
|
2
|
+
if (!value || typeof value !== "object")
|
|
3
|
+
return !1;
|
|
4
|
+
const candidate = value;
|
|
5
|
+
return typeof candidate.message === "string" && (candidate.name === "BuildMessage" || candidate.name === "ResolveMessage" || ("position" in candidate));
|
|
6
|
+
}
|
|
7
|
+
function unwrap(error) {
|
|
8
|
+
if (error && typeof error === "object" && Array.isArray(error.errors))
|
|
9
|
+
return error.errors;
|
|
10
|
+
return [error];
|
|
11
|
+
}
|
|
12
|
+
export function formatBuildFailure(error, sourcePath) {
|
|
13
|
+
const parts = [];
|
|
14
|
+
for (const item of unwrap(error)) {
|
|
15
|
+
if (isBuildMessageLike(item)) {
|
|
16
|
+
const position = item.position || void 0, file = sourcePath || position?.file, where = file ? `${file}${position?.line ? `:${position.line}${position.column ? `:${position.column}` : ""}` : ""}` : "", snippet = position?.lineText ? `
|
|
17
|
+
${position.lineText.trim()}` : "";
|
|
18
|
+
parts.push(where ? `${where}: ${item.message}${snippet}` : `${item.message}${snippet}`);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const message = item instanceof Error ? item.message : String(item);
|
|
22
|
+
parts.push(sourcePath ? `${sourcePath}: ${message}` : message);
|
|
23
|
+
}
|
|
24
|
+
return parts.join(`
|
|
25
|
+
`);
|
|
26
|
+
}
|
package/dist/builtins/attrs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { escapeAttr } from "./escape.js";
|
|
2
|
+
import { BOOLEAN_ATTRIBUTE_SENTINEL, stripControlChars } from "../prop-sentinels.js";
|
|
2
3
|
export function forwardStaticAttrs(props, consumed) {
|
|
3
4
|
const attrs = [];
|
|
4
5
|
for (const [key, value] of Object.entries(props.static)) {
|
|
@@ -10,7 +11,11 @@ export function forwardStaticAttrs(props, consumed) {
|
|
|
10
11
|
attrs.push(escapeAttr(name));
|
|
11
12
|
continue;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
if (value === BOOLEAN_ATTRIBUTE_SENTINEL) {
|
|
15
|
+
attrs.push(escapeAttr(name));
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
attrs.push(`${escapeAttr(name)}="${escapeAttr(stripControlChars(String(value)))}"`);
|
|
14
19
|
}
|
|
15
20
|
return attrs;
|
|
16
21
|
}
|