Skip to content

Commit

Permalink
0.1.2 (#44)
Browse files Browse the repository at this point in the history
* Live demo (#42)

* feat: add progress in vue playground

* feat: add 600 delay

* Attached (#43)

* feat: add progress in vue playground

* feat: add 600 delay

* feat: check attached and isMounted

* chore: playground ci package update

* chore: playground try 0.1.2-beta vue-skia

* version: 0.1.2
  • Loading branch information
meloalright authored Aug 18, 2024
1 parent a53a28f commit fb6c7b8
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monorepo",
"version": "0.1.1",
"version": "0.1.2",
"private": "true",
"scripts": {},
"packageManager": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion soft-skia-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soft-skia-wasm"
version = "0.11.0"
version = "0.12.0"
authors = ["meloalright <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion soft-skia/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soft_skia"
version = "0.11.0"
version = "0.12.0"
edition = "2021"
description="software rasterization skia binding"
license = "MIT"
Expand Down
5 changes: 3 additions & 2 deletions vue-playground/package-ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-playground",
"version": "0.11.0",
"version": "0.12.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -14,7 +14,8 @@
"prismjs": "^1.29.0",
"vue": "^3.2.13",
"vue-live": "^2.5.4",
"vue-skia": "0.1.1"
"vue3-progress": "0.0.1-beta4",
"vue-skia": "0.1.2"
},
"devDependencies": {
"@types/node": "^20.5.0",
Expand Down
3 changes: 2 additions & 1 deletion vue-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-playground",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -14,6 +14,7 @@
"prismjs": "^1.29.0",
"vue": "^3.2.13",
"vue-live": "^2.5.4",
"vue3-progress": "0.0.1-beta4",
"vue-skia": "workspace:*"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion vue-playground/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<template>
<vue3-progress />
<main v-if="!loading" style="text-align: center">
<template v-if="true">
<h1>Vue Skia</h1>
Expand All @@ -19,6 +20,7 @@
</div>
<VueLive
:editorProps="{ lineNumbers: true }"
:delay="600"
:code="!loading && !debug ? code : LoadingCode"
:layout="CustomLayout"
:components="{
Expand Down Expand Up @@ -113,6 +115,7 @@ import code from "./code";
import LoadingCode from "./loading-code";
import "vue-live/style.css";
import "prism-themes/themes/prism-night-owl.css";
export default defineComponent({
name: "App",
components: {
Expand Down Expand Up @@ -159,11 +162,15 @@ export default defineComponent({
}
this.loading = false;
(this as unknown as { $progress: { start: () => void; finish: () => void } }).$progress.finish();
});
},
created() {
(this as unknown as { $progress: { start: () => void; finish: () => void } }).$progress.start();
},
methods: {
input(event: any) {
this.code = event.target._value;
// this.code = event.target._value;
},
copy() {
try {
Expand Down
5 changes: 5 additions & 0 deletions vue-playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { createApp } from "vue";
import App from "./App.vue";
import { VueSkia } from 'vue-skia'
import Vue3Progress from "vue3-progress";

const app = createApp(App);
app.use(VueSkia);
app.use(Vue3Progress, {
position: "fixed",
color: "rgb(0, 161, 132)",
})
app.mount("#app");
4 changes: 2 additions & 2 deletions vue-skia-framework/package-publish.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-skia",
"version": "0.1.1",
"version": "0.1.2",
"files": [
"lib",
"type.d.ts",
Expand All @@ -13,6 +13,6 @@
"main": "./main.js",
"module": "./main.js",
"dependencies": {
"soft-skia-wasm": "0.11.0"
"soft-skia-wasm": "0.12.0"
}
}
7 changes: 6 additions & 1 deletion vue-skia-framework/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const VSKNode = (name: string) => {
instance._ssw_id = (
parent as ComponentInternalInstanceWithSoftSkiaWASM
)._ssw_id;
instance._ssw_attached = true;

instance._ssw_grouped = (child) => {
core.setAttrBySerde(instance._ssw_id, {
Expand Down Expand Up @@ -103,6 +104,7 @@ const VSKNode = (name: string) => {
}
const core = root.ssw;
instance._ssw_id = SelfIncreaseCount.count;
instance._ssw_attached = true;
var parent = instance.parent;
while (!('_ssw_id' in parent)) {
parent = parent.parent;
Expand Down Expand Up @@ -208,7 +210,10 @@ const VSKNode = (name: string) => {
while (!('_ssw_id' in parent)) {
parent = parent.parent;
}
core.removeChildFromContainer(child_id, (parent as ComponentInternalInstanceWithSoftSkiaWASM)._ssw_id)
instance._ssw_attached = false;
if ((parent as ComponentInternalInstanceWithSoftSkiaWASM)._ssw_attached && parent.isMounted) {
core.removeChildFromContainer(child_id, (parent as ComponentInternalInstanceWithSoftSkiaWASM)._ssw_id)
}
});

return () => h(name, {}, slots.default?.())
Expand Down
1 change: 1 addition & 0 deletions vue-skia-framework/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SoftSkiaWASM } from '../soft-skia-wasm/pkg/';
export type ComponentInternalInstanceWithSoftSkiaWASM = ComponentInternalInstance & {
ssw: SoftSkiaWASM;
_ssw_id: number;
_ssw_attached: boolean;
_ssw_grouped?: (instance: ComponentInternalInstanceWithSoftSkiaWASM) => void;
_ssw_batchDraw?: () => void;
}
Expand Down

0 comments on commit fb6c7b8

Please sign in to comment.