@77-zhike/app-sdk 0.2.0-d7b1.13 → 0.2.0-d7b1.15
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.
- package/README.md +9 -1
- package/package.json +2 -2
- package/src/cli/browser-auth.js +64 -18
- package/src/cli/credential-store.js +21 -0
- package/src/cli/local-commands.js +2 -1
- package/src/cli/windows-credential-bridge.ps1 +131 -0
- package/src/cli/windows-credential-store.js +112 -0
- package/src/client/index.d.ts +4 -0
- package/src/client/index.js +7 -1
- package/src/forms/index.d.ts +3 -0
- package/src/toolchain/real-build.js +2 -2
- package/src/toolchain/source-discovery.js +7 -1
- package/src/ui/components.generated.js +3 -3
- package/src/ui/conversation.d.ts +48 -0
- package/src/ui/conversation.js +82 -0
- package/src/ui/factory.js +19 -1
- package/src/ui/index.d.ts +35 -10
- package/src/ui/index.js +1 -1
- package/src/ui/scroll-viewport.d.ts +22 -0
- package/src/ui/scroll-viewport.js +23 -0
- package/src/ui/text-selection.d.ts +10 -0
- package/src/ui/text-selection.js +9 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Host选区快照不包含DOM、坐标或业务身份。 */
|
|
2
|
+
export function assertTextSelection(value) {
|
|
3
|
+
if (value === null) return null;
|
|
4
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || Object.keys(value).some(key => !['text', 'anchor', 'start', 'end'].includes(key))
|
|
5
|
+
|| typeof value.text !== 'string' || !value.text.trim() || value.text.length > 10000
|
|
6
|
+
|| typeof value.anchor !== 'string' || !/^selection-[a-zA-Z0-9-]{1,100}$/.test(value.anchor)) throw new Error('runtime_ui_contract_invalid');
|
|
7
|
+
if ((value.start !== undefined || value.end !== undefined) && (!Number.isSafeInteger(value.start) || !Number.isSafeInteger(value.end) || value.start < 0 || value.end < value.start || value.end - value.start !== value.text.length)) throw new Error('runtime_ui_contract_invalid');
|
|
8
|
+
return value;
|
|
9
|
+
}
|