@stacksjs/stx 0.2.174 → 0.2.176

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.
@@ -169,6 +169,7 @@ const BROWSER_CORE_IMPORTS = [
169
169
  "clamp",
170
170
  "rand",
171
171
  "readableSize",
172
+ "useActiveElement",
172
173
  "useDocumentVisibility",
173
174
  "useIntervalFn"
174
175
  ];
@@ -6,6 +6,7 @@ import { renderComponentWithSlot, userComponentFileExists } from "./utils.js";
6
6
  import { createSafeFunction, isExpressionSafe, safeEvaluateObject } from "./safe-evaluator.js";
7
7
  import { BOOLEAN_ATTRIBUTE_SENTINEL } from "./prop-sentinels.js";
8
8
  import { COMPONENT_PASSTHROUGH_X_ATTRS } from "./runtime-globals.js";
9
+ import { stripCommentsAndLiterals } from "./strip-literals.js";
9
10
  import fs from "node:fs";
10
11
  import path from "node:path";
11
12
  let builtinsRegistered = !1;
@@ -183,6 +184,18 @@ function parseComponentProps(rawProps, context, options) {
183
184
  serverDynamic: {},
184
185
  clientReactive: {},
185
186
  events: {}
187
+ }, clientSignalNames = new Set(Array.isArray(context.__stx_client_signal_names) ? context.__stx_client_signal_names : []), referencesClientSignal = (expression) => {
188
+ if (clientSignalNames.size === 0)
189
+ return !1;
190
+ const code = stripCommentsAndLiterals(expression), leadingIdentifier = code.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];
191
+ if (leadingIdentifier && clientSignalNames.has(leadingIdentifier))
192
+ return !0;
193
+ for (const signalName of clientSignalNames) {
194
+ const escapedName = signalName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
195
+ if (new RegExp(`(?:^|[^\\w$.])${escapedName}\\s*\\(`).test(code))
196
+ return !0;
197
+ }
198
+ return !1;
186
199
  }, ALPINE_PASSTHROUGH = new Set(COMPONENT_PASSTHROUGH_X_ATTRS), kebabToCamel = (key) => {
187
200
  if (!key.includes("-") || key.startsWith("@") || key.startsWith(":") || key.startsWith("x-") || key.startsWith("__"))
188
201
  return key;
@@ -212,6 +225,10 @@ function parseComponentProps(rawProps, context, options) {
212
225
  resolved.clientReactive[propName] = expression;
213
226
  continue;
214
227
  }
228
+ if (referencesClientSignal(expression)) {
229
+ resolved.clientReactive[propName] = expression;
230
+ continue;
231
+ }
215
232
  try {
216
233
  if (!isExpressionSafe(expression)) {
217
234
  if (options.debug)