@connectedxm/zpl-generator 0.0.1 → 0.0.2-beta.3

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.es.js CHANGED
@@ -130,10 +130,10 @@ class O extends Error {
130
130
  else if (i.path.length === 0)
131
131
  r._errors.push(t(i));
132
132
  else {
133
- let o = r, h = 0;
134
- for (; h < i.path.length; ) {
135
- const f = i.path[h];
136
- h === i.path.length - 1 ? (o[f] = o[f] || { _errors: [] }, o[f]._errors.push(t(i))) : o[f] = o[f] || { _errors: [] }, o = o[f], h++;
133
+ let o = r, f = 0;
134
+ for (; f < i.path.length; ) {
135
+ const h = i.path[f];
136
+ f === i.path.length - 1 ? (o[h] = o[h] || { _errors: [] }, o[h]._errors.push(t(i))) : o[h] = o[h] || { _errors: [] }, o = o[h], f++;
137
137
  }
138
138
  }
139
139
  };
@@ -239,9 +239,9 @@ const Me = (n) => {
239
239
  message: s.message
240
240
  };
241
241
  let o = "";
242
- const h = r.filter((f) => !!f).slice().reverse();
243
- for (const f of h)
244
- o = f(i, { data: e, defaultError: o }).message;
242
+ const f = r.filter((h) => !!h).slice().reverse();
243
+ for (const h of f)
244
+ o = h(i, { data: e, defaultError: o }).message;
245
245
  return {
246
246
  ...s,
247
247
  path: a,
@@ -266,7 +266,7 @@ function c(n, e) {
266
266
  });
267
267
  n.common.issues.push(r);
268
268
  }
269
- class b {
269
+ class w {
270
270
  constructor() {
271
271
  this.value = "valid";
272
272
  }
@@ -294,7 +294,7 @@ class b {
294
294
  value: i
295
295
  });
296
296
  }
297
- return b.mergeObjectSync(e, r);
297
+ return w.mergeObjectSync(e, r);
298
298
  }
299
299
  static mergeObjectSync(e, t) {
300
300
  const r = {};
@@ -344,8 +344,8 @@ function g(n) {
344
344
  if (e && (t || r))
345
345
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
346
346
  return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
347
- const { message: h } = n;
348
- return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: h ?? r ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: h ?? t ?? o.defaultError };
347
+ const { message: f } = n;
348
+ return i.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: f ?? r ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: f ?? t ?? o.defaultError };
349
349
  }, description: s };
350
350
  }
351
351
  class _ {
@@ -367,7 +367,7 @@ class _ {
367
367
  }
368
368
  _processInputParams(e) {
369
369
  return {
370
- status: new b(),
370
+ status: new w(),
371
371
  ctx: {
372
372
  common: e.parent.common,
373
373
  data: e.data,
@@ -469,7 +469,7 @@ class _ {
469
469
  code: d.custom,
470
470
  ...r(s)
471
471
  });
472
- return typeof Promise < "u" && i instanceof Promise ? i.then((h) => h ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
472
+ return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
473
473
  });
474
474
  }
475
475
  refinement(e, t) {
@@ -612,7 +612,7 @@ class R extends _ {
612
612
  received: a.parsedType
613
613
  }), m;
614
614
  }
615
- const r = new b();
615
+ const r = new w();
616
616
  let s;
617
617
  for (const a of this._def.checks)
618
618
  if (a.kind === "min")
@@ -1003,7 +1003,7 @@ class B extends _ {
1003
1003
  }), m;
1004
1004
  }
1005
1005
  let r;
1006
- const s = new b();
1006
+ const s = new w();
1007
1007
  for (const a of this._def.checks)
1008
1008
  a.kind === "int" ? v.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
1009
1009
  code: d.invalid_type,
