diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index 872e6ed..90ae3b4 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -20,7 +20,7 @@ jobs: with: node-version: 24 package-manager-cache: false - - uses: calcit-lang/setup-calcit@v1.5.0 + - uses: calcit-lang/setup-calcit@v1.5.1 with: tools: calcit,caps caps-version: "0.1.1" @@ -75,7 +75,7 @@ jobs: name: client-dist path: dist/ - name: Upload and verify frontend resources - uses: worktools/cos-upload-action@v1.2.0 + uses: worktools/cos-upload-action@8c4f3d09a4478b0d4c8698ffb94759b41831cba8 # v1.3.0 with: source-dir: dist bucket: ${{ secrets.COS_BUCKET }} diff --git a/README.md b/README.md index f303210..22ee9db 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ ClojureScript, beginners' home page ### 使用者影响 -升级到 Calcit 和 `@calcit/procs` **0.37.0** 后,请重新安装依赖、生成 JS 并刷新页面。导航、十份展示示例、代码高亮、旧 Map 存档和页面 HUD 继续适用。`content/*.cljs` 仍作为页面示例展示。 +升级到 Calcit 和 `@calcit/procs` **0.38.0** 后,请重新安装依赖、生成 JS 并刷新页面。导航、十份展示示例、代码高亮、旧 Map 存档和页面 HUD 继续适用。`content/*.cljs` 仍作为页面示例展示。 -Logo 切换使用 `RespoEvent` 和具名 `Action`,状态路径校验为 `CoordKey`。开发面板直接使用类型化 Reel,渲染进入 Respo 的 memo frame。依赖配对正式 Respo **0.19.5**、Reel **0.10.0**、Markdown **0.8.2**、UI **0.15.2**、JS-FFI **0.2.13**,传递 Router **0.12.2**。 应用派发使用 `Action | reel.typed/Control`,缺席的工具 Logo 保持为 `Option`。Highlight.js 注册回调使用具名宿主类型。 +Logo 切换使用 `RespoEvent` 和具名 `Action`,状态路径校验为 `CoordKey`。开发面板直接使用类型化 Reel,渲染进入 Respo 的 memo frame。依赖配对正式 Respo **0.19.5**、Reel **0.11.0**、Markdown **0.8.2**、UI **0.15.2**、JS-FFI **0.2.13**,传递 Router **0.12.2**。 页面只派发具名 `Action`,Reel 面板和快捷键单独接收 `reel.typed/Control`,两者在更新状态时用联合类型匹配,缺席的工具 Logo 保持为 `Option`。Highlight.js 注册回调使用具名宿主类型。 ### 0.31.0 迁移记录 @@ -39,8 +39,7 @@ For development, run `yarn watch` and `yarn serve` in separate terminals. Open the Vite URL with `?mode=dev` to enable the existing Reel tools. The application Store, actions, showcases and tool cards have explicit nominal -types. The legacy Respo component-state payload and incoming dispatcher remain -open boundaries, so this is not a claim of zero Dynamic type debt. +types. The Respo component-state payload remains heterogeneous. Stored data retains the original Map field format and is decoded into Store when restored. Startup still chooses a random showcase, as before. diff --git a/calcit.cirru b/calcit.cirru index c6c08ab..8ff2377 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -6,12 +6,12 @@ {} (:description |) (:init-fn 'app.main/main!) (:mode :js) (:reload-fn 'app.main/reload!) (:target :browser) :feature-policy $ {} :modules $ [] |respo.calcit/ |respo-ui.calcit/ |respo-markdown.calcit/ |reel.calcit/ |js-ffi/ - :type-slots $ {} $ :dispatch-op 'app.schema/DispatchOp + :type-slots $ {} $ :dispatch-op 'app.schema/Action :files $ {} 'app.comp.container $ %{} 'FileEntry :defs $ {} 'comp-container $ %{} 'CodeEntry (:doc |) - :code $ quote $ defcomp comp-container (reel) + :code $ quote $ defcomp comp-container (reel on-control) let store $ :store reel states $ :states store @@ -32,10 +32,12 @@ respo.comp.space/space-y 16 comp-footer if dev? - Option :some $ comp-typed-reel (>> states :reel) reel $ {} + Option :some $ comp-typed-reel (>> states :reel) reel ({}) on-control Option :none :examples $ [] - :schema $ quote $ Fn (reel.typed/State app.schema/Action app.schema/Store) (-> respo.schema/Component) + :schema $ quote $ Fn (reel.typed/State app.schema/Action app.schema/Store) + Fn reel.typed/Control $ -> Unit + -> respo.schema/Component 'comp-footer $ %{} 'CodeEntry (:doc |) :code $ quote $ defcomp comp-footer () div @@ -64,7 +66,7 @@ :style $ .merge ui/row-center $ {} (:cursor |pointer) :on-click $ fn (e d!) hint-fn $ Fn respo.schema/RespoEvent - Fn AnyEnum $ -> Unit + Fn app.schema/Action $ -> Unit -> Unit d! $ app.schema/Action :pick-case $ decode-map-as (rand-int 10) Number div $ {} $ :style @@ -241,16 +243,10 @@ :code $ quote $ defref *reel (typed-reel/new-reel schema/store) :examples $ [] :schema $ quote $ Ref (reel.typed/State app.schema/Action app.schema/Store) - 'dispatch! $ %{} 'CodeEntry - :doc "|Checks incoming application operations and Reel controls before updating typed state." - :code $ quote $ defn dispatch! (op) - match (typed-reel/decode-control op) - (:some control) (dispatch-resolved! control) - (:none) - dispatch-resolved! $ decode-action op - , &unit + 'dispatch! $ %{} 'CodeEntry (:doc "|Dispatches a typed application action.") + :code $ quote $ defn dispatch! (op) (dispatch-resolved! op) :examples $ [] - :schema $ quote $ Fn AnyEnum (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn app.schema/Action (-> Unit) (:features :js-ffi) 'dispatch-resolved! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn dispatch-resolved! (op) hint-fn $ Fn app.schema/ResolvedAction (-> Unit) (:features :js-ffi) @@ -274,17 +270,17 @@ match browser/storage-get $ :storage-key config/site (:some raw) - dispatch! $ :: :hydrate-storage $ parse-cirru-edn raw + dispatch! $ restore-action raw (:none) &unit render-app! add-watch! *reel :changes $ fn (r p) hint-fn $ Fn (reel.typed/State app.schema/Action app.schema/Store) (reel.typed/State app.schema/Action app.schema/Store) (-> Unit) render-app! - listen-devtools! |a dispatch! + listen-devtools! |a on-control! browser/add-event-listener! |beforeunload $ fn (event) hint-fn $ Fn js-ffi.browser/EventHost $ -> Unit save-store! - dispatch! $ :: :pick-case $ rand-int 10 + dispatch! $ schema/Action :pick-case $ decode-map-as (rand-int 10) Number println "|App started." :examples $ [] :schema $ quote $ Fn (-> Unit) (:features :js-ffi) @@ -297,6 +293,10 @@ :schema $ quote $ Fn -> $ JsNullish respo.dom/DomElement :features :js-ffi + 'on-control! $ %{} 'CodeEntry (:doc |) + :code $ quote $ defn on-control! (control) (dispatch-resolved! control) + :examples $ [] + :schema $ quote $ Fn reel.typed/Control (-> Unit) (:features :js-ffi) 'reload! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn reload! () if (js-nullish? build-errors) @@ -313,7 +313,7 @@ 'render-app! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn render-app! () render-with! (mount-target) - fn () $ comp-container @*reel + fn () $ comp-container @*reel on-control! , dispatch! :examples $ [] :schema $ quote $ Fn (-> Unit) (:features :js-ffi) @@ -333,7 +333,7 @@ :require respo.core :refer $ render-with! clear-cache! realize-ssr! app.comp.container :refer $ comp-container - app.updater :refer $ updater decode-action + app.updater :refer $ updater restore-action app.schema :as schema app.config :as config reel.util :refer $ listen-devtools! @@ -355,10 +355,6 @@ :hydrate-storage app.schema/Store :examples $ [] :schema $ quote EnumDef - 'DispatchOp $ %{} 'CodeEntry (:doc "|Respo 入口事件合同,容纳应用和 Reel 控制事件;代表值不发送。") - :code $ quote $ def DispatchOp (:: :unhandled) - :examples $ [] - :schema $ quote AnyEnum 'ResolvedAction $ %{} 'CodeEntry (:doc |) :code $ quote $ defunion ResolvedAction Action reel.typed/Control :examples $ [] @@ -389,25 +385,14 @@ :code $ quote $ ns app.schema 'app.updater $ %{} 'FileEntry :defs $ {} - 'decode-action $ %{} 'CodeEntry (:doc |) - :code $ quote $ defn decode-action (op) - match op - (:states cursor data) - Action :states - decode-map-as cursor $ List respo.schema/CoordKey - , data - (:content text) - if (string? text) (Action :content text) (raise "|Expected content String") - (:pick-case index) - if (number? index) (Action :pick-case index) (raise "|Expected showcase Number") - (:hydrate-storage data) - Action :hydrate-storage $ decode-map-as data 'app.schema/Store - _ $ raise "|Unknown application action" - :examples $ [] - :schema $ quote $ Fn AnyEnum (-> app.schema/Action) + 'restore-action $ %{} 'CodeEntry (:doc |) + :code $ quote $ defn restore-action (raw) + Action :hydrate-storage $ decode-map-as (parse-cirru-edn raw) 'app.schema/Store + :examples $ [] + :schema $ quote $ Fn String (-> app.schema/Action) :tests $ [] $ %{} 'TestEntry (:name |restores-legacy-store-map) :code $ quote $ let - action $ decode-action $ :: :hydrate-storage + action $ restore-action $ format-cirru-edn {} :states $ {} :content |saved diff --git a/deps.cirru b/deps.cirru index a4e1f40..fc76420 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,7 +1,7 @@ -{} (:calcit-version |0.37.0) (:version |0.1.1) +{} (:calcit-version |0.38.0) (:version |0.1.1) :dependencies $ {} |Respo/respo.calcit |0.19.5 - |Respo/reel.calcit |0.10.0 + |Respo/reel.calcit |0.11.0 |Respo/respo-markdown.calcit |0.8.2 |Respo/respo-ui.calcit |0.15.2 |calcit-lang/js-ffi |0.2.13 diff --git a/package.json b/package.json index ca12316..446f714 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "vite": "8.3.3" }, "dependencies": { - "@calcit/procs": "0.37.0", + "@calcit/procs": "0.38.0", "@calcit/std": "^0.0.2", "cirru-color": "^0.2.4", "copy-text-to-clipboard": "^3.2.2", diff --git a/yarn.lock b/yarn.lock index 6a96a34..69cd5c6 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 @@ -229,7 +229,7 @@ __metadata: version: 0.0.0-use.local resolution: "clojure-script-org@workspace:." dependencies: - "@calcit/procs": "npm:0.37.0" + "@calcit/procs": "npm:0.38.0" "@calcit/std": "npm:^0.0.2" bottom-tip: "npm:^0.1.5" cirru-color: "npm:^0.2.4"