From 21e7b69024db4980cc438e26c9f3933981a7c3d0 Mon Sep 17 00:00:00 2001 From: tiye Date: Sun, 8 Nov 2026 01:44:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20Diffview=20=E5=88=B0?= =?UTF-8?q?=20Calcit=200.37.0=20=E5=B9=B6=E6=94=B6=E7=B4=A7=E5=88=86?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++------ calcit.cirru | 68 +++++++++++++++++++++++++++------------------------- deps.cirru | 10 ++++---- package.json | 4 ++-- yarn.lock | 10 ++++---- 5 files changed, 56 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index fd2175c..063fa6e 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,23 @@ http://r.tiye.me/Memkits/diffview/ ### 使用者影响 -CLI 与 `@calcit/procs` 配对升级到正式 **0.35.1**,需要重新安装完整模块图、 -生成 JS 并完整刷新,不能跨工具链热重载旧 Reel。依赖使用正式 Reel **0.9.2**、 -UI **0.15.1**、Respo **0.19.4**、JS-FFI **0.2.13**,传递 Router **0.12.1**。 +CLI 与 `@calcit/procs` 配对升级到正式 **0.37.0**,需要重新安装完整模块图、 +生成 JS 并完整刷新,不能跨工具链热重载旧 Reel。依赖使用正式 Reel **0.10.0**、 +UI **0.15.2**、Respo **0.19.5**、JS-FFI **0.2.13**,传递 Router **0.12.2**。 不使用 main/hash 或 alpha,不关闭 Caps strict 解决冲突。 行/词差异、Sorted、Swap、Clear、原 ⌘E/⌘I/⌘K、存储 key `diffview` 和 Map 存档 保持。恢复仍先于 render/watch、beforeunload 和 60 秒保存注册;失败保留原值, 不吞异常或用默认状态覆盖。真实 `hud!` 的页面错误展示及原服务器路径保持。 -七个 DOM 回调采用 RespoEvent 与单个 Enum 派发。两个文本输入直接读 Struct 字段, +七个 DOM 回调采用 RespoEvent,并派发同一个具名 `Op` 类型。两个文本输入直接读 Struct 字段, 缺失宿主 value(JS undefined)按原缺失值合同回退为空串;显式 null/false/0 等非法 文本仍由原 String decoder 拒绝,不在失败时写入状态。旧 Map 事件夹具改用 Respo 公开 event→EDN 适配,原六项测试及全部断言保留。 DiffChunk、StoreData 和 `Map Tag String` site 配置沿用。存档入口接受原 Map/Struct, -通过原 decoder 构造本地 StoreData。派发入口接收 Respo 与 Reel 的匿名枚举, -校验并转换为具名 `Op` 再写入 Reel。状态坐标使用 Respo 的 `CoordKey` union, +通过原 decoder 构造本地 StoreData。应用事件构造具名 `Op` 后进入 Reel, +开发工具的控制操作仍由 Reel 解码。状态坐标使用 Respo 的 `CoordKey` union, 状态节点载荷继续接受异构数据。 根组件构建与 render! 同处 managed memo frame。开发 Reel 直接使用 typed State, @@ -31,7 +31,7 @@ DiffChunk、StoreData 和 `Map Tag String` site 配置沿用。存档入口接 ### 安装与原门禁 -使用 Calcit 0.35.1、Caps 0.1.1、Node.js 24、Yarn 4.18.0。 +使用 Calcit 0.37.0、Caps 0.1.1、Node.js 24、Yarn 4.18.0。 Caps 独立安装,见 [官方说明](https://github.com/calcit-lang/caps);Corepack/Yarn 不会安装它。 新解析 npm 包保留 60 分钟年龄门禁,无单包例外。lock 只更新 procs 配对;已有 undici Dependabot #48 单独保留。 @@ -51,8 +51,7 @@ node --test scripts/upgrade.test.mjs Snapshot 使用官方 query/tree/edit 与 revision 事务,不用文本补丁或自行解析。 保留原 canonical、全定义、完整 strict、公开定义及原六项 Node 业务回归。 -0.35.1 的 Caps strict/toolchain、Yarn immutable、224 个完整定义、31 个公开定义、 -完整 strict、原六项回归与 JS/Vite 构建通过。 +验收使用 Caps strict/toolchain、Yarn immutable、完整 strict、原六项回归与 JS/Vite 构建。 此前 0.34.2 在普通 Chrome 的独立回环来源使用合成中文/emoji、多行文本,实际验证行/词模式、 Sorted 的重排等价、Swap、Clear、⌘快捷键及刷新恢复,无应用 pageerror。 diff --git a/calcit.cirru b/calcit.cirru index b2467d5..d17884f 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -6,7 +6,7 @@ {} (:description |) (:init-fn 'app.main/main!) (:mode :js) (:reload-fn 'app.main/reload!) (:target :browser) :feature-policy $ {} :modules $ [] |respo.calcit/ |respo-ui.calcit/ |reel.calcit/ |js-ffi/ - :type-slots $ {} $ :dispatch-op |app.schema/DispatchOp + :type-slots $ {} $ :dispatch-op 'app.schema/Op :files $ {} 'app.comp.container $ %{} 'FileEntry :defs $ {} @@ -22,7 +22,7 @@ :examples $ [] :schema $ quote $ Fn Bool String Fn respo.schema/RespoEvent - Fn Enum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit -> respo.schema/Component 'comp-container $ %{} 'CodeEntry (:doc |) @@ -57,13 +57,13 @@ :placeholder "|Old text" :on-input $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :write-old $ let + d! $ app.schema/Op :write-old $ let value $ :value e if = :unit $ type-of value - , | value + , | $ decode-map-as value String :spell-check false :autofocus true comp-divider @@ -73,13 +73,13 @@ :placeholder "|New text" :on-input $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :write-new $ let + d! $ app.schema/Op :write-new $ let value $ :value e if = :unit $ type-of value - , | value + , | $ decode-map-as value String :spellcheck false if dev? Option :some $ comp-typed-reel (>> states :reel) reel $ {} @@ -130,35 +130,35 @@ {} $ :class-name css/row-center comp-checked show-result? "|Result?(⌘ e)" $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :toggle-result + d! $ app.schema/Op :toggle-result space-x 16 comp-checked sorted? |Sorted $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :toggle-sorted + d! $ app.schema/Op :toggle-sorted space-x 16 comp-checked by-word? |ByWord $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :toggle-word + d! $ app.schema/Op :toggle-word space-x 16 a $ {} (:class-name css/link) (:inner-text |Swap) (:title "|⌘ i") :on-click $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :swap-text + d! $ app.schema/Op :swap-text space-x 16 a $ {} (:class-name css/link) (:inner-text |Clear) (:title "|⌘ k") :on-click $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Op $ -> Unit -> Unit - d! $ :: :clear-text + d! $ app.schema/Op :clear-text :examples $ [] :schema $ quote $ Fn Bool Bool Bool (-> respo.schema/Component) 'sort-by-line $ %{} 'CodeEntry (:doc |) @@ -252,10 +252,10 @@ (:some control) reset! *reel $ typed-reel/apply-control updater @*reel control (:none) - reset! *reel $ typed-reel/record-op updater @*reel (schema/decode-op op) (generate-id!) (host/now-ms) + reset! *reel $ typed-reel/record-op updater @*reel op (generate-id!) (host/now-ms) , &unit :examples $ [] - :schema $ quote $ Fn AnyEnum (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn app.schema/Op (-> Unit) (:features :js-ffi) 'main! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn main! () if config/dev? $ load-console-formatter! @@ -263,13 +263,13 @@ match browser/storage-get $ .unwrap-or (get config/site :storage-key) | (:some raw) - dispatch! $ :: :hydrate-storage $ parse-cirru-edn raw + dispatch! $ app.schema/Op :hydrate-storage $ schema/normalize-store (parse-cirru-edn raw) (:none) &unit render-app! add-watch! *reel :changes $ fn (r p) hint-fn $ Fn (reel.typed/State app.schema/Op app.schema/StoreData) (reel.typed/State app.schema/Op app.schema/StoreData) (-> Unit) render-app! - listen-devtools! |a dispatch! + listen-devtools-toggle! |a $ fn () $ dispatch! (app.schema/Op :reel/toggle) browser/add-event-listener! |beforeunload $ fn (event) hint-fn $ Fn js-ffi.browser/EventHost $ -> Unit persist-storage! @@ -282,11 +282,11 @@ meta-key? $ .-meta-key? host cond and meta-key? $ = |e key - dispatch! $ :: :toggle-result + dispatch! $ app.schema/Op :toggle-result (and meta-key? (= |k key)) - dispatch! $ :: :clear-text + dispatch! $ app.schema/Op :clear-text (and meta-key? (= |i key)) - dispatch! $ :: :swap-text + dispatch! $ app.schema/Op :swap-text true &unit println "|App started." :examples $ [] @@ -343,7 +343,7 @@ app.comp.container :refer $ comp-container app.updater :refer $ updater app.schema :as schema - reel.util :refer $ listen-devtools! + reel.util :refer $ listen-devtools-toggle! app.config :as config |./calcit.build-errors :default build-errors |bottom-tip :default hud! @@ -360,10 +360,6 @@ :count Number :examples $ [] :schema $ quote StructDef - 'DispatchOp $ %{} 'CodeEntry (:doc |) - :code $ quote $ def DispatchOp (:: :unhandled) - :examples $ [] - :schema $ quote AnyEnum 'Op $ %{} 'CodeEntry (:doc |) :code $ quote $ defenum Op :states (List respo.schema/CoordKey) Dynamic @@ -375,7 +371,14 @@ :toggle-word :clear-text :swap-text - :unknown AnyEnum + :unknown String + :reel/toggle + :reel/recall Number + :reel/run + :reel/step + :reel/merge + :reel/reset + :reel/remove Number :examples $ [] :schema $ quote EnumDef 'StoreData $ %{} 'CodeEntry (:doc |) @@ -407,7 +410,7 @@ (:toggle-word) (Op :toggle-word) (:clear-text) (Op :clear-text) (:swap-text) (Op :swap-text) - _ $ Op :unknown raw + _ $ Op :unknown $ str raw :examples $ [] :schema $ quote $ Fn AnyEnum (-> app.schema/Op) 'normalize-store $ %{} 'CodeEntry (:doc |) @@ -447,6 +450,7 @@ assoc :new-text $ :old-text store (:unknown raw) do (eprintln "|Unknown op:" raw) store + _ store :examples $ [] :schema $ quote $ Fn app.schema/StoreData app.schema/Op String Number (-> app.schema/StoreData) :ns $ %{} 'NsEntry (:doc |) diff --git a/deps.cirru b/deps.cirru index 6c3c85b..4683dab 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,7 +1,7 @@ -{} (:calcit-version |0.35.1) - :version |0.1.4 - :dependencies $ {} (|Respo/reel.calcit |0.9.2) - |Respo/respo-ui.calcit |0.15.1 - |Respo/respo.calcit |0.19.4 +{} (:calcit-version |0.37.0) + :version |0.1.5 + :dependencies $ {} (|Respo/reel.calcit |0.10.0) + |Respo/respo-ui.calcit |0.15.2 + |Respo/respo.calcit |0.19.5 |calcit-lang/js-ffi |0.2.13 diff --git a/package.json b/package.json index fa410e3..65a27de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calcit-workflow", - "version": "0.1.4", + "version": "0.1.5", "description": "Online text diff viewer built with Calcit and Respo", "main": "index.js", "repository": { @@ -20,7 +20,7 @@ "vite": "8.3.3" }, "dependencies": { - "@calcit/procs": "0.35.1", + "@calcit/procs": "0.37.0", "diff": "^8.0.2" } } diff --git a/yarn.lock b/yarn.lock index d0396fe..036cc81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,15 +12,15 @@ __metadata: languageName: node linkType: hard -"@calcit/procs@npm:0.35.1": - version: 0.35.1 - resolution: "@calcit/procs@npm:0.35.1" +"@calcit/procs@npm:0.37.0": + version: 0.37.0 + resolution: "@calcit/procs@npm:0.37.0" dependencies: "@calcit/finger-vec": "npm:0.1.1" "@calcit/ternary-tree": "npm:0.0.26" "@cirru/parser.ts": "npm:0.0.10" "@cirru/writer.ts": "npm:^0.1.9" - checksum: 10c0/c39ab807cdda677cfd9fa9f6ae8adbb468347d5dd85ac38355a27a048cc9a1b7301d4f9c73f3bbf815269ecc7a59d824f61c8c46a9d56ae6a67f3b5cb21be3de + checksum: 10c0/38efd6a08b096419d41aa1d502a573ecbb415867caa18ee69142010e5d6c285f36f47d4e4334c33eff15617b1eff980f29662176422acb1bbf4fac5fdca83178 languageName: node linkType: hard @@ -201,7 +201,7 @@ __metadata: version: 0.0.0-use.local resolution: "calcit-workflow@workspace:." dependencies: - "@calcit/procs": "npm:0.35.1" + "@calcit/procs": "npm:0.37.0" bottom-tip: "npm:^0.1.5" diff: "npm:^8.0.2" vite: "npm:8.3.3" From cc252993f07d975c48e49ea4d5b1016d22d64c80 Mon Sep 17 00:00:00 2001 From: tiye Date: Sun, 8 Nov 2026 11:44:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20Diffview=20=E5=88=B0?= =?UTF-8?q?=20Calcit=200.38.0=20=E5=B9=B6=E7=A7=BB=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E8=A7=A3=E7=A0=81=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- calcit.cirru | 24 ------------------------ deps.cirru | 2 +- package.json | 2 +- scripts/upgrade.test.mjs | 8 ++++---- yarn.lock | 10 +++++----- 6 files changed, 14 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 063fa6e..4c3c672 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ http://r.tiye.me/Memkits/diffview/ ### 使用者影响 -CLI 与 `@calcit/procs` 配对升级到正式 **0.37.0**,需要重新安装完整模块图、 +CLI 与 `@calcit/procs` 配对升级到正式 **0.38.0**,需要重新安装完整模块图、 生成 JS 并完整刷新,不能跨工具链热重载旧 Reel。依赖使用正式 Reel **0.10.0**、 UI **0.15.2**、Respo **0.19.5**、JS-FFI **0.2.13**,传递 Router **0.12.2**。 不使用 main/hash 或 alpha,不关闭 Caps strict 解决冲突。 @@ -23,7 +23,7 @@ UI **0.15.2**、Respo **0.19.5**、JS-FFI **0.2.13**,传递 Router **0.12.2** DiffChunk、StoreData 和 `Map Tag String` site 配置沿用。存档入口接受原 Map/Struct, 通过原 decoder 构造本地 StoreData。应用事件构造具名 `Op` 后进入 Reel, -开发工具的控制操作仍由 Reel 解码。状态坐标使用 Respo 的 `CoordKey` union, +开发工具的控制操作仍由 Reel 解码。移除闲置的开放事件解码器,回归测试直接使用页面派发的具名事件。状态坐标使用 Respo 的 `CoordKey` union, 状态节点载荷继续接受异构数据。 根组件构建与 render! 同处 managed memo frame。开发 Reel 直接使用 typed State, @@ -31,7 +31,7 @@ DiffChunk、StoreData 和 `Map Tag String` site 配置沿用。存档入口接 ### 安装与原门禁 -使用 Calcit 0.37.0、Caps 0.1.1、Node.js 24、Yarn 4.18.0。 +使用 Calcit 0.38.0、Caps 0.1.1、Node.js 24、Yarn 4.18.0。 Caps 独立安装,见 [官方说明](https://github.com/calcit-lang/caps);Corepack/Yarn 不会安装它。 新解析 npm 包保留 60 分钟年龄门禁,无单包例外。lock 只更新 procs 配对;已有 undici Dependabot #48 单独保留。 diff --git a/calcit.cirru b/calcit.cirru index d17884f..10f0920 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -371,7 +371,6 @@ :toggle-word :clear-text :swap-text - :unknown String :reel/toggle :reel/recall Number :reel/run @@ -392,27 +391,6 @@ :new-text String :examples $ [] :schema $ quote StructDef - 'decode-op $ %{} 'CodeEntry (:doc |) - :code $ quote $ defn decode-op (raw) - match raw - (:states cursor data) - Op :states - decode-map-as cursor $ List respo.schema/CoordKey - , data - (:write-old text) - Op :write-old $ decode-map-as text String - (:write-new text) - Op :write-new $ decode-map-as text String - (:hydrate-storage data) - Op :hydrate-storage $ normalize-store data - (:toggle-sorted) (Op :toggle-sorted) - (:toggle-result) (Op :toggle-result) - (:toggle-word) (Op :toggle-word) - (:clear-text) (Op :clear-text) - (:swap-text) (Op :swap-text) - _ $ Op :unknown $ str raw - :examples $ [] - :schema $ quote $ Fn AnyEnum (-> app.schema/Op) 'normalize-store $ %{} 'CodeEntry (:doc |) :code $ quote $ defn normalize-store (raw) decode-map-as @@ -448,8 +426,6 @@ -> store assoc :old-text $ :new-text store assoc :new-text $ :old-text store - (:unknown raw) - do (eprintln "|Unknown op:" raw) store _ store :examples $ [] :schema $ quote $ Fn app.schema/StoreData app.schema/Op String Number (-> app.schema/StoreData) diff --git a/deps.cirru b/deps.cirru index 4683dab..0a183e9 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,5 +1,5 @@ -{} (:calcit-version |0.37.0) +{} (:calcit-version |0.38.0) :version |0.1.5 :dependencies $ {} (|Respo/reel.calcit |0.10.0) |Respo/respo-ui.calcit |0.15.2 diff --git a/package.json b/package.json index 65a27de..f017626 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "vite": "8.3.3" }, "dependencies": { - "@calcit/procs": "0.37.0", + "@calcit/procs": "0.38.0", "diff": "^8.0.2" } } diff --git a/scripts/upgrade.test.mjs b/scripts/upgrade.test.mjs index da5f989..d904554 100644 --- a/scripts/upgrade.test.mjs +++ b/scripts/upgrade.test.mjs @@ -3,7 +3,7 @@ import test from "node:test"; import { assoc, init_tags } from "../js-out/calcit.core.mjs"; import { comp_container } from "../js-out/app.comp.container.mjs"; -import { decode_op, store as defaultStore } from "../js-out/app.schema.mjs"; +import { Op, store as defaultStore } from "../js-out/app.schema.mjs"; import { new_reel } from "../js-out/reel.typed.mjs"; import * as clt from "../js-out/calcit.core.mjs"; import { updater } from "../js-out/app.updater.mjs"; @@ -15,8 +15,8 @@ import { as_element, child_pair_value, component_$q_, component_tree, element_ch const t = init_tags(["states", "old-text", "new-text", "show-result?", "sorted?", "by-word?", "input", "click", "value", "data", "editor"]); const unwrap = clt.option_$o_unwrap; const read = (value, key) => unwrap(clt.get(value, key)); -const op = (name, ...args) => clt._$o__$o_(init_tags([name])[name], ...args); -const apply = (store, name, ...args) => updater(store, decode_op(op(name, ...args)), "test", 0); +const op = (name, ...args) => clt._PCT__$o__$o_(Op, init_tags([name])[name], ...args); +const apply = (store, name, ...args) => updater(store, op(name, ...args), "test", 0); const render = (store) => comp_container(new_reel(store)); function handlers(node, kind) { @@ -59,7 +59,7 @@ test("textarea callbacks dispatch one Enum and preserve missing-value fallback", let store = defaultStore; const dispatch = (...args) => { assert.equal(args.length, 1); - store = updater(store, decode_op(args[0]), "test", 0); + store = updater(store, args[0], "test", 0); }; handler(event__GT_edn({type: "input", target: {value: `text-${index}`}}), dispatch); const field = index === 0 ? t["old-text"] : t["new-text"]; diff --git a/yarn.lock b/yarn.lock index 036cc81..097f9c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,15 +12,15 @@ __metadata: languageName: node linkType: hard -"@calcit/procs@npm:0.37.0": - version: 0.37.0 - resolution: "@calcit/procs@npm:0.37.0" +"@calcit/procs@npm:0.38.0": + version: 0.38.0 + resolution: "@calcit/procs@npm:0.38.0" dependencies: "@calcit/finger-vec": "npm:0.1.1" "@calcit/ternary-tree": "npm:0.0.26" "@cirru/parser.ts": "npm:0.0.10" "@cirru/writer.ts": "npm:^0.1.9" - checksum: 10c0/38efd6a08b096419d41aa1d502a573ecbb415867caa18ee69142010e5d6c285f36f47d4e4334c33eff15617b1eff980f29662176422acb1bbf4fac5fdca83178 + checksum: 10c0/8d1910cc739b1b23b5d5b549fb519053b2a578ab05f11814d28c09fbf4c18be5d3a14f52ff3b9bea4c9a3a42ab79d56a59021cd533d68ecc5e26e61da1e347ba languageName: node linkType: hard @@ -201,7 +201,7 @@ __metadata: version: 0.0.0-use.local resolution: "calcit-workflow@workspace:." dependencies: - "@calcit/procs": "npm:0.37.0" + "@calcit/procs": "npm:0.38.0" bottom-tip: "npm:^0.1.5" diff: "npm:^8.0.2" vite: "npm:8.3.3"