@aiquants/markdown-explorer 0.33.0 → 0.35.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 (146) hide show
  1. package/CHANGELOG.md +795 -0
  2. package/README.md +119 -55
  3. package/dist/EditSurface-CLG70Vnn.cjs +6 -0
  4. package/dist/EditSurface-D2j1kCEE.js +990 -0
  5. package/dist/ExplorerSplit-CfP1smbT.js +1589 -0
  6. package/dist/ExplorerSplit-D_0VohOv.cjs +2 -0
  7. package/dist/{MultiLayout-DYNGlNy0.js → MultiLayout-BeJ5Lubb.js} +291 -290
  8. package/dist/MultiLayout-CxV5SI7f.cjs +1 -0
  9. package/dist/NativeScrollBar-BM5NULzg.js +62 -0
  10. package/dist/NativeScrollBar-RWXpVhbI.cjs +1 -0
  11. package/dist/TreeLayout-AxLw-36S.js +103 -0
  12. package/dist/TreeLayout-Bg2YH-EY.cjs +1 -0
  13. package/dist/client/MarkdownExplorer.d.cts +14 -1
  14. package/dist/client/MarkdownExplorer.d.ts +14 -1
  15. package/dist/client/edit/lineEndings.d.cts +4 -0
  16. package/dist/client/edit/lineEndings.d.ts +4 -0
  17. package/dist/client/hostContract.d.cts +67 -0
  18. package/dist/client/hostContract.d.ts +67 -0
  19. package/dist/core/config.d.cts +7 -0
  20. package/dist/core/config.d.ts +7 -0
  21. package/dist/core/contracts.d.cts +10 -4
  22. package/dist/core/contracts.d.ts +10 -4
  23. package/dist/core/draftAnswer.d.cts +23 -0
  24. package/dist/core/draftAnswer.d.ts +23 -0
  25. package/dist/core/geometry.d.cts +1 -0
  26. package/dist/core/geometry.d.ts +1 -0
  27. package/dist/core/labels.d.cts +78 -0
  28. package/dist/core/labels.d.ts +78 -0
  29. package/dist/core/location.d.cts +3 -2
  30. package/dist/core/location.d.ts +3 -2
  31. package/dist/core/ownUrls.d.cts +15 -0
  32. package/dist/core/ownUrls.d.ts +15 -0
  33. package/dist/core/treeSettings.d.cts +3 -2
  34. package/dist/core/treeSettings.d.ts +3 -2
  35. package/dist/core/viewSettings.d.cts +5 -1
  36. package/dist/core/viewSettings.d.ts +5 -1
  37. package/dist/describeValue-CLlVRO8d.js +17 -0
  38. package/dist/describeValue-Ccvhbt36.cjs +1 -0
  39. package/dist/explorerCore-DLpDuSev.js +998 -0
  40. package/dist/explorerCore-DYrxS9ez.cjs +1 -0
  41. package/dist/index-C1YMH-yI.js +5816 -0
  42. package/dist/index-LQWQfpAf.cjs +18 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.d.cts +7 -4
  45. package/dist/index.d.ts +7 -4
  46. package/dist/index.js +47 -42
  47. package/dist/licenses/@heroicons/react/LICENSE +21 -0
  48. package/dist/licenses/entities/LICENSE +11 -0
  49. package/dist/licenses/parse5/LICENSE +19 -0
  50. package/dist/location--KvTA0Ri.js +726 -0
  51. package/dist/location-D8DyDkuA.cjs +1 -0
  52. package/dist/lru-DC8GBmkX.js +39 -0
  53. package/dist/lru-SGmUyBQU.cjs +1 -0
  54. package/dist/{merge-D7L_pINl.js → merge-Bb_HpPhe.js} +1 -1
  55. package/dist/{merge-DZI4pkWI.cjs → merge-DQUYEGCx.cjs} +1 -1
  56. package/dist/nestingGuardWorker.js +5511 -0
  57. package/dist/ownUrls-B259RGgd.cjs +1 -0
  58. package/dist/ownUrls-Dh5g6ZJi.js +370 -0
  59. package/dist/sanitizeJob-BYRk17nr.js +21 -0
  60. package/dist/sanitizeJob-Cs9o3Vpl.cjs +1 -0
  61. package/dist/sanitizePolicy-CEMdaLUB.js +139 -0
  62. package/dist/sanitizePolicy-CiQfnxyd.cjs +2 -0
  63. package/dist/sanitizeWorker.cjs +1 -1
  64. package/dist/sanitizeWorker.js +134 -139
  65. package/dist/sanitizerService-BY4CPCoA.cjs +1 -0
  66. package/dist/sanitizerService-KWXv7bPm.js +240 -0
  67. package/dist/server/assetResponse.d.cts +60 -0
  68. package/dist/server/assetResponse.d.ts +60 -0
  69. package/dist/server/browser/browserPlatform.d.cts +12 -0
  70. package/dist/server/browser/browserPlatform.d.ts +12 -0
  71. package/dist/server/createMarkdownExplorer.d.cts +0 -10
  72. package/dist/server/createMarkdownExplorer.d.ts +0 -10
  73. package/dist/server/explorerCore.d.cts +12 -0
  74. package/dist/server/explorerCore.d.ts +12 -0
  75. package/dist/server/fileSystemSource.d.cts +1 -0
  76. package/dist/server/fileSystemSource.d.ts +1 -0
  77. package/dist/server/inProcessFetch.d.cts +5 -0
  78. package/dist/server/inProcessFetch.d.ts +5 -0
  79. package/dist/server/platform.d.cts +18 -0
  80. package/dist/server/platform.d.ts +18 -0
  81. package/dist/server/ports.d.cts +36 -5
  82. package/dist/server/ports.d.ts +36 -5
  83. package/dist/server/sanitizeProtocol.d.cts +3 -0
  84. package/dist/server/sanitizeProtocol.d.ts +3 -0
  85. package/dist/server/sanitizer.d.cts +5 -40
  86. package/dist/server/sanitizer.d.ts +5 -40
  87. package/dist/server/sanitizerOptions.d.cts +24 -0
  88. package/dist/server/sanitizerOptions.d.ts +24 -0
  89. package/dist/server/sanitizerService.d.cts +41 -0
  90. package/dist/server/sanitizerService.d.ts +41 -0
  91. package/dist/server/{workerPool.d.cts → workerJobs.d.cts} +0 -16
  92. package/dist/server/{workerPool.d.ts → workerJobs.d.ts} +0 -16
  93. package/dist/server.cjs +1 -1
  94. package/dist/server.d.cts +3 -1
  95. package/dist/server.d.ts +3 -1
  96. package/dist/server.js +270 -1343
  97. package/dist/serverBrowser.cjs +1 -0
  98. package/dist/serverBrowser.d.cts +1 -0
  99. package/dist/serverBrowser.d.ts +1 -0
  100. package/dist/serverBrowser.js +120 -0
  101. package/dist/serverCore.cjs +1 -0
  102. package/dist/serverCore.d.cts +14 -0
  103. package/dist/serverCore.d.ts +14 -0
  104. package/dist/serverCore.js +46 -0
  105. package/dist/storage-BpYsprog.cjs +1 -0
  106. package/dist/{storage-CmGHg7OA.js → storage-D1uSw-xj.js} +19 -18
  107. package/dist/storage.cjs +1 -1
  108. package/dist/storage.js +1 -1
  109. package/dist/styles/markdown-explorer.css +1 -1
  110. package/dist/tapScrollCircle-BEydRn0y.js +14 -0
  111. package/dist/tapScrollCircle-DdX0Wri0.cjs +1 -0
  112. package/dist/testing.cjs +1 -0
  113. package/dist/testing.d.cts +6 -0
  114. package/dist/testing.d.ts +6 -0
  115. package/dist/testing.js +4 -0
  116. package/dist/useSplitPersistence-B2Fj508K.cjs +1 -0
  117. package/dist/useSplitPersistence-Fkqak8G8.js +44 -0
  118. package/docs/behavior/dom-hooks.md +14 -3
  119. package/docs/behavior/hosting.md +123 -0
  120. package/docs/behavior/layout.md +69 -19
  121. package/docs/behavior/localization.md +28 -10
  122. package/docs/behavior/security.md +34 -14
  123. package/docs/behavior/url-contract.md +13 -6
  124. package/package.json +54 -16
  125. package/dist/EditSurface-BPqqykro.cjs +0 -6
  126. package/dist/EditSurface-CWq35IWQ.js +0 -972
  127. package/dist/ExplorerSplit-BRY4uy6x.js +0 -1493
  128. package/dist/ExplorerSplit-CQxr6b0v.cjs +0 -1
  129. package/dist/MultiLayout-TXbet9k3.cjs +0 -1
  130. package/dist/NativeScrollBar-BsWdvkHa.js +0 -64
  131. package/dist/NativeScrollBar-UpjxjLlB.cjs +0 -1
  132. package/dist/TreeLayout-BQEgZhz9.js +0 -72
  133. package/dist/TreeLayout-C0O1OGi4.cjs +0 -1
  134. package/dist/dataRoute-DLhQfdoW.js +0 -298
  135. package/dist/dataRoute-DwYtgyt6.cjs +0 -1
  136. package/dist/index-CO-RgTml.js +0 -4912
  137. package/dist/index-DSkK8iLE.cjs +0 -15
  138. package/dist/location-BxiJRTyw.cjs +0 -1
  139. package/dist/location-perTmwct.js +0 -663
  140. package/dist/sanitizePolicy-By0tKOpZ.js +0 -98
  141. package/dist/sanitizePolicy-T5T-3vV5.cjs +0 -1
  142. package/dist/storage-DM0EvkVf.cjs +0 -1
  143. package/dist/tapScrollCircle-CRKZremf.js +0 -12
  144. package/dist/tapScrollCircle-Cbf17x8g.cjs +0 -1
  145. package/dist/useSplitPersistence-Du01PHNg.js +0 -42
  146. package/dist/useSplitPersistence-pPmE4GTT.cjs +0 -1