@@ -1175,7 +1175,7 @@ class z extends _ {
1175
1175
  if (this._getType(e) !== u.bigint)
1176
1176
  return this._getInvalidInput(e);
1177
1177
  let r;
1178
- const s = new b();
1178
+ const s = new w();
1179
1179
  for (const a of this._def.checks)
1180
1180
  a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), c(r, {
1181
1181
  code: d.too_small,
@@ -1328,7 +1328,7 @@ class q extends _ {
1328
1328
  code: d.invalid_date
1329
1329
  }), m;
1330
1330
  }
1331
- const r = new b();
1331
+ const r = new w();
1332
1332
  let s;
1333
1333
  for (const a of this._def.checks)
1334
1334
  a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), c(s, {
@@ -1453,7 +1453,7 @@ ke.create = (n) => new ke({
1453
1453
  typeName: p.ZodAny,
1454
1454
  ...g(n)
1455
1455
  });
1456
- class we extends _ {
1456
+ class be extends _ {
1457
1457
  constructor() {
1458
1458
  super(...arguments), this._unknown = !0;
1459
1459
  }
@@ -1461,7 +1461,7 @@ class we extends _ {
1461
1461
  return S(e.data);
1462
1462
  }
1463
1463
  }
1464
- we.create = (n) => new we({
1464
+ be.create = (n) => new be({
1465
1465
  typeName: p.ZodUnknown,
1466
1466
  ...g(n)
1467
1467
  });
@@ -1479,7 +1479,7 @@ j.create = (n) => new j({
1479
1479
  typeName: p.ZodNever,
1480
1480
  ...g(n)
1481
1481
  });
1482
- class be extends _ {
1482
+ class we extends _ {
1483
1483
  _parse(e) {
1484
1484
  if (this._getType(e) !== u.undefined) {
1485
1485
  const r = this._getOrReturnCtx(e);
@@ -1492,7 +1492,7 @@ class be extends _ {
1492
1492
  return S(e.data);
1493
1493
  }
1494
1494
  }
1495
- be.create = (n) => new be({
1495
+ we.create = (n) => new we({
1496
1496
  typeName: p.ZodVoid,
1497
1497
  ...g(n)
1498
1498
  });
@@ -1532,9 +1532,9 @@ class T extends _ {
1532
1532
  exact: !1,
1533
1533
  message: s.maxLength.message
1534
1534
  }), r.dirty()), t.common.async)
1535
- return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Z(t, i, t.path, o)))).then((i) => b.mergeArray(r, i));
1535
+ return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new Z(t, i, t.path, o)))).then((i) => w.mergeArray(r, i));
1536
1536
  const a = [...t.data].map((i, o) => s.type._parseSync(new Z(t, i, t.path, o)));
1537
- return b.mergeArray(r, a);
1537
+ return w.mergeArray(r, a);
1538
1538
  }
