@expressive/mvc 0.30.0 → 0.31.0

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/lib/index.d.ts CHANGED
@@ -71,7 +71,7 @@ interface Observable {
71
71
  get(effect: Model.Effect<this>): Callback;
72
72
  set(): Promise<Model.Event<this>[]>;
73
73
  set(timeout: number): Promise<Model.Event<this>[] | false>;
74
- set<T extends Model.Values<this>>(source: T, only?: (keyof T)[]): Promise<Model.Event<T>[] | false>;
74
+ set<T extends Model.Values<this>>(from: T, only?: (keyof T)[]): Promise<Model.Event<T>[] | false>;
75
75
  set<K extends Model.Key<this>>(key: K, value: Model.Value<this[K]>): Promise<Model.Event<this>[] | false>;
76
76
  set<K extends Model.Event<this>>(key: K): Promise<Model.Event<this>[] | false>;
77
77
  }
@@ -342,7 +342,7 @@ declare class Control<T extends {} = any> {
342
342
  static use: Control.UseHook;
343
343
  static has: Control.GetContext;
344
344
  static for: typeof control;
345
- static apply: typeof apply;
345
+ static does: typeof does;
346
346
  static watch: typeof watch;
347
347
  id: string | number | false;
348
348
  subject: T;
@@ -367,7 +367,7 @@ type Focus<T extends {}> = T & {
367
367
  is: T;
368
368
  };
369
369
  declare function watch<T extends {}>(value: T, cb: Observer): Focus<T>;
370
- declare function apply<T = any>(instruction: Control.Instruction<T>): T;
370
+ declare function does<T = any>(instruction: Control.Instruction<T>): T;
371
371
 
372
372
  declare const STATE = "__state";
373
373
  declare const UPDATE = "__update";
package/lib/index.esm.js CHANGED
@@ -540,7 +540,7 @@ Control.after = new Set();
540
540
  Control.before = new Set();
541
541
  Control.pending = new Set();
542
542
  Control.for = control;
543
- Control.apply = apply;
543
+ Control.does = does;
544
544
  Control.watch = watch;
545
545
  function control(subject, ready) {
546
546
  const control = REGISTER.get(subject);
@@ -605,7 +605,7 @@ function watch(value, cb) {
605
605
  OBSERVER.set(value, cb);
606
606
  return value;
607
607
  }
608
- function apply(instruction) {
608
+ function does(instruction) {
609
609
  const placeholder = Symbol("instruction");
610
610
  INSTRUCT.set(placeholder, (onto, key) => {
611
611
  delete onto.subject[key];
@@ -620,7 +620,7 @@ const Oops$3 = issues({
620
620
  DuplicatePending: (key) => `Invoked action ${key} but one is already active.`
621
621
  });
622
622
  function run(task) {
623
- return apply((key, control) => {
623
+ return does((key, control) => {
624
624
  let pending = false;
625
625
  const invoke = (...args) => __awaiter(this, void 0, void 0, function* () {
626
626
  if (pending)
@@ -654,7 +654,7 @@ const Oops$2 = issues({
654
654
  AmbientRequired: (requested, requester) => `Attempted to find an instance of ${requested} in context. It is required by ${requester}, but one could not be found.`
655
655
  });
656
656
  function get(arg0, arg1) {
657
- return apply((key, control) => {
657
+ return does((key, control) => {
658
658
  let { subject } = control;
659
659
  if (typeof arg0 == "symbol")
660
660
  throw Oops$2.PeerNotAllowed(subject, key);
@@ -780,7 +780,7 @@ function flushComputed() {
780
780
  Control.before.add(flushComputed);
781
781
 
782
782
  function ref(arg, arg2) {
783
- return apply((key, source) => {
783
+ return does((key, source) => {
784
784
  let value = {};
785
785
  if (typeof arg == "object")
786
786
  for (const key in control(arg, true).state)
@@ -815,7 +815,7 @@ const Oops$1 = issues({
815
815
  NotReady: (model, key) => `Value ${model}.${key} value is not yet available.`
816
816
  });
817
817
  function set(value, argument) {
818
- return apply((key, control) => {
818
+ return does((key, control) => {
819
819
  const { state, subject } = control;
820
820
  if (typeof value == "function" || value instanceof Promise) {
821
821
  const output = {};
@@ -885,7 +885,7 @@ function set(value, argument) {
885
885
  }
886
886
 
887
887
  function use(input, argument) {
888
- return apply((key, source) => {
888
+ return does((key, source) => {
889
889
  const { state, subject } = source;
890
890
  if (typeof input === "function")
891
891
  input = new input();
package/lib/index.js CHANGED
@@ -544,7 +544,7 @@ Control.after = new Set();
544
544
  Control.before = new Set();
545
545
  Control.pending = new Set();
546
546
  Control.for = control;
547
- Control.apply = apply;
547
+ Control.does = does;
548
548
  Control.watch = watch;
549
549
  function control(subject, ready) {
550
550
  const control = REGISTER.get(subject);
@@ -609,7 +609,7 @@ function watch(value, cb) {
609
609
  OBSERVER.set(value, cb);
610
610
  return value;
611
611
  }
612
- function apply(instruction) {
612
+ function does(instruction) {
613
613
  const placeholder = Symbol("instruction");
614
614
  INSTRUCT.set(placeholder, (onto, key) => {
615
615
  delete onto.subject[key];
@@ -624,7 +624,7 @@ const Oops$3 = issues({
624
624
  DuplicatePending: (key) => `Invoked action ${key} but one is already active.`
625
625
  });
626
626
  function run(task) {
627
- return apply((key, control) => {
627
+ return does((key, control) => {
628
628
  let pending = false;
629
629
  const invoke = (...args) => __awaiter(this, void 0, void 0, function* () {
630
630
  if (pending)
@@ -658,7 +658,7 @@ const Oops$2 = issues({
658
658
  AmbientRequired: (requested, requester) => `Attempted to find an instance of ${requested} in context. It is required by ${requester}, but one could not be found.`
659
659
  });
660
660
  function get(arg0, arg1) {
661
- return apply((key, control) => {
661
+ return does((key, control) => {
662
662
  let { subject } = control;
663
663
  if (typeof arg0 == "symbol")
664
664
  throw Oops$2.PeerNotAllowed(subject, key);
@@ -784,7 +784,7 @@ function flushComputed() {
784
784
  Control.before.add(flushComputed);
785
785
 
786
786
  function ref(arg, arg2) {
787
- return apply((key, source) => {
787
+ return does((key, source) => {
788
788
  let value = {};
789
789
  if (typeof arg == "object")
790
790
  for (const key in control(arg, true).state)
@@ -819,7 +819,7 @@ const Oops$1 = issues({
819
819
  NotReady: (model, key) => `Value ${model}.${key} value is not yet available.`
820
820
  });
821
821
  function set(value, argument) {
822
- return apply((key, control) => {
822
+ return does((key, control) => {
823
823
  const { state, subject } = control;
824
824
  if (typeof value == "function" || value instanceof Promise) {
825
825
  const output = {};
@@ -889,7 +889,7 @@ function set(value, argument) {
889
889
  }
890
890
 
891
891
  function use(input, argument) {
892
- return apply((key, source) => {
892
+ return does((key, source) => {
893
893
  const { state, subject } = source;
894
894
  if (typeof input === "function")
895
895
  input = new input();
package/package.json CHANGED
@@ -26,6 +26,6 @@
26
26
  "prebuild": "rm -rf lib/",
27
27
  "preversion": "npm run test && npm run build"
28
28
  },
29
- "version": "0.30.0",
30
- "gitHead": "8e2ed856c216a18e350494fef186adbee3c20f73"
29
+ "version": "0.31.0",
30
+ "gitHead": "63fd9a26371cb53d00ff2e3f5f2673660c6213de"
31
31
  }