@builder.io/mitosis 0.0.48 → 0.0.49
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/CHANGELOG.md +4 -0
- package/dist/src/__tests__/angular.test.d.ts +1 -0
- package/dist/src/__tests__/angular.test.js +12 -0
- package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onUpdate.raw.jsx +10 -0
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +11 -0
- package/dist/src/__tests__/data/blocks/tabs.raw.d.ts +11 -0
- package/dist/src/__tests__/data/blocks/tabs.raw.jsx +24 -0
- package/dist/src/__tests__/qoot.test.d.ts +1 -0
- package/dist/src/__tests__/qoot.test.js +115 -0
- package/dist/src/__tests__/qwik.test.js +38 -10
- package/dist/src/__tests__/react.test.js +12 -0
- package/dist/src/__tests__/svelte.test.d.ts +1 -0
- package/dist/src/__tests__/svelte.test.js +12 -0
- package/dist/src/__tests__/vue.test.js +6 -0
- package/dist/src/generators/angular.js +7 -3
- package/dist/src/generators/builder.js +7 -7
- package/dist/src/generators/html.js +16 -7
- package/dist/src/generators/jsx-lite.d.ts +10 -0
- package/dist/src/generators/jsx-lite.js +176 -0
- package/dist/src/generators/minify.d.ts +1 -0
- package/dist/src/generators/minify.js +24 -0
- package/dist/src/generators/mitosis.js +5 -2
- package/dist/src/generators/qoot.d.ts +21 -0
- package/dist/src/generators/qoot.js +442 -0
- package/dist/src/generators/qwik/component.js +48 -6
- package/dist/src/generators/qwik/directives.d.ts +21 -1
- package/dist/src/generators/qwik/directives.js +80 -3
- package/dist/src/generators/qwik/jsx.d.ts +1 -1
- package/dist/src/generators/qwik/jsx.js +28 -5
- package/dist/src/generators/qwik/src-generator.d.ts +3 -1
- package/dist/src/generators/qwik/src-generator.js +34 -10
- package/dist/src/generators/qwik.d.ts +21 -0
- package/dist/src/generators/qwik.js +458 -0
- package/dist/src/generators/react.js +13 -7
- package/dist/src/generators/solid.js +5 -2
- package/dist/src/generators/svelte.js +10 -5
- package/dist/src/generators/vue.js +7 -5
- package/dist/src/helpers/create-jsx-lite-component.d.ts +2 -0
- package/dist/src/helpers/create-jsx-lite-component.js +16 -0
- package/dist/src/helpers/create-jsx-lite-context.d.ts +4 -0
- package/dist/src/helpers/create-jsx-lite-context.js +18 -0
- package/dist/src/helpers/create-jsx-lite-node.d.ts +2 -0
- package/dist/src/helpers/create-jsx-lite-node.js +16 -0
- package/dist/src/helpers/is-jsx-lite-node.d.ts +2 -0
- package/dist/src/helpers/is-jsx-lite-node.js +7 -0
- package/dist/src/helpers/map-refs.js +7 -6
- package/dist/src/helpers/process-http-requests.js +3 -3
- package/dist/src/helpers/process-tag-references.js +4 -3
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +4 -3
- package/dist/src/parsers/builder.d.ts +50 -10
- package/dist/src/parsers/builder.js +37 -7
- package/dist/src/parsers/jsx.js +43 -3
- package/dist/src/parsers/liquid.js +4 -4
- package/dist/src/plugins/compile-away-builder-components.js +40 -20
- package/dist/src/symbols/symbol-processor.d.ts +18 -0
- package/dist/src/symbols/symbol-processor.js +177 -0
- package/dist/src/types/jsx-lite-component.d.ts +63 -0
- package/dist/src/types/jsx-lite-component.js +2 -0
- package/dist/src/types/jsx-lite-context.d.ts +6 -0
- package/dist/src/types/jsx-lite-context.js +2 -0
- package/dist/src/types/jsx-lite-node.d.ts +13 -0
- package/dist/src/types/jsx-lite-node.js +2 -0
- package/dist/src/types/jsx-lite-styles.d.ts +1 -0
- package/dist/src/types/jsx-lite-styles.js +2 -0
- package/dist/src/types/mitosis-component.d.ts +10 -5
- package/dist/test/qoot/Todo/bundle.js +88 -0
- package/dist/test/qoot/Todo/component.ts +17 -0
- package/dist/test/qoot/Todo/onButtonClick.ts +13 -0
- package/dist/test/qoot/Todo/onInput2Blur.ts +11 -0
- package/dist/test/qoot/Todo/onInput2KeyUp.ts +10 -0
- package/dist/test/qoot/Todo/onInputClick.ts +10 -0
- package/dist/test/qoot/Todo/onLabelDblClick.ts +11 -0
- package/dist/test/qoot/Todo/public.ts +4 -0
- package/dist/test/qoot/Todo/template.tsx +46 -0
- package/dist/test/qoot/Todos/component.ts +9 -0
- package/dist/test/qoot/Todos/onInputClick.ts +14 -0
- package/dist/test/qoot/Todos/public.ts +3 -0
- package/dist/test/qoot/Todos/template.tsx +30 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/high.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/med.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/high.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/low.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/med.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/med.tsx +0 -0
- package/dist/test/qwik/Todo/bundle.js +46 -0
- package/dist/test/qwik/Todo/component.ts +17 -0
- package/dist/test/qwik/Todo/onButtonClick.ts +10 -0
- package/dist/test/qwik/Todo/onInput2Blur.ts +14 -0
- package/dist/test/qwik/Todo/onInput2KeyUp.ts +10 -0
- package/dist/test/qwik/Todo/onInputClick.ts +13 -0
- package/dist/test/qwik/Todo/onLabelDblClick.ts +11 -0
- package/dist/test/qwik/Todo/public.ts +3 -0
- package/dist/test/qwik/Todo/template.tsx +46 -0
- package/dist/test/qwik/Todo.ts +4 -0
- package/dist/test/qwik/Todo_component.ts +17 -0
- package/dist/test/qwik/Todo_onButtonClick.ts +13 -0
- package/dist/test/qwik/Todo_onInput2Blur.ts +14 -0
- package/dist/test/qwik/Todo_onInput2KeyUp.ts +10 -0
- package/dist/test/qwik/Todo_onInputClick.ts +13 -0
- package/dist/test/qwik/Todo_onLabelDblClick.ts +14 -0
- package/dist/test/qwik/Todo_template.tsx +46 -0
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/low.tsx +3 -4
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/med.tsx +0 -0
- package/dist/test/qwik/Todos/component.ts +9 -0
- package/dist/test/qwik/Todos/onInputClick.ts +14 -0
- package/dist/test/qwik/Todos/public.ts +3 -0
- package/dist/test/qwik/Todos/template.tsx +30 -0
- package/dist/test/qwik/Todos.ts +3 -0
- package/dist/test/qwik/Todos_component.ts +9 -0
- package/dist/test/qwik/Todos_onInputClick.ts +14 -0
- package/dist/test/qwik/Todos_template.tsx +30 -0
- package/dist/test/qwik/qwik/Image/high.js +1 -0
- package/dist/test/qwik/qwik/Image/low.js +75 -0
- package/dist/test/qwik/qwik/Image/med.js +9 -0
- package/dist/test/qwik/{For/high.jsx → qwik/Image.slow/high.js} +0 -0
- package/dist/test/qwik/qwik/Image.slow/low.js +75 -0
- package/dist/test/qwik/{For/med.jsx → qwik/Image.slow/med.js} +0 -0
- package/dist/test/qwik/qwik/button/high.js +8 -0
- package/dist/test/qwik/qwik/button/low.js +34 -0
- package/dist/test/qwik/qwik/button/med.js +9 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/high.jsx +1 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/low.jsx +24 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/med.jsx +9 -0
- package/dist/test/qwik/qwik/page-with-symbol/high.js +1 -0
- package/dist/test/qwik/qwik/page-with-symbol/low.js +49 -0
- package/dist/test/qwik/qwik/page-with-symbol/med.js +9 -0
- package/dist/test/qwik/qwik/svg/high.js +1 -0
- package/dist/test/qwik/qwik/svg/low.js +30 -0
- package/dist/test/qwik/qwik/svg/med.js +9 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/high.cjs +31 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/low.cjs +1 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/med.cjs +59 -0
- package/dist/test/qwik/qwik/todo/Todo.js/high.js +5 -0
- package/dist/{src/types/generators.d.ts → test/qwik/qwik/todo/Todo.js/low.js} +0 -0
- package/dist/test/qwik/qwik/todo/Todo.js/med.js +1 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/high.tsx +30 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/low.tsx +1 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/med.tsx +34 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/high.tsx +12 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/low.tsx +24 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/med.tsx +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/types/generators.js +0 -1
- package/dist/test/qwik/For/low.jsx +0 -55
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, QRL } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
export class TodoComponent extends Component<any, any> {
|
|
4
|
+
static $templateQRL = "ui:/Todo/template";
|
|
5
|
+
|
|
6
|
+
editing = false;
|
|
7
|
+
toggle() {
|
|
8
|
+
this.todo.completed = !this.todo.completed;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
$newState() {
|
|
12
|
+
return {}; // TODO
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export const onButtonClick = injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
todosState.todos.splice(todosState.todos.indexOf(this.todo));
|
|
9
|
+
}
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.editing = false;
|
|
9
|
+
markDirty(this);
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
his);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export const onInput2KeyUp = injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.todo.text = event.target.value;
|
|
9
|
+
}
|
|
10
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.toggle();
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
le();
|
|
12
|
+
}
|
|
13
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export const onLabelDblClick = injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.editing = true;
|
|
9
|
+
markDirty(this);
|
|
10
|
+
}
|
|
11
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { injectMethod, QRL, jsxFactory } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
import { TodosState as todosState } from "../TodosState/public.js";
|
|
5
|
+
|
|
6
|
+
export const template = injectMethod(
|
|
7
|
+
TodoComponent,
|
|
8
|
+
function (this: TodoComponent) {
|
|
9
|
+
return (
|
|
10
|
+
<li
|
|
11
|
+
class={`${this.todo.completed ? "completed" : ""} ${
|
|
12
|
+
this.editing ? "editing" : ""
|
|
13
|
+
}`}
|
|
14
|
+
>
|
|
15
|
+
<div class="view">
|
|
16
|
+
<input
|
|
17
|
+
class="toggle"
|
|
18
|
+
type="checkbox"
|
|
19
|
+
checked={this.todo.completed}
|
|
20
|
+
on:click={QRL`ui:/Todo/bundle.onInputClick`}
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<label on:dblclick={QRL`ui:/Todo/bundle.onLabelDblClick`}>
|
|
24
|
+
{this.todo.text}
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
class="destroy"
|
|
29
|
+
on:click={QRL`ui:/Todo/bundle.onButtonClick`}
|
|
30
|
+
></button>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
{this.editing ? (
|
|
34
|
+
<>
|
|
35
|
+
<input
|
|
36
|
+
class="edit"
|
|
37
|
+
value={this.todo.text}
|
|
38
|
+
on:blur={QRL`ui:/Todo/bundle.onInput2Blur`}
|
|
39
|
+
on:keyup={QRL`ui:/Todo/bundle.onInput2KeyUp`}
|
|
40
|
+
/>
|
|
41
|
+
</>
|
|
42
|
+
) : undefined}
|
|
43
|
+
</li>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, QRL } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
export class TodoComponent extends Component<any, any> {
|
|
4
|
+
static $templateQRL = "ui:/Todo_template";
|
|
5
|
+
|
|
6
|
+
editing = false;
|
|
7
|
+
toggle() {
|
|
8
|
+
this.todo.completed = !this.todo.completed;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
$newState() {
|
|
12
|
+
return {}; // TODO
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
todosState.todos.splice(todosState.todos.indexOf(this.todo));
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
odo));
|
|
12
|
+
}
|
|
13
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.editing = false;
|
|
9
|
+
markDirty(this);
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
his);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
export const onInput2KeyUp = injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.todo.text = event.target.value;
|
|
9
|
+
}
|
|
10
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.toggle();
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
le();
|
|
12
|
+
}
|
|
13
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodoComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodoComponent, event: Event) {
|
|
8
|
+
this.editing = true;
|
|
9
|
+
markDirty(this);
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
y(this);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { injectMethod, QRL, h } from "@builder.io/qwik";
|
|
2
|
+
import { TodoComponent } from "./Todo_component.js";
|
|
3
|
+
|
|
4
|
+
import { TodosState as todosState } from "../TodosState/public.js";
|
|
5
|
+
|
|
6
|
+
export const template = injectMethod(
|
|
7
|
+
TodoComponent,
|
|
8
|
+
function (this: TodoComponent) {
|
|
9
|
+
return (
|
|
10
|
+
<li
|
|
11
|
+
class={`${this.todo.completed ? "completed" : ""} ${
|
|
12
|
+
this.editing ? "editing" : ""
|
|
13
|
+
}`}
|
|
14
|
+
>
|
|
15
|
+
<div class="view">
|
|
16
|
+
<input
|
|
17
|
+
type="checkbox"
|
|
18
|
+
class="toggle"
|
|
19
|
+
checked={this.todo.completed}
|
|
20
|
+
on:click={QRL`ui:/Todo/bundle.onInputClick`}
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<label on:dblclick={QRL`ui:/Todo/bundle.onLabelDblClick`}>
|
|
24
|
+
{this.todo.text}
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
class="destroy"
|
|
29
|
+
on:click={QRL`ui:/Todo/bundle.onButtonClick`}
|
|
30
|
+
></button>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
{this.editing ? (
|
|
34
|
+
<>
|
|
35
|
+
<input
|
|
36
|
+
class="edit"
|
|
37
|
+
value={this.todo.text}
|
|
38
|
+
on:blur={QRL`ui:/Todo/bundle.onInput2Blur`}
|
|
39
|
+
on:keyup={QRL`ui:/Todo/bundle.onInput2KeyUp`}
|
|
40
|
+
/>
|
|
41
|
+
</>
|
|
42
|
+
) : undefined}
|
|
43
|
+
</li>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Todo } from "./med.js";
|
|
1
|
+
import { For, Todo } from "./med.js";
|
|
2
2
|
|
|
3
3
|
import { h, qHook } from "@builder.io/qwik";
|
|
4
4
|
|
|
@@ -15,11 +15,10 @@ export const Todos_onRender = qHook((props, state) => (
|
|
|
15
15
|
: null
|
|
16
16
|
}
|
|
17
17
|
<ul class="todo-list">
|
|
18
|
-
{
|
|
18
|
+
<For each={todosState.todos}>
|
|
19
19
|
<Todo todo={todo}>
|
|
20
20
|
</Todo>
|
|
21
|
-
|
|
22
|
-
}
|
|
21
|
+
</For>
|
|
23
22
|
</ul>
|
|
24
23
|
</section>
|
|
25
24
|
));
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodosComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodosComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodosComponent, event: Event) {
|
|
8
|
+
const newValue = !todosState.allCompleted;
|
|
9
|
+
|
|
10
|
+
for (const todoItem of todosState.todos) {
|
|
11
|
+
todoItem.completed = newValue;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { injectMethod, QRL, jsxFactory } from "@builder.io/qwik";
|
|
2
|
+
import { TodosComponent } from "./component.js";
|
|
3
|
+
|
|
4
|
+
import { TodosState as todosState } from "../TodosState/public.js";
|
|
5
|
+
import { Todo } from "../Todo/public.js";
|
|
6
|
+
|
|
7
|
+
export default injectMethod(TodosComponent, function (this: TodosComponent) {
|
|
8
|
+
return (
|
|
9
|
+
<section class="main">
|
|
10
|
+
{todosState.todos.length ? (
|
|
11
|
+
<>
|
|
12
|
+
<input
|
|
13
|
+
class="toggle-all"
|
|
14
|
+
type="checkbox"
|
|
15
|
+
checked={todosState.allCompleted}
|
|
16
|
+
on:click={QRL`ui:/Todos/onInputClick`}
|
|
17
|
+
/>
|
|
18
|
+
</>
|
|
19
|
+
) : undefined}
|
|
20
|
+
|
|
21
|
+
<ul class="todo-list">
|
|
22
|
+
{todosState.todos.map((todo) => (
|
|
23
|
+
<>
|
|
24
|
+
<Todo todo={todo}></Todo>
|
|
25
|
+
</>
|
|
26
|
+
))}
|
|
27
|
+
</ul>
|
|
28
|
+
</section>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { injectEventHandler, provideEvent, markDirty } from "@builder.io/qwik";
|
|
2
|
+
import { TodosComponent } from "./Todos_component.js";
|
|
3
|
+
|
|
4
|
+
export default injectEventHandler(
|
|
5
|
+
TodosComponent,
|
|
6
|
+
provideEvent(),
|
|
7
|
+
async function (this: TodosComponent, event: Event) {
|
|
8
|
+
const newValue = !todosState.allCompleted;
|
|
9
|
+
|
|
10
|
+
for (const todoItem of todosState.todos) {
|
|
11
|
+
todoItem.completed = newValue;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { injectMethod, QRL, h } from "@builder.io/qwik";
|
|
2
|
+
import { TodosComponent } from "./Todos_component.js";
|
|
3
|
+
|
|
4
|
+
import { TodosState as todosState } from "../TodosState/public.js";
|
|
5
|
+
import { Todo } from "../Todo/public.js";
|
|
6
|
+
|
|
7
|
+
export default injectMethod(TodosComponent, function (this: TodosComponent) {
|
|
8
|
+
return (
|
|
9
|
+
<section class="main">
|
|
10
|
+
{todosState.todos.length ? (
|
|
11
|
+
<>
|
|
12
|
+
<input
|
|
13
|
+
type="checkbox"
|
|
14
|
+
class="toggle-all"
|
|
15
|
+
checked={todosState.allCompleted}
|
|
16
|
+
on:click={QRL`ui:/Todos_onInputClick`}
|
|
17
|
+
/>
|
|
18
|
+
</>
|
|
19
|
+
) : undefined}
|
|
20
|
+
|
|
21
|
+
<ul class="todo-list">
|
|
22
|
+
{todosState.todos?.map((todo) => (
|
|
23
|
+
<>
|
|
24
|
+
<Todo todo={todo}></Todo>
|
|
25
|
+
</>
|
|
26
|
+
))}
|
|
27
|
+
</ul>
|
|
28
|
+
</section>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { h, qHook } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const MyComponent_styles = `
|
|
5
|
+
.crpvxpi{
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
position: relative;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
margin-left: 0px;
|
|
12
|
+
width: 147px;
|
|
13
|
+
min-height: 20px;
|
|
14
|
+
min-width: 20px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
margin-top: 0px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
}
|
|
20
|
+
.cj0wetn{
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding-top: 33.6%;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
font-size: 0;
|
|
25
|
+
}
|
|
26
|
+
.cffxoir{
|
|
27
|
+
object-fit: cover;
|
|
28
|
+
object-position: center;
|
|
29
|
+
position: absolute;
|
|
30
|
+
height: 100%;
|
|
31
|
+
width: 100%;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export const MyComponent_onRender = qHook((props, state) => (
|
|
38
|
+
h(
|
|
39
|
+
"a",
|
|
40
|
+
{
|
|
41
|
+
href: "https://www.builder.io/",
|
|
42
|
+
builderTag: "a",
|
|
43
|
+
class: "crpvxpi"
|
|
44
|
+
},
|
|
45
|
+
h(
|
|
46
|
+
"picture",
|
|
47
|
+
{
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
h(
|
|
51
|
+
"source",
|
|
52
|
+
{
|
|
53
|
+
srcset: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=100 100w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=200 200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=400 400w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=800 800w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=147 147w",
|
|
54
|
+
type: "image/webp"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
h(
|
|
58
|
+
"img",
|
|
59
|
+
{
|
|
60
|
+
src: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=147",
|
|
61
|
+
sizes: "(max-width: 638px) 24vw, (max-width: 998px) 15vw, 11vw",
|
|
62
|
+
srcset: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=100 100w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=200 200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=400 400w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=800 800w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=147 147w",
|
|
63
|
+
class: "cffxoir",
|
|
64
|
+
loading: "lazy"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
),
|
|
68
|
+
h(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
class: "cj0wetn builder-image-sizer"
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { qComponent, qHook } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const onMountCreateEmptyState = qHook(() => ({}));
|
|
5
|
+
export const MyComponent = qComponent({
|
|
6
|
+
onMount: qHook("./med#onMountCreateEmptyState"),
|
|
7
|
+
onRender: qHook("./low#MyComponent_onRender"),
|
|
8
|
+
styles: "./low#MyComponent_styles"
|
|
9
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { h, qHook } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const MyComponent_styles = `
|
|
5
|
+
.crpvxpi{
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
position: relative;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
margin-left: 0px;
|
|
12
|
+
width: 147px;
|
|
13
|
+
min-height: 20px;
|
|
14
|
+
min-width: 20px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
margin-top: 0px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
}
|
|
20
|
+
.cj0wetn{
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding-top: 33.6%;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
font-size: 0;
|
|
25
|
+
}
|
|
26
|
+
.cffxoir{
|
|
27
|
+
object-fit: cover;
|
|
28
|
+
object-position: center;
|
|
29
|
+
position: absolute;
|
|
30
|
+
height: 100%;
|
|
31
|
+
width: 100%;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export const MyComponent_onRender = qHook((props, state) => (
|
|
38
|
+
h(
|
|
39
|
+
"a",
|
|
40
|
+
{
|
|
41
|
+
href: "https://www.builder.io/",
|
|
42
|
+
builderTag: "a",
|
|
43
|
+
class: "crpvxpi"
|
|
44
|
+
},
|
|
45
|
+
h(
|
|
46
|
+
"picture",
|
|
47
|
+
{
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
h(
|
|
51
|
+
"source",
|
|
52
|
+
{
|
|
53
|
+
srcset: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=100 100w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=200 200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=400 400w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=800 800w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?format=webp&width=147 147w",
|
|
54
|
+
type: "image/webp"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
h(
|
|
58
|
+
"img",
|
|
59
|
+
{
|
|
60
|
+
src: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=147",
|
|
61
|
+
sizes: "(max-width: 638px) 24vw, (max-width: 998px) 15vw, 11vw",
|
|
62
|
+
srcset: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=100 100w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=200 200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=400 400w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=800 800w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffc377a8e6589456996b4b36b837b69b3?width=147 147w",
|
|
63
|
+
class: "cffxoir",
|
|
64
|
+
loading: "lazy"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
),
|
|
68
|
+
h(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
class: "cj0wetn builder-image-sizer"
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
));
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { h, qHook } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const MyComponent_styles = `
|
|
5
|
+
.c9nzze9{
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
position: relative;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
margin-top: 20px;
|
|
12
|
+
appearance: none;
|
|
13
|
+
padding-top: 15px;
|
|
14
|
+
padding-bottom: 15px;
|
|
15
|
+
padding-left: 25px;
|
|
16
|
+
padding-right: 25px;
|
|
17
|
+
background-color: #3898EC;
|
|
18
|
+
color: white;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
text-align: center;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const MyComponent_onRender = qHook((props, state) => (
|
|
26
|
+
h(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
innerHTML: "Click me!",
|
|
30
|
+
class: "c9nzze9",
|
|
31
|
+
"on:click": qHook("./high#MyComponent_onClick_0")
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { qComponent, qHook } from "@builder.io/qwik";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const onMountCreateEmptyState = qHook(() => ({}));
|
|
5
|
+
export const MyComponent = qComponent({
|
|
6
|
+
onMount: qHook("./med#onMountCreateEmptyState"),
|
|
7
|
+
onRender: qHook("./low#MyComponent_onRender"),
|
|
8
|
+
styles: "./low#MyComponent_styles"
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|