@gridland/web 0.2.29 → 0.2.30

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/next.js CHANGED
@@ -1764,141 +1764,17 @@ function parseWrap(value) {
1764
1764
  }
1765
1765
  }
1766
1766
 
1767
- // src/shims/node-util.ts
1768
- function inspect(obj, _options) {
1769
- try {
1770
- return JSON.stringify(obj, null, 2);
1771
- } catch {
1772
- return String(obj);
1773
- }
1774
- }
1775
- function format(fmt, ...args) {
1776
- let i = 0;
1777
- return fmt.replace(/%[sdjifoO%]/g, (match) => {
1778
- if (match === "%%") return "%";
1779
- if (i >= args.length) return match;
1780
- return String(args[i++]);
1781
- });
1782
- }
1783
- function promisify(fn) {
1784
- return (...args) => new Promise((resolve, reject) => {
1785
- fn(...args, (err, result) => {
1786
- if (err) reject(err);
1787
- else resolve(result);
1788
- });
1789
- });
1790
- }
1791
- function isDeepStrictEqual(a, b2) {
1792
- return JSON.stringify(a) === JSON.stringify(b2);
1793
- }
1794
- var node_util_default = { inspect, format, promisify, isDeepStrictEqual };
1795
-
1796
- // ../../opentui/packages/core/src/renderables/composition/vnode.ts
1797
- var BrandedVNode = /* @__PURE__ */ Symbol.for("@opentui/core/VNode");
1798
- function isRenderableConstructor(value) {
1799
- return typeof value === "function" && value.prototype && Renderable.prototype.isPrototypeOf(value.prototype);
1800
- }
1801
- function flattenChildren(children) {
1802
- const result = [];
1803
- for (const child of children) {
1804
- if (Array.isArray(child)) {
1805
- result.push(...flattenChildren(child));
1806
- } else if (child !== null && child !== void 0 && child !== false) {
1807
- result.push(child);
1808
- }
1809
- }
1810
- return result;
1767
+ // ../../opentui/packages/core/src/renderable-brand.ts
1768
+ var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
1769
+ function isRenderable2(obj) {
1770
+ return !!obj?.[BrandedRenderable];
1811
1771
  }
1812
- function isVNode(node) {
1813
- return node && node[BrandedVNode];
1772
+ var _maybeMakeRenderable = null;
1773
+ function registerMaybeMakeRenderable(fn) {
1774
+ _maybeMakeRenderable = fn;
1814
1775
  }
1815
1776
  function maybeMakeRenderable(ctx, node) {
1816
- if (isRenderable(node)) return node;
1817
- if (isVNode(node)) return instantiate(ctx, node);
1818
- if (process.env.NODE_ENV !== "production") {
1819
- console.warn("maybeMakeRenderable received an invalid node", node_util_default.inspect(node, { depth: 2 }));
1820
- }
1821
- return null;
1822
- }
1823
- function wrapWithDelegates(instance, delegateMap) {
1824
- if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
1825
- const descendantCache = /* @__PURE__ */ new Map();
1826
- const getDescendant = (id) => {
1827
- if (descendantCache.has(id)) {
1828
- const cached = descendantCache.get(id);
1829
- if (cached !== void 0) {
1830
- return cached;
1831
- }
1832
- }
1833
- const descendant = instance.findDescendantById(id);
1834
- if (descendant) {
1835
- descendantCache.set(id, descendant);
1836
- }
1837
- return descendant;
1838
- };
1839
- const proxy = new Proxy(instance, {
1840
- get(target, prop, receiver) {
1841
- if (typeof prop === "string" && delegateMap[prop]) {
1842
- const host = getDescendant(delegateMap[prop]);
1843
- if (host) {
1844
- const value = host[prop];
1845
- if (typeof value === "function") {
1846
- return value.bind(host);
1847
- }
1848
- return value;
1849
- }
1850
- }
1851
- return Reflect.get(target, prop, receiver);
1852
- },
1853
- set(target, prop, value, receiver) {
1854
- if (typeof prop === "string" && delegateMap[prop]) {
1855
- const host = getDescendant(delegateMap[prop]);
1856
- if (host) {
1857
- return Reflect.set(host, prop, value);
1858
- }
1859
- }
1860
- return Reflect.set(target, prop, value, receiver);
1861
- }
1862
- });
1863
- return proxy;
1864
- }
1865
- function instantiate(ctx, node) {
1866
- if (isRenderable(node)) return node;
1867
- if (!node || typeof node !== "object") {
1868
- throw new TypeError("mount() received an invalid vnode");
1869
- }
1870
- const vnode = node;
1871
- const { type, props } = vnode;
1872
- const children = flattenChildren(vnode.children || []);
1873
- const delegateMap = vnode.__delegateMap;
1874
- if (isRenderableConstructor(type)) {
1875
- const instance = new type(ctx, props || {});
1876
- for (const child of children) {
1877
- if (isRenderable(child)) {
1878
- instance.add(child);
1879
- } else {
1880
- const mounted = instantiate(ctx, child);
1881
- instance.add(mounted);
1882
- }
1883
- }
1884
- const delegatedInstance = wrapWithDelegates(instance, delegateMap);
1885
- const pendingCalls = vnode.__pendingCalls;
1886
- if (pendingCalls) {
1887
- for (const call of pendingCalls) {
1888
- if (call.isProperty) {
1889
- ;
1890
- delegatedInstance[call.method] = call.args[0];
1891
- } else {
1892
- ;
1893
- delegatedInstance[call.method].apply(delegatedInstance, call.args);
1894
- }
1895
- }
1896
- }
1897
- return delegatedInstance;
1898
- }
1899
- const resolved = type(props || {}, children);
1900
- const inst = instantiate(ctx, resolved);
1901
- return wrapWithDelegates(inst, delegateMap);
1777
+ return _maybeMakeRenderable?.(ctx, node) ?? null;
1902
1778
  }
1903
1779
 
1904
1780
  // ../../opentui/packages/core/src/lib/renderable.validations.ts
@@ -1975,10 +1851,6 @@ function isSizeType(value) {
1975
1851
  }
1976
1852
 
1977
1853
  // ../../opentui/packages/core/src/Renderable.ts
1978
- var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
1979
- function isRenderable(obj) {
1980
- return !!obj?.[BrandedRenderable];
1981
- }
1982
1854
  var BaseRenderable = class _BaseRenderable extends EventEmitter {
1983
1855
  [BrandedRenderable] = true;
1984
1856
  static renderableNumber = 1;
@@ -4622,6 +4494,144 @@ var TextNodeRenderable = class _TextNodeRenderable extends BaseRenderable {
4622
4494
  }
4623
4495
  };
4624
4496
 
4497
+ // src/shims/node-util.ts
4498
+ function inspect(obj, _options) {
4499
+ try {
4500
+ return JSON.stringify(obj, null, 2);
4501
+ } catch {
4502
+ return String(obj);
4503
+ }
4504
+ }
4505
+ function format(fmt, ...args) {
4506
+ let i = 0;
4507
+ return fmt.replace(/%[sdjifoO%]/g, (match) => {
4508
+ if (match === "%%") return "%";
4509
+ if (i >= args.length) return match;
4510
+ return String(args[i++]);
4511
+ });
4512
+ }
4513
+ function promisify(fn) {
4514
+ return (...args) => new Promise((resolve, reject) => {
4515
+ fn(...args, (err, result) => {
4516
+ if (err) reject(err);
4517
+ else resolve(result);
4518
+ });
4519
+ });
4520
+ }
4521
+ function isDeepStrictEqual(a, b2) {
4522
+ return JSON.stringify(a) === JSON.stringify(b2);
4523
+ }
4524
+ var node_util_default = { inspect, format, promisify, isDeepStrictEqual };
4525
+
4526
+ // ../../opentui/packages/core/src/renderables/composition/vnode.ts
4527
+ var BrandedVNode = /* @__PURE__ */ Symbol.for("@opentui/core/VNode");
4528
+ function isRenderableConstructor(value) {
4529
+ return typeof value === "function" && value.prototype && !!value.prototype[BrandedRenderable];
4530
+ }
4531
+ function flattenChildren(children) {
4532
+ const result = [];
4533
+ for (const child of children) {
4534
+ if (Array.isArray(child)) {
4535
+ result.push(...flattenChildren(child));
4536
+ } else if (child !== null && child !== void 0 && child !== false) {
4537
+ result.push(child);
4538
+ }
4539
+ }
4540
+ return result;
4541
+ }
4542
+ function isVNode(node) {
4543
+ return node && node[BrandedVNode];
4544
+ }
4545
+ function maybeMakeRenderable2(ctx, node) {
4546
+ if (isRenderable2(node)) return node;
4547
+ if (isVNode(node)) return instantiate(ctx, node);
4548
+ if (process.env.NODE_ENV !== "production") {
4549
+ console.warn("maybeMakeRenderable received an invalid node", node_util_default.inspect(node, { depth: 2 }));
4550
+ }
4551
+ return null;
4552
+ }
4553
+ registerMaybeMakeRenderable(maybeMakeRenderable2);
4554
+ function wrapWithDelegates(instance, delegateMap) {
4555
+ if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
4556
+ const descendantCache = /* @__PURE__ */ new Map();
4557
+ const getDescendant = (id) => {
4558
+ if (descendantCache.has(id)) {
4559
+ const cached = descendantCache.get(id);
4560
+ if (cached !== void 0) {
4561
+ return cached;
4562
+ }
4563
+ }
4564
+ const descendant = instance.findDescendantById(id);
4565
+ if (descendant) {
4566
+ descendantCache.set(id, descendant);
4567
+ }
4568
+ return descendant;
4569
+ };
4570
+ const proxy = new Proxy(instance, {
4571
+ get(target, prop, receiver) {
4572
+ if (typeof prop === "string" && delegateMap[prop]) {
4573
+ const host = getDescendant(delegateMap[prop]);
4574
+ if (host) {
4575
+ const value = host[prop];
4576
+ if (typeof value === "function") {
4577
+ return value.bind(host);
4578
+ }
4579
+ return value;
4580
+ }
4581
+ }
4582
+ return Reflect.get(target, prop, receiver);
4583
+ },
4584
+ set(target, prop, value, receiver) {
4585
+ if (typeof prop === "string" && delegateMap[prop]) {
4586
+ const host = getDescendant(delegateMap[prop]);
4587
+ if (host) {
4588
+ return Reflect.set(host, prop, value);
4589
+ }
4590
+ }
4591
+ return Reflect.set(target, prop, value, receiver);
4592
+ }
4593
+ });
4594
+ return proxy;
4595
+ }
4596
+ function instantiate(ctx, node) {
4597
+ if (isRenderable2(node)) return node;
4598
+ if (!node || typeof node !== "object") {
4599
+ throw new TypeError("mount() received an invalid vnode");
4600
+ }
4601
+ const vnode = node;
4602
+ const { type, props } = vnode;
4603
+ const children = flattenChildren(vnode.children || []);
4604
+ const delegateMap = vnode.__delegateMap;
4605
+ if (isRenderableConstructor(type)) {
4606
+ const instance = new type(ctx, props || {});
4607
+ for (const child of children) {
4608
+ if (isRenderable2(child)) {
4609
+ instance.add(child);
4610
+ } else {
4611
+ const mounted = instantiate(ctx, child);
4612
+ instance.add(mounted);
4613
+ }
4614
+ }
4615
+ const delegatedInstance = wrapWithDelegates(instance, delegateMap);
4616
+ const pendingCalls = vnode.__pendingCalls;
4617
+ if (pendingCalls) {
4618
+ for (const call of pendingCalls) {
4619
+ if (call.isProperty) {
4620
+ ;
4621
+ delegatedInstance[call.method] = call.args[0];
4622
+ } else {
4623
+ ;
4624
+ delegatedInstance[call.method].apply(delegatedInstance, call.args);
4625
+ }
4626
+ }
4627
+ }
4628
+ return delegatedInstance;
4629
+ }
4630
+ const resolved = type(props || {}, children);
4631
+ const inst = instantiate(ctx, resolved);
4632
+ return wrapWithDelegates(inst, delegateMap);
4633
+ }
4634
+
4625
4635
  // ../../opentui/node_modules/.bun/marked@17.0.1/node_modules/marked/lib/marked.esm.js
4626
4636
  function L() {
4627
4637
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };