@inkandswitch/patchwork-pkg-base 0.0.23 → 0.0.24
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/modules.json +1 -0
- package/package.json +1 -1
- package/packages/codemirror-markdown/dist/extensions/embed.js +42 -107
- package/packages/codemirror-markdown/dist/extensions/embed.js.map +3 -3
- package/packages/embed/dist/assets/tool-Cg7zrpH9.js +236 -0
- package/packages/embed/dist/assets/tool-Cg7zrpH9.js.map +1 -0
- package/packages/embed/dist/index.js +94 -0
- package/packages/embed/dist/index.js.map +1 -0
- package/packages/embed/package.json +27 -0
- package/packages/tldraw4/dist/{chunk-VF5CY24G.js → chunk-GDYMD4VT.js} +146 -146
- package/packages/tldraw4/dist/{chunk-VF5CY24G.js.map → chunk-GDYMD4VT.js.map} +4 -4
- package/packages/tldraw4/dist/datatype.js +1 -1
- package/packages/tldraw4/dist/tool.js +75 -383
- package/packages/tldraw4/dist/tool.js.map +3 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const scriptRel = "modulepreload";
|
|
2
|
+
const assetsURL = function(dep, importerUrl) {
|
|
3
|
+
return new URL(dep, importerUrl).href;
|
|
4
|
+
};
|
|
5
|
+
const seen = {};
|
|
6
|
+
const __vitePreload = function preload(baseModule, deps, importerUrl) {
|
|
7
|
+
let promise = Promise.resolve();
|
|
8
|
+
if (deps && deps.length > 0) {
|
|
9
|
+
const links = document.getElementsByTagName("link");
|
|
10
|
+
const cspNonceMeta = document.querySelector(
|
|
11
|
+
"meta[property=csp-nonce]"
|
|
12
|
+
);
|
|
13
|
+
const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
|
|
14
|
+
promise = Promise.allSettled(
|
|
15
|
+
deps.map((dep) => {
|
|
16
|
+
dep = assetsURL(dep, importerUrl);
|
|
17
|
+
if (dep in seen) return;
|
|
18
|
+
seen[dep] = true;
|
|
19
|
+
const isCss = dep.endsWith(".css");
|
|
20
|
+
const cssSelector = isCss ? '[rel="stylesheet"]' : "";
|
|
21
|
+
const isBaseRelative = !!importerUrl;
|
|
22
|
+
if (isBaseRelative) {
|
|
23
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
24
|
+
const link2 = links[i];
|
|
25
|
+
if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const link = document.createElement("link");
|
|
33
|
+
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
34
|
+
if (!isCss) {
|
|
35
|
+
link.as = "script";
|
|
36
|
+
}
|
|
37
|
+
link.crossOrigin = "";
|
|
38
|
+
link.href = dep;
|
|
39
|
+
if (cspNonce) {
|
|
40
|
+
link.setAttribute("nonce", cspNonce);
|
|
41
|
+
}
|
|
42
|
+
document.head.appendChild(link);
|
|
43
|
+
if (isCss) {
|
|
44
|
+
return new Promise((res, rej) => {
|
|
45
|
+
link.addEventListener("load", res);
|
|
46
|
+
link.addEventListener(
|
|
47
|
+
"error",
|
|
48
|
+
() => rej(new Error(`Unable to preload CSS for ${dep}`))
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function handlePreloadError(err) {
|
|
56
|
+
const e = new Event("vite:preloadError", {
|
|
57
|
+
cancelable: true
|
|
58
|
+
});
|
|
59
|
+
e.payload = err;
|
|
60
|
+
window.dispatchEvent(e);
|
|
61
|
+
if (!e.defaultPrevented) {
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return promise.then((res) => {
|
|
66
|
+
for (const item of res || []) {
|
|
67
|
+
if (item.status !== "rejected") continue;
|
|
68
|
+
handlePreloadError(item.reason);
|
|
69
|
+
}
|
|
70
|
+
return baseModule().catch(handlePreloadError);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const plugins = [
|
|
74
|
+
{
|
|
75
|
+
type: "patchwork:tool",
|
|
76
|
+
id: "embed",
|
|
77
|
+
name: "Embed",
|
|
78
|
+
icon: "PictureInPicture2",
|
|
79
|
+
supportedDatatypes: "*",
|
|
80
|
+
// Load-bearing: keeps "Embed" out of pickers and out of getFallbackTool,
|
|
81
|
+
// which would otherwise recurse (embed frame falling back to itself).
|
|
82
|
+
unlisted: true,
|
|
83
|
+
async load() {
|
|
84
|
+
return (await __vitePreload(async () => {
|
|
85
|
+
const { default: __vite_default__ } = await import("./assets/tool-Cg7zrpH9.js");
|
|
86
|
+
return { default: __vite_default__ };
|
|
87
|
+
}, true ? [] : void 0, import.meta.url)).default;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
export {
|
|
92
|
+
plugins
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,UAAkB;AAAA,EAC7B;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,oBAAoB;AAAA;AAAA;AAAA,IAGpB,UAAU;AAAA,IACV,MAAM,OAAO;AACX,cAAQ;AAAA,oDAAM,OAAO,2BAAQ;AAAA;AAAA,+CAAG;AAAA,IAClC;AAAA;AAEJ","names":[],"ignoreList":[],"sources":["../src/index.ts"],"sourcesContent":["// Metadata only: Patchwork evaluates this entry in a worker (no importmap, no\n// DOM), so no runtime imports here — the implementation loads lazily.\nimport type { Tool } from \"@inkandswitch/patchwork-plugins\";\n\nexport const plugins: Tool[] = [\n {\n type: \"patchwork:tool\",\n id: \"embed\",\n name: \"Embed\",\n icon: \"PictureInPicture2\",\n supportedDatatypes: \"*\",\n // Load-bearing: keeps \"Embed\" out of pickers and out of getFallbackTool,\n // which would otherwise recurse (embed frame falling back to itself).\n unlisted: true,\n async load() {\n return (await import(\"./tool\")).default;\n },\n },\n];\n"],"file":"index.js"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "embed",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Shared embed frame: title bar, tool picker, and open button around a nested patchwork-view",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"push": "pnpm build && pushwork sync",
|
|
11
|
+
"register": "pw-modules add \"$MODULE_SETTINGS_DOC_URL\" \"$(pushwork url)\""
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@inkandswitch/patchwork-bootloader": "^0.2.8",
|
|
15
|
+
"@inkandswitch/patchwork-elements": "1.0.0",
|
|
16
|
+
"@inkandswitch/patchwork-filesystem": "^0.0.8",
|
|
17
|
+
"@inkandswitch/patchwork-plugins": "^0.0.11",
|
|
18
|
+
"solid-js": "^1.9.11"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@automerge/automerge-repo": "^2.6.0-subduction.9",
|
|
22
|
+
"typescript": "~5.9.3",
|
|
23
|
+
"vite": "^5.4.21",
|
|
24
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
25
|
+
"vite-plugin-solid": "^2.11.10"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -38531,50 +38531,6 @@ registerTldrawLibraryVersion(
|
|
|
38531
38531
|
"esm"
|
|
38532
38532
|
);
|
|
38533
38533
|
|
|
38534
|
-
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useEditor.mjs
|
|
38535
|
-
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
38536
|
-
var import_react2 = __toESM(require_react(), 1);
|
|
38537
|
-
|
|
38538
|
-
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useSafeId.mjs
|
|
38539
|
-
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
38540
|
-
var import_react = __toESM(require_react(), 1);
|
|
38541
|
-
function suffixSafeId(id, suffix) {
|
|
38542
|
-
return sanitizeId(`${id}_${suffix}`);
|
|
38543
|
-
}
|
|
38544
|
-
function useUniqueSafeId(suffix) {
|
|
38545
|
-
return sanitizeId(`${(0, import_react.useId)()}${suffix ?? ""}`);
|
|
38546
|
-
}
|
|
38547
|
-
function useSharedSafeId(id) {
|
|
38548
|
-
const idScope = assertExists((0, import_react.useContext)(IdContext));
|
|
38549
|
-
return sanitizeId(`${idScope}_${id}`);
|
|
38550
|
-
}
|
|
38551
|
-
function sanitizeId(id) {
|
|
38552
|
-
return id.replace(/:/g, "_");
|
|
38553
|
-
}
|
|
38554
|
-
var IdContext = (0, import_react.createContext)(null);
|
|
38555
|
-
function IdProvider({ children }) {
|
|
38556
|
-
const id = useUniqueSafeId();
|
|
38557
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdContext.Provider, { value: id, children });
|
|
38558
|
-
}
|
|
38559
|
-
|
|
38560
|
-
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useEditor.mjs
|
|
38561
|
-
var EditorContext = (0, import_react2.createContext)(null);
|
|
38562
|
-
function useEditor() {
|
|
38563
|
-
const editor = import_react2.default.useContext(EditorContext);
|
|
38564
|
-
if (!editor) {
|
|
38565
|
-
throw new Error(
|
|
38566
|
-
"useEditor must be used inside of the <Tldraw /> or <TldrawEditor /> components"
|
|
38567
|
-
);
|
|
38568
|
-
}
|
|
38569
|
-
return editor;
|
|
38570
|
-
}
|
|
38571
|
-
function useMaybeEditor() {
|
|
38572
|
-
return import_react2.default.useContext(EditorContext);
|
|
38573
|
-
}
|
|
38574
|
-
function EditorProvider({ editor, children }) {
|
|
38575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EditorContext.Provider, { value: editor, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IdProvider, { children }) });
|
|
38576
|
-
}
|
|
38577
|
-
|
|
38578
38534
|
// ../node_modules/.pnpm/@tldraw+store@4.3.1_react@18.3.1/node_modules/@tldraw/store/dist-esm/lib/ImmutableMap.mjs
|
|
38579
38535
|
function smi(i32) {
|
|
38580
38536
|
return i32 >>> 1 & 1073741824 | i32 & 3221225471;
|
|
@@ -44085,6 +44041,9 @@ registerTldrawLibraryVersion(
|
|
|
44085
44041
|
"esm"
|
|
44086
44042
|
);
|
|
44087
44043
|
|
|
44044
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/TLOpacity.mjs
|
|
44045
|
+
var opacityValidator = validation_exports.unitInterval;
|
|
44046
|
+
|
|
44088
44047
|
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/id-validator.mjs
|
|
44089
44048
|
function idValidator(prefix) {
|
|
44090
44049
|
return validation_exports.string.refine((id) => {
|
|
@@ -44095,34 +44054,6 @@ function idValidator(prefix) {
|
|
|
44095
44054
|
});
|
|
44096
44055
|
}
|
|
44097
44056
|
|
|
44098
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/assets/TLBaseAsset.mjs
|
|
44099
|
-
var assetIdValidator = idValidator("asset");
|
|
44100
|
-
function createAssetValidator(type, props) {
|
|
44101
|
-
return validation_exports.object({
|
|
44102
|
-
id: assetIdValidator,
|
|
44103
|
-
typeName: validation_exports.literal("asset"),
|
|
44104
|
-
type: validation_exports.literal(type),
|
|
44105
|
-
props,
|
|
44106
|
-
meta: validation_exports.jsonValue
|
|
44107
|
-
});
|
|
44108
|
-
}
|
|
44109
|
-
|
|
44110
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/geometry-types.mjs
|
|
44111
|
-
var vecModelValidator = validation_exports.object({
|
|
44112
|
-
x: validation_exports.number,
|
|
44113
|
-
y: validation_exports.number,
|
|
44114
|
-
z: validation_exports.number.optional()
|
|
44115
|
-
});
|
|
44116
|
-
var boxModelValidator = validation_exports.object({
|
|
44117
|
-
x: validation_exports.number,
|
|
44118
|
-
y: validation_exports.number,
|
|
44119
|
-
w: validation_exports.number,
|
|
44120
|
-
h: validation_exports.number
|
|
44121
|
-
});
|
|
44122
|
-
|
|
44123
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/TLOpacity.mjs
|
|
44124
|
-
var opacityValidator = validation_exports.unitInterval;
|
|
44125
|
-
|
|
44126
44057
|
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/shapes/TLBaseShape.mjs
|
|
44127
44058
|
var parentIdValidator = validation_exports.string.refine((id) => {
|
|
44128
44059
|
if (!id.startsWith("page:") && !id.startsWith("shape:")) {
|
|
@@ -44148,79 +44079,6 @@ function createShapeValidator(type, props, meta) {
|
|
|
44148
44079
|
});
|
|
44149
44080
|
}
|
|
44150
44081
|
|
|
44151
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/bindings/TLBaseBinding.mjs
|
|
44152
|
-
var bindingIdValidator = idValidator("binding");
|
|
44153
|
-
function createBindingValidator(type, props, meta) {
|
|
44154
|
-
return validation_exports.object({
|
|
44155
|
-
id: bindingIdValidator,
|
|
44156
|
-
typeName: validation_exports.literal("binding"),
|
|
44157
|
-
type: validation_exports.literal(type),
|
|
44158
|
-
fromId: shapeIdValidator,
|
|
44159
|
-
toId: shapeIdValidator,
|
|
44160
|
-
props: props ? validation_exports.object(props) : validation_exports.jsonValue,
|
|
44161
|
-
meta: meta ? validation_exports.object(meta) : validation_exports.jsonValue
|
|
44162
|
-
});
|
|
44163
|
-
}
|
|
44164
|
-
|
|
44165
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/records/TLBinding.mjs
|
|
44166
|
-
var rootBindingVersions = createMigrationIds("com.tldraw.binding", {});
|
|
44167
|
-
var rootBindingMigrations = createRecordMigrationSequence({
|
|
44168
|
-
sequenceId: "com.tldraw.binding",
|
|
44169
|
-
recordType: "binding",
|
|
44170
|
-
sequence: []
|
|
44171
|
-
});
|
|
44172
|
-
function createBindingId(id) {
|
|
44173
|
-
return `binding:${id ?? uniqueId()}`;
|
|
44174
|
-
}
|
|
44175
|
-
function createBindingPropsMigrationSequence(migrations) {
|
|
44176
|
-
return migrations;
|
|
44177
|
-
}
|
|
44178
|
-
function createBindingPropsMigrationIds(bindingType, ids) {
|
|
44179
|
-
return mapObjectMapValues(ids, (_k, v) => `com.tldraw.binding.${bindingType}/${v}`);
|
|
44180
|
-
}
|
|
44181
|
-
function createBindingRecordType(bindings) {
|
|
44182
|
-
return createRecordType("binding", {
|
|
44183
|
-
scope: "document",
|
|
44184
|
-
validator: validation_exports.model(
|
|
44185
|
-
"binding",
|
|
44186
|
-
validation_exports.union(
|
|
44187
|
-
"type",
|
|
44188
|
-
mapObjectMapValues(
|
|
44189
|
-
bindings,
|
|
44190
|
-
(type, { props, meta }) => createBindingValidator(type, props, meta)
|
|
44191
|
-
)
|
|
44192
|
-
)
|
|
44193
|
-
)
|
|
44194
|
-
}).withDefaultProperties(() => ({
|
|
44195
|
-
meta: {}
|
|
44196
|
-
}));
|
|
44197
|
-
}
|
|
44198
|
-
|
|
44199
|
-
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/TLRichText.mjs
|
|
44200
|
-
var richTextValidator = validation_exports.object({
|
|
44201
|
-
type: validation_exports.string,
|
|
44202
|
-
content: validation_exports.arrayOf(validation_exports.unknown),
|
|
44203
|
-
attrs: validation_exports.any.optional()
|
|
44204
|
-
});
|
|
44205
|
-
function toRichText(text) {
|
|
44206
|
-
const lines = text.split("\n");
|
|
44207
|
-
const content = lines.map((text2) => {
|
|
44208
|
-
if (!text2) {
|
|
44209
|
-
return {
|
|
44210
|
-
type: "paragraph"
|
|
44211
|
-
};
|
|
44212
|
-
}
|
|
44213
|
-
return {
|
|
44214
|
-
type: "paragraph",
|
|
44215
|
-
content: [{ type: "text", text: text2 }]
|
|
44216
|
-
};
|
|
44217
|
-
});
|
|
44218
|
-
return {
|
|
44219
|
-
type: "doc",
|
|
44220
|
-
content
|
|
44221
|
-
};
|
|
44222
|
-
}
|
|
44223
|
-
|
|
44224
44082
|
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/styles/StyleProp.mjs
|
|
44225
44083
|
var StyleProp = class _StyleProp {
|
|
44226
44084
|
/** @internal */
|
|
@@ -44405,6 +44263,104 @@ function createShapeRecordType(shapes) {
|
|
|
44405
44263
|
}));
|
|
44406
44264
|
}
|
|
44407
44265
|
|
|
44266
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/assets/TLBaseAsset.mjs
|
|
44267
|
+
var assetIdValidator = idValidator("asset");
|
|
44268
|
+
function createAssetValidator(type, props) {
|
|
44269
|
+
return validation_exports.object({
|
|
44270
|
+
id: assetIdValidator,
|
|
44271
|
+
typeName: validation_exports.literal("asset"),
|
|
44272
|
+
type: validation_exports.literal(type),
|
|
44273
|
+
props,
|
|
44274
|
+
meta: validation_exports.jsonValue
|
|
44275
|
+
});
|
|
44276
|
+
}
|
|
44277
|
+
|
|
44278
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/geometry-types.mjs
|
|
44279
|
+
var vecModelValidator = validation_exports.object({
|
|
44280
|
+
x: validation_exports.number,
|
|
44281
|
+
y: validation_exports.number,
|
|
44282
|
+
z: validation_exports.number.optional()
|
|
44283
|
+
});
|
|
44284
|
+
var boxModelValidator = validation_exports.object({
|
|
44285
|
+
x: validation_exports.number,
|
|
44286
|
+
y: validation_exports.number,
|
|
44287
|
+
w: validation_exports.number,
|
|
44288
|
+
h: validation_exports.number
|
|
44289
|
+
});
|
|
44290
|
+
|
|
44291
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/bindings/TLBaseBinding.mjs
|
|
44292
|
+
var bindingIdValidator = idValidator("binding");
|
|
44293
|
+
function createBindingValidator(type, props, meta) {
|
|
44294
|
+
return validation_exports.object({
|
|
44295
|
+
id: bindingIdValidator,
|
|
44296
|
+
typeName: validation_exports.literal("binding"),
|
|
44297
|
+
type: validation_exports.literal(type),
|
|
44298
|
+
fromId: shapeIdValidator,
|
|
44299
|
+
toId: shapeIdValidator,
|
|
44300
|
+
props: props ? validation_exports.object(props) : validation_exports.jsonValue,
|
|
44301
|
+
meta: meta ? validation_exports.object(meta) : validation_exports.jsonValue
|
|
44302
|
+
});
|
|
44303
|
+
}
|
|
44304
|
+
|
|
44305
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/records/TLBinding.mjs
|
|
44306
|
+
var rootBindingVersions = createMigrationIds("com.tldraw.binding", {});
|
|
44307
|
+
var rootBindingMigrations = createRecordMigrationSequence({
|
|
44308
|
+
sequenceId: "com.tldraw.binding",
|
|
44309
|
+
recordType: "binding",
|
|
44310
|
+
sequence: []
|
|
44311
|
+
});
|
|
44312
|
+
function createBindingId(id) {
|
|
44313
|
+
return `binding:${id ?? uniqueId()}`;
|
|
44314
|
+
}
|
|
44315
|
+
function createBindingPropsMigrationSequence(migrations) {
|
|
44316
|
+
return migrations;
|
|
44317
|
+
}
|
|
44318
|
+
function createBindingPropsMigrationIds(bindingType, ids) {
|
|
44319
|
+
return mapObjectMapValues(ids, (_k, v) => `com.tldraw.binding.${bindingType}/${v}`);
|
|
44320
|
+
}
|
|
44321
|
+
function createBindingRecordType(bindings) {
|
|
44322
|
+
return createRecordType("binding", {
|
|
44323
|
+
scope: "document",
|
|
44324
|
+
validator: validation_exports.model(
|
|
44325
|
+
"binding",
|
|
44326
|
+
validation_exports.union(
|
|
44327
|
+
"type",
|
|
44328
|
+
mapObjectMapValues(
|
|
44329
|
+
bindings,
|
|
44330
|
+
(type, { props, meta }) => createBindingValidator(type, props, meta)
|
|
44331
|
+
)
|
|
44332
|
+
)
|
|
44333
|
+
)
|
|
44334
|
+
}).withDefaultProperties(() => ({
|
|
44335
|
+
meta: {}
|
|
44336
|
+
}));
|
|
44337
|
+
}
|
|
44338
|
+
|
|
44339
|
+
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/misc/TLRichText.mjs
|
|
44340
|
+
var richTextValidator = validation_exports.object({
|
|
44341
|
+
type: validation_exports.string,
|
|
44342
|
+
content: validation_exports.arrayOf(validation_exports.unknown),
|
|
44343
|
+
attrs: validation_exports.any.optional()
|
|
44344
|
+
});
|
|
44345
|
+
function toRichText(text) {
|
|
44346
|
+
const lines = text.split("\n");
|
|
44347
|
+
const content = lines.map((text2) => {
|
|
44348
|
+
if (!text2) {
|
|
44349
|
+
return {
|
|
44350
|
+
type: "paragraph"
|
|
44351
|
+
};
|
|
44352
|
+
}
|
|
44353
|
+
return {
|
|
44354
|
+
type: "paragraph",
|
|
44355
|
+
content: [{ type: "text", text: text2 }]
|
|
44356
|
+
};
|
|
44357
|
+
});
|
|
44358
|
+
return {
|
|
44359
|
+
type: "doc",
|
|
44360
|
+
content
|
|
44361
|
+
};
|
|
44362
|
+
}
|
|
44363
|
+
|
|
44408
44364
|
// ../node_modules/.pnpm/@tldraw+tlschema@4.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tldraw/tlschema/dist-esm/recordsWithProps.mjs
|
|
44409
44365
|
function processPropsMigrations(typeName, records) {
|
|
44410
44366
|
const result = [];
|
|
@@ -48320,6 +48276,50 @@ registerTldrawLibraryVersion(
|
|
|
48320
48276
|
"esm"
|
|
48321
48277
|
);
|
|
48322
48278
|
|
|
48279
|
+
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useEditor.mjs
|
|
48280
|
+
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
48281
|
+
var import_react2 = __toESM(require_react(), 1);
|
|
48282
|
+
|
|
48283
|
+
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useSafeId.mjs
|
|
48284
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
48285
|
+
var import_react = __toESM(require_react(), 1);
|
|
48286
|
+
function suffixSafeId(id, suffix) {
|
|
48287
|
+
return sanitizeId(`${id}_${suffix}`);
|
|
48288
|
+
}
|
|
48289
|
+
function useUniqueSafeId(suffix) {
|
|
48290
|
+
return sanitizeId(`${(0, import_react.useId)()}${suffix ?? ""}`);
|
|
48291
|
+
}
|
|
48292
|
+
function useSharedSafeId(id) {
|
|
48293
|
+
const idScope = assertExists((0, import_react.useContext)(IdContext));
|
|
48294
|
+
return sanitizeId(`${idScope}_${id}`);
|
|
48295
|
+
}
|
|
48296
|
+
function sanitizeId(id) {
|
|
48297
|
+
return id.replace(/:/g, "_");
|
|
48298
|
+
}
|
|
48299
|
+
var IdContext = (0, import_react.createContext)(null);
|
|
48300
|
+
function IdProvider({ children }) {
|
|
48301
|
+
const id = useUniqueSafeId();
|
|
48302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdContext.Provider, { value: id, children });
|
|
48303
|
+
}
|
|
48304
|
+
|
|
48305
|
+
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/hooks/useEditor.mjs
|
|
48306
|
+
var EditorContext = (0, import_react2.createContext)(null);
|
|
48307
|
+
function useEditor() {
|
|
48308
|
+
const editor = import_react2.default.useContext(EditorContext);
|
|
48309
|
+
if (!editor) {
|
|
48310
|
+
throw new Error(
|
|
48311
|
+
"useEditor must be used inside of the <Tldraw /> or <TldrawEditor /> components"
|
|
48312
|
+
);
|
|
48313
|
+
}
|
|
48314
|
+
return editor;
|
|
48315
|
+
}
|
|
48316
|
+
function useMaybeEditor() {
|
|
48317
|
+
return import_react2.default.useContext(EditorContext);
|
|
48318
|
+
}
|
|
48319
|
+
function EditorProvider({ editor, children }) {
|
|
48320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EditorContext.Provider, { value: editor, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IdProvider, { children }) });
|
|
48321
|
+
}
|
|
48322
|
+
|
|
48323
48323
|
// ../node_modules/.pnpm/@tldraw+editor@4.3.1_@floating-ui+dom@1.8.0_@types+react-dom@18.3.7_@types+react@18.3.3_3081f05cd840b04b22960e65d9baabe3/node_modules/@tldraw/editor/dist-esm/lib/editor/Editor.mjs
|
|
48324
48324
|
var import_eventemitter3 = __toESM(require_eventemitter3(), 1);
|
|
48325
48325
|
|
|
@@ -140891,4 +140891,4 @@ tldraw/dist-esm/lib/shapes/shared/PathBuilder.mjs:
|
|
|
140891
140891
|
* https://github.com/adobe-webplatform/Snap.svg/blob/c8e483c9694517e24b282f8f59f985629f4994ce/dist/snap.svg.js#L5786
|
|
140892
140892
|
*)
|
|
140893
140893
|
*/
|
|
140894
|
-
//# sourceMappingURL=chunk-
|
|
140894
|
+
//# sourceMappingURL=chunk-GDYMD4VT.js.map
|