Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evt.detail.value not working for third party libs #326

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bundles/datastar.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions bundles/datastar.js.map

Large diffs are not rendered by default.

31 changes: 30 additions & 1 deletion library/src/plugins/official/dom/attributes/on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,41 @@ const knownOnModifiers = new Set([
"outside",
]);

const EVT = "evt";
export const On: AttributePlugin = {
type: PluginType.Attribute,
name: "on",
keyReq: Requirement.Must,
valReq: Requirement.Must,
argNames: ["evt"],
argNames: [EVT],
macros: {
pre: [
{
// We need to escape the evt in case .value is used
type: PluginType.Macro,
name: "evtEsc",
fn: (original) => {
return original.replaceAll(
/evt.([\w\.]+)value/gm,
"EVT_$1_VALUE",
);
},
},
],
post: [
{
// We need to unescape the evt in case .value is used
type: PluginType.Macro,
name: "evtUnesc",
fn: (original) => {
return original.replaceAll(
/EVT_([\w\.]+)_VALUE/gm,
"evt.$1value",
);
},
},
],
},
onLoad: ({ el, key, genRX, mods, signals, effect }) => {
const rx = genRX();
let target: Element | Window | Document = el;
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/src/Consts.fs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/consts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/php/src/Consts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Consts
{
public const DATASTAR_KEY = 'datastar';
public const VERSION = '0.21.0-beta1';
public const VERSION_CLIENT_BYTE_SIZE = 33376;
public const VERSION_CLIENT_BYTE_SIZE_GZIP = 12238;
public const VERSION_CLIENT_BYTE_SIZE = 33568;
public const VERSION_CLIENT_BYTE_SIZE_GZIP = 12332;

// The default duration for settling during merges. Allows for CSS transitions to complete.
public const DEFAULT_SETTLE_DURATION = 300;
Expand Down
Loading