mirror of
https://github.com/nvms/soma3.git
synced 2025-12-16 07:20:52 +00:00
k
This commit is contained in:
parent
9d90e12f8a
commit
9c75ee6bc1
@ -435,7 +435,7 @@ function _if(el, exp, ctx, component, componentProps, allProps) {
|
|||||||
activeBranchIndex = -1;
|
activeBranchIndex = -1;
|
||||||
removeActiveBlock();
|
removeActiveBlock();
|
||||||
});
|
});
|
||||||
return nextNode;
|
return nextNode.parentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/directives/interpolation.ts
|
// src/directives/interpolation.ts
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
43
src/demo.ts
43
src/demo.ts
@ -172,7 +172,9 @@ import { html } from "./util";
|
|||||||
// template: html`
|
// template: html`
|
||||||
// <div class="sans-serif">
|
// <div class="sans-serif">
|
||||||
// <div :teleport="body">
|
// <div :teleport="body">
|
||||||
// <div :if="style.color === 'gray'">true</div>
|
// <div :if="style.color === 'gray'">color is gray</div>
|
||||||
|
// <div :if="style.color === 'white'">color is white</div>
|
||||||
|
// <div>{{style.color}}</div>
|
||||||
// </div>
|
// </div>
|
||||||
// <h3 {style:bind}>Count: {{count}}{{count >= 2 ? '!!!' : ''}}</h3>
|
// <h3 {style:bind}>Count: {{count}}{{count >= 2 ? '!!!' : ''}}</h3>
|
||||||
// <button @click="increment" class="padding-x-1 padding-y-0_5">+</button>
|
// <button @click="increment" class="padding-x-1 padding-y-0_5">+</button>
|
||||||
@ -187,15 +189,15 @@ import { html } from "./util";
|
|||||||
// const style = reactive({ color: "gray" });
|
// const style = reactive({ color: "gray" });
|
||||||
// const increment = () => count.value++;
|
// const increment = () => count.value++;
|
||||||
// const decrement = () => count.value--;
|
// const decrement = () => count.value--;
|
||||||
|
//
|
||||||
// setInterval(() => {
|
// setInterval(() => {
|
||||||
// style.color = style.color === "gray" ? "white" : "gray";
|
// style.color = style.color === "gray" ? "white" : "gray";
|
||||||
// }, 500);
|
// }, 500);
|
||||||
|
//
|
||||||
// return { count, increment, decrement, style };
|
// return { count, increment, decrement, style };
|
||||||
// },
|
// },
|
||||||
// };
|
// };
|
||||||
|
//
|
||||||
// const app = new App();
|
// const app = new App();
|
||||||
// app.mount(counter, "#app");
|
// app.mount(counter, "#app");
|
||||||
|
|
||||||
@ -222,7 +224,7 @@ import { html } from "./util";
|
|||||||
// return { items, bool };
|
// return { items, bool };
|
||||||
// },
|
// },
|
||||||
// };
|
// };
|
||||||
|
//
|
||||||
// const app = new App();
|
// const app = new App();
|
||||||
// app.mount(main, "#app");
|
// app.mount(main, "#app");
|
||||||
|
|
||||||
@ -338,24 +340,49 @@ app.mount(main, "#app");
|
|||||||
// props: { thing: { default: 1 } },
|
// props: { thing: { default: 1 } },
|
||||||
// main({ thing }) {
|
// main({ thing }) {
|
||||||
// return { thing };
|
// return { thing };
|
||||||
// }
|
// },
|
||||||
// };
|
// };
|
||||||
|
//
|
||||||
// const counter = {
|
// const counter = {
|
||||||
// template: html`
|
// template: html`
|
||||||
// <div class="sans-serif">
|
// <div class="sans-serif">
|
||||||
|
// <div :if="true">
|
||||||
// <div :teleport="body">
|
// <div :teleport="body">
|
||||||
// <div :for="color in colors">{{color}}</div>
|
// <div :for="color in colors">{{color}}</div>
|
||||||
// </div>
|
// </div>
|
||||||
// <child :teleport="body" .thing="5" />
|
// <child :teleport="body" .thing="5" />
|
||||||
// </div>
|
// </div>
|
||||||
|
// </div>
|
||||||
// `,
|
// `,
|
||||||
// main() {
|
// main() {
|
||||||
// const colors = reactive(["red", "green"]);
|
// const colors = reactive(["red", "green"]);
|
||||||
// return { colors };
|
// return { colors };
|
||||||
// },
|
// },
|
||||||
// };
|
// };
|
||||||
|
//
|
||||||
// const app = new App();
|
// const app = new App();
|
||||||
// app.register("child", child);
|
// app.register("child", child);
|
||||||
// app.mount(counter, "#app");
|
// app.mount(counter, "#app");
|
||||||
|
|
||||||
|
// ------------------------------------------------
|
||||||
|
// <template>
|
||||||
|
// const templateTest = {
|
||||||
|
// template: html`
|
||||||
|
// <div>
|
||||||
|
// <!-- is dissolved -->
|
||||||
|
// <div :if="bool">hello</div>
|
||||||
|
//
|
||||||
|
// <template :if="bool">
|
||||||
|
// <span :for="num in [1,2,3]">{{num}}</span>
|
||||||
|
// </template>
|
||||||
|
// </div>
|
||||||
|
// `,
|
||||||
|
// main() {
|
||||||
|
// const bool = ref(true);
|
||||||
|
//
|
||||||
|
// return { bool };
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// const app = new App();
|
||||||
|
// app.mount(templateTest, "#app");
|
||||||
|
|||||||
@ -63,5 +63,5 @@ export function _if(el: Element, exp: string, ctx: Context, component?: Componen
|
|||||||
removeActiveBlock();
|
removeActiveBlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
return nextNode;
|
return nextNode.parentElement;
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/index.ts
23
src/index.ts
@ -11,7 +11,28 @@ import { isComputed } from "./reactivity/computed";
|
|||||||
import { effect as _effect } from "./reactivity/effect";
|
import { effect as _effect } from "./reactivity/effect";
|
||||||
import { reactive } from "./reactivity/reactive";
|
import { reactive } from "./reactivity/reactive";
|
||||||
import { isRef } from "./reactivity/ref";
|
import { isRef } from "./reactivity/ref";
|
||||||
import { checkAndRemoveAttribute, componentHasPropByName, extractPropName, findSlotNodes, findTemplateNodes, insertBefore, isElement, isEventAttribute, isMirrorProp, isObject, isPropAttribute, isRegularProp, isSpreadProp, isText, nextTick, Slot, stringToElement, Template, toDisplayString } from "./util";
|
import {
|
||||||
|
checkAndRemoveAttribute,
|
||||||
|
componentHasPropByName,
|
||||||
|
extractPropName,
|
||||||
|
findSlotNodes,
|
||||||
|
findTemplateNodes,
|
||||||
|
insertBefore,
|
||||||
|
isElement,
|
||||||
|
isEventAttribute,
|
||||||
|
isMirrorProp,
|
||||||
|
isObject,
|
||||||
|
isPropAttribute,
|
||||||
|
isRegularProp,
|
||||||
|
isSpreadProp,
|
||||||
|
isTemplate,
|
||||||
|
isText,
|
||||||
|
nextTick,
|
||||||
|
Slot,
|
||||||
|
stringToElement,
|
||||||
|
Template,
|
||||||
|
toDisplayString,
|
||||||
|
} from "./util";
|
||||||
|
|
||||||
export * from "./plugins";
|
export * from "./plugins";
|
||||||
export * from "./plugins/router";
|
export * from "./plugins/router";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user