@gridland/demo 0.2.34 → 0.2.35
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/run.js +114 -106
- package/package.json +2 -2
package/dist/run.js
CHANGED
|
@@ -25926,111 +25926,16 @@ var OptimizedBuffer2 = class _OptimizedBuffer {
|
|
|
25926
25926
|
this.lib.bufferDrawChar(this.bufferPtr, char, x2, y2, fg2, bg2, attributes);
|
|
25927
25927
|
}
|
|
25928
25928
|
};
|
|
25929
|
-
var
|
|
25930
|
-
function
|
|
25931
|
-
return
|
|
25932
|
-
}
|
|
25933
|
-
function flattenChildren(children) {
|
|
25934
|
-
const result = [];
|
|
25935
|
-
for (const child of children) {
|
|
25936
|
-
if (Array.isArray(child)) {
|
|
25937
|
-
result.push(...flattenChildren(child));
|
|
25938
|
-
} else if (child !== null && child !== void 0 && child !== false) {
|
|
25939
|
-
result.push(child);
|
|
25940
|
-
}
|
|
25941
|
-
}
|
|
25942
|
-
return result;
|
|
25929
|
+
var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
|
|
25930
|
+
function isRenderable(obj) {
|
|
25931
|
+
return !!obj?.[BrandedRenderable];
|
|
25943
25932
|
}
|
|
25944
|
-
|
|
25945
|
-
|
|
25933
|
+
var _maybeMakeRenderable = null;
|
|
25934
|
+
function registerMaybeMakeRenderable(fn) {
|
|
25935
|
+
_maybeMakeRenderable = fn;
|
|
25946
25936
|
}
|
|
25947
25937
|
function maybeMakeRenderable(ctx, node) {
|
|
25948
|
-
|
|
25949
|
-
if (isVNode(node)) return instantiate(ctx, node);
|
|
25950
|
-
if (process2.env.NODE_ENV !== "production") {
|
|
25951
|
-
console.warn("maybeMakeRenderable received an invalid node", node);
|
|
25952
|
-
}
|
|
25953
|
-
return null;
|
|
25954
|
-
}
|
|
25955
|
-
function wrapWithDelegates(instance, delegateMap) {
|
|
25956
|
-
if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
|
|
25957
|
-
const descendantCache = /* @__PURE__ */ new Map();
|
|
25958
|
-
const getDescendant = (id) => {
|
|
25959
|
-
if (descendantCache.has(id)) {
|
|
25960
|
-
const cached = descendantCache.get(id);
|
|
25961
|
-
if (cached !== void 0) {
|
|
25962
|
-
return cached;
|
|
25963
|
-
}
|
|
25964
|
-
}
|
|
25965
|
-
const descendant = instance.findDescendantById(id);
|
|
25966
|
-
if (descendant) {
|
|
25967
|
-
descendantCache.set(id, descendant);
|
|
25968
|
-
}
|
|
25969
|
-
return descendant;
|
|
25970
|
-
};
|
|
25971
|
-
const proxy = new Proxy(instance, {
|
|
25972
|
-
get(target, prop, receiver) {
|
|
25973
|
-
if (typeof prop === "string" && delegateMap[prop]) {
|
|
25974
|
-
const host = getDescendant(delegateMap[prop]);
|
|
25975
|
-
if (host) {
|
|
25976
|
-
const value = host[prop];
|
|
25977
|
-
if (typeof value === "function") {
|
|
25978
|
-
return value.bind(host);
|
|
25979
|
-
}
|
|
25980
|
-
return value;
|
|
25981
|
-
}
|
|
25982
|
-
}
|
|
25983
|
-
return Reflect.get(target, prop, receiver);
|
|
25984
|
-
},
|
|
25985
|
-
set(target, prop, value, receiver) {
|
|
25986
|
-
if (typeof prop === "string" && delegateMap[prop]) {
|
|
25987
|
-
const host = getDescendant(delegateMap[prop]);
|
|
25988
|
-
if (host) {
|
|
25989
|
-
return Reflect.set(host, prop, value);
|
|
25990
|
-
}
|
|
25991
|
-
}
|
|
25992
|
-
return Reflect.set(target, prop, value, receiver);
|
|
25993
|
-
}
|
|
25994
|
-
});
|
|
25995
|
-
return proxy;
|
|
25996
|
-
}
|
|
25997
|
-
function instantiate(ctx, node) {
|
|
25998
|
-
if (isRenderable(node)) return node;
|
|
25999
|
-
if (!node || typeof node !== "object") {
|
|
26000
|
-
throw new TypeError("mount() received an invalid vnode");
|
|
26001
|
-
}
|
|
26002
|
-
const vnode = node;
|
|
26003
|
-
const { type, props } = vnode;
|
|
26004
|
-
const children = flattenChildren(vnode.children || []);
|
|
26005
|
-
const delegateMap = vnode.__delegateMap;
|
|
26006
|
-
if (isRenderableConstructor(type)) {
|
|
26007
|
-
const instance = new type(ctx, props || {});
|
|
26008
|
-
for (const child of children) {
|
|
26009
|
-
if (isRenderable(child)) {
|
|
26010
|
-
instance.add(child);
|
|
26011
|
-
} else {
|
|
26012
|
-
const mounted = instantiate(ctx, child);
|
|
26013
|
-
instance.add(mounted);
|
|
26014
|
-
}
|
|
26015
|
-
}
|
|
26016
|
-
const delegatedInstance = wrapWithDelegates(instance, delegateMap);
|
|
26017
|
-
const pendingCalls = vnode.__pendingCalls;
|
|
26018
|
-
if (pendingCalls) {
|
|
26019
|
-
for (const call of pendingCalls) {
|
|
26020
|
-
if (call.isProperty) {
|
|
26021
|
-
;
|
|
26022
|
-
delegatedInstance[call.method] = call.args[0];
|
|
26023
|
-
} else {
|
|
26024
|
-
;
|
|
26025
|
-
delegatedInstance[call.method].apply(delegatedInstance, call.args);
|
|
26026
|
-
}
|
|
26027
|
-
}
|
|
26028
|
-
}
|
|
26029
|
-
return delegatedInstance;
|
|
26030
|
-
}
|
|
26031
|
-
const resolved = type(props || {}, children);
|
|
26032
|
-
const inst = instantiate(ctx, resolved);
|
|
26033
|
-
return wrapWithDelegates(inst, delegateMap);
|
|
25938
|
+
return _maybeMakeRenderable?.(ctx, node) ?? null;
|
|
26034
25939
|
}
|
|
26035
25940
|
function validateOptions(id, options) {
|
|
26036
25941
|
if (typeof options.width === "number") {
|
|
@@ -26103,10 +26008,6 @@ function isSizeType(value) {
|
|
|
26103
26008
|
}
|
|
26104
26009
|
return isValidPercentage(value);
|
|
26105
26010
|
}
|
|
26106
|
-
var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
|
|
26107
|
-
function isRenderable(obj) {
|
|
26108
|
-
return !!obj?.[BrandedRenderable];
|
|
26109
|
-
}
|
|
26110
26011
|
var BaseRenderable = class _BaseRenderable extends EventEmitter {
|
|
26111
26012
|
[BrandedRenderable] = true;
|
|
26112
26013
|
static renderableNumber = 1;
|
|
@@ -29714,6 +29615,113 @@ var RootTextNodeRenderable = class extends TextNodeRenderable {
|
|
|
29714
29615
|
this.ctx.requestRender();
|
|
29715
29616
|
}
|
|
29716
29617
|
};
|
|
29618
|
+
var BrandedVNode = /* @__PURE__ */ Symbol.for("@opentui/core/VNode");
|
|
29619
|
+
function isRenderableConstructor(value) {
|
|
29620
|
+
return typeof value === "function" && value.prototype && !!value.prototype[BrandedRenderable];
|
|
29621
|
+
}
|
|
29622
|
+
function flattenChildren(children) {
|
|
29623
|
+
const result = [];
|
|
29624
|
+
for (const child of children) {
|
|
29625
|
+
if (Array.isArray(child)) {
|
|
29626
|
+
result.push(...flattenChildren(child));
|
|
29627
|
+
} else if (child !== null && child !== void 0 && child !== false) {
|
|
29628
|
+
result.push(child);
|
|
29629
|
+
}
|
|
29630
|
+
}
|
|
29631
|
+
return result;
|
|
29632
|
+
}
|
|
29633
|
+
function isVNode(node) {
|
|
29634
|
+
return node && node[BrandedVNode];
|
|
29635
|
+
}
|
|
29636
|
+
function maybeMakeRenderable2(ctx, node) {
|
|
29637
|
+
if (isRenderable(node)) return node;
|
|
29638
|
+
if (isVNode(node)) return instantiate(ctx, node);
|
|
29639
|
+
if (process2.env.NODE_ENV !== "production") {
|
|
29640
|
+
console.warn("maybeMakeRenderable received an invalid node", node);
|
|
29641
|
+
}
|
|
29642
|
+
return null;
|
|
29643
|
+
}
|
|
29644
|
+
registerMaybeMakeRenderable(maybeMakeRenderable2);
|
|
29645
|
+
function wrapWithDelegates(instance, delegateMap) {
|
|
29646
|
+
if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
|
|
29647
|
+
const descendantCache = /* @__PURE__ */ new Map();
|
|
29648
|
+
const getDescendant = (id) => {
|
|
29649
|
+
if (descendantCache.has(id)) {
|
|
29650
|
+
const cached = descendantCache.get(id);
|
|
29651
|
+
if (cached !== void 0) {
|
|
29652
|
+
return cached;
|
|
29653
|
+
}
|
|
29654
|
+
}
|
|
29655
|
+
const descendant = instance.findDescendantById(id);
|
|
29656
|
+
if (descendant) {
|
|
29657
|
+
descendantCache.set(id, descendant);
|
|
29658
|
+
}
|
|
29659
|
+
return descendant;
|
|
29660
|
+
};
|
|
29661
|
+
const proxy = new Proxy(instance, {
|
|
29662
|
+
get(target, prop, receiver) {
|
|
29663
|
+
if (typeof prop === "string" && delegateMap[prop]) {
|
|
29664
|
+
const host = getDescendant(delegateMap[prop]);
|
|
29665
|
+
if (host) {
|
|
29666
|
+
const value = host[prop];
|
|
29667
|
+
if (typeof value === "function") {
|
|
29668
|
+
return value.bind(host);
|
|
29669
|
+
}
|
|
29670
|
+
return value;
|
|
29671
|
+
}
|
|
29672
|
+
}
|
|
29673
|
+
return Reflect.get(target, prop, receiver);
|
|
29674
|
+
},
|
|
29675
|
+
set(target, prop, value, receiver) {
|
|
29676
|
+
if (typeof prop === "string" && delegateMap[prop]) {
|
|
29677
|
+
const host = getDescendant(delegateMap[prop]);
|
|
29678
|
+
if (host) {
|
|
29679
|
+
return Reflect.set(host, prop, value);
|
|
29680
|
+
}
|
|
29681
|
+
}
|
|
29682
|
+
return Reflect.set(target, prop, value, receiver);
|
|
29683
|
+
}
|
|
29684
|
+
});
|
|
29685
|
+
return proxy;
|
|
29686
|
+
}
|
|
29687
|
+
function instantiate(ctx, node) {
|
|
29688
|
+
if (isRenderable(node)) return node;
|
|
29689
|
+
if (!node || typeof node !== "object") {
|
|
29690
|
+
throw new TypeError("mount() received an invalid vnode");
|
|
29691
|
+
}
|
|
29692
|
+
const vnode = node;
|
|
29693
|
+
const { type, props } = vnode;
|
|
29694
|
+
const children = flattenChildren(vnode.children || []);
|
|
29695
|
+
const delegateMap = vnode.__delegateMap;
|
|
29696
|
+
if (isRenderableConstructor(type)) {
|
|
29697
|
+
const instance = new type(ctx, props || {});
|
|
29698
|
+
for (const child of children) {
|
|
29699
|
+
if (isRenderable(child)) {
|
|
29700
|
+
instance.add(child);
|
|
29701
|
+
} else {
|
|
29702
|
+
const mounted = instantiate(ctx, child);
|
|
29703
|
+
instance.add(mounted);
|
|
29704
|
+
}
|
|
29705
|
+
}
|
|
29706
|
+
const delegatedInstance = wrapWithDelegates(instance, delegateMap);
|
|
29707
|
+
const pendingCalls = vnode.__pendingCalls;
|
|
29708
|
+
if (pendingCalls) {
|
|
29709
|
+
for (const call of pendingCalls) {
|
|
29710
|
+
if (call.isProperty) {
|
|
29711
|
+
;
|
|
29712
|
+
delegatedInstance[call.method] = call.args[0];
|
|
29713
|
+
} else {
|
|
29714
|
+
;
|
|
29715
|
+
delegatedInstance[call.method].apply(delegatedInstance, call.args);
|
|
29716
|
+
}
|
|
29717
|
+
}
|
|
29718
|
+
}
|
|
29719
|
+
return delegatedInstance;
|
|
29720
|
+
}
|
|
29721
|
+
const resolved = type(props || {}, children);
|
|
29722
|
+
const inst = instantiate(ctx, resolved);
|
|
29723
|
+
return wrapWithDelegates(inst, delegateMap);
|
|
29724
|
+
}
|
|
29717
29725
|
var GutterRenderable = class extends Renderable3 {
|
|
29718
29726
|
target;
|
|
29719
29727
|
_fg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridland/demo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Run gridland component demos from anywhere",
|
|
6
6
|
"exports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "bun test"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gridland/bun": "
|
|
24
|
+
"@gridland/bun": "0.2.35",
|
|
25
25
|
"figlet": "^1.10.0",
|
|
26
26
|
"react": "^19.0.0"
|
|
27
27
|
},
|