@kanf/wema-kake 0.0.0-stage → 0.1.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.
Files changed (84) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +123 -2
  3. package/bin/wema-kake.mjs +220 -0
  4. package/dist/lib/index.d.ts +13 -0
  5. package/dist/lib/index.js +14 -0
  6. package/dist/lib/shared/api.d.ts +97 -0
  7. package/dist/lib/shared/api.js +23 -0
  8. package/dist/lib/shared/delta.d.ts +24 -0
  9. package/dist/lib/shared/delta.js +19 -0
  10. package/dist/lib/shared/guide.d.ts +32 -0
  11. package/dist/lib/shared/guide.js +259 -0
  12. package/dist/lib/shared/hierarchy.d.ts +31 -0
  13. package/dist/lib/shared/hierarchy.js +40 -0
  14. package/dist/lib/shared/i18n.d.ts +23 -0
  15. package/dist/lib/shared/i18n.js +58 -0
  16. package/dist/lib/shared/note-html.d.ts +10 -0
  17. package/dist/lib/shared/note-html.js +28 -0
  18. package/dist/lib/shared/note-info.d.ts +20 -0
  19. package/dist/lib/shared/note-info.js +29 -0
  20. package/dist/lib/shared/note-text.d.ts +11 -0
  21. package/dist/lib/shared/note-text.js +118 -0
  22. package/dist/lib/shared/op-summary.d.ts +30 -0
  23. package/dist/lib/shared/op-summary.js +37 -0
  24. package/dist/lib/shared/protocol.d.ts +74 -0
  25. package/dist/lib/shared/protocol.js +12 -0
  26. package/dist/lib/shared/site.d.ts +16 -0
  27. package/dist/lib/shared/site.js +28 -0
  28. package/dist/lib/shared/slug.d.ts +4 -0
  29. package/dist/lib/shared/slug.js +6 -0
  30. package/dist/lib/shared/tools.d.ts +67 -0
  31. package/dist/lib/shared/tools.js +353 -0
  32. package/dist/lib/worker/access.d.ts +34 -0
  33. package/dist/lib/worker/access.js +114 -0
  34. package/dist/lib/worker/apply-ops.d.ts +75 -0
  35. package/dist/lib/worker/apply-ops.js +335 -0
  36. package/dist/lib/worker/assets.d.ts +4 -0
  37. package/dist/lib/worker/assets.js +35 -0
  38. package/dist/lib/worker/config.d.ts +52 -0
  39. package/dist/lib/worker/config.js +23 -0
  40. package/dist/lib/worker/first-page.d.ts +10 -0
  41. package/dist/lib/worker/first-page.js +30 -0
  42. package/dist/lib/worker/images.d.ts +3 -0
  43. package/dist/lib/worker/images.js +54 -0
  44. package/dist/lib/worker/index.d.ts +8 -0
  45. package/dist/lib/worker/index.js +72 -0
  46. package/dist/lib/worker/indexer.d.ts +42 -0
  47. package/dist/lib/worker/indexer.js +93 -0
  48. package/dist/lib/worker/mcp/board-access.d.ts +28 -0
  49. package/dist/lib/worker/mcp/board-access.js +67 -0
  50. package/dist/lib/worker/mcp/server.d.ts +9 -0
  51. package/dist/lib/worker/mcp/server.js +39 -0
  52. package/dist/lib/worker/page-do.d.ts +330 -0
  53. package/dist/lib/worker/page-do.js +1168 -0
  54. package/dist/lib/worker/page-queries.d.ts +28 -0
  55. package/dist/lib/worker/page-queries.js +88 -0
  56. package/dist/lib/worker/pages-api.d.ts +5 -0
  57. package/dist/lib/worker/pages-api.js +257 -0
  58. package/dist/lib/worker/plain-text.d.ts +22 -0
  59. package/dist/lib/worker/plain-text.js +113 -0
  60. package/dist/lib/worker/revert.d.ts +21 -0
  61. package/dist/lib/worker/revert.js +126 -0
  62. package/dist/lib/worker/sanitize.d.ts +4 -0
  63. package/dist/lib/worker/sanitize.js +135 -0
  64. package/dist/lib/worker/validate.d.ts +21 -0
  65. package/dist/lib/worker/validate.js +218 -0
  66. package/dist/web/assets/index-CVwMafiH.js +5 -0
  67. package/dist/web/assets/index-Cgi5orcJ.css +1 -0
  68. package/dist/web/favicon.svg +13 -0
  69. package/dist/web/index.html +14 -0
  70. package/migrations/0001_init.sql +18 -0
  71. package/migrations/0002_fts.sql +9 -0
  72. package/migrations/0003_hierarchy.sql +9 -0
  73. package/migrations/0004_settings.sql +12 -0
  74. package/migrations/0005_bookmarks.sql +8 -0
  75. package/migrations/0006_page_color.sql +5 -0
  76. package/package.json +75 -4
  77. package/template/.dev.vars.example +4 -0
  78. package/template/README.md +55 -0
  79. package/template/gitignore +8 -0
  80. package/template/package.json +25 -0
  81. package/template/src/config.ts +18 -0
  82. package/template/src/index.ts +9 -0
  83. package/template/tsconfig.json +16 -0
  84. package/template/wrangler.jsonc +57 -0
@@ -0,0 +1 @@
1
+ .wema-board{--wema-note-border-radius:4px;--wema-note-shadow:0 2px 8px #00000026;--wema-note-font-size:14px;--wema-anchor-size:12px;--wema-anchor-color:#4a90d9;--wema-note-color-text:#333;--wema-edge-color:#555;--wema-edge-width:2px;--wema-note-link-background:#fff;--wema-note-link-color:#333;--wema-note-link-border-color:#00000026;--wema-note-link-label-color:#666;--wema-note-link-accent-color:#4a90d9;-webkit-user-select:none;user-select:none;width:100%;height:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;position:relative;overflow:hidden}.wema-board:focus{outline:none}.wema-board.wema-page-scroll .wema-note,.wema-board.wema-page-scroll .wema-move-handle,.wema-board.wema-page-scroll .wema-resize-handle{touch-action:manipulation}.wema-board.wema-pan-ready{cursor:grab}.wema-board.wema-panning,.wema-board.wema-panning *{cursor:grabbing!important}.wema-edges{pointer-events:none}.wema-note{border-radius:var(--wema-note-border-radius);box-shadow:var(--wema-note-shadow);background-color:var(--wema-note-color,#fff9c4);cursor:default;box-sizing:border-box;touch-action:none;flex-direction:column;display:flex;position:absolute}.wema-note-selected{outline:2px solid var(--wema-anchor-color);outline-offset:1px;box-shadow:0 0 0 3px #4a90d94d, var(--wema-note-shadow)}.wema-move-handle{cursor:grab;opacity:0;color:#0000004d;touch-action:none;flex-shrink:0;justify-content:center;align-items:center;height:18px;transition:opacity .15s;display:flex}.wema-move-handle:active{cursor:grabbing}.wema-note:hover .wema-move-handle{opacity:1}.wema-note-content{font-size:var(--wema-note-font-size);color:var(--wema-note-color-text);word-wrap:break-word;white-space:pre-wrap;cursor:text;-webkit-user-select:text;user-select:text;outline:none;flex:1;padding:4px 12px 12px;line-height:1.4;overflow-y:auto}.wema-note-custom{flex:1;min-height:0;display:none;overflow:auto}.wema-note-host-drawn>.wema-note-content{display:none}.wema-note-host-drawn>.wema-note-custom{display:block}.wema-note-under{box-sizing:border-box;pointer-events:none;width:100%;display:flow-root;position:absolute;top:100%;left:0}.wema-note-accessory{display:none}.wema-note-has-accessory>.wema-note-under>.wema-note-accessory{flex-wrap:wrap;align-items:center;gap:4px;display:flex}.wema-note-accessory>*{pointer-events:auto}.wema-note-footer{pointer-events:auto;display:none}.wema-board.wema-stacked .wema-note-has-footer>.wema-note-under>.wema-note-footer{display:block}.wema-board.wema-stacked .wema-note-has-footer>.wema-note-collapse-badge[data-side=bottom],.wema-board.wema-stacked .wema-note-has-accessory>.wema-note-collapse-badge[data-side=bottom]{left:auto;right:0;transform:none}.wema-board.wema-stacked .wema-note-collapse-badge[data-side=bottom]~.wema-note-under{padding-right:28px}.wema-note-links{flex-wrap:wrap;gap:4px;padding-top:6px;display:flex}.wema-note-link{box-sizing:border-box;border:1px solid var(--wema-note-link-border-color);background:var(--wema-note-link-background);max-width:100%;min-height:28px;color:var(--wema-note-link-color);font:inherit;cursor:pointer;border-radius:14px;align-items:baseline;gap:4px;margin:0;padding:4px 10px;font-size:12px;line-height:1.4;display:flex}.wema-note-link:disabled{opacity:.5;cursor:default}.wema-note-link-arrow{color:var(--wema-note-link-accent-color);flex:none}.wema-note-link-label{text-overflow:ellipsis;white-space:nowrap;max-width:8em;color:var(--wema-note-link-label-color);flex:none;overflow:hidden}.wema-note-link-text{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.wema-note.wema-note-link-target{animation:1.4s ease-out wema-note-link-target}@keyframes wema-note-link-target{0%,60%{outline:3px solid var(--wema-note-link-accent-color);outline-offset:2px}to{outline-offset:2px;outline:3px solid #0000}}.wema-note-content ul,.wema-note-content ol{white-space:normal;margin:4px 0;padding-left:20px}.wema-note-content li{white-space:normal;margin:2px 0}.wema-note-content blockquote{opacity:.85;border-left:3px solid #00000040;margin:2px 0 6px;padding:1px 0 1px 10px}.wema-note-content li>ul,.wema-note-content li>ol{margin:0}.wema-note-content input[type=checkbox]{cursor:pointer;vertical-align:middle;margin-right:6px}.wema-note-content .wema-checklist{padding-left:4px;list-style:none}.wema-note-content li>.wema-checklist{padding-left:20px}.wema-note-content .wema-checklist li.wema-checked{color:#aaa;text-decoration:line-through}.wema-note-content .wema-checklist li.wema-checked>:not(ul,ol),.wema-note-content .wema-checklist li.wema-checked>:not(ul,ol) *{color:#aaa!important}.wema-note-content .wema-checklist li.wema-checked>ul,.wema-note-content .wema-checklist li.wema-checked>ol{box-sizing:border-box;vertical-align:top;width:100%;color:var(--wema-note-color-text);display:inline-block}.wema-note-content a{color:var(--wema-anchor-color);cursor:pointer;text-decoration:underline}.wema-note-content a:hover{opacity:.8}.wema-note-content img{cursor:pointer;border-radius:2px;max-width:100%;height:auto;margin:4px 0;display:block}.wema-note-content img.wema-image-selected{outline:2px solid var(--wema-anchor-color);outline-offset:1px}.wema-image-overlay,.wema-edge-popup,.wema-note-popup,.wema-richtext-toolbar,.wema-embed-input{box-sizing:border-box;width:max-content;max-width:calc(100% - 8px)}.wema-image-overlay{z-index:10001;pointer-events:auto;background:#fff;border:1px solid #ddd;border-radius:4px;gap:2px;padding:3px;display:flex;position:absolute;box-shadow:0 2px 8px #00000026}.wema-image-overlay-btn{cursor:pointer;color:#333;text-align:center;background:#fff;border:1px solid #ddd;border-radius:3px;min-width:24px;padding:3px 7px;font-size:11px;line-height:1.2}.wema-image-overlay-btn:hover{background:#f0f0f0}.wema-image-overlay-btn.active{background:var(--wema-anchor-color);color:#fff;border-color:var(--wema-anchor-color)}.wema-image-overlay-delete{color:#d32f2f;border-color:#ffcdd2}.wema-image-overlay-delete:hover{background:#ffebee}.wema-note-content iframe,.wema-note-content video,.wema-note-content audio{border:1px solid #ddd;border-radius:2px;max-width:100%;margin:4px 0}.wema-note-content div,.wema-note-content p{white-space:normal}.wema-note-anchors{pointer-events:none;position:absolute;inset:0}.wema-anchor{width:var(--wema-anchor-size);height:var(--wema-anchor-size);background:var(--wema-anchor-color);opacity:0;pointer-events:auto;cursor:crosshair;border:2px solid #fff;border-radius:50%;transition:opacity .15s;position:absolute;transform:translate(-50%,-50%)}.wema-note:hover .wema-anchor{opacity:1}.wema-anchor-top{top:0;left:50%}.wema-anchor-right{top:50%;left:100%}.wema-anchor-bottom{top:100%;left:50%}.wema-anchor-left{top:50%;left:0}.wema-edge-hit{cursor:pointer}.wema-note-collapse-btn{cursor:pointer;color:#00000080;opacity:0;z-index:1;box-sizing:border-box;background:#fff;border:1.5px solid #0003;border-radius:50%;justify-content:center;align-items:center;width:22px;height:22px;transition:opacity .15s;display:flex;position:absolute}.wema-note-collapse-btn[data-side=right]{top:50%;right:-24px;transform:translateY(-50%)}.wema-note-collapse-btn[data-side=left]{top:50%;left:-24px;transform:translateY(-50%)}.wema-note-collapse-btn[data-side=top]{top:-24px;left:50%;transform:translate(-50%)}.wema-note-collapse-btn[data-side=bottom]{bottom:-24px;left:50%;transform:translate(-50%)}.wema-note:hover .wema-note-collapse-btn{opacity:1}.wema-note-collapse-badge{background:var(--wema-anchor-color,#4a90d9);border-color:var(--wema-anchor-color,#4a90d9);color:#fff;font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-size:10px;font-weight:600;opacity:1!important}.wema-edge-path{stroke:var(--wema-edge-color);fill:none;transition:stroke .15s,filter .15s}.wema-edge-hit:hover+.wema-edge-path{filter:drop-shadow(0 0 4px #4a90d980);stroke:color-mix(in srgb, var(--wema-edge-color) 70%, var(--wema-anchor-color))}.wema-edge-path.wema-edge-selected{stroke:var(--wema-anchor-color)}.wema-arrow-fill{fill:var(--wema-edge-color)}.wema-edge-label{fill:var(--wema-edge-color);pointer-events:none;font-size:12px}.wema-edge-temp{stroke:var(--wema-anchor-color);stroke-width:2px;stroke-dasharray:6 3;fill:none;pointer-events:none}.wema-note-drop-target{outline:2px dashed var(--wema-anchor-color);outline-offset:3px}.wema-edge-popup{z-index:10000;pointer-events:auto;background:#fff;border:1px solid #ddd;border-radius:6px;flex-direction:column;gap:6px;padding:8px;display:flex;position:absolute;box-shadow:0 4px 12px #00000026}.wema-popup-section{align-items:center;gap:8px;display:flex}.wema-popup-label{color:#888;text-transform:uppercase;letter-spacing:.5px;flex-shrink:0;width:36px;font-size:10px}.wema-popup-group{gap:2px;display:flex}.wema-popup-btn{cursor:pointer;color:#333;background:#fff;border:1px solid #ddd;border-radius:3px;justify-content:center;align-items:center;padding:4px 6px;font-size:11px;line-height:0;display:flex}.wema-popup-btn:hover{background:#f0f0f0}.wema-popup-btn.active{background:var(--wema-anchor-color);color:#fff;border-color:var(--wema-anchor-color)}.wema-popup-details{border-top:1px solid #eee;padding-top:4px}.wema-popup-details-toggle{cursor:pointer;color:#888;text-transform:uppercase;letter-spacing:.5px;background:0 0;border:none;border-radius:3px;align-items:center;gap:4px;width:100%;padding:2px 4px;font-size:10px;display:flex}.wema-popup-details-toggle:hover{color:#555;background:#f5f5f5}.wema-popup-details-toggle svg{transition:transform .15s}.wema-popup-details-toggle.open svg{transform:rotate(90deg)}.wema-popup-details-content{flex-direction:column;gap:6px;padding-top:4px;display:flex}.wema-popup-delete-section{border-top:1px solid #eee;padding-top:6px}.wema-popup-btn-delete{color:#d32f2f;width:100%}.wema-popup-btn-delete:hover{background:#ffebee}.wema-note-popup{z-index:10000;pointer-events:auto;background:#fff;border:1px solid #ddd;border-radius:6px;flex-direction:column;gap:6px;padding:6px;display:flex;position:absolute;box-shadow:0 4px 12px #00000026}.wema-note-popup-actions{gap:4px;display:flex}.wema-note-popup-color-btn{border:2px solid #ccc;border-radius:4px;flex-shrink:0;width:26px;height:26px;padding:0}.wema-note-popup-color-btn:hover{border-color:#999}.wema-note-popup-colors{border-top:1px solid #eee;grid-template-columns:repeat(4,1fr);gap:3px;padding-top:6px;display:grid}.wema-color-swatch{cursor:pointer;border:2px solid #ccc;border-radius:3px;width:22px;height:22px;padding:0}.wema-color-swatch:hover{border-color:#666}.wema-color-swatch.active{border-color:#333;box-shadow:0 0 0 1px #333}.wema-note.wema-auto-size{height:auto!important}.wema-note.wema-auto-size:not(.wema-note-placed){min-width:80px;max-width:600px;width:max-content!important}.wema-note.wema-auto-size .wema-note-content{overflow:visible}.wema-note.wema-auto-size .wema-resize-handle{display:none}.wema-note.wema-foldable:not(.wema-note-host-drawn){height:auto!important}.wema-note-fold-toggle{text-align:center;white-space:nowrap;color:var(--wema-anchor-color);cursor:pointer;background:0 0;border:0;align-self:stretch;margin:0;padding:0 12px 6px;font-family:inherit;font-size:12px;line-height:1.4;text-decoration:underline;display:none}.wema-note-fold-toggle:hover{opacity:.8}.wema-note.wema-fold-long>.wema-note-fold-toggle{display:block}.wema-note.wema-fold-long>.wema-note-content{padding-bottom:4px}.wema-note.wema-folded>.wema-note-content{--wema-fold-line:calc(var(--wema-note-font-size) * 1.4);--wema-fold-top:4px;--wema-fold-mask:linear-gradient(to bottom, #000 calc(var(--wema-fold-top) + var(--wema-fold-line) * 2), #0003 calc(var(--wema-fold-top) + var(--wema-fold-line) * 2.15), #0000001a calc(var(--wema-fold-top) + var(--wema-fold-line) * 3));max-height:calc(var(--wema-fold-top) + var(--wema-fold-line) * 3 + 2px);-webkit-mask-image:var(--wema-fold-mask);-webkit-mask-image:var(--wema-fold-mask);-webkit-mask-image:var(--wema-fold-mask);mask-image:var(--wema-fold-mask);flex:none;padding-bottom:2px;overflow:hidden}.wema-note.wema-folded>.wema-note-fold-toggle{padding-bottom:4px;position:absolute;bottom:0;left:0;right:0}.wema-resize-handle{cursor:nwse-resize;border-radius:0 0 var(--wema-note-border-radius) 0;touch-action:none;background:linear-gradient(135deg,#0000 50%,#00000026 50%,#0000 55%),linear-gradient(135deg,#0000 65%,#00000026 65%,#0000 70%),linear-gradient(135deg,#0000 80%,#00000026 80%);width:16px;height:16px;position:absolute;bottom:0;right:0}.wema-theme-card .wema-note{background-color:#fff;border:1px solid #e0e0e0;box-shadow:0 1px 4px #00000014}.wema-theme-card .wema-note:before{content:"";background:var(--wema-note-color);border-radius:var(--wema-note-border-radius) 0 0 var(--wema-note-border-radius);width:6px;position:absolute;top:0;bottom:0;left:0}.wema-readonly .wema-note,.wema-readonly .wema-note:active,.wema-readonly .wema-note-content{cursor:default}.wema-readonly .wema-anchor,.wema-readonly .wema-resize-handle,.wema-board.wema-stacked .wema-resize-handle{display:none}.wema-board.wema-stacked .wema-move-handle{visibility:hidden}.wema-board.wema-stacked .wema-edges,.wema-board.wema-stacked .wema-anchor,.wema-board.wema-stacked .wema-note-collapse-btn:not(.wema-note-collapse-badge){display:none}.wema-richtext-toolbar{z-index:10001;pointer-events:auto;background:#fff;border:1px solid #ddd;border-radius:4px;flex-wrap:wrap;gap:2px;padding:3px;display:flex;position:absolute;box-shadow:0 2px 8px #00000026}.wema-richtext-btn{cursor:pointer;color:#333;text-align:center;background:#fff;border:1px solid #ddd;border-radius:3px;min-width:24px;padding:3px 7px;font-size:12px;line-height:1.2}.wema-richtext-btn:hover{background:#f0f0f0}.wema-richtext-btn.active{background:var(--wema-anchor-color);color:#fff;border-color:var(--wema-anchor-color)}.wema-richtext-colors{gap:2px;width:100%;padding:2px 0;display:flex}.wema-richtext-colors .wema-color-swatch{width:18px;height:18px}.wema-richtext-link-input{gap:2px;width:100%;padding:2px 0;display:flex}.wema-richtext-link-input input{border:1px solid #ddd;border-radius:3px;outline:none;flex:1;min-width:120px;padding:2px 4px;font-size:11px}.wema-richtext-link-input input:focus{border-color:var(--wema-anchor-color)}.wema-embed-input{background:#fff;border:1px solid #ddd;border-radius:4px;gap:4px;padding:6px;display:flex;box-shadow:0 2px 8px #00000026}.wema-rubberband{border:1px dashed var(--wema-anchor-color);pointer-events:none;z-index:9999;background:#4a90d914;position:absolute}.wema-viewonly .wema-note-content{cursor:default}.wema-viewonly .wema-anchor,.wema-viewonly .wema-resize-handle{display:none}.wema-readonly .wema-edge-hit,.wema-viewonly .wema-edge-hit{cursor:default;pointer-events:none!important}html,body{height:100%;margin:0}body{color:#222;font-family:system-ui,sans-serif;font-size:14px}#app{flex-direction:column;height:100%;display:flex}.page-header{box-sizing:border-box;background:#fafafa;border-bottom:1px solid #ddd;flex:none;align-items:center;gap:12px;height:40px;padding:0 12px;display:flex}.zone{align-items:center;gap:8px;min-width:0;display:flex}.zone-left,.zone-right{flex:1 1 0}.zone-right{justify-content:flex-end}.zone-tools{flex:none;gap:4px}.zone-left>a{color:#555;flex:none;font-size:12px}.page-header h1{text-overflow:ellipsis;white-space:nowrap;min-width:0;margin:0;font-size:15px;overflow:hidden}.page-title{cursor:text}.color-button,.color-swatch{cursor:pointer;background:#fff;border:1px solid #00000040;border-radius:50%;flex:none;padding:0}.color-button{border-color:#0006;width:14px;height:14px;box-shadow:0 0 0 2px #fff}.color-panel{grid-template-columns:repeat(3,22px);gap:6px;padding:4px;display:grid}.color-swatch{width:22px;height:22px}.color-swatch.active{outline-offset:1px;outline:2px solid #2563eb}.color-swatch:last-child{background:linear-gradient(to top right,#fff 45%,#d33 45% 55%,#fff 55%)}.title-input{width:20em;min-width:0;font-size:15px;font-weight:700}.tool-group{align-items:center;gap:2px;display:inline-flex}.separator{background:#ddd;flex:none;width:1px;height:18px;margin:0 4px}.icon-button,.zoom-level,.text-button{color:#444;font:inherit;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:4px;flex:none;font-size:12px}.icon-button{justify-content:center;align-items:center;width:28px;height:28px;padding:0;display:inline-flex}.icon{display:inline-flex}.zoom-level{font-variant-numeric:tabular-nums;min-width:44px;height:28px;padding:0 4px}.text-button{white-space:nowrap;height:28px;padding:0 8px}.text-button.primary{background:#fff;border-color:#ccc}.icon-button:hover:not(:disabled),.zoom-level:hover,.text-button:hover,.icon-button[aria-expanded=true],.text-button[aria-expanded=true]{background:#eaeaea}.icon-button:disabled{color:#bbb;cursor:default}.sync-status{color:#b45309;white-space:nowrap;flex:none;font-size:12px}.sync-status:before{content:"";background:#aaa;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.sync-status[title=""]:before{display:none}.sync-status[data-state=offline]:before{background:#d97706}.popover{display:inline-flex;position:relative}.popover-panel{z-index:1000;background:#fff;border:1px solid #ccc;border-radius:6px;padding:4px;position:absolute;top:calc(100% + 6px);box-shadow:0 4px 16px #0000001f}.popover-panel[hidden]{display:none}.popover-left{left:0}.popover-right{right:0}.layout-panel{grid-template-columns:repeat(3,28px);gap:2px;display:grid}.menu{flex-direction:column;min-width:180px;display:flex}.menu-item{text-align:left;font:inherit;cursor:pointer;color:#222;white-space:nowrap;background:0 0;border:none;border-radius:4px;padding:6px 10px;font-size:13px}.menu-item:hover{background:#eee}.menu-item.danger{color:#b91c1c}.menu hr{border:none;border-top:1px solid #e5e5e5;width:100%;margin:4px 0}.link-list{flex-direction:column;min-width:180px;max-width:320px;max-height:60vh;display:flex;overflow-y:auto}.link-list a{color:#222;white-space:nowrap;border-radius:4px;flex:none;align-items:baseline;gap:12px;padding:6px 10px;font-size:13px;text-decoration:none;display:flex}.link-list a:hover{background:#eee}.link-title{text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.link-detail{color:#999;flex:none;font-size:11px}.link-list .empty{padding:6px 10px;font-size:12px}.link-list hr{border:none;border-top:1px solid #e5e5e5;flex:none;width:100%;margin:4px 0}.link-star{color:#d97706;flex:none;align-self:center;margin-right:-6px;display:inline-flex}.link-star svg{width:12px;height:12px}.page-nav{flex-direction:column;gap:4px;width:280px;max-width:calc(100vw - 16px);display:flex}.page-nav .link-list{min-width:0;max-width:none}.nav-filter{box-sizing:border-box;height:28px;font:inherit;font-size:13px}.zone-left>.icon-button{margin-left:-4px}.page-body{flex:1;min-height:0;display:flex;position:relative}.board{isolation:isolate;flex:1;min-width:0}.board.stacked,.index-board.stacked{scrollbar-width:thin;scrollbar-gutter:stable;overflow:hidden auto}.crumbs{color:#999;flex:0 auto;align-items:center;gap:6px;min-width:0;font-size:12px;display:flex;overflow:hidden}.crumbs:empty{display:none}.crumbs a{color:#555;white-space:nowrap;text-overflow:ellipsis;max-width:12em;overflow:hidden}.wema-note-content,.wema-note-custom{scrollbar-width:thin;scrollbar-color:#0000004d transparent}.wema-note .child-note{box-sizing:border-box;flex-direction:column;gap:4px;padding:6px 12px 12px;display:flex;overflow:hidden}.wema-note-accessory{justify-content:flex-end;padding-right:2px}.wema-note-accessory>*{margin:8px 0 4px}.note-agent,.note-author{box-sizing:border-box;visibility:hidden;background:#fff;border:1px solid #00000026;border-radius:9px;height:18px}.note-author{color:#555;white-space:nowrap;text-overflow:ellipsis;max-width:100%;padding:0 7px;font-size:11px;line-height:16px;overflow:hidden}.note-agent{color:#555;flex:none;justify-content:center;align-items:center;width:18px}.note-agent svg{width:12px;height:12px}.note-agent-claude{color:#d97757}.note-agent-openai{color:#000}.wema-note:hover :is(.note-agent,.note-author),.wema-note-selected :is(.note-agent,.note-author){visibility:visible}.wema-note-has-accessory:is(:hover,.wema-note-selected){z-index:9998!important}.wema-board.wema-stacked :is(.note-agent,.note-author){display:none}.wema-board.wema-stacked .wema-note-selected .note-author{display:block}.wema-board.wema-stacked .wema-note-selected .note-agent{display:inline-flex}.wema-note.drop-target{outline-offset:2px;outline:3px solid #2563eb}.wema-note.note-leaving{opacity:0;pointer-events:none;transition:opacity .12s}.child-title{color:#1d4ed8;overflow-wrap:anywhere;flex:none;font-weight:700}.child-meta{color:#666;flex:none;font-size:11px}.child-layout{background:#fff9;border:1px solid #0000001f;border-radius:4px;flex:1;width:100%;min-height:0}.child-layout rect{stroke:#00000040;stroke-width:1px;vector-effect:non-scaling-stroke}.child-form{flex-direction:column;display:flex}.child-form .new-page+.new-page{border-top:1px solid #e5e5e5}.child-form .form-error{padding:0 8px 8px;font-size:12px}.toast{z-index:900;color:#fff;background:#333;border-radius:6px;max-width:min(90%,560px);padding:8px 14px;font-size:13px;position:absolute;top:12px;left:50%;transform:translate(-50%);box-shadow:0 4px 16px #0003}.modal{box-sizing:border-box;border:1px solid #ccc;border-radius:8px;padding:16px 20px}.modal::backdrop{background:#0000004d}.modal h2{margin:0 0 12px;font-size:16px}.modal-foot{text-align:right;margin-top:12px}.history-dialog{width:min(92vw,480px);font-size:12px}.history-dialog[open]{flex-direction:column;max-height:min(80vh,640px);display:flex}.history-dialog .op-list{min-height:0;overflow-y:auto}.history-head{justify-content:space-between;align-items:center;margin-bottom:8px;display:flex}.op-result{overflow-wrap:anywhere;background:#f3f3f3;border-radius:4px;margin-bottom:8px;padding:6px 8px}.op-result:empty{display:none}.op-list{margin:0;padding:0;list-style:none}.op-list li{border-bottom:1px solid #eee;padding:6px 0}.op-list li.reverted .op-summary,.empty{color:#999}.op-meta{color:#666}.op-summary{overflow-wrap:anywhere;margin:2px 0 4px}.help-note{color:#999;white-space:nowrap;font-size:12px}.index-search{box-sizing:border-box;width:16em;min-width:6em;height:26px;font:inherit;font-size:13px}.index-count{color:#666;white-space:nowrap;font-size:12px}.index-canvas{isolation:isolate;flex:1;min-height:0;display:flex;position:relative;overflow:hidden}.index-board{flex:1;min-width:0}.note-actions,.note-rename{z-index:20000;background:#fff;border:1px solid #ccc;border-radius:6px;align-items:center;gap:2px;padding:2px;display:flex;position:absolute;box-shadow:0 2px 8px #00000026}.note-actions[hidden],.note-rename[hidden]{display:none}.note-actions .icon-button{width:24px;height:24px}.note-rename{box-sizing:border-box;gap:4px;padding:4px}.note-rename input{min-width:0;font:inherit;flex:1;font-size:13px}.note-rename button{font:inherit;flex:none;font-size:12px}.index-canvas .empty{padding:12px}.index-canvas .wema-board{--wema-edge-color:#8b95a1}.index-canvas .wema-edges{z-index:0!important}.index-canvas.index-focus .wema-board{--wema-edge-color:#2563eb}.index-canvas.index-focus .wema-edge-group{opacity:.15}.index-canvas.index-focus .wema-edge-group.index-linked{opacity:1}.index-canvas .index-linked .wema-edge-path{stroke-width:2px!important}.new-page{flex-direction:column;gap:8px;width:260px;padding:8px;font-size:12px;display:flex}.new-page label{color:#555;flex-direction:column;gap:2px;display:flex}.new-page input{font:inherit;min-width:0;font-size:13px}.slug-field{color:#888;align-items:center;gap:2px;display:flex}.slug-field input{flex:1}.form-error{color:#b91c1c}.form-error:empty{display:none}@media (width<=760px){:is(.optional,.separator:has(+.optional)){display:none}.index-search{width:9em}}@media (width<=640px){.page-header{flex-wrap:wrap;row-gap:0;height:auto}.zone{height:40px}.zone-left{flex:1 0 100%}.zone-tools{flex:auto}.zone-right{flex:none}.zone-tools:has(.index-search){flex:1 1 0}.index-search{flex:1 1 0;width:auto;min-width:4em}}
@@ -0,0 +1,13 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
+ <!-- 掛ける横木と、付箋を吊るす紐 -->
3
+ <line x1="2.5" y1="5" x2="29.5" y2="5" stroke="#555" stroke-width="2" stroke-linecap="round"/>
4
+ <line x1="8.5" y1="5" x2="8.5" y2="10" stroke="#555" stroke-width="1.5"/>
5
+ <line x1="23.5" y1="5" x2="23.5" y2="16" stroke="#555" stroke-width="1.5"/>
6
+ <!-- 付箋(色と形は wema のロゴと同じ) -->
7
+ <rect x="2" y="10" width="13" height="11" rx="2" fill="#FDD835" stroke="#F9A825"/>
8
+ <line x1="5" y1="14" x2="12" y2="14" stroke="#F9A825" opacity=".6" stroke-linecap="round"/>
9
+ <line x1="5" y1="17" x2="10" y2="17" stroke="#F9A825" opacity=".6" stroke-linecap="round"/>
10
+ <rect x="17" y="16" width="13" height="11" rx="2" fill="#64B5F6" stroke="#1E88E5"/>
11
+ <line x1="20" y1="20" x2="27" y2="20" stroke="#1E88E5" opacity=".6" stroke-linecap="round"/>
12
+ <line x1="20" y1="23" x2="25" y2="23" stroke="#1E88E5" opacity=".6" stroke-linecap="round"/>
13
+ </svg>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="ja">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
+ <title>wema-kake</title>
8
+ <script type="module" crossorigin src="/assets/index-CVwMafiH.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-Cgi5orcJ.css">
10
+ </head>
11
+ <body>
12
+ <div id="app"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,18 @@
1
+ CREATE TABLE pages (
2
+ id INTEGER PRIMARY KEY, -- pages_fts の rowid と対応させる
3
+ name TEXT NOT NULL UNIQUE, -- スラッグ
4
+ title TEXT, -- 表示名。未設定ならスラッグを表示する
5
+ plain_text TEXT, -- 全付箋のテキストをタグ除去して連結したもの
6
+ note_count INTEGER NOT NULL DEFAULT 0,
7
+ updated_at INTEGER NOT NULL
8
+ );
9
+
10
+ CREATE INDEX pages_updated_at ON pages (updated_at);
11
+
12
+ CREATE TABLE links (
13
+ from_page TEXT NOT NULL,
14
+ to_page TEXT NOT NULL,
15
+ PRIMARY KEY (from_page, to_page)
16
+ );
17
+
18
+ CREATE INDEX links_to_page ON links (to_page);
@@ -0,0 +1,9 @@
1
+ -- 仮想テーブルがあると D1 を export できない。export するときはこのテーブルを削除し、
2
+ -- 後から pages の内容で作り直す。そのため pages とは別のマイグレーションにしている。
3
+ --
4
+ -- rowid は pages.id と同じ値にする(name は索引されないので、行の特定には rowid を使う)。
5
+ CREATE VIRTUAL TABLE pages_fts USING fts5(
6
+ title,
7
+ plain_text,
8
+ tokenize = 'trigram'
9
+ );
@@ -0,0 +1,9 @@
1
+ -- ページの階層(docs/plan.md のフェーズ 6.6)。
2
+ --
3
+ -- parent: 親ページのスラッグ。ルートのページなら NULL。正のデータは、子ページの DO の meta にある
4
+ -- layout: 付箋の配置([[x, y, 幅, 高さ, 色], ...] の JSON)。親ページの画面が、子ページの付箋の上に、
5
+ -- 子ページの配置を簡易に再現するのに使う
6
+ ALTER TABLE pages ADD COLUMN parent TEXT;
7
+ ALTER TABLE pages ADD COLUMN layout TEXT;
8
+
9
+ CREATE INDEX pages_parent ON pages (parent);
@@ -0,0 +1,12 @@
1
+ -- サイト全体で 1 つの値。今は、最初のページを作ったかどうか(first_page)だけ。
2
+ --
3
+ -- 最初のページ(使い方の付箋を置いたページ)は、ページが 1 つもないときに 1 回だけ作る。
4
+ -- 作ったことをここに記録するので、すべてのページを消しても、作り直さない
5
+ CREATE TABLE settings (
6
+ key TEXT PRIMARY KEY,
7
+ value TEXT NOT NULL
8
+ );
9
+
10
+ -- すでに使っている環境には作らない
11
+ INSERT INTO settings (key, value)
12
+ SELECT 'first_page', 'skipped' WHERE EXISTS (SELECT 1 FROM pages);
@@ -0,0 +1,8 @@
1
+ -- ブックマーク。利用者(Access の主体。'user:<email>')ごとの、よく行くページ。
2
+ -- 他の利用者のブックマークは見えない。ページを削除すると、そのページのブックマークも消す
3
+ CREATE TABLE bookmarks (
4
+ actor TEXT NOT NULL,
5
+ page TEXT NOT NULL, -- スラッグ
6
+ created_at INTEGER NOT NULL,
7
+ PRIMARY KEY (actor, page)
8
+ );
@@ -0,0 +1,5 @@
1
+ -- ページの色。
2
+ --
3
+ -- color: ページに付けた色(src/shared/api.ts の PAGE_COLORS のどれか)。付けていなければ NULL。
4
+ -- 正のデータは、ページの DO の meta にある。子ページの付箋と、一覧の付箋の色に使う
5
+ ALTER TABLE pages ADD COLUMN color TEXT;
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "@kanf/wema-kake",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "付箋ボードライブラリ wema を使った Wiki。Cloudflare Workers の上で動き、利用側が自分の Worker を作ってデプロイする",
5
+ "license": "ISC",
6
+ "type": "module",
7
+ "homepage": "https://github.com/kan/wema-kake",
8
+ "bugs": "https://github.com/kan/wema-kake/issues",
9
+ "keywords": [
10
+ "wiki",
11
+ "sticky-notes",
12
+ "whiteboard",
13
+ "cloudflare",
14
+ "cloudflare-workers",
15
+ "durable-objects",
16
+ "d1",
17
+ "mcp",
18
+ "wema"
19
+ ],
20
+ "//exports": "tsc が出した .js と .d.ts(dist/lib)を配る。境界は src/index.ts で、ここに載っていないものは利用側から読まれない前提で動かせる。package.json を出しているのは、利用側やコマンドが migrations と dist/web の場所をたどれるようにするため",
21
+ "exports": {
22
+ ".": "./dist/lib/index.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "//bin": "init が雛形(template/)を書き出す。名前がパッケージ名と同じなのは、npx @kanf/wema-kake が、スコープを外した名前と同じ bin を選ぶため",
26
+ "bin": {
27
+ "wema-kake": "./bin/wema-kake.mjs"
28
+ },
29
+ "//files": "dist/web はビルド済みの画面で、利用側の wrangler.jsonc の assets.directory が直接指す。migrations も migrations_dir で直接指す(どちらもコピーしない)。雛形のロックは入れない(publish の時点の版と噛み合わない)",
30
+ "files": [
31
+ "dist/lib",
32
+ "dist/web",
33
+ "migrations",
34
+ "bin",
35
+ "template",
36
+ "!template/package-lock.json"
37
+ ],
38
+ "scripts": {
39
+ "dev": "npm run build:web && wrangler dev",
40
+ "dev:roji": "npm run build:web && roji run wema-kake -- wrangler dev --port {port} --host {host} --upstream-protocol https",
41
+ "build": "npm run build:web && npm run build:lib",
42
+ "build:web": "vite build",
43
+ "build:lib": "npm run types:build && node scripts/clean-lib.mjs && tsc -p tsconfig.build.json",
44
+ "//types:build": "出力用の、ランタイムの型だけを出す(Env と mainModule を落とす)。理由は tsconfig.build.json",
45
+ "types:build": "wrangler types ./build-types.d.ts --include-env false --strict-vars=false",
46
+ "//prepack": "配るものを作る。雛形の .gitignore は npm がパッケージから落とすので、入る名前で複製する(scripts/pack-template.mjs)",
47
+ "prepack": "npm run build && node scripts/pack-template.mjs",
48
+ "deploy": "npm run build:web && node scripts/deploy.mjs",
49
+ "types": "wrangler types --strict-vars=false",
50
+ "lint": "npm run types && tsc -p tsconfig.json && tsc -p tsconfig.web.json && tsc -p tsconfig.node.json",
51
+ "//pretest": "テストは src/ を直接読むので dist/lib は要らない。画面のアセットを返す処理を確かめるので、dist/web は要る",
52
+ "pretest": "npm run build:web",
53
+ "test": "vitest run"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/kan/wema-kake.git"
58
+ },
59
+ "//dependencies": "Worker の側が実行時に使うもの。@kanf/wema は、画面のビルドに入るほか、Worker の側も自動配置(computeAutoLayout)と型に使うので、ここに置く",
60
+ "dependencies": {
61
+ "@kanf/wema": "^0.16.0",
62
+ "@modelcontextprotocol/server": "^2.0.0",
63
+ "agents": "^0.28.0",
64
+ "hono": "^4.13.13",
65
+ "jose": "^6.2.12",
66
+ "zod": "^4.6.5"
67
+ },
68
+ "devDependencies": {
69
+ "@cloudflare/vitest-plugin": "^1.4.0",
70
+ "@modelcontextprotocol/client": "^2.0.0",
71
+ "@types/node": "^26.6.5",
72
+ "typescript": "^7.0.2",
73
+ "vite": "^8.3.4",
74
+ "vitest": "^5.0.3",
75
+ "wrangler": "^4.149.0"
76
+ }
77
+ }
@@ -0,0 +1,4 @@
1
+ # .dev.vars にコピーして使う(.dev.vars は git に入れない)。
2
+ # ローカル開発では Access がないので、この email を変更の主体として使う(/mcp の主体は agent:local になる)。
3
+ # localhost(と、.localhost で終わるホスト名)へのリクエストでだけ有効で、ACCESS_TEAM_DOMAIN と ACCESS_AUD が設定されていれば無視される。
4
+ DEV_USER_EMAIL=dev@example.com
@@ -0,0 +1,55 @@
1
+ # my-wiki
2
+
3
+ [wema-kake](https://github.com/kan/wema-kake)(`@kanf/wema-kake`)で動く、付箋の Wiki です。Wiki の処理と画面はすべて `@kanf/wema-kake` にあり、このリポジトリが持つのは設定だけです。
4
+
5
+ | ファイル | 中身 |
6
+ | --- | --- |
7
+ | `src/config.ts` | サイトの名前、既定の言語、MCP を有効にするか、最初のページを作るか |
8
+ | `wrangler.jsonc` | Worker の名前、バインディング、デプロイ先ごとの値(Access の設定、サイトのオリジン) |
9
+ | `src/index.ts` | Worker の入口。設定を `@kanf/wema-kake` に渡すだけ |
10
+
11
+ ## ローカルでの開発
12
+
13
+ ```sh
14
+ npm install
15
+ cp .dev.vars.example .dev.vars
16
+ npm run dev
17
+ ```
18
+
19
+ `http://localhost:8787/` で開けます。ローカルでは Access を通らず、`.dev.vars` の `DEV_USER_EMAIL` が利用者になります。
20
+
21
+ ## 最初のデプロイ
22
+
23
+ Cloudflare のアカウントがあれば、ほかに要るものはありません。D1 と R2 は、`wrangler deploy` がバインディングから作ります。
24
+
25
+ ```sh
26
+ npx wrangler login
27
+ npm run deploy:first
28
+ ```
29
+
30
+ **デプロイしただけでは、まだ使えません。** Access を設定するまで、画面と API は 500 を返します(保護のない状態で公開しないためです)。続けて、下の「Access の設定」を行います。
31
+
32
+ ## Access の設定
33
+
34
+ 1. Cloudflare Zero Trust で、Access アプリケーション(Self-hosted)を 1 つ作る。宛先は Worker のホスト名だけ(パスは空)、ポリシーは Allow
35
+ 2. チームドメイン(`https://<team>.cloudflareaccess.com`。末尾の `/` は付けない)と AUD タグを、`wrangler.jsonc` の `ACCESS_TEAM_DOMAIN` と `ACCESS_AUD` に書いて、`npm run deploy` でデプロイし直す
36
+ 3. MCP を使うなら、そのアプリケーションの Additional settings の「OAuth」で **Managed OAuth** を有効にし、Allowed redirect URIs に、つなぐクライアントのコールバックを入れる
37
+ - claude.ai: `https://claude.ai/api/mcp/auth_callback`
38
+ - ChatGPT: `https://chatgpt.com/connector_platform_oauth_redirect`
39
+ - 手元のクライアント(Claude Code など): Allow localhost clients と Allow loopback clients を有効にする
40
+ - 定期タスクから使うなら、Grant session duration を 1 か月(上限)にする。既定のままだと、アプリケーションのセッションの長さで切れて、そのたびにコネクタの再認可が要る
41
+ 4. 未ログインの `curl` で確かめる。Managed OAuth を有効にしていれば、`/api/session` と `POST /mcp` は 401 を返し、`WWW-Authenticate` に `resource_metadata` が入る
42
+
43
+ - **Worker 単位の保護(Worker の「Access」タブの「Protect this Worker behind Access」)は使わない。** WebSocket に対応していない
44
+ - **`/mcp` を Bypass にするアプリケーションを作らない。** Access を通らないリクエストには JWT が付かないので、Worker が 401 を返す
45
+
46
+ MCP のサーバーの URL は `https://<ホスト名>/mcp` です。
47
+
48
+ ## 更新
49
+
50
+ ```sh
51
+ npm update @kanf/wema-kake
52
+ npm run deploy
53
+ ```
54
+
55
+ `npm run deploy` は、D1 のマイグレーションを当ててから Worker をデプロイします。版ごとの変更と、利用側で要る作業は、wema-kake のリリースノートに書かれます。
@@ -0,0 +1,8 @@
1
+ node_modules/
2
+
3
+ # wrangler の作業場所と、生成する型
4
+ .wrangler/
5
+ worker-configuration.d.ts
6
+
7
+ # 手元の secret。.dev.vars.example をコピーして作る
8
+ .dev.vars
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "my-wiki",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "//dev": "ローカルの D1 にマイグレーションを当ててから起動する(新しく clone した木には、ローカルの D1 がない)",
8
+ "dev": "npm run db:migrate:local && wrangler dev",
9
+ "//deploy": "2 回目からのデプロイ。マイグレーションを先に当てるので、新しいコードが古いスキーマに当たらない",
10
+ "deploy": "npm run db:migrate && wrangler deploy",
11
+ "//deploy:first": "最初のデプロイだけ。D1 と R2 は wrangler deploy がバインディングから作るので、それまではマイグレーションを当てる先がない",
12
+ "deploy:first": "wrangler deploy && npm run db:migrate",
13
+ "db:migrate": "wrangler d1 migrations apply DB --remote",
14
+ "db:migrate:local": "wrangler d1 migrations apply DB --local",
15
+ "typecheck": "wrangler types --strict-vars=false && tsc --noEmit"
16
+ },
17
+ "//dependencies": "Wiki の本体。画面、D1 のマイグレーションも、このパッケージに入っている",
18
+ "dependencies": {
19
+ "@kanf/wema-kake": "^0.1.0"
20
+ },
21
+ "devDependencies": {
22
+ "typescript": "^7.0.2",
23
+ "wrangler": "^4.149.0"
24
+ }
25
+ }
@@ -0,0 +1,18 @@
1
+ // この Wiki の設定。どの項目も省ける(省いたときの値は、各項目のコメントにある)。
2
+ //
3
+ // デプロイ先ごとの値(Access の設定、サイトのオリジン)は、ここではなく wrangler.jsonc の vars に書く
4
+ import type { WemaKakeConfig } from '@kanf/wema-kake';
5
+
6
+ const config: WemaKakeConfig = {
7
+ // 画面に出すサイトの名前(一覧の見出しと、タブの表示名)。省くと 'wema-kake'
8
+ siteName: 'My wiki',
9
+ // 既定の言語('ja' か 'en')。画面で選んだ言語も、ブラウザの言語の設定も、対応する言語に
10
+ // 当たらないときに使う。省くと 'en'
11
+ defaultLang: 'en',
12
+ // リモート MCP サーバー(/mcp)。false にすると /mcp は 404 を返す。省くと true
13
+ mcp: true,
14
+ // ページが 1 つもないときに、使い方の付箋を置いたページを 1 回だけ作る。省くと true
15
+ firstPage: true,
16
+ };
17
+
18
+ export default config;
@@ -0,0 +1,9 @@
1
+ // Worker の入口。処理はすべて @kanf/wema-kake にあり、ここでは設定を渡すだけ。
2
+ //
3
+ // PageDO(ページごとの Durable Object)は、Worker の入口から export されている必要があるので、
4
+ // ここで再 export する。名前は wrangler.jsonc の class_name と合わせる
5
+ import { createWemaKake, PageDO } from '@kanf/wema-kake';
6
+ import config from './config';
7
+
8
+ export { PageDO };
9
+ export default createWemaKake(config);
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "esnext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["es2022"],
7
+ // wrangler types が作る(git には入れない)。npm run typecheck が、検査の前に作り直す
8
+ "types": ["./worker-configuration.d.ts"],
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true,
13
+ "verbatimModuleSyntax": true
14
+ },
15
+ "include": ["src", "worker-configuration.d.ts"]
16
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "./node_modules/wrangler/config-schema.json",
3
+
4
+ // この Worker の名前。workers.dev のホスト名にもなる(https://my-wiki.<account>.workers.dev)
5
+ "name": "my-wiki",
6
+ "main": "./src/index.ts",
7
+ "compatibility_date": "2026-10-01",
8
+
9
+ // プレビュー用の URL(<version>-<name>.….workers.dev)は出さない。Access のアプリケーションは
10
+ // 本番のホスト名にしか掛けないので、保護の外に同じ Worker の入口を作らない
11
+ "preview_urls": false,
12
+
13
+ // 画面。ビルド済みのものが @kanf/wema-kake に入っているので、それを直接指す(ビルドは要らない)。
14
+ // **run_worker_first は true のままにすること。** API に当たらないリクエストも Worker が受け、
15
+ // 認証を通してから画面を返す。パスの一覧は @kanf/wema-kake が持つ
16
+ "assets": {
17
+ "binding": "ASSETS",
18
+ "directory": "./node_modules/@kanf/wema-kake/dist/web",
19
+ "not_found_handling": "single-page-application",
20
+ "run_worker_first": true
21
+ },
22
+
23
+ // **バインディングの名前(PAGE / DB / IMAGES / ASSETS)は変えないこと。** @kanf/wema-kake がこの名前で読む。
24
+ // リソースの ID は書かない。wrangler deploy(と Deploy to Cloudflare のボタン)が、足りないものを作って結び付ける
25
+
26
+ // ページごとの Durable Object。クラスは src/index.ts が再 export する PageDO。
27
+ // **クラス名と migrations の tag は変えないこと**(変えると、保存してあるページに届かなくなる)
28
+ "durable_objects": {
29
+ "bindings": [{ "name": "PAGE", "class_name": "PageDO" }]
30
+ },
31
+ "migrations": [{ "tag": "v1", "new_sqlite_classes": ["PageDO"] }],
32
+
33
+ // ページの一覧と全文検索の索引。スキーマは @kanf/wema-kake が持ち、ここからパッケージの中を指す
34
+ // (コピーしない)。当てるのは npm run db:migrate
35
+ "d1_databases": [
36
+ {
37
+ "binding": "DB",
38
+ "database_name": "my-wiki",
39
+ "migrations_dir": "./node_modules/@kanf/wema-kake/migrations"
40
+ }
41
+ ],
42
+
43
+ // 付箋に貼った画像
44
+ "r2_buckets": [{ "binding": "IMAGES", "bucket_name": "my-wiki-images" }],
45
+
46
+ "vars": {
47
+ // Cloudflare Access の設定(README の「Access の設定」)。**両方が空の間、画面と API は 500 を返す**
48
+ // (保護のない状態では開かない)。ローカル開発は .dev.vars の DEV_USER_EMAIL を使う
49
+ // 例: "https://<team>.cloudflareaccess.com"(末尾の / は付けない)
50
+ "ACCESS_TEAM_DOMAIN": "",
51
+ // Access アプリケーションの AUD タグ
52
+ "ACCESS_AUD": "",
53
+ // このサイトのオリジン(例: "https://wiki.example.com")。付箋の中の絶対 URL のリンクを、
54
+ // ページ間のリンクとして拾うのに使う。空なら相対 URL(/p/<slug>)だけを拾う
55
+ "SITE_ORIGIN": ""
56
+ }
57
+ }