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.
package/dist/index.umd.js CHANGED
@@ -82,6 +82,7 @@
82
82
  this.loc = loc;
83
83
  }
84
84
  }
85
+ const isDep = target => target && (target instanceof aoye.Signal || target instanceof aoye.Computed || typeof target === 'function' || typeof target === 'string');
85
86
 
86
87
  class Tokenizer {
87
88
  TabSize = 2;
@@ -106,10 +107,13 @@
106
107
  this.hook = hook;
107
108
  this.useDedentAsEof = useDedentAsEof;
108
109
  if (useDedentAsEof) {
109
- this.setToken(TokenType.Indent, '');
110
- this.isFirstToken = true;
110
+ this.initIndentWhenUseDedentAsEof();
111
111
  }
112
112
  }
113
+ initIndentWhenUseDedentAsEof() {
114
+ this.setToken(TokenType.Indent, '');
115
+ this.isFirstToken = true;
116
+ }
113
117
  next() {
114
118
  this.i++;
115
119
  }
@@ -139,16 +143,23 @@
139
143
  throwUnclosed(code, message, startOffset, startLine, startCol) {
140
144
  throw new ParseSyntaxError(code, message, this.unclosedLoc(startOffset, startLine, startCol));
141
145
  }
142
- resume(_snapshot) {
146
+ resume({
147
+ dentStack,
148
+ waitingTokens,
149
+ ..._snapshot
150
+ }) {
143
151
  this.token = undefined;
144
152
  this.needIndent = false;
145
153
  this.isFirstToken = true;
146
- this.dentStack = [0];
154
+ this.dentStack = dentStack ? dentStack.slice() : [0];
155
+ if (waitingTokens) {
156
+ this.waitingTokens = waitingTokens.clone();
157
+ }
147
158
  Object.assign(this, _snapshot);
148
159
  }
149
- snapshot(keys) {
160
+ snapshot(keys, dtI = 0) {
150
161
  const snap = {
151
- i: this.i,
162
+ i: this.i + dtI,
152
163
  waitingTokens: this.waitingTokens.clone()
153
164
  };
154
165
  if (keys) {
@@ -161,8 +172,10 @@
161
172
  }
162
173
  return snap;
163
174
  }
164
- skip() {
165
- const logicDentLen = this.dentStack[this.dentStack.length - 1];
175
+ skip(targetDentLen) {
176
+ if (targetDentLen == undefined) {
177
+ targetDentLen = this.dentStack[this.dentStack.length - 1];
178
+ }
166
179
  let needIndent = false;
167
180
  let skipFragment = ``;
168
181
  this.token = undefined;
@@ -185,7 +198,7 @@
185
198
  isEmptyLine = _this$getDentValue.isEmptyLine;
186
199
  const currLen = value.length;
187
200
  if (isEmptyLine) continue;
188
- if (currLen > logicDentLen) {
201
+ if (currLen > targetDentLen) {
189
202
  skipFragment += value;
190
203
  } else {
191
204
  for (let i = this.dentStack.length - 1; i >= 0; i--) {
@@ -198,6 +211,9 @@
198
211
  break;
199
212
  }
200
213
  this.dentStack.pop();
214
+ if (expLen > targetDentLen) {
215
+ continue;
216
+ }
201
217
  if (!this.token) {
202
218
  this.setToken(TokenType.Dedent, String(expLen));
203
219
  } else {
@@ -252,29 +268,31 @@
252
268
  }
253
269
  outer: while (1) {
254
270
  if (this.needIndent) {
271
+ this.locStart();
255
272
  this.dent();
273
+ this.locEnd();
256
274
  } else {
257
275
  const char = this.code[this.i];
258
276
  switch (char) {
259
277
  case '\t':
260
278
  case ' ':
261
279
  break;
262
- case '\n':
263
- this.newLine();
264
- this.needIndent = true;
265
- break;
266
- case '=':
267
- this.assignment();
268
- break;
269
- case '|':
270
- this.pipe();
271
- break;
272
- case ';':
273
- this.setToken(TokenType.Semicolon, ';');
274
- break;
275
280
  default:
276
- if (false) ;
281
+ this.locStart();
277
282
  switch (char) {
283
+ case '\n':
284
+ this.newLine();
285
+ this.needIndent = true;
286
+ break;
287
+ case '=':
288
+ this.assignment();
289
+ break;
290
+ case '|':
291
+ this.pipe();
292
+ break;
293
+ case ';':
294
+ this.setToken(TokenType.Semicolon, ';');
295
+ break;
278
296
  case '/':
279
297
  this.comment();
280
298
  break;
@@ -299,7 +317,7 @@
299
317
  }
300
318
  break;
301
319
  }
302
- if (false) ;
320
+ this.locEnd();
303
321
  break;
304
322
  }
305
323
  this.next();
@@ -315,6 +333,10 @@
315
333
  this.handledTokens.push(this.token);
316
334
  }
317
335
  }
336
+ locStart() {
337
+ }
338
+ locEnd() {
339
+ }
318
340
  getComment() {
319
341
  let value = '/';
320
342
  let nextC = this.code[this.i + 1];
@@ -331,6 +353,7 @@
331
353
  this.getComment();
332
354
  }
333
355
  condExp() {
356
+ this.locStart();
334
357
  let value = '';
335
358
  this.token = null;
336
359
  let char = this.code[this.i];
@@ -345,12 +368,14 @@
345
368
  const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
346
369
  this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
347
370
  this.handledTokens.push(this.token);
371
+ this.locEnd();
348
372
  return this.token;
349
373
  }
350
374
  isEol(i) {
351
375
  return this.code[i] === '\n' || this.code[i] === '/';
352
376
  }
353
377
  jsExp() {
378
+ this.locStart();
354
379
  this.token = null;
355
380
  let value = '';
356
381
  let char = this.code[this.i];
@@ -364,6 +389,7 @@
364
389
  }
365
390
  this.setToken(TokenType.Identifier, value, 0);
366
391
  this.handledTokens.push(this.token);
392
+ this.locEnd();
367
393
  return this.token;
368
394
  }
369
395
  peekChar() {
@@ -551,7 +577,7 @@
551
577
  const prevLen = this.dentStack[this.dentStack.length - 1];
552
578
  if (currLen > prevLen) {
553
579
  this.dentStack.push(currLen);
554
- this.setToken(TokenType.Indent, currLen);
580
+ this.setToken(TokenType.Indent, currLen, 0);
555
581
  return indentHasLen;
556
582
  }
557
583
  if (currLen < prevLen) {
@@ -566,7 +592,7 @@
566
592
  }
567
593
  this.dentStack.pop();
568
594
  if (!this.token) {
569
- this.setToken(TokenType.Dedent, String(expLen));
595
+ this.setToken(TokenType.Dedent, String(expLen), 0);
570
596
  } else {
571
597
  this.waitingTokens.push({
572
598
  type: TokenType.Dedent,
@@ -975,7 +1001,7 @@
975
1001
  let _initProto;
976
1002
  class Compiler {
977
1003
  static {
978
- 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);
1004
+ 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);
979
1005
  _initProto = _applyDecs$e[0];
980
1006
  }
981
1007
  errors = (_initProto(this), []);
@@ -1077,9 +1103,9 @@
1077
1103
  parseComponentNode(node) {
1078
1104
  const name = this.parseName();
1079
1105
  this.tokenizer.nextToken();
1080
- const props = this.headerLineAndExtensions();
1081
1106
  node.type = NodeType.Component;
1082
1107
  node.componentName = name;
1108
+ const props = this.headerLineAndExtensions();
1083
1109
  node.props = props;
1084
1110
  this.hooks.parseComponentNode?.propsAdded?.call(this, node);
1085
1111
  const children = this.handleChildren();
@@ -1097,9 +1123,9 @@
1097
1123
  }
1098
1124
  const tagName = tagToken.value;
1099
1125
  this.tokenizer.nextToken();
1100
- const props = this.headerLineAndExtensions();
1101
1126
  node.type = NodeType.Element;
1102
1127
  node.tagName = tagName;
1128
+ const props = this.headerLineAndExtensions();
1103
1129
  node.props = props;
1104
1130
  this.hooks.parseElementNode?.propsAdded?.call(this, node);
1105
1131
  const children = this.handleChildren();
@@ -1173,17 +1199,17 @@
1173
1199
  }
1174
1200
  headerLineAndExtensions() {
1175
1201
  const props = [];
1176
- props.push(...this.attributeList());
1177
- if (this.tokenizer.token.type & TokenType.NewLine) {
1178
- this.tokenizer.nextToken();
1179
- }
1180
- while (this.tokenizer.token.type & TokenType.Pipe) {
1181
- this.tokenizer.nextToken();
1202
+ do {
1182
1203
  props.push(...this.attributeList());
1183
1204
  if (this.tokenizer.token.type & TokenType.NewLine) {
1184
1205
  this.tokenizer.nextToken();
1185
1206
  }
1186
- }
1207
+ if ((this.tokenizer.token.type & TokenType.Pipe) === 0) {
1208
+ break;
1209
+ } else {
1210
+ this.tokenizer.nextToken();
1211
+ }
1212
+ } while (true);
1187
1213
  return props;
1188
1214
  }
1189
1215
  attributeList() {
@@ -1207,25 +1233,35 @@
1207
1233
  const token = this.tokenizer.nextToken();
1208
1234
  if (token.value !== '=') {
1209
1235
  this.addError(ParseErrorCode.MISSING_ASSIGN, `属性 "${node.key.key}" 缺少 "=" 赋值符号`, node.key.loc ?? this.tokenizer.emptyLoc(), node);
1210
- node.loc.start = node.key.loc.start;
1211
- node.loc.end = node.key.loc.end;
1212
- node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1236
+ this.handleOnlyKeyLoc(node);
1213
1237
  return node;
1214
1238
  }
1215
1239
  const valueToken = this.tokenizer.nextToken();
1240
+ if (valueToken.type & TokenType.NewLine) {
1241
+ this.tokenizer.nextToken();
1242
+ node.value = this.parsePropertyInlineFragment();
1243
+ this.handleKeyValueLoc(node);
1244
+ return node;
1245
+ }
1216
1246
  if ((valueToken.type & ValueTokenType) === 0) {
1217
1247
  this.addError(ParseErrorCode.MISSING_PROP_ASSIGNMENT, `属性值不合法, "${valueToken.value}" 不合法`, valueToken.loc ?? this.tokenizer.emptyLoc(), node);
1218
- node.loc.start = node.key.loc.start;
1219
- node.loc.end = node.key.loc.end;
1220
- node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1248
+ this.handleOnlyKeyLoc(node);
1221
1249
  return node;
1222
1250
  }
1223
1251
  node.value = this.parsePropertyValue();
1224
1252
  this.tokenizer.nextToken();
1253
+ this.handleKeyValueLoc(node);
1254
+ return node;
1255
+ }
1256
+ handleOnlyKeyLoc(node) {
1257
+ node.loc.start = node.key.loc.start;
1258
+ node.loc.end = node.key.loc.end;
1259
+ node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1260
+ }
1261
+ handleKeyValueLoc(node) {
1225
1262
  node.loc.start = node.key.loc.start;
1226
1263
  node.loc.end = node.value.loc.end;
1227
1264
  node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
1228
- return node;
1229
1265
  }
1230
1266
  parsePropertyKey(node) {
1231
1267
  node.type = NodeType.PropertyKey;
@@ -1250,6 +1286,12 @@
1250
1286
  node.value = value;
1251
1287
  return node;
1252
1288
  }
1289
+ parsePropertyInlineFragment(node) {
1290
+ const list = this.handleChildren();
1291
+ node.type = NodeType.StaticValue;
1292
+ node.value = list;
1293
+ return node;
1294
+ }
1253
1295
  parseName(node) {
1254
1296
  const _this$tokenizer$_hook7 = this.tokenizer._hook({}),
1255
1297
  _this$tokenizer$_hook8 = _slicedToArray(_this$tokenizer$_hook7, 2),
@@ -1473,6 +1515,9 @@
1473
1515
  }
1474
1516
  if (sort & NodeSort.TokenizerSwitcher) {
1475
1517
  const switcher = stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
1518
+ if (parent.resumeSnapshot) {
1519
+ this.tokenizer.resume(parent.resumeSnapshot);
1520
+ }
1476
1521
  this.tokenizer = switcher.tokenizer;
1477
1522
  }
1478
1523
  if (parent.__logicType === FakeType.ForItem) {
@@ -1567,7 +1612,7 @@
1567
1612
  } else {
1568
1613
  const valueIsMapKey = Reflect.has(data[aoye.Keys.Raw], value);
1569
1614
  const val = data[aoye.Keys.Raw][value];
1570
- if (typeof val === 'function') {
1615
+ if (typeof val === 'function' || val instanceof InlineFragment) {
1571
1616
  _node = this.componentOrFragmentDeclaration(val, ctx);
1572
1617
  } else {
1573
1618
  const str = valueIsMapKey ? value : this.getFn(data, value);
@@ -1579,11 +1624,15 @@
1579
1624
  _node = this.createNode(value);
1580
1625
  }
1581
1626
  this.tokenizer.nextToken();
1582
- this.headerLine(_node);
1583
- this.extensionLines(_node);
1627
+ this.headerLineAndExtensions(_node);
1584
1628
  this.onePropParsed = this.oneRealPropParsed;
1585
1629
  if (_node.__logicType & TokenizerSwitcherBit) {
1586
1630
  this.tokenizer = _node.tokenizer;
1631
+ if (_node.fragmentSnapshot) {
1632
+ this.tokenizer.resume(_node.fragmentSnapshot);
1633
+ this.tokenizer.useDedentAsEof = true;
1634
+ this.tokenizer.initIndentWhenUseDedentAsEof();
1635
+ }
1587
1636
  }
1588
1637
  return _node;
1589
1638
  }
@@ -1665,7 +1714,7 @@
1665
1714
  _forNode$snapshot.isFirstToken;
1666
1715
  const snapshotForUpdate = _objectWithoutProperties(_forNode$snapshot, _excluded);
1667
1716
  let isFirstRender = true;
1668
- forNode.effect = new aoye.Effect(() => {
1717
+ forNode.effect = new this.Effect(() => {
1669
1718
  let arr = arrSignal.get();
1670
1719
  arr[aoye.Keys.Iterator];
1671
1720
  const prevCtx = aoye.getPulling();
@@ -1836,7 +1885,7 @@
1836
1885
  }
1837
1886
  }
1838
1887
  };
1839
- });
1888
+ }, aoye.ScheduleType.Render);
1840
1889
  return forNode.children[0] || forNode;
1841
1890
  }
1842
1891
  insertForItem(forNode, i, parentData, newChildren, before, snapshotForUpdate) {
@@ -1942,33 +1991,42 @@
1942
1991
  return this.setProp(node, key, value, hookI);
1943
1992
  }).get();
1944
1993
  } else if (typeof value === 'function') {
1945
- new aoye.Effect(() => {
1994
+ new this.Effect(() => {
1946
1995
  const res = value(data);
1947
1996
  const dispose = this.setProp(node, key, res, hookI);
1948
1997
  return dispose;
1949
- });
1998
+ }, aoye.ScheduleType.Render);
1950
1999
  } else if (valueIsMapKey) {
1951
- new aoye.Effect(() => {
2000
+ new this.Effect(() => {
1952
2001
  const res = data[value];
1953
2002
  const dispose = this.setProp(node, key, res, hookI);
1954
2003
  return dispose;
1955
- });
2004
+ }, aoye.ScheduleType.Render);
1956
2005
  } else {
1957
2006
  this.setProp(node, key, value, hookI);
1958
2007
  }
1959
2008
  }
