rip-lang 3.13.109 → 3.13.110
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/README.md +1 -1
- package/docs/dist/rip.js +185 -17
- package/docs/dist/rip.min.js +159 -157
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +3 -2
- package/src/components.js +117 -2
- package/src/typecheck.js +21 -14
- package/src/types.js +51 -10
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.110-blue.svg" alt="Version"></a>
|
|
13
13
|
<a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
|
|
14
14
|
<a href="#"><img src="https://img.shields.io/badge/tests-1%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
package/docs/dist/rip.js
CHANGED
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
let endIdx = findMatchingOutdent(tokens, indentIdx);
|
|
436
436
|
return { typeText: members.join(" | "), endIdx };
|
|
437
437
|
}
|
|
438
|
-
function emitTypes(tokens, sexpr = null) {
|
|
438
|
+
function emitTypes(tokens, sexpr = null, source = "") {
|
|
439
439
|
let lines = [];
|
|
440
440
|
let indentLevel = 0;
|
|
441
441
|
let indentStr = " ";
|
|
@@ -444,6 +444,9 @@
|
|
|
444
444
|
let classFields = new Set;
|
|
445
445
|
let usesSignal = false;
|
|
446
446
|
let usesComputed = false;
|
|
447
|
+
let usesRipIntrinsicProps = false;
|
|
448
|
+
const sourceLines = typeof source === "string" ? source.split(`
|
|
449
|
+
`) : [];
|
|
447
450
|
for (let i = 0;i < tokens.length; i++) {
|
|
448
451
|
const tag = tokens[i][0];
|
|
449
452
|
if (tag === "REACTIVE_ASSIGN")
|
|
@@ -1021,7 +1024,7 @@
|
|
|
1021
1024
|
}
|
|
1022
1025
|
let componentVars = new Set;
|
|
1023
1026
|
if (sexpr) {
|
|
1024
|
-
emitComponentTypes(sexpr, lines, indent, indentLevel, componentVars);
|
|
1027
|
+
usesRipIntrinsicProps = emitComponentTypes(sexpr, lines, indent, indentLevel, componentVars, sourceLines) || usesRipIntrinsicProps;
|
|
1025
1028
|
if (componentVars.size > 0) {
|
|
1026
1029
|
for (let k = lines.length - 1;k >= 0; k--) {
|
|
1027
1030
|
let match = lines[k].match(/(?:declare |export )*(?:const|let) (\w+)/);
|
|
@@ -1033,6 +1036,13 @@
|
|
|
1033
1036
|
if (lines.length === 0)
|
|
1034
1037
|
return null;
|
|
1035
1038
|
let preamble = [];
|
|
1039
|
+
if (usesRipIntrinsicProps) {
|
|
1040
|
+
preamble.push("type __RipElementMap = HTMLElementTagNameMap & Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>;");
|
|
1041
|
+
preamble.push("type __RipTag = keyof __RipElementMap;");
|
|
1042
|
+
preamble.push("type __RipAttrKeys<T> = { [K in keyof T]-?: K extends 'style' ? never : T[K] extends (...args: any[]) => any ? never : K }[keyof T] & string;");
|
|
1043
|
+
preamble.push("type __RipEvents = { [K in keyof HTMLElementEventMap as `@${K}`]?: ((event: HTMLElementEventMap[K]) => void) | null };");
|
|
1044
|
+
preamble.push("type __RipProps<K extends __RipTag> = { [P in __RipAttrKeys<__RipElementMap[K]>]?: __RipElementMap[K][P] } & __RipEvents & { class?: string; style?: string; [k: `data-${string}`]: any; [k: `aria-${string}`]: any };");
|
|
1045
|
+
}
|
|
1036
1046
|
if (usesSignal) {
|
|
1037
1047
|
preamble.push("interface Signal<T> { value: T; read(): T; lock(): Signal<T>; free(): Signal<T>; kill(): T; }");
|
|
1038
1048
|
preamble.push("declare function __state<T>(value: T | Signal<T>): Signal<T>;");
|
|
@@ -1060,10 +1070,36 @@
|
|
|
1060
1070
|
typeStr = typeStr.replace(/(\w+(?:<[^>]+>)?)\!/g, "NonNullable<$1>");
|
|
1061
1071
|
return typeStr;
|
|
1062
1072
|
}
|
|
1063
|
-
function
|
|
1073
|
+
function findInheritedTagNearLine(sourceLines, line, componentName = null) {
|
|
1074
|
+
if (!Array.isArray(sourceLines))
|
|
1075
|
+
return null;
|
|
1076
|
+
if (Number.isInteger(line)) {
|
|
1077
|
+
const start = Math.max(0, line - 2);
|
|
1078
|
+
const end = Math.min(sourceLines.length - 1, line + 2);
|
|
1079
|
+
for (let i = start;i <= end; i++) {
|
|
1080
|
+
const m = sourceLines[i]?.match(/#\s*@inherits\s+([A-Za-z][\w-]*)/);
|
|
1081
|
+
if (m)
|
|
1082
|
+
return m[1];
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
if (componentName) {
|
|
1086
|
+
const escaped = componentName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1087
|
+
const declRe = new RegExp(`\\b${escaped}\\b\\s*=\\s*component\\b`);
|
|
1088
|
+
for (const lineText of sourceLines) {
|
|
1089
|
+
if (!declRe.test(lineText))
|
|
1090
|
+
continue;
|
|
1091
|
+
const m = lineText.match(/#\s*@inherits\s+([A-Za-z][\w-]*)/);
|
|
1092
|
+
if (m)
|
|
1093
|
+
return m[1];
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return null;
|
|
1097
|
+
}
|
|
1098
|
+
function emitComponentTypes(sexpr, lines, indent, indentLevel, componentVars, sourceLines) {
|
|
1064
1099
|
if (!Array.isArray(sexpr))
|
|
1065
|
-
return;
|
|
1100
|
+
return false;
|
|
1066
1101
|
let head = sexpr[0]?.valueOf?.() ?? sexpr[0];
|
|
1102
|
+
let usesIntrinsicProps = false;
|
|
1067
1103
|
let exported = false;
|
|
1068
1104
|
let name = null;
|
|
1069
1105
|
let compNode = null;
|
|
@@ -1081,6 +1117,10 @@
|
|
|
1081
1117
|
}
|
|
1082
1118
|
if (name && compNode) {
|
|
1083
1119
|
let exp = exported ? "export " : "";
|
|
1120
|
+
let inheritsTag = findInheritedTagNearLine(sourceLines, compNode.loc?.r ?? sexpr.loc?.r, name);
|
|
1121
|
+
let inheritedPropsType = inheritsTag ? `__RipProps<'${inheritsTag}'>` : null;
|
|
1122
|
+
if (inheritedPropsType)
|
|
1123
|
+
usesIntrinsicProps = true;
|
|
1084
1124
|
let body = compNode[2];
|
|
1085
1125
|
let members = Array.isArray(body) && (body[0]?.valueOf?.() ?? body[0]) === "block" ? body.slice(1) : body ? [body] : [];
|
|
1086
1126
|
let publicProps = [];
|
|
@@ -1165,12 +1205,16 @@
|
|
|
1165
1205
|
}
|
|
1166
1206
|
}
|
|
1167
1207
|
lines.push(`${exp}declare class ${name} {`);
|
|
1168
|
-
if (publicProps.length > 0) {
|
|
1208
|
+
if (publicProps.length > 0 || inheritedPropsType) {
|
|
1169
1209
|
let propsOpt = hasRequired ? "" : "?";
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1210
|
+
if (publicProps.length > 0) {
|
|
1211
|
+
lines.push(` constructor(props${propsOpt}: {`);
|
|
1212
|
+
for (let p of publicProps)
|
|
1213
|
+
lines.push(p);
|
|
1214
|
+
lines.push(inheritedPropsType ? ` } & ${inheritedPropsType});` : " });");
|
|
1215
|
+
} else {
|
|
1216
|
+
lines.push(` constructor(props${propsOpt}: ${inheritedPropsType});`);
|
|
1217
|
+
}
|
|
1174
1218
|
}
|
|
1175
1219
|
for (let m of bodyMembers)
|
|
1176
1220
|
lines.push(m);
|
|
@@ -1179,13 +1223,14 @@
|
|
|
1179
1223
|
if (head === "program" || head === "block") {
|
|
1180
1224
|
for (let i = 1;i < sexpr.length; i++) {
|
|
1181
1225
|
if (Array.isArray(sexpr[i])) {
|
|
1182
|
-
emitComponentTypes(sexpr[i], lines, indent, indentLevel, componentVars);
|
|
1226
|
+
usesIntrinsicProps = emitComponentTypes(sexpr[i], lines, indent, indentLevel, componentVars, sourceLines) || usesIntrinsicProps;
|
|
1183
1227
|
}
|
|
1184
1228
|
}
|
|
1185
1229
|
}
|
|
1186
1230
|
if (head === "export" && Array.isArray(sexpr[1]) && !compNode) {
|
|
1187
|
-
emitComponentTypes(sexpr[1], lines, indent, indentLevel, componentVars);
|
|
1231
|
+
usesIntrinsicProps = emitComponentTypes(sexpr[1], lines, indent, indentLevel, componentVars, sourceLines) || usesIntrinsicProps;
|
|
1188
1232
|
}
|
|
1233
|
+
return usesIntrinsicProps;
|
|
1189
1234
|
}
|
|
1190
1235
|
function generateEnum(head, rest, context) {
|
|
1191
1236
|
let [name, body] = rest;
|
|
@@ -3849,6 +3894,33 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
3849
3894
|
return target[2].type;
|
|
3850
3895
|
return null;
|
|
3851
3896
|
}
|
|
3897
|
+
function findInheritedTagNearLine2(source, line, componentName = null) {
|
|
3898
|
+
if (typeof source !== "string")
|
|
3899
|
+
return null;
|
|
3900
|
+
const lines = source.split(`
|
|
3901
|
+
`);
|
|
3902
|
+
if (Number.isInteger(line)) {
|
|
3903
|
+
const start = Math.max(0, line - 2);
|
|
3904
|
+
const end = Math.min(lines.length - 1, line + 2);
|
|
3905
|
+
for (let i = start;i <= end; i++) {
|
|
3906
|
+
const m = lines[i]?.match(/#\s*@inherits\s+([A-Za-z][\w-]*)/);
|
|
3907
|
+
if (m)
|
|
3908
|
+
return m[1];
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
if (componentName) {
|
|
3912
|
+
const escaped = componentName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3913
|
+
const declRe = new RegExp(`\\b${escaped}\\b\\s*=\\s*component\\b`);
|
|
3914
|
+
for (const lineText of lines) {
|
|
3915
|
+
if (!declRe.test(lineText))
|
|
3916
|
+
continue;
|
|
3917
|
+
const m = lineText.match(/#\s*@inherits\s+([A-Za-z][\w-]*)/);
|
|
3918
|
+
if (m)
|
|
3919
|
+
return m[1];
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
return null;
|
|
3923
|
+
}
|
|
3852
3924
|
function installComponentSupport(CodeGenerator, Lexer2) {
|
|
3853
3925
|
let meta = (node, key) => node instanceof String ? node[key] : undefined;
|
|
3854
3926
|
const origClassify = Lexer2.prototype.classifyKeyword;
|
|
@@ -4359,12 +4431,22 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4359
4431
|
autoEventHandlers.set(name[2].toLowerCase() + name.slice(3), name);
|
|
4360
4432
|
}
|
|
4361
4433
|
}
|
|
4434
|
+
const inheritsTag = findInheritedTagNearLine2(this.options.source, sexpr?.loc?.r, this._componentName);
|
|
4435
|
+
const publicPropNames = new Set;
|
|
4436
|
+
for (const { name, isPublic } of stateVars)
|
|
4437
|
+
if (isPublic)
|
|
4438
|
+
publicPropNames.add(name);
|
|
4439
|
+
for (const { name, isPublic } of readonlyVars)
|
|
4440
|
+
if (isPublic)
|
|
4441
|
+
publicPropNames.add(name);
|
|
4362
4442
|
const prevComponentMembers = this.componentMembers;
|
|
4363
4443
|
const prevReactiveMembers = this.reactiveMembers;
|
|
4364
4444
|
const prevAutoEventHandlers = this._autoEventHandlers;
|
|
4445
|
+
const prevInheritsTag = this._inheritsTag;
|
|
4365
4446
|
this.componentMembers = memberNames;
|
|
4366
4447
|
this.reactiveMembers = reactiveMembers;
|
|
4367
4448
|
this._autoEventHandlers = autoEventHandlers.size > 0 ? autoEventHandlers : null;
|
|
4449
|
+
this._inheritsTag = inheritsTag || null;
|
|
4368
4450
|
if (this.options.stubComponents) {
|
|
4369
4451
|
const expandType = (t) => t ? t.replace(/::/g, ":").replace(/(\w+(?:<[^>]+>)?)\?\?/g, "$1 | null | undefined").replace(/(\w+(?:<[^>]+>)?)\?(?![.:])/g, "$1 | undefined").replace(/(\w+(?:<[^>]+>)?)\!/g, "NonNullable<$1>") : null;
|
|
4370
4452
|
const sl = [];
|
|
@@ -4387,7 +4469,9 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4387
4469
|
{
|
|
4388
4470
|
const hasRequired = propEntries.length > 0 && stateVars.some((v) => v.isPublic && v.required);
|
|
4389
4471
|
const propsOpt = hasRequired ? "" : "?";
|
|
4390
|
-
|
|
4472
|
+
let propsType = propEntries.length > 0 ? `{${propEntries.join("; ")}}` : "{}";
|
|
4473
|
+
if (inheritsTag)
|
|
4474
|
+
propsType += ` & __RipProps<'${inheritsTag}'>`;
|
|
4391
4475
|
sl.push(` constructor(props${propsOpt}: ${propsType}) {}`);
|
|
4392
4476
|
}
|
|
4393
4477
|
const inferLiteralType = (v) => {
|
|
@@ -4619,6 +4703,7 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4619
4703
|
this.componentMembers = prevComponentMembers;
|
|
4620
4704
|
this.reactiveMembers = prevReactiveMembers;
|
|
4621
4705
|
this._autoEventHandlers = prevAutoEventHandlers;
|
|
4706
|
+
this._inheritsTag = prevInheritsTag;
|
|
4622
4707
|
return sl.join(`
|
|
4623
4708
|
`);
|
|
4624
4709
|
}
|
|
@@ -4646,6 +4731,17 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4646
4731
|
lines.push(` this.${name} = __state(${val});`);
|
|
4647
4732
|
}
|
|
4648
4733
|
}
|
|
4734
|
+
if (inheritsTag) {
|
|
4735
|
+
lines.push(" this._rest = {};");
|
|
4736
|
+
lines.push(" for (const __k in props) {");
|
|
4737
|
+
if (publicPropNames.size > 0) {
|
|
4738
|
+
const checks = [...publicPropNames].map((name) => `__k !== '${name}'`).join(" && ");
|
|
4739
|
+
lines.push(` if (${checks} && !__k.startsWith('__bind_')) this._rest[__k] = props[__k];`);
|
|
4740
|
+
} else {
|
|
4741
|
+
lines.push(" if (!__k.startsWith('__bind_')) this._rest[__k] = props[__k];");
|
|
4742
|
+
}
|
|
4743
|
+
lines.push(" }");
|
|
4744
|
+
}
|
|
4649
4745
|
for (const { name, expr } of derivedVars) {
|
|
4650
4746
|
if (this.is(expr, "block")) {
|
|
4651
4747
|
const transformed = this.transformComponentMembers(expr);
|
|
@@ -4672,6 +4768,63 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4672
4768
|
}
|
|
4673
4769
|
}
|
|
4674
4770
|
lines.push(" }");
|
|
4771
|
+
if (inheritsTag) {
|
|
4772
|
+
lines.push(" _setRestProp(key, value) {");
|
|
4773
|
+
lines.push(" if (key.startsWith('__bind_')) return;");
|
|
4774
|
+
lines.push(" this._rest || (this._rest = {});");
|
|
4775
|
+
lines.push(" if (value == null) delete this._rest[key];");
|
|
4776
|
+
lines.push(" else this._rest[key] = value;");
|
|
4777
|
+
lines.push(" this._applyInheritedProp(this._inheritedEl, key, value);");
|
|
4778
|
+
lines.push(" }");
|
|
4779
|
+
lines.push(" _applyRestToInheritedEl() {");
|
|
4780
|
+
lines.push(" if (!this._inheritedEl || !this._rest) return;");
|
|
4781
|
+
lines.push(" for (const key in this._rest) this._applyInheritedProp(this._inheritedEl, key, this._rest[key]);");
|
|
4782
|
+
lines.push(" }");
|
|
4783
|
+
lines.push(" _applyInheritedProp(el, key, value) {");
|
|
4784
|
+
lines.push(" if (!el || key === 'key' || key === 'ref' || key.startsWith('__bind_')) return;");
|
|
4785
|
+
lines.push(" if (key[0] === '@') {");
|
|
4786
|
+
lines.push(" const event = key.slice(1).split('.')[0];");
|
|
4787
|
+
lines.push(" this._restHandlers || (this._restHandlers = {});");
|
|
4788
|
+
lines.push(" const prev = this._restHandlers[key];");
|
|
4789
|
+
lines.push(" if (prev) el.removeEventListener(event, prev);");
|
|
4790
|
+
lines.push(" if (typeof value === 'function') {");
|
|
4791
|
+
lines.push(" const next = (e) => __batch(() => value(e));");
|
|
4792
|
+
lines.push(" this._restHandlers[key] = next;");
|
|
4793
|
+
lines.push(" el.addEventListener(event, next);");
|
|
4794
|
+
lines.push(" } else {");
|
|
4795
|
+
lines.push(" delete this._restHandlers[key];");
|
|
4796
|
+
lines.push(" }");
|
|
4797
|
+
lines.push(" return;");
|
|
4798
|
+
lines.push(" }");
|
|
4799
|
+
lines.push(" if (key === 'class' || key === 'className') {");
|
|
4800
|
+
lines.push(" if (el instanceof SVGElement) el.setAttribute('class', __clsx(value));");
|
|
4801
|
+
lines.push(" else el.className = __clsx(value);");
|
|
4802
|
+
lines.push(" return;");
|
|
4803
|
+
lines.push(" }");
|
|
4804
|
+
lines.push(" if (key === 'style') {");
|
|
4805
|
+
lines.push(" if (value == null) { el.removeAttribute('style'); return; }");
|
|
4806
|
+
lines.push(" if (typeof value === 'string') { el.setAttribute('style', value); return; }");
|
|
4807
|
+
lines.push(" if (typeof value === 'object') { Object.assign(el.style, value); return; }");
|
|
4808
|
+
lines.push(" }");
|
|
4809
|
+
lines.push(" if (key === 'innerHTML' || key === 'textContent' || key === 'innerText') {");
|
|
4810
|
+
lines.push(" el[key] = value ?? '';");
|
|
4811
|
+
lines.push(" return;");
|
|
4812
|
+
lines.push(" }");
|
|
4813
|
+
lines.push(" if (key in el && !key.includes('-')) {");
|
|
4814
|
+
lines.push(" el[key] = value;");
|
|
4815
|
+
lines.push(" return;");
|
|
4816
|
+
lines.push(" }");
|
|
4817
|
+
lines.push(" if (value == null || value === false) {");
|
|
4818
|
+
lines.push(" el.removeAttribute(key);");
|
|
4819
|
+
lines.push(" return;");
|
|
4820
|
+
lines.push(" }");
|
|
4821
|
+
lines.push(" if (value === true) {");
|
|
4822
|
+
lines.push(" el.setAttribute(key, '');");
|
|
4823
|
+
lines.push(" return;");
|
|
4824
|
+
lines.push(" }");
|
|
4825
|
+
lines.push(" el.setAttribute(key, value);");
|
|
4826
|
+
lines.push(" }");
|
|
4827
|
+
}
|
|
4675
4828
|
for (const { name, func } of methods) {
|
|
4676
4829
|
if (Array.isArray(func) && (func[0] === "->" || func[0] === "=>")) {
|
|
4677
4830
|
const [, params, methodBody] = func;
|
|
@@ -4720,6 +4873,7 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
|
|
|
4720
4873
|
this.componentMembers = prevComponentMembers;
|
|
4721
4874
|
this.reactiveMembers = prevReactiveMembers;
|
|
4722
4875
|
this._autoEventHandlers = prevAutoEventHandlers;
|
|
4876
|
+
this._inheritsTag = prevInheritsTag;
|
|
4723
4877
|
if (blockFactoriesCode) {
|
|
4724
4878
|
return `(() => {
|
|
4725
4879
|
${blockFactoriesCode}return ${lines.join(`
|
|
@@ -4765,6 +4919,7 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
4765
4919
|
this._pendingAutoWire = false;
|
|
4766
4920
|
this._autoWireEl = null;
|
|
4767
4921
|
this._autoWireExplicit = null;
|
|
4922
|
+
this._inheritsTargetBound = false;
|
|
4768
4923
|
const statements = this.is(body, "block") ? body.slice(1) : [body];
|
|
4769
4924
|
let rootVar;
|
|
4770
4925
|
if (statements.length === 0) {
|
|
@@ -4848,6 +5003,7 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
4848
5003
|
}
|
|
4849
5004
|
if (idStr)
|
|
4850
5005
|
this._createLines.push(`${elVar}.id = '${idStr}';`);
|
|
5006
|
+
this._bindInheritedTarget(actualTag, elVar);
|
|
4851
5007
|
return elVar;
|
|
4852
5008
|
}
|
|
4853
5009
|
if (!Array.isArray(sexpr)) {
|
|
@@ -5000,6 +5156,15 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
5000
5156
|
this._autoWireEl = null;
|
|
5001
5157
|
this._autoWireExplicit = null;
|
|
5002
5158
|
};
|
|
5159
|
+
proto._bindInheritedTarget = function(tag, elVar) {
|
|
5160
|
+
if (!this._inheritsTag || this._factoryMode || this._inheritsTargetBound)
|
|
5161
|
+
return;
|
|
5162
|
+
if (tag !== this._inheritsTag)
|
|
5163
|
+
return;
|
|
5164
|
+
this._inheritsTargetBound = true;
|
|
5165
|
+
this._createLines.push(`this._inheritedEl = ${elVar};`);
|
|
5166
|
+
this._createLines.push("this._applyRestToInheritedEl();");
|
|
5167
|
+
};
|
|
5003
5168
|
proto.generateTag = function(tag, classes, args, id) {
|
|
5004
5169
|
const elVar = this.newElementVar();
|
|
5005
5170
|
const isSvg = SVG_TAGS.has(tag) || this._svgDepth > 0;
|
|
@@ -5011,6 +5176,7 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
5011
5176
|
if (id) {
|
|
5012
5177
|
this._createLines.push(`${elVar}.id = '${id}';`);
|
|
5013
5178
|
}
|
|
5179
|
+
this._bindInheritedTarget(tag, elVar);
|
|
5014
5180
|
if (this._componentName && this._elementCount === 1 && !this._factoryMode && !this.options.skipDataPart) {
|
|
5015
5181
|
this._createLines.push(`${elVar}.setAttribute('data-part', '${this._componentName}');`);
|
|
5016
5182
|
}
|
|
@@ -5056,6 +5222,7 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
5056
5222
|
}
|
|
5057
5223
|
if (id)
|
|
5058
5224
|
this._createLines.push(`${elVar}.id = '${id}';`);
|
|
5225
|
+
this._bindInheritedTarget(tag, elVar);
|
|
5059
5226
|
const autoWireClaimed = this._claimAutoWire(elVar);
|
|
5060
5227
|
const classArgs = [...staticClassArgs || [], ...classExprs.map((e) => this.generateInComponent(e, "value"))];
|
|
5061
5228
|
const prevClassArgs = this._pendingClassArgs;
|
|
@@ -5429,7 +5596,7 @@ ${blockFactoriesCode}return ${lines.join(`
|
|
|
5429
5596
|
}
|
|
5430
5597
|
this._setupLines.push(`try { if (${instVar}._setup) ${instVar}._setup(); if (${instVar}.mounted) ${instVar}.mounted(); } catch (__e) { __handleComponentError(__e, ${instVar}); }`);
|
|
5431
5598
|
for (const { key, valueCode } of reactiveProps) {
|
|
5432
|
-
this._pushEffect(`if (${instVar}.${key}) ${instVar}.${key}.value = ${valueCode};`);
|
|
5599
|
+
this._pushEffect(`if (${instVar}.${key} && typeof ${instVar}.${key} === 'object' && 'value' in ${instVar}.${key}) ${instVar}.${key}.value = ${valueCode}; else if (${instVar}._setRestProp) ${instVar}._setRestProp('${key}', ${valueCode});`);
|
|
5433
5600
|
}
|
|
5434
5601
|
for (const line of childrenSetupLines) {
|
|
5435
5602
|
this._setupLines.push(line);
|
|
@@ -9367,7 +9534,7 @@ if (typeof globalThis !== 'undefined') {
|
|
|
9367
9534
|
}
|
|
9368
9535
|
if (tokens.every((t) => t[0] === "TERMINATOR")) {
|
|
9369
9536
|
if (typeTokens)
|
|
9370
|
-
dts = emitTypes(typeTokens, ["program"]);
|
|
9537
|
+
dts = emitTypes(typeTokens, ["program"], source);
|
|
9371
9538
|
return { tokens, sexpr: ["program"], code: "", dts, data: dataSection, reactiveVars: {} };
|
|
9372
9539
|
}
|
|
9373
9540
|
parser.lexer = {
|
|
@@ -9409,6 +9576,7 @@ if (typeof globalThis !== 'undefined') {
|
|
|
9409
9576
|
}
|
|
9410
9577
|
let generator = new CodeGenerator({
|
|
9411
9578
|
dataSection,
|
|
9579
|
+
source,
|
|
9412
9580
|
skipPreamble: this.options.skipPreamble,
|
|
9413
9581
|
skipRuntimes: this.options.skipRuntimes,
|
|
9414
9582
|
skipExports: this.options.skipExports,
|
|
@@ -9430,7 +9598,7 @@ if (typeof globalThis !== 'undefined') {
|
|
|
9430
9598
|
//# sourceMappingURL=${this.options.filename}.js.map`;
|
|
9431
9599
|
}
|
|
9432
9600
|
if (typeTokens) {
|
|
9433
|
-
dts = emitTypes(typeTokens, sexpr);
|
|
9601
|
+
dts = emitTypes(typeTokens, sexpr, source);
|
|
9434
9602
|
}
|
|
9435
9603
|
return { tokens, sexpr, code, dts, map, reverseMap, data: dataSection, reactiveVars: generator.reactiveVars };
|
|
9436
9604
|
}
|
|
@@ -9472,8 +9640,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
|
9472
9640
|
return new CodeGenerator({}).getComponentRuntime();
|
|
9473
9641
|
}
|
|
9474
9642
|
// src/browser.js
|
|
9475
|
-
var VERSION = "3.13.
|
|
9476
|
-
var BUILD_DATE = "2026-03-14@
|
|
9643
|
+
var VERSION = "3.13.110";
|
|
9644
|
+
var BUILD_DATE = "2026-03-14@09:05:54GMT";
|
|
9477
9645
|
if (typeof globalThis !== "undefined") {
|
|
9478
9646
|
if (!globalThis.__rip)
|
|
9479
9647
|
new Function(getReactiveRuntime())();
|