@tldraw/editor 5.6.0 → 5.7.0-canary.74fcba690527
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/dist-cjs/index.d.ts +10 -0
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +11 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +3 -0
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +6 -1
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +10 -0
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +11 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +3 -0
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +6 -1
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/shapes/ShapeUtil.ts +12 -0
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +4 -0
- package/src/lib/license/LicenseManager.test.ts +31 -0
- package/src/lib/license/LicenseManager.ts +8 -1
- package/src/version.ts +3 -3
|
@@ -760,6 +760,37 @@ describe('LicenseManager', () => {
|
|
|
760
760
|
}
|
|
761
761
|
})
|
|
762
762
|
|
|
763
|
+
it('Licenses our VS Code extension webview when no key is provided', async () => {
|
|
764
|
+
const manager = await createManagerOnHost(
|
|
765
|
+
'vscode-webview://1ipd8pun8ud7nd7hv9d112g7evi7m10vak9vviuvia66ou6aibp3/index.html?id=6ec2dc7a-afe9-45d9-bd71-1749f9568d28&swVersion=4&extensionId=tldraw-org.tldraw-vscode&platform=electron'
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
expect(await manager.getLicenseFromKey('')).toMatchObject({
|
|
769
|
+
isLicenseParseable: true,
|
|
770
|
+
isDomainValid: true,
|
|
771
|
+
isLicensedWithWatermark: true,
|
|
772
|
+
})
|
|
773
|
+
expect(manager.state.get()).toBe('licensed-with-watermark')
|
|
774
|
+
manager.dispose()
|
|
775
|
+
})
|
|
776
|
+
|
|
777
|
+
it('Does not license other VS Code extension webviews', async () => {
|
|
778
|
+
const urls = [
|
|
779
|
+
'vscode-webview://abc/index.html?extensionId=evil-org.evil-vscode&x=tldraw-org.tldraw-vscode',
|
|
780
|
+
'vscode-webview://tldraw-org.tldraw-vscode/index.html?extensionId=evil-org.evil-vscode',
|
|
781
|
+
]
|
|
782
|
+
|
|
783
|
+
for (const url of urls) {
|
|
784
|
+
const manager = await createManagerOnHost(url)
|
|
785
|
+
|
|
786
|
+
expect(await manager.getLicenseFromKey('')).toMatchObject({
|
|
787
|
+
isLicenseParseable: false,
|
|
788
|
+
reason: 'no-key-provided',
|
|
789
|
+
})
|
|
790
|
+
manager.dispose()
|
|
791
|
+
}
|
|
792
|
+
})
|
|
793
|
+
|
|
763
794
|
it('Never sends a watermark tracking ping for our own domains', async () => {
|
|
764
795
|
const manager = await createManagerOnHost('https://makereal.tldraw.com')
|
|
765
796
|
|
|
@@ -59,6 +59,9 @@ const CANONICAL_TLDRAW_HOSTS = [
|
|
|
59
59
|
'tldraw.xyz',
|
|
60
60
|
]
|
|
61
61
|
|
|
62
|
+
/** Our VS Code extension, whose webviews are served from `vscode-webview:` with a random hostname. */
|
|
63
|
+
const CANONICAL_VSCODE_EXTENSION_ID = 'tldraw-org.tldraw-vscode'
|
|
64
|
+
|
|
62
65
|
/** Marks a license as the keyless canonical-host grant, which is never tracked. */
|
|
63
66
|
const CANONICAL_HOST_LICENSE_ID = 'tldraw-canonical-host'
|
|
64
67
|
|
|
@@ -237,8 +240,12 @@ export class LicenseManager {
|
|
|
237
240
|
return host === 'localhost' || host === '::1' || /^127(?:\.\d{1,3}){3}$/.test(host)
|
|
238
241
|
}
|
|
239
242
|
|
|
240
|
-
/** Whether the page is served from one of tldraw's own domains,
|
|
243
|
+
/** Whether the page is served from one of tldraw's own domains, a subdomain of one, or our VS Code extension. */
|
|
241
244
|
private isCanonicalTldrawHost() {
|
|
245
|
+
if (window.location.protocol === 'vscode-webview:') {
|
|
246
|
+
const extensionId = new URL(window.location.href).searchParams.get('extensionId')
|
|
247
|
+
return extensionId === CANONICAL_VSCODE_EXTENSION_ID
|
|
248
|
+
}
|
|
242
249
|
const hostname = window.location.hostname.toLowerCase()
|
|
243
250
|
return CANONICAL_TLDRAW_HOSTS.some((host) => hostname === host || hostname.endsWith(`.${host}`))
|
|
244
251
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '5.
|
|
4
|
+
export const version = '5.7.0-canary.74fcba690527'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2026-05-06T16:28:18.473Z',
|
|
7
|
-
minor: '2026-10-28T14:
|
|
8
|
-
patch: '2026-10-28T14:
|
|
7
|
+
minor: '2026-10-28T14:50:21.792Z',
|
|
8
|
+
patch: '2026-10-28T14:50:21.792Z',
|
|
9
9
|
}
|