tempo-sdk 0.0.87 → 0.0.92
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/astro.js +7 -7
- package/dist/canvas/astro.js +1 -1
- package/dist/canvas/editor.js +1 -1
- package/dist/canvas/index.js +2 -2
- package/dist/canvas/interact-projection.js +1 -1
- package/dist/canvas/parser.js +1 -1
- package/dist/canvas/svelte.js +10 -2
- package/dist/canvas/svelte.js.map +1 -1
- package/dist/canvas/vue.js +1 -1
- package/dist/{chunk-RQ54RXOY.js → chunk-3XEEVCM3.js} +36 -12
- package/dist/chunk-3XEEVCM3.js.map +1 -0
- package/dist/{chunk-2ZQMVAFM.js → chunk-6SOP4XU6.js} +98 -33
- package/dist/chunk-6SOP4XU6.js.map +1 -0
- package/dist/{chunk-Y72PIE3I.js → chunk-AFXE462X.js} +5 -4
- package/dist/{chunk-Y72PIE3I.js.map → chunk-AFXE462X.js.map} +1 -1
- package/dist/{chunk-DMT5MRMS.js → chunk-BQPKOVI5.js} +4 -3
- package/dist/{chunk-DMT5MRMS.js.map → chunk-BQPKOVI5.js.map} +1 -1
- package/dist/{chunk-PTL3UFIF.js → chunk-FENUT2N2.js} +2 -2
- package/dist/{chunk-PTL3UFIF.js.map → chunk-FENUT2N2.js.map} +1 -1
- package/dist/{chunk-H6OZIX2U.js → chunk-FGWGY3G3.js} +27 -3
- package/dist/chunk-FGWGY3G3.js.map +1 -0
- package/dist/{chunk-CXGAJRK7.js → chunk-KQSOE4KZ.js} +7 -7
- package/dist/chunk-MU7S7NU7.js +183 -0
- package/dist/chunk-MU7S7NU7.js.map +1 -0
- package/dist/{chunk-PPIIUCX5.js → chunk-NXPP3CSM.js} +5 -4
- package/dist/chunk-NXPP3CSM.js.map +1 -0
- package/dist/{chunk-GVH7HUMT.js → chunk-RZ3TG6MV.js} +2 -2
- package/dist/{chunk-GVH7HUMT.js.map → chunk-RZ3TG6MV.js.map} +1 -1
- package/dist/{chunk-AUG3ZWTR.js → chunk-TWW2DL7E.js} +2 -2
- package/dist/{chunk-AUG3ZWTR.js.map → chunk-TWW2DL7E.js.map} +1 -1
- package/dist/{chunk-5VIBKVFO.js → chunk-U66QI3EN.js} +28 -18
- package/dist/chunk-U66QI3EN.js.map +1 -0
- package/dist/{controls-reader-Z7OQWYWQ.js → controls-reader-5MFHYBZZ.js} +4 -4
- package/dist/expo/plugin.cjs +97 -32
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +97 -32
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.d.cts +2 -0
- package/dist/expo-babel-plugin.d.ts +2 -0
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -6
- package/dist/nextjs/plugin.cjs +1 -1
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +126 -37
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +2 -0
- package/dist/nextjs.d.ts +2 -0
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.js +1 -1
- package/dist/nuxt.js +230 -53
- package/dist/nuxt.js.map +1 -1
- package/dist/svelte.js +99 -24
- package/dist/svelte.js.map +1 -1
- package/dist/vue.js +120 -22
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2ZQMVAFM.js.map +0 -1
- package/dist/chunk-5VIBKVFO.js.map +0 -1
- package/dist/chunk-H6BQZOAW.js +0 -121
- package/dist/chunk-H6BQZOAW.js.map +0 -1
- package/dist/chunk-H6OZIX2U.js.map +0 -1
- package/dist/chunk-PPIIUCX5.js.map +0 -1
- package/dist/chunk-RQ54RXOY.js.map +0 -1
- /package/dist/{chunk-CXGAJRK7.js.map → chunk-KQSOE4KZ.js.map} +0 -0
- /package/dist/{controls-reader-Z7OQWYWQ.js.map → controls-reader-5MFHYBZZ.js.map} +0 -0
package/dist/vue.js
CHANGED
|
@@ -10,15 +10,16 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
TEMPO_VUE_ANNOTATION_PLUGIN_NAME,
|
|
12
12
|
createSdkFileMatcher
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TWW2DL7E.js";
|
|
14
14
|
import {
|
|
15
15
|
appendModuleVersionRecord
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BQPKOVI5.js";
|
|
17
17
|
import {
|
|
18
18
|
DYNAMIC_SLOT_FACT,
|
|
19
19
|
EXPRESSION_FACTS_ATTRIBUTE,
|
|
20
|
+
readLiteralExpression,
|
|
20
21
|
sourceVersionHash
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MU7S7NU7.js";
|
|
22
23
|
import {
|
|
23
24
|
TEMPO_VUE_INVOCATION_MARKER_PREFIX,
|
|
24
25
|
TEMPO_VUE_SOURCE_REGISTRY_GLOBAL
|
|
@@ -51,6 +52,8 @@ var SIMPLE_EXPRESSION_NODE = 4;
|
|
|
51
52
|
var INTERPOLATION_NODE = 5;
|
|
52
53
|
var ATTRIBUTE_NODE = 6;
|
|
53
54
|
var NATIVE_TAG = 0;
|
|
55
|
+
var SVG_NAMESPACE = 1;
|
|
56
|
+
var MATH_NAMESPACE = 2;
|
|
54
57
|
var COMPONENT_TAG = 1;
|
|
55
58
|
var STRUCTURAL_TEMPLATE_TAG = 3;
|
|
56
59
|
var BUILT_IN_COMPONENT_TAGS = /* @__PURE__ */ new Set([
|
|
@@ -139,10 +142,11 @@ function parseVueSource(source, filename = "Component.vue") {
|
|
|
139
142
|
openingEnd
|
|
140
143
|
);
|
|
141
144
|
const inVPre = parent !== null && (parent.vPre || parent.inVPre);
|
|
142
|
-
const opensScope = kind === "
|
|
145
|
+
const opensScope = kind === "dynamic-element" || isBuiltInComponent(child) || child.tag === "template" || vPre || hasDirective(child, SCOPE_DIRECTIVES);
|
|
143
146
|
const info = {
|
|
144
147
|
kind,
|
|
145
148
|
tagName: child.tag,
|
|
149
|
+
namespace: child.ns === SVG_NAMESPACE ? "svg" : child.ns === MATH_NAMESPACE ? "mathml" : "html",
|
|
146
150
|
start,
|
|
147
151
|
end,
|
|
148
152
|
propsEnd,
|
|
@@ -255,13 +259,19 @@ function readProp(prop) {
|
|
|
255
259
|
if (prop.name === "bind") {
|
|
256
260
|
const arg = prop.arg;
|
|
257
261
|
const staticName = arg?.type === SIMPLE_EXPRESSION_NODE && arg.isStatic ? arg.content : null;
|
|
262
|
+
const style = staticName === "style" ? boundStyleObject(prop) : void 0;
|
|
263
|
+
const literal = staticName !== null && staticName !== "style" && staticName !== "class" ? boundLiteral(prop) : null;
|
|
258
264
|
return {
|
|
259
265
|
kind: "bind",
|
|
260
266
|
name: staticName,
|
|
261
267
|
objectBind: arg === void 0,
|
|
262
268
|
rawName,
|
|
263
269
|
...expression,
|
|
264
|
-
...
|
|
270
|
+
...literal ? { literal } : {},
|
|
271
|
+
...style === void 0 ? {} : {
|
|
272
|
+
styleKeys: style && style.entries.map((entry) => entry.key),
|
|
273
|
+
styleObject: style
|
|
274
|
+
},
|
|
265
275
|
start,
|
|
266
276
|
end
|
|
267
277
|
};
|
|
@@ -275,33 +285,93 @@ function readProp(prop) {
|
|
|
275
285
|
end
|
|
276
286
|
};
|
|
277
287
|
}
|
|
278
|
-
function
|
|
288
|
+
function boundStyleObject(prop) {
|
|
279
289
|
const exp = prop.exp;
|
|
280
290
|
if (!exp || exp.type !== SIMPLE_EXPRESSION_NODE) return null;
|
|
281
291
|
let ast = exp.ast;
|
|
282
|
-
if (ast === void 0)
|
|
283
|
-
try {
|
|
284
|
-
const program = babelParse(`(${exp.content})`, {
|
|
285
|
-
plugins: ["typescript"]
|
|
286
|
-
}).program;
|
|
287
|
-
const statement = program.body[0];
|
|
288
|
-
ast = statement?.type === "ExpressionStatement" ? statement.expression : null;
|
|
289
|
-
} catch {
|
|
290
|
-
ast = null;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
292
|
+
if (ast === void 0) ast = parseWrapped(exp.content);
|
|
293
293
|
if (!ast) return null;
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
294
|
+
const object = unwrapTypeScript(ast);
|
|
295
|
+
if (object.type !== "ObjectExpression") return null;
|
|
296
296
|
const keys = [];
|
|
297
|
-
for (const property of
|
|
297
|
+
for (const property of object.properties) {
|
|
298
298
|
if (property.type === "SpreadElement" || property.computed) return null;
|
|
299
299
|
if (property.key.type === "Identifier") keys.push(property.key.name);
|
|
300
300
|
else if (property.key.type === "StringLiteral")
|
|
301
301
|
keys.push(camelCaseStyleKey(property.key.value));
|
|
302
302
|
else return null;
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
const delimiter = prop.loc.source[exp.loc.start.offset - prop.loc.start.offset - 1];
|
|
305
|
+
const quote = delimiter === '"' || delimiter === "'" ? delimiter : null;
|
|
306
|
+
const raw = quote === null ? null : rawOffsets(exp.loc.source, exp.content);
|
|
307
|
+
const at = (offset) => raw && typeof offset === "number" ? exp.loc.start.offset + raw[offset - 1] : null;
|
|
308
|
+
const entries = object.properties.map((property, index) => {
|
|
309
|
+
const value = property.type === "ObjectProperty" ? property.value : void 0;
|
|
310
|
+
const literal = property.type === "ObjectProperty" && !property.shorthand && raw ? readLiteralExpression(
|
|
311
|
+
property.value
|
|
312
|
+
) : null;
|
|
313
|
+
return {
|
|
314
|
+
key: keys[index],
|
|
315
|
+
literal: typeof literal === "string" || typeof literal === "number" ? literal : null,
|
|
316
|
+
start: at(property.start),
|
|
317
|
+
end: at(property.end),
|
|
318
|
+
valueStart: at(value?.start),
|
|
319
|
+
valueEnd: at(value?.end)
|
|
320
|
+
};
|
|
321
|
+
});
|
|
322
|
+
return { start: at(object.start), end: at(object.end), quote, entries };
|
|
323
|
+
}
|
|
324
|
+
function boundLiteral(prop) {
|
|
325
|
+
const exp = prop.exp;
|
|
326
|
+
if (!exp || exp.type !== SIMPLE_EXPRESSION_NODE) return null;
|
|
327
|
+
if (exp.content !== exp.loc.source) return null;
|
|
328
|
+
const delimiter = prop.loc.source[exp.loc.start.offset - prop.loc.start.offset - 1];
|
|
329
|
+
if (delimiter !== '"' && delimiter !== "'") return null;
|
|
330
|
+
let ast = exp.ast;
|
|
331
|
+
if (ast === void 0) ast = parseWrapped(exp.content);
|
|
332
|
+
if (!ast) return null;
|
|
333
|
+
const value = readLiteralExpression(
|
|
334
|
+
ast
|
|
335
|
+
);
|
|
336
|
+
if (typeof value !== "string" && typeof value !== "number") return null;
|
|
337
|
+
return {
|
|
338
|
+
value,
|
|
339
|
+
start: exp.loc.start.offset,
|
|
340
|
+
end: exp.loc.end.offset,
|
|
341
|
+
quote: delimiter
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
var WRITTEN_ENTITIES = {
|
|
345
|
+
""": '"',
|
|
346
|
+
"'": "'",
|
|
347
|
+
"<": "<",
|
|
348
|
+
">": ">",
|
|
349
|
+
"&": "&"
|
|
350
|
+
};
|
|
351
|
+
function rawOffsets(raw, decoded) {
|
|
352
|
+
const offsets = [];
|
|
353
|
+
let text = "";
|
|
354
|
+
const reference = /&(?:quot|#39|lt|gt|amp);/y;
|
|
355
|
+
for (let at = 0; at < raw.length; ) {
|
|
356
|
+
reference.lastIndex = at;
|
|
357
|
+
const entity = reference.exec(raw)?.[0];
|
|
358
|
+
offsets.push(at);
|
|
359
|
+
text += entity ? WRITTEN_ENTITIES[entity] : raw[at];
|
|
360
|
+
at += entity ? entity.length : 1;
|
|
361
|
+
}
|
|
362
|
+
offsets.push(raw.length);
|
|
363
|
+
return text === decoded ? offsets : null;
|
|
364
|
+
}
|
|
365
|
+
function parseWrapped(text) {
|
|
366
|
+
try {
|
|
367
|
+
const program = babelParse(`(${text})`, {
|
|
368
|
+
plugins: ["typescript"]
|
|
369
|
+
}).program;
|
|
370
|
+
const statement = program.body[0];
|
|
371
|
+
return statement?.type === "ExpressionStatement" ? statement.expression : null;
|
|
372
|
+
} catch {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
305
375
|
}
|
|
306
376
|
function vueTargetKind(node) {
|
|
307
377
|
if (node.tag === "template" || node.tag === "slot") return "special-element";
|
|
@@ -574,6 +644,28 @@ function camelize(name) {
|
|
|
574
644
|
return name.replace(/-(\w)/g, (_, char) => char.toUpperCase());
|
|
575
645
|
}
|
|
576
646
|
|
|
647
|
+
// ../../modules/vue-editor/literal-attributes.ts
|
|
648
|
+
var NOT_ATTRIBUTES = /* @__PURE__ */ new Set(["key", "ref", "ref_for", "ref_key", "is"]);
|
|
649
|
+
function vueLiteralAttribute(target, name) {
|
|
650
|
+
if (target.kind !== "native-element" || target.namespace !== "svg")
|
|
651
|
+
return null;
|
|
652
|
+
if (VUE_MERGED_PROP_NAMES.has(name.toLowerCase()) || NOT_ATTRIBUTES.has(name) || name.toLowerCase().startsWith("on"))
|
|
653
|
+
return null;
|
|
654
|
+
if (target.props.some(
|
|
655
|
+
(prop) => prop.kind === "bind" && (prop.objectBind || prop.name === null)
|
|
656
|
+
))
|
|
657
|
+
return null;
|
|
658
|
+
const named = target.props.filter(
|
|
659
|
+
(prop) => (prop.kind === "attribute" || prop.kind === "bind") && prop.name?.toLowerCase() === name.toLowerCase()
|
|
660
|
+
);
|
|
661
|
+
const only = named.length === 1 ? named[0] : null;
|
|
662
|
+
if (only?.kind !== "bind" || !only.literal || only.name !== name)
|
|
663
|
+
return null;
|
|
664
|
+
if (only.rawName !== `:${name}` && only.rawName !== `v-bind:${name}`)
|
|
665
|
+
return null;
|
|
666
|
+
return only;
|
|
667
|
+
}
|
|
668
|
+
|
|
577
669
|
// ../../modules/vue-editor/annotate.ts
|
|
578
670
|
var TEMPO_STAMP_NAMES = [
|
|
579
671
|
"data-tempo-filepath",
|
|
@@ -741,9 +833,15 @@ function authoredFacts(target, props, position) {
|
|
|
741
833
|
if (prop.name === null || !isRenderedName(prop.name)) return;
|
|
742
834
|
if (prop.kind === "bind") {
|
|
743
835
|
if (prop.name === "style" && Array.isArray(prop.styleKeys)) {
|
|
744
|
-
|
|
836
|
+
const writable = !canOverrideAnything && props.filter((entry) => entry.kind === "bind" && entry.name === "style").length === 1;
|
|
837
|
+
const last = /* @__PURE__ */ new Map();
|
|
838
|
+
for (const entry of writable ? prop.styleObject?.entries ?? [] : [])
|
|
839
|
+
last.set(entry.key, entry.literal);
|
|
840
|
+
for (const key of prop.styleKeys)
|
|
841
|
+
if ((last.get(key) ?? null) === null) facts.add(`style.${key}`);
|
|
745
842
|
return;
|
|
746
843
|
}
|
|
844
|
+
if (vueLiteralAttribute(target, prop.name)) return;
|
|
747
845
|
bound.add(prop.name);
|
|
748
846
|
facts.add(factName(prop.name));
|
|
749
847
|
return;
|