Skip to content

Commit

Permalink
:lazyload 添加跨域處理,修正差異算法確保元素屬性可以被正確移除。
Browse files Browse the repository at this point in the history
  • Loading branch information
pardnchiu committed Feb 15, 2025
1 parent 295e645 commit 89861d8
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ const app = new QUI({
// Custom EVENT
},
when: {
before_render: function () {
beforeRender: function () {
// Stop rendering
},
rendered: function () {
// Rendered
},
before_update: function () {
beforeUpdate: function () {
// Stop updating
},
updated: function () {
// Updated
},
before_destroy: function () {
beforeDestroy: function () {
// Stop destruction
},
destroyed: function () {
Expand Down
6 changes: 3 additions & 3 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ const app = new QUI({
// 自訂 EVENT
},
when: {
before_render: function () {
beforeRender: function () {
// 停止渲染
},
rendered: function () {
// 已渲染
},
before_update: function () {
beforeUpdate: function () {
// 停止更新
},
updated: function () {
// 已更新
},
before_destroy: function () {
beforeDestroy: function () {
// 停止銷毀
},
destroyed: function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/QuickUI.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/QuickUI.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"name": "@pardnchiu/quickui",
"version": "0.6.7",
"version": "0.6.8",
"description": "QuickUI is a lightweight frontend framework built on pure JavaScript and native APIs. Supports data binding, i18n support, event binding, conditional rendering, and loop rendering.",
"main": "dist/QuickUI.js",
"module": "dist/QuickUI.esm.js",
"types": "src/interface.ts",
"scripts": {
"minify": "npx terser src/*.js -c -m -o dist/QuickUI.js --config-file terser.config.json --name-cache terser.cache.json && npx terser src/*.js -c -m -o dist/QuickUI.esm.js --config-file terser.config.json --name-cache terser.cache.json && echo 'export const QUI = window.QUI;' >> dist/QuickUI.esm.js",
"minify-w": "chokidar 'src/QuickUI.js' -c 'npm run minify'",
"sass": "sass src/sass:dist/ -w --style compressed --no-source-map",
"sass-index": "sass static/sass/:static/css/ -w --style compressed --no-source-map"
"build:debug": "tsc",
"build:min": "npx terser src/QuickUI.debug.js -c -m -o dist/QuickUI.js --config-file terser.config.json",
"build:esm": "npx terser src/QuickUI.debug.js -c -m -o dist/QuickUI.esm.js --config-file terser.config.json && echo 'export const QUI = window.QUI;' >> dist/QuickUI.esm.js",
"build:once": "npm run build:debug && npm-run-all build:min build:esm",
"build": "chokidar src/QuickUI.debug.js -c 'npm-run-all build:min build:esm'",
"sass:library": "sass src/sass:dist/ -w --style compressed --no-source-map",
"sass:index": "sass static/sass/:static/css/ -w --style compressed --no-source-map",
"sass": "npm-run-all sass:library sass:index"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion page/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
<button @click="changeContent" data-title="data">{{ i18n.data }}</button>
<button @click="changeContent" data-title="DEPRECATION">{{ i18n.DEPRECATION }}</button>
</section>
<section id="doc-body-content" class="body"></section>
<section id="doc-body-content" class="body" style="padding-top: 1.5rem"></section>
</section>
<!-- -->
<footer>
Expand Down
14 changes: 7 additions & 7 deletions page/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@

<!-- 本地資源 -->
<!-- <script type="module" src="/static/js/index.js"></script> -->
<script src="/dist/QuickUI.js"></script>
<script src="/src/QuickUI.debug.js"></script>
</head>

<body id="app" :effect="fade-in">
<body id="app">
<p @click="click">i18n</p>
<p :test="i18n.greeting">{{ i18n.greeting }}, {{ i18n.user }}: {{ username }}</p>
<section :html="html"></section>
Expand Down Expand Up @@ -126,13 +126,13 @@ <h4 :else>{{ title }} 4
<script>
document.addEventListener("DOMContentLoaded", () => {
let icons = "ableton,activitypub,actix,adonis,ae,aiscript,alpinejs,anaconda,androidstudio,angular,ansible,apollo,apple,appwrite,arch,arduino,astro,atom,au,autocad,aws,azul,azure,babel,bash,bevy,bitbucket,blender,bootstrap,bsd,bun,c,cs,cpp,crystal,cassandra,clion,clojure,cloudflare,cmake,codepen,coffeescript,css,cypress,d3,dart,debian,deno,devto,discord,bots,discordjs,django,docker,dotnet,dynamodb,eclipse,elasticsearch,electron,elixir,elysia,emacs,ember,emotion,express,fastapi,fediverse,figma,firebase,flask,flutter,forth,fortran,gamemakerstudio,gatsby,gcp,git,github,githubactions,gitlab,gmail,gherkin,go,gradle,godot,grafana,graphql,gtk,gulp,haskell,haxe,haxeflixel,heroku,hibernate,html,htmx,idea,ai,instagram,ipfs,java,js,jenkins,jest,jquery,kafka,kali,kotlin,ktor,kubernetes,laravel,latex,less,linkedin,linux,lit,lua,md,mastodon,materialui,matlab,maven,mint,misskey,mongodb,mysql,neovim,nestjs,netlify,nextjs,nginx,nim,nix,nodejs,notion,npm,nuxtjs,obsidian,ocaml,octave,opencv,openshift,openstack,p5js,perl,ps,php,phpstorm,pinia,pkl,plan9,planetscale,pnpm,postgres,postman,powershell,pr,prisma,processing,prometheus,pug,pycharm,py,pytorch,qt,r,rabbitmq,rails,raspberrypi,react,reactivex,redhat,redis,redux,regex,remix,replit,rider,robloxstudio,rocket,rollupjs,ros,ruby,rust,sass,spring,sqlite,stackoverflow,styledcomponents,sublime,supabase,scala,sklearn,selenium,sentry,sequelize,sketchup,solidity,solidjs,svelte,svg,swift,symfony,tailwind,tauri,tensorflow,terraform,threejs,twitter,ts,ubuntu,unity,unreal,v,vala,vercel,vim,visualstudio,vite,vitest,vscode,vscodium,vue,vuetify,wasm,webflow,webpack,webstorm,windicss,windows,wordpress,workers,xd,yarn,yew,zig".split(",");

const test = new QUI({
id: "test",
data: {
test: "test 123"
},
render: () => {
return `
render: _ => `
"{{ test }}",
div#main-card.primary.highlighted {
style: "background: red;",
Expand All @@ -146,7 +146,6 @@ <h4 :else>{{ title }} 4
}
]
}`
}
})

const app = new QUI({
Expand Down Expand Up @@ -238,7 +237,7 @@ <h4 :else>{{ title }} 4
}
},
when: {
before_render: _ => {
beforeRender: _ => {
console.log("準備渲染");
// return false;
},
Expand Down Expand Up @@ -271,7 +270,7 @@ <h4 :else>{{ title }} 4
}, 2000)
console.log("已渲染")
},
before_update: _ => {
beforeUpdate: _ => {
console.log("準備更新")
// alert(true)
// return false;
Expand All @@ -281,6 +280,7 @@ <h4 :else>{{ title }} 4
}
}
});

});
</script>
</body>
Expand Down
Binary file added src/QuickUI.debug.js
Binary file not shown.
Binary file removed src/QuickUI.js
Binary file not shown.
Binary file modified src/function/check200.ts
Binary file not shown.
Binary file modified src/listener/LazyloadListener.ts
Binary file not shown.
Binary file modified src/model/QUI.ts
Binary file not shown.
Binary file modified src/model/vDOM.ts
Binary file not shown.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
"outFile": "./src/QuickUI.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outFile": "./src/QuickUI.debug.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
Expand Down

0 comments on commit 89861d8

Please sign in to comment.