1960
2009
  oneRealPropParsed = this.onePropParsed.bind(this);
1961
2010
  componentOrFragmentDeclaration(ComponentOrRender, ctx) {
1962
- let Component, render, child;
2011
+ let Component, tokenizer, child, fragmentSnapshot, resumeSnapshot;
1963
2012
  const isCC = ComponentOrRender.prototype instanceof aoye.Store;
1964
2013
  if (isCC) {
1965
2014
  Component = ComponentOrRender;
1966
2015
  child = Component.new();
2016
+ tokenizer = child.ui(true);
2017
+ } else if (ComponentOrRender instanceof InlineFragment) {
2018
+ const conf = ComponentOrRender;
2019
+ child = aoye.deepSignal({}, aoye.getPulling(), true);
2020
+ Object.setPrototypeOf(child, conf.data);
2021
+ tokenizer = conf.tokenizer;
2022
+ fragmentSnapshot = conf.snapshot;
2023
+ resumeSnapshot = tokenizer.snapshot(['token', 'needIndent', 'isFirstToken', 'dentStack', 'isFirstToken', 'useDedentAsEof']);
1967
2024
  } else {
1968
- render = ComponentOrRender;
2025
+ const render = ComponentOrRender;
1969
2026
  const boundStore = render.boundStore;
1970
2027
  child = aoye.deepSignal({}, aoye.getPulling(), true);
1971
2028
  Object.setPrototypeOf(child, boundStore);
2029
+ tokenizer = render(true);
1972
2030
  }
1973
2031
  const node = {
1974
2032
  __logicType: isCC ? FakeType.Component : FakeType.Fragment,
@@ -1976,7 +2034,9 @@
1976
2034
  realBefore: null,
1977
2035
  realAfter: null,
1978
2036
  data: child,
1979
- tokenizer: render ? render(true) : child.ui(true)
2037
+ tokenizer,
2038
+ fragmentSnapshot,
2039
+ resumeSnapshot
1980
2040
  };
1981
2041
  this.onePropParsed = createStoreOnePropParsed(child);
1982
2042
  node.realAfter = this.insertAfterAnchor('component-after');
@@ -2075,7 +2135,7 @@
2075
2135
  }
