@capyclaw/offline-ddr0 0.0.0-stage → 1.9.0
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/LICENSE +21 -0
- package/README.md +441 -2
- package/client/client.js +603 -0
- package/cordis.patch.yml +13 -0
- package/docs/STORAGE-MIGRATION.md +136 -0
- package/lib/atomic.mjs +40 -0
- package/lib/http-cache.mjs +42 -0
- package/lib/inbox.mjs +64 -0
- package/lib/media.mjs +242 -0
- package/lib/migrate-json.mjs +101 -0
- package/lib/mirror-index.mjs +105 -0
- package/lib/mirror.mjs +123 -0
- package/lib/proxy.mjs +188 -0
- package/lib/remote.mjs +158 -0
- package/lib/render.mjs +93 -0
- package/lib/repository.mjs +71 -0
- package/lib/store.mjs +610 -0
- package/lib/surface.mjs +74 -0
- package/lib/sync-ui.mjs +108 -0
- package/lib/sync.mjs +433 -0
- package/lib/wire.mjs +211 -0
- package/lib/workstore-repository.mjs +316 -0
- package/lib/workstore.mjs +338 -0
- package/mirror/files/00001.html +2045 -0
- package/mirror/files/00002.json +1 -0
- package/mirror/files/00003.json +1 -0
- package/mirror/files/00004.json +1 -0
- package/mirror/files/00005.json +1 -0
- package/mirror/files/00006.json +1 -0
- package/mirror/files/00007.json +1 -0
- package/mirror/files/00008.json +1 -0
- package/mirror/files/00009.json +1 -0
- package/mirror/files/00010.json +1 -0
- package/mirror/files/00011.json +1 -0
- package/mirror/files/00012.json +1 -0
- package/mirror/files/00013.json +1 -0
- package/mirror/files/00014.json +1 -0
- package/mirror/files/00015.json +1 -0
- package/mirror/files/00016.json +1 -0
- package/mirror/files/00017.json +1 -0
- package/mirror/files/00018.json +1 -0
- package/mirror/files/00019.json +1 -0
- package/mirror/files/00020.json +1 -0
- package/mirror/files/00021.json +1 -0
- package/mirror/files/00022.json +1 -0
- package/mirror/files/00023.js +205 -0
- package/mirror/files/00024.json +1 -0
- package/mirror/files/00025.json +1 -0
- package/mirror/files/00026.json +1 -0
- package/mirror/files/00027.js +51 -0
- package/mirror/files/00028.json +1 -0
- package/mirror/files/00029.json +1 -0
- package/mirror/files/00030.json +1 -0
- package/mirror/files/00031.json +1 -0
- package/mirror/files/00032.json +1 -0
- package/mirror/files/00033.json +1 -0
- package/mirror/files/00034.json +1 -0
- package/mirror/files/00035.json +1 -0
- package/mirror/files/00036.json +1 -0
- package/mirror/files/00037.json +1 -0
- package/mirror/files/00038.json +1 -0
- package/mirror/files/00039.json +1 -0
- package/mirror/files/00040.js +2311 -0
- package/mirror/files/00041.json +1 -0
- package/mirror/files/00042.json +1 -0
- package/mirror/files/00043.json +1 -0
- package/mirror/files/00044.json +1 -0
- package/mirror/files/00045.js +575 -0
- package/mirror/files/00046.json +1 -0
- package/mirror/files/00047.js +575 -0
- package/mirror/files/00048.js +575 -0
- package/mirror/files/00049.json +1 -0
- package/mirror/files/00050.json +1 -0
- package/mirror/files/00051.json +1 -0
- package/mirror/files/00052.json +1 -0
- package/mirror/files/00053.js +575 -0
- package/mirror/files/00054.json +1 -0
- package/mirror/files/00055.json +1 -0
- package/mirror/files/00056.js +575 -0
- package/mirror/files/00057.json +1 -0
- package/mirror/files/00058.json +1 -0
- package/mirror/files/00059.js +360 -0
- package/mirror/files/00060.json +1 -0
- package/mirror/files/00061.json +1 -0
- package/mirror/files/00062.json +1 -0
- package/mirror/files/00063.json +1 -0
- package/mirror/files/00064.json +1 -0
- package/mirror/files/00065.js +144 -0
- package/mirror/files/00066.js +7 -0
- package/mirror/files/00067.json +1 -0
- package/mirror/files/00068.json +1 -0
- package/mirror/files/00069.json +1 -0
- package/mirror/files/00070.json +1 -0
- package/mirror/files/00071.json +1 -0
- package/mirror/files/00072.json +1 -0
- package/mirror/files/00073.js +1 -0
- package/mirror/files/00074.json +1 -0
- package/mirror/files/00075.json +1 -0
- package/mirror/files/00076.json +1 -0
- package/mirror/files/00077.js +45 -0
- package/mirror/files/00078.js +1348 -0
- package/mirror/files/00079.json +1 -0
- package/mirror/files/00080.json +1 -0
- package/mirror/files/00081.js +1 -0
- package/mirror/files/00082.json +1 -0
- package/mirror/files/00083.json +1 -0
- package/mirror/files/00084.js +7 -0
- package/mirror/files/00085.json +1 -0
- package/mirror/files/00086.json +1 -0
- package/mirror/files/00087.js +7 -0
- package/mirror/files/00088.json +1 -0
- package/mirror/files/00089.json +1 -0
- package/mirror/files/00090.js +7 -0
- package/mirror/files/00091.json +1 -0
- package/mirror/files/00092.json +1 -0
- package/mirror/files/00093.js +102 -0
- package/mirror/files/00094.json +1 -0
- package/mirror/files/00095.json +1 -0
- package/mirror/files/00096.json +1 -0
- package/mirror/files/00097.json +1 -0
- package/mirror/files/00098.json +1 -0
- package/mirror/files/00099.json +1 -0
- package/mirror/files/00100.json +1 -0
- package/mirror/files/00101.js +102 -0
- package/mirror/files/00102.json +1 -0
- package/mirror/files/00103.json +1 -0
- package/mirror/files/00104.json +1 -0
- package/mirror/files/00105.json +1 -0
- package/mirror/files/00106.json +1 -0
- package/mirror/files/00107.js +110 -0
- package/mirror/files/00108.json +1 -0
- package/mirror/files/00109.json +1 -0
- package/mirror/files/00110.json +1 -0
- package/mirror/files/00111.json +1 -0
- package/mirror/files/00112.json +1 -0
- package/mirror/files/00113.json +1 -0
- package/mirror/files/00114.json +1 -0
- package/mirror/files/00115.json +1 -0
- package/mirror/files/00116.json +1 -0
- package/mirror/files/00117.json +1 -0
- package/mirror/files/00118.json +1 -0
- package/mirror/files/00119.json +1 -0
- package/mirror/files/00120.json +1 -0
- package/mirror/files/00121.json +1 -0
- package/mirror/files/00122.json +1 -0
- package/mirror/files/00123.json +1 -0
- package/mirror/files/00124.json +1 -0
- package/mirror/files/00125.json +1 -0
- package/mirror/files/00126.json +1 -0
- package/mirror/files/00127.json +1 -0
- package/mirror/files/00128.json +1 -0
- package/mirror/files/00129.json +1 -0
- package/mirror/files/00130.json +1 -0
- package/mirror/files/00131.json +1 -0
- package/mirror/files/00132.js +110 -0
- package/mirror/files/00133.json +1 -0
- package/mirror/files/00134.json +1 -0
- package/mirror/files/00135.json +1 -0
- package/mirror/files/00136.json +1 -0
- package/mirror/files/00137.js +26 -0
- package/mirror/files/00138.json +1 -0
- package/mirror/files/00139.json +1 -0
- package/mirror/files/00140.json +1 -0
- package/mirror/files/00141.json +1 -0
- package/mirror/files/00142.json +1 -0
- package/mirror/files/00143.json +1 -0
- package/mirror/files/00144.js +26 -0
- package/mirror/files/00145.json +1 -0
- package/mirror/files/00146.json +1 -0
- package/mirror/files/00147.js +29 -0
- package/mirror/files/00148.json +1 -0
- package/mirror/files/00149.json +1 -0
- package/mirror/files/00150.js +23 -0
- package/mirror/files/00151.json +1 -0
- package/mirror/files/00152.json +1 -0
- package/mirror/files/00153.js +719 -0
- package/mirror/files/00154.js +9575 -0
- package/mirror/files/00155.js +108 -0
- package/mirror/files/00156.js +379 -0
- package/mirror/files/00157.js +48 -0
- package/mirror/files/00158.json +16 -0
- package/mirror/manifest.json +1582 -0
- package/node_modules/@capyclaw/asset-service/README.md +48 -0
- package/node_modules/@capyclaw/asset-service/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/asset-service/lib/host.mjs +14 -0
- package/node_modules/@capyclaw/asset-service/package.json +59 -0
- package/node_modules/@capyclaw/asset-service/src/index.mjs +223 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
- package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
- package/node_modules/@capyclaw/foundation/package.json +53 -0
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
- package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
- package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/service-host/README.md +86 -0
- package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
- package/node_modules/@capyclaw/service-host/package.json +60 -0
- package/node_modules/@capyclaw/service-host/src/index.mjs +571 -0
- package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -0
- package/node_modules/@capyclaw/suite-kit/README.md +238 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-domain.mjs +98 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-suite.mjs +174 -0
- package/node_modules/@capyclaw/suite-kit/client/embed.js +35 -0
- package/node_modules/@capyclaw/suite-kit/domain.schema.json +129 -0
- package/node_modules/@capyclaw/suite-kit/package.json +54 -0
- package/node_modules/@capyclaw/suite-kit/src/activation-registry.mjs +184 -0
- package/node_modules/@capyclaw/suite-kit/src/artifacts.mjs +131 -0
- package/node_modules/@capyclaw/suite-kit/src/capability.mjs +181 -0
- package/node_modules/@capyclaw/suite-kit/src/compose.mjs +201 -0
- package/node_modules/@capyclaw/suite-kit/src/domain.mjs +138 -0
- package/node_modules/@capyclaw/suite-kit/src/embed.mjs +81 -0
- package/node_modules/@capyclaw/suite-kit/src/index.mjs +10 -0
- package/node_modules/@capyclaw/suite-kit/src/manifest.mjs +263 -0
- package/node_modules/@capyclaw/suite-kit/src/orchestration.mjs +100 -0
- package/node_modules/@capyclaw/suite-kit/src/profile.mjs +584 -0
- package/node_modules/@capyclaw/suite-kit/src/surface.mjs +28 -0
- package/node_modules/@capyclaw/suite-kit/suite.schema.json +112 -0
- package/node_modules/@capyclaw/work-store/README.md +83 -0
- package/node_modules/@capyclaw/work-store/STANDARD.md +257 -0
- package/node_modules/@capyclaw/work-store/cordis.patch.yml +3 -0
- package/node_modules/@capyclaw/work-store/dsh-suite.json +26 -0
- package/node_modules/@capyclaw/work-store/icon.svg +7 -0
- package/node_modules/@capyclaw/work-store/lib/host.mjs +21 -0
- package/node_modules/@capyclaw/work-store/package.json +68 -0
- package/node_modules/@capyclaw/work-store/src/backend.mjs +89 -0
- package/node_modules/@capyclaw/work-store/src/db.mjs +199 -0
- package/node_modules/@capyclaw/work-store/src/envelope.mjs +132 -0
- package/node_modules/@capyclaw/work-store/src/index.mjs +570 -0
- package/node_modules/@capyclaw/work-store/src/interop.mjs +70 -0
- package/node_modules/@capyclaw/work-store/src/refs.mjs +99 -0
- package/node_modules/@capyclaw/work-store/src/routes.mjs +135 -0
- package/package.json +82 -4
- package/plugin.mjs +636 -0
- package/static/index.html +2068 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @caps flow-kit,work-caps
|
|
3
|
+
* Squiggle 笔迹文档装饰器套件 —— 纯抽象内核(source_code/,零图片
|
|
4
|
+
* 零配置数值)+ 打包时注入的具体实现(本层):META view.decorator
|
|
5
|
+
* 渲染套件,只读渲染宿主数据分节里的 DrawingDocument JSON。
|
|
6
|
+
*/
|
|
7
|
+
"use strict";(()=>{var P=t=>typeof t=="object"&&t!==null,R=t=>typeof t=="number"&&Number.isFinite(t)&&t>0,U=(t,e)=>{if(!P(t))throw new Error(`${e} must be an object`);if(t.mode!=="pen"&&t.mode!=="eraser")throw new Error(`${e}.mode must be "pen" or "eraser"`);if(!Array.isArray(t.pts))throw new Error(`${e}.pts must be an array`);let n=t.pts.map((i,o)=>{if(!Array.isArray(i)||i.length!==4)throw new Error(`${e}.pts[${o}] must be an array of four numbers`);if(!i.every(r=>typeof r=="number"&&Number.isFinite(r)))throw new Error(`${e}.pts[${o}] must contain only finite numbers`);return[i[0],i[1],i[2],i[3]]});return{mode:t.mode,pts:n}};function Y(t,e="strokes"){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map((n,i)=>U(n,`${e}[${i}]`))}function Q(t){if(!P(t))throw new Error("drawing document must be an object");if(!R(t.width))throw new Error("drawing document.width must be a finite positive number");if(!R(t.height))throw new Error("drawing document.height must be a finite positive number");if(t.background!=="paper"&&t.background!=="transparent")throw new Error('drawing document.background must be "paper" or "transparent"');return{width:t.width,height:t.height,background:t.background,strokes:Y(t.strokes,"drawing document.strokes")}}function A(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`invalid drawing document JSON: ${i}`)}return Q(e)}var L=(t,e)=>[(t[0]+e[0])/2,(t[1]+e[1])/2,(t[2]+e[2])/2,0];function F(t,e){return e.alpha*(1-e.fade+e.fade*Math.min(1,t/(e.base*e.nib)))}function*V(t,e){let n=t.length;for(let i=0;i<n;i++){let o=i===0?t[0]:L(t[i-1],t[i]),r=i>=n-1?t[n-1]:L(t[i],t[i+1]),a=t[i],m=Math.hypot(a[0]-o[0],a[1]-o[1])+Math.hypot(r[0]-a[0],r[1]-a[1]),l=Math.max(1,Math.ceil(m/2.5)),h=o[0],c=o[1];for(let p=1;p<=l;p++){let u=p/l,f=1-u,s=f*f*o[0]+2*f*u*a[0]+u*u*r[0],d=f*f*o[1]+2*f*u*a[1]+u*u*r[1],g=o[2]+(r[2]-o[2])*(u-.5/l);yield{x0:h,y0:c,x1:s,y1:d,w:g,alpha:F(g,e)},h=s,c=d}}}function z(t,e){return{x:t[0],y:t[1],r:t[2]/2,alpha:F(t[2],e)}}function H(t){let e=1e9,n=1e9,i=-1e9,o=-1e9;for(let r of t){let a=r[2]/2+5;r[0]-a<e&&(e=r[0]-a),r[0]+a>i&&(i=r[0]+a),r[1]-a<n&&(n=r[1]-a),r[1]+a>o&&(o=r[1]+a)}return i>e&&o>n?[e,n,i,o]:null}function N(t){let e=t>>>0;return function(){e=e+1831565813>>>0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}var X=t=>Math.pow(2,Math.round(Math.log2(t)*2)/2);function W(t,e,n=1){e=X(e);let i=t+e.toFixed(4)+":"+n,o=256,r=new Uint8ClampedArray(o*o*4),a=N(t==="print"?11:7),m=Math.max(1,1.6*e),l=Math.ceil(o/m)+2,h=new Float32Array(l*l);for(let p=0;p<h.length;p++)h[p]=a();let c=Math.round(o/m);c<1&&(c=1);for(let p=0;p<o;p++)for(let u=0;u<o;u++){let f=u/o*c,s=p/o*c,d=Math.floor(f),g=Math.floor(s),y=f-d,w=s-g,E=h[g%c*l+d%c],J=h[g%c*l+(d+1)%c],T=h[(g+1)%c*l+d%c],B=h[(g+1)%c*l+(d+1)%c];y=y*y*(3-2*y),w=w*w*(3-2*w);let k=(E+(J-E)*y)*(1-w)+(T+(B-T)*y)*w;k=k*.7+a()*.3;let b=(p*o+u)*4;r[b]=r[b+1]=r[b+2]=0;let x=G=>Math.round(255*(1-n)+n*G);t==="pencil"?r[b+3]=k>.3?x(255):k>.22?x(120):x(0):t==="print"?r[b+3]=x(k>.12?255:90):r[b+3]=x(k>.2?255:150)}return{key:i,size:o,rgba:r}}var q="squiggle-doc-suite-stage",M=t=>typeof t=="object"&&t!==null,K=t=>typeof t=="number"&&Number.isFinite(t)?t:null,C=t=>{let e=K(t);return e===null||e<0||e>1?null:e},$=t=>{let e=K(t);return e===null||e<=0?null:e},v=typeof document<"u"?document.createElement("canvas").getContext("2d"):null;function j(t){if(typeof t!="string"||!t.trim()||!v)return null;let e=t.trim(),n="#123456";return v.fillStyle=n,v.fillStyle=e,v.fillStyle===n&&e.toLowerCase()!==n?null:v.fillStyle}var Z=t=>t==="pencil"||t==="marker"||t==="print"?t:t===null?null:void 0;function I(t,e){if(!M(t))return null;let n=j(t.color),i=C(t.alpha),o=Z(t.mask),r=C(t.grain),a=$(t.base),m=$(t.nib),l=C(t.fade);return n===null||i===null||o===void 0||r===null||a===null||m===null||l===null?null:{color:n,alpha:i,mask:o,grain:r,base:a,nib:m,fade:l,op:e}}function tt(t){let e=M(t.pens)?t.pens:{},n=M(t.paper)?t.paper:{};return{paperFill:j(n.fill),pen:I(e.pen,"source-over"),eraser:I(e.eraser,"destination-out")}}var O="squiggle-doc-suite-style";if(typeof document<"u"&&!document.getElementById(O)){let t=document.createElement("style");t.id=O,t.textContent="html,body{margin:0;width:100%;height:100%}#app{width:100%;height:100vh}",document.head.appendChild(t)}var D=class{constructor(e,n,i){this.stage=e;this.conf=i;this.paper=document.createElement("canvas");this.inkCv=document.createElement("canvas");this.scratch=document.createElement("canvas");this.ro=null;this.w=0;this.h=0;this.s=1;this.ox=0;this.oy=0;this.tiles=new Map;this.patSeq=0;this.patCache=new Map;this.stage.dataset.mark=q,this.stage.innerHTML="",this.stage.style.position||(this.stage.style.position="relative");for(let r of[this.paper,this.inkCv])r.style.position="absolute",r.style.inset="0",r.style.width="100%",r.style.height="100%",r.style.touchAction="none",this.stage.appendChild(r);let o=this.inkCv.getContext("2d");if(!o)throw new Error("canvas 2d \u4E0D\u53EF\u7528");this.ink=o,this.doc=n,this.layout(),typeof ResizeObserver=="function"&&(this.ro=new ResizeObserver(()=>this.layout()),this.ro.observe(this.stage))}destroy(){this.ro?.disconnect(),this.ro=null,this.stage.innerHTML=""}layout(){let e=Math.round(this.stage.clientWidth),n=Math.round(this.stage.clientHeight);if(n===0&&!this.stage.style.height&&(this.stage.style.height="100vh",n=Math.round(this.stage.clientHeight)),e===0&&!this.stage.style.width&&(this.stage.style.width="100vw",e=Math.round(this.stage.clientWidth)),e=Math.max(1,e),n=Math.max(1,n),e===this.w&&n===this.h)return;this.w=e,this.h=n;let i=window.devicePixelRatio||1;for(let r of[this.paper,this.inkCv])r.width=Math.round(e*i),r.height=Math.round(n*i);this.scratch.width=this.inkCv.width,this.scratch.height=this.inkCv.height,this.s=Math.min(e/this.doc.width,n/this.doc.height),this.ox=(e-this.doc.width*this.s)/2,this.oy=(n-this.doc.height*this.s)/2;let o=this.paper.getContext("2d");o&&(o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,this.paper.width,this.paper.height),this.doc.background==="paper"&&this.conf.paperFill&&(o.fillStyle=this.conf.paperFill,o.fillRect(0,0,this.paper.width,this.paper.height))),this.render()}render(){this.ink.setTransform(1,0,0,1,0,0),this.ink.clearRect(0,0,this.inkCv.width,this.inkCv.height);for(let e of this.doc.strokes)this.stroke(e)}row(e){return e.mode==="pen"?this.conf.pen:this.conf.eraser}stroke(e){let n=this.row(e);if(!n)return;let i=window.devicePixelRatio||1,o=this.s*i,r=this.ox*i,a=this.oy*i,m=H(e.pts);if(!m)return;let l=Math.max(0,Math.floor(m[0]*o+r)-2),h=Math.max(0,Math.floor(m[1]*o+a)-2),c=Math.min(this.inkCv.width,Math.ceil(m[2]*o+r)+2),p=Math.min(this.inkCv.height,Math.ceil(m[3]*o+a)+2);if(c<=l||p<=h)return;let u=c-l,f=p-h,s=this.scratch.getContext("2d");if(s){if(s.setTransform(1,0,0,1,0,0),s.clearRect(l,h,u,f),s.save(),s.beginPath(),s.rect(l,h,u,f),s.clip(),s.setTransform(o,0,0,o,r,a),s.lineCap=s.lineJoin="round",s.strokeStyle=s.fillStyle=n.color,e.pts.length===1){let d=z(e.pts[0],n);s.globalAlpha=d.alpha,s.beginPath(),s.arc(d.x,d.y,d.r,0,6.2832),s.fill()}else for(let d of V(e.pts,n))s.lineWidth=d.w,s.globalAlpha=d.alpha,s.beginPath(),s.moveTo(d.x0,d.y0),s.lineTo(d.x1,d.y1),s.stroke();s.restore(),n.mask&&(s.save(),s.setTransform(1,0,0,1,0,0),s.beginPath(),s.rect(l,h,u,f),s.clip(),s.globalCompositeOperation="destination-in",s.fillStyle=this.pattern(s,n.mask,o,n.grain),s.fillRect(l,h,u,f),s.restore()),this.ink.save(),this.ink.setTransform(1,0,0,1,0,0),this.ink.globalAlpha=1,this.ink.globalCompositeOperation=n.op,this.ink.drawImage(this.scratch,l,h,u,f,l,h,u,f),this.ink.restore()}}pattern(e,n,i,o){let r=W(n,i,o),a=this.tiles.get(r.key);if(!a){a=document.createElement("canvas"),a.width=a.height=r.size;let p=a.getContext("2d");if(p){let u=p.createImageData(r.size,r.size);u.data.set(r.rgba),p.putImageData(u,0,0)}this.tiles.set(r.key,a)}let m=e.canvas,h=(m.__id||(m.__id=++this.patSeq))+":"+r.key,c=this.patCache.get(h);return c||(c=e.createPattern(a,"repeat"),this.patCache.set(h,c)),c}};function et(t){let e=(t||"").trim();if(!e)return null;try{let n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?null:(n.background!=="paper"&&n.background!=="transparent"&&(n.background="paper"),{doc:A(n),conf:tt(n)})}catch{return null}}var S=null;function nt(t,e,n,i){S=new D(t,e,n),requestAnimationFrame(()=>i?.())}function _(t,e){t.dataset.mark=q,t.innerHTML="",requestAnimationFrame(()=>e?.())}if(typeof window<"u"&&window.Work)window.Work.register({mount:t=>{let e=et(t.viewDoc);e?nt(t.stage,e.doc,e.conf,t.ready):_(t.stage,t.ready)},destroy:()=>{S?.destroy(),S=null}});else{let t=document.querySelector("#app")??document.body;_(t)}})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"liked":true,"favorited":true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"status":"ok","item":{"id":3580,"ref":"WORKS-3580","name":"Squiggle 涂鸦(入口)","tags":"外接","image_url":"","thumb_url":"","emoji":"","status":3,"visible_to":[],"is_pinned":true,"is_locked":false,"ban_hidden":false,"author":"站长","author_id":1,"author_username":"root","author_avatar":"emoji:🦔","view_count":443,"like_count":1,"favorite_count":1,"fork_count":0,"referenced_count":0,"latest_version":7,"default_version":7,"forked_from_ref":"","fork_base_version":0,"description":"AI","description_truncated":false,"description_next_offset":2,"brief":"Squiggle 涂鸦(外接应用)入口:点卡直达。","created_at":"2026-10-08T20:54:32.811134+08:00","last_published_at":"2026-10-17T01:51:07.751351+08:00","updated_at":"2026-10-17T01:51:07.746413+08:00","code_url":"","has_code":false,"view":{"kind":"link","url":"https://ddr0.com/apps/works/3580/"},"launch":{"type":"external","url":"https://ddr0.com/apps/works/3580/"},"item_type":"works","delivery_adopted":null,"delivery_published":null,"is_favorited":true,"references":[],"attachments":[]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"liked":true,"favorited":true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"status":"ok","item":{"id":3685,"ref":"WORKS-3685","name":"Canvas 文档示例:装饰器只读渲染","tags":"外接,示例","image_url":"","thumb_url":"","emoji":"📃","status":3,"visible_to":[],"is_pinned":false,"is_locked":false,"ban_hidden":false,"author":"站长","author_id":1,"author_username":"root","author_avatar":"emoji:🦔","view_count":362,"like_count":0,"favorite_count":1,"fork_count":0,"referenced_count":0,"latest_version":16,"default_version":16,"forked_from_ref":"","fork_base_version":0,"description":"# Canvas 文档示例\n\n点顶图查看 canvas-editor 只读渲染(数据 = WORKFLOW-SOURCE 分节的文档配置 JSON)。","description_truncated":false,"description_next_offset":75,"brief":"Canvas 文档顶图点击只读渲染。","created_at":"2026-10-12T16:10:31.899677+08:00","last_published_at":"2026-11-08T13:58:42.339209+08:00","updated_at":"2026-11-08T13:58:42.337476+08:00","code_url":"/api/works/works/3685/version/16/js","has_code":true,"view":{"kind":"code","decorator":"WORKS-3684@13","source":"%%%WORKS-WORKFLOW-SOURCE%%%"},"launch":{"type":"runtime","runtime":{"contract":"work-v1","work_ref":"WORKS-3685","code_url":"/api/works/works/3685/version/16/js","caps_url":"","decorator":"WORKS-3684@13"}},"item_type":"works","delivery_adopted":null,"delivery_published":null,"is_favorited":true,"references":[{"ref":"WORKS-3684","name":"Canvas 文档装饰器套件","kind":"works","version":13,"follow":false,"work_version":16,"created_at":"2026-11-08T13:58:42.369232+08:00"}],"attachments":[]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"liked":false,"favorited":true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"status":"ok","item":{"id":3684,"ref":"WORKS-3684","name":"Canvas 文档装饰器套件","tags":"外接,套件","image_url":"","thumb_url":"","emoji":"📄","status":3,"visible_to":[],"is_pinned":false,"is_locked":false,"ban_hidden":false,"author":"站长","author_id":1,"author_username":"root","author_avatar":"emoji:🦔","view_count":182,"like_count":1,"favorite_count":0,"fork_count":0,"referenced_count":2,"latest_version":13,"default_version":13,"forked_from_ref":"","fork_base_version":0,"description":"# Canvas 文档装饰器套件 —— 使用说明\n\n> **套件作品**: WORKS-3684 \n> **产物文件**: `canvas-doc-suite.js` \n> **适用场景**: 在平台上展示只读的富文本文档内容\n\n## 这是什么\n\nCanvas 文档装饰器套件是一个**只读文档渲染器**,用于在平台作品中展示富文本文档内容。基于开源引擎 [hufe921/canvas-editor](https://github.com/hufe921/canvas-editor) 定制。\n\n**你可以用它做什么**:\n- ✅ 展示包含文本、图片、表格、超链接、列表的富文本文档\n- ✅ 自动适应容器尺寸,支持多页文档滚动查看\n- ✅ 用户可以选中和复制文档内容\n\n**你不能用它做什么**:\n- ❌ 编辑文档内容(这是只读渲染器)\n- ❌ 添加交互功能(如按钮、输入框)\n- ❌ 导出为 PDF 或 Word 文档\n\n---\n\n## 快速开始\n\n### 1. 在你的作品中声明装饰器\n\n在 `.works` 文件的 META 部分声明使用此套件:\n\n```\n===META===\ntitle: 我的文档作品\ntags: 外接,文档\nview:\n decorator: WORKS-3684:latest\n\n===WORKFLOW-SOURCE===\n{\n \"main\": [\n {\n \"value\": \"这是文档内容\"\n }\n ]\n}\n```\n\n### 2. 在 WORKFLOW-SOURCE 中配置文档数据\n\n`WORKFLOW-SOURCE` 分节必须是有效的 JSON 格式,包含文档内容配置。\n\n---\n\n## 数据格式说明\n\n套件支持三种数据格式,选择最适合你场景的一种。\n\n### 格式 1: 完整配置(推荐用于需要自定义页面尺寸的场景)\n\n```json\n{\n \"data\": {\n \"main\": [\n { \"value\": \"文档内容\" }\n ]\n },\n \"options\": {\n \"width\": 794,\n \"height\": 1123\n }\n}\n```\n\n**字段说明**:\n\n| 字段 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `data.main` | array | 文档主体内容(必需) | - |\n| `data.header` | array | 页眉内容(可选) | [] |\n| `data.footer` | array | 页脚内容(可选) | [] |\n| `options.width` | number | 页面宽度(像素) | 794 |\n| `options.height` | number | 页面高度(像素) | 1123 |\n| `options.margins` | array | 页边距 [上, 右, 下, 左] | [100, 120, 100, 120] |\n\n### 格式 2: 简化配置(推荐用于常规场景)\n\n```json\n{\n \"main\": [\n { \"value\": \"文档内容\" }\n ]\n}\n```\n\n**字段说明**:\n\n| 字段 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `main` | array | 文档主体内容(必需) | - |\n| `header` | array | 页眉内容(可选) | [] |\n| `footer` | array | 页脚内容(可选) | [] |\n\n### 格式 3: 纯元素数组(推荐用于最简单的场景)\n\n```json\n[\n { \"value\": \"文档内容\" }\n]\n```\n\n直接传递元素数组,套件会自动识别并处理。\n\n---\n\n## 元素类型参考\n\n### 文本元素\n\n**最简单的形式**:\n```json\n{ \"value\": \"这是一段文本\" }\n```\n\n**完整形式**:\n```json\n{\n \"value\": \"这是标题\",\n \"size\": 24,\n \"bold\": true,\n \"color\": \"#333333\",\n \"rowFlex\": \"center\"\n}\n```\n\n**可用属性**:\n\n| 属性 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `value` | string | 文本内容(必需),用 `\\n` 表示换行 | - |\n| `size` | number | 字号 | 16 |\n| `font` | string | 字体名称 | \"Microsoft YaHei\" |\n| `color` | string | 文本颜色(十六进制,如 \"#000000\") | \"#000000\" |\n| `bold` | boolean | 是否加粗 | false |\n| `italic` | boolean | 是否斜体 | false |\n| `underline` | boolean | 是否下划线 | false |\n| `strikeout` | boolean | 是否删除线 | false |\n| `rowFlex` | string | 段落对齐:`\"left\"` / `\"center\"` / `\"right\"` / `\"alignment\"` | \"left\" |\n\n**注意事项**:\n- 使用 `\\n` 表示换行\n- 颜色必须是十六进制格式(如 \"#FF0000\")\n- `rowFlex` 影响整个段落,不影响行内文本\n\n### 图片元素\n\n**完整形式**:\n```json\n{\n \"type\": \"image\",\n \"value\": \"https://example.com/image.png\",\n \"width\": 400,\n \"height\": 300\n}\n```\n\n**可用属性**:\n\n| 属性 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `type` | string | 必须为 `\"image\"` | - |\n| `value` | string | 图片 URL(必需) | - |\n| `width` | number | 图片显示宽度(像素,必需) | - |\n| `height` | number | 图片显示高度(像素,必需) | - |\n\n**注意事项**:\n- 图片 URL 必须是可访问的公网地址\n- 必须支持 CORS 跨域访问\n- 建议使用 HTTPS 协议\n- 如果图片加载失败,会显示占位图\n\n### 表格元素\n\n**完整形式**:\n```json\n{\n \"type\": \"table\",\n \"trList\": [\n {\n \"tdList\": [\n {\n \"colspan\": 1,\n \"rowspan\": 1,\n \"value\": [\n { \"value\": \"单元格内容\" }\n ]\n }\n ]\n }\n ]\n}\n```\n\n**结构说明**:\n\n| 字段 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `type` | string | 必须为 `\"table\"` | - |\n| `trList` | array | 行数组(必需) | - |\n| `trList[].tdList` | array | 单元格数组(必需) | - |\n| `tdList[].colspan` | number | 合并列数 | 1 |\n| `tdList[].rowspan` | number | 合并行数 | 1 |\n| `tdList[].value` | array | 单元格内容(元素数组) | - |\n\n**注意事项**:\n- 单元格内容 `value` 是元素数组,可以包含文本、图片等\n- 使用 `colspan` 和 `rowspan` 实现单元格合并\n- 每行的单元格数量应该一致(考虑合并后的实际列数)\n\n### 超链接元素\n\n**完整形式**:\n```json\n{\n \"type\": \"hyperlink\",\n \"url\": \"https://example.com\",\n \"valueList\": [\n {\n \"value\": \"点击这里\",\n \"color\": \"#0000FF\",\n \"underline\": true\n }\n ]\n}\n```\n\n**可用属性**:\n\n| 属性 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `type` | string | 必须为 `\"hyperlink\"` | - |\n| `url` | string | 链接地址(必需) | - |\n| `valueList` | array | 链接文本内容(元素数组,必需) | - |\n\n**注意事项**:\n- `valueList` 中可以设置文本样式(颜色、下划线等)\n- 链接在只读模式下可以点击跳转\n\n### 列表元素\n\n**无序列表**:\n```json\n{\n \"type\": \"list\",\n \"listType\": \"ul\",\n \"listStyle\": \"disc\",\n \"valueList\": [\n { \"value\": \"列表项 1\" },\n { \"value\": \"\\n列表项 2\" },\n { \"value\": \"\\n列表项 3\" }\n ]\n}\n```\n\n**有序列表**:\n```json\n{\n \"type\": \"list\",\n \"listType\": \"ol\",\n \"listStyle\": \"decimal\",\n \"valueList\": [\n { \"value\": \"第一项\" },\n { \"value\": \"\\n第二项\" },\n { \"value\": \"\\n第三项\" }\n ]\n}\n```\n\n**可用属性**:\n\n| 属性 | 类型 | 说明 | 默认值 |\n|------|------|------|--------|\n| `type` | string | 必须为 `\"list\"` | - |\n| `listType` | string | 列表类型:`\"ul\"`(无序)或 `\"ol\"`(有序) | - |\n| `listStyle` | string | 列表样式(见下方说明) | - |\n| `valueList` | array | 列表项内容(元素数组,必需) | - |\n\n**listStyle 可选值**:\n- 无序列表:`\"disc\"`(实心圆点)、`\"circle\"`(空心圆)、`\"square\"`(方块)\n- 有序列表:`\"decimal\"`(数字)\n\n**注意事项**:\n- 每个列表项开头需要 `\\n`(第一项除外)\n- `valueList` 中可以包含任何元素类型\n\n---\n\n## 完整示例\n\n### 示例 1: 简单公告\n\n```json\n{\n \"main\": [\n {\n \"value\": \"系统维护通知\",\n \"size\": 28,\n \"bold\": true,\n \"rowFlex\": \"center\"\n },\n {\n \"value\": \"\\n\\n尊敬的用户:\"\n },\n {\n \"value\": \"\\n\\n系统将于 2026 年 10 月 15 日 02:00-04:00 进行维护升级,期间服务将暂时中断。\"\n },\n {\n \"value\": \"\\n\\n感谢您的理解与支持!\"\n }\n ]\n}\n```\n\n**说明**:适用于简单的通知、公告类文档,只包含标题和正文。\n\n### 示例 2: 产品说明书\n\n```json\n{\n \"main\": [\n {\n \"value\": \"产品使用说明\",\n \"size\": 32,\n \"bold\": true,\n \"rowFlex\": \"center\",\n \"color\": \"#2c3e50\"\n },\n {\n \"value\": \"\\n\\n一、产品特性\",\n \"size\": 20,\n \"bold\": true,\n \"color\": \"#34495e\"\n },\n {\n \"value\": \"\\n本产品具有以下特性:\"\n },\n {\n \"type\": \"list\",\n \"listType\": \"ul\",\n \"listStyle\": \"disc\",\n \"valueList\": [\n { \"value\": \"高性能处理能力\" },\n { \"value\": \"\\n简单易用的界面\" },\n { \"value\": \"\\n7×24 小时技术支持\" }\n ]\n },\n {\n \"value\": \"\\n\\n二、产品图片\",\n \"size\": 20,\n \"bold\": true,\n \"color\": \"#34495e\"\n },\n {\n \"value\": \"\\n\"\n },\n {\n \"type\": \"image\",\n \"value\": \"https://example.com/product.jpg\",\n \"width\": 500,\n \"height\": 350\n },\n {\n \"value\": \"\\n\\n三、联系我们\",\n \"size\": 20,\n \"bold\": true,\n \"color\": \"#34495e\"\n },\n {\n \"value\": \"\\n官方网站:\"\n },\n {\n \"type\": \"hyperlink\",\n \"url\": \"https://example.com\",\n \"valueList\": [\n {\n \"value\": \"https://example.com\",\n \"color\": \"#3498db\",\n \"underline\": true\n }\n ]\n }\n ]\n}\n```\n\n**说明**:适用于包含多种元素的富文本文档,展示了标题、列表、图片、超链接的综合使用。\n\n### 示例 3: 数据报表\n\n```json\n{\n \"main\": [\n {\n \"value\": \"月度销售报表\",\n \"size\": 24,\n \"bold\": true,\n \"rowFlex\": \"center\"\n },\n {\n \"value\": \"\\n\\n2026年10月销售数据统计:\",\n \"size\": 16\n },\n {\n \"value\": \"\\n\\n\"\n },\n {\n \"type\": \"table\",\n \"trList\": [\n {\n \"tdList\": [\n {\n \"value\": [{ \"value\": \"产品名称\", \"bold\": true }]\n },\n {\n \"value\": [{ \"value\": \"销售量\", \"bold\": true }]\n },\n {\n \"value\": [{ \"value\": \"销售额\", \"bold\": true }]\n }\n ]\n },\n {\n \"tdList\": [\n {\n \"value\": [{ \"value\": \"产品 A\" }]\n },\n {\n \"value\": [{ \"value\": \"1,250 件\" }]\n },\n {\n \"value\": [{ \"value\": \"¥125,000\" }]\n }\n ]\n },\n {\n \"tdList\": [\n {\n \"value\": [{ \"value\": \"产品 B\" }]\n },\n {\n \"value\": [{ \"value\": \"890 件\" }]\n },\n {\n \"value\": [{ \"value\": \"¥178,000\" }]\n }\n ]\n },\n {\n \"tdList\": [\n {\n \"value\": [{ \"value\": \"合计\", \"bold\": true }]\n },\n {\n \"value\": [{ \"value\": \"2,140 件\", \"bold\": true }]\n },\n {\n \"value\": [{ \"value\": \"¥303,000\", \"bold\": true }]\n }\n ]\n }\n ]\n }\n ]\n}\n```\n\n**说明**:适用于包含表格的数据报表类文档,表格中可以使用加粗等样式。\n\n---\n\n## 常见问题\n\n### 文档不显示,怎么办?\n\n**检查项**:\n1. 确认 `WORKFLOW-SOURCE` 是有效的 JSON 格式(使用 JSON 验证工具检查)\n2. 确认至少有 `main` 字段或直接是元素数组\n3. 确认每个元素都有 `value` 属性\n4. 查看浏览器控制台是否有错误信息\n\n**解决方法**:\n1. 使用在线 JSON 格式化工具检查 JSON 是否有语法错误\n2. 参考本文档的\"完整示例\",确保数据结构正确\n3. 如果使用了特殊字符,确保正确转义(如引号需要用 `\\\"`)\n\n### 图片显示不出来,怎么办?\n\n**可能原因**:\n1. 图片 URL 无法访问\n2. 图片服务器不支持 CORS 跨域\n3. 使用了 HTTP 而非 HTTPS(混合内容警告)\n4. 图片尺寸 `width` 或 `height` 未指定\n\n**解决方法**:\n1. 在浏览器中直接打开图片 URL,确认可以访问\n2. 使用支持 CORS 的图片服务器(如公共图床)\n3. 使用 HTTPS 协议的图片地址\n4. 确保 `width` 和 `height` 属性都已设置\n\n### 如何让文本居中或右对齐?\n\n使用 `rowFlex` 属性:\n\n```json\n{\n \"value\": \"居中文本\",\n \"rowFlex\": \"center\"\n}\n```\n\n可选值:\n- `\"left\"`: 左对齐(默认)\n- `\"center\"`: 居中\n- `\"right\"`: 右对齐\n- `\"alignment\"`: 两端对齐\n\n### 如何在文本中换行?\n\n有两种方法:\n\n**方法 1**:在 `value` 中使用 `\\n`\n```json\n{ \"value\": \"第一行\\n第二行\\n第三行\" }\n```\n\n**方法 2**:用单独的元素表示新段落\n```json\n[\n { \"value\": \"第一段\" },\n { \"value\": \"\\n第二段\" },\n { \"value\": \"\\n第三段\" }\n]\n```\n\n### 文档内容太多,性能怎么样?\n\n套件已优化性能:\n- ✅ 自动分页,不会一次渲染所有内容\n- ✅ 懒加载,只渲染可见区域\n- ✅ 建议单个文档元素数量 < 10,000\n\n如果文档非常长,可以考虑:\n1. 分成多个作品\n2. 使用分页或章节导航\n3. 优化图片大小和数量\n\n---\n\n## 技术限制\n\n### 不支持的功能\n\n- ❌ **编辑文档内容**: 这是只读渲染器,用户无法修改内容\n- ❌ **导出为 PDF/Word**: 不提供导出功能\n- ❌ **打印功能**: 不提供打印支持\n- ❌ **多人协作编辑**: 不支持协作功能\n\n### 环境要求\n\n- ✅ 现代浏览器(Chrome / Firefox / Safari / Edge)\n- ✅ 支持 ES6+ 语法\n- ✅ 支持 ResizeObserver API(自适应缩放,不支持时使用默认尺寸)\n\n### 数据约束\n\n- JSON 必须是有效格式\n- 图片 URL 必须可访问且支持 CORS\n- 建议单个文档元素数量 < 10,000(性能考虑)\n- 建议图片尺寸合理(避免过大的图片影响加载速度)\n\n---\n\n## 相关资源\n\n- **示例作品**: [WORKS-3685](https://ddr0.com/works/3685/) - 查看实际效果\n- **开源引擎**: [hufe921/canvas-editor](https://github.com/hufe921/canvas-editor)\n\n---\n\n## 版本信息\n\n- **当前版本**: 由平台自动管理\n- **最后更新**: 2026-10-14\n- **产物大小**: 686.76 KB (gzip: 201.63 KB)","description_truncated":false,"description_next_offset":9547,"brief":"Canvas 文档配置 JSON 只读渲染。","created_at":"2026-10-12T16:10:29.101491+08:00","last_published_at":"2026-11-08T13:58:42.020373+08:00","updated_at":"2026-11-08T13:58:42.015900+08:00","code_url":"/api/works/works/3684/version/13/js","has_code":true,"launch":{"type":"document","document":{"path":"/apps/works/doc/3684"}},"item_type":"works","delivery_adopted":null,"delivery_published":null,"is_favorited":false,"references":[],"attachments":[]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Work.register({ mount(ctx) { ctx.stage.innerHTML = '<div style="padding:24px;opacity:.7">本作品的看点在顶图:点顶图开 Canvas 文档只读渲染(WORKFLOW-SOURCE 分节数据)。</div>'; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"status":"ok","item":{"id":3686,"ref":"WORKS-3686","name":"PPT 演示文档装饰器套件","tags":"外接,套件","image_url":"","thumb_url":"","emoji":"🎞️","status":3,"visible_to":[],"is_pinned":false,"is_locked":false,"ban_hidden":false,"author":"站长","author_id":1,"author_username":"root","author_avatar":"emoji:🦔","view_count":179,"like_count":1,"favorite_count":1,"fork_count":0,"referenced_count":23,"latest_version":15,"default_version":15,"forked_from_ref":"","fork_base_version":0,"description":"[TOC]\n\n# PPT 演示文档装饰器套件\n\nMETA `view.decorator` 的渲染套件(flow-kit 形):宿主作品声明 decorator\n钉版本套件后,顶图点击在标准容器(WorkView 沙箱)内把作品的数据分节\n放映成 **PPTist 只读幻灯片**(PPTist 定制只读放映版,编辑通道 =\nddr0.com/apps/works/3682/)。放映保持画幅原比例自适应铺满容器(cover,\n无黑边);点击屏幕或左右滑动翻页,也支持方向键 / 空格,右下角有页码。\n\n## 用法\n\n宿主作品 .works 的 META view 声明(decorator 钉本套件版本,source 指数据分节):\n\n```json\n{\"kind\": \"code\", \"decorator\": \"WORKS-套件编号@版本\", \"source\": \"%%%WORKS-WORKFLOW-SOURCE%%%\"}\n```\n\n数据分节 `%%%WORKS-WORKFLOW-SOURCE%%%` 放 PPTist 幻灯片数据 JSON,\n三形兼容:\n\n- 完整导出:`.pptist` 文件内容(`title / width / height / theme / slides`),\n 按 width : height 自动适配画幅\n- 精简对象:`{\"slides\": [...], \"theme\": {...}}`,画幅缺省 1000 × 562.5\n- 裸数组:`[slide, ...]`\n\n元素词表见 PPTist 上游文档(text / shape / line / image / table / chart /\nlatex / video / audio,坐标单位 = viewportSize 像素)。放映固定只读,保留\n元素动画(click / meantime / auto)与页面转场(turningMode);坏数据降级为\n套件内置示例,不白屏。\n\n## 能力\n\n- chart(图表)元素由套件内置 ECharts SVG 渲染,不再是空占位。\n- video / audio 元素使用原生生媒体控件;资源需为 data URL 或可访问 URL,\n 不可达时组件显示加载失败。\n- 构建收尾会对 ECharts 内部标识符做一致性改名,避免平台素材自动引用扫描\n 误命中 WORKS-3300 导出词;不改平台发布器。","description_truncated":false,"description_next_offset":1034,"brief":"PPTist 幻灯片数据只读放映。","created_at":"2026-10-12T16:31:05.404605+08:00","last_published_at":"2026-11-08T13:59:01.331153+08:00","updated_at":"2026-11-08T13:59:01.325844+08:00","code_url":"/api/works/works/3686/version/15/js","has_code":true,"launch":{"type":"document","document":{"path":"/apps/works/doc/3686"}},"item_type":"works","delivery_adopted":null,"delivery_published":null,"is_favorited":true,"references":[],"attachments":[]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"liked":true,"favorited":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"liked":true,"favorited":true}
|