@@ -0,0 +1,4 @@
1
+ const a = /* @__PURE__ */ JSON.parse('[{"pattern":".env*","path":".env","expect":true},{"pattern":".env*","path":"apps/web/.env.production","expect":true},{"pattern":".env*","path":".envrc","expect":true},{"pattern":".env*","path":".env~","expect":true},{"pattern":".env*","path":".env-old","expect":true},{"pattern":".env*","path":".env_backup","expect":true},{"pattern":".env*","path":"docs/environment.md","expect":false},{"pattern":".env*","path":"docs/prod.env","expect":false},{"pattern":"*.env","path":"prod.env","expect":true},{"pattern":"*.env","path":"config/staging.env","expect":true},{"pattern":"*.env","path":"prod.env.bak","expect":false},{"pattern":"*.env","path":"environment.md","expect":false},{"pattern":"*.env.*","path":"prod.env.bak","expect":true},{"pattern":"*.env.*","path":"config/deploy.env.production","expect":true},{"pattern":"*.env.*","path":"prod.env","expect":false},{"pattern":"*.env.*","path":"prod.environment.md","expect":false},{"pattern":"*.env~*","path":"prod.env~","expect":true},{"pattern":"*.env~*","path":"config/prod.env~1","expect":true},{"pattern":"*.env~*","path":"prod.env","expect":false},{"pattern":"*.env-*","path":"prod.env-old","expect":true},{"pattern":"*.env-*","path":"config/app.env-2026","expect":true},{"pattern":"*.env-*","path":"my-env-file.md","expect":false},{"pattern":"*.env_*","path":"prod.env_backup","expect":true},{"pattern":"*.env_*","path":"config/app.env_local","expect":true},{"pattern":"*.env_*","path":"my_env_file.md","expect":false},{"pattern":"*.env#*","path":"#prod.env#","expect":true},{"pattern":"*.env#*","path":"config/prod.env#1","expect":true},{"pattern":"*.env#*","path":"prod.env","expect":false},{"pattern":".git","path":".git/config","expect":true},{"pattern":".git","path":"sub/.git/HEAD","expect":true},{"pattern":".git","path":".github/workflows/ci.yml","expect":false},{"pattern":".git","path":".gitignore","expect":false},{"pattern":".git-credentials","path":".git-credentials","expect":true},{"pattern":".git-credentials","path":"home/.git-credentials","expect":true},{"pattern":".git-credentials","path":"git-credentials","expect":false},{"pattern":".svn","path":".svn/entries","expect":true},{"pattern":".svn","path":"svn/entries","expect":false},{"pattern":".hg","path":".hg/hgrc","expect":true},{"pattern":".hg","path":".hgignore","expect":false},{"pattern":"node_modules","path":"node_modules/pkg/index.js","expect":true},{"pattern":"node_modules","path":"packages/a/node_modules/b/README.md","expect":true},{"pattern":"node_modules","path":"docs/node_modules_guide.md","expect":false},{"pattern":"secrets","path":"secrets/api.md","expect":true},{"pattern":"secrets","path":"config/secrets/prod.json","expect":true},{"pattern":"secrets","path":"docs/secrets-overview.md","expect":false},{"pattern":".secrets","path":".secrets/key","expect":true},{"pattern":".secrets","path":"app/.secrets","expect":true},{"pattern":".secrets","path":".secrets.md","expect":false},{"pattern":"secrets.json","path":"secrets.json","expect":true},{"pattern":"secrets.json","path":"config/secrets.json","expect":true},{"pattern":"secrets.json","path":"my-secrets.json","expect":false},{"pattern":"secrets.yml","path":"config/secrets.yml","expect":true},{"pattern":"secrets.yml","path":"secrets.yaml","expect":false},{"pattern":"secrets.yaml","path":"config/secrets.yaml","expect":true},{"pattern":"secrets.yaml","path":"secrets.yml","expect":false},{"pattern":"secrets.toml","path":"config/secrets.toml","expect":true},{"pattern":"secrets.toml","path":"secrets.toml.example","expect":false},{"pattern":"secrets.ini","path":"config/secrets.ini","expect":true},{"pattern":"secrets.ini","path":"app.ini","expect":false},{"pattern":"secrets.txt","path":"notes/secrets.txt","expect":true},{"pattern":"secrets.txt","path":"secrets.txt.bak","expect":false},{"pattern":".ssh","path":".ssh/id_rsa","expect":true},{"pattern":".ssh","path":"home/user/.ssh/config","expect":true},{"pattern":".ssh","path":".ssh_config","expect":false},{"pattern":".aws","path":".aws/credentials","expect":true},{"pattern":".aws","path":"home/user/.aws/config","expect":true},{"pattern":".aws","path":".aws-sam/build.toml","expect":false},{"pattern":".gnupg","path":".gnupg/secring.gpg","expect":true},{"pattern":".gnupg","path":".gnupg2/pubring.kbx","expect":false},{"pattern":".docker","path":".docker/config.json","expect":true},{"pattern":".docker","path":"docker/Dockerfile","expect":false},{"pattern":".kube","path":".kube/config","expect":true},{"pattern":".kube","path":"kube/deployment.yaml","expect":false},{"pattern":".terraform","path":".terraform/terraform.tfstate","expect":true},{"pattern":".terraform","path":"terraform/main.tf","expect":false},{"pattern":".npmrc","path":".npmrc","expect":true},{"pattern":".npmrc","path":"packages/web/.npmrc","expect":true},{"pattern":".npmrc","path":"npmrc","expect":false},{"pattern":".yarnrc","path":".yarnrc","expect":true},{"pattern":".yarnrc","path":".yarnrc.yml","expect":false},{"pattern":".yarnrc.yml","path":".yarnrc.yml","expect":true},{"pattern":".yarnrc.yml","path":".yarnrc","expect":false},{"pattern":".netrc","path":".netrc","expect":true},{"pattern":".netrc","path":"_netrc","expect":false},{"pattern":"_netrc","path":"_netrc","expect":true},{"pattern":"_netrc","path":".netrc","expect":false},{"pattern":".pypirc","path":"home/.pypirc","expect":true},{"pattern":".pypirc","path":"pypirc","expect":false},{"pattern":".pgpass","path":"home/.pgpass","expect":true},{"pattern":".pgpass","path":"pgpass.conf","expect":false},{"pattern":".my.cnf","path":"home/.my.cnf","expect":true},{"pattern":".my.cnf","path":"my.cnf","expect":false},{"pattern":".htpasswd","path":"etc/nginx/.htpasswd","expect":true},{"pattern":".htpasswd","path":"htpasswd","expect":false},{"pattern":".vault-token","path":"home/.vault-token","expect":true},{"pattern":".vault-token","path":"vault-token","expect":false},{"pattern":"id_rsa*","path":"id_rsa","expect":true},{"pattern":"id_rsa*","path":"keys/id_rsa.pub","expect":true},{"pattern":"id_rsa*","path":"my_id_rsa","expect":false},{"pattern":"id_dsa*","path":"legacy/id_dsa","expect":true},{"pattern":"id_dsa*","path":"my_id_dsa","expect":false},{"pattern":"id_ecdsa*","path":"keys/id_ecdsa-cert.pub","expect":true},{"pattern":"id_ecdsa*","path":"my_id_ecdsa","expect":false},{"pattern":"id_ed25519*","path":"keys/id_ed25519.pub","expect":true},{"pattern":"id_ed25519*","path":"my_id_ed25519","expect":false},{"pattern":"*.pem","path":"tls/fullchain.pem","expect":true},{"pattern":"*.pem","path":"tls/fullchain.pem.bak","expect":false},{"pattern":"*.key","path":"certs/server.key","expect":true},{"pattern":"*.key","path":"certs/server.key.pub","expect":false},{"pattern":"*.p8","path":"apple/AuthKey_123.p8","expect":true},{"pattern":"*.p8","path":"apple/AuthKey_123.p8.txt","expect":false},{"pattern":"*.p12","path":"certs/client.p12","expect":true},{"pattern":"*.p12","path":"certs/client.p12.enc","expect":false},{"pattern":"*.pfx","path":"win/signing.pfx","expect":true},{"pattern":"*.pfx","path":"win/signing.pfx.bak","expect":false},{"pattern":"*.ppk","path":"putty/server.ppk","expect":true},{"pattern":"*.ppk","path":"putty/server.ppk.old","expect":false},{"pattern":"*.jks","path":"java/keystore.jks","expect":true},{"pattern":"*.jks","path":"java/keystore.jks.bak","expect":false},{"pattern":"*.keystore","path":"android/release.keystore","expect":true},{"pattern":"*.keystore","path":"android/keystore.properties","expect":false},{"pattern":"*.kdbx","path":"vault/passwords.kdbx","expect":true},{"pattern":"*.kdbx","path":"vault/passwords.kdbx.html","expect":false},{"pattern":"*credentials*.json","path":"gcp/client_credentials_prod.json","expect":true},{"pattern":"*credentials*.json","path":"credentials.json","expect":true},{"pattern":"*credentials*.json","path":"gcp/credentials.yaml","expect":false},{"pattern":"service-account*.json","path":"gcp/service-account-prod.json","expect":true},{"pattern":"service-account*.json","path":"gcp/my-service-account.json","expect":false},{"pattern":"*.tfstate","path":"infra/terraform.tfstate","expect":true},{"pattern":"*.tfstate","path":"infra/terraform.tfstate.backup","expect":false},{"pattern":"*.tfstate.*","path":"infra/terraform.tfstate.backup","expect":true},{"pattern":"*.tfstate.*","path":"infra/terraform.tfstate","expect":false},{"pattern":"*.tfvars","path":"infra/prod.tfvars","expect":true},{"pattern":"*.tfvars","path":"infra/prod.tfvars.json","expect":false},{"pattern":"*.tfvars.json","path":"infra/prod.tfvars.json","expect":true},{"pattern":"*.tfvars.json","path":"infra/prod.tfvars","expect":false},{"pattern":".*_history","path":"home/.bash_history","expect":true},{"pattern":".*_history","path":"home/.zsh_history","expect":true},{"pattern":".*_history","path":"home/bash_history","expect":false},{"pattern":"fish_history","path":"local/share/fish/fish_history","expect":true},{"pattern":"fish_history","path":"docs/fish_history.md","expect":false},{"pattern":".env*","path":".ENV","expect":true},{"pattern":".env*","path":"docs/.Env.Local","expect":true},{"pattern":"*.pem","path":"TLS/Server.PEM","expect":true},{"pattern":"id_ed25519*","path":"keys/ID_ED25519.PUB","expect":true},{"pattern":".AWS","path":"docs/.aws/credentials","expect":true},{"pattern":"*.KEY","path":"certs/tls.key","expect":true},{"pattern":"secrets","path":"docs/ſecrets/note.md","expect":true},{"pattern":".ssh","path":".ſsh/config","expect":true},{"pattern":"id_rsa*","path":"keys/ıd_rsa","expect":true},{"pattern":".env*","path":"docs/.env","expect":true},{"pattern":".ssh","path":".ssh/config","expect":true},{"pattern":"*.key","path":"tls/server.Key","expect":true},{"pattern":".ENV*","path":"apps/.env.local","expect":true},{"pattern":".env*","path":"docs\.env","expect":true},{"pattern":".env*","path":"docs/.env","expect":true},{"pattern":".env*","path":"%2eenv","expect":true},{"pattern":".env*","path":"%2E%45%4E%56","expect":true},{"pattern":".ssh","path":"docs/%2essh/config","expect":true},{"pattern":".env*","path":"%252eenv","expect":true},{"pattern":".aws","path":"docs/%252Eaws/credentials","expect":true},{"pattern":"*.pem","path":"certs/root%252Epem","expect":true},{"pattern":".env*","path":"%25252eenv","expect":true},{"pattern":".gnupg","path":"home/%25252Egnupg/key","expect":true},{"pattern":"id_rsa*","path":"keys/%252569d_rsa","expect":true},{"pattern":".env*","path":"docs%2f.env","expect":true},{"pattern":".ssh","path":"docs%252f.ssh%252fconfig","expect":true},{"pattern":".aws","path":"docs%25255c.aws%25255ccredentials","expect":true},{"pattern":".env*","path":"docs/%EF%BC%8Eenv","expect":true},{"pattern":".env*","path":"docs/%25EF%25BC%258Eenv","expect":true},{"pattern":".env*","path":".env.%ZZlocal","expect":true},{"pattern":".env*","path":"%2eenv.%ZZ","expect":true},{"pattern":".env*","path":"%2eenv.trail%","expect":true},{"pattern":".env*","path":"%2eenv.short%2","expect":true},{"pattern":"secrets","path":"secrets%2F%ZZ","expect":true},{"pattern":".env*","path":"%FF/.env","expect":true},{"pattern":".env*","path":"%ZZenv","expect":false},{"pattern":".env*","path":"%2Genv","expect":false},{"pattern":"*credentials*.json","path":"my-credentials\\\\backup.json","expect":true},{"pattern":"*credentials*.json","path":"my-credentials%5Cbackup.json","expect":true},{"pattern":".env*","path":"apps\\\\backend\\\\.env","expect":true},{"pattern":".ssh","path":"C:\\\\Users\\\\example\\\\.ssh\\\\id","expect":true},{"pattern":"*.key","path":"certs\\\\prod/tls.key","expect":true},{"pattern":".env*","path":"///docs///.env///","expect":true},{"pattern":".env*","path":"\\\\\\\\\\\\docs\\\\\\\\\\\\.env\\\\\\\\","expect":true},{"pattern":".env*","path":"","expect":false},{"pattern":".env*","path":"/","expect":false},{"pattern":".env*","path":"\\\\","expect":false},{"pattern":".env.?","path":".env.?","expect":true},{"pattern":".env.?","path":".env.a","expect":false},{"pattern":"file+[1](test)$^|{2}.txt","path":"dir/file+[1](test)$^|{2}.txt","expect":true},{"pattern":"file+[1](test)$^|{2}.txt","path":"dir/file+1(test)$^|{2}.txt","expect":false},{"pattern":"a|b.md","path":"docs/a|b.md","expect":true},{"pattern":"a|b.md","path":"docs/a.md","expect":false},{"pattern":"foo+bar.md","path":"docs/foo+bar.md","expect":true},{"pattern":"foo+bar.md","path":"docs/fooooobar.md","expect":false},{"pattern":"unrelated","path":"docs/safe-%252561-name/readme.md","expect":false},{"pattern":".env","path":"%2525252Eenv","expect":true},{"pattern":".env*","path":"%2525252Eenv","expect":true},{"pattern":".aws","path":"docs/%2525252Eaws/credentials","expect":true},{"pattern":"unrelated","path":"%2525252Eenv","expect":true},{"pattern":"unrelated","path":"docs/%2525252Eaws/credentials","expect":true},{"pattern":"unrelated","path":"docs/safe-%25252561-name/readme.md","expect":true},{"pattern":".env*","path":"%252525252Eenv","expect":true},{"pattern":"unrelated","path":"a/b/%2525252F/c.md","expect":true},{"pattern":"unrelated","path":"a/b/%2525255C..%2525255C/c.md","expect":true},{"pattern":"unrelated","path":"docs/%2525252Eenv%ZZ","expect":true}]'), r = Object.freeze(a.map(({ pattern: e, path: t, expect: p }) => Object.freeze({ pattern: e, path: t, expect: p }))), n = () => r;
2
+ export {
3
+ n as denyVectors
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react"),m=require("./location-D8DyDkuA.cjs"),f=u=>({minimumExceededSummary:u.panelGroupMinimumExceededSummary,minimumExceededDetail:u.panelGroupMinimumExceededDetail,maximumInsufficientSummary:u.panelGroupMaximumInsufficientSummary,maximumInsufficientDetail:u.panelGroupMaximumInsufficientDetail}),d=u=>{const a=e.useRef(u);e.useLayoutEffect(()=>{a.current=u},[u]);const c=e.useRef(null),r=e.useRef(null),n=e.useRef(!1),t=e.useCallback(()=>{r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,c.current!==null&&a.current(c.current)},m.SPLIT_PERSIST_DELAY_MS)},[]);e.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const s=e.useCallback((i,o)=>{c.current=i,o.source==="keyboard"?t():o.source==="pointer"&&(n.current=!0)},[t]),l=e.useCallback(i=>{if(i){n.current=!1;return}n.current&&(n.current=!1,t())},[t]);return e.useMemo(()=>({layoutChanged:s,draggingChanged:l}),[s,l])};exports.toPanelGroupLabels=f;exports.useSplitPersistence=d;
@@ -0,0 +1,44 @@
1
+ import { useRef as t, useLayoutEffect as f, useCallback as m, useEffect as d, useMemo as p } from "react";
2
+ import { S } from "./location--KvTA0Ri.js";
3
+ const E = (e) => ({
4
+ minimumExceededSummary: e.panelGroupMinimumExceededSummary,
5
+ minimumExceededDetail: e.panelGroupMinimumExceededDetail,
6
+ maximumInsufficientSummary: e.panelGroupMaximumInsufficientSummary,
7
+ maximumInsufficientDetail: e.panelGroupMaximumInsufficientDetail
8
+ }), M = (e) => {
9
+ const o = t(e);
10
+ f(() => {
11
+ o.current = e;
12
+ }, [e]);
13
+ const i = t(null), u = t(null), r = t(!1), n = m(() => {
14
+ u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => {
15
+ u.current = null, i.current !== null && o.current(i.current);
16
+ }, S);
17
+ }, []);
18
+ d(
19
+ () => () => {
20
+ u.current !== null && clearTimeout(u.current);
21
+ },
22
+ []
23
+ );
24
+ const a = m(
25
+ (c, s) => {
26
+ i.current = c, s.source === "keyboard" ? n() : s.source === "pointer" && (r.current = !0);
27
+ },
28
+ [n]
29
+ ), l = m(
30
+ (c) => {
31
+ if (c) {
32
+ r.current = !1;
33
+ return;
34
+ }
35
+ r.current && (r.current = !1, n());
36
+ },
37
+ [n]
38
+ );
39
+ return p(() => ({ layoutChanged: a, draggingChanged: l }), [a, l]);
40
+ };
41
+ export {
42
+ E as t,
43
+ M as u
44
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  This page is part of the host-facing contract of `@aiquants/markdown-explorer`; its summary is in the [README](../../README.md#dom-hooks).
4
4
 
5
- Tests and host styling may rely on the `data-testid` values and `data-aqmx-*` attributes below; they keep their meaning across releases, and a change to them is a breaking change. Class names (`aqmx-*`) are styling details and change freely — never select on them. Hooks rendered by the peer packages (`@aiquants/directory-tree`, `@aiquants/drag-drop-panels`, `@aiquants/markdown`) belong to those packages.
5
+ Tests and host styling may rely on the `data-testid` values and `data-aqmx-*` attributes below; they keep their meaning across releases, and a change to them is a breaking change. Class names (`aqmx-*`) are styling details and change freely — never select on them. Hooks rendered by the peer packages (`@aiquants/directory-tree`, `@aiquants/drag-drop-panels`, `@aiquants/markdown`, `@aiquants/virtualscroll`) belong to those packages.
6
6
 
7
7
  ## Frame
8
8
 
@@ -10,8 +10,14 @@ Tests and host styling may rely on the `data-testid` values and `data-aqmx-*` at
10
10
  | --- | --- | --- |
11
11
  | `data-testid="markdown-explorer"` | Root | Carries `data-aqmx-theme` (`light` / `dark`) and `data-aqmx-view` (`tree` / `multi` / `single`) |
12
12
  | `data-testid="markdown-explorer-announcer"` | The root's polite live region (`role="status"`) | While it holds the announcements (no sheet is open): the text of the last announcement frame — its one message, or every message posted within that frame in order (the items of one list label merged into one sentence in the place of the first), joined by `announcementSequence`; empty while the next frame is pending, in a new reader's explorer, and while the sheet holds the announcements |
13
- | `data-aqmx-explorer-mode` | Frame of the tree and multi views | `split` (the explorer beside the content) or `sheet` (the frame is narrower than 13rem × φ², and the explorer opens as a sheet) |
13
+ | `data-aqmx-explorer-mode` | Frame of the tree and multi views | `split` (the explorer beside the content), `rail` (the reader closed the explorer, and a rail holds its side) or `sheet` (the frame is narrower than 13rem × φ², and the explorer opens as a sheet) |
14
+ | `data-aqmx-measured` | Frame of the tree and multi views | `false` until the frame has measured its width (in the server's render, and until the first layout after hydration), then `true`. Until then `data-aqmx-explorer-mode` holds the server's assumption (`split`, or `rail` by the display settings), and the stylesheet lays the frame out as the measure will (see [Layout](layout.md#the-split)) |
15
+ | `data-aqmx-content-covers-page` | Frame of the tree and multi views | `true` while the content covers the page (a maximized multi-view panel, or the tree view's maximized document), which makes the explorer's side inert; else `false` |
14
16
  | `data-aqmx-split` | Explorer/content split | The view it splits (`tree` / `multi`) |
17
+ | `data-testid="markdown-explorer-split-close"` | Close button at the end of the split explorer's first line (named `hideExplorer`) | Closes the explorer to the rail; absent in sheet mode, where the sheet has its own close button |
18
+ | `data-testid="markdown-explorer-rail"` | The rail that holds the explorer's side while the reader closed the explorer | `inert` while the content covers the page |
19
+ | `data-testid="markdown-explorer-rail-toggle"` | Button in the rail that opens the explorer again (named `showExplorer`) | Carries `aria-expanded="false"`. Receives the focus when the explorer closes with the focus on its side, and after a view switch from the header's link when the new view's explorer is closed |
20
+ | `data-testid="markdown-explorer-sheet-bar"` | The bar that holds the sheet's toggle | Carries `data-aqmx-sheet-bar-merged`: `true` while it lies over the start of the tree view's document bar (the two bars are one), else `false` (it stands above the content). `inert` while the content covers the page |
15
21
  | `data-testid="markdown-explorer-sheet-toggle"` | Button that opens the explorer sheet | Carries `aria-expanded`. Also receives the focus after a view switch from the header's link when the frame is a sheet |
16
22
  | `data-testid="markdown-explorer-sheet"` | The explorer sheet (a modal `dialog`) | Has the `open` attribute while shown |
17
23
  | `data-testid="markdown-explorer-sheet-close"` | Close button of the sheet | |
@@ -19,7 +25,7 @@ Tests and host styling may rely on the `data-testid` values and `data-aqmx-*` at
19
25
  | `data-testid="markdown-explorer-split-loading"` | Placeholder while the tree view's code loads | Carries `data-aqmx-content-pane` |
20
26
  | `data-testid="markdown-explorer-single"` | Single view frame | Carries `data-aqmx-content-pane` |
21
27
  | `data-aqmx-content-pane` | The content pane the explorer's dialogs are centered over | The document column of the tree view (the bar and the document region), the single view's frame, the multi view's stage, and a maximized panel's frame (`markdown-explorer-panel-frame`, inside the stage) while it is maximized; a view's loading placeholder while its code loads. The innermost element carrying it is the pane |
22
- | `data-testid="markdown-explorer-document-refresh-bar"` | The document refresh bar | In the tree and single views, above the document region (the button at its inline end; absent while the tree view shows no document); in the multi view, the first row of each panel's body, inside the panel's scroll area and pinned (sticky) to its top while the document scrolls under it. Holds the button row (the Source toggle while the document is Markdown, an SVG image or a spreadsheet, the Edit toggle or the external editor's link when the host offers one, then the Refresh document button) and, below it, the failure notice. While its document is edited it carries `data-aqmx-editing="true"`, and its row holds the editor's status and actions, then the Edit toggle (Source, Refresh document and the refresh notice step aside); a save that needs a grant shows `markdown-explorer-save-grant` below the row |
28
+ | `data-testid="markdown-explorer-document-refresh-bar"` | The document refresh bar | In the tree and single views, above the document region (the button at its inline end; absent while the tree view shows no document); in the multi view, the first row of each panel's body, inside the panel's scroll area and pinned (sticky) to its top while the document scrolls under it. Holds the button row (the Source toggle while the document is Markdown, an SVG image or a spreadsheet, the Edit toggle or the external editor's link when the host offers one, then the Refresh document button) and, below it, the failure notice. While its document is edited it carries `data-aqmx-editing="true"`, and its row holds the editor's status and actions, then the Edit toggle (Source, Refresh document and the refresh notice step aside); a save that needs a grant shows `markdown-explorer-save-grant` below the row. In the tree view below the sheet threshold it is the sheet's bar too and carries `data-aqmx-sheet-bar`: `merged` (it keeps a lane at its start that the sheet's toggle lies over) or `covering` (the document is maximized and the toggle lies inert under the cover); elsewhere it has no such attribute |
23
29
  | `data-testid="markdown-explorer-document-markup"` | The Source toggle, in the bar before Refresh document | Shown only while the bar's document is a loaded Markdown document, SVG image (`imageType` `svg`; a raster image has none) or spreadsheet. A toggle button: `aria-pressed="true"` while the document shows as written (its source, an SVG image's own SVG, a table file's CSV or TSV), `"false"` while it shows rendered (a spreadsheet as its table); a press replaces the URL with the document shown the other way (`markup`, see the [URL contract](url-contract.md#shape)), so a reload or a shared link shows it the same way. The page views name it by its visible label (`showMarkupLabel`; tooltip `showMarkup`, `showSvgMarkup` for an SVG image, or `showSpreadsheetMarkup` with `CSV` or `TSV` for a spreadsheet); a panel's is icon-only, with `aria-label` and `title` set to `showMarkupNamed` (the panel title) |
24
30
  | `data-testid="markdown-explorer-document-edit"` | The Edit toggle, in the bar between Source and Refresh document | Shown while the document is a loaded Markdown document whose `edit` is `inline` or `draft`, and while it is edited. A toggle button: `aria-pressed="true"` while the document is edited (its `title` is then `closeEditor`). The page views name it by its visible label (`editDocumentLabel`; tooltip `editDocument`, or `editDraftDocument` for a `draft` edit); a panel's is icon-only, named `editDocumentNamed` (`editDraftDocumentNamed` for a `draft` edit, with the panel title). The same element before and after a press |
25
31
  | `data-testid="markdown-explorer-document-edit-external"` | Link to the document's own editor (a new tab), in place of the Edit toggle | For an `edit` of kind `external`: `href` is the host's `https:` address, with `target="_blank"` and `rel="noopener noreferrer"`; named `editExternallyLabel` in the page views and `editExternallyNamed` in a panel |
@@ -31,6 +37,8 @@ Tests and host styling may rely on the `data-testid` values and `data-aqmx-*` at
31
37
  | `data-testid="markdown-explorer-unsaved-guard"` / `-cancel` / `-confirm` | The confirmation before a navigation drops unsaved drafts (a modal `dialog`, one per explorer) | As above; `-confirm` drops those drafts and goes on |
32
38
  | `data-testid="markdown-explorer-history"` | The revisions dialog (a modal `dialog`, named `historyTitle`) | Holds `-history-loading`, `-history-failure` or `-history-empty`, else `-history-list` of `-history-entry` buttons (`aria-pressed` for the one shown), the picked revision's text `-history-text` (focusable, so the keyboard scrolls it) or `-history-revision-failure`, and `-history-close` and `-history-restore` (`aria-disabled` until a revision's text is shown) |
33
39
  | `data-testid="markdown-explorer-document-refresh"` | The Refresh document button, in the bar | Reads that document alone again past the host's caches. The page views name it by its visible label (`refreshDocumentLabel`; tooltip `refreshDocument`); a panel's is icon-only, with `aria-label` and `title` set to `refreshDocumentNamed` (the panel title). Carries `aria-busy="true"` and `data-aqmx-busy="true"` while it runs, and `aria-disabled="true"` then and while the document loads (never `disabled`) |
40
+ | `data-testid="markdown-explorer-document-maximize"` | The Maximize button that ends the tree view's document bar | Icon-only, with `aria-label` and `title` naming what a press does (`documentMaximize`, or `documentRestore` while the document is maximized) and no `aria-pressed`; the same element in every state. Absent in the single view and in a multi-view panel |
41
+ | `data-aqmx-maximized` | The tree view's document column (the bar and the document region, `data-aqmx-content-pane`) | `true` while the column covers the page — the document is maximized and has something to show, or its folder's README is being looked for — else `false` (a multi-view panel's frame carries the same attribute, see [Multi-panel view](#multi-panel-view)) |
34
42
  | `data-testid="markdown-explorer-document-refresh-failure"` | Notice of a document refresh that failed, inside the bar below its button row | No live role (the announcer speaks the same text); carries `data-aqmx-failure` (the reason). The failure is the document's answer, or the reading of the part the document's content reads itself (a table file's table, a document shown as written) when that content showed a copy of it, which stays. Shown while the copy of the document it kept stays on screen: a newer answer that replaces or confirms that copy, a move to another document (it does not come back on return), a switch between the document rendered and as written and that control's next refresh take it down. It is the one notice of a failed refresh: no notice inside the document repeats it |
35
43
  | `data-aqmx-key-repeat="allow"` | A control inside the explorer, or an element around controls | Opts the control (or every control inside the element) in to the key repeat of a held Enter, which the explorer otherwise ignores: a press of Enter that began on the control keeps activating it once per repeat while the focus stays there, and a press that began elsewhere and handed the focus to it does not (see [Held keys](layout.md#held-keys)); the explorer sets it on Zoom in and Zoom out |
36
44
 
@@ -76,6 +84,8 @@ The tree's stand-in Tab stop, present while the tab-stop row is outside the tree
76
84
  | `data-testid="markdown-explorer-document-skeleton"` | Placeholder while a pane has no document to show yet (its first document, one the server gave up on, or the README of the tree view's folder while it is looked for) | The region carries `aria-busy="true"` |
77
85
  | `data-testid="markdown-explorer-document-progress"` | Progress bar while the next document (or a fresh copy of a failed one) loads over the one still shown | The region carries `aria-busy="true"` meanwhile, also during router navigations |
78
86
  | `data-testid="markdown-explorer-document-failure"` | Document failure | Carries `data-aqmx-failure` (the reason); its callout has no role in every view (tree, single and multi-view panels): the announcer speaks the failure (`documentFailed`), once for each failed attempt |
87
+ | `data-testid="markdown-explorer-document-notices"` | The notices above a document region | `role="status"` (polite, not atomic), in the page whenever the pane shows a document and empty while there is nothing to tell, so each notice is spoken as it appears; in this order: the document changed elsewhere, media that could not be loaded, media that cannot be played |
88
+ | `data-testid="markdown-explorer-document-notice"` | One notice above the document | Carries `data-aqmx-notice` (`changed` under the host change policy `"notify"`, `media-load` or `media-unplayable`) and `data-aqmx-tone` (`info` for `changed`, `warning` for the media); `changed` and `media-load` hold a Reload button (`reload`), and a media notice names the one medium it tells of or counts two or more |
79
89
  | `data-testid="markdown-explorer-text-truncated"` | Notice under a cut text preview, or a cut source of a Markdown document shown as written | |
80
90
  | `data-testid="markdown-explorer-markup-skeleton"` | Placeholder while the source of a Markdown document shown as written loads (until its first answer) | Hidden from assistive technology; the region holds the screen-reader text `markupLoading` beside it |
81
91
  | `data-testid="markdown-explorer-markup-failure"` | Failure to read the source of a document shown as written before any source was read | Carries `data-aqmx-failure` (the reason); its callout has no role: the pane's announcer speaks the failure (`documentFailed`), once for each answer. A `failed` read offers Try again (`retry`); when the retry succeeds the focus moves into the source and a page view announces the document (`documentShown`) |
@@ -123,6 +133,7 @@ Every link the explorer renders inside Markdown also keeps the document's own `d
123
133
  | `data-testid="markdown-explorer-panel-limit"` | Visible notice that the panel limit was reached (not a live region; the announcer speaks it) | Inside the open sheet's header (the band over the explorer's first line) while the sheet is open, spanning the header from its top edge with its whole text wrapped around the close button, which stays above it: one line covers exactly the header's band (over the source switch), and more lines spill over the top of the sheet's body (the header never changes size); otherwise a manual popover at the stage's corner, or, in browsers without the Popover API, an element without `popover` drawn in place there. Removed after three seconds, or as soon as the focus moves onto an element it is painted over (a control painted above it, such as the sheet's close button, keeps it) |
124
134
 
125
135
  Each panel's scroll area (`data-aqdd-scroll-area`, `SCROLL_AREA_SELECTOR`) is the element that scrolls, inside `@aiquants/markdown`'s HostedScrollArea row (`data-aqmd-scroll-row`) in drag-drop-panels' scroll slot (`data-aqdd-scroll-slot`); the row's bar slot (`data-aqmd-scroll-bar`) holds the explorer's pointer scroll bar inside an element marked `data-aqdd-no-panel-drag`. The stage's pointer scroll bar (without a tap-scroll circle) is in drag-drop-panels' `data-aqdd-stage-scroll-bar`, and the stage carries the room for it in `--aqmx-multi-stage-bar-gutter` (an inline style).
136
+ Under a coarse pointer every tap-scroll circle — the tree's, a content scroller's bar's and a table's — shows only while the reader scrolls (see [Rhythm](layout.md#rhythm)); `@aiquants/virtualscroll` marks it with `data-aqvs-tap-circle-revealed` on the circle's element (`virtual-scroll-tap-circle`): `true` while it shows and takes presses, `false` while it is hidden and lets them through.
126
137
 
127
138
  A panel id is `aqmx-p-` followed by a hash of the document path that first opened the panel; it stays with the panel when the reader follows a link inside it.
128
139
 
@@ -0,0 +1,123 @@
1
+ # Hosting
2
+
3
+ This page is part of the host-facing contract of `@aiquants/markdown-explorer`; its summary is in the [README](../../README.md#installation).
4
+
5
+ The explorer's server half runs on Node behind `@aiquants/markdown-explorer/server`, or inside the page itself — a desktop webview, or a page that answers from what it bundles — on the browser runtime of `@aiquants/markdown-explorer/server/browser`. Both complete the same core, `createExplorerServer` of `@aiquants/markdown-explorer/server/core`, so the explorer answers alike on either.
6
+
7
+ ## Entries
8
+
9
+ | Entry | What it holds | What it never loads |
10
+ | --- | --- | --- |
11
+ | `@aiquants/markdown-explorer` | The browser half: `<MarkdownExplorer>` with the handle its `ref` receives and what a host exchanges with it, the shared configuration, the URL contract, the label catalogs, the contract of a browser draft converter with its helpers (`draftAnswerOf`, `draftConversionOf`), the rule of a document's language (`isExplorerDocumentLang`) and the deny rules. | A Node built-in, the server half or `@aiquants/markdown/server`. What a single-view page loads up front also leaves out the tree, split, virtual-scroll and drag-and-drop packages and the editor, which load when a view or an edit needs them. |
12
+ | `@aiquants/markdown-explorer/server` | The Node entry: `createMarkdownExplorer` (the core on Node's runtime, with its sanitizer's worker threads), `createFileSystemSource`, `anonymousAccess`, the ports and the rules a host's adapters share with the explorer. | React or the browser half; of `@aiquants/markdown`, only its React-free entries. |
13
+ | `@aiquants/markdown-explorer/server/core` | The core every runtime completes: `createExplorerServer(config, platform)`, `createInProcessDataFetch`, the ports and the types they show, `ExplorerError`, `ASSET_CONTENT_SECURITY_POLICIES` and the shared rules (the deny rules, the document path rule, the source id rule, the rule of a document's language (`isExplorerDocumentLang`), `EXPLORER_MAX_HEADINGS` and the rule by which a file's bytes read as text). | A Node built-in, `@aiquants/markdown/server`, `undici`, `jsdom`, React or the client's components. |
14
+ | `@aiquants/markdown-explorer/server/browser` | The browser runtime: `createBrowserExplorerPlatform`. | The same as `./server/core`. It starts the nesting-guard worker from a URL and does not import it. |
15
+ | `@aiquants/markdown-explorer/server/browser/nesting-guard-worker` | The nesting guard's module Web Worker, one self-contained ES module. | Anything but the guard and `parse5`: no DOM and no sanitize policy. |
16
+ | `@aiquants/markdown-explorer/storage` | `clearExplorerStorage`. | Any package: no React and no `@aiquants/*`, so a layout that runs on every page can import it. |
17
+ | `@aiquants/markdown-explorer/testing` | `denyVectors()`: the answers the deny rules owe (one segment pattern, a path and whether the rules made of that pattern alone deny the path), for a host's tests and for another implementation of the rules. | Anything else. No other entry carries the table. |
18
+ | `@aiquants/markdown-explorer/styles/markdown-explorer.css` | The stylesheet ([Load the styles](../../README.md#5-load-the-styles)). | — |
19
+
20
+ ## Running the server half in the page
21
+
22
+ 1. **The core's configuration.** `createExplorerServer(config, platform)` takes the configuration of `createMarkdownExplorer` without its `scopeSecret` (a runtime that keeps a secret holds it itself), and two settings the Node entry fixes:
23
+ - `readSettings(request)` reads the display settings a request carries, as the serialized value (`undefined` when it carries none), for every page request; a malformed value reads as no settings, never as an error. `<MarkdownExplorer persistSettings>` stores the settings where it will find them. The Node entry reads and writes the configuration's `settingsCookie`.
24
+ - `assetMaxRangeBytes` is the most bytes one ranged answer of the `asset` operation carries (a positive safe integer): a satisfiable single range longer than that is shortened from its start and answered 206 with its own `Content-Range`, while a request without `Range`, or whose `If-Range` does not match, is answered whole. `null` answers every range as asked, as the Node entry does.
25
+ - Its `sanitizer` takes the limits every runtime takes; the browser runtime's are [below](#the-browser-runtimes-sanitizer).
26
+ 2. **The browser runtime.** `createBrowserExplorerPlatform({ principalKey, scope, window, nestingGuardWorkerUrl, pageFetch })` checks its options when it is created (a `TypeError` names the first one that is wrong):
27
+ - `principalKey` is the one principal key the page serves, a non-empty string. It must be the key the core's `principalKey` answers: a request that names another key is a `TypeError`. `anonymousAccess` is the Node entry's; a page writes its own `authenticate`.
28
+ - `scope` is that principal's scope, 22 base64url characters (for example 16 random bytes your page keeps), which every data response carries and the browser's stores compare to tell readers apart.
29
+ - `window` is the window whose DOM sanitizes; it must be a secure context, since the runtime measures the HTML with its `crypto.subtle`.
30
+ - `nestingGuardWorkerUrl` is the URL of `@aiquants/markdown-explorer/server/browser/nesting-guard-worker` as your bundler emits it; with Vite, its `?url` import resolved against the page (`new URL(url, window.location.href)`).
31
+ - `pageFetch` is the link cards' network port (`PageFetchPort` of `@aiquants/markdown/link-cards`, `{ open, classify }`), or `null` with link cards off; a configuration with link cards on over a runtime without the port throws when the core asks for the card handler.
32
+ 3. **The page's fetch.** `createInProcessDataFetch(server, { dataPath, pageAddress })`, given the configuration's `dataPath` and the page's own URL (`window.location.href`), answers a request to `<dataPath>/<operation>` with no network, through the core's `dataLoader` (GET and HEAD) or `dataAction` (any other method), and refuses any other URL with a `TypeError`.
33
+ A HEAD answer keeps its status and headers but not its body, and an aborted request rejects with its reason at once, as `fetch` does. It compares a request's scheme and host with the page's rather than origins, so it also answers on a scheme whose origin is `"null"` (such as `wails://`).
34
+ Pass it as `<MarkdownExplorer fetch>`. The page's router has no `basename`: the data URLs are the configuration's own.
35
+ 4. **The route.** The page route has no server loader and no data route. Its `clientLoader` returns the core's `loader`, also during hydration, with a `HydrateFallback` meanwhile, and `shouldRevalidateExplorer` decides when it runs again:
36
+
37
+ ```ts
38
+ // explorer-host.client.ts: a module only the browser loads
39
+ import { createBrowserExplorerPlatform } from "@aiquants/markdown-explorer/server/browser"
40
+ import nestingGuardWorkerUrl from "@aiquants/markdown-explorer/server/browser/nesting-guard-worker?url"
41
+ import { createExplorerServer, createInProcessDataFetch } from "@aiquants/markdown-explorer/server/core"
42
+ import { explorerConfig } from "./explorer.config"
43
+ import { assetOf, documentOf, sources } from "./explorer.sources"
44
+ import { keptScope, keptSettings, READER, READER_KEY } from "./explorer.reader"
45
+
46
+ export const explorer = createExplorerServer(
47
+ {
48
+ config: explorerConfig,
49
+ authenticate: async () => ({ status: "signed-in", principal: READER }),
50
+ principalKey: () => READER_KEY,
51
+ sources,
52
+ document: documentOf,
53
+ asset: assetOf,
54
+ signedOutPage: (_request, headers) => new Response(null, { status: 401, headers }),
55
+ readSettings: keptSettings,
56
+ assetMaxRangeBytes: null,
57
+ },
58
+ createBrowserExplorerPlatform({
59
+ principalKey: READER_KEY,
60
+ scope: keptScope(),
61
+ window,
62
+ nestingGuardWorkerUrl: new URL(nestingGuardWorkerUrl, window.location.href),
63
+ pageFetch: null,
64
+ }),
65
+ )
66
+
67
+ export const explorerFetch = createInProcessDataFetch(explorer, { dataPath: explorerConfig.dataPath, pageAddress: window.location.href })
68
+ ```
69
+
70
+ ```tsx
71
+ // routes/docs.tsx: registered at basePath and basePath/*, like the page route of the quick start
72
+ import { MarkdownExplorer, shouldRevalidateExplorer } from "@aiquants/markdown-explorer"
73
+ import type { ExplorerPageLoaderResult } from "@aiquants/markdown-explorer/server/core"
74
+ import { useLoaderData } from "react-router"
75
+ import { explorer, explorerFetch } from "../explorer-host.client"
76
+ import { explorerConfig } from "../explorer.config"
77
+ import { persistSettings } from "../explorer.reader"
78
+ import type { Route } from "./+types/docs"
79
+
80
+ export const clientLoader = (args: Route.ClientLoaderArgs): Promise<ExplorerPageLoaderResult> => explorer.loader(args)
81
+ clientLoader.hydrate = true as const
82
+ export const shouldRevalidate = shouldRevalidateExplorer
83
+ export const HydrateFallback = () => <p role="status">Loading…</p>
84
+
85
+ export default function Docs() {
86
+ const data = useLoaderData<typeof clientLoader>()
87
+ return <MarkdownExplorer data={data} config={explorerConfig} storageNamespace="docs" fetch={explorerFetch} persistSettings={persistSettings} />
88
+ }
89
+ ```
90
+
91
+ ### What a page host must know
92
+
93
+ - **Images and media load from their URLs.** The browser reads a document's images and media from their asset URLs (`{dataPath}/asset?path=…`, or `mediaDataPath` for videos, audio and PDF documents), never through the explorer's `fetch`, so the in-process fetch never sees those requests. Serve that path over the page's own scheme (a desktop shell's scheme handler, for example, [streaming the files itself](#streaming-files-yourself)), or give the page content without images and media.
94
+ - **Keep your storage keys outside the explorer's namespace.** The explorer keeps its keys under `<storageNamespace>:` (the reader's scope at `<storageNamespace>:scope`) and erases every key of its namespace when the page names another reader, so a key of yours inside it would collide or be erased.
95
+ - **One principal per page.** The core's `principalKey` and the runtime's `principalKey` name the same reader, and the runtime's `scope` stays the same for that reader across page loads; a new scope makes the explorer erase what it kept for the previous reader.
96
+ - **The tree opens the open document's folders only through `ancestors`.** Under the reader's "Reveal the open document" setting (off by default, [Revealing the open document](../../README.md#revealing-the-open-document)), the tree opens the folders down to the open document only when its source answers `ancestors` (the folders from the source's top down to the document's parent, `[]` at the top level, `null` for a path it does not hold); without it, the setting opens no folder.
97
+ - **The browser runtime follows the server's rules.** Every rule of [Security](security.md) holds in the page too: the document admission, the deny rules, the sanitizer's allow-list and limits, the failures a host's adapters throw.
98
+
99
+ ## The browser runtime's sanitizer
100
+
101
+ The browser runtime sanitizes with the same rules and limits as the Node entry, over the page's window ([Security](security.md#html) gives the details):
102
+
103
+ - the nesting guard (the same parser and the same depth, node, comment and attribute budgets) runs in the module Web Worker started from `nestingGuardWorkerUrl`, so its cost never blocks the page, and HTML it stops never reaches the DOM; DOMPurify then sanitizes on the page's main thread, one document at a time, after yielding the main thread once;
104
+ - `sanitizer.workers` and `sanitizer.workerHeapMb` are Node's and refused (a `TypeError` when the explorer is created);
105
+ - the node budget is the one of Node's default worker heap (81,920 nodes with the default 4 MiB of HTML), so `sanitizer.maxHtmlBytes` may be at most 14,155,776, the most that leaves the budget 4,096 nodes (a `RangeError` above it);
106
+ - the admission defaults are those of one worker: `jobsPerScope` defaults to `multiView.maxPanels` + 4 (16 with the default 12 panels) and `maxQueuedJobs` to four times `jobsPerScope`, and neither may be set below `multiView.maxPanels`;
107
+ - the per-document deadline spans the guard and DOMPurify: a document that misses it is `too-large`.
108
+
109
+ ## The app's own URLs: `appOrigins` and `mediaDataPath`
110
+
111
+ Two options of the shared configuration (`defineExplorerConfig`) tell the sanitizer which absolute URLs are the app's own, which then stay only under the paths their use allows ([Security](security.md#html)):
112
+
113
+ - `appOrigins` lists the origins the app's own pages are served from, written as the browser writes them (`scheme://host[:port]`, without a default port, a path, a query or a fragment), such as `http://wails.localhost` or `wails://localhost`. A document's absolute URL of one of them is treated like a path-absolute one. None by default, so only relative and path-absolute URLs are the app's.
114
+ - `mediaDataPath` is an absolute `http:` or `https:` URL, of an origin and a mount path, on which the asset URLs of videos, audio and PDF documents are built instead of the data route, such as a separate media server's data route (`http://127.0.0.1:<port>/m/<secret>/_data`); a document's `video`, `audio` and `source` may then use it too. None by default: every asset is on the data route.
115
+
116
+ ## Streaming files yourself
117
+
118
+ A host that delivers a file's bytes itself — a desktop shell's scheme handler, for example — instead of through the `asset` port's `open` gives each file a `bridge` and asks the core for a plan of each data request:
119
+
120
+ - `ExplorerAssetFile.bridge` is `{ uri, storageVersion, readFailure }`: the storage URI, the storage's own version a read must still find (`null` when the storage keeps none, such as a Google-native Drive file, which is then read without a precondition and without a declared length), and the host's classification of a failed read (the mapping `open` applies, so a failure answers the status a failed `open` would). A host that serves through `open` alone gives none; any other value, `null` included, is a malformed answer. It never reaches the browser.
121
+ - `planData(args)` (of the core and of `createMarkdownExplorer` alike, with the data route's loader arguments) answers a GET of the `asset` operation that the explorer answers with bytes (200 or 206) as a `file` the host streams.
122
+ The plan holds its `status`, every response header (type, length, range, validators, delivery, cache, authentication), the `bridge` (`uri` and `storageVersion`), the `range` to read (`null` for the whole file), the `length` to send (`null` when unknown, then without `Content-Length`), and `fail(error)`, the response to send instead when the bytes cannot be read before the first byte.
123
+ Every other request (HEAD, 304, 416, an empty file, a redirect, a failure, any other operation) is a `response`, exactly as `dataLoader` answers it. A file without a `bridge` cannot be planned and is answered `failed`, and a table preview's workbook (`as=workbook`) is refused as `invalid`.