@gridland/web 0.2.30 → 0.2.32
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/core-shims.js +139 -149
- package/dist/core-shims.js.map +4 -4
- package/dist/index.js +136 -146
- package/dist/index.js.map +4 -4
- package/dist/next-plugin.cjs +6 -0
- package/dist/next-plugin.cjs.map +1 -1
- package/dist/next-plugin.js +6 -0
- package/dist/next-plugin.js.map +1 -1
- package/dist/next.js +136 -146
- package/dist/next.js.map +4 -4
- package/dist/vite-plugin.js +6 -6
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +2 -2
package/dist/core-shims.js
CHANGED
|
@@ -25075,17 +25075,141 @@ function parseWrap(value) {
|
|
|
25075
25075
|
}
|
|
25076
25076
|
}
|
|
25077
25077
|
|
|
25078
|
-
//
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
|
|
25078
|
+
// src/shims/node-util.ts
|
|
25079
|
+
function inspect(obj, _options) {
|
|
25080
|
+
try {
|
|
25081
|
+
return JSON.stringify(obj, null, 2);
|
|
25082
|
+
} catch {
|
|
25083
|
+
return String(obj);
|
|
25084
|
+
}
|
|
25085
|
+
}
|
|
25086
|
+
function format(fmt, ...args) {
|
|
25087
|
+
let i = 0;
|
|
25088
|
+
return fmt.replace(/%[sdjifoO%]/g, (match) => {
|
|
25089
|
+
if (match === "%%") return "%";
|
|
25090
|
+
if (i >= args.length) return match;
|
|
25091
|
+
return String(args[i++]);
|
|
25092
|
+
});
|
|
25082
25093
|
}
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
|
|
25094
|
+
function promisify(fn) {
|
|
25095
|
+
return (...args) => new Promise((resolve, reject) => {
|
|
25096
|
+
fn(...args, (err, result) => {
|
|
25097
|
+
if (err) reject(err);
|
|
25098
|
+
else resolve(result);
|
|
25099
|
+
});
|
|
25100
|
+
});
|
|
25101
|
+
}
|
|
25102
|
+
function isDeepStrictEqual(a, b2) {
|
|
25103
|
+
return JSON.stringify(a) === JSON.stringify(b2);
|
|
25104
|
+
}
|
|
25105
|
+
var node_util_default = { inspect, format, promisify, isDeepStrictEqual };
|
|
25106
|
+
|
|
25107
|
+
// ../../opentui/packages/core/src/renderables/composition/vnode.ts
|
|
25108
|
+
var BrandedVNode = /* @__PURE__ */ Symbol.for("@opentui/core/VNode");
|
|
25109
|
+
function isRenderableConstructor(value) {
|
|
25110
|
+
return typeof value === "function" && value.prototype && Renderable.prototype.isPrototypeOf(value.prototype);
|
|
25111
|
+
}
|
|
25112
|
+
function flattenChildren(children) {
|
|
25113
|
+
const result = [];
|
|
25114
|
+
for (const child of children) {
|
|
25115
|
+
if (Array.isArray(child)) {
|
|
25116
|
+
result.push(...flattenChildren(child));
|
|
25117
|
+
} else if (child !== null && child !== void 0 && child !== false) {
|
|
25118
|
+
result.push(child);
|
|
25119
|
+
}
|
|
25120
|
+
}
|
|
25121
|
+
return result;
|
|
25122
|
+
}
|
|
25123
|
+
function isVNode(node) {
|
|
25124
|
+
return node && node[BrandedVNode];
|
|
25086
25125
|
}
|
|
25087
25126
|
function maybeMakeRenderable(ctx, node) {
|
|
25088
|
-
|
|
25127
|
+
if (isRenderable(node)) return node;
|
|
25128
|
+
if (isVNode(node)) return instantiate(ctx, node);
|
|
25129
|
+
if (process.env.NODE_ENV !== "production") {
|
|
25130
|
+
console.warn("maybeMakeRenderable received an invalid node", node_util_default.inspect(node, { depth: 2 }));
|
|
25131
|
+
}
|
|
25132
|
+
return null;
|
|
25133
|
+
}
|
|
25134
|
+
function wrapWithDelegates(instance, delegateMap) {
|
|
25135
|
+
if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
|
|
25136
|
+
const descendantCache = /* @__PURE__ */ new Map();
|
|
25137
|
+
const getDescendant = (id) => {
|
|
25138
|
+
if (descendantCache.has(id)) {
|
|
25139
|
+
const cached = descendantCache.get(id);
|
|
25140
|
+
if (cached !== void 0) {
|
|
25141
|
+
return cached;
|
|
25142
|
+
}
|
|
25143
|
+
}
|
|
25144
|
+
const descendant = instance.findDescendantById(id);
|
|
25145
|
+
if (descendant) {
|
|
25146
|
+
descendantCache.set(id, descendant);
|
|
25147
|
+
}
|
|
25148
|
+
return descendant;
|
|
25149
|
+
};
|
|
25150
|
+
const proxy = new Proxy(instance, {
|
|
25151
|
+
get(target, prop, receiver) {
|
|
25152
|
+
if (typeof prop === "string" && delegateMap[prop]) {
|
|
25153
|
+
const host = getDescendant(delegateMap[prop]);
|
|
25154
|
+
if (host) {
|
|
25155
|
+
const value = host[prop];
|
|
25156
|
+
if (typeof value === "function") {
|
|
25157
|
+
return value.bind(host);
|
|
25158
|
+
}
|
|
25159
|
+
return value;
|
|
25160
|
+
}
|
|
25161
|
+
}
|
|
25162
|
+
return Reflect.get(target, prop, receiver);
|
|
25163
|
+
},
|
|
25164
|
+
set(target, prop, value, receiver) {
|
|
25165
|
+
if (typeof prop === "string" && delegateMap[prop]) {
|
|
25166
|
+
const host = getDescendant(delegateMap[prop]);
|
|
25167
|
+
if (host) {
|
|
25168
|
+
return Reflect.set(host, prop, value);
|
|
25169
|
+
}
|
|
25170
|
+
}
|
|
25171
|
+
return Reflect.set(target, prop, value, receiver);
|
|
25172
|
+
}
|
|
25173
|
+
});
|
|
25174
|
+
return proxy;
|
|
25175
|
+
}
|
|
25176
|
+
function instantiate(ctx, node) {
|
|
25177
|
+
if (isRenderable(node)) return node;
|
|
25178
|
+
if (!node || typeof node !== "object") {
|
|
25179
|
+
throw new TypeError("mount() received an invalid vnode");
|
|
25180
|
+
}
|
|
25181
|
+
const vnode = node;
|
|
25182
|
+
const { type, props } = vnode;
|
|
25183
|
+
const children = flattenChildren(vnode.children || []);
|
|
25184
|
+
const delegateMap = vnode.__delegateMap;
|
|
25185
|
+
if (isRenderableConstructor(type)) {
|
|
25186
|
+
const instance = new type(ctx, props || {});
|
|
25187
|
+
for (const child of children) {
|
|
25188
|
+
if (isRenderable(child)) {
|
|
25189
|
+
instance.add(child);
|
|
25190
|
+
} else {
|
|
25191
|
+
const mounted = instantiate(ctx, child);
|
|
25192
|
+
instance.add(mounted);
|
|
25193
|
+
}
|
|
25194
|
+
}
|
|
25195
|
+
const delegatedInstance = wrapWithDelegates(instance, delegateMap);
|
|
25196
|
+
const pendingCalls = vnode.__pendingCalls;
|
|
25197
|
+
if (pendingCalls) {
|
|
25198
|
+
for (const call of pendingCalls) {
|
|
25199
|
+
if (call.isProperty) {
|
|
25200
|
+
;
|
|
25201
|
+
delegatedInstance[call.method] = call.args[0];
|
|
25202
|
+
} else {
|
|
25203
|
+
;
|
|
25204
|
+
delegatedInstance[call.method].apply(delegatedInstance, call.args);
|
|
25205
|
+
}
|
|
25206
|
+
}
|
|
25207
|
+
}
|
|
25208
|
+
return delegatedInstance;
|
|
25209
|
+
}
|
|
25210
|
+
const resolved = type(props || {}, children);
|
|
25211
|
+
const inst = instantiate(ctx, resolved);
|
|
25212
|
+
return wrapWithDelegates(inst, delegateMap);
|
|
25089
25213
|
}
|
|
25090
25214
|
|
|
25091
25215
|
// ../../opentui/packages/core/src/lib/renderable.validations.ts
|
|
@@ -25162,6 +25286,7 @@ function isSizeType(value) {
|
|
|
25162
25286
|
}
|
|
25163
25287
|
|
|
25164
25288
|
// ../../opentui/packages/core/src/Renderable.ts
|
|
25289
|
+
var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
|
|
25165
25290
|
var LayoutEvents = /* @__PURE__ */ ((LayoutEvents2) => {
|
|
25166
25291
|
LayoutEvents2["LAYOUT_CHANGED"] = "layout-changed";
|
|
25167
25292
|
LayoutEvents2["ADDED"] = "added";
|
|
@@ -25174,6 +25299,9 @@ var RenderableEvents = /* @__PURE__ */ ((RenderableEvents2) => {
|
|
|
25174
25299
|
RenderableEvents2["BLURRED"] = "blurred";
|
|
25175
25300
|
return RenderableEvents2;
|
|
25176
25301
|
})(RenderableEvents || {});
|
|
25302
|
+
function isRenderable(obj) {
|
|
25303
|
+
return !!obj?.[BrandedRenderable];
|
|
25304
|
+
}
|
|
25177
25305
|
var BaseRenderable = class _BaseRenderable extends EventEmitter {
|
|
25178
25306
|
[BrandedRenderable] = true;
|
|
25179
25307
|
static renderableNumber = 1;
|
|
@@ -32410,144 +32538,6 @@ var RootTextNodeRenderable = class extends TextNodeRenderable {
|
|
|
32410
32538
|
}
|
|
32411
32539
|
};
|
|
32412
32540
|
|
|
32413
|
-
// src/shims/node-util.ts
|
|
32414
|
-
function inspect(obj, _options) {
|
|
32415
|
-
try {
|
|
32416
|
-
return JSON.stringify(obj, null, 2);
|
|
32417
|
-
} catch {
|
|
32418
|
-
return String(obj);
|
|
32419
|
-
}
|
|
32420
|
-
}
|
|
32421
|
-
function format(fmt, ...args) {
|
|
32422
|
-
let i = 0;
|
|
32423
|
-
return fmt.replace(/%[sdjifoO%]/g, (match) => {
|
|
32424
|
-
if (match === "%%") return "%";
|
|
32425
|
-
if (i >= args.length) return match;
|
|
32426
|
-
return String(args[i++]);
|
|
32427
|
-
});
|
|
32428
|
-
}
|
|
32429
|
-
function promisify(fn) {
|
|
32430
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
32431
|
-
fn(...args, (err, result) => {
|
|
32432
|
-
if (err) reject(err);
|
|
32433
|
-
else resolve(result);
|
|
32434
|
-
});
|
|
32435
|
-
});
|
|
32436
|
-
}
|
|
32437
|
-
function isDeepStrictEqual(a, b2) {
|
|
32438
|
-
return JSON.stringify(a) === JSON.stringify(b2);
|
|
32439
|
-
}
|
|
32440
|
-
var node_util_default = { inspect, format, promisify, isDeepStrictEqual };
|
|
32441
|
-
|
|
32442
|
-
// ../../opentui/packages/core/src/renderables/composition/vnode.ts
|
|
32443
|
-
var BrandedVNode = /* @__PURE__ */ Symbol.for("@opentui/core/VNode");
|
|
32444
|
-
function isRenderableConstructor(value) {
|
|
32445
|
-
return typeof value === "function" && value.prototype && !!value.prototype[BrandedRenderable];
|
|
32446
|
-
}
|
|
32447
|
-
function flattenChildren(children) {
|
|
32448
|
-
const result = [];
|
|
32449
|
-
for (const child of children) {
|
|
32450
|
-
if (Array.isArray(child)) {
|
|
32451
|
-
result.push(...flattenChildren(child));
|
|
32452
|
-
} else if (child !== null && child !== void 0 && child !== false) {
|
|
32453
|
-
result.push(child);
|
|
32454
|
-
}
|
|
32455
|
-
}
|
|
32456
|
-
return result;
|
|
32457
|
-
}
|
|
32458
|
-
function isVNode(node) {
|
|
32459
|
-
return node && node[BrandedVNode];
|
|
32460
|
-
}
|
|
32461
|
-
function maybeMakeRenderable2(ctx, node) {
|
|
32462
|
-
if (isRenderable2(node)) return node;
|
|
32463
|
-
if (isVNode(node)) return instantiate(ctx, node);
|
|
32464
|
-
if (process.env.NODE_ENV !== "production") {
|
|
32465
|
-
console.warn("maybeMakeRenderable received an invalid node", node_util_default.inspect(node, { depth: 2 }));
|
|
32466
|
-
}
|
|
32467
|
-
return null;
|
|
32468
|
-
}
|
|
32469
|
-
registerMaybeMakeRenderable(maybeMakeRenderable2);
|
|
32470
|
-
function wrapWithDelegates(instance, delegateMap) {
|
|
32471
|
-
if (!delegateMap || Object.keys(delegateMap).length === 0) return instance;
|
|
32472
|
-
const descendantCache = /* @__PURE__ */ new Map();
|
|
32473
|
-
const getDescendant = (id) => {
|
|
32474
|
-
if (descendantCache.has(id)) {
|
|
32475
|
-
const cached = descendantCache.get(id);
|
|
32476
|
-
if (cached !== void 0) {
|
|
32477
|
-
return cached;
|
|
32478
|
-
}
|
|
32479
|
-
}
|
|
32480
|
-
const descendant = instance.findDescendantById(id);
|
|
32481
|
-
if (descendant) {
|
|
32482
|
-
descendantCache.set(id, descendant);
|
|
32483
|
-
}
|
|
32484
|
-
return descendant;
|
|
32485
|
-
};
|
|
32486
|
-
const proxy = new Proxy(instance, {
|
|
32487
|
-
get(target, prop, receiver) {
|
|
32488
|
-
if (typeof prop === "string" && delegateMap[prop]) {
|
|
32489
|
-
const host = getDescendant(delegateMap[prop]);
|
|
32490
|
-
if (host) {
|
|
32491
|
-
const value = host[prop];
|
|
32492
|
-
if (typeof value === "function") {
|
|
32493
|
-
return value.bind(host);
|
|
32494
|
-
}
|
|
32495
|
-
return value;
|
|
32496
|
-
}
|
|
32497
|
-
}
|
|
32498
|
-
return Reflect.get(target, prop, receiver);
|
|
32499
|
-
},
|
|
32500
|
-
set(target, prop, value, receiver) {
|
|
32501
|
-
if (typeof prop === "string" && delegateMap[prop]) {
|
|
32502
|
-
const host = getDescendant(delegateMap[prop]);
|
|
32503
|
-
if (host) {
|
|
32504
|
-
return Reflect.set(host, prop, value);
|
|
32505
|
-
}
|
|
32506
|
-
}
|
|
32507
|
-
return Reflect.set(target, prop, value, receiver);
|
|
32508
|
-
}
|
|
32509
|
-
});
|
|
32510
|
-
return proxy;
|
|
32511
|
-
}
|
|
32512
|
-
function instantiate(ctx, node) {
|
|
32513
|
-
if (isRenderable2(node)) return node;
|
|
32514
|
-
if (!node || typeof node !== "object") {
|
|
32515
|
-
throw new TypeError("mount() received an invalid vnode");
|
|
32516
|
-
}
|
|
32517
|
-
const vnode = node;
|
|
32518
|
-
const { type, props } = vnode;
|
|
32519
|
-
const children = flattenChildren(vnode.children || []);
|
|
32520
|
-
const delegateMap = vnode.__delegateMap;
|
|
32521
|
-
if (isRenderableConstructor(type)) {
|
|
32522
|
-
const instance = new type(ctx, props || {});
|
|
32523
|
-
for (const child of children) {
|
|
32524
|
-
if (isRenderable2(child)) {
|
|
32525
|
-
instance.add(child);
|
|
32526
|
-
} else {
|
|
32527
|
-
const mounted = instantiate(ctx, child);
|
|
32528
|
-
instance.add(mounted);
|
|
32529
|
-
}
|
|
32530
|
-
}
|
|
32531
|
-
const delegatedInstance = wrapWithDelegates(instance, delegateMap);
|
|
32532
|
-
const pendingCalls = vnode.__pendingCalls;
|
|
32533
|
-
if (pendingCalls) {
|
|
32534
|
-
for (const call of pendingCalls) {
|
|
32535
|
-
if (call.isProperty) {
|
|
32536
|
-
;
|
|
32537
|
-
delegatedInstance[call.method] = call.args[0];
|
|
32538
|
-
} else {
|
|
32539
|
-
;
|
|
32540
|
-
delegatedInstance[call.method].apply(delegatedInstance, call.args);
|
|
32541
|
-
}
|
|
32542
|
-
}
|
|
32543
|
-
}
|
|
32544
|
-
return delegatedInstance;
|
|
32545
|
-
}
|
|
32546
|
-
const resolved = type(props || {}, children);
|
|
32547
|
-
const inst = instantiate(ctx, resolved);
|
|
32548
|
-
return wrapWithDelegates(inst, delegateMap);
|
|
32549
|
-
}
|
|
32550
|
-
|
|
32551
32541
|
// ../../opentui/packages/core/src/renderables/LineNumberRenderable.ts
|
|
32552
32542
|
var GutterRenderable = class extends Renderable {
|
|
32553
32543
|
target;
|
|
@@ -45663,7 +45653,7 @@ function setProperty(instance, type, propKey, propValue, oldPropValue) {
|
|
|
45663
45653
|
}
|
|
45664
45654
|
break;
|
|
45665
45655
|
case "focused":
|
|
45666
|
-
if (
|
|
45656
|
+
if (isRenderable(instance)) {
|
|
45667
45657
|
if (!!propValue) {
|
|
45668
45658
|
instance.focus();
|
|
45669
45659
|
} else {
|
|
@@ -46065,14 +46055,14 @@ export {
|
|
|
46065
46055
|
isPaddingType,
|
|
46066
46056
|
isPositionType,
|
|
46067
46057
|
isPositionTypeType,
|
|
46068
|
-
|
|
46058
|
+
isRenderable,
|
|
46069
46059
|
isSizeType,
|
|
46070
46060
|
isStyledText,
|
|
46071
46061
|
isTextNodeRenderable,
|
|
46072
46062
|
isValidBorderStyle,
|
|
46073
46063
|
italic,
|
|
46074
46064
|
magenta,
|
|
46075
|
-
|
|
46065
|
+
maybeMakeRenderable,
|
|
46076
46066
|
parseAlign,
|
|
46077
46067
|
parseAlignItems,
|
|
46078
46068
|
parseBorderStyle,
|