rip-lang 3.12.4 → 3.12.5
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/demo.html +1017 -0
- package/docs/dist/rip.js +9483 -0
- package/docs/dist/rip.min.js +47 -47
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/app.rip +10 -4
- package/src/components.js +3 -2
- package/src/typecheck.js +19 -0
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/app.rip
CHANGED
|
@@ -688,7 +688,7 @@ export createRenderer = (opts = {}) ->
|
|
|
688
688
|
for inst in layoutInstances by -1
|
|
689
689
|
inst.beforeUnmount() if inst.beforeUnmount
|
|
690
690
|
inst.unmounted() if inst.unmounted
|
|
691
|
-
inst.
|
|
691
|
+
inst._target?.remove()
|
|
692
692
|
layoutInstances = []
|
|
693
693
|
mountPoint = container
|
|
694
694
|
|
|
@@ -724,7 +724,7 @@ export createRenderer = (opts = {}) ->
|
|
|
724
724
|
return
|
|
725
725
|
|
|
726
726
|
layoutsChanged = not arraysEqual(layoutFiles, currentLayouts)
|
|
727
|
-
|
|
727
|
+
oldTarget = currentComponent?._target
|
|
728
728
|
|
|
729
729
|
if layoutsChanged
|
|
730
730
|
unmount()
|
|
@@ -768,7 +768,7 @@ export createRenderer = (opts = {}) ->
|
|
|
768
768
|
cached = componentCache.get(route.file)
|
|
769
769
|
if cached
|
|
770
770
|
componentCache.delete route.file
|
|
771
|
-
mp.appendChild cached.
|
|
771
|
+
mp.appendChild cached._target
|
|
772
772
|
currentComponent = cached
|
|
773
773
|
currentRoute = route.file
|
|
774
774
|
else
|
|
@@ -783,7 +783,7 @@ export createRenderer = (opts = {}) ->
|
|
|
783
783
|
currentRoute = route.file
|
|
784
784
|
|
|
785
785
|
instance.load!(params, query) if instance.load
|
|
786
|
-
|
|
786
|
+
oldTarget?.remove()
|
|
787
787
|
router.navigating = false
|
|
788
788
|
if container.style.opacity is '0'
|
|
789
789
|
document.fonts.ready.then ->
|
|
@@ -857,6 +857,12 @@ connectWatch = (url) ->
|
|
|
857
857
|
console.log '[Rip] Reloading...'
|
|
858
858
|
location.reload()
|
|
859
859
|
|
|
860
|
+
es.addEventListener 'css', ->
|
|
861
|
+
for link as document.querySelectorAll('link[rel="stylesheet"]')
|
|
862
|
+
url = new URL(link.href)
|
|
863
|
+
url.searchParams.set('_t', Date.now())
|
|
864
|
+
link.href = url.toString()
|
|
865
|
+
|
|
860
866
|
es.onerror = ->
|
|
861
867
|
es.close()
|
|
862
868
|
setTimeout connect, retryDelay
|
package/src/components.js
CHANGED
|
@@ -729,13 +729,14 @@ export function installComponentSupport(CodeGenerator, Lexer) {
|
|
|
729
729
|
// Effects
|
|
730
730
|
for (const effect of effects) {
|
|
731
731
|
const effectBody = effect[2];
|
|
732
|
+
const isAsync = this.containsAwait(effectBody) ? 'async ' : '';
|
|
732
733
|
if (this.is(effectBody, 'block') && effectBody.length > 2) {
|
|
733
734
|
const transformed = this.transformComponentMembers(effectBody);
|
|
734
735
|
const body = this.generateFunctionBody(transformed, [], true);
|
|
735
|
-
lines.push(` __effect(() => ${body});`);
|
|
736
|
+
lines.push(` __effect(${isAsync}() => ${body});`);
|
|
736
737
|
} else {
|
|
737
738
|
const effectCode = this.generateInComponent(effectBody, 'value');
|
|
738
|
-
lines.push(` __effect(() => { ${effectCode}; });`);
|
|
739
|
+
lines.push(` __effect(${isAsync}() => { ${effectCode}; });`);
|
|
739
740
|
}
|
|
740
741
|
}
|
|
741
742
|
|
package/src/typecheck.js
CHANGED
|
@@ -206,6 +206,25 @@ export function compileForCheck(filePath, source, compiler) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
// Interpolate gaps — if src line A maps to gen line X and src line B maps to
|
|
210
|
+
// gen line Y, fill src lines A+1..B-1 → gen lines X+1..Y-1. This gives hover
|
|
211
|
+
// and diagnostics coverage for function body lines that the compiler didn't map.
|
|
212
|
+
const mapped = [...srcToGen.entries()].sort((a, b) => a[0] - b[0]);
|
|
213
|
+
for (let i = 0; i < mapped.length - 1; i++) {
|
|
214
|
+
const [srcA, genA] = mapped[i];
|
|
215
|
+
const [srcB, genB] = mapped[i + 1];
|
|
216
|
+
const srcGap = srcB - srcA;
|
|
217
|
+
const genGap = genB - genA;
|
|
218
|
+
if (srcGap > 1 && genGap > 1 && srcGap <= genGap + 2) {
|
|
219
|
+
for (let d = 1; d < srcGap; d++) {
|
|
220
|
+
if (!srcToGen.has(srcA + d) && genA + d < genB) {
|
|
221
|
+
srcToGen.set(srcA + d, genA + d);
|
|
222
|
+
genToSrc.set(genA + d, srcA + d);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
209
228
|
return { tsContent, headerLines, hasTypes, srcToGen, genToSrc, source };
|
|
210
229
|
}
|
|
211
230
|
|