Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ 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.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 解决冲突。

行/词差异、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,
两个开发工具条件子节点采用 Option,四处 spacer 保持宽 16。

### 安装与原门禁

使用 Calcit 0.35.1、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 单独保留。
Expand All @@ -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。
Expand Down
88 changes: 34 additions & 54 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -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 $ {}
Expand All @@ -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 |)
Expand Down Expand Up @@ -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
Expand All @@ -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 $ {}
Expand Down Expand Up @@ -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 |)
Expand Down Expand Up @@ -252,24 +252,24 @@
(: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!
println "|Running mode:" $ if config/dev? |dev |release
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!
Expand All @@ -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 $ []
Expand Down Expand Up @@ -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!
Expand All @@ -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
Expand All @@ -375,7 +371,13 @@
:toggle-word
:clear-text
:swap-text
:unknown AnyEnum
:reel/toggle
:reel/recall Number
:reel/run
:reel/step
:reel/merge
:reel/reset
:reel/remove Number
:examples $ []
:schema $ quote EnumDef
'StoreData $ %{} 'CodeEntry (:doc |)
Expand All @@ -389,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 raw
:examples $ []
:schema $ quote $ Fn AnyEnum (-> app.schema/Op)
'normalize-store $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn normalize-store (raw)
decode-map-as
Expand Down Expand Up @@ -445,8 +426,7 @@
-> 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)
:ns $ %{} 'NsEntry (:doc |)
Expand Down
10 changes: 5 additions & 5 deletions deps.cirru
Original file line number Diff line number Diff line change
@@ -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.38.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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -20,7 +20,7 @@
"vite": "8.3.3"
},
"dependencies": {
"@calcit/procs": "0.35.1",
"@calcit/procs": "0.38.0",
"diff": "^8.0.2"
}
}
8 changes: 4 additions & 4 deletions scripts/upgrade.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) {
Expand Down Expand Up @@ -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"];
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.