bobe 0.0.47 → 0.0.49

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.
@@ -81,6 +81,7 @@ class ParseSyntaxError extends SyntaxError {
81
81
  this.loc = loc;
82
82
  }
83
83
  }
84
+ const isDep = target => target && (target instanceof aoye.Signal || target instanceof aoye.Computed || typeof target === 'function' || typeof target === 'string');
84
85
 
85
86
  class Tokenizer {
86
87
  TabSize = 2;
@@ -105,10 +106,13 @@ class Tokenizer {
105
106
  this.hook = hook;
106
107
  this.useDedentAsEof = useDedentAsEof;
107
108
  if (useDedentAsEof) {
108
- this.setToken(TokenType.Indent, '');
109
- this.isFirstToken = true;
109
+ this.initIndentWhenUseDedentAsEof();
110
110
  }
111
111
  }
112
+ initIndentWhenUseDedentAsEof() {
113
+ this.setToken(TokenType.Indent, '');
114
+ this.isFirstToken = true;
115
+ }
112
116
  next() {
113
117
  {
114
118
  const char = this.code[this.i];
@@ -147,16 +151,23 @@ class Tokenizer {
147
151
  throwUnclosed(code, message, startOffset, startLine, startCol) {
148
152
  throw new ParseSyntaxError(code, message, this.unclosedLoc(startOffset, startLine, startCol));
149
153
  }
150
- resume(_snapshot) {
154
+ resume({
155
+ dentStack,
156
+ waitingTokens,
157
+ ..._snapshot
158
+ }) {
151
159
  this.token = undefined;
152
160
  this.needIndent = false;
153
161
  this.isFirstToken = true;
154
- this.dentStack = [0];
162
+ this.dentStack = dentStack ? dentStack.slice() : [0];
163
+ if (waitingTokens) {
164
+ this.waitingTokens = waitingTokens.clone();
165
+ }
155
166
  Object.assign(this, _snapshot);
156
167
  }
157
- snapshot(keys) {
168
+ snapshot(keys, dtI = 0) {
158
169
  const snap = {
159
- i: this.i,
170
+ i: this.i + dtI,
160
171
  waitingTokens: this.waitingTokens.clone()
161
172
  };
162
173
  if (keys) {
@@ -169,8 +180,10 @@ class Tokenizer {
169
180
  }
170
181
  return snap;
171
182
  }
172
- skip() {
173
- const logicDentLen = this.dentStack[this.dentStack.length - 1];
183
+ skip(targetDentLen) {
184
+ if (targetDentLen == undefined) {
185
+ targetDentLen = this.dentStack[this.dentStack.length - 1];
186
+ }
174
187
  let needIndent = false;
175
188
  let skipFragment = ``;
176
189
  this.token = undefined;
@@ -193,7 +206,7 @@ class Tokenizer {
193
206
  isEmptyLine = _this$getDentValue.isEmptyLine;
194
207
  const currLen = value.length;
195
208
  if (isEmptyLine) continue;
196
- if (currLen > logicDentLen) {
209
+ if (currLen > targetDentLen) {
197
210
  skipFragment += value;
198
211
  } else {
199
212
  for (let i = this.dentStack.length - 1; i >= 0; i--) {
@@ -206,6 +219,9 @@ class Tokenizer {
206
219
  break;
207
220
  }
208
221
  this.dentStack.pop();
222
+ if (expLen > targetDentLen) {
223
+ continue;
224
+ }
209
225
  if (!this.token) {
210
226
  this.setToken(TokenType.Dedent, String(expLen));
211
227
  } else {
@@ -272,33 +288,31 @@ class Tokenizer {
272
288
  }
273
289
  outer: while (1) {
274
290
  if (this.needIndent) {
291
+ this.locStart();
275
292
  this.dent();
293
+ this.locEnd();
276
294
  } else {
277
295
  const char = this.code[this.i];
278
296
  switch (char) {
279
297
  case '\t':
280
298
  case ' ':
281
299
  break;
282
- case '\n':
283
- this.newLine();
284
- this.needIndent = true;
285
- break;
286
- case '=':
287
- this.assignment();
288
- break;
289
- case '|':
290
- this.pipe();
291
- break;
292
- case ';':
293
- this.setToken(TokenType.Semicolon, ';');
294
- break;
295
300
  default:
296
- if (true) {
297
- this.preI = this.i;
298
- this.preCol = this.column;
299
- this.needLoc = true;
300
- }
301
+ this.locStart();
301
302
  switch (char) {
303
+ case '\n':
304
+ this.newLine();
305
+ this.needIndent = true;
306
+ break;
307
+ case '=':
308
+ this.assignment();
309
+ break;
310
+ case '|':
311
+ this.pipe();
312
+ break;
313
+ case ';':
314
+ this.setToken(TokenType.Semicolon, ';');
315
+ break;
302
316
  case '/':
303
317
  this.comment();
304
318
  break;
@@ -323,9 +337,7 @@ class Tokenizer {
323
337
  }
324
338
  break;
325
339
  }
326
- if (true) {
327
- this.needLoc = false;
328
- }
340
+ this.locEnd();
329
341
  break;
330
342
  }
331
343
  this.next();
@@ -341,6 +353,18 @@ class Tokenizer {
341
353
  this.handledTokens.push(this.token);
342
354
  }
343
355
  }
356
+ locStart() {
357
+ {
358
+ this.preCol = this.column;
359
+ this.preI = this.i;
360
+ this.needLoc = true;
361
+ }
362
+ }
363
+ locEnd() {
364
+ {
365
+ this.needLoc = false;
366
+ }
367
+ }
344
368
  getComment() {
345
369
  let value = '/';
346
370
  let nextC = this.code[this.i + 1];
@@ -357,11 +381,7 @@ class Tokenizer {
357
381
  this.getComment();
358
382
  }
359
383
  condExp() {
360
- {
361
- this.preCol = this.column;
362
- this.preI = this.i;
363
- this.needLoc = true;
364
- }
384
+ this.locStart();
365
385
  let value = '';
366
386
  this.token = null;
367
387
  let char = this.code[this.i];
@@ -376,20 +396,14 @@ class Tokenizer {
376
396
  const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
377
397
  this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
378
398
  this.handledTokens.push(this.token);
379
- {
380
- this.needLoc = false;
381
- }
399
+ this.locEnd();
382
400
  return this.token;
383
401
  }
384
402
  isEol(i) {
385
403
  return this.code[i] === '\n' || this.code[i] === '/';
386
404
  }
387
405
  jsExp() {
388
- {
389
- this.preCol = this.column;
390
- this.preI = this.i;
391
- this.needLoc = true;
392
- }
406
+ this.locStart();
393
407
  this.token = null;
394
408
  let value = '';
395
409
  let char = this.code[this.i];
@@ -403,9 +417,7 @@ class Tokenizer {
403
417
  }
404
418
  this.setToken(TokenType.Identifier, value, 0);
405
419
  this.handledTokens.push(this.token);
406
- {
407
- this.needLoc = false;
408
- }
420
+ this.locEnd();
409
421
  return this.token;
410
422
  }
411
423
  peekChar() {
@@ -593,7 +605,7 @@ class Tokenizer {
593
605
  const prevLen = this.dentStack[this.dentStack.length - 1];
594
606
  if (currLen > prevLen) {
595
607
  this.dentStack.push(currLen);
596
- this.setToken(TokenType.Indent, currLen);
608
+ this.setToken(TokenType.Indent, currLen, 0);
597
609
  return indentHasLen;
598
610
  }
599
611
  if (currLen < prevLen) {
@@ -608,7 +620,7 @@ class Tokenizer {
608
620
  }
609
621
  this.dentStack.pop();
610
622
  if (!this.token) {
611
- this.setToken(TokenType.Dedent, String(expLen));
623
+ this.setToken(TokenType.Dedent, String(expLen), 0);
612
624
  } else {
613
625
  this.waitingTokens.push({
614
626
  type: TokenType.Dedent,
@@ -1015,7 +1027,7 @@ var NodeType = function (NodeType) {
1015
1027
  let _initProto;
1016
1028
  class Compiler {
1017
1029
  static {
1018
- var _applyDecs$e = _slicedToArray(_applyDecs2311(this, [], [[NodeHook, 2, "parseProgram"], [[NodeHook, NodeLoc], 2, "parseComponentNode"], [[NodeHook, NodeLoc], 2, "parseElementNode"], [[NodeHook, NodeLoc], 2, "parseConditionalNode"], [[NodeHook, NodeLoc], 2, "parseLoopNode"], [NodeHook, 2, "parseProperty"], [[NodeHook, TokenLoc], 2, "parsePropertyKey"], [[NodeHook, TokenLoc], 2, "parseJsExp"], [[NodeHook, TokenLoc], 2, "parsePropertyValue"], [[NodeHook, TokenLoc], 2, "parseName"]]).e, 1);
1030
+ var _applyDecs$e = _slicedToArray(_applyDecs2311(this, [], [[NodeHook, 2, "parseProgram"], [[NodeHook, NodeLoc], 2, "parseComponentNode"], [[NodeHook, NodeLoc], 2, "parseElementNode"], [[NodeHook, NodeLoc], 2, "parseConditionalNode"], [[NodeHook, NodeLoc], 2, "parseLoopNode"], [NodeHook, 2, "parseProperty"], [[NodeHook, TokenLoc], 2, "parsePropertyKey"], [[NodeHook, TokenLoc], 2, "parseJsExp"], [[NodeHook, TokenLoc], 2, "parsePropertyValue"], [[NodeHook, NodeLoc], 2, "parsePropertyInlineFragment"], [[NodeHook, TokenLoc], 2, "parseName"]]).e, 1);
1019
1031
  _initProto = _applyDecs$e[0];
1020
1032
  }
1021
1033
  errors = (_initProto(this), []);
@@ -1117,9 +1129,9 @@ class Compiler {
1117
1129
  parseComponentNode(node) {
1118
1130
  const name = this.parseName();
1119
1131
  this.tokenizer.nextToken();
1120
- const props = this.headerLineAndExtensions();
1121
1132
  node.type = NodeType.Component;
1122
1133
  node.componentName = name;
1134
+ const props = this.headerLineAndExtensions();
1123
1135
  node.props = props;
1124
1136
  this.hooks.parseComponentNode?.propsAdded?.call(this, node);
1125
1137
  const children = this.handleChildren();
@@ -1137,9 +1149,9 @@ class Compiler {
1137
1149
  }
1138
1150
  const tagName = tagToken.value;
1139
1151
  this.tokenizer.nextToken();
1140
- const props = this.headerLineAndExtensions();
1141
1152
  node.type = NodeType.Element;
1142
1153
  node.tagName = tagName;
1154
+ const props = this.headerLineAndExtensions();
1143
1155
  node.props = props;
1144
1156
  this.hooks.parseElementNode?.propsAdded?.call(this, node);
1145
1157
  const children = this.handleChildren();
@@ -1213,17 +1225,17 @@ class Compiler {
1213
1225
  }
1214
1226
  headerLineAndExtensions() {
1215
1227
  const props = [];
1216
- props.push(...this.attributeList());
1217
- if (this.tokenizer.token.type & TokenType.NewLine) {
1218
- this.tokenizer.nextToken();
1219
- }
1220
- while (this.tokenizer.token.type & TokenType.Pipe) {
1221
- this.tokenizer.nextToken();
1228
+ do {
1222
1229
  props.push(...this.attributeList());
1223
1230
  if (this.tokenizer.token.type & TokenType.NewLine) {
1224
1231
  this.tokenizer.nextToken();
1225
1232
  }
1226
- }
1233
+ if ((this.tokenizer.token.type & TokenType.Pipe) === 0) {
1234
+ break;
1235
+ } else {
1236
+ this.tokenizer.nextToken();
1237
+ }
1238
+ } while (true);
1227
1239
  return props;
1228
1240
  }
1229
1241
  attributeList() {
@@ -1247,25 +1259,35 @@ class Compiler {
1247
1259
  const token = this.tokenizer.nextToken();
1248
1260
  if (token.value !== '=') {
1249
1261
  this.addError(ParseErrorCode.MISSING_ASSIGN, `属性 "${node.key.key}" 缺少 "=" 赋值符号`, node.key.loc ?? this.tokenizer.emptyLoc(), node);
1250
- node.loc.start = node.key.loc.start;
1251
- node.loc.end = node.key.loc.end;
1252
- node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1262
+ this.handleOnlyKeyLoc(node);
1253
1263
  return node;
1254
1264
  }
1255
1265
  const valueToken = this.tokenizer.nextToken();
1266
+ if (valueToken.type & TokenType.NewLine) {
1267
+ this.tokenizer.nextToken();
1268
+ node.value = this.parsePropertyInlineFragment();
1269
+ this.handleKeyValueLoc(node);
1270
+ return node;
1271
+ }
1256
1272
  if ((valueToken.type & ValueTokenType) === 0) {
1257
1273
  this.addError(ParseErrorCode.MISSING_PROP_ASSIGNMENT, `属性值不合法, "${valueToken.value}" 不合法`, valueToken.loc ?? this.tokenizer.emptyLoc(), node);
1258
- node.loc.start = node.key.loc.start;
1259
- node.loc.end = node.key.loc.end;
1260
- node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1274
+ this.handleOnlyKeyLoc(node);
1261
1275
  return node;
1262
1276
  }
1263
1277
  node.value = this.parsePropertyValue();
1264
1278
  this.tokenizer.nextToken();
1279
+ this.handleKeyValueLoc(node);
1280
+ return node;
1281
+ }
1282
+ handleOnlyKeyLoc(node) {
1283
+ node.loc.start = node.key.loc.start;
1284
+ node.loc.end = node.key.loc.end;
1285
+ node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1286
+ }
1287
+ handleKeyValueLoc(node) {
1265
1288
  node.loc.start = node.key.loc.start;
1266
1289
  node.loc.end = node.value.loc.end;
1267
1290
  node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1268
- return node;
1269
1291
  }
1270
1292
  parsePropertyKey(node) {
1271
1293
  node.type = NodeType.PropertyKey;
@@ -1290,6 +1312,12 @@ class Compiler {
1290
1312
  node.value = value;
1291
1313
  return node;
1292
1314
  }
1315
+ parsePropertyInlineFragment(node) {
1316
+ const list = this.handleChildren();
1317
+ node.type = NodeType.StaticValue;
1318
+ node.value = list;
1319
+ return node;
1320
+ }
1293
1321
  parseName(node) {
1294
1322
  const _this$tokenizer$_hook7 = this.tokenizer._hook({}),
1295
1323
  _this$tokenizer$_hook8 = _slicedToArray(_this$tokenizer$_hook7, 2),
@@ -1513,6 +1541,9 @@ class Interpreter {
1513
1541
  }
1514
1542
  if (sort & NodeSort.TokenizerSwitcher) {
1515
1543
  const switcher = stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
1544
+ if (parent.resumeSnapshot) {
1545
+ this.tokenizer.resume(parent.resumeSnapshot);
1546
+ }
1516
1547
  this.tokenizer = switcher.tokenizer;
1517
1548
  }
1518
1549
  if (parent.__logicType === FakeType.ForItem) {
@@ -1607,7 +1638,7 @@ class Interpreter {
1607
1638
  } else {
1608
1639
  const valueIsMapKey = Reflect.has(data[aoye.Keys.Raw], value);
1609
1640
  const val = data[aoye.Keys.Raw][value];
1610
- if (typeof val === 'function') {
1641
+ if (typeof val === 'function' || val instanceof InlineFragment) {
1611
1642
  _node = this.componentOrFragmentDeclaration(val, ctx);
1612
1643
  } else {
1613
1644
  const str = valueIsMapKey ? value : this.getFn(data, value);
@@ -1619,11 +1650,15 @@ class Interpreter {
1619
1650
  _node = this.createNode(value);
1620
1651
  }
1621
1652
  this.tokenizer.nextToken();
1622
- this.headerLine(_node);
1623
- this.extensionLines(_node);
1653
+ this.headerLineAndExtensions(_node);
1624
1654
  this.onePropParsed = this.oneRealPropParsed;
1625
1655
  if (_node.__logicType & TokenizerSwitcherBit) {
1626
1656
  this.tokenizer = _node.tokenizer;
1657
+ if (_node.fragmentSnapshot) {
1658
+ this.tokenizer.resume(_node.fragmentSnapshot);
1659
+ this.tokenizer.useDedentAsEof = true;
1660
+ this.tokenizer.initIndentWhenUseDedentAsEof();
1661
+ }
1627
1662
  }
1628
1663
  return _node;
1629
1664
  }
@@ -1705,7 +1740,7 @@ class Interpreter {
1705
1740
  _forNode$snapshot.isFirstToken;
1706
1741
  const snapshotForUpdate = _objectWithoutProperties(_forNode$snapshot, _excluded);
1707
1742
  let isFirstRender = true;
1708
- forNode.effect = new aoye.Effect(() => {
1743
+ forNode.effect = new this.Effect(() => {
1709
1744
  let arr = arrSignal.get();
1710
1745
  arr[aoye.Keys.Iterator];
1711
1746
  const prevCtx = aoye.getPulling();
@@ -1876,7 +1911,7 @@ class Interpreter {
1876
1911
  }
1877
1912
  }
1878
1913
  };
1879
- });
1914
+ }, aoye.ScheduleType.Render);
1880
1915
  return forNode.children[0] || forNode;
1881
1916
  }
1882
1917
  insertForItem(forNode, i, parentData, newChildren, before, snapshotForUpdate) {
@@ -1982,33 +2017,42 @@ class Interpreter {
1982
2017
  return this.setProp(node, key, value, hookI);
1983
2018
  }).get();
1984
2019
  } else if (typeof value === 'function') {
1985
- new aoye.Effect(() => {
2020
+ new this.Effect(() => {
1986
2021
  const res = value(data);
1987
2022
  const dispose = this.setProp(node, key, res, hookI);
1988
2023
  return dispose;
1989
- });
2024
+ }, aoye.ScheduleType.Render);
1990
2025
  } else if (valueIsMapKey) {
1991
- new aoye.Effect(() => {
2026
+ new this.Effect(() => {
1992
2027
  const res = data[value];
1993
2028
  const dispose = this.setProp(node, key, res, hookI);
1994
2029
  return dispose;
1995
- });
2030
+ }, aoye.ScheduleType.Render);
1996
2031
  } else {
1997
2032
  this.setProp(node, key, value, hookI);
1998
2033
  }
1999
2034
  }
2000
2035
  oneRealPropParsed = this.onePropParsed.bind(this);
2001
2036
  componentOrFragmentDeclaration(ComponentOrRender, ctx) {
2002
- let Component, render, child;
2037
+ let Component, tokenizer, child, fragmentSnapshot, resumeSnapshot;
2003
2038
  const isCC = ComponentOrRender.prototype instanceof aoye.Store;
2004
2039
  if (isCC) {
2005
2040
  Component = ComponentOrRender;
2006
2041
  child = Component.new();
2042
+ tokenizer = child.ui(true);
2043
+ } else if (ComponentOrRender instanceof InlineFragment) {
2044
+ const conf = ComponentOrRender;
2045
+ child = aoye.deepSignal({}, aoye.getPulling(), true);
2046
+ Object.setPrototypeOf(child, conf.data);
2047
+ tokenizer = conf.tokenizer;
2048
+ fragmentSnapshot = conf.snapshot;
2049
+ resumeSnapshot = tokenizer.snapshot(['token', 'needIndent', 'isFirstToken', 'dentStack', 'isFirstToken', 'useDedentAsEof']);
2007
2050
  } else {
2008
- render = ComponentOrRender;
2051
+ const render = ComponentOrRender;
2009
2052
  const boundStore = render.boundStore;
2010
2053
  child = aoye.deepSignal({}, aoye.getPulling(), true);
2011
2054
  Object.setPrototypeOf(child, boundStore);
2055
+ tokenizer = render(true);
2012
2056
  }
2013
2057
  const node = {
2014
2058
  __logicType: isCC ? FakeType.Component : FakeType.Fragment,
@@ -2016,7 +2060,9 @@ class Interpreter {
2016
2060
  realBefore: null,
2017
2061
  realAfter: null,
2018
2062
  data: child,
2019
- tokenizer: render ? render(true) : child.ui(true)
2063
+ tokenizer,
2064
+ fragmentSnapshot,
2065
+ resumeSnapshot
2020
2066
  };
2021
2067
  this.onePropParsed = createStoreOnePropParsed(child);
2022
2068
  node.realAfter = this.insertAfterAnchor('component-after');
@@ -2115,7 +2161,7 @@ class Interpreter {
2115
2161
  }
2116
2162
  ifNode.condition = signal;
2117
2163
  ifNode.realAfter = this.insertAfterAnchor(`${keyWord.value}-after`);
2118
- const ef = aoye.effect(({
2164
+ const ef = this.effect(({
2119
2165
  val
2120
2166
  }) => {
2121
2167
  if (val) {
@@ -2136,7 +2182,9 @@ class Interpreter {
2136
2182
  }
2137
2183
  }
2138
2184
  ifNode.isFirstRender = false;
2139
- }, [signal]);
2185
+ }, [signal], {
2186
+ type: 'render'
2187
+ });
2140
2188
  ifNode.effect = ef;
2141
2189
  return ifNode;
2142
2190
  }
@@ -2151,26 +2199,38 @@ class Interpreter {
2151
2199
  point = next;
2152
2200
  }
2153
2201
  }
2154
- extensionLines(_node) {
2155
- while (1) {
2156
- if ((this.tokenizer.token.type & TokenType.Pipe) === 0) {
2157
- return;
2202
+ headerLineAndExtensions(_node) {
2203
+ const tokenizer = this.tokenizer;
2204
+ do {
2205
+ const isComponent = _node.__logicType & TokenizerSwitcherBit;
2206
+ let snapshot, dentLen;
2207
+ const data = this.getData();
2208
+ const unHandledKey = this.attributeList(_node, data);
2209
+ if (isComponent) {
2210
+ snapshot = tokenizer.snapshot(undefined, -1);
2211
+ dentLen = tokenizer.dentStack[tokenizer.dentStack.length - 1];
2158
2212
  }
2159
- this.tokenizer.nextToken();
2160
- this.attributeList(_node);
2161
- if ((this.tokenizer.token.type & TokenType.NewLine) === 0) {
2162
- return;
2213
+ tokenizer.nextToken();
2214
+ if ((tokenizer.token.type & TokenType.Pipe) === 0) {
2215
+ if (isComponent && tokenizer.token.type & TokenType.Indent) {
2216
+ this.inlineFragment(_node, snapshot, data, unHandledKey);
2217
+ tokenizer.skip(dentLen);
2218
+ if ((tokenizer.token.type & TokenType.Pipe) === 0) {
2219
+ break;
2220
+ }
2221
+ } else {
2222
+ break;
2223
+ }
2163
2224
  }
2164
- this.tokenizer.nextToken();
2165
- }
2225
+ tokenizer.nextToken();
2226
+ } while (true);
2166
2227
  }
2167
- headerLine(_node) {
2168
- this.attributeList(_node);
2169
- this.tokenizer.nextToken();
2228
+ inlineFragment(_node, snapshot, data, key = 'children') {
2229
+ const value = new InlineFragment(snapshot, data, key, this.tokenizer);
2230
+ this.onePropParsed(data, _node, key, value, false, true);
2170
2231
  }
2171
- attributeList(_node) {
2232
+ attributeList(_node, data) {
2172
2233
  let key, eq;
2173
- const data = this.getData();
2174
2234
  while ((this.tokenizer.token.type & TokenType.NewLine) === 0) {
2175
2235
  if (key == null) {
2176
2236
  key = this.tokenizer.token.value;
@@ -2218,10 +2278,15 @@ class Interpreter {
2218
2278
  }
2219
2279
  this.tokenizer.nextToken();
2220
2280
  }
2281
+ return key;
2221
2282
  }
2222
2283
  config(opt) {
2223
2284
  Object.assign(this, opt);
2224
2285
  this.opt = opt;
2286
+ if (opt.noopEffect) {
2287
+ this.effect = aoye.noopEffect;
2288
+ this.Effect = aoye.NoopEffect;
2289
+ }
2225
2290
  }
2226
2291
  createNode(name) {
2227
2292
  return {
@@ -2271,6 +2336,8 @@ class Interpreter {
2271
2336
  setProp(node, key, value, hookI) {
2272
2337
  node.props[key] = value;
2273
2338
  }
2339
+ Effect = aoye.Effect;
2340
+ effect = aoye.effect;
2274
2341
  }
2275
2342
  function createStoreOnePropParsed(child) {
2276
2343
  const onePropParsed = (data, _, key, value, valueIsMapKey, isFn, hookI) => {
@@ -2295,6 +2362,15 @@ function createStoreOnePropParsed(child) {
2295
2362
  };
2296
2363
  return onePropParsed;
2297
2364
  }
2365
+ class InlineFragment {
2366
+ [aoye.Keys.ProxyFreeObject] = true;
2367
+ constructor(snapshot, data, key, tokenizer) {
2368
+ this.snapshot = snapshot;
2369
+ this.data = data;
2370
+ this.key = key;
2371
+ this.tokenizer = tokenizer;
2372
+ }
2373
+ }
2298
2374
 
2299
2375
  function bobe(fragments, ...values) {
2300
2376
  const ui = function ui(isSub) {
@@ -2341,6 +2417,34 @@ const context = name => {
2341
2417
  return context;
2342
2418
  };
2343
2419
 
2420
+ const depTokenizer = new Tokenizer(() => '', false);
2421
+ const effect = (callback, depOrOpt, opt) => {
2422
+ const isArray = Array.isArray(depOrOpt);
2423
+ const isSingleDep = isDep(depOrOpt);
2424
+ const deps = isArray ? depOrOpt : isSingleDep ? [depOrOpt] : [];
2425
+ const option = isArray || isSingleDep ? opt : depOrOpt;
2426
+ const newDeps = [];
2427
+ for (let i = 0; i < deps.length; i++) {
2428
+ const dep = deps[i];
2429
+ if (typeof dep === 'string') {
2430
+ depTokenizer.code = dep.trim() + '\n';
2431
+ let exp;
2432
+ while (depTokenizer.i < depTokenizer.code.length) {
2433
+ exp = depTokenizer.jsExp().value;
2434
+ depTokenizer.nextToken();
2435
+ newDeps.push(new Function('data', `let v;with(data){v=${exp};}return v;`).bind(undefined, aoye.Store.Current));
2436
+ }
2437
+ } else {
2438
+ newDeps.push(dep);
2439
+ }
2440
+ }
2441
+ return aoye.effect(callback, newDeps, option);
2442
+ };
2443
+
2444
+ Object.defineProperty(exports, "Store", {
2445
+ enumerable: true,
2446
+ get: function () { return aoye.Store; }
2447
+ });
2344
2448
  exports.Compiler = Compiler;
2345
2449
  exports.NodeType = NodeType;
2346
2450
  exports.ParseSyntaxError = ParseSyntaxError;
@@ -2348,10 +2452,5 @@ exports.Tokenizer = Tokenizer;
2348
2452
  exports.bobe = bobe;
2349
2453
  exports.context = context;
2350
2454
  exports.customRender = customRender;
2351
- Object.keys(aoye).forEach(function (k) {
2352
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
2353
- enumerable: true,
2354
- get: function () { return aoye[k]; }
2355
- });
2356
- });
2455
+ exports.effect = effect;
2357
2456
  //# sourceMappingURL=bobe.compiler.cjs.js.map