attaform 0.27.6 → 0.29.0
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/abstract.d.mts +5 -4
- package/dist/abstract.mjs +4 -3
- package/dist/chunks/fingerprint.mjs +1 -2
- package/dist/chunks/fingerprint2.mjs +2 -3
- package/dist/dev/abstract.mjs +4 -0
- package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
- package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
- package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
- package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
- package/dist/dev/directive.mjs +1 -0
- package/dist/dev/history.mjs +89 -0
- package/dist/dev/index.mjs +5 -0
- package/dist/dev/runtime/plugins/attaform.mjs +40 -0
- package/dist/dev/shared/attaform-dev.A-TpJW0B.mjs +207 -0
- package/dist/dev/shared/attaform-dev.BO-71R54.mjs +820 -0
- package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.BgM6FdtA.mjs} +324 -73
- package/dist/dev/shared/attaform-dev.ButTkwHd.mjs +375 -0
- package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -1
- package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.D8aoKb89.mjs} +190 -400
- package/dist/dev/shared/attaform-dev.DD5m2W51.mjs +220 -0
- package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.DHuydLAC.mjs} +3867 -4731
- package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.DrzObAZo.mjs} +6 -7
- package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.q6UutkCx.mjs} +274 -672
- package/dist/dev/zod-v3.mjs +17 -0
- package/dist/dev/zod-v4.mjs +16 -0
- package/dist/dev/zod.mjs +5 -0
- package/dist/directive.d.mts +20 -0
- package/dist/directive.mjs +1 -0
- package/dist/esbuild.mjs +0 -1
- package/dist/history.d.mts +59 -0
- package/dist/history.mjs +89 -0
- package/dist/index.d.mts +14 -6
- package/dist/index.mjs +5 -4
- package/dist/nuxt.d.mts +10 -10
- package/dist/nuxt.mjs +5 -2
- package/dist/rollup.mjs +0 -1
- package/dist/rspack.d.mts +6 -1
- package/dist/rspack.mjs +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/shared/{attaform.CoR4mWfv.mjs → attaform.B0dKL8ST.mjs} +309 -46
- package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -140
- package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.BndjUUYX.mjs} +11 -16
- package/dist/shared/{attaform.CQN9R62B.cjs → attaform.BxfsuwBR.mjs} +9 -4
- package/dist/shared/attaform.C2MVyuxC.mjs +811 -0
- package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.CIWLMY-R.d.mts} +2 -2
- package/dist/shared/attaform.CZMAYwSK.mjs +6383 -0
- package/dist/shared/attaform.CZYt_5N_.mjs +207 -0
- package/dist/shared/{attaform.DniawQLP.d.cts → attaform.CsoeRi3P.d.mts} +490 -98
- package/dist/shared/attaform.Cvao8bW5.mjs +358 -0
- package/dist/shared/attaform.D0x-qSXm.mjs +197 -0
- package/dist/shared/{attaform.D8kliaKw.cjs → attaform.D1fnTifF.mjs} +279 -692
- package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.DDtqHYv1.d.mts} +155 -184
- package/dist/shared/{attaform.Biytrv0-.cjs → attaform.DffRL5pP.mjs} +215 -547
- package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
- package/dist/shared/attaform.KvlEedlF.mjs +0 -1
- package/dist/shared/attaform.axHXVQO7.d.mts +44 -0
- package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
- package/dist/transforms.d.mts +0 -22
- package/dist/transforms.mjs +1 -2
- package/dist/vite.d.mts +30 -9
- package/dist/vite.mjs +27 -4
- package/dist/webpack.d.mts +6 -1
- package/dist/webpack.mjs +0 -1
- package/dist/zod-v3.d.mts +13 -6
- package/dist/zod-v3.mjs +17 -4
- package/dist/zod-v4.d.mts +19 -26
- package/dist/zod-v4.mjs +16 -4
- package/dist/zod.d.mts +4 -3
- package/dist/zod.mjs +5 -4
- package/package.json +38 -20
- package/skills/attaform/SKILL.md +6 -2
- package/skills/attaform/references/custom-components.md +7 -2
- package/skills/attaform/references/errors.md +8 -3
- package/skills/attaform/references/saving.md +77 -0
- package/skills/attaform/references/wizards.md +10 -8
- package/dist/abstract.cjs +0 -48
- package/dist/abstract.cjs.map +0 -1
- package/dist/abstract.d.cts +0 -42
- package/dist/abstract.d.ts +0 -42
- package/dist/abstract.mjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
- package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
- package/dist/chunks/devtools.cjs +0 -157
- package/dist/chunks/devtools.cjs.map +0 -1
- package/dist/chunks/devtools.mjs.map +0 -1
- package/dist/chunks/fingerprint.cjs.map +0 -1
- package/dist/chunks/fingerprint.mjs.map +0 -1
- package/dist/chunks/fingerprint2.cjs.map +0 -1
- package/dist/chunks/fingerprint2.mjs.map +0 -1
- package/dist/esbuild.cjs +0 -28
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.d.cts +0 -56
- package/dist/esbuild.d.ts +0 -56
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -51
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -249
- package/dist/index.d.ts +0 -249
- package/dist/index.mjs.map +0 -1
- package/dist/nuxt.cjs +0 -84
- package/dist/nuxt.cjs.map +0 -1
- package/dist/nuxt.d.cts +0 -66
- package/dist/nuxt.d.ts +0 -66
- package/dist/nuxt.mjs.map +0 -1
- package/dist/rollup.cjs +0 -24
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.cts +0 -35
- package/dist/rollup.d.ts +0 -35
- package/dist/rollup.mjs.map +0 -1
- package/dist/rspack.cjs +0 -10
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -40
- package/dist/rspack.d.ts +0 -40
- package/dist/rspack.mjs.map +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
- package/dist/runtime/plugins/attaform.cjs +0 -43
- package/dist/runtime/plugins/attaform.cjs.map +0 -1
- package/dist/runtime/plugins/attaform.d.cts +0 -5
- package/dist/runtime/plugins/attaform.d.ts +0 -5
- package/dist/runtime/plugins/attaform.mjs.map +0 -1
- package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
- package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
- package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
- package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
- package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
- package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
- package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
- package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
- package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
- package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
- package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
- package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
- package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
- package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
- package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
- package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
- package/dist/shared/attaform.DMxM2kol.mjs +0 -1275
- package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
- package/dist/shared/attaform.DRUT703x.d.cts +0 -56
- package/dist/shared/attaform.DRUT703x.d.ts +0 -56
- package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
- package/dist/shared/attaform.DdQN7sgN.cjs +0 -1302
- package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
- package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
- package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
- package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
- package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
- package/dist/shared/attaform.DrvMscNX.cjs +0 -7697
- package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
- package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
- package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
- package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
- package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
- package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
- package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
- package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
- package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
- package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.d.cts +0 -73
- package/dist/transforms.d.ts +0 -73
- package/dist/transforms.mjs.map +0 -1
- package/dist/vite.cjs +0 -363
- package/dist/vite.cjs.map +0 -1
- package/dist/vite.d.cts +0 -133
- package/dist/vite.d.ts +0 -133
- package/dist/vite.mjs.map +0 -1
- package/dist/webpack.cjs +0 -10
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -37
- package/dist/webpack.d.ts +0 -37
- package/dist/webpack.mjs.map +0 -1
- package/dist/zod-v3.cjs +0 -53
- package/dist/zod-v3.cjs.map +0 -1
- package/dist/zod-v3.d.cts +0 -246
- package/dist/zod-v3.d.ts +0 -246
- package/dist/zod-v3.mjs.map +0 -1
- package/dist/zod-v4.cjs +0 -55
- package/dist/zod-v4.cjs.map +0 -1
- package/dist/zod-v4.d.cts +0 -172
- package/dist/zod-v4.d.ts +0 -172
- package/dist/zod-v4.mjs.map +0 -1
- package/dist/zod.cjs +0 -51
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts +0 -7
- package/dist/zod.d.ts +0 -7
- package/dist/zod.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeTypes, createCompoundExpression, createSimpleExpression,
|
|
1
|
+
import { NodeTypes, ElementTypes, createCompoundExpression, createSimpleExpression, processExpression } from '@vue/compiler-core';
|
|
2
2
|
import { S as SSR_COMPONENT_HOST_MODIFIER, V as V_REGISTER_COMPILED_MODIFIER } from './attaform.KvlEedlF.mjs';
|
|
3
3
|
|
|
4
4
|
function getSummarizedProps(node) {
|
|
@@ -40,6 +40,10 @@ function removePropsByName(props, propNames) {
|
|
|
40
40
|
props.splice(index, 1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
function toExpressionArray(value) {
|
|
44
|
+
if (value === void 0) return void 0;
|
|
45
|
+
return Array.isArray(value) ? value : [value];
|
|
46
|
+
}
|
|
43
47
|
function isExactKey(summarizedKey, name) {
|
|
44
48
|
return summarizedKey === name || summarizedKey === `"${name}"`;
|
|
45
49
|
}
|
|
@@ -64,54 +68,13 @@ function flattenExpression(exp) {
|
|
|
64
68
|
return out;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
function generateEqualityExpression$1(selectValue, optionValue,
|
|
68
|
-
const multipleExpression = previousOptionExpressions?.[0];
|
|
69
|
-
if (multipleExpression === void 0) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
"Programming error: `multiple` expression for `select` node not generated while transforming AST"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const optExpressions = previousOptionExpressions.slice(1);
|
|
75
|
-
const noMultipleOptExpressions = optExpressions.reduce(
|
|
76
|
-
(acc, curr, index) => {
|
|
77
|
-
if (index === 0) {
|
|
78
|
-
acc.push("(");
|
|
79
|
-
}
|
|
80
|
-
acc.push(...curr);
|
|
81
|
-
if (index < optExpressions.length - 1) {
|
|
82
|
-
acc.push(" || ");
|
|
83
|
-
}
|
|
84
|
-
if (index === optExpressions.length - 1) {
|
|
85
|
-
acc.push(")");
|
|
86
|
-
}
|
|
87
|
-
return acc;
|
|
88
|
-
},
|
|
89
|
-
[]
|
|
90
|
-
);
|
|
71
|
+
function generateEqualityExpression$1(selectValue, optionValue, multipleExpression) {
|
|
91
72
|
const selectValueArr = Array.isArray(selectValue) ? selectValue : [selectValue];
|
|
92
73
|
const optionValueArr = Array.isArray(optionValue) ? optionValue : [optionValue];
|
|
93
74
|
function getImplicitTrueMultipleExpression(expression) {
|
|
94
75
|
if (expression.length === 1 && expression[0] === "") return [`true`];
|
|
95
76
|
return expression;
|
|
96
77
|
}
|
|
97
|
-
previousOptionExpressions.push(["(", ...selectValueArr, ") === (", ...optionValueArr, ")"]);
|
|
98
|
-
if (!noMultipleOptExpressions.length) {
|
|
99
|
-
return [
|
|
100
|
-
"(",
|
|
101
|
-
...getImplicitTrueMultipleExpression(multipleExpression),
|
|
102
|
-
`) ? ((`,
|
|
103
|
-
...selectValueArr,
|
|
104
|
-
`)?.innerRef?.value?.findIndex?.(el => el === (`,
|
|
105
|
-
...optionValueArr,
|
|
106
|
-
`)) > -1) : (typeof (`,
|
|
107
|
-
...selectValueArr,
|
|
108
|
-
`)?.innerRef?.value !== 'object' && String((`,
|
|
109
|
-
...selectValueArr,
|
|
110
|
-
`)?.innerRef?.value) === String((`,
|
|
111
|
-
...optionValueArr,
|
|
112
|
-
`)))`
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
78
|
return [
|
|
116
79
|
"(",
|
|
117
80
|
...getImplicitTrueMultipleExpression(multipleExpression),
|
|
@@ -119,16 +82,13 @@ function generateEqualityExpression$1(selectValue, optionValue, previousOptionEx
|
|
|
119
82
|
...selectValueArr,
|
|
120
83
|
`)?.innerRef?.value?.findIndex?.(el => el === (`,
|
|
121
84
|
...optionValueArr,
|
|
122
|
-
`)) > -1) : ((`,
|
|
123
|
-
...noMultipleOptExpressions,
|
|
124
|
-
// if true, we already found the relevant option
|
|
125
|
-
`) ? false : (typeof (`,
|
|
85
|
+
`)) > -1) : (typeof (`,
|
|
126
86
|
...selectValueArr,
|
|
127
|
-
`)?.innerRef?.value !== 'object' &&
|
|
87
|
+
`)?.innerRef?.value !== 'object' && (`,
|
|
128
88
|
...selectValueArr,
|
|
129
|
-
`)?.
|
|
89
|
+
`)?.displayValue?.value === String((`,
|
|
130
90
|
...optionValueArr,
|
|
131
|
-
`)))
|
|
91
|
+
`)))`
|
|
132
92
|
];
|
|
133
93
|
}
|
|
134
94
|
function extractMultipleFromSelectSummarizedProps(props) {
|
|
@@ -143,7 +103,7 @@ function extractMultipleFromSelectSummarizedProps(props) {
|
|
|
143
103
|
const value = props[priorityIndex]?.value;
|
|
144
104
|
return typeof value === "string" ? value.replace(/'|"/g, "") : value ?? "true";
|
|
145
105
|
}
|
|
146
|
-
const RECURSABLE_NODE_TYPES
|
|
106
|
+
const RECURSABLE_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
147
107
|
NodeTypes.ELEMENT,
|
|
148
108
|
NodeTypes.FOR,
|
|
149
109
|
NodeTypes.IF,
|
|
@@ -170,6 +130,57 @@ function inferOptionValueFromChildren(node) {
|
|
|
170
130
|
const text = only.content.trim();
|
|
171
131
|
return JSON.stringify(text);
|
|
172
132
|
}
|
|
133
|
+
const pendingOptionBindings = /* @__PURE__ */ new WeakMap();
|
|
134
|
+
function applyPendingOptionBinding(node, pending) {
|
|
135
|
+
const optionProps = getSummarizedProps(node);
|
|
136
|
+
const valueIndex = optionProps.findIndex((p) => isExactKey(p.key, "value"));
|
|
137
|
+
let optionValueSummarizedProp;
|
|
138
|
+
if (valueIndex >= 0 && valueIndex < optionProps.length) {
|
|
139
|
+
optionValueSummarizedProp = optionProps[valueIndex];
|
|
140
|
+
} else {
|
|
141
|
+
const fallback = inferOptionValueFromChildren(node);
|
|
142
|
+
if (fallback === null) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
optionValueSummarizedProp = { key: "value", value: fallback };
|
|
146
|
+
}
|
|
147
|
+
const props = node.props;
|
|
148
|
+
const snapshot = [...props];
|
|
149
|
+
try {
|
|
150
|
+
removePropsByName(props, ["selected"]);
|
|
151
|
+
const authorSelectedArr = toExpressionArray(
|
|
152
|
+
optionProps.find((p) => isExactKey(p.key, "selected"))?.value
|
|
153
|
+
);
|
|
154
|
+
const registerArr = toExpressionArray(pending.registerValue) ?? ["undefined"];
|
|
155
|
+
const boundExpression = generateEqualityExpression$1(
|
|
156
|
+
pending.registerValue,
|
|
157
|
+
optionValueSummarizedProp?.value ?? "undefined",
|
|
158
|
+
pending.multiple
|
|
159
|
+
);
|
|
160
|
+
props.push({
|
|
161
|
+
arg: createSimpleExpression("selected", true),
|
|
162
|
+
exp: createCompoundExpression(
|
|
163
|
+
authorSelectedArr === void 0 ? boundExpression : [
|
|
164
|
+
"((",
|
|
165
|
+
...registerArr,
|
|
166
|
+
") == null ? (",
|
|
167
|
+
...authorSelectedArr,
|
|
168
|
+
") : (",
|
|
169
|
+
...boundExpression,
|
|
170
|
+
"))"
|
|
171
|
+
]
|
|
172
|
+
),
|
|
173
|
+
name: "bind",
|
|
174
|
+
modifiers: [],
|
|
175
|
+
type: NodeTypes.DIRECTIVE,
|
|
176
|
+
loc: node.loc
|
|
177
|
+
});
|
|
178
|
+
} catch (err) {
|
|
179
|
+
props.length = 0;
|
|
180
|
+
props.push(...snapshot);
|
|
181
|
+
console.error("[attaform] component-bridge transform: option binding failed, skipping:", err);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
173
184
|
const componentBridgeTransform = (node, context) => {
|
|
174
185
|
const snapshots = [];
|
|
175
186
|
const snapshotProps = (target) => {
|
|
@@ -177,51 +188,33 @@ const componentBridgeTransform = (node, context) => {
|
|
|
177
188
|
snapshots.push({ target, snapshot: [...target] });
|
|
178
189
|
};
|
|
179
190
|
try {
|
|
180
|
-
let traverseSelectNode = function(_node,
|
|
191
|
+
let traverseSelectNode = function(_node, multipleExpression2) {
|
|
181
192
|
const isOption = _node.type === NodeTypes.ELEMENT && _node.tag === "option";
|
|
182
193
|
if (!isOption) {
|
|
183
|
-
if (!RECURSABLE_NODE_TYPES
|
|
194
|
+
if (!RECURSABLE_NODE_TYPES.has(_node.type)) return;
|
|
184
195
|
const hasChildren = "children" in _node;
|
|
185
196
|
if (!hasChildren) return;
|
|
186
197
|
for (const child of _node.children) {
|
|
187
198
|
if (typeof child === "symbol" || typeof child === "string") continue;
|
|
188
199
|
if (child.type === NodeTypes.SIMPLE_EXPRESSION) continue;
|
|
189
|
-
traverseSelectNode(child,
|
|
200
|
+
traverseSelectNode(child, multipleExpression2);
|
|
190
201
|
}
|
|
191
202
|
return;
|
|
192
203
|
}
|
|
193
204
|
hasSlottedOptions = true;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
optionValueSummarizedProp = optionProps[valueIndex];
|
|
199
|
-
} else {
|
|
200
|
-
const fallback = inferOptionValueFromChildren(_node);
|
|
201
|
-
if (fallback === null) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
optionValueSummarizedProp = { key: "value", value: fallback };
|
|
205
|
-
}
|
|
206
|
-
const props = _node.props;
|
|
207
|
-
snapshotProps(props);
|
|
208
|
-
removePropsByName(props, ["selected"]);
|
|
209
|
-
const newProp = {
|
|
210
|
-
arg: createSimpleExpression("selected", true),
|
|
211
|
-
exp: createCompoundExpression(
|
|
212
|
-
generateEqualityExpression$1(
|
|
213
|
-
registerSummarizedProp?.value ?? "undefined",
|
|
214
|
-
optionValueSummarizedProp?.value ?? "undefined",
|
|
215
|
-
previousOptionExpressions2
|
|
216
|
-
)
|
|
217
|
-
),
|
|
218
|
-
name: "bind",
|
|
219
|
-
modifiers: [],
|
|
220
|
-
type: NodeTypes.DIRECTIVE,
|
|
221
|
-
loc: _node.loc
|
|
222
|
-
};
|
|
223
|
-
props.push(newProp);
|
|
205
|
+
pendingOptionBindings.set(_node, {
|
|
206
|
+
registerValue: registerSummarizedProp?.value ?? "undefined",
|
|
207
|
+
multiple: multipleExpression2
|
|
208
|
+
});
|
|
224
209
|
};
|
|
210
|
+
if (node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.ELEMENT) {
|
|
211
|
+
const pending = pendingOptionBindings.get(node);
|
|
212
|
+
if (pending !== void 0) {
|
|
213
|
+
pendingOptionBindings.delete(node);
|
|
214
|
+
applyPendingOptionBinding(node, pending);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
225
218
|
const isSelect = node.type === NodeTypes.ELEMENT && node.tag === "select";
|
|
226
219
|
const isCustomComponent = node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.COMPONENT;
|
|
227
220
|
const isKebabCustomElement = node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.ELEMENT && node.tag.includes("-") && !NATIVE_FORM_TAGS.has(node.tag);
|
|
@@ -233,25 +226,32 @@ const componentBridgeTransform = (node, context) => {
|
|
|
233
226
|
const registerSummarizedProp = selectSummarizedProps[registerIndex];
|
|
234
227
|
const selectLoc = node.loc;
|
|
235
228
|
let hasSlottedOptions = false;
|
|
236
|
-
const
|
|
237
|
-
const
|
|
229
|
+
const rawMultipleExpression = extractMultipleFromSelectSummarizedProps(selectSummarizedProps);
|
|
230
|
+
const multipleExpression = typeof rawMultipleExpression === "string" ? [rawMultipleExpression] : rawMultipleExpression;
|
|
238
231
|
for (const child of node.children) {
|
|
239
|
-
traverseSelectNode(child,
|
|
232
|
+
traverseSelectNode(child, multipleExpression);
|
|
240
233
|
}
|
|
241
|
-
const isStaticallyNonMultiple =
|
|
234
|
+
const isStaticallyNonMultiple = rawMultipleExpression === "false";
|
|
242
235
|
const isComponentHost = isCustomComponent || isKebabCustomElement;
|
|
243
236
|
const isSelectLikeHost = isSelect || isComponentHost && hasSlottedOptions;
|
|
244
237
|
const isPlainComponentHost = isComponentHost && !hasSlottedOptions;
|
|
245
238
|
const selectProps = node.props;
|
|
239
|
+
const authorSelectValueArr = toExpressionArray(
|
|
240
|
+
selectSummarizedProps.find((p) => isExactKey(p.key, "value"))?.value
|
|
241
|
+
);
|
|
246
242
|
snapshotProps(selectProps);
|
|
247
243
|
removePropsByName(selectProps, ["value"]);
|
|
248
244
|
if (isStaticallyNonMultiple && isSelectLikeHost) {
|
|
249
245
|
const valuePropExpArray = Array.isArray(registerSummarizedProp?.value) ? registerSummarizedProp.value : [registerSummarizedProp?.value ?? "undefined"];
|
|
250
|
-
const initExpression = createCompoundExpression(
|
|
251
|
-
"(",
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
246
|
+
const initExpression = createCompoundExpression(
|
|
247
|
+
authorSelectValueArr === void 0 ? ["(", ...valuePropExpArray, ")?.displayValue.value"] : [
|
|
248
|
+
"((",
|
|
249
|
+
...valuePropExpArray,
|
|
250
|
+
")?.displayValue.value ?? (",
|
|
251
|
+
...authorSelectValueArr,
|
|
252
|
+
"))"
|
|
253
|
+
]
|
|
254
|
+
);
|
|
255
255
|
const simpleExpression = createSimpleExpression(flattenExpression(initExpression), false);
|
|
256
256
|
let outputExp;
|
|
257
257
|
try {
|
|
@@ -470,26 +470,41 @@ const inputTextAreaNodeTransform = (node) => {
|
|
|
470
470
|
const isStaticRadio = typeProp !== void 0 && isStaticTypeOneOf(typeProp.value, ["radio"]);
|
|
471
471
|
const isDynamicType = typeProp !== void 0 && isDynamicTypeValue(typeProp.value);
|
|
472
472
|
const keepStaticValue = isStaticCheckbox || isStaticRadio || isDynamicType;
|
|
473
|
+
const authorCheckedProp = elementProps.find((p) => isExactKey(p.key, "checked"));
|
|
474
|
+
const authorValueProp = keepStaticValue ? void 0 : elementProps.find((p) => isExactKey(p.key, "value"));
|
|
473
475
|
removePropsByName(props, keepStaticValue ? ["checked"] : ["checked", "value"]);
|
|
474
476
|
const registerValueArr = Array.isArray(registerSummarizedProp2.value) ? registerSummarizedProp2.value : [registerSummarizedProp2.value];
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
...registerValueArr,
|
|
478
|
-
|
|
479
|
-
]);
|
|
477
|
+
const authorValueArr = toExpressionArray(authorValueProp?.value);
|
|
478
|
+
const valueExpression = createCompoundExpression(
|
|
479
|
+
authorValueArr === void 0 ? ["(", ...registerValueArr, ")?.displayValue?.value"] : ["((", ...registerValueArr, ")?.displayValue?.value ?? (", ...authorValueArr, "))"]
|
|
480
|
+
);
|
|
480
481
|
const trueValueIndex = elementProps.findIndex((p) => isExactKey(p.key, "true-value"));
|
|
481
482
|
const trueValueProp = elementProps[trueValueIndex];
|
|
482
483
|
const scalarTarget = isStaticCheckbox ? trueValueProp !== void 0 ? trueValueProp.value : "true" : elementValueSummarizedProp2.value;
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
const authorCheckedArr = toExpressionArray(authorCheckedProp?.value);
|
|
485
|
+
const checkedExpression = authorCheckedArr === void 0 ? generateEqualityExpression(
|
|
486
|
+
registerSummarizedProp2.value,
|
|
487
|
+
elementValueSummarizedProp2.value,
|
|
488
|
+
scalarTarget
|
|
489
|
+
) : [
|
|
490
|
+
"((",
|
|
491
|
+
...registerValueArr,
|
|
492
|
+
") == null ? (",
|
|
493
|
+
...authorCheckedArr,
|
|
494
|
+
") : (",
|
|
488
495
|
...generateEqualityExpression(
|
|
489
496
|
registerSummarizedProp2.value,
|
|
490
497
|
elementValueSummarizedProp2.value,
|
|
491
498
|
scalarTarget
|
|
492
499
|
),
|
|
500
|
+
"))"
|
|
501
|
+
];
|
|
502
|
+
const coreExpression = [
|
|
503
|
+
"(",
|
|
504
|
+
...elementSelectionLabelExpression.children,
|
|
505
|
+
") === 'checked' ? (",
|
|
506
|
+
// resolves to a boolean
|
|
507
|
+
...checkedExpression,
|
|
493
508
|
") : (",
|
|
494
509
|
// resolves to the provided register value
|
|
495
510
|
...valueExpression.children,
|
|
@@ -562,22 +577,10 @@ const inputTextAreaNodeTransform = (node) => {
|
|
|
562
577
|
}
|
|
563
578
|
};
|
|
564
579
|
|
|
565
|
-
|
|
566
|
-
NodeTypes.ELEMENT,
|
|
567
|
-
NodeTypes.FOR,
|
|
568
|
-
NodeTypes.IF,
|
|
569
|
-
NodeTypes.IF_BRANCH
|
|
570
|
-
]);
|
|
571
|
-
function findRedundantStateBinding(props, stateNames) {
|
|
580
|
+
function findRedundantStateBinding(props) {
|
|
572
581
|
for (const prop of props) {
|
|
573
|
-
if (prop.type === NodeTypes.ATTRIBUTE)
|
|
574
|
-
if (stateNames.includes(prop.name)) return prop.name;
|
|
575
|
-
continue;
|
|
576
|
-
}
|
|
582
|
+
if (prop.type === NodeTypes.ATTRIBUTE) continue;
|
|
577
583
|
if (prop.name === "model") return "v-model";
|
|
578
|
-
if (prop.name === "bind" && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic && stateNames.includes(prop.arg.content)) {
|
|
579
|
-
return `:${prop.arg.content}`;
|
|
580
|
-
}
|
|
581
584
|
}
|
|
582
585
|
return null;
|
|
583
586
|
}
|
|
@@ -602,42 +605,23 @@ function emitRedundantWarning(tag, binding) {
|
|
|
602
605
|
`[attaform] \`${binding}\` is redundant beside v-register on <${tag}>. v-register already drives this field's value, so keep v-register alone and drop \`${binding}\`. (An identity \`:value\` on a radio or <option> is expected and stays silent.)`
|
|
603
606
|
);
|
|
604
607
|
}
|
|
605
|
-
function walkOptionsForSelected(selectNode) {
|
|
606
|
-
const visit = (candidate) => {
|
|
607
|
-
if (candidate.type === NodeTypes.ELEMENT && candidate.tag === "option") {
|
|
608
|
-
const found = findRedundantStateBinding(candidate.props, ["selected"]);
|
|
609
|
-
if (found !== null) emitRedundantWarning("option", found);
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
if (!RECURSABLE_NODE_TYPES.has(candidate.type)) return;
|
|
613
|
-
if (!("children" in candidate)) return;
|
|
614
|
-
for (const child of candidate.children) {
|
|
615
|
-
if (typeof child === "string" || typeof child === "symbol") continue;
|
|
616
|
-
if (child.type === NodeTypes.SIMPLE_EXPRESSION) continue;
|
|
617
|
-
visit(child);
|
|
618
|
-
}
|
|
619
|
-
};
|
|
620
|
-
for (const child of selectNode.children) visit(child);
|
|
621
|
-
}
|
|
622
608
|
function warnIfRedundant(node) {
|
|
623
609
|
if (node.tagType !== ElementTypes.ELEMENT) return;
|
|
624
610
|
const tag = node.tag;
|
|
625
611
|
if (tag === "select") {
|
|
626
|
-
const found2 = findRedundantStateBinding(node.props
|
|
612
|
+
const found2 = findRedundantStateBinding(node.props);
|
|
627
613
|
if (found2 !== null) emitRedundantWarning("select", found2);
|
|
628
|
-
walkOptionsForSelected(node);
|
|
629
614
|
return;
|
|
630
615
|
}
|
|
631
616
|
if (tag === "textarea") {
|
|
632
|
-
const found2 = findRedundantStateBinding(node.props
|
|
617
|
+
const found2 = findRedundantStateBinding(node.props);
|
|
633
618
|
if (found2 !== null) emitRedundantWarning("textarea", found2);
|
|
634
619
|
return;
|
|
635
620
|
}
|
|
636
621
|
if (tag !== "input") return;
|
|
637
622
|
const kind = classifyInput(node.props);
|
|
638
623
|
if (kind === "dynamic" || kind === "file") return;
|
|
639
|
-
const
|
|
640
|
-
const found = findRedundantStateBinding(node.props, stateNames);
|
|
624
|
+
const found = findRedundantStateBinding(node.props);
|
|
641
625
|
if (found !== null) emitRedundantWarning("input", found);
|
|
642
626
|
}
|
|
643
627
|
const redundantBindingWarnTransform = (node) => {
|
|
@@ -791,4 +775,3 @@ function hasPreamble(element) {
|
|
|
791
775
|
}
|
|
792
776
|
|
|
793
777
|
export { vRegisterPreambleTransform as a, componentBridgeTransform as c, inputTextAreaNodeTransform as i, redundantBindingWarnTransform as r, vRegisterHintTransform as v };
|
|
794
|
-
//# sourceMappingURL=attaform.Cs2Rbdlo.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const index = require('./attaform.DdQN7sgN.cjs');
|
|
6
|
-
const walkFieldMeta = require('./attaform.D6tk90Rc.cjs');
|
|
1
|
+
import { a as InvalidUseFormConfigError } from './attaform.CZYt_5N_.mjs';
|
|
2
|
+
import { u as useForm$2 } from './attaform.D1fnTifF.mjs';
|
|
3
|
+
import { u as useForm$1 } from './attaform.C2MVyuxC.mjs';
|
|
4
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.B0dKL8ST.mjs';
|
|
7
5
|
|
|
8
6
|
function isZodV4SchemaShape(value) {
|
|
9
7
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -14,21 +12,21 @@ function isZodV4SchemaShape(value) {
|
|
|
14
12
|
|
|
15
13
|
function useForm(configuration) {
|
|
16
14
|
if (configuration === void 0 || configuration === null || configuration.schema === void 0) {
|
|
17
|
-
throw new
|
|
15
|
+
throw new InvalidUseFormConfigError();
|
|
18
16
|
}
|
|
19
17
|
const { schema } = configuration;
|
|
20
18
|
if (isZodV4SchemaShape(schema)) {
|
|
21
|
-
return
|
|
19
|
+
return useForm$1(configuration);
|
|
22
20
|
}
|
|
23
|
-
return useForm$
|
|
21
|
+
return useForm$2(configuration);
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
const fieldMeta =
|
|
24
|
+
const fieldMeta = installingFieldMetaStore;
|
|
27
25
|
function withMeta(schema, payload) {
|
|
28
26
|
const target = schema;
|
|
29
|
-
const existing =
|
|
27
|
+
const existing = getFieldMetaForSchema(target) ?? {};
|
|
30
28
|
const cloned = cloneSchema(schema);
|
|
31
|
-
|
|
29
|
+
installingFieldMetaStore.add(cloned, { ...existing, ...payload });
|
|
32
30
|
return cloned;
|
|
33
31
|
}
|
|
34
32
|
function cloneSchema(schema) {
|
|
@@ -40,7 +38,4 @@ function cloneSchema(schema) {
|
|
|
40
38
|
return new Ctor(candidate._def);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
exports.useForm = useForm;
|
|
45
|
-
exports.withMeta = withMeta;
|
|
46
|
-
//# sourceMappingURL=attaform.B9Wyhfro.cjs.map
|
|
41
|
+
export { fieldMeta as f, useForm as u, withMeta as w };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
4
2
|
if (value === null) return "null";
|
|
5
3
|
if (value === void 0) return "undefined";
|
|
@@ -26,6 +24,14 @@ function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
26
24
|
try {
|
|
27
25
|
if (value instanceof Date) return `date:${value.getTime()}`;
|
|
28
26
|
if (value instanceof RegExp) return `regex:${String(value)}`;
|
|
27
|
+
if (value instanceof Map) {
|
|
28
|
+
const entries2 = [...value].map(([k, v]) => `${canonicalStringify(k, seen)}=>${canonicalStringify(v, seen)}`).sort();
|
|
29
|
+
return `map:[${entries2.join(",")}]`;
|
|
30
|
+
}
|
|
31
|
+
if (value instanceof Set) {
|
|
32
|
+
const members = [...value].map((v) => canonicalStringify(v, seen)).sort();
|
|
33
|
+
return `set:[${members.join(",")}]`;
|
|
34
|
+
}
|
|
29
35
|
const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`);
|
|
30
36
|
return `{${entries.join(",")}}`;
|
|
31
37
|
} finally {
|
|
@@ -35,5 +41,4 @@ function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
35
41
|
return "unknown";
|
|
36
42
|
}
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=attaform.CQN9R62B.cjs.map
|
|
44
|
+
export { canonicalStringify as c };
|