2076
2136
  ifNode.condition = signal;
2077
2137
  ifNode.realAfter = this.insertAfterAnchor(`${keyWord.value}-after`);
2078
- const ef = aoye.effect(({
2138
+ const ef = this.effect(({
2079
2139
  val
2080
2140
  }) => {
2081
2141
  if (val) {
@@ -2096,7 +2156,9 @@
2096
2156
  }
2097
2157
  }
2098
2158
  ifNode.isFirstRender = false;
2099
- }, [signal]);
2159
+ }, [signal], {
2160
+ type: 'render'
2161
+ });
2100
2162
  ifNode.effect = ef;
2101
2163
  return ifNode;
2102
2164
  }
@@ -2111,26 +2173,38 @@
2111
2173
  point = next;
2112
2174
  }
2113
2175
  }
2114
- extensionLines(_node) {
2115
- while (1) {
2116
- if ((this.tokenizer.token.type & TokenType.Pipe) === 0) {
2117
- return;
2176
+ headerLineAndExtensions(_node) {
2177
+ const tokenizer = this.tokenizer;
2178
+ do {
2179
+ const isComponent = _node.__logicType & TokenizerSwitcherBit;
2180
+ let snapshot, dentLen;
2181
+ const data = this.getData();
2182
+ const unHandledKey = this.attributeList(_node, data);
2183
+ if (isComponent) {
2184
+ snapshot = tokenizer.snapshot(undefined, -1);
2185
+ dentLen = tokenizer.dentStack[tokenizer.dentStack.length - 1];
2118
2186
  }
2119
- this.tokenizer.nextToken();
2120
- this.attributeList(_node);
2121
- if ((this.tokenizer.token.type & TokenType.NewLine) === 0) {
2122
- return;
2187
+ tokenizer.nextToken();
2188
+ if ((tokenizer.token.type & TokenType.Pipe) === 0) {
2189
+ if (isComponent && tokenizer.token.type & TokenType.Indent) {
2190
+ this.inlineFragment(_node, snapshot, data, unHandledKey);
2191
+ tokenizer.skip(dentLen);
2192
+ if ((tokenizer.token.type & TokenType.Pipe) === 0) {
2193
+ break;
2194
+ }
2195
+ } else {
2196
+ break;
2197
+ }
2123
2198
  }
2124
- this.tokenizer.nextToken();
2125
- }
2199
+ tokenizer.nextToken();
2200
+ } while (true);
2126
2201
  }
2127
- headerLine(_node) {
2128
- this.attributeList(_node);
2129
- this.tokenizer.nextToken();
2202
+ inlineFragment(_node, snapshot, data, key = 'children') {
2203
+ const value = new InlineFragment(snapshot, data, key, this.tokenizer);
2204
+ this.onePropParsed(data, _node, key, value, false, true);
2130
2205
  }
2131
- attributeList(_node) {
2206
+ attributeList(_node, data) {
2132
2207
  let key, eq;
2133
- const data = this.getData();
2134
2208
  while ((this.tokenizer.token.type & TokenType.NewLine) === 0) {
2135
2209
  if (key == null) {
2136
2210
  key = this.tokenizer.token.value;
@@ -2178,10 +2252,15 @@
2178
2252
  }
2179
2253
  this.tokenizer.nextToken();
2180
2254
  }
2255
+ return key;
2181
2256
  }
2182
2257
  config(opt) {
2183
2258
  Object.assign(this, opt);
2184
2259
  this.opt = opt;
2260
+ if (opt.noopEffect) {
2261
+ this.effect = aoye.noopEffect;
2262
+ this.Effect = aoye.NoopEffect;
2263
+ }
2185
2264
  }
2186
2265
  createNode(name) {
2187
2266
  return {
@@ -2231,6 +2310,8 @@
2231
2310
  setProp(node, key, value, hookI) {
2232
2311
  node.props[key] = value;
2233
2312
  }
2313
+ Effect = aoye.Effect;
2314
+ effect = aoye.effect;
2234
2315
  }
2235
2316
  function createStoreOnePropParsed(child) {
2236
2317
  const onePropParsed = (data, _, key, value, valueIsMapKey, isFn, hookI) => {
@@ -2255,6 +2336,15 @@
2255
2336
  };
2256
2337
  return onePropParsed;
2257
2338
  }
2339
+ class InlineFragment {
2340
+ [aoye.Keys.ProxyFreeObject] = true;
2341
+ constructor(snapshot, data, key, tokenizer) {
2342
+ this.snapshot = snapshot;
2343
+ this.data = data;
2344
+ this.key = key;
2345
+ this.tokenizer = tokenizer;
2346
+ }
2347
+ }
2258
2348
 
2259
2349
  function bobe(fragments, ...values) {
2260
2350
  const ui = function ui(isSub) {
@@ -2301,6 +2391,34 @@
2301
2391
  return context;
2302
2392
  };
2303
2393
 
2394
+ const depTokenizer = new Tokenizer(() => '', false);
2395
+ const effect = (callback, depOrOpt, opt) => {
2396
+ const isArray = Array.isArray(depOrOpt);
2397
+ const isSingleDep = isDep(depOrOpt);
2398
+ const deps = isArray ? depOrOpt : isSingleDep ? [depOrOpt] : [];
2399
+ const option = isArray || isSingleDep ? opt : depOrOpt;
2400
+ const newDeps = [];
2401
+ for (let i = 0; i < deps.length; i++) {
2402
+ const dep = deps[i];
2403
+ if (typeof dep === 'string') {
2404
+ depTokenizer.code = dep.trim() + '\n';
2405
+ let exp;
2406
+ while (depTokenizer.i < depTokenizer.code.length) {
2407
+ exp = depTokenizer.jsExp().value;
2408
+ depTokenizer.nextToken();
2409
+ newDeps.push(new Function('data', `let v;with(data){v=${exp};}return v;`).bind(undefined, aoye.Store.Current));
2410
+ }
2411
+ } else {
2412
+ newDeps.push(dep);
2413
+ }
2414
+ }
2415
+ return aoye.effect(callback, newDeps, option);
2416
+ };
2417
+
2418
+ Object.defineProperty(exports, "Store", {
2419
+ enumerable: true,
2420
+ get: function () { return aoye.Store; }
2421
+ });
2304
2422
  exports.Compiler = Compiler;
2305
2423
  exports.NodeType = NodeType;
2306
2424
  exports.ParseSyntaxError = ParseSyntaxError;
@@ -2308,12 +2426,7 @@
2308
2426
  exports.bobe = bobe;
2309
2427
  exports.context = context;
2310
2428
  exports.customRender = customRender;
2311
- Object.keys(aoye).forEach(function (k) {
2312
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
2313
- enumerable: true,
2314
- get: function () { return aoye[k]; }
2315
- });
2316
- });
2429
+ exports.effect = effect;
2317
2430
 
2318
2431
  }));
2319
2432
  //# sourceMappingURL=index.umd.js.map