dsh-mobile 0.6.2 → 0.6.4

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 (44) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/CONTRIBUTORS.md +19 -4
  3. package/README.en.md +16 -8
  4. package/README.md +16 -8
  5. package/SECURITY.md +3 -2
  6. package/THIRD_PARTY_NOTICES.md +29 -1
  7. package/apps/mobile/README.md +25 -5
  8. package/apps/mobile/release.json +3 -3
  9. package/cordis.patch.yml +7 -3
  10. package/docs/ATTACH_EXISTING_FRPS.en.md +1 -1
  11. package/docs/ATTACH_EXISTING_FRPS.md +2 -2
  12. package/docs/CADDY_MANAGED.en.md +15 -1
  13. package/docs/CADDY_MANAGED.md +15 -1
  14. package/docs/CLOUDFLARE_TUNNEL.en.md +2 -2
  15. package/docs/CLOUDFLARE_TUNNEL.md +3 -3
  16. package/docs/EXTENSION_WORKERS.en.md +49 -0
  17. package/docs/EXTENSION_WORKERS.md +49 -0
  18. package/docs/MOBILE_COMPOSER_TOOLBAR.en.md +27 -0
  19. package/docs/MOBILE_COMPOSER_TOOLBAR.md +27 -0
  20. package/docs/README.md +2 -0
  21. package/docs/SELF_HOSTED_FRP.en.md +4 -2
  22. package/docs/SELF_HOSTED_FRP.md +4 -2
  23. package/docs/SLOW_CONNECTIONS.en.md +6 -0
  24. package/docs/SLOW_CONNECTIONS.md +6 -0
  25. package/docs/TRUSTED_NETWORKS.en.md +1 -1
  26. package/docs/TRUSTED_NETWORKS.md +1 -1
  27. package/lib/cli.js +140 -19
  28. package/lib/cli.js.map +1 -1
  29. package/lib/client.js +1264 -106
  30. package/lib/client.js.map +1 -1
  31. package/lib/extension-worker-runtime.mjs +1646 -0
  32. package/lib/extension-worker-runtime.mjs.map +1 -0
  33. package/lib/index.d.mts +209 -12
  34. package/lib/index.mjs +2152 -811
  35. package/lib/index.mjs.map +1 -1
  36. package/lib/mobile-layout.js.map +1 -1
  37. package/package.json +17 -6
  38. package/packages/question-fixes/LICENSE +201 -0
  39. package/packages/question-fixes/package.json +9 -2
  40. package/node_modules/dsh-mobile-question-fixes/lib/client.js +0 -78
  41. package/node_modules/dsh-mobile-question-fixes/lib/client.js.map +0 -1
  42. package/node_modules/dsh-mobile-question-fixes/lib/index.mjs +0 -14
  43. package/node_modules/dsh-mobile-question-fixes/lib/index.mjs.map +0 -1
  44. package/node_modules/dsh-mobile-question-fixes/package.json +0 -25
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "dsh-mobile-question-fixes",
3
- "version": "0.5.5",
3
+ "version": "0.6.4",
4
4
  "private": true,
5
5
  "description": "Scoped question-card scrolling and touch-keyboard fixes for DSH Web.",
6
6
  "type": "module",
