@odoo/owl 3.0.0-alpha.29 → 3.0.0-alpha.30
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/owl.cjs.js +111 -462
- package/dist/owl.es.js +111 -462
- package/dist/owl.iife.js +111 -462
- package/dist/owl.iife.min.js +12 -12
- package/dist/types/owl.d.ts +5 -5
- package/package.json +4 -4
package/dist/owl.es.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// ../owl-
|
|
2
|
-
var version = "3.0.0-alpha.29";
|
|
1
|
+
// ../owl-core/dist/owl-core.es.js
|
|
3
2
|
var OwlError = class extends Error {
|
|
4
3
|
cause;
|
|
5
4
|
};
|
|
@@ -17,7 +16,7 @@ function batched(callback) {
|
|
|
17
16
|
return function batchedCall(...args) {
|
|
18
17
|
if (!scheduled) {
|
|
19
18
|
scheduled = true;
|
|
20
|
-
|
|
19
|
+
Promise.resolve().then(() => {
|
|
21
20
|
scheduled = false;
|
|
22
21
|
callback(...args);
|
|
23
22
|
});
|
|
@@ -65,10 +64,11 @@ function onWriteAtom(atom) {
|
|
|
65
64
|
}
|
|
66
65
|
var batchProcessEffects = batched(processEffects);
|
|
67
66
|
function processEffects() {
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const pending = observers;
|
|
68
|
+
observers = [];
|
|
69
|
+
for (let i = 0; i < pending.length; i++) {
|
|
70
|
+
updateComputation(pending[i]);
|
|
70
71
|
}
|
|
71
|
-
observers.length = 0;
|
|
72
72
|
}
|
|
73
73
|
function getCurrentComputation() {
|
|
74
74
|
return currentComputation;
|
|
@@ -87,6 +87,9 @@ function updateComputation(computation) {
|
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
89
|
updateComputation(source);
|
|
90
|
+
if (computation.state === 1) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
90
93
|
}
|
|
91
94
|
if (computation.state !== 1) {
|
|
92
95
|
computation.state = 0;
|
|
@@ -96,15 +99,18 @@ function updateComputation(computation) {
|
|
|
96
99
|
removeSources(computation);
|
|
97
100
|
const previousComputation = currentComputation;
|
|
98
101
|
currentComputation = computation;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
try {
|
|
103
|
+
computation.value = computation.compute();
|
|
104
|
+
computation.state = 0;
|
|
105
|
+
} finally {
|
|
106
|
+
currentComputation = previousComputation;
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
function removeSources(computation) {
|
|
104
110
|
const sources = computation.sources;
|
|
105
111
|
for (const source of sources) {
|
|
106
|
-
const
|
|
107
|
-
|
|
112
|
+
const observers2 = source.observers;
|
|
113
|
+
observers2.delete(computation);
|
|
108
114
|
}
|
|
109
115
|
sources.clear();
|
|
110
116
|
}
|
|
@@ -368,10 +374,10 @@ function proxifyTarget(target, atom) {
|
|
|
368
374
|
} else {
|
|
369
375
|
handler = basicProxyHandler(atom);
|
|
370
376
|
}
|
|
371
|
-
const
|
|
372
|
-
proxyCache.set(target,
|
|
373
|
-
targets.set(
|
|
374
|
-
return
|
|
377
|
+
const proxy2 = new Proxy(target, handler);
|
|
378
|
+
proxyCache.set(target, proxy2);
|
|
379
|
+
targets.set(proxy2, target);
|
|
380
|
+
return proxy2;
|
|
375
381
|
}
|
|
376
382
|
function proxy(target) {
|
|
377
383
|
return proxifyTarget(target, null);
|
|
@@ -553,11 +559,11 @@ function buildSignal(value, set) {
|
|
|
553
559
|
};
|
|
554
560
|
return readSignal;
|
|
555
561
|
}
|
|
556
|
-
function triggerSignal(
|
|
557
|
-
if (typeof
|
|
558
|
-
throw new OwlError(`Value is not a signal (${
|
|
562
|
+
function triggerSignal(signal2) {
|
|
563
|
+
if (typeof signal2 !== "function" || signal2[atomSymbol]?.type !== "signal") {
|
|
564
|
+
throw new OwlError(`Value is not a signal (${signal2})`);
|
|
559
565
|
}
|
|
560
|
-
onWriteAtom(
|
|
566
|
+
onWriteAtom(signal2[atomSymbol]);
|
|
561
567
|
}
|
|
562
568
|
function signalArray(initialValue) {
|
|
563
569
|
return buildSignal(initialValue, (atom) => proxifyTarget(atom.value, atom));
|
|
@@ -1183,6 +1189,9 @@ function startPlugins(manager, plugins) {
|
|
|
1183
1189
|
);
|
|
1184
1190
|
}
|
|
1185
1191
|
}
|
|
1192
|
+
|
|
1193
|
+
// ../owl-runtime/dist/owl-runtime.es.js
|
|
1194
|
+
var version = "3.0.0-alpha.30";
|
|
1186
1195
|
var fibersInError = /* @__PURE__ */ new WeakMap();
|
|
1187
1196
|
var nodeErrorHandlers = /* @__PURE__ */ new WeakMap();
|
|
1188
1197
|
function invokeErrorHandlers(node, error, finalize, markFibers) {
|
|
@@ -1238,12 +1247,7 @@ function handleError(params) {
|
|
|
1238
1247
|
app.destroy();
|
|
1239
1248
|
} catch (e) {
|
|
1240
1249
|
}
|
|
1241
|
-
|
|
1242
|
-
return error;
|
|
1243
|
-
}
|
|
1244
|
-
return Object.assign(new OwlError(`[Owl] Unhandled error. Destroying the root component`), {
|
|
1245
|
-
cause: error
|
|
1246
|
-
});
|
|
1250
|
+
return error;
|
|
1247
1251
|
};
|
|
1248
1252
|
const result = invokeErrorHandlers(node, error, finalize, true);
|
|
1249
1253
|
if (!result.handled) {
|
|
@@ -2963,8 +2967,9 @@ var Fiber = class {
|
|
|
2963
2967
|
this.bdom = node.renderFn();
|
|
2964
2968
|
} catch (e) {
|
|
2965
2969
|
handleError({ node, error: e });
|
|
2970
|
+
} finally {
|
|
2971
|
+
setComputation(c);
|
|
2966
2972
|
}
|
|
2967
|
-
setComputation(c);
|
|
2968
2973
|
const newCounter = root.counter - 1;
|
|
2969
2974
|
root.counter = newCounter;
|
|
2970
2975
|
if (newCounter === 0) {
|
|
@@ -3170,7 +3175,6 @@ var ComponentNode = class extends Scope {
|
|
|
3170
3175
|
setComputation(prev);
|
|
3171
3176
|
await Promise.all(promises);
|
|
3172
3177
|
} catch (e) {
|
|
3173
|
-
setComputation(prev);
|
|
3174
3178
|
if (isAbortError(e) && this.status > STATUS.MOUNTED) {
|
|
3175
3179
|
return;
|
|
3176
3180
|
}
|
|
@@ -3524,7 +3528,10 @@ function createRef(ref2) {
|
|
|
3524
3528
|
remove2 = ref2.delete.bind(ref2);
|
|
3525
3529
|
} else if (ref2.set) {
|
|
3526
3530
|
add = ref2.set.bind(ref2);
|
|
3527
|
-
|
|
3531
|
+
const atom = ref2[atomSymbol];
|
|
3532
|
+
remove2 = atom ? (prevEl) => {
|
|
3533
|
+
if (atom.value === prevEl) ref2.set(null);
|
|
3534
|
+
} : () => ref2.set(null);
|
|
3528
3535
|
} else {
|
|
3529
3536
|
throw new OwlError(
|
|
3530
3537
|
`Ref should implement either a 'set' function or 'add' and 'delete' functions`
|
|
@@ -3618,12 +3625,13 @@ function createComponent(app, name, isStatic, hasSlotsProp, hasDynamicPropList,
|
|
|
3618
3625
|
if (node.patched.length) parentRoot.patched.push(fiber);
|
|
3619
3626
|
let promises;
|
|
3620
3627
|
if (hooks.length) {
|
|
3628
|
+
let nextProps = props2;
|
|
3621
3629
|
const defaultProps = node.defaultProps;
|
|
3622
3630
|
if (defaultProps) {
|
|
3623
|
-
|
|
3631
|
+
nextProps = Object.assign({}, props2);
|
|
3624
3632
|
for (const k in defaultProps) {
|
|
3625
|
-
if (
|
|
3626
|
-
|
|
3633
|
+
if (nextProps[k] === void 0) {
|
|
3634
|
+
nextProps[k] = defaultProps[k];
|
|
3627
3635
|
}
|
|
3628
3636
|
}
|
|
3629
3637
|
}
|
|
@@ -3631,7 +3639,7 @@ function createComponent(app, name, isStatic, hasSlotsProp, hasDynamicPropList,
|
|
|
3631
3639
|
const prev = getCurrentComputation();
|
|
3632
3640
|
setComputation(void 0);
|
|
3633
3641
|
for (const f of hooks) {
|
|
3634
|
-
const r = f.call(component,
|
|
3642
|
+
const r = f.call(component, nextProps);
|
|
3635
3643
|
if (r && typeof r.then === "function") {
|
|
3636
3644
|
(promises ||= []).push(r);
|
|
3637
3645
|
}
|
|
@@ -3751,9 +3759,7 @@ var TemplateSet = class {
|
|
|
3751
3759
|
return;
|
|
3752
3760
|
}
|
|
3753
3761
|
const rawTemplate = this.rawTemplates[name];
|
|
3754
|
-
|
|
3755
|
-
const newAsString = typeof template === "string" ? template : template.outerHTML;
|
|
3756
|
-
if (currentAsString === newAsString) {
|
|
3762
|
+
if (areTemplatesEqual(rawTemplate, template)) {
|
|
3757
3763
|
return;
|
|
3758
3764
|
}
|
|
3759
3765
|
throw new OwlError(`Template ${name} already defined with different content`);
|
|
@@ -3810,6 +3816,17 @@ function xml(...args) {
|
|
|
3810
3816
|
return name;
|
|
3811
3817
|
}
|
|
3812
3818
|
xml.nextId = 1;
|
|
3819
|
+
function areTemplatesEqual(t1, t2) {
|
|
3820
|
+
if (t1 === t2) {
|
|
3821
|
+
return true;
|
|
3822
|
+
}
|
|
3823
|
+
if (typeof t1 === "function" !== (typeof t2 === "function")) {
|
|
3824
|
+
return false;
|
|
3825
|
+
}
|
|
3826
|
+
const s1 = t1 instanceof Element ? t1.outerHTML : String(t1);
|
|
3827
|
+
const s2 = t2 instanceof Element ? t2.outerHTML : String(t2);
|
|
3828
|
+
return s1 === s2;
|
|
3829
|
+
}
|
|
3813
3830
|
var hasBeenLogged = false;
|
|
3814
3831
|
var apps = /* @__PURE__ */ new Set();
|
|
3815
3832
|
if (typeof window !== "undefined") {
|
|
@@ -4069,6 +4086,9 @@ function props(type, defaults) {
|
|
|
4069
4086
|
if (app.dev) {
|
|
4070
4087
|
const validation = defaults ? validateObjectWithDefaults(type, defaults) : types2.object(type);
|
|
4071
4088
|
assertType(node.props, validation, `Invalid component props (${componentName})`);
|
|
4089
|
+
if (defaults) {
|
|
4090
|
+
assertType(defaults, validation, `Invalid default props (${componentName})`);
|
|
4091
|
+
}
|
|
4072
4092
|
node.willUpdateProps.push((np) => {
|
|
4073
4093
|
assertType(np, validation, `Invalid component props (${componentName})`);
|
|
4074
4094
|
});
|
|
@@ -4289,396 +4309,12 @@ var blockDom = {
|
|
|
4289
4309
|
};
|
|
4290
4310
|
var __info__ = {
|
|
4291
4311
|
version: App.version,
|
|
4292
|
-
date: "2026-
|
|
4293
|
-
hash: "
|
|
4312
|
+
date: "2026-05-19T14:24:07.068Z",
|
|
4313
|
+
hash: "a826de4f",
|
|
4294
4314
|
url: "https://github.com/odoo/owl"
|
|
4295
4315
|
};
|
|
4296
4316
|
|
|
4297
4317
|
// ../owl-compiler/dist/owl-compiler.es.js
|
|
4298
|
-
var OwlError2 = class extends Error {
|
|
4299
|
-
cause;
|
|
4300
|
-
};
|
|
4301
|
-
function batched2(callback) {
|
|
4302
|
-
let scheduled = false;
|
|
4303
|
-
return function batchedCall(...args) {
|
|
4304
|
-
if (!scheduled) {
|
|
4305
|
-
scheduled = true;
|
|
4306
|
-
queueMicrotask(() => {
|
|
4307
|
-
scheduled = false;
|
|
4308
|
-
callback(...args);
|
|
4309
|
-
});
|
|
4310
|
-
}
|
|
4311
|
-
};
|
|
4312
|
-
}
|
|
4313
|
-
var atomSymbol2 = /* @__PURE__ */ Symbol("Atom");
|
|
4314
|
-
var observers2 = [];
|
|
4315
|
-
var currentComputation2;
|
|
4316
|
-
function onReadAtom2(atom) {
|
|
4317
|
-
if (!currentComputation2) {
|
|
4318
|
-
return;
|
|
4319
|
-
}
|
|
4320
|
-
currentComputation2.sources.add(atom);
|
|
4321
|
-
atom.observers.add(currentComputation2);
|
|
4322
|
-
}
|
|
4323
|
-
function onWriteAtom2(atom) {
|
|
4324
|
-
for (const ctx of atom.observers) {
|
|
4325
|
-
if (ctx.state === 0) {
|
|
4326
|
-
if (ctx.isDerived) {
|
|
4327
|
-
markDownstream2(ctx);
|
|
4328
|
-
} else {
|
|
4329
|
-
observers2.push(ctx);
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
ctx.state = 1;
|
|
4333
|
-
}
|
|
4334
|
-
batchProcessEffects2();
|
|
4335
|
-
}
|
|
4336
|
-
var batchProcessEffects2 = batched2(processEffects2);
|
|
4337
|
-
function processEffects2() {
|
|
4338
|
-
for (let i = 0; i < observers2.length; i++) {
|
|
4339
|
-
updateComputation2(observers2[i]);
|
|
4340
|
-
}
|
|
4341
|
-
observers2.length = 0;
|
|
4342
|
-
}
|
|
4343
|
-
function updateComputation2(computation) {
|
|
4344
|
-
const state = computation.state;
|
|
4345
|
-
if (state === 0) {
|
|
4346
|
-
return;
|
|
4347
|
-
}
|
|
4348
|
-
if (state === 2) {
|
|
4349
|
-
for (const source of computation.sources) {
|
|
4350
|
-
if (!("compute" in source)) {
|
|
4351
|
-
continue;
|
|
4352
|
-
}
|
|
4353
|
-
updateComputation2(source);
|
|
4354
|
-
}
|
|
4355
|
-
if (computation.state !== 1) {
|
|
4356
|
-
computation.state = 0;
|
|
4357
|
-
return;
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
removeSources2(computation);
|
|
4361
|
-
const previousComputation = currentComputation2;
|
|
4362
|
-
currentComputation2 = computation;
|
|
4363
|
-
computation.value = computation.compute();
|
|
4364
|
-
computation.state = 0;
|
|
4365
|
-
currentComputation2 = previousComputation;
|
|
4366
|
-
}
|
|
4367
|
-
function removeSources2(computation) {
|
|
4368
|
-
const sources = computation.sources;
|
|
4369
|
-
for (const source of sources) {
|
|
4370
|
-
const observers22 = source.observers;
|
|
4371
|
-
observers22.delete(computation);
|
|
4372
|
-
}
|
|
4373
|
-
sources.clear();
|
|
4374
|
-
}
|
|
4375
|
-
function markDownstream2(computation) {
|
|
4376
|
-
const stack = [computation];
|
|
4377
|
-
let current;
|
|
4378
|
-
while (current = stack.pop()) {
|
|
4379
|
-
for (const observer of current.observers) {
|
|
4380
|
-
if (observer.state) {
|
|
4381
|
-
continue;
|
|
4382
|
-
}
|
|
4383
|
-
observer.state = 2;
|
|
4384
|
-
if (observer.isDerived) {
|
|
4385
|
-
stack.push(observer);
|
|
4386
|
-
} else {
|
|
4387
|
-
observers2.push(observer);
|
|
4388
|
-
}
|
|
4389
|
-
}
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
var KEYCHANGES2 = /* @__PURE__ */ Symbol("Key changes");
|
|
4393
|
-
var objectToString2 = Object.prototype.toString;
|
|
4394
|
-
var objectHasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
4395
|
-
function canBeMadeReactive2(value) {
|
|
4396
|
-
if (typeof value !== "object" || value === null) {
|
|
4397
|
-
return false;
|
|
4398
|
-
}
|
|
4399
|
-
const raw = toRaw2(value);
|
|
4400
|
-
if (Array.isArray(raw) || raw instanceof Set || raw instanceof Map || raw instanceof WeakMap) {
|
|
4401
|
-
return true;
|
|
4402
|
-
}
|
|
4403
|
-
return objectToString2.call(raw) === "[object Object]";
|
|
4404
|
-
}
|
|
4405
|
-
function possiblyReactive2(val, atom) {
|
|
4406
|
-
return !atom && canBeMadeReactive2(val) ? proxy2(val) : val;
|
|
4407
|
-
}
|
|
4408
|
-
var skipped2 = /* @__PURE__ */ new WeakSet();
|
|
4409
|
-
function toRaw2(value) {
|
|
4410
|
-
return targets2.has(value) ? targets2.get(value) : value;
|
|
4411
|
-
}
|
|
4412
|
-
var targetToKeysToAtomItem2 = /* @__PURE__ */ new WeakMap();
|
|
4413
|
-
function getTargetKeyAtom2(target, key) {
|
|
4414
|
-
let keyToAtomItem = targetToKeysToAtomItem2.get(target);
|
|
4415
|
-
if (!keyToAtomItem) {
|
|
4416
|
-
keyToAtomItem = /* @__PURE__ */ new Map();
|
|
4417
|
-
targetToKeysToAtomItem2.set(target, keyToAtomItem);
|
|
4418
|
-
}
|
|
4419
|
-
let atom = keyToAtomItem.get(key);
|
|
4420
|
-
if (!atom) {
|
|
4421
|
-
atom = {
|
|
4422
|
-
value: void 0,
|
|
4423
|
-
observers: /* @__PURE__ */ new Set()
|
|
4424
|
-
};
|
|
4425
|
-
keyToAtomItem.set(key, atom);
|
|
4426
|
-
}
|
|
4427
|
-
return atom;
|
|
4428
|
-
}
|
|
4429
|
-
function onReadTargetKey2(target, key, atom) {
|
|
4430
|
-
onReadAtom2(atom ?? getTargetKeyAtom2(target, key));
|
|
4431
|
-
}
|
|
4432
|
-
function onWriteTargetKey2(target, key, atom) {
|
|
4433
|
-
if (!atom) {
|
|
4434
|
-
const keyToAtomItem = targetToKeysToAtomItem2.get(target);
|
|
4435
|
-
if (!keyToAtomItem) {
|
|
4436
|
-
return;
|
|
4437
|
-
}
|
|
4438
|
-
if (!keyToAtomItem.has(key)) {
|
|
4439
|
-
return;
|
|
4440
|
-
}
|
|
4441
|
-
atom = keyToAtomItem.get(key);
|
|
4442
|
-
}
|
|
4443
|
-
onWriteAtom2(atom);
|
|
4444
|
-
}
|
|
4445
|
-
var targets2 = /* @__PURE__ */ new WeakMap();
|
|
4446
|
-
var proxyCache2 = /* @__PURE__ */ new WeakMap();
|
|
4447
|
-
function proxifyTarget2(target, atom) {
|
|
4448
|
-
if (!canBeMadeReactive2(target)) {
|
|
4449
|
-
throw new OwlError2(`Cannot make the given value reactive`);
|
|
4450
|
-
}
|
|
4451
|
-
if (skipped2.has(target)) {
|
|
4452
|
-
return target;
|
|
4453
|
-
}
|
|
4454
|
-
if (targets2.has(target)) {
|
|
4455
|
-
return target;
|
|
4456
|
-
}
|
|
4457
|
-
const reactive = proxyCache2.get(target);
|
|
4458
|
-
if (reactive) {
|
|
4459
|
-
return reactive;
|
|
4460
|
-
}
|
|
4461
|
-
let handler;
|
|
4462
|
-
if (target instanceof Map) {
|
|
4463
|
-
handler = collectionsProxyHandler2(target, "Map", atom);
|
|
4464
|
-
} else if (target instanceof Set) {
|
|
4465
|
-
handler = collectionsProxyHandler2(target, "Set", atom);
|
|
4466
|
-
} else if (target instanceof WeakMap) {
|
|
4467
|
-
handler = collectionsProxyHandler2(target, "WeakMap", atom);
|
|
4468
|
-
} else {
|
|
4469
|
-
handler = basicProxyHandler2(atom);
|
|
4470
|
-
}
|
|
4471
|
-
const proxy22 = new Proxy(target, handler);
|
|
4472
|
-
proxyCache2.set(target, proxy22);
|
|
4473
|
-
targets2.set(proxy22, target);
|
|
4474
|
-
return proxy22;
|
|
4475
|
-
}
|
|
4476
|
-
function proxy2(target) {
|
|
4477
|
-
return proxifyTarget2(target, null);
|
|
4478
|
-
}
|
|
4479
|
-
function basicProxyHandler2(atom) {
|
|
4480
|
-
return {
|
|
4481
|
-
get(target, key, receiver) {
|
|
4482
|
-
onReadTargetKey2(target, key, atom);
|
|
4483
|
-
const value = Reflect.get(target, key, receiver);
|
|
4484
|
-
if (atom || typeof value !== "object" || value === null) {
|
|
4485
|
-
return value;
|
|
4486
|
-
}
|
|
4487
|
-
if (!canBeMadeReactive2(value)) {
|
|
4488
|
-
return value;
|
|
4489
|
-
}
|
|
4490
|
-
const desc = Object.getOwnPropertyDescriptor(target, key);
|
|
4491
|
-
if (desc && !desc.writable && !desc.configurable) {
|
|
4492
|
-
return value;
|
|
4493
|
-
}
|
|
4494
|
-
return proxifyTarget2(value, null);
|
|
4495
|
-
},
|
|
4496
|
-
set(target, key, value, receiver) {
|
|
4497
|
-
const hadKey = objectHasOwnProperty2.call(target, key);
|
|
4498
|
-
const originalValue = Reflect.get(target, key, receiver);
|
|
4499
|
-
const ret = Reflect.set(target, key, toRaw2(value), receiver);
|
|
4500
|
-
if (!hadKey && objectHasOwnProperty2.call(target, key)) {
|
|
4501
|
-
onWriteTargetKey2(target, KEYCHANGES2, atom);
|
|
4502
|
-
}
|
|
4503
|
-
if (originalValue !== Reflect.get(target, key, receiver) || key === "length" && Array.isArray(target)) {
|
|
4504
|
-
onWriteTargetKey2(target, key, atom);
|
|
4505
|
-
}
|
|
4506
|
-
return ret;
|
|
4507
|
-
},
|
|
4508
|
-
deleteProperty(target, key) {
|
|
4509
|
-
const ret = Reflect.deleteProperty(target, key);
|
|
4510
|
-
onWriteTargetKey2(target, KEYCHANGES2, atom);
|
|
4511
|
-
onWriteTargetKey2(target, key, atom);
|
|
4512
|
-
return ret;
|
|
4513
|
-
},
|
|
4514
|
-
ownKeys(target) {
|
|
4515
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4516
|
-
return Reflect.ownKeys(target);
|
|
4517
|
-
},
|
|
4518
|
-
has(target, key) {
|
|
4519
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4520
|
-
return Reflect.has(target, key);
|
|
4521
|
-
}
|
|
4522
|
-
};
|
|
4523
|
-
}
|
|
4524
|
-
function makeKeyObserver2(methodName, target, atom) {
|
|
4525
|
-
return (key) => {
|
|
4526
|
-
key = toRaw2(key);
|
|
4527
|
-
onReadTargetKey2(target, key, atom);
|
|
4528
|
-
return possiblyReactive2(target[methodName](key), atom);
|
|
4529
|
-
};
|
|
4530
|
-
}
|
|
4531
|
-
function makeIteratorObserver2(methodName, target, atom) {
|
|
4532
|
-
return function* () {
|
|
4533
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4534
|
-
const keys = target.keys();
|
|
4535
|
-
for (const item of target[methodName]()) {
|
|
4536
|
-
const key = keys.next().value;
|
|
4537
|
-
onReadTargetKey2(target, key, atom);
|
|
4538
|
-
yield possiblyReactive2(item, atom);
|
|
4539
|
-
}
|
|
4540
|
-
};
|
|
4541
|
-
}
|
|
4542
|
-
function makeForEachObserver2(target, atom) {
|
|
4543
|
-
return function forEach(forEachCb, thisArg) {
|
|
4544
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4545
|
-
target.forEach(function(val, key, targetObj) {
|
|
4546
|
-
onReadTargetKey2(target, key, atom);
|
|
4547
|
-
forEachCb.call(
|
|
4548
|
-
thisArg,
|
|
4549
|
-
possiblyReactive2(val, atom),
|
|
4550
|
-
possiblyReactive2(key, atom),
|
|
4551
|
-
possiblyReactive2(targetObj, atom)
|
|
4552
|
-
);
|
|
4553
|
-
}, thisArg);
|
|
4554
|
-
};
|
|
4555
|
-
}
|
|
4556
|
-
function delegateAndNotify2(setterName, getterName, target, atom) {
|
|
4557
|
-
return (key, value) => {
|
|
4558
|
-
key = toRaw2(key);
|
|
4559
|
-
const hadKey = target.has(key);
|
|
4560
|
-
const originalValue = target[getterName](key);
|
|
4561
|
-
const ret = target[setterName](key, value);
|
|
4562
|
-
const hasKey = target.has(key);
|
|
4563
|
-
if (hadKey !== hasKey) {
|
|
4564
|
-
onWriteTargetKey2(target, KEYCHANGES2, atom);
|
|
4565
|
-
}
|
|
4566
|
-
if (originalValue !== target[getterName](key)) {
|
|
4567
|
-
onWriteTargetKey2(target, key, atom);
|
|
4568
|
-
}
|
|
4569
|
-
return ret;
|
|
4570
|
-
};
|
|
4571
|
-
}
|
|
4572
|
-
function makeClearNotifier2(target, atom) {
|
|
4573
|
-
return () => {
|
|
4574
|
-
const allKeys = [...target.keys()];
|
|
4575
|
-
target.clear();
|
|
4576
|
-
onWriteTargetKey2(target, KEYCHANGES2, atom);
|
|
4577
|
-
for (const key of allKeys) {
|
|
4578
|
-
onWriteTargetKey2(target, key, atom);
|
|
4579
|
-
}
|
|
4580
|
-
};
|
|
4581
|
-
}
|
|
4582
|
-
var rawTypeToFuncHandlers2 = {
|
|
4583
|
-
Set: (target, atom) => ({
|
|
4584
|
-
has: makeKeyObserver2("has", target, atom),
|
|
4585
|
-
add: delegateAndNotify2("add", "has", target, atom),
|
|
4586
|
-
delete: delegateAndNotify2("delete", "has", target, atom),
|
|
4587
|
-
keys: makeIteratorObserver2("keys", target, atom),
|
|
4588
|
-
values: makeIteratorObserver2("values", target, atom),
|
|
4589
|
-
entries: makeIteratorObserver2("entries", target, atom),
|
|
4590
|
-
[Symbol.iterator]: makeIteratorObserver2(Symbol.iterator, target, atom),
|
|
4591
|
-
forEach: makeForEachObserver2(target, atom),
|
|
4592
|
-
clear: makeClearNotifier2(target, atom),
|
|
4593
|
-
get size() {
|
|
4594
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4595
|
-
return target.size;
|
|
4596
|
-
}
|
|
4597
|
-
}),
|
|
4598
|
-
Map: (target, atom) => ({
|
|
4599
|
-
has: makeKeyObserver2("has", target, atom),
|
|
4600
|
-
get: makeKeyObserver2("get", target, atom),
|
|
4601
|
-
set: delegateAndNotify2("set", "get", target, atom),
|
|
4602
|
-
delete: delegateAndNotify2("delete", "has", target, atom),
|
|
4603
|
-
keys: makeIteratorObserver2("keys", target, atom),
|
|
4604
|
-
values: makeIteratorObserver2("values", target, atom),
|
|
4605
|
-
entries: makeIteratorObserver2("entries", target, atom),
|
|
4606
|
-
[Symbol.iterator]: makeIteratorObserver2(Symbol.iterator, target, atom),
|
|
4607
|
-
forEach: makeForEachObserver2(target, atom),
|
|
4608
|
-
clear: makeClearNotifier2(target, atom),
|
|
4609
|
-
get size() {
|
|
4610
|
-
onReadTargetKey2(target, KEYCHANGES2, atom);
|
|
4611
|
-
return target.size;
|
|
4612
|
-
}
|
|
4613
|
-
}),
|
|
4614
|
-
WeakMap: (target, atom) => ({
|
|
4615
|
-
has: makeKeyObserver2("has", target, atom),
|
|
4616
|
-
get: makeKeyObserver2("get", target, atom),
|
|
4617
|
-
set: delegateAndNotify2("set", "get", target, atom),
|
|
4618
|
-
delete: delegateAndNotify2("delete", "has", target, atom)
|
|
4619
|
-
})
|
|
4620
|
-
};
|
|
4621
|
-
function collectionsProxyHandler2(target, targetRawType, atom) {
|
|
4622
|
-
const specialHandlers = rawTypeToFuncHandlers2[targetRawType](target, atom);
|
|
4623
|
-
return Object.assign(basicProxyHandler2(atom), {
|
|
4624
|
-
// FIXME: probably broken when part of prototype chain since we ignore the receiver
|
|
4625
|
-
get(target2, key) {
|
|
4626
|
-
if (objectHasOwnProperty2.call(specialHandlers, key)) {
|
|
4627
|
-
return specialHandlers[key];
|
|
4628
|
-
}
|
|
4629
|
-
onReadTargetKey2(target2, key, atom);
|
|
4630
|
-
return possiblyReactive2(target2[key], atom);
|
|
4631
|
-
}
|
|
4632
|
-
});
|
|
4633
|
-
}
|
|
4634
|
-
function buildSignal2(value, set) {
|
|
4635
|
-
const atom = {
|
|
4636
|
-
type: "signal",
|
|
4637
|
-
value,
|
|
4638
|
-
observers: /* @__PURE__ */ new Set()
|
|
4639
|
-
};
|
|
4640
|
-
let readValue = set(atom);
|
|
4641
|
-
const readSignal = () => {
|
|
4642
|
-
onReadAtom2(atom);
|
|
4643
|
-
return readValue;
|
|
4644
|
-
};
|
|
4645
|
-
readSignal[atomSymbol2] = atom;
|
|
4646
|
-
readSignal.set = function writeSignal(newValue) {
|
|
4647
|
-
if (Object.is(atom.value, newValue)) {
|
|
4648
|
-
return;
|
|
4649
|
-
}
|
|
4650
|
-
atom.value = newValue;
|
|
4651
|
-
readValue = set(atom);
|
|
4652
|
-
onWriteAtom2(atom);
|
|
4653
|
-
};
|
|
4654
|
-
return readSignal;
|
|
4655
|
-
}
|
|
4656
|
-
function triggerSignal2(signal22) {
|
|
4657
|
-
if (typeof signal22 !== "function" || signal22[atomSymbol2]?.type !== "signal") {
|
|
4658
|
-
throw new OwlError2(`Value is not a signal (${signal22})`);
|
|
4659
|
-
}
|
|
4660
|
-
onWriteAtom2(signal22[atomSymbol2]);
|
|
4661
|
-
}
|
|
4662
|
-
function signalArray2(initialValue) {
|
|
4663
|
-
return buildSignal2(initialValue, (atom) => proxifyTarget2(atom.value, atom));
|
|
4664
|
-
}
|
|
4665
|
-
function signalObject2(initialValue) {
|
|
4666
|
-
return buildSignal2(initialValue, (atom) => proxifyTarget2(atom.value, atom));
|
|
4667
|
-
}
|
|
4668
|
-
function signalMap2(initialValue) {
|
|
4669
|
-
return buildSignal2(initialValue, (atom) => proxifyTarget2(atom.value, atom));
|
|
4670
|
-
}
|
|
4671
|
-
function signalSet2(initialValue) {
|
|
4672
|
-
return buildSignal2(initialValue, (atom) => proxifyTarget2(atom.value, atom));
|
|
4673
|
-
}
|
|
4674
|
-
function signal2(value) {
|
|
4675
|
-
return buildSignal2(value, (atom) => atom.value);
|
|
4676
|
-
}
|
|
4677
|
-
signal2.trigger = triggerSignal2;
|
|
4678
|
-
signal2.Array = signalArray2;
|
|
4679
|
-
signal2.Map = signalMap2;
|
|
4680
|
-
signal2.Object = signalObject2;
|
|
4681
|
-
signal2.Set = signalSet2;
|
|
4682
4318
|
var RESERVED_WORDS = "true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,eval,void,Math,RegExp,Array,Object,Date,__globals__".split(
|
|
4683
4319
|
","
|
|
4684
4320
|
);
|
|
@@ -4716,14 +4352,14 @@ var tokenizeString = function(expr) {
|
|
|
4716
4352
|
i++;
|
|
4717
4353
|
cur = expr[i];
|
|
4718
4354
|
if (!cur) {
|
|
4719
|
-
throw new
|
|
4355
|
+
throw new OwlError("Invalid expression");
|
|
4720
4356
|
}
|
|
4721
4357
|
s += cur;
|
|
4722
4358
|
}
|
|
4723
4359
|
i++;
|
|
4724
4360
|
}
|
|
4725
4361
|
if (expr[i] !== start) {
|
|
4726
|
-
throw new
|
|
4362
|
+
throw new OwlError("Invalid expression");
|
|
4727
4363
|
}
|
|
4728
4364
|
s += start;
|
|
4729
4365
|
if (start === "`") {
|
|
@@ -4815,19 +4451,25 @@ function tokenize(expr) {
|
|
|
4815
4451
|
error = e;
|
|
4816
4452
|
}
|
|
4817
4453
|
if (current.length || error) {
|
|
4818
|
-
throw new
|
|
4454
|
+
throw new OwlError(`Tokenizer error: could not tokenize \`${expr}\``);
|
|
4819
4455
|
}
|
|
4820
4456
|
return result;
|
|
4821
4457
|
}
|
|
4822
4458
|
var isLeftSeparator = (token) => token && (token.type === "LEFT_BRACE" || token.type === "COMMA");
|
|
4823
4459
|
var isRightSeparator = (token) => token && (token.type === "RIGHT_BRACE" || token.type === "COMMA");
|
|
4824
4460
|
var paddedValues = /* @__PURE__ */ new Map([["in ", " in "]]);
|
|
4825
|
-
function processExpr(expr) {
|
|
4826
|
-
const
|
|
4461
|
+
function processExpr(expr, seededLocals) {
|
|
4462
|
+
const scopeStack2 = [];
|
|
4463
|
+
if (seededLocals?.size) {
|
|
4464
|
+
scopeStack2.push({ vars: seededLocals, depth: -Infinity });
|
|
4465
|
+
}
|
|
4827
4466
|
const tokens = tokenize(expr);
|
|
4828
4467
|
let i = 0;
|
|
4829
4468
|
let stack = [];
|
|
4830
4469
|
let topLevelArrowIndex = -1;
|
|
4470
|
+
function isLocal(name) {
|
|
4471
|
+
return scopeStack2.some((s) => s.vars.has(name));
|
|
4472
|
+
}
|
|
4831
4473
|
while (i < tokens.length) {
|
|
4832
4474
|
let token = tokens[i];
|
|
4833
4475
|
let prevToken = tokens[i - 1];
|
|
@@ -4843,6 +4485,10 @@ function processExpr(expr) {
|
|
|
4843
4485
|
case "RIGHT_BRACKET":
|
|
4844
4486
|
case "RIGHT_PAREN":
|
|
4845
4487
|
stack.pop();
|
|
4488
|
+
while (scopeStack2.length > 0 && stack.length < scopeStack2[scopeStack2.length - 1].depth) {
|
|
4489
|
+
scopeStack2.pop();
|
|
4490
|
+
}
|
|
4491
|
+
break;
|
|
4846
4492
|
}
|
|
4847
4493
|
let isVar = token.type === "SYMBOL" && !RESERVED_WORDS.includes(token.value);
|
|
4848
4494
|
if (isVar) {
|
|
@@ -4861,9 +4507,14 @@ function processExpr(expr) {
|
|
|
4861
4507
|
}
|
|
4862
4508
|
}
|
|
4863
4509
|
if (token.type === "TEMPLATE_STRING") {
|
|
4864
|
-
|
|
4510
|
+
const currentLocals = /* @__PURE__ */ new Set();
|
|
4511
|
+
for (const scope of scopeStack2) {
|
|
4512
|
+
for (const v of scope.vars) currentLocals.add(v);
|
|
4513
|
+
}
|
|
4514
|
+
token.value = token.replace((expr2) => compileExpr(expr2, currentLocals));
|
|
4865
4515
|
}
|
|
4866
4516
|
if (nextToken && nextToken.type === "OPERATOR" && nextToken.value === "=>") {
|
|
4517
|
+
const newScope = /* @__PURE__ */ new Set();
|
|
4867
4518
|
if (stack.length === 0) {
|
|
4868
4519
|
topLevelArrowIndex = i + 1;
|
|
4869
4520
|
}
|
|
@@ -4871,31 +4522,29 @@ function processExpr(expr) {
|
|
|
4871
4522
|
let j = i - 1;
|
|
4872
4523
|
while (j > 0 && tokens[j].type !== "LEFT_PAREN") {
|
|
4873
4524
|
if (tokens[j].type === "SYMBOL" && tokens[j].originalValue) {
|
|
4874
|
-
|
|
4875
|
-
|
|
4525
|
+
newScope.add(tokens[j].originalValue);
|
|
4526
|
+
tokens[j].value = `_${tokens[j].originalValue}`;
|
|
4527
|
+
tokens[j].isLocal = true;
|
|
4876
4528
|
}
|
|
4877
4529
|
j--;
|
|
4878
4530
|
}
|
|
4879
4531
|
} else {
|
|
4880
|
-
|
|
4532
|
+
newScope.add(token.value);
|
|
4881
4533
|
}
|
|
4534
|
+
scopeStack2.push({ vars: newScope, depth: stack.length });
|
|
4882
4535
|
}
|
|
4883
4536
|
if (isVar) {
|
|
4884
4537
|
token.varName = token.value;
|
|
4885
|
-
if (!
|
|
4538
|
+
if (!isLocal(token.value)) {
|
|
4886
4539
|
token.originalValue = token.value;
|
|
4887
4540
|
token.value = `ctx['${token.value}']`;
|
|
4541
|
+
} else {
|
|
4542
|
+
token.value = `_${token.value}`;
|
|
4543
|
+
token.isLocal = true;
|
|
4888
4544
|
}
|
|
4889
4545
|
}
|
|
4890
4546
|
i++;
|
|
4891
4547
|
}
|
|
4892
|
-
for (const token of tokens) {
|
|
4893
|
-
if (token.type === "SYMBOL" && token.varName && localVars.has(token.value)) {
|
|
4894
|
-
token.originalValue = token.value;
|
|
4895
|
-
token.value = `_${token.value}`;
|
|
4896
|
-
token.isLocal = true;
|
|
4897
|
-
}
|
|
4898
|
-
}
|
|
4899
4548
|
let freeVariables = null;
|
|
4900
4549
|
if (topLevelArrowIndex !== -1) {
|
|
4901
4550
|
freeVariables = [];
|
|
@@ -4911,8 +4560,8 @@ function processExpr(expr) {
|
|
|
4911
4560
|
const compiled = tokens.map((t) => paddedValues.get(t.value) || t.value).join("");
|
|
4912
4561
|
return { expr: compiled, freeVariables };
|
|
4913
4562
|
}
|
|
4914
|
-
function compileExpr(expr) {
|
|
4915
|
-
return processExpr(expr).expr;
|
|
4563
|
+
function compileExpr(expr, seededLocals) {
|
|
4564
|
+
return processExpr(expr, seededLocals).expr;
|
|
4916
4565
|
}
|
|
4917
4566
|
var INTERP_REGEXP = /\{\{.*?\}\}|\#\{.*?\}/g;
|
|
4918
4567
|
function replaceDynamicParts(s, replacer) {
|
|
@@ -4954,7 +4603,7 @@ ${"-".repeat(columnIndex - 1)}^`;
|
|
|
4954
4603
|
}
|
|
4955
4604
|
}
|
|
4956
4605
|
}
|
|
4957
|
-
throw new
|
|
4606
|
+
throw new OwlError(msg);
|
|
4958
4607
|
}
|
|
4959
4608
|
return doc;
|
|
4960
4609
|
}
|
|
@@ -5033,13 +4682,13 @@ function parseTCustom(node, ctx) {
|
|
|
5033
4682
|
const nodeAttrsNames = node.getAttributeNames();
|
|
5034
4683
|
for (let attr of nodeAttrsNames) {
|
|
5035
4684
|
if (attr === "t-custom" || attr === "t-custom-") {
|
|
5036
|
-
throw new
|
|
4685
|
+
throw new OwlError("Missing custom directive name with t-custom directive");
|
|
5037
4686
|
}
|
|
5038
4687
|
if (attr.startsWith("t-custom-")) {
|
|
5039
4688
|
const directiveName = attr.split(".")[0].slice(9);
|
|
5040
4689
|
const customDirective = ctx.customDirectives[directiveName];
|
|
5041
4690
|
if (!customDirective) {
|
|
5042
|
-
throw new
|
|
4691
|
+
throw new OwlError(`Custom directive "${directiveName}" is not defined`);
|
|
5043
4692
|
}
|
|
5044
4693
|
const value = node.getAttribute(attr);
|
|
5045
4694
|
const modifiers = attr.split(".").slice(1);
|
|
@@ -5047,7 +4696,7 @@ function parseTCustom(node, ctx) {
|
|
|
5047
4696
|
try {
|
|
5048
4697
|
customDirective(node, value, modifiers);
|
|
5049
4698
|
} catch (error) {
|
|
5050
|
-
throw new
|
|
4699
|
+
throw new OwlError(
|
|
5051
4700
|
`Custom directive "${directiveName}" throw the following error: ${error}`
|
|
5052
4701
|
);
|
|
5053
4702
|
}
|
|
@@ -5094,7 +4743,7 @@ function parseDOMNode(node, ctx) {
|
|
|
5094
4743
|
return null;
|
|
5095
4744
|
}
|
|
5096
4745
|
if (tagName.startsWith("block-")) {
|
|
5097
|
-
throw new
|
|
4746
|
+
throw new OwlError(`Invalid tag name: '${tagName}'`);
|
|
5098
4747
|
}
|
|
5099
4748
|
ctx = Object.assign({}, ctx);
|
|
5100
4749
|
if (tagName === "pre") {
|
|
@@ -5111,14 +4760,14 @@ function parseDOMNode(node, ctx) {
|
|
|
5111
4760
|
for (let attr of nodeAttrsNames) {
|
|
5112
4761
|
const value = node.getAttribute(attr);
|
|
5113
4762
|
if (attr === "t-on" || attr === "t-on-") {
|
|
5114
|
-
throw new
|
|
4763
|
+
throw new OwlError("Missing event name with t-on directive");
|
|
5115
4764
|
}
|
|
5116
4765
|
if (attr.startsWith("t-on-")) {
|
|
5117
4766
|
on = on || {};
|
|
5118
4767
|
on[attr.slice(5)] = value;
|
|
5119
4768
|
} else if (attr.startsWith("t-model")) {
|
|
5120
4769
|
if (!["input", "select", "textarea"].includes(tagName)) {
|
|
5121
|
-
throw new
|
|
4770
|
+
throw new OwlError(
|
|
5122
4771
|
"The t-model directive only works with <input>, <textarea> and <select>"
|
|
5123
4772
|
);
|
|
5124
4773
|
}
|
|
@@ -5147,7 +4796,7 @@ function parseDOMNode(node, ctx) {
|
|
|
5147
4796
|
ctx.tModelInfo = model;
|
|
5148
4797
|
}
|
|
5149
4798
|
} else if (attr.startsWith("block-")) {
|
|
5150
|
-
throw new
|
|
4799
|
+
throw new OwlError(`Invalid attribute: '${attr}'`);
|
|
5151
4800
|
} else if (attr === "xmlns") {
|
|
5152
4801
|
ns = value;
|
|
5153
4802
|
} else if (attr.startsWith("t-translation-context-")) {
|
|
@@ -5156,7 +4805,7 @@ function parseDOMNode(node, ctx) {
|
|
|
5156
4805
|
attrsTranslationCtx[attrName] = value;
|
|
5157
4806
|
} else if (attr !== "t-name") {
|
|
5158
4807
|
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
|
5159
|
-
throw new
|
|
4808
|
+
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
|
5160
4809
|
}
|
|
5161
4810
|
const tModel = ctx.tModelInfo;
|
|
5162
4811
|
if (tModel && ["t-att-value", "t-attf-value"].includes(attr)) {
|
|
@@ -5223,7 +4872,7 @@ function parseTForEach(node, ctx) {
|
|
|
5223
4872
|
node.removeAttribute("t-as");
|
|
5224
4873
|
const key = node.getAttribute("t-key");
|
|
5225
4874
|
if (!key) {
|
|
5226
|
-
throw new
|
|
4875
|
+
throw new OwlError(
|
|
5227
4876
|
`"Directive t-foreach should always be used with a t-key!" (expression: t-foreach="${collection}" t-as="${elem}")`
|
|
5228
4877
|
);
|
|
5229
4878
|
}
|
|
@@ -5272,7 +4921,7 @@ function parseTCall(node, ctx) {
|
|
|
5272
4921
|
return null;
|
|
5273
4922
|
}
|
|
5274
4923
|
if (node.tagName !== "t") {
|
|
5275
|
-
throw new
|
|
4924
|
+
throw new OwlError(
|
|
5276
4925
|
`Directive 't-call' can only be used on <t> nodes (used on a <${node.tagName}>)`
|
|
5277
4926
|
);
|
|
5278
4927
|
}
|
|
@@ -5376,7 +5025,7 @@ function parseComponent(node, ctx) {
|
|
|
5376
5025
|
const firstLetter = name[0];
|
|
5377
5026
|
let isDynamic = node.hasAttribute("t-component");
|
|
5378
5027
|
if (isDynamic && name !== "t") {
|
|
5379
|
-
throw new
|
|
5028
|
+
throw new OwlError(
|
|
5380
5029
|
`Directive 't-component' can only be used on <t> nodes (used on a <${name}>)`
|
|
5381
5030
|
);
|
|
5382
5031
|
}
|
|
@@ -5406,7 +5055,7 @@ function parseComponent(node, ctx) {
|
|
|
5406
5055
|
on[name2.slice(5)] = value;
|
|
5407
5056
|
} else {
|
|
5408
5057
|
const message = directiveErrorMap.get(name2.split("-").slice(0, 2).join("-"));
|
|
5409
|
-
throw new
|
|
5058
|
+
throw new OwlError(message || `unsupported directive on Component: ${name2}`);
|
|
5410
5059
|
}
|
|
5411
5060
|
} else {
|
|
5412
5061
|
props2 = props2 || {};
|
|
@@ -5419,7 +5068,7 @@ function parseComponent(node, ctx) {
|
|
|
5419
5068
|
const slotNodes = Array.from(clone.querySelectorAll("[t-set-slot]"));
|
|
5420
5069
|
for (let slotNode of slotNodes) {
|
|
5421
5070
|
if (slotNode.tagName !== "t") {
|
|
5422
|
-
throw new
|
|
5071
|
+
throw new OwlError(
|
|
5423
5072
|
`Directive 't-set-slot' can only be used on <t> nodes (used on a <${slotNode.tagName}>)`
|
|
5424
5073
|
);
|
|
5425
5074
|
}
|
|
@@ -5606,24 +5255,24 @@ function normalizeTIf(el) {
|
|
|
5606
5255
|
let nattr = (name) => +!!node.getAttribute(name);
|
|
5607
5256
|
if (prevElem && (pattr("t-if") || pattr("t-elif"))) {
|
|
5608
5257
|
if (pattr("t-foreach")) {
|
|
5609
|
-
throw new
|
|
5258
|
+
throw new OwlError(
|
|
5610
5259
|
"t-if cannot stay at the same level as t-foreach when using t-elif or t-else"
|
|
5611
5260
|
);
|
|
5612
5261
|
}
|
|
5613
5262
|
if (["t-if", "t-elif", "t-else"].map(nattr).reduce(function(a, b) {
|
|
5614
5263
|
return a + b;
|
|
5615
5264
|
}) > 1) {
|
|
5616
|
-
throw new
|
|
5265
|
+
throw new OwlError("Only one conditional branching directive is allowed per node");
|
|
5617
5266
|
}
|
|
5618
5267
|
let textNode;
|
|
5619
5268
|
while ((textNode = node.previousSibling) !== prevElem) {
|
|
5620
5269
|
if (textNode.nodeValue.trim().length && textNode.nodeType !== 8) {
|
|
5621
|
-
throw new
|
|
5270
|
+
throw new OwlError("text is not allowed between branching directives");
|
|
5622
5271
|
}
|
|
5623
5272
|
textNode.remove();
|
|
5624
5273
|
}
|
|
5625
5274
|
} else {
|
|
5626
|
-
throw new
|
|
5275
|
+
throw new OwlError(
|
|
5627
5276
|
"t-elif and t-else directives must be preceded by a t-if or t-elif directive"
|
|
5628
5277
|
);
|
|
5629
5278
|
}
|
|
@@ -5635,7 +5284,7 @@ function normalizeTOut(el) {
|
|
|
5635
5284
|
);
|
|
5636
5285
|
for (const el2 of elements) {
|
|
5637
5286
|
if (el2.childNodes.length) {
|
|
5638
|
-
throw new
|
|
5287
|
+
throw new OwlError(`Cannot have t-out on a component that already has content`);
|
|
5639
5288
|
}
|
|
5640
5289
|
const value = el2.getAttribute("t-out");
|
|
5641
5290
|
el2.removeAttribute("t-out");
|
|
@@ -6042,7 +5691,7 @@ ${code}`;
|
|
|
6042
5691
|
generateHandlerCode(rawEvent, handler) {
|
|
6043
5692
|
const modifiers = rawEvent.split(".").slice(1).map((m) => {
|
|
6044
5693
|
if (!MODS.has(m)) {
|
|
6045
|
-
throw new
|
|
5694
|
+
throw new OwlError(`Unknown event modifier: '${m}'`);
|
|
6046
5695
|
}
|
|
6047
5696
|
return `"${m}"`;
|
|
6048
5697
|
});
|
|
@@ -6593,7 +6242,7 @@ ${code}`;
|
|
|
6593
6242
|
case "translate":
|
|
6594
6243
|
break;
|
|
6595
6244
|
default:
|
|
6596
|
-
throw new
|
|
6245
|
+
throw new OwlError(`Invalid prop suffix: ${suffix}`);
|
|
6597
6246
|
}
|
|
6598
6247
|
}
|
|
6599
6248
|
name = /^[a-z_]+$/i.test(name) ? name : `'${name}'`;
|
|
@@ -6809,7 +6458,7 @@ function compile(template, options = {
|
|
|
6809
6458
|
} catch (originalError) {
|
|
6810
6459
|
const { name } = options;
|
|
6811
6460
|
const nameStr = name ? `template "${name}"` : "anonymous template";
|
|
6812
|
-
const err = new
|
|
6461
|
+
const err = new OwlError(
|
|
6813
6462
|
`Failed to compile ${nameStr}: ${originalError.message}
|
|
6814
6463
|
|
|
6815
6464
|
generated code:
|