@pilates/core 2.0.0 → 2.0.1

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.
@@ -52,12 +52,14 @@ export interface StyleDirtier {
52
52
  * `buildFlexGrammar` output that produced its grammar into a
53
53
  * `StyleDirtier`.
54
54
  *
55
- * The returned callback throws if `node` is not part of the
56
- * grammar's `styleInputs` (a node from a different / stale build),
57
- * or if an edge prop is called without an edge index. It is a no-op
58
- * when the grammar emits no input Field for the `(node, prop)`
59
- * which happens precisely when that prop can't affect layout (e.g.
60
- * `padding` on a childless leaf), so marking nothing is correct.
55
+ * The returned callback is a no-op when the grammar emits no input
56
+ * Field for the `(node, prop)` including the case where the grammar
57
+ * emits no input Field at all for `node` (every style input folded to
58
+ * a default-valued constant by phase 17; the `styleInputs` map then
59
+ * has no entry for the node). In all these cases, marking nothing is
60
+ * the correct precise behaviour because no layout field can move from
61
+ * the mutation. The callback throws only if an edge prop is called
62
+ * without an edge index.
61
63
  *
62
64
  * @internal
63
65
  */
@@ -1 +1 @@
1
- {"version":3,"file":"style-dirty.d.ts","sourceRoot":"","sources":["../../../src/algorithm/spineless/style-dirty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,qDAAqD;AACrD,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,CAAC;AAEhB,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjD;;;;;GAKG;AACH,MAA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AC,GAC1C,YAAY,CAyBd"}
@@ -35,30 +35,29 @@
35
35
  * `buildFlexGrammar` output that produced its grammar into a
36
36
  * `StyleDirtier`.
37
37
  *
38
- * The returned callback throws if `node` is not part of the
39
- * grammar's `styleInputs` (a node from a different / stale build),
40
- * or if an edge prop is called without an edge index. It is a no-op
41
- * when the grammar emits no input Field for the `(node, prop)`
42
- * which happens precisely when that prop can't affect layout (e.g.
43
- * `padding` on a childless leaf), so marking nothing is correct.
38
+ * The returned callback is a no-op when the grammar emits no input
39
+ * Field for the `(node, prop)` including the case where the grammar
40
+ * emits no input Field at all for `node` (every style input folded to
41
+ * a default-valued constant by phase 17; the `styleInputs` map then
42
+ * has no entry for the node). In all these cases, marking nothing is
43
+ * the correct precise behaviour because no layout field can move from
44
+ * the mutation. The callback throws only if an edge prop is called
45
+ * without an edge index.
44
46
  *
45
47
  * @internal
46
48
  */
47
49
  export function createStyleDirtier(runtime, styleInputs) {
48
50
  return (node, prop, edge) => {
49
51
  const entry = styleInputs.get(node);
50
- if (entry === undefined) {
51
- throw new Error('[spineless] markStyleDirty: node has no style inputs in this grammar — pass a node from the same buildFlexGrammar() tree');
52
- }
53
52
  let f;
54
53
  if (prop === 'padding' || prop === 'margin') {
55
54
  if (edge === undefined) {
56
55
  throw new Error(`[spineless] markStyleDirty: '${prop}' requires an edge index`);
57
56
  }
58
- f = entry[prop]?.[edge];
57
+ f = entry?.[prop]?.[edge];
59
58
  }
60
59
  else {
61
- f = entry[prop];
60
+ f = entry?.[prop];
62
61
  }
63
62
  // Marking nothing is the correct, precise behaviour when the
64
63
  // mutation cannot move any layout field. That is the case both
@@ -1 +1 @@
1
- {"version":3,"file":"style-dirty.js","sourceRoot":"","sources":["../../../src/algorithm/spineless/style-dirty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAmCH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAyB,EACzB,WAA2C;I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;QAEpC,IAAI,CAA4B,CAAC;QACjC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,0BAA0B,CAAC,CAAC;YAClF,CAAC;YACD,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QAED,6DAA6D;QAC7D,+DAA+D;QAC/D,+DAA+D;QAC/D,+DAA+D;QAC/D,6DAA6D;QAC7D,8DAA8D;QAC9D,qDAAqD;QACrD,IAAI,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAmB,CAAC,EAAE,CAAC;YAC9D,OAAO,CAAC,SAAS,CAAC,CAAmB,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "2.0.0";
1
+ export declare const VERSION = "2.0.1";
2
2
  export { Node } from './node.js';
3
3
  export { Edge } from './edge.js';
4
4
  export type { Align, Display, FlexDirection, FlexWrap, Justify, Length, Overflow, PositionType, Style, } from './style.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = '2.0.0';
1
+ export const VERSION = '2.0.1';
2
2
  // Tree
3
3
  export { Node } from './node.js';
4
4
  // Style values
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilates/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Headless flex layout engine for terminal UIs. Pure TypeScript, zero dependencies.",
5
5
  "license": "MIT",
6
6
  "author": "Zhijie Wang",