1539
1539
  get element() {
1540
1540
  return this._def.type;
@@ -1597,47 +1597,47 @@ class k extends _ {
1597
1597
  }
1598
1598
  _parse(e) {
1599
1599
  if (this._getType(e) !== u.object) {
1600
- const f = this._getOrReturnCtx(e);
1601
- return c(f, {
1600
+ const h = this._getOrReturnCtx(e);
1601
+ return c(h, {
1602
1602
  code: d.invalid_type,
1603
1603
  expected: u.object,
1604
- received: f.parsedType
1604
+ received: h.parsedType
1605
1605
  }), m;
1606
1606
  }
1607
1607
  const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1608
1608
  if (!(this._def.catchall instanceof j && this._def.unknownKeys === "strip"))
1609
- for (const f in s.data)
1610
- i.includes(f) || o.push(f);
1611
- const h = [];
1612
- for (const f of i) {
1613
- const y = a[f], C = s.data[f];
1614
- h.push({
1615
- key: { status: "valid", value: f },
1616
- value: y._parse(new Z(s, C, s.path, f)),
1617
- alwaysSet: f in s.data
1609
+ for (const h in s.data)
1610
+ i.includes(h) || o.push(h);
1611
+ const f = [];
1612
+ for (const h of i) {
1613
+ const y = a[h], C = s.data[h];
1614
+ f.push({
1615
+ key: { status: "valid", value: h },
1616
+ value: y._parse(new Z(s, C, s.path, h)),
1617
+ alwaysSet: h in s.data
1618
1618
  });
1619
1619
  }
1620
1620
  if (this._def.catchall instanceof j) {
1621
- const f = this._def.unknownKeys;
1622
- if (f === "passthrough")
1621
+ const h = this._def.unknownKeys;
1622
+ if (h === "passthrough")
1623
1623
  for (const y of o)
1624
- h.push({
1624
+ f.push({
1625
1625
  key: { status: "valid", value: y },
1626
1626
  value: { status: "valid", value: s.data[y] }
1627
1627
  });
1628
- else if (f === "strict")
1628
+ else if (h === "strict")
1629
1629
  o.length > 0 && (c(s, {
1630
1630
  code: d.unrecognized_keys,
1631
1631
  keys: o
1632
1632
  }), r.dirty());
1633
- else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1633
+ else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1634
1634
  } else {
1635
- const f = this._def.catchall;
1635
+ const h = this._def.catchall;
1636
1636
  for (const y of o) {
1637
1637
  const C = s.data[y];
1638
- h.push({
1638
+ f.push({
1639
1639
  key: { status: "valid", value: y },
1640
- value: f._parse(
1640
+ value: h._parse(
1641
1641
  new Z(s, C, s.path, y)
1642
1642
  //, ctx.child(key), value, getParsedType(value)
1643
1643
  ),
@@ -1646,17 +1646,17 @@ class k extends _ {
1646
1646
  }
1647
1647
  }
1648
1648
  return s.common.async ? Promise.resolve().then(async () => {
1649
- const f = [];
1650
- for (const y of h) {
1649
+ const h = [];
1650
+ for (const y of f) {
1651
1651
  const C = await y.key, ne = await y.value;
1652
- f.push({
1652
+ h.push({
1653
1653
  key: C,
1654
1654
  value: ne,
1655
1655
  alwaysSet: y.alwaysSet
1656
1656
  });
1657
1657
  }
1658
- return f;
1659
- }).then((f) => b.mergeObjectSync(r, f)) : b.mergeObjectSync(r, h);
1658
+ return h;
1659
+ }).then((h) => w.mergeObjectSync(r, h)) : w.mergeObjectSync(r, f);
1660
1660
  }
1661
1661
  get shape() {
1662
1662
  return this._def.shape();
@@ -1910,26 +1910,26 @@ class H extends _ {
1910
1910
  {
1911
1911
  let a;
1912
1912
  const i = [];
1913
- for (const h of r) {
1914
- const f = {
1913
+ for (const f of r) {
1914
+ const h = {
1915
1915
  ...t,
1916
1916
  common: {
1917
1917
  ...t.common,
1918
1918
  issues: []
1919
1919
  },
1920
1920
  parent: null
1921
- }, y = h._parseSync({
1921
+ }, y = f._parseSync({
1922
1922
  data: t.data,
1923
1923
  path: t.path,
1924
- parent: f
1924
+ parent: h
1925
1925
  });
1926
1926
  if (y.status === "valid")
1927
1927
  return y;
1928
- y.status === "dirty" && !a && (a = { result: y, ctx: f }), f.common.issues.length && i.push(f.common.issues);
1928
+ y.status === "dirty" && !a && (a = { result: y, ctx: h }), h.common.issues.length && i.push(h.common.issues);
1929
1929
  }
1930
1930
  if (a)
1931
1931
  return t.common.issues.push(...a.ctx.common.issues), a.result;
1932
- const o = i.map((h) => new O(h));
1932
+ const o = i.map((f) => new O(f));
1933
1933
  return c(t, {
1934
1934
  code: d.invalid_union,
1935
1935
  unionErrors: o
@@ -2015,10 +2015,10 @@ function de(n, e) {
2015
2015
  if (t === u.object && r === u.object) {
2016
2016
  const s = v.objectKeys(e), a = v.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = { ...n, ...e };
2017
2017
  for (const o of a) {
2018
- const h = de(n[o], e[o]);
2019
- if (!h.valid)
2018
+ const f = de(n[o], e[o]);
2019
+ if (!f.valid)
2020
2020
  return { valid: !1 };
2021
- i[o] = h.data;
2021
+ i[o] = f.data;
2022
2022
  }
2023
2023
  return { valid: !0, data: i };
2024
2024
  } else if (t === u.array && r === u.array) {
@@ -2026,10 +2026,10 @@ function de(n, e) {
2026
2026
  return { valid: !1 };
2027
2027
  const s = [];
2028
2028
  for (let a = 0; a < n.length; a++) {
2029
- const i = n[a], o = e[a], h = de(i, o);
2030
- if (!h.valid)
2029
+ const i = n[a], o = e[a], f = de(i, o);
2030
+ if (!f.valid)
2031
2031
  return { valid: !1 };
2032
- s.push(h.data);
2032
+ s.push(f.data);
2033
2033
  }
2034
2034
  return { valid: !0, data: s };
2035
2035
  } else return t === u.date && r === u.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
@@ -2097,10 +2097,10 @@ class E extends _ {
2097
2097
  type: "array"
2098
2098
  }), t.dirty());
2099
2099
  const a = [...r.data].map((i, o) => {
2100
- const h = this._def.items[o] || this._def.rest;
2101
- return h ? h._parse(new Z(r, i, r.path, o)) : null;
2100
+ const f = this._def.items[o] || this._def.rest;
2101
+ return f ? f._parse(new Z(r, i, r.path, o)) : null;
2102
2102
  }).filter((i) => !!i);
2103
- return r.common.async ? Promise.all(a).then((i) => b.mergeArray(t, i)) : b.mergeArray(t, a);
2103
+ return r.common.async ? Promise.all(a).then((i) => w.mergeArray(t, i)) : w.mergeArray(t, a);
2104
2104
  }
2105
2105
  get items() {
2106
2106
  return this._def.items;
@@ -2137,28 +2137,28 @@ class Se extends _ {
2137
2137
  expected: u.map,
2138
2138
  received: r.parsedType
2139
2139
  }), m;
2140
- const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, h], f) => ({
2141
- key: s._parse(new Z(r, o, r.path, [f, "key"])),
2142
- value: a._parse(new Z(r, h, r.path, [f, "value"]))
2140
+ const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, f], h) => ({
2141
+ key: s._parse(new Z(r, o, r.path, [h, "key"])),
2142
+ value: a._parse(new Z(r, f, r.path, [h, "value"]))
2143
2143
  }));
2144
2144
  if (r.common.async) {
2145
2145
  const o = /* @__PURE__ */ new Map();
2146
2146
  return Promise.resolve().then(async () => {
2147
- for (const h of i) {
2148
- const f = await h.key, y = await h.value;
2149
- if (f.status === "aborted" || y.status === "aborted")
2147
+ for (const f of i) {
2148
+ const h = await f.key, y = await f.value;
2149
+ if (h.status === "aborted" || y.status === "aborted")
2150
2150
  return m;
2151
- (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2151
+ (h.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(h.value, y.value);
2152
2152
  }
2153
2153
  return { status: t.value, value: o };
2154
2154
  });
2155
2155
  } else {
2156
2156
  const o = /* @__PURE__ */ new Map();
2157
- for (const h of i) {
2158
- const f = h.key, y = h.value;
2159
- if (f.status === "aborted" || y.status === "aborted")
2157
+ for (const f of i) {
2158
+ const h = f.key, y = f.value;
2159
+ if (h.status === "aborted" || y.status === "aborted")
2160
2160
  return m;
2161
- (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2161
+ (h.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(h.value, y.value);
2162
2162
  }
2163
2163
  return { status: t.value, value: o };
2164
2164
  }
@@ -2196,17 +2196,17 @@ class F extends _ {
2196
2196
  message: s.maxSize.message
2197
2197
  }), t.dirty());
2198
2198
  const a = this._def.valueType;
2199
- function i(h) {
2200
- const f = /* @__PURE__ */ new Set();
2201
- for (const y of h) {
2199
+ function i(f) {
2200
+ const h = /* @__PURE__ */ new Set();
2201
+ for (const y of f) {
2202
2202
  if (y.status === "aborted")
2203
2203
  return m;
2204
- y.status === "dirty" && t.dirty(), f.add(y.value);
2204
+ y.status === "dirty" && t.dirty(), h.add(y.value);
2205
2205
  }
2206
- return { status: t.value, value: f };
2206
+ return { status: t.value, value: h };
2207
2207
  }
2208
- const o = [...r.data.values()].map((h, f) => a._parse(new Z(r, h, r.path, f)));
2209
- return r.common.async ? Promise.all(o).then((h) => i(h)) : i(o);
2208
+ const o = [...r.data.values()].map((f, h) => a._parse(new Z(r, f, r.path, h)));
2209
+ return r.common.async ? Promise.all(o).then((f) => i(f)) : i(o);
2210
2210
  }
2211
2211
  min(e, t) {
2212
2212
  return new F({
@@ -2407,12 +2407,12 @@ class M extends _ {
2407
2407
  return Promise.resolve(i).then(async (o) => {
2408
2408
  if (t.value === "aborted")
2409
2409
  return m;
2410
- const h = await this._def.schema._parseAsync({
2410
+ const f = await this._def.schema._parseAsync({
2411
2411
  data: o,
2412
2412
  path: r.path,
2413
2413
  parent: r
2414
2414
  });
2415
- return h.status === "aborted" ? m : h.status === "dirty" || t.value === "dirty" ? W(h.value) : h;
2415
+ return f.status === "aborted" ? m : f.status === "dirty" || t.value === "dirty" ? W(f.value) : f;
2416
2416
  });
2417
2417
  {
2418
2418
  if (t.value === "aborted")
@@ -2427,10 +2427,10 @@ class M extends _ {
2427
2427
  }
2428
2428
  if (s.type === "refinement") {
2429
2429
  const i = (o) => {
2430
- const h = s.refinement(o, a);
2430
+ const f = s.refinement(o, a);
2431
2431
  if (r.common.async)
2432
- return Promise.resolve(h);
2433
- if (h instanceof Promise)
2432
+ return Promise.resolve(f);
2433
+ if (f instanceof Promise)
2434
2434
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2435
2435
  return o;
2436
2436
  };
@@ -2656,14 +2656,14 @@ var p;
2656
2656
  })(p || (p = {}));
2657
2657
  const te = R.create, x = B.create;
2658
2658
  j.create;
2659
- const $e = T.create, fe = k.create;
2659
+ const $e = T.create, he = k.create;
2660
2660
  H.create;
2661
2661
  const at = ue.create;
2662
2662
  Y.create;
2663
2663
  E.create;
2664
2664
  const V = J.create;
2665
2665
  I.create;
2666
- const w = Q.create;
2666
+ const b = Q.create;
2667
2667
  X.create;
2668
2668
  N.create;
2669
2669
  L.create;
@@ -2681,29 +2681,29 @@ const it = {
2681
2681
  Backfeed70: "70",
2682
2682
  Backfeed80: "80",
2683
2683
  Backfeed90: "90"
2684
- }, ot = w(it), dt = {
2684
+ }, ot = b(it), dt = {
2685
2685
  Continuous: "N",
2686
2686
  VariableLengthContinuous: "V",
2687
2687
  NonContinuousWebSensing: "W",
2688
2688
  NonContinuousWebSensingAlt: "Y",
2689
2689
  NonContinuousMarkSensing: "M",
2690
2690
  AutoDetect: "A"
2691
- }, ct = w(dt), ut = {
2691
+ }, ct = b(dt), ut = {
2692
2692
  DirectThermal: "D",
2693
2693
  ThermalTransfer: "T"
2694
- }, lt = w(ut), ft = {
2694
+ }, lt = b(ut), ht = {
2695
2695
  Invert: "I",
2696
2696
  Normal: "N"
2697
- }, ht = w(ft), mt = {
2697
+ }, ft = b(ht), mt = {
2698
2698
  Mirror: "Y",
2699
2699
  Normal: "N"
2700
- }, pt = w(mt), gt = {
2700
+ }, pt = b(mt), gt = {
2701
2701
  Normal: "A",
2702
2702
  Half: "B"
2703
- }, yt = w(gt), _t = {
2703
+ }, yt = b(gt), _t = {
2704
2704
  Enable: "Y",
2705
2705
  Disable: "N"
2706
- }, vt = w(_t), xt = {
2706
+ }, vt = b(_t), xt = {
2707
2707
  TearOff: "T",
2708
2708
  PeelOff: "P",
2709
2709
  Rewind: "R",
@@ -2712,44 +2712,44 @@ const it = {
2712
2712
  DelayedCut: "D",
2713
2713
  EncodeRFID: "F",
2714
2714
  Kiosk: "K"
2715
- }, kt = w(xt), wt = {
2715
+ }, kt = b(xt), bt = {
2716
2716
  Prepeel: "Y",
2717
2717
  NoPrepeel: "N"
2718
- }, bt = w(wt), St = {
2718
+ }, wt = b(bt), St = {
2719
2719
  AllMedia: "Y",
2720
2720
  ContinuousOnly: "N"
2721
- }, Tt = w(St), Ct = {
2721
+ }, Tt = b(St), Ct = {
2722
2722
  NoRotation: "N",
2723
2723
  Rotate90: "R",
2724
2724
  Rotate180: "I",
2725
2725
  Rotate270: "B"
2726
- }, Re = w(Ct), At = {
2726
+ }, Re = b(Ct), At = {
2727
2727
  Left: "L",
2728
2728
  Right: "R",
2729
2729
  Center: "C",
2730
2730
  Justified: "J"
2731
- }, Nt = w(At), Ot = {
2731
+ }, Nt = b(At), Ot = {
2732
2732
  Highest: "H",
2733
2733
  High: "Q",
2734
2734
  Medium: "M",
2735
2735
  Lower: "L"
2736
- }, $t = w(Ot), Rt = {
2736
+ }, $t = b(Ot), Rt = {
2737
2737
  Yes: "Y",
2738
2738
  No: "N"
2739
- }, se = w(Rt), Ze = {
2739
+ }, se = b(Rt), Ze = {
2740
2740
  Start: "start",
2741
2741
  End: "end"
2742
- }, Zt = w(Ze), jt = fe({
2742
+ }, Zt = b(Ze), jt = he({
2743
2743
  word: te(),
2744
2744
  width: x(),
2745
2745
  spaceWidth: x()
2746
- }), he = fe({
2746
+ }), fe = he({
2747
2747
  name: te(),
2748
2748
  x: x().int(),
2749
2749
  y: x().int(),
2750
2750
  data: te()
2751
- }), Et = he.extend({
2752
- type: V("field"),
2751
+ }), Et = fe.extend({
2752
+ type: V("text"),
2753
2753
  // ^A font, height, width
2754
2754
  font: te().regex(/^[A-Z0-9]$/, "Font must be a single character A-Z or 0-9"),
2755
2755
  fontOrientation: Re,
@@ -2763,7 +2763,7 @@ const it = {
2763
2763
  hangingIndent: x().int().min(0).max(9999),
2764
2764
  verticalAlignment: Zt,
2765
2765
  wordWidths: $e(jt).optional()
2766
- }), It = he.extend({
2766
+ }), It = fe.extend({
2767
2767
  type: V("barcode"),
2768
2768
  // ^BY barWidth
2769
2769
  barWidth: x().int().min(4).max(9999),
@@ -2773,7 +2773,7 @@ const it = {
2773
2773
  line: se,
2774
2774
  lineAbove: se,
2775
2775
  checkDigit: se
2776
- }), Mt = he.extend({
2776
+ }), Mt = fe.extend({
2777
2777
  type: V("qrcode"),
2778
2778
  // ^BQ orientation, model, magnification, errorCorrection, mask
2779
2779
  orientation: V("N"),
@@ -2785,7 +2785,7 @@ const it = {
2785
2785
  Et,
2786
2786
  It,
2787
2787
  Mt
2788
- ]), je = fe({
2788
+ ]), je = he({
2789
2789
  type: V("thermal"),
2790
2790
  // ~TA adjustment
2791
2791
  tearOffAdjustment: x().int().min(0).max(120),
@@ -2797,7 +2797,7 @@ const it = {
2797
2797
  // ^MT mediaType
2798
2798
  thermalMediaType: lt,
2799
2799
  // ^PO orientation
2800
- printOrientation: ht,
2800
+ printOrientation: ft,
2801
2801
  // ^PM mirror
2802
2802
  mirror: pt,
2803
2803
  // ^LH x,y
@@ -2815,14 +2815,14 @@ const it = {
2815
2815
  reverse: vt,
2816
2816
  // ^MM mode, prepeel
2817
2817
  postPrintMode: kt,
2818
- prepeel: bt,
2818
+ prepeel: wt,
2819
2819
  // ^PW width
2820
2820
  printWidth: x().int().min(2),
2821
2821
  // ^LL length, allMedia
2822
2822
  labelLength: x().int().min(1).max(32e3),
2823
2823
  allMedia: Tt,
2824
- // Blocks
2825
- blocks: $e(Lt)
2824
+ // Fields
2825
+ fields: $e(Lt)
2826
2826
  });
2827
2827
  function Yt(n) {
2828
2828
  return je.safeParse(n);
@@ -2837,7 +2837,7 @@ function Qt(n) {
2837
2837
  }
2838
2838
  function Pt(n) {
2839
2839
  const e = ["^XA", Vt(n)];
2840
- for (const t of n.blocks)
2840
+ for (const t of n.fields)
2841
2841
  e.push(Dt(t));
2842
2842
  return e.push("^XZ"), e.join(`
2843
2843
  `);
@@ -2864,7 +2864,7 @@ function Vt(n) {
2864
2864
  }
2865
2865
  function Dt(n) {
2866
2866
  switch (n.type) {
2867
- case "field":
2867
+ case "text":
2868
2868
  return Bt(n);
2869
2869
  case "barcode":
2870
2870
  return qt(n);
@@ -2872,7 +2872,7 @@ function Dt(n) {
2872
2872
  return Ht(n);
2873
2873
  default: {
2874
2874
  const e = n;
2875
- throw new Error(`Unsupported block type: ${e.type}`);
2875
+ throw new Error(`Unsupported field type: ${e.type}`);
2876
2876
  }
2877
2877
  }
2878
2878
  }
@@ -2904,12 +2904,12 @@ function Ft(n, e, t) {
2904
2904
  continue;
2905
2905
  }
2906
2906
  const i = a.split(" ");
2907
- let o = 0, h = 1;
2908
- for (let f = 0; f < i.length; f++) {
2909
- const y = r.get(i[f]), C = y?.width ?? 0, ne = y?.spaceWidth ?? 0, me = o > 0 ? ne + C : C;
2910
- o > 0 && o + me > t ? (h++, o = C) : o += me;
2907
+ let o = 0, f = 1;
2908
+ for (let h = 0; h < i.length; h++) {
2909
+ const y = r.get(i[h]), C = y?.width ?? 0, ne = y?.spaceWidth ?? 0, me = o > 0 ? ne + C : C;
2910
+ o > 0 && o + me > t ? (f++, o = C) : o += me;
2911
2911
  }
2912
- s += h;
2912
+ s += f;
2913
2913
  }
2914
2914
  return s;
2915
2915
  }
@@ -2937,9 +2937,9 @@ export {
2937
2937
  dt as MediaType,
2938
2938
  mt as MirrorMode,
2939
2939
  xt as PostPrintMode,
2940
- wt as PrepeelMode,
2940
+ bt as PrepeelMode,
2941
2941
  gt as PrintDensityAdjustment,
2942
- ft as PrintOrientation,
2942
+ ht as PrintOrientation,
2943
2943
  Ot as QRCodeErrorCorrection,
2944
2944
  _t as ReverseMode,
2945
2945
  At as TextAlignment,
@@ -2950,22 +2950,22 @@ export {
2950
2950
  Wt as applyVerticalAlignment,
2951
2951
  ot as backfeedActionSchema,
2952
2952
  je as badgeSchema,
2953
- It as barcodeBlockSchema,
2954
- Lt as blockSchema,
2953
+ It as barcodeFieldSchema,
2955
2954
  zt as countLines,
2956
- Et as fieldBlockSchema,
2955
+ Lt as fieldSchema,
2957
2956
  Re as fontOrientationSchema,
2958
2957
  Qt as generate,
2959
2958
  ct as mediaTypeSchema,
2960
2959
  pt as mirrorModeSchema,
2961
2960
  kt as postPrintModeSchema,
2962
- bt as prepeelModeSchema,
2961
+ wt as prepeelModeSchema,
2963
2962
  yt as printDensityAdjustmentSchema,
2964
- ht as printOrientationSchema,
2963
+ ft as printOrientationSchema,
2965
2964
  $t as qrCodeErrorCorrectionSchema,
2966
- Mt as qrcodeBlockSchema,
2965
+ Mt as qrcodeFieldSchema,
2967
2966
  vt as reverseModeSchema,
2968
2967
  Nt as textAlignmentSchema,
2968
+ Et as textFieldSchema,
2969
2969
  lt as thermalMediaTypeSchema,
2970
2970
  Yt as validateBadge,
2971
2971
  Jt as validateBadgeOrThrow,
@@ -0,0 +1,29 @@
1
+ import { Badge, TextField } from './validate';
2
+ /**
3
+ * Generates ZPL (Zebra Programming Language) from a Badge configuration.
4
+ * Switches on badge type and renders the complete label format for thermal printers.
5
+ */
6
+ export declare function generate(badge: Badge): string;
7
+ /**
8
+ * ZPL ^FB blocks have no vertical alignment — text always starts at line 1.
9
+ * To simulate "end" (bottom) alignment, we count how many lines the data
10
+ * will occupy and prepend empty ZPL line breaks (\&) to push it down.
11
+ *
12
+ * Two counting strategies:
13
+ * - wordWidths provided: simulate word-wrap using pre-measured pixel widths
14
+ * - wordWidths omitted: approximate chars per line from maxWidth / font width
15
+ */
16
+ export declare function applyVerticalAlignment(field: TextField): string;
17
+ /**
18
+ * Counts how many lines the field data will occupy inside a ^FB field.
19
+ * Exported so consuming projects (e.g. React label previews) can reuse
20
+ * the same logic to stay in sync with the generator.
21
+ *
22
+ * When wordWidths are provided, simulates ZPL word-wrap: words are placed
23
+ * on the current line until the next word would exceed maxWidth, then a
24
+ * new line is started. Explicit \& breaks always start a new line.
25
+ *
26
+ * When wordWidths are not provided, falls back to a character-width
27
+ * heuristic using fontWidth (or fontHeight).
28
+ */
29
+ export declare function countLines(field: TextField): number;