7
+ "license": "Apache-2.0",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/saya-ch/dsh-mobile.git",
11
+ "directory": "packages/question-fixes"
12
+ },
7
13
  "exports": {
8
14
  ".": {
9
15
  "default": "./lib/index.mjs"
@@ -14,7 +20,8 @@
14
20
  "./package.json": "./package.json"
15
21
  },
16
22
  "files": [
17
- "lib"
23
+ "lib",
24
+ "LICENSE"
18
25
  ],
19
26
  "dsh": {
20
27
  "client": {
@@ -1,78 +0,0 @@
1
- window.__ModuleLoader__.load({
2
- id: "dsh-mobile-question-fixes",
3
- factory: (require) => {
4
- var module = { exports: {} };
5
- var exports = module.exports;
6
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region packages/question-fixes/src/client.ts
8
- /** Local, reversible layout and touch-keyboard fixes for DSH question cards. */
9
- const QUESTION_FIX_CSS = `
10
- [data-question-key] > section:has(> [data-question-scroll]) {
11
- overflow-x: hidden !important;
12
- overflow-y: auto !important;
13
- overscroll-behavior: contain;
14
- }
15
-
16
- [data-question-key] > section > [data-question-scroll] {
17
- flex: 0 0 auto !important;
18
- max-height: none !important;
19
- overflow: visible !important;
20
- }
21
-
22
- [data-question-key] > section:has(> header button[aria-expanded="false"]) > header h2 {
23
- display: -webkit-box;
24
- -webkit-box-orient: vertical;
25
- -webkit-line-clamp: 2;
26
- overflow: hidden;
27
- }
28
- `;
29
- /**
30
- * Whether an editable question answer should keep the browser's Enter newline.
31
- * @param event - the keyboard event received before DSH's submit handler.
32
- * @param context - the App keyboard state or browser touch hint.
33
- * @returns True for an unmodified Enter outside IME composition on touch devices.
34
- */
35
- function questionEnterUsesNewline(event, context) {
36
- return (context.nativeBridge ? context.nativeState?.imeVisible === true && context.nativeState.noHardwareKeyboard === true : context.touchPrimary) && event.key === "Enter" && !event.defaultPrevented && !event.isComposing && event.keyCode !== 229 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey;
37
- }
38
- /**
39
- * Add scoped card styles and preserve touch Enter's native editing action.
40
- * Card height, typography, composer placement and draft ownership remain in DSH.
41
- * @returns A disposer that restores the existing card without reloading it.
42
- */
43
- function installQuestionFixes() {
44
- const style = document.createElement("style");
45
- style.dataset.plugin = "dsh-mobile-question-fixes";
46
- style.textContent = QUESTION_FIX_CSS;
47
- document.head.append(style);
48
- const touchPrimary = window.matchMedia("(hover: none), (pointer: coarse)");
49
- const onKeyDown = (event) => {
50
- if (!questionEnterUsesNewline(event, {
51
- touchPrimary: touchPrimary.matches,
52
- nativeBridge: window.__DSH_MOBILE_NATIVE__ !== void 0,
53
- nativeState: window.__DSH_MOBILE_KEYBOARD_STATE__ ?? null
54
- })) return;
55
- const answer = event.target;
56
- if (!(answer instanceof HTMLTextAreaElement) || answer.disabled || answer.readOnly || answer.closest("[data-question-key]") === null) return;
57
- event.stopPropagation();
58
- };
59
- document.addEventListener("keydown", onKeyDown, true);
60
- return () => {
61
- document.removeEventListener("keydown", onKeyDown, true);
62
- style.remove();
63
- };
64
- }
65
- /** Register the browser effect controlled by the bundle component's switch. */
66
- function apply(ctx) {
67
- ctx.effect(() => installQuestionFixes());
68
- }
69
- //#endregion
70
- exports.QUESTION_FIX_CSS = QUESTION_FIX_CSS;
71
- exports.apply = apply;
72
- exports.installQuestionFixes = installQuestionFixes;
73
- exports.questionEnterUsesNewline = questionEnterUsesNewline;
74
- return module.exports;
75
- }
76
- });
77
-
78
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["/** Local, reversible layout and touch-keyboard fixes for DSH question cards. */\nexport const QUESTION_FIX_CSS = `\n[data-question-key] > section:has(> [data-question-scroll]) {\n overflow-x: hidden !important;\n overflow-y: auto !important;\n overscroll-behavior: contain;\n}\n\n[data-question-key] > section > [data-question-scroll] {\n flex: 0 0 auto !important;\n max-height: none !important;\n overflow: visible !important;\n}\n\n[data-question-key] > section:has(> header button[aria-expanded=\"false\"]) > header h2 {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n}\n`\n\n/** Keyboard facts required to preserve upstream shortcuts and IME composition. */\nexport interface QuestionEnterEvent {\n readonly key: string\n readonly keyCode: number\n readonly defaultPrevented: boolean\n readonly isComposing: boolean\n readonly shiftKey: boolean\n readonly ctrlKey: boolean\n readonly altKey: boolean\n readonly metaKey: boolean\n}\n\n/** App keyboard facts take precedence over a browser's pointer hint. */\nexport interface QuestionKeyboardContext {\n readonly touchPrimary: boolean\n readonly nativeBridge: boolean\n readonly nativeState?: { readonly imeVisible: boolean; readonly noHardwareKeyboard: boolean } | null\n}\n\n/**\n * Whether an editable question answer should keep the browser's Enter newline.\n * @param event - the keyboard event received before DSH's submit handler.\n * @param context - the App keyboard state or browser touch hint.\n * @returns True for an unmodified Enter outside IME composition on touch devices.\n */\nexport function questionEnterUsesNewline(event: QuestionEnterEvent, context: QuestionKeyboardContext): boolean {\n const keyboardAllowsNewline = context.nativeBridge\n ? context.nativeState?.imeVisible === true && context.nativeState.noHardwareKeyboard === true\n : context.touchPrimary\n return keyboardAllowsNewline && event.key === 'Enter' && !event.defaultPrevented\n && !event.isComposing && event.keyCode !== 229\n && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey\n}\n\n/**\n * Add scoped card styles and preserve touch Enter's native editing action.\n * Card height, typography, composer placement and draft ownership remain in DSH.\n * @returns A disposer that restores the existing card without reloading it.\n */\nexport function installQuestionFixes(): () => void {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-mobile-question-fixes'\n style.textContent = QUESTION_FIX_CSS\n document.head.append(style)\n const touchPrimary = window.matchMedia('(hover: none), (pointer: coarse)')\n const onKeyDown = (event: KeyboardEvent): void => {\n if (!questionEnterUsesNewline(event, {\n touchPrimary: touchPrimary.matches,\n nativeBridge: window.__DSH_MOBILE_NATIVE__ !== undefined,\n nativeState: window.__DSH_MOBILE_KEYBOARD_STATE__ ?? null,\n })) return\n const answer = event.target\n if (!(answer instanceof HTMLTextAreaElement) || answer.disabled || answer.readOnly\n || answer.closest('[data-question-key]') === null) return\n // DSH submits on keydown. Leave the textarea's default action and input event\n // intact so React receives the newline as an ordinary edit.\n event.stopPropagation()\n }\n document.addEventListener('keydown', onKeyDown, true)\n return () => {\n document.removeEventListener('keydown', onKeyDown, true)\n style.remove()\n }\n}\n\n/** Register the browser effect controlled by the bundle component's switch. */\nexport function apply(ctx: { effect(effect: () => void | (() => void)): void }): void {\n ctx.effect(() => installQuestionFixes())\n}\n"],"mappings":";;;;;;;;EACA,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;EA8ChC,SAAgB,yBAAyB,OAA2B,SAA2C;GAI7G,QAH8B,QAAQ,eAClC,QAAQ,aAAa,eAAe,QAAQ,QAAQ,YAAY,uBAAuB,OACvF,QAAQ,iBACoB,MAAM,QAAQ,WAAW,CAAC,MAAM,oBAC3D,CAAC,MAAM,eAAe,MAAM,YAAY,OACxC,CAAC,MAAM,YAAY,CAAC,MAAM,WAAW,CAAC,MAAM,UAAU,CAAC,MAAM;EACpE;;;;;;EAOA,SAAgB,uBAAmC;GACjD,MAAM,QAAQ,SAAS,cAAc,OAAO;GAC5C,MAAM,QAAQ,SAAS;GACvB,MAAM,cAAc;GACpB,SAAS,KAAK,OAAO,KAAK;GAC1B,MAAM,eAAe,OAAO,WAAW,kCAAkC;GACzE,MAAM,aAAa,UAA+B;IAChD,IAAI,CAAC,yBAAyB,OAAO;KACnC,cAAc,aAAa;KAC3B,cAAc,OAAO,0BAA0B,KAAA;KAC/C,aAAa,OAAO,iCAAiC;IACvD,CAAC,GAAG;IACJ,MAAM,SAAS,MAAM;IACrB,IAAI,EAAE,kBAAkB,wBAAwB,OAAO,YAAY,OAAO,YACrE,OAAO,QAAQ,qBAAqB,MAAM,MAAM;IAGrD,MAAM,gBAAgB;GACxB;GACA,SAAS,iBAAiB,WAAW,WAAW,IAAI;GACpD,aAAa;IACX,SAAS,oBAAoB,WAAW,WAAW,IAAI;IACvD,MAAM,OAAO;GACf;EACF;;EAGA,SAAgB,MAAM,KAAgE;GACpF,IAAI,aAAa,qBAAqB,CAAC;EACzC"}
@@ -1,14 +0,0 @@
1
- //#region packages/question-fixes/src/index.ts
2
- /**
3
- * Question-card fixes, node half.
4
- *
5
- * A pure UI plugin: this empty apply exists so the plugin appears in the Loader
6
- * and gets its own component row with its own toggle. The browser half ships as
7
- * `exports["./client"]`, discovered through the `dsh.client` declaration in this
8
- * package's manifest. All behaviour lives in `src/client.ts`.
9
- */
10
- function apply() {}
11
- //#endregion
12
- export { apply };
13
-
14
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Question-card fixes, node half.\n *\n * A pure UI plugin: this empty apply exists so the plugin appears in the Loader\n * and gets its own component row with its own toggle. The browser half ships as\n * `exports[\"./client\"]`, discovered through the `dsh.client` declaration in this\n * package's manifest. All behaviour lives in `src/client.ts`.\n */\nexport function apply(): void {}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,QAAc,CAAC"}
@@ -1,25 +0,0 @@
1
- {
2
- "name": "dsh-mobile-question-fixes",
3
- "version": "0.5.5",
4
- "private": true,
5
- "description": "Scoped question-card scrolling and touch-keyboard fixes for DSH Web.",
6
- "type": "module",
7
- "exports": {
8
- ".": {
9
- "default": "./lib/index.mjs"
10
- },
11
- "./client": {
12
- "default": "./lib/client.js"
13
- },
14
- "./package.json": "./package.json"
15
- },
16
- "files": [
17
- "lib"
18
- ],
19
- "dsh": {
20
- "client": {
21
- "platform": "web",
22
- "immediately": true
23
- }
24
- }
25
- }