@bigbluebutton/tlschema 2.0.0-alpha.19
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/LICENSE +190 -0
- package/dist-cjs/TLStore.js +133 -0
- package/dist-cjs/TLStore.js.map +7 -0
- package/dist-cjs/assets/TLBaseAsset.js +37 -0
- package/dist-cjs/assets/TLBaseAsset.js.map +7 -0
- package/dist-cjs/assets/TLBookmarkAsset.js +38 -0
- package/dist-cjs/assets/TLBookmarkAsset.js.map +7 -0
- package/dist-cjs/assets/TLImageAsset.js +76 -0
- package/dist-cjs/assets/TLImageAsset.js.map +7 -0
- package/dist-cjs/assets/TLVideoAsset.js +76 -0
- package/dist-cjs/assets/TLVideoAsset.js.map +7 -0
- package/dist-cjs/createPresenceStateDerivation.js +68 -0
- package/dist-cjs/createPresenceStateDerivation.js.map +7 -0
- package/dist-cjs/createTLSchema.js +68 -0
- package/dist-cjs/createTLSchema.js.map +7 -0
- package/dist-cjs/index.d.ts +1414 -0
- package/dist-cjs/index.js +142 -0
- package/dist-cjs/index.js.map +7 -0
- package/dist-cjs/misc/TLColor.js +36 -0
- package/dist-cjs/misc/TLColor.js.map +7 -0
- package/dist-cjs/misc/TLCursor.js +55 -0
- package/dist-cjs/misc/TLCursor.js.map +7 -0
- package/dist-cjs/misc/TLHandle.js +36 -0
- package/dist-cjs/misc/TLHandle.js.map +7 -0
- package/dist-cjs/misc/TLOpacity.js +30 -0
- package/dist-cjs/misc/TLOpacity.js.map +7 -0
- package/dist-cjs/misc/TLScribble.js +40 -0
- package/dist-cjs/misc/TLScribble.js.map +7 -0
- package/dist-cjs/misc/geometry-types.js +37 -0
- package/dist-cjs/misc/geometry-types.js.map +7 -0
- package/dist-cjs/misc/id-validator.js +33 -0
- package/dist-cjs/misc/id-validator.js.map +7 -0
- package/dist-cjs/records/TLAsset.js +74 -0
- package/dist-cjs/records/TLAsset.js.map +7 -0
- package/dist-cjs/records/TLCamera.js +74 -0
- package/dist-cjs/records/TLCamera.js.map +7 -0
- package/dist-cjs/records/TLDocument.js +82 -0
- package/dist-cjs/records/TLDocument.js.map +7 -0
- package/dist-cjs/records/TLInstance.js +452 -0
- package/dist-cjs/records/TLInstance.js.map +7 -0
- package/dist-cjs/records/TLPage.js +74 -0
- package/dist-cjs/records/TLPage.js.map +7 -0
- package/dist-cjs/records/TLPageState.js +209 -0
- package/dist-cjs/records/TLPageState.js.map +7 -0
- package/dist-cjs/records/TLPointer.js +76 -0
- package/dist-cjs/records/TLPointer.js.map +7 -0
- package/dist-cjs/records/TLPresence.js +170 -0
- package/dist-cjs/records/TLPresence.js.map +7 -0
- package/dist-cjs/records/TLRecord.js +17 -0
- package/dist-cjs/records/TLRecord.js.map +7 -0
- package/dist-cjs/records/TLShape.js +147 -0
- package/dist-cjs/records/TLShape.js.map +7 -0
- package/dist-cjs/shapes/TLArrowShape.js +156 -0
- package/dist-cjs/shapes/TLArrowShape.js.map +7 -0
- package/dist-cjs/shapes/TLBaseShape.js +52 -0
- package/dist-cjs/shapes/TLBaseShape.js.map +7 -0
- package/dist-cjs/shapes/TLBookmarkShape.js +57 -0
- package/dist-cjs/shapes/TLBookmarkShape.js.map +7 -0
- package/dist-cjs/shapes/TLDrawShape.js +89 -0
- package/dist-cjs/shapes/TLDrawShape.js.map +7 -0
- package/dist-cjs/shapes/TLEmbedShape.js +709 -0
- package/dist-cjs/shapes/TLEmbedShape.js.map +7 -0
- package/dist-cjs/shapes/TLFrameShape.js +33 -0
- package/dist-cjs/shapes/TLFrameShape.js.map +7 -0
- package/dist-cjs/shapes/TLGeoShape.js +230 -0
- package/dist-cjs/shapes/TLGeoShape.js.map +7 -0
- package/dist-cjs/shapes/TLGroupShape.js +28 -0
- package/dist-cjs/shapes/TLGroupShape.js.map +7 -0
- package/dist-cjs/shapes/TLHighlightShape.js +38 -0
- package/dist-cjs/shapes/TLHighlightShape.js.map +7 -0
- package/dist-cjs/shapes/TLImageShape.js +69 -0
- package/dist-cjs/shapes/TLImageShape.js.map +7 -0
- package/dist-cjs/shapes/TLLineShape.js +70 -0
- package/dist-cjs/shapes/TLLineShape.js.map +7 -0
- package/dist-cjs/shapes/TLNoteShape.js +144 -0
- package/dist-cjs/shapes/TLNoteShape.js.map +7 -0
- package/dist-cjs/shapes/TLTextShape.js +67 -0
- package/dist-cjs/shapes/TLTextShape.js.map +7 -0
- package/dist-cjs/shapes/TLVideoShape.js +53 -0
- package/dist-cjs/shapes/TLVideoShape.js.map +7 -0
- package/dist-cjs/store-migrations.js +81 -0
- package/dist-cjs/store-migrations.js.map +7 -0
- package/dist-cjs/styles/StyleProp.js +94 -0
- package/dist-cjs/styles/StyleProp.js.map +7 -0
- package/dist-cjs/styles/TLColorStyle.js +283 -0
- package/dist-cjs/styles/TLColorStyle.js.map +7 -0
- package/dist-cjs/styles/TLDashStyle.js +29 -0
- package/dist-cjs/styles/TLDashStyle.js.map +7 -0
- package/dist-cjs/styles/TLFillStyle.js +29 -0
- package/dist-cjs/styles/TLFillStyle.js.map +7 -0
- package/dist-cjs/styles/TLFontStyle.js +36 -0
- package/dist-cjs/styles/TLFontStyle.js.map +7 -0
- package/dist-cjs/styles/TLHorizontalAlignStyle.js +29 -0
- package/dist-cjs/styles/TLHorizontalAlignStyle.js.map +7 -0
- package/dist-cjs/styles/TLSizeStyle.js +29 -0
- package/dist-cjs/styles/TLSizeStyle.js.map +7 -0
- package/dist-cjs/styles/TLVerticalAlignStyle.js +29 -0
- package/dist-cjs/styles/TLVerticalAlignStyle.js.map +7 -0
- package/dist-cjs/translations/languages.js +59 -0
- package/dist-cjs/translations/languages.js.map +7 -0
- package/dist-cjs/translations/translations.js +63 -0
- package/dist-cjs/translations/translations.js.map +7 -0
- package/dist-cjs/util-types.js +17 -0
- package/dist-cjs/util-types.js.map +7 -0
- package/dist-esm/TLStore.mjs +113 -0
- package/dist-esm/TLStore.mjs.map +7 -0
- package/dist-esm/assets/TLBaseAsset.mjs +17 -0
- package/dist-esm/assets/TLBaseAsset.mjs.map +7 -0
- package/dist-esm/assets/TLBookmarkAsset.mjs +18 -0
- package/dist-esm/assets/TLBookmarkAsset.mjs.map +7 -0
- package/dist-esm/assets/TLImageAsset.mjs +56 -0
- package/dist-esm/assets/TLImageAsset.mjs.map +7 -0
- package/dist-esm/assets/TLVideoAsset.mjs +56 -0
- package/dist-esm/assets/TLVideoAsset.mjs.map +7 -0
- package/dist-esm/createPresenceStateDerivation.mjs +48 -0
- package/dist-esm/createPresenceStateDerivation.mjs.map +7 -0
- package/dist-esm/createTLSchema.mjs +48 -0
- package/dist-esm/createTLSchema.mjs.map +7 -0
- package/dist-esm/index.d.mts +1414 -0
- package/dist-esm/index.mjs +193 -0
- package/dist-esm/index.mjs.map +7 -0
- package/dist-esm/misc/TLColor.mjs +16 -0
- package/dist-esm/misc/TLColor.mjs.map +7 -0
- package/dist-esm/misc/TLCursor.mjs +35 -0
- package/dist-esm/misc/TLCursor.mjs.map +7 -0
- package/dist-esm/misc/TLHandle.mjs +16 -0
- package/dist-esm/misc/TLHandle.mjs.map +7 -0
- package/dist-esm/misc/TLOpacity.mjs +10 -0
- package/dist-esm/misc/TLOpacity.mjs.map +7 -0
- package/dist-esm/misc/TLScribble.mjs +20 -0
- package/dist-esm/misc/TLScribble.mjs.map +7 -0
- package/dist-esm/misc/geometry-types.mjs +17 -0
- package/dist-esm/misc/geometry-types.mjs.map +7 -0
- package/dist-esm/misc/id-validator.mjs +13 -0
- package/dist-esm/misc/id-validator.mjs.map +7 -0
- package/dist-esm/records/TLAsset.mjs +57 -0
- package/dist-esm/records/TLAsset.mjs.map +7 -0
- package/dist-esm/records/TLCamera.mjs +54 -0
- package/dist-esm/records/TLCamera.mjs.map +7 -0
- package/dist-esm/records/TLDocument.mjs +62 -0
- package/dist-esm/records/TLDocument.mjs.map +7 -0
- package/dist-esm/records/TLInstance.mjs +432 -0
- package/dist-esm/records/TLInstance.mjs.map +7 -0
- package/dist-esm/records/TLPage.mjs +54 -0
- package/dist-esm/records/TLPage.mjs.map +7 -0
- package/dist-esm/records/TLPageState.mjs +189 -0
- package/dist-esm/records/TLPageState.mjs.map +7 -0
- package/dist-esm/records/TLPointer.mjs +56 -0
- package/dist-esm/records/TLPointer.mjs.map +7 -0
- package/dist-esm/records/TLPresence.mjs +150 -0
- package/dist-esm/records/TLPresence.mjs.map +7 -0
- package/dist-esm/records/TLRecord.mjs +1 -0
- package/dist-esm/records/TLRecord.mjs.map +7 -0
- package/dist-esm/records/TLShape.mjs +127 -0
- package/dist-esm/records/TLShape.mjs.map +7 -0
- package/dist-esm/shapes/TLArrowShape.mjs +136 -0
- package/dist-esm/shapes/TLArrowShape.mjs.map +7 -0
- package/dist-esm/shapes/TLBaseShape.mjs +32 -0
- package/dist-esm/shapes/TLBaseShape.mjs.map +7 -0
- package/dist-esm/shapes/TLBookmarkShape.mjs +37 -0
- package/dist-esm/shapes/TLBookmarkShape.mjs.map +7 -0
- package/dist-esm/shapes/TLDrawShape.mjs +69 -0
- package/dist-esm/shapes/TLDrawShape.mjs.map +7 -0
- package/dist-esm/shapes/TLEmbedShape.mjs +689 -0
- package/dist-esm/shapes/TLEmbedShape.mjs.map +7 -0
- package/dist-esm/shapes/TLFrameShape.mjs +13 -0
- package/dist-esm/shapes/TLFrameShape.mjs.map +7 -0
- package/dist-esm/shapes/TLGeoShape.mjs +212 -0
- package/dist-esm/shapes/TLGeoShape.mjs.map +7 -0
- package/dist-esm/shapes/TLGroupShape.mjs +8 -0
- package/dist-esm/shapes/TLGroupShape.mjs.map +7 -0
- package/dist-esm/shapes/TLHighlightShape.mjs +18 -0
- package/dist-esm/shapes/TLHighlightShape.mjs.map +7 -0
- package/dist-esm/shapes/TLImageShape.mjs +49 -0
- package/dist-esm/shapes/TLImageShape.mjs.map +7 -0
- package/dist-esm/shapes/TLLineShape.mjs +50 -0
- package/dist-esm/shapes/TLLineShape.mjs.map +7 -0
- package/dist-esm/shapes/TLNoteShape.mjs +126 -0
- package/dist-esm/shapes/TLNoteShape.mjs.map +7 -0
- package/dist-esm/shapes/TLTextShape.mjs +47 -0
- package/dist-esm/shapes/TLTextShape.mjs.map +7 -0
- package/dist-esm/shapes/TLVideoShape.mjs +33 -0
- package/dist-esm/shapes/TLVideoShape.mjs.map +7 -0
- package/dist-esm/store-migrations.mjs +61 -0
- package/dist-esm/store-migrations.mjs.map +7 -0
- package/dist-esm/styles/StyleProp.mjs +74 -0
- package/dist-esm/styles/StyleProp.mjs.map +7 -0
- package/dist-esm/styles/TLColorStyle.mjs +263 -0
- package/dist-esm/styles/TLColorStyle.mjs.map +7 -0
- package/dist-esm/styles/TLDashStyle.mjs +9 -0
- package/dist-esm/styles/TLDashStyle.mjs.map +7 -0
- package/dist-esm/styles/TLFillStyle.mjs +9 -0
- package/dist-esm/styles/TLFillStyle.mjs.map +7 -0
- package/dist-esm/styles/TLFontStyle.mjs +16 -0
- package/dist-esm/styles/TLFontStyle.mjs.map +7 -0
- package/dist-esm/styles/TLHorizontalAlignStyle.mjs +9 -0
- package/dist-esm/styles/TLHorizontalAlignStyle.mjs.map +7 -0
- package/dist-esm/styles/TLSizeStyle.mjs +9 -0
- package/dist-esm/styles/TLSizeStyle.mjs.map +7 -0
- package/dist-esm/styles/TLVerticalAlignStyle.mjs +9 -0
- package/dist-esm/styles/TLVerticalAlignStyle.mjs.map +7 -0
- package/dist-esm/translations/languages.mjs +39 -0
- package/dist-esm/translations/languages.mjs.map +7 -0
- package/dist-esm/translations/translations.mjs +43 -0
- package/dist-esm/translations/translations.mjs.map +7 -0
- package/dist-esm/util-types.mjs +1 -0
- package/dist-esm/util-types.mjs.map +7 -0
- package/package.json +64 -0
- package/src/TLStore.ts +160 -0
- package/src/assets/TLBaseAsset.ts +44 -0
- package/src/assets/TLBookmarkAsset.ts +31 -0
- package/src/assets/TLImageAsset.ts +73 -0
- package/src/assets/TLVideoAsset.ts +73 -0
- package/src/createPresenceStateDerivation.ts +53 -0
- package/src/createTLSchema.ts +65 -0
- package/src/index.ts +168 -0
- package/src/migrations.test.ts +1768 -0
- package/src/misc/TLColor.ts +28 -0
- package/src/misc/TLCursor.ts +54 -0
- package/src/misc/TLHandle.ts +41 -0
- package/src/misc/TLOpacity.ts +11 -0
- package/src/misc/TLScribble.ts +39 -0
- package/src/misc/geometry-types.ts +37 -0
- package/src/misc/id-validator.ts +14 -0
- package/src/records/TLAsset.ts +80 -0
- package/src/records/TLCamera.ts +74 -0
- package/src/records/TLDocument.ts +77 -0
- package/src/records/TLInstance.ts +493 -0
- package/src/records/TLPage.ts +72 -0
- package/src/records/TLPageState.ts +216 -0
- package/src/records/TLPointer.ts +74 -0
- package/src/records/TLPresence.ts +179 -0
- package/src/records/TLRecord.ts +21 -0
- package/src/records/TLShape.ts +214 -0
- package/src/shapes/TLArrowShape.ts +160 -0
- package/src/shapes/TLBaseShape.ts +67 -0
- package/src/shapes/TLBookmarkShape.ts +44 -0
- package/src/shapes/TLDrawShape.ts +89 -0
- package/src/shapes/TLEmbedShape.ts +754 -0
- package/src/shapes/TLFrameShape.ts +18 -0
- package/src/shapes/TLGeoShape.ts +226 -0
- package/src/shapes/TLGroupShape.ts +14 -0
- package/src/shapes/TLHighlightShape.ts +24 -0
- package/src/shapes/TLImageShape.ts +59 -0
- package/src/shapes/TLLineShape.ts +61 -0
- package/src/shapes/TLNoteShape.ts +137 -0
- package/src/shapes/TLTextShape.ts +55 -0
- package/src/shapes/TLVideoShape.ts +40 -0
- package/src/store-migrations.ts +63 -0
- package/src/styles/StyleProp.ts +105 -0
- package/src/styles/TLColorStyle.ts +296 -0
- package/src/styles/TLDashStyle.ts +11 -0
- package/src/styles/TLFillStyle.ts +11 -0
- package/src/styles/TLFontStyle.ts +19 -0
- package/src/styles/TLHorizontalAlignStyle.ts +11 -0
- package/src/styles/TLSizeStyle.ts +11 -0
- package/src/styles/TLVerticalAlignStyle.ts +11 -0
- package/src/translations/languages.ts +39 -0
- package/src/translations/translations.test.ts +43 -0
- package/src/translations/translations.ts +73 -0
- package/src/util-types.ts +2 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createPresenceStateDerivation_exports = {};
|
|
20
|
+
__export(createPresenceStateDerivation_exports, {
|
|
21
|
+
createPresenceStateDerivation: () => createPresenceStateDerivation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createPresenceStateDerivation_exports);
|
|
24
|
+
var import_state = require("@bigbluebutton/state");
|
|
25
|
+
var import_TLCamera = require("./records/TLCamera");
|
|
26
|
+
var import_TLInstance = require("./records/TLInstance");
|
|
27
|
+
var import_TLPageState = require("./records/TLPageState");
|
|
28
|
+
var import_TLPointer = require("./records/TLPointer");
|
|
29
|
+
var import_TLPresence = require("./records/TLPresence");
|
|
30
|
+
const createPresenceStateDerivation = ($user, instanceId) => (store) => {
|
|
31
|
+
return (0, import_state.computed)("instancePresence", () => {
|
|
32
|
+
const instance = store.get(import_TLInstance.TLINSTANCE_ID);
|
|
33
|
+
const pageState = store.get(import_TLPageState.InstancePageStateRecordType.createId(instance?.currentPageId));
|
|
34
|
+
const camera = store.get(import_TLCamera.CameraRecordType.createId(instance?.currentPageId));
|
|
35
|
+
const pointer = store.get(import_TLPointer.TLPOINTER_ID);
|
|
36
|
+
const user = $user.get();
|
|
37
|
+
if (!pageState || !instance || !camera || !pointer || !user) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return import_TLPresence.InstancePresenceRecordType.create({
|
|
41
|
+
id: instanceId ?? import_TLPresence.InstancePresenceRecordType.createId(store.id),
|
|
42
|
+
selectedShapeIds: pageState.selectedShapeIds,
|
|
43
|
+
brush: instance.brush,
|
|
44
|
+
scribbles: instance.scribbles,
|
|
45
|
+
userId: user.id,
|
|
46
|
+
userName: user.name,
|
|
47
|
+
followingUserId: instance.followingUserId,
|
|
48
|
+
camera: {
|
|
49
|
+
x: camera.x,
|
|
50
|
+
y: camera.y,
|
|
51
|
+
z: camera.z
|
|
52
|
+
},
|
|
53
|
+
color: user.color,
|
|
54
|
+
currentPageId: instance.currentPageId,
|
|
55
|
+
cursor: {
|
|
56
|
+
x: pointer.x,
|
|
57
|
+
y: pointer.y,
|
|
58
|
+
rotation: instance.cursor.rotation,
|
|
59
|
+
type: instance.cursor.type
|
|
60
|
+
},
|
|
61
|
+
lastActivityTimestamp: pointer.lastActivityTimestamp,
|
|
62
|
+
screenBounds: instance.screenBounds,
|
|
63
|
+
chatMessage: instance.chatMessage,
|
|
64
|
+
meta: {}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=createPresenceStateDerivation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createPresenceStateDerivation.ts"],
|
|
4
|
+
"sourcesContent": ["import { Signal, computed } from '@bigbluebutton/state'\nimport { TLStore } from './TLStore'\nimport { CameraRecordType } from './records/TLCamera'\nimport { TLINSTANCE_ID } from './records/TLInstance'\nimport { InstancePageStateRecordType } from './records/TLPageState'\nimport { TLPOINTER_ID } from './records/TLPointer'\nimport { InstancePresenceRecordType, TLInstancePresence } from './records/TLPresence'\n\n/** @public */\nexport const createPresenceStateDerivation =\n\t(\n\t\t$user: Signal<{ id: string; color: string; name: string }>,\n\t\tinstanceId?: TLInstancePresence['id']\n\t) =>\n\t(store: TLStore): Signal<TLInstancePresence | null> => {\n\t\treturn computed('instancePresence', () => {\n\t\t\tconst instance = store.get(TLINSTANCE_ID)\n\t\t\tconst pageState = store.get(InstancePageStateRecordType.createId(instance?.currentPageId))\n\t\t\tconst camera = store.get(CameraRecordType.createId(instance?.currentPageId))\n\t\t\tconst pointer = store.get(TLPOINTER_ID)\n\t\t\tconst user = $user.get()\n\t\t\tif (!pageState || !instance || !camera || !pointer || !user) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn InstancePresenceRecordType.create({\n\t\t\t\tid: instanceId ?? InstancePresenceRecordType.createId(store.id),\n\t\t\t\tselectedShapeIds: pageState.selectedShapeIds,\n\t\t\t\tbrush: instance.brush,\n\t\t\t\tscribbles: instance.scribbles,\n\t\t\t\tuserId: user.id,\n\t\t\t\tuserName: user.name,\n\t\t\t\tfollowingUserId: instance.followingUserId,\n\t\t\t\tcamera: {\n\t\t\t\t\tx: camera.x,\n\t\t\t\t\ty: camera.y,\n\t\t\t\t\tz: camera.z,\n\t\t\t\t},\n\t\t\t\tcolor: user.color,\n\t\t\t\tcurrentPageId: instance.currentPageId,\n\t\t\t\tcursor: {\n\t\t\t\t\tx: pointer.x,\n\t\t\t\t\ty: pointer.y,\n\t\t\t\t\trotation: instance.cursor.rotation,\n\t\t\t\t\ttype: instance.cursor.type,\n\t\t\t\t},\n\t\t\t\tlastActivityTimestamp: pointer.lastActivityTimestamp,\n\t\t\t\tscreenBounds: instance.screenBounds,\n\t\t\t\tchatMessage: instance.chatMessage,\n\t\t\t\tmeta: {},\n\t\t\t})\n\t\t})\n\t}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAEjC,sBAAiC;AACjC,wBAA8B;AAC9B,yBAA4C;AAC5C,uBAA6B;AAC7B,wBAA+D;AAGxD,MAAM,gCACZ,CACC,OACA,eAED,CAAC,UAAsD;AACtD,aAAO,uBAAS,oBAAoB,MAAM;AACzC,UAAM,WAAW,MAAM,IAAI,+BAAa;AACxC,UAAM,YAAY,MAAM,IAAI,+CAA4B,SAAS,UAAU,aAAa,CAAC;AACzF,UAAM,SAAS,MAAM,IAAI,iCAAiB,SAAS,UAAU,aAAa,CAAC;AAC3E,UAAM,UAAU,MAAM,IAAI,6BAAY;AACtC,UAAM,OAAO,MAAM,IAAI;AACvB,QAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM;AAC5D,aAAO;AAAA,IACR;AAEA,WAAO,6CAA2B,OAAO;AAAA,MACxC,IAAI,cAAc,6CAA2B,SAAS,MAAM,EAAE;AAAA,MAC9D,kBAAkB,UAAU;AAAA,MAC5B,OAAO,SAAS;AAAA,MAChB,WAAW,SAAS;AAAA,MACpB,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,iBAAiB,SAAS;AAAA,MAC1B,QAAQ;AAAA,QACP,GAAG,OAAO;AAAA,QACV,GAAG,OAAO;AAAA,QACV,GAAG,OAAO;AAAA,MACX;AAAA,MACA,OAAO,KAAK;AAAA,MACZ,eAAe,SAAS;AAAA,MACxB,QAAQ;AAAA,QACP,GAAG,QAAQ;AAAA,QACX,GAAG,QAAQ;AAAA,QACX,UAAU,SAAS,OAAO;AAAA,QAC1B,MAAM,SAAS,OAAO;AAAA,MACvB;AAAA,MACA,uBAAuB,QAAQ;AAAA,MAC/B,cAAc,SAAS;AAAA,MACvB,aAAa,SAAS;AAAA,MACtB,MAAM,CAAC;AAAA,IACR,CAAC;AAAA,EACF,CAAC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createTLSchema_exports = {};
|
|
20
|
+
__export(createTLSchema_exports, {
|
|
21
|
+
createTLSchema: () => createTLSchema
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createTLSchema_exports);
|
|
24
|
+
var import_store = require("@bigbluebutton/store");
|
|
25
|
+
var import_utils = require("@bigbluebutton/utils");
|
|
26
|
+
var import_TLStore = require("./TLStore");
|
|
27
|
+
var import_TLAsset = require("./records/TLAsset");
|
|
28
|
+
var import_TLCamera = require("./records/TLCamera");
|
|
29
|
+
var import_TLDocument = require("./records/TLDocument");
|
|
30
|
+
var import_TLInstance = require("./records/TLInstance");
|
|
31
|
+
var import_TLPage = require("./records/TLPage");
|
|
32
|
+
var import_TLPageState = require("./records/TLPageState");
|
|
33
|
+
var import_TLPointer = require("./records/TLPointer");
|
|
34
|
+
var import_TLPresence = require("./records/TLPresence");
|
|
35
|
+
var import_TLShape = require("./records/TLShape");
|
|
36
|
+
var import_store_migrations = require("./store-migrations");
|
|
37
|
+
function createTLSchema({ shapes }) {
|
|
38
|
+
const stylesById = /* @__PURE__ */ new Map();
|
|
39
|
+
for (const shape of (0, import_utils.objectMapValues)(shapes)) {
|
|
40
|
+
for (const style of (0, import_TLShape.getShapePropKeysByStyle)(shape.props ?? {}).keys()) {
|
|
41
|
+
if (stylesById.has(style.id) && stylesById.get(style.id) !== style) {
|
|
42
|
+
throw new Error(`Multiple StyleProp instances with the same id: ${style.id}`);
|
|
43
|
+
}
|
|
44
|
+
stylesById.set(style.id, style);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const ShapeRecordType = (0, import_TLShape.createShapeRecordType)(shapes);
|
|
48
|
+
const InstanceRecordType = (0, import_TLInstance.createInstanceRecordType)(stylesById);
|
|
49
|
+
return import_store.StoreSchema.create(
|
|
50
|
+
{
|
|
51
|
+
asset: import_TLAsset.AssetRecordType,
|
|
52
|
+
camera: import_TLCamera.CameraRecordType,
|
|
53
|
+
document: import_TLDocument.DocumentRecordType,
|
|
54
|
+
instance: InstanceRecordType,
|
|
55
|
+
instance_page_state: import_TLPageState.InstancePageStateRecordType,
|
|
56
|
+
page: import_TLPage.PageRecordType,
|
|
57
|
+
shape: ShapeRecordType,
|
|
58
|
+
instance_presence: import_TLPresence.InstancePresenceRecordType,
|
|
59
|
+
pointer: import_TLPointer.PointerRecordType
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
snapshotMigrations: import_store_migrations.storeMigrations,
|
|
63
|
+
onValidationFailure: import_TLStore.onValidationFailure,
|
|
64
|
+
createIntegrityChecker: import_TLStore.createIntegrityChecker
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=createTLSchema.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createTLSchema.ts"],
|
|
4
|
+
"sourcesContent": ["import { Migrations, StoreSchema } from '@bigbluebutton/store'\nimport { objectMapValues } from '@bigbluebutton/utils'\nimport { TLStoreProps, createIntegrityChecker, onValidationFailure } from './TLStore'\nimport { AssetRecordType } from './records/TLAsset'\nimport { CameraRecordType } from './records/TLCamera'\nimport { DocumentRecordType } from './records/TLDocument'\nimport { createInstanceRecordType } from './records/TLInstance'\nimport { PageRecordType } from './records/TLPage'\nimport { InstancePageStateRecordType } from './records/TLPageState'\nimport { PointerRecordType } from './records/TLPointer'\nimport { InstancePresenceRecordType } from './records/TLPresence'\nimport { TLRecord } from './records/TLRecord'\nimport { createShapeRecordType, getShapePropKeysByStyle } from './records/TLShape'\nimport { storeMigrations } from './store-migrations'\nimport { StyleProp } from './styles/StyleProp'\n\n/** @public */\nexport type SchemaShapeInfo = {\n\tmigrations?: Migrations\n\tprops?: Record<string, { validate: (prop: any) => any }>\n\tmeta?: Record<string, { validate: (prop: any) => any }>\n}\n\n/** @public */\nexport type TLSchema = StoreSchema<TLRecord, TLStoreProps>\n\n/**\n * Create a TLSchema with custom shapes. Custom shapes cannot override default shapes.\n *\n * @param opts - Options\n *\n * @public */\nexport function createTLSchema({ shapes }: { shapes: Record<string, SchemaShapeInfo> }): TLSchema {\n\tconst stylesById = new Map<string, StyleProp<unknown>>()\n\tfor (const shape of objectMapValues(shapes)) {\n\t\tfor (const style of getShapePropKeysByStyle(shape.props ?? {}).keys()) {\n\t\t\tif (stylesById.has(style.id) && stylesById.get(style.id) !== style) {\n\t\t\t\tthrow new Error(`Multiple StyleProp instances with the same id: ${style.id}`)\n\t\t\t}\n\t\t\tstylesById.set(style.id, style)\n\t\t}\n\t}\n\n\tconst ShapeRecordType = createShapeRecordType(shapes)\n\tconst InstanceRecordType = createInstanceRecordType(stylesById)\n\n\treturn StoreSchema.create(\n\t\t{\n\t\t\tasset: AssetRecordType,\n\t\t\tcamera: CameraRecordType,\n\t\t\tdocument: DocumentRecordType,\n\t\t\tinstance: InstanceRecordType,\n\t\t\tinstance_page_state: InstancePageStateRecordType,\n\t\t\tpage: PageRecordType,\n\t\t\tshape: ShapeRecordType,\n\t\t\tinstance_presence: InstancePresenceRecordType,\n\t\t\tpointer: PointerRecordType,\n\t\t},\n\t\t{\n\t\t\tsnapshotMigrations: storeMigrations,\n\t\t\tonValidationFailure,\n\t\t\tcreateIntegrityChecker: createIntegrityChecker,\n\t\t}\n\t)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AACxC,mBAAgC;AAChC,qBAA0E;AAC1E,qBAAgC;AAChC,sBAAiC;AACjC,wBAAmC;AACnC,wBAAyC;AACzC,oBAA+B;AAC/B,yBAA4C;AAC5C,uBAAkC;AAClC,wBAA2C;AAE3C,qBAA+D;AAC/D,8BAAgC;AAmBzB,SAAS,eAAe,EAAE,OAAO,GAA0D;AACjG,QAAM,aAAa,oBAAI,IAAgC;AACvD,aAAW,aAAS,8BAAgB,MAAM,GAAG;AAC5C,eAAW,aAAS,wCAAwB,MAAM,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG;AACtE,UAAI,WAAW,IAAI,MAAM,EAAE,KAAK,WAAW,IAAI,MAAM,EAAE,MAAM,OAAO;AACnE,cAAM,IAAI,MAAM,kDAAkD,MAAM,EAAE,EAAE;AAAA,MAC7E;AACA,iBAAW,IAAI,MAAM,IAAI,KAAK;AAAA,IAC/B;AAAA,EACD;AAEA,QAAM,sBAAkB,sCAAsB,MAAM;AACpD,QAAM,yBAAqB,4CAAyB,UAAU;AAE9D,SAAO,yBAAY;AAAA,IAClB;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,UAAU;AAAA,MACV,qBAAqB;AAAA,MACrB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,mBAAmB;AAAA,MACnB,SAAS;AAAA,IACV;AAAA,IACA;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,MACA,wBAAwB;AAAA,IACzB;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|