@gjsify/gtk-host 0.43.0 → 0.45.0

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.
Files changed (63) hide show
  1. package/README.md +86 -13
  2. package/lib/esm/adapters/react.js +1 -1
  3. package/lib/esm/adapters/solid.js +1 -1
  4. package/lib/esm/conformance/diagnostics.js +2 -2
  5. package/lib/esm/conformance/index.js +2 -2
  6. package/lib/esm/descriptors/adw.js +1 -1
  7. package/lib/esm/descriptors/gtk.js +1 -1
  8. package/lib/esm/errors.js +1 -1
  9. package/lib/esm/generated/widgets.js +1 -1
  10. package/lib/esm/host.js +1 -1
  11. package/lib/esm/index.js +1 -1
  12. package/lib/esm/list/controller.js +1 -0
  13. package/lib/esm/list/index.js +1 -0
  14. package/lib/esm/list/scroll.js +1 -0
  15. package/lib/esm/policies.js +1 -1
  16. package/lib/esm/probe.js +1 -1
  17. package/lib/esm/signals.js +1 -1
  18. package/lib/esm/style/errors.js +1 -0
  19. package/lib/esm/style/gtk-css.js +1 -0
  20. package/lib/esm/style/gtk-props.js +1 -0
  21. package/lib/esm/style/index.js +1 -0
  22. package/lib/esm/style/layout.js +1 -0
  23. package/lib/esm/style/paint.js +1 -0
  24. package/lib/esm/style/resolve.js +1 -0
  25. package/lib/esm/style/sheet.js +3 -0
  26. package/lib/esm/style/tokens.js +1 -0
  27. package/lib/types/adapters/react.d.ts +59 -10
  28. package/lib/types/adapters/solid.d.ts +35 -0
  29. package/lib/types/conformance/diagnostics.d.ts +13 -3
  30. package/lib/types/conformance/index.d.ts +1 -1
  31. package/lib/types/descriptors/index.d.ts +2 -2
  32. package/lib/types/errors.d.ts +10 -0
  33. package/lib/types/generated/props.d.ts +80 -1
  34. package/lib/types/generator/emit-types.d.mts +1 -1
  35. package/lib/types/generator/gir.d.mts +36 -2
  36. package/lib/types/host.d.ts +2 -2
  37. package/lib/types/index.d.ts +1 -1
  38. package/lib/types/list/controller.d.ts +112 -0
  39. package/lib/types/list/index.d.ts +2 -0
  40. package/lib/types/list/list.spec.d.ts +2 -0
  41. package/lib/types/list/scroll.d.ts +26 -0
  42. package/lib/types/policies.d.ts +11 -0
  43. package/lib/types/probe.d.ts +80 -2
  44. package/lib/types/probe.spec.d.ts +2 -0
  45. package/lib/types/props.d.ts +7 -4
  46. package/lib/types/signals.d.ts +3 -1
  47. package/lib/types/style/errors.d.ts +6 -0
  48. package/lib/types/style/gtk-css.d.ts +24 -0
  49. package/lib/types/style/gtk-css.spec.d.ts +2 -0
  50. package/lib/types/style/gtk-props.d.ts +27 -0
  51. package/lib/types/style/gtk-props.spec.d.ts +2 -0
  52. package/lib/types/style/index.d.ts +13 -0
  53. package/lib/types/style/layout.d.ts +163 -0
  54. package/lib/types/style/layout.spec.d.ts +2 -0
  55. package/lib/types/style/paint.d.ts +53 -0
  56. package/lib/types/style/paint.spec.d.ts +2 -0
  57. package/lib/types/style/resolve.d.ts +58 -0
  58. package/lib/types/style/sheet.d.ts +40 -0
  59. package/lib/types/style/sheet.spec.d.ts +2 -0
  60. package/lib/types/style/tokens.d.ts +58 -0
  61. package/lib/types/testing/gate.d.mts +23 -0
  62. package/lib/types/types.d.ts +21 -4
  63. package/package.json +26 -12
package/README.md CHANGED
@@ -103,11 +103,62 @@ exists there, so it uses `indexed` and reorders natively. Near-identical APIs wi
103
103
  opposite capabilities are exactly why the table is measured per widget rather than
104
104
  inherited.
105
105
 
106
+ `Adw.NavigationView` declares the same `remove-all` degradation and it is a HAZARD
107
+ there rather than only a cost: its `remove()` also takes the page out of the
108
+ **navigation stack**, which no other container in the table does, so a renderer that
109
+ reorders these children disturbs navigation and not just paint order. It is `keyed`
110
+ with `titled: false` — MEASURED, `add(page)` takes one argument — and the tag a page
111
+ is addressed by afterwards (`push_by_tag`, `pop_to_tag`, `replace_with_tags`) is a
112
+ property on the CHILD, not an argument to the add. That is what lets a route key be
113
+ the join between React's membership and GTK's ordering.
114
+
106
115
  `slot` and `layout` are props the CHILD declares: `slot="end"` picks a `slotted`
107
116
  attachment point, `layout={{ column, row, columnSpan, rowSpan }}` a `coords` cell,
108
117
  `layout={{ name, title }}` a `keyed` page. Both are read at placement time, so
109
118
  changing either RE-PLACES the child rather than doing nothing.
110
119
 
120
+ ## Lists — `@gjsify/gtk-host/list`
121
+
122
+ A `Gtk.ListView` is the one thing in GTK4 that cannot be an element: it installs no
123
+ child-adding method at all (measured against its prototype), and the carrier its
124
+ factory hands back is not a `Gtk.Widget`. What it needs instead is a model, a factory
125
+ and a key diff — none of which has a framework in it, and all of which every dialect
126
+ would otherwise own a copy of. `ListController` is that half, in a subpath rather than
127
+ a package: a `/core` subpath beats a new `-core` package unless a separate NAME buys a
128
+ package-level cycle or an independent external consumer, and neither is in play.
129
+
130
+ It imports Gtk, GObject and Gio and nothing else — no React, no Solid, no Vue; `Gio`
131
+ is not an oversight in that list but the module's centrepiece, since the model IS a
132
+ `Gio.ListStore`. The constraint that matters is the framework one, and
133
+ `scripts/check-adapter-import-direction.mjs` enforces it rather than this sentence. The
134
+ dialect supplies three callbacks:
135
+
136
+ | callback | called from | what it owes |
137
+ |---|---|---|
138
+ | `mountRow(item)` | `setup` | take the carrier, put a subtree root in it, return a handle |
139
+ | `showRow(handle, row, index)` | `bind`, `unbind` (with `null`), and a same-key content change | show that row, or empty it |
140
+ | `disposeRow(handle)` | `teardown` and `dispose()` | let go |
141
+
142
+ **Take the carrier ONCE, in `mountRow`.** GTK recycles a carrier across `bind`/`unbind`,
143
+ and `adopt` snapshots what a container already held without being able to tell the
144
+ host's own previous child from application chrome — so a dialect that adopts per bind
145
+ refuses with `occupied-slot`. `host.spec.ts` pins that
146
+ refusal. The route that reaches it FIRST is not GTK recycling a carrier, which needs
147
+ scrolling: it is `setRows` over unchanged keys, which shows every live row again through
148
+ the same handle with no GTK involvement, so a per-show `adopt` fails on the first content
149
+ change; `list/controller.ts` carries the three measurements the controller's shape
150
+ follows from (the `Gio.ListStore` carrier identity, why a data change SPLICES rather
151
+ than emitting `items-changed`, and why `dispose()` and not GTK's `teardown` is the
152
+ teardown authority).
153
+
154
+ `@gjsify/gtk-host/solid`'s `listRows` is the Solid half, and it is one reactive root
155
+ per ROW WIDGET rather than per bound row: a row sees an ACCESSOR, so a content change
156
+ behind an unchanged key writes one property and the widget survives — asserted by
157
+ identity in `list/list.spec.ts`. `@gjsify/react-native`'s `lists/controller.ts` is the
158
+ React half, and it defers every row render to a microtask, which is React's constraint
159
+ and not GTK's: the adapter's `render()` refuses a re-entrant flush by name, and GTK
160
+ binds rows from inside React's own commit.
161
+
111
162
  ## Lifetime
112
163
 
113
164
  `remove` detaches and is reversible, because frameworks move nodes. The wrapper
@@ -377,14 +428,30 @@ is not in this table because `@vue/runtime-core` does not export it at all
377
428
  READ instead of restated. `react-reconciler` is `module.exports = function
378
429
  $$$reconciler($$$hostConfig) { … }` and its body opens by destructuring the whole
379
430
  config, so a recording `Proxy` over the config reports exactly which members the
380
- installed version asks for. Measured on **0.29.2**, production bundle: **76**
381
- members read, **37** answered here, **39** switched off by three flags the config
382
- does declare (`supportsPersistence: false`, `supportsHydration: false`,
383
- `supportsTestSelectors` absent) plus `supportsMicrotasks`, and 4 more declared for
384
- the development bundle, which reads 94. `react.spec.ts` asserts all three
431
+ installed version asks for. Measured on **0.33.0** (React 19.2), production bundle:
432
+ **160** members read, **58** answered here, **102** switched off — by the four
433
+ capability flags the config declares false (`supportsPersistence`,
434
+ `supportsHydration`, `supportsResources`, `supportsSingletons`), by two it declares
435
+ not at all (`supportsTestSelectors`, `supportsMicrotasks`), and by three families no
436
+ flag gates and nothing here can mean (view transitions and the gesture timeline,
437
+ fragment instances, DevTools metadata, and the suspended-commit reason React reads
438
+ only to name a commit in its own timeline). `react.spec.ts` asserts all three
385
439
  directions, so a version bump that starts asking for something new fails a test
386
440
  instead of reading `undefined` inside a commit.
387
441
 
442
+ **What the React 19 bump cost, because the numbers alone understate it.** 0.29.2 read
443
+ 76 members and the development bundle read 94, which made the count itself a guard
444
+ against a lost `NODE_ENV=production` define; on 0.33.0 both bundles read 160 and that
445
+ guard is gone — the "runs without a DOM at all" vector, which asserts `document`,
446
+ `HTMLCanvasElement` and `Path2D` are absent, is now the only thing holding the build
447
+ recipe. Three further changes were silent rather than typed: `flushSync(() =>
448
+ updateContainer(…))` on a ConcurrentRoot mounts NOTHING under 19 (the sync path is
449
+ `updateContainerSync` + `flushSyncWork`); `createContainer` grew two error callbacks
450
+ *before* `onRecoverableError`, so the React 18 argument list keeps working and wires
451
+ the wrong handler; and an error the host throws no longer propagates out of
452
+ `render()` but goes to `onUncaughtError`, which is why `createRoot` holds the first
453
+ one and rethrows it — a named refusal that only reaches a log has bought nothing.
454
+
388
455
  ```ts
389
456
  import { createRoot, flushSync } from '@gjsify/gtk-host/react';
390
457
 
@@ -396,11 +463,13 @@ root.render(createElement('GtkBox', null, createElement('GtkLabel', { label: 'hi
396
463
  `ConcurrentRoot`'s updates are DEFAULT-lane, so they are handed to `scheduler`,
397
464
  which under GJS is a GLib timer source — with no main loop running yet, an
398
465
  unflushed first render leaves the container empty and says nothing. `render()`
399
- therefore wraps `updateContainer` in `flushSync`, which sets the current update
400
- priority to `DiscreteEventPriority` and makes everything scheduled inside it a
401
- sync lane the same call then flushes.
466
+ therefore calls `updateContainerSync`, which puts the work on the sync lane, and
467
+ then `flushSyncWork`, which drains it. Under React 18 this was
468
+ `flushSync(() => updateContainer(…))`; under 19 that combination on a
469
+ `ConcurrentRoot` mounts nothing at all, silently, so the two calls are spelled
470
+ separately and the reason is written down where they are.
402
471
  - **A `setState` from a GTK signal handler is concurrent** and lands on the next
403
- main-loop iteration, because `getCurrentEventPriority` returns the default lane
472
+ main-loop iteration, because `resolveUpdatePriority` returns the default lane
404
473
  (there is no ambient DOM event to derive a priority from). `flushSync` is the
405
474
  escape hatch. A vector pumps `GLib.MainContext.default()` and proves the
406
475
  scheduled path works at all under GJS — it does, on gjs 1.88.1, with no
@@ -459,10 +528,14 @@ contain, and a reader who concludes `@gjsify/gtk-host/testing` exists.
459
528
 
460
529
  ## The widget table, and the type surfaces
461
530
 
462
- The table is **generated from the GIR** and committed. 164 concrete GtkWidget
463
- descendants (Gtk 102, Adw 62), each with its GType name, its kebab tag and a lazy
464
- `ctor`; 26 of them also carry a **curated** placement rule, and the generator may
465
- only ever ADD a tag, never contradict one. A tag with no curated rule gets
531
+ The table is **generated from the GIR** and committed, from TWO rules: every concrete
532
+ `GtkWidget` descendant, plus the concrete non-widgets that hold one — GTK4's list
533
+ carriers, which take no children of their own but whose `child` is where a row's
534
+ subtree goes (ADR 0028 § Amendment). Each row carries its GType name, its kebab tag and
535
+ a lazy `ctor`; some also carry a **curated** placement rule, and the generator may
536
+ only ever ADD a tag, never contradict one. `tableProvenance()` reports every live
537
+ figure — the counts are deliberately not stamped here, because the pair that used to
538
+ stand in this sentence was wrong in both halves. A tag with no curated rule gets
466
539
  `children: { kind: 'uncurated' }` — the widget can be created, given properties and
467
540
  given handlers, while inserting a child raises an error naming the tag that needs a
468
541
  policy. Guessing is not on offer: `add`, `append` and `set_child` all exist
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{withoutKeys as e}from"../props.js";import{adopt as t,createElement as n,createText as r,destroy as i,destroyChildren as a,insert as o,materialize as s,setElementText as c,setProp as l,setText as u,widgetOf as d}from"../host.js";import f from"react-reconciler";import{ConcurrentRoot as p,DefaultEventPriority as m}from"react-reconciler/constants.js";const h=new Set([`children`]),ownProps=t=>e(t,h);function diffProps(e,t){let n=null;for(let r of Object.keys(t))h.has(r)||t[r]!==e[r]&&(n??=[]).push([r,t[r],e[r]]);for(let r of Object.keys(e))h.has(r)||r in t||(n??=[]).push([r,void 0,e[r]]);return n}const visibilityTargetOf=e=>{let t=s(e);return e.wrapper??t},g={supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,isPrimaryRenderer:!0,noTimeout:-1,scheduleTimeout:setTimeout,cancelTimeout:clearTimeout,createInstance:(e,t)=>n(e,ownProps(t)),createTextInstance:e=>r(e),appendInitialChild:(e,t)=>{o(t,e,null)},finalizeInitialChildren:()=>!1,shouldSetTextContent:()=>!1,getRootHostContext:()=>null,getChildHostContext:e=>e,getPublicInstance:e=>s(e),prepareForCommit:()=>null,resetAfterCommit:()=>{},preparePortalMount:()=>{},getCurrentEventPriority:()=>m,appendChild:(e,t)=>{o(t,e,null)},appendChildToContainer:(e,t)=>{o(t,e,null)},insertBefore:(e,t,n)=>{o(t,e,n)},insertInContainerBefore:(e,t,n)=>{o(t,e,n)},removeChild:(e,t)=>{i(t)},removeChildFromContainer:(e,t)=>{i(t)},clearContainer:e=>{a(e)},prepareUpdate:(e,t,n,r)=>diffProps(n,r),commitUpdate:(e,t)=>{for(let[n,r,i]of t)l(e,n,r,i)},commitTextUpdate:(e,t,n)=>{u(e,n)},commitMount:()=>{throw Error(`@gjsify/gtk-host/react: commitMount was called, which means finalizeInitialChildren returned true. Nothing in this adapter asks for a post-mount callback yet.`)},resetTextContent:e=>{c(e,``)},hideInstance:e=>{visibilityTargetOf(e).set_visible(!1)},unhideInstance:e=>{visibilityTargetOf(e).set_visible(!0)},hideTextInstance:e=>{u(e,``)},unhideTextInstance:(e,t)=>{u(e,t)},getInstanceFromNode:()=>null,getInstanceFromScope:()=>null,prepareScopeUpdate:()=>{},beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{}},_=f(g),flushSync=e=>_.flushSync(e);function createRoot(e,n={}){let r=t(e),i=n.onRecoverableError??(e=>{console.error(`@gjsify/gtk-host/react: React recovered from an error`,e)}),a=_.createContainer(r,p,null,!1,null,``,i,null);return{container:r,render(e){_.flushSync(()=>{_.updateContainer(e,a,null,null)})},unmount(){_.flushSync(()=>{_.updateContainer(null,a,null,null)})}}}function mount(e,t,n={}){let r=createRoot(t,n);return r.render(e),r}export{t as adopt,createRoot,flushSync,g as gtkHostConfig,mount,d as widgetOf};
1
+ import"../_virtual/_rolldown/runtime.js";import{withoutKeys as e}from"../props.js";import{adopt as t,createElement as n,createText as r,destroy as i,destroyChildren as a,insert as o,materialize as s,setElementText as c,setProp as l,setText as u,widgetOf as d}from"../host.js";import f from"react-reconciler";import{ConcurrentRoot as p,DefaultEventPriority as m,NoEventPriority as h}from"react-reconciler/constants.js";import{createContext as g}from"react";const _=new Set([`children`,`ref`]),ownProps=t=>e(t,_);function diffProps(e,t){let n=null;for(let r of Object.keys(t))_.has(r)||t[r]!==e[r]&&(n??=[]).push([r,t[r],e[r]]);for(let r of Object.keys(e))_.has(r)||r in t||(n??=[]).push([r,void 0,e[r]]);return n}const visibilityTargetOf=e=>{let t=s(e);return e.wrapper??t},v=Object.freeze({});let y=h;const b={supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,isPrimaryRenderer:!0,supportsResources:!1,supportsSingletons:!1,noTimeout:-1,scheduleTimeout:setTimeout,cancelTimeout:clearTimeout,createInstance:(e,t)=>n(e,ownProps(t)),createTextInstance:e=>r(e),appendInitialChild:(e,t)=>{o(t,e,null)},finalizeInitialChildren:()=>!1,shouldSetTextContent:()=>!1,getRootHostContext:()=>v,getChildHostContext:e=>e,getPublicInstance:e=>s(e),prepareForCommit:()=>null,resetAfterCommit:()=>{},preparePortalMount:()=>{},getCurrentUpdatePriority:()=>y,setCurrentUpdatePriority:e=>{y=e},resolveUpdatePriority:()=>y===h?m:y,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,appendChild:(e,t)=>{o(t,e,null)},appendChildToContainer:(e,t)=>{o(t,e,null)},insertBefore:(e,t,n)=>{o(t,e,n)},insertInContainerBefore:(e,t,n)=>{o(t,e,n)},removeChild:(e,t)=>{i(t)},removeChildFromContainer:(e,t)=>{i(t)},clearContainer:e=>{a(e)},commitUpdate:(e,t,n,r)=>{let i=diffProps(n,r);if(i!==null)for(let[t,n,r]of i)l(e,t,n,r)},commitTextUpdate:(e,t,n)=>{u(e,n)},commitMount:()=>{throw Error(`@gjsify/gtk-host/react: commitMount was called, which means finalizeInitialChildren returned true. Nothing in this adapter asks for a post-mount callback yet.`)},resetTextContent:e=>{c(e,``)},hideInstance:e=>{visibilityTargetOf(e).set_visible(!1)},unhideInstance:e=>{visibilityTargetOf(e).set_visible(!0)},hideTextInstance:e=>{u(e,``)},unhideTextInstance:(e,t)=>{u(e,t)},getInstanceFromNode:()=>null,getInstanceFromScope:()=>null,prepareScopeUpdate:()=>{},beforeActiveInstanceBlur:()=>{},maySuspendCommit:()=>!1,maySuspendCommitOnUpdate:()=>!1,maySuspendCommitInSyncRender:()=>!1,preloadInstance:()=>!0,startSuspendingCommit:()=>{},suspendInstance:()=>{},waitForCommitToBeReady:()=>null,requestPostPaintCallback:()=>{},NotPendingTransition:null,HostTransitionContext:g(null),resetFormInstance:()=>{},detachDeletedInstance:()=>{}},x=f(b),flushSync=e=>x.flushSyncFromReconciler(e);function createRoot(e,n={}){let r=t(e),report=(e,t)=>n=>{if(t)return t(n);console.error(`@gjsify/gtk-host/react: ${e}`,n)},i=null,a=n.onUncaughtError?report(`React hit an error no boundary caught`,n.onUncaughtError):e=>{console.error(`@gjsify/gtk-host/react: React hit an error no boundary caught`,e),i??=e},o=x.createContainer(r,p,null,!1,null,``,a,report(`an error boundary caught an error`,n.onCaughtError),report(`React recovered from an error`,n.onRecoverableError),()=>{}),renderSync=e=>{i=null,x.updateContainerSync(e,o,null,null);let t=x.flushSyncWork();if(i!==null){let e=i;throw i=null,e}if(t===!0)throw Error(`@gjsify/gtk-host/react: render() could not flush, because React is already rendering or committing — this call is re-entrant (a ref callback, a useLayoutEffect, or a GTK signal handler that fired during a commit). The widgets do NOT exist yet, which is what render() promises, so this throws rather than returning an empty container. Render the second tree from a useEffect or an idle callback instead.`)};return{container:r,render:renderSync,unmount(){renderSync(null)}}}function mount(e,t,n={}){let r=createRoot(t,n);return r.render(e),r}export{t as adopt,createRoot,flushSync,b as gtkHostConfig,mount,d as widgetOf};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{adopt as e,createElement as t,createText as n,describeValue as r,destroyChildren as i,disconnectHandlers as a,firstChild as o,insert as s,isText as c,nextSibling as l,parentNode as u,remove as d,setProp as f,setText as p,widgetOf as m}from"../host.js";import{For as h,Index as g,Show as _,onCleanup as v,splitProps as y,untrack as b}from"solid-js";import{createRenderer as x}from"solid-js/universal";const S=new Set([`element`,`text`,`anchor`]);function assertHostNode(e){let t=e?.kind;if(!(typeof t==`string`&&S.has(t)))throw Error(`@gjsify/gtk-host/solid: insertNode got ${r(e)}, which is not a node of this renderer. Almost always this is a component from solid-js/web — the DOM renderer — reaching a universal one: its <Dynamic>, <Portal> and template() build DOM elements with document.createElement and spread onto them with the DOM's own spread, so nothing arrives through these host ops and the subtree renders NOTHING, silently. Import Dynamic, For, Index and Show from @gjsify/gtk-host/solid instead; solid-js's own control flow (For/Index/Show) is renderer-agnostic, everything under solid-js/web is not.`)}const{render:C,effect:w,memo:T,createComponent:E,createElement:D,createTextNode:O,insertNode:k,insert:A,spread:j,setProp:M,mergeProps:N,use:P}=x({createElement:e=>{let n=t(e);return v(()=>a(n)),n},createTextNode:e=>n(e),replaceText:(e,t)=>{p(e,t)},isTextNode:e=>c(e),setProperty:(e,t,n,r)=>{f(e,t,n,r)},insertNode:(e,t,n)=>{assertHostNode(t),s(t,e,n??null)},removeNode:(e,t)=>{d(t)},getParentNode:e=>u(e)??void 0,getFirstChild:e=>e.kind===`element`?o(e)??void 0:void 0,getNextSibling:e=>l(e)??void 0});function mount(t,n){let r=e(n),a=C(t,r);return()=>{a(),i(r)}}const F=h,I=g,L=_;function Dynamic(e){let[,t]=y(e,[`component`]);return T(()=>{let n=e.component;if(typeof n==`function`)return b(()=>n(t));if(typeof n==`string`){let e=D(n);return j(e,t,!1),e}throw Error(`@gjsify/gtk-host/solid: <Dynamic component={…}> needs a registered tag name or a component function, and got ${r(n)}. Solid's own DOM version returns undefined here and renders nothing at all — a lookup that missed is indistinguishable from an empty branch. Use <Show when={…}> to render nothing on purpose.`)},!1)}export{Dynamic,F as For,I as Index,L as Show,E as createComponent,D as createElement,O as createTextNode,w as effect,A as insert,k as insertNode,T as memo,N as mergeProps,mount,C as render,M as setProp,j as spread,P as use,m as widgetOf};
1
+ import"../_virtual/_rolldown/runtime.js";import{adopt as e,createElement as t,createText as n,describeValue as r,destroyChildren as i,disconnectHandlers as a,firstChild as o,insert as s,isText as c,nextSibling as l,parentNode as u,remove as d,setProp as f,setText as p,widgetOf as m}from"../host.js";import{For as h,Index as g,Show as _,batch as v,createMemo as y,createRoot as b,createSignal as x,onCleanup as S,splitProps as C,untrack as w}from"solid-js";import{createRenderer as T}from"solid-js/universal";const E=new Set([`element`,`text`,`anchor`]);function assertHostNode(e){let t=e?.kind;if(!(typeof t==`string`&&E.has(t)))throw Error(`@gjsify/gtk-host/solid: insertNode got ${r(e)}, which is not a node of this renderer. Almost always this is a component from solid-js/web — the DOM renderer — reaching a universal one: its <Dynamic>, <Portal> and template() build DOM elements with document.createElement and spread onto them with the DOM's own spread, so nothing arrives through these host ops and the subtree renders NOTHING, silently. Import Dynamic, For, Index and Show from @gjsify/gtk-host/solid instead; solid-js's own control flow (For/Index/Show) is renderer-agnostic, everything under solid-js/web is not.`)}const{render:D,effect:O,memo:k,createComponent:A,createElement:j,createTextNode:M,insertNode:N,insert:P,spread:F,setProp:I,mergeProps:L,use:R}=T({createElement:e=>{let n=t(e);return S(()=>a(n)),n},createTextNode:e=>n(e),replaceText:(e,t)=>{p(e,t)},isTextNode:e=>c(e),setProperty:(e,t,n,r)=>{f(e,t,n,r)},insertNode:(e,t,n)=>{assertHostNode(t),s(t,e,n??null)},removeNode:(e,t)=>{d(t)},getParentNode:e=>u(e)??void 0,getFirstChild:e=>e.kind===`element`?o(e)??void 0:void 0,getNextSibling:e=>l(e)??void 0});function mount(t,n){let r=e(n),a=D(t,r);return()=>{a(),i(r)}}function listRows(t){return{mountRow(n){let r=e(n);return b(e=>{let[n,a]=x(null),[o,s]=x(0),c=y(()=>n()!==null);return P(r,()=>c()?t(n,o):null),{show(e,t){v(()=>{s(t),a(()=>e)})},dispose(){e(),i(r)}}})},showRow(e,t,n){e.show(t,n)},disposeRow(e){e.dispose()}}}const z=h,B=g,V=_;function Dynamic(e){let[,t]=C(e,[`component`]);return k(()=>{let n=e.component;if(typeof n==`function`)return w(()=>n(t));if(typeof n==`string`){let e=j(n);return F(e,t,!1),e}throw Error(`@gjsify/gtk-host/solid: <Dynamic component={…}> needs a registered tag name or a component function, and got ${r(n)}. Solid's own DOM version returns undefined here and renders nothing at all — a lookup that missed is indistinguishable from an empty branch. Use <Show when={…}> to render nothing on purpose.`)},!1)}export{Dynamic,z as For,B as Index,V as Show,A as createComponent,j as createElement,M as createTextNode,O as effect,P as insert,N as insertNode,listRows,k as memo,L as mergeProps,mount,D as render,I as setProp,F as spread,R as use,m as widgetOf};
@@ -1,2 +1,2 @@
1
- import"../_virtual/_rolldown/runtime.js";import e from"gi://GLib";let t=null;function describeLogRecord(e,t=new TextDecoder){let text=e=>e instanceof Uint8Array?t.decode(e):String(e),n=e,r=n?.MESSAGE;if(r!=null){let e=text(r);if(e!==``)return e}let i=n?Object.keys(n).filter(e=>e!==`MESSAGE`&&n[e]!==void 0&&n[e]!==null).map(e=>`${e}=${text(n[e])}`):[];return i.length>0?`<no MESSAGE field> ${i.join(` `)}`:`<a log record with no MESSAGE and no other field>`}function installDiagnosticsGate(){if(t)return t;let n=[],r=new TextDecoder,i=e.getenv(`G_MESSAGES_DEBUG`)!==null;return e.log_set_writer_func((t,a)=>{try{let o=describeLogRecord(a,r),s=t&e.LogLevelFlags.LEVEL_MASK;s<=e.LogLevelFlags.LEVEL_WARNING&&n.push(o),(i||s<=e.LogLevelFlags.LEVEL_MESSAGE)&&printerr(o)}catch{printerr(`<gtk-host: a log message could not be decoded>`)}return e.LogWriterOutput.HANDLED}),t={seen:n,reset(){n.length=0},assertQuiet(e){if(n.length===0)return;let t=n.length,r=n.join(`
2
- `);throw n.length=0,Error(`${e?e+`: `:``}GTK reported ${t} diagnostic(s) that would have passed at exit 0:\n ${r}`)}},t}export{describeLogRecord,installDiagnosticsGate};
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://GLib";const t=[`Vulkan: `];function isEnvironmentDiagnostic(e){return t.some(t=>e.startsWith(t))}let n=null;function describeLogRecord(e,t=new TextDecoder){let text=e=>e instanceof Uint8Array?t.decode(e):String(e),n=e,r=n?.MESSAGE;if(r!=null){let e=text(r);if(e!==``)return e}let i=n?Object.keys(n).filter(e=>e!==`MESSAGE`&&n[e]!==void 0&&n[e]!==null).map(e=>`${e}=${text(n[e])}`):[];return i.length>0?`<no MESSAGE field> ${i.join(` `)}`:`<a log record with no MESSAGE and no other field>`}function installDiagnosticsGate(){if(n)return n;let t=[],r=[],i=new TextDecoder,a=e.getenv(`G_MESSAGES_DEBUG`)!==null;return e.log_set_writer_func((n,o)=>{try{let s=describeLogRecord(o,i),c=n&e.LogLevelFlags.LEVEL_MASK;c<=e.LogLevelFlags.LEVEL_WARNING&&(isEnvironmentDiagnostic(s)?r:t).push(s),(a||c<=e.LogLevelFlags.LEVEL_MESSAGE)&&printerr(s)}catch{printerr(`<gtk-host: a log message could not be decoded>`)}return e.LogWriterOutput.HANDLED}),n={seen:t,environment:r,reset(){t.length=0,r.length=0},assertQuiet(e){let n=r.length;if(r.length=0,t.length===0)return;let i=t.length,a=t.join(`
2
+ `);t.length=0;let o=n>0?`\n (plus ${n} diagnostic(s) about the HOST's graphics stack, not the tree — see isEnvironmentDiagnostic)`:``;throw Error(`${e?e+`: `:``}GTK reported ${i} diagnostic(s) that would have passed at exit 0:\n ${a}${o}`)}},n}export{describeLogRecord,installDiagnosticsGate,isEnvironmentDiagnostic};
@@ -1,2 +1,2 @@
1
- import"../_virtual/_rolldown/runtime.js";import{addressOf as e,unhandledPolicy as t}from"../policies.js";import{describeLogRecord as n,installDiagnosticsGate as r}from"./diagnostics.js";import{BUILTIN_DESCRIPTORS as i}from"../descriptors/index.js";import a from"gi://GObject";function methodsOf(e){switch(e.kind){case`none`:case`uncurated`:return[];case`single`:return[e.set];case`ordered`:return e.after?[e.append,e.after,e.remove]:[e.append,e.remove];case`indexed`:return[e.insert,e.remove];case`slotted`:return[...Object.values(e.slots),e.remove];case`keyed`:return[e.add,e.remove];case`coords`:return[e.attach,e.remove];default:return t(e)}}function descriptorProblems(e=i){let t=[];for(let n of e){let e;try{e=n.ctor()}catch(e){t.push({gtype:n.gtype,problem:`ctor() threw: ${e.message}`});continue}let r=a.type_name(e.$gtype);r!==n.gtype&&t.push({gtype:n.gtype,problem:`ctor() is ${r}, not ${n.gtype}`});for(let i of methodsOf(n.children))typeof e.prototype[i]!=`function`&&t.push({gtype:n.gtype,problem:`declares children.${i}(), which ${r} does not have`});if(n.textSink){let i=e.list_properties().find(e=>e.get_name()===n.textSink);i?(i.flags&a.ParamFlags.WRITABLE)===0?t.push({gtype:n.gtype,problem:`declares a READ-ONLY textSink "${n.textSink}"`}):a.type_is_a(i.value_type,a.TYPE_STRING)||t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which is ${a.type_name(i.value_type)}, not a string`}):t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which ${r} does not have`})}t.push(...policyProblems(n,e,r))}return t}function policyProblems(e,t,n){let r=[],i=t.prototype,a=e.children,requireGetter=(t,a)=>{let o=t.replace(/^set_/,`get_`);typeof i[o]!=`function`&&r.push({gtype:e.gtype,problem:`${a} uses ${t}() but ${n} has no ${o}(), so removal cannot check whether this child is still the one in place`})};if(a.kind===`single`&&requireGetter(a.set,`children.set`),a.kind===`slotted`){for(let[e,t]of Object.entries(a.slots))t.startsWith(`set_`)&&requireGetter(t,`slot "${e}"`);a.defaultSlot in a.slots||r.push({gtype:e.gtype,problem:`defaultSlot "${a.defaultSlot}" is not one of ${Object.keys(a.slots).join(`, `)}`})}if(a.kind===`ordered`&&a.reorder===`native`&&!a.after&&r.push({gtype:e.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),a.kind===`keyed`){let t=i[a.add],o=a.titled?3:1;typeof t==`function`&&t.length!==o&&r.push({gtype:e.gtype,problem:`titled: ${a.titled} implies ${a.add}() takes ${o} argument(s), but ${n}'s takes ${t.length}`})}return r}function gtkChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtkChildTypes=e=>gtkChildren(e).map(e=>a.type_name(e.constructor.$gtype));function addressesOf(t){let n=[];for(let r=t.first;r;r=r.next)r.kind===`element`&&r.widget&&n.push(e(r));return n}function findDescendant(e,t){let n=[e];for(;n.length>0;){let r=n.shift();if(r!==e&&t(r))return r;n.push(...gtkChildren(r))}return null}function descendants(e){let t=[e];for(let n of gtkChildren(e))t.push(...descendants(n));return t}function dumpTree(e,t=0){let n=a.type_name(e.constructor.$gtype),r=[`${` `.repeat(t)}${n}`];for(let n of gtkChildren(e))r.push(dumpTree(n,t+1));return r.join(`
2
- `)}export{addressesOf,descendants,n as describeLogRecord,descriptorProblems,dumpTree,findDescendant,gtkChildTypes,gtkChildren,r as installDiagnosticsGate,methodsOf};
1
+ import"../_virtual/_rolldown/runtime.js";import{adderSlots as e,addressOf as t,unhandledPolicy as n}from"../policies.js";import{describeLogRecord as r,installDiagnosticsGate as i,isEnvironmentDiagnostic as a}from"./diagnostics.js";import{BUILTIN_DESCRIPTORS as o}from"../descriptors/index.js";import s from"gi://GObject";function methodsOf(e){switch(e.kind){case`none`:case`uncurated`:return[];case`single`:return[e.set];case`ordered`:return e.after?[e.append,e.after,e.remove]:[e.append,e.remove];case`indexed`:return[e.insert,e.remove];case`slotted`:return e.remove?[...Object.values(e.slots),e.remove]:Object.values(e.slots);case`keyed`:return[e.add,e.remove];case`coords`:return[e.attach,e.remove];default:return n(e)}}function descriptorProblems(e=o){let t=[];for(let n of e){let e;try{e=n.ctor()}catch(e){t.push({gtype:n.gtype,problem:`ctor() threw: ${e.message}`});continue}let r=s.type_name(e.$gtype);r!==n.gtype&&t.push({gtype:n.gtype,problem:`ctor() is ${r}, not ${n.gtype}`});for(let i of methodsOf(n.children))typeof e.prototype[i]!=`function`&&t.push({gtype:n.gtype,problem:`declares children.${i}(), which ${r} does not have`});if(n.textSink){let i=e.list_properties().find(e=>e.get_name()===n.textSink);i?(i.flags&s.ParamFlags.WRITABLE)===0?t.push({gtype:n.gtype,problem:`declares a READ-ONLY textSink "${n.textSink}"`}):s.type_is_a(i.value_type,s.TYPE_STRING)||t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which is ${s.type_name(i.value_type)}, not a string`}):t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which ${r} does not have`})}t.push(...policyProblems(n,e,r))}return t}function policyProblems(t,n,r){let i=[],a=n.prototype,o=t.children,requireGetter=(e,n)=>{let o=e.replace(/^set_/,`get_`);typeof a[o]!=`function`&&i.push({gtype:t.gtype,problem:`${n} uses ${e}() but ${r} has no ${o}(), so removal cannot check whether this child is still the one in place`})};if(o.kind===`single`&&requireGetter(o.set,`children.set`),o.kind===`slotted`){for(let[e,t]of Object.entries(o.slots))t.startsWith(`set_`)&&requireGetter(t,`slot "${e}"`);o.defaultSlot in o.slots||i.push({gtype:t.gtype,problem:`defaultSlot "${o.defaultSlot}" is not one of ${Object.keys(o.slots).join(`, `)}`});let n=e(o);n.length>0&&!o.remove&&i.push({gtype:t.gtype,problem:`slot(s) ${n.map(e=>`"${e}"`).join(`, `)} are adder-backed, so removal needs a "remove" method and this policy names none`})}if(o.kind===`ordered`&&o.reorder===`native`&&!o.after&&i.push({gtype:t.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),o.kind===`keyed`){let e=a[o.add],n=o.titled?3:1;typeof e==`function`&&e.length!==n&&i.push({gtype:t.gtype,problem:`titled: ${o.titled} implies ${o.add}() takes ${n} argument(s), but ${r}'s takes ${e.length}`})}return i}function gtkChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtkChildTypes=e=>gtkChildren(e).map(e=>s.type_name(e.constructor.$gtype));function addressesOf(e){let n=[];for(let r=e.first;r;r=r.next)r.kind===`element`&&r.widget&&n.push(t(r));return n}function findDescendant(e,t){let n=[e];for(;n.length>0;){let r=n.shift();if(r!==e&&t(r))return r;n.push(...gtkChildren(r))}return null}function descendants(e){let t=[e];for(let n of gtkChildren(e))t.push(...descendants(n));return t}function dumpTree(e,t=0){let n=s.type_name(e.constructor.$gtype),r=[`${` `.repeat(t)}${n}`];for(let n of gtkChildren(e))r.push(dumpTree(n,t+1));return r.join(`
2
+ `)}export{addressesOf,descendants,r as describeLogRecord,descriptorProblems,dumpTree,findDescendant,gtkChildTypes,gtkChildren,i as installDiagnosticsGate,a as isEnvironmentDiagnostic,methodsOf};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import e from"gi://Adw?version=1";const t=[{gtype:`AdwApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_content`}},{gtype:`AdwWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_content`}},{gtype:`AdwBin`,ctor:()=>e.Bin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToolbarView`,ctor:()=>e.ToolbarView,children:{kind:`slotted`,slots:{top:`add_top_bar`,bottom:`add_bottom_bar`,content:`set_content`},defaultSlot:`content`,remove:`remove`}},{gtype:`AdwHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}},{gtype:`AdwPreferencesGroup`,ctor:()=>e.PreferencesGroup,children:{kind:`ordered`,append:`add`,remove:`remove`,reorder:`remove-all`}},{gtype:`AdwPreferencesPage`,ctor:()=>e.PreferencesPage,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:null}},{gtype:`AdwActionRow`,ctor:()=>e.ActionRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`},defaultSlot:`suffix`,remove:`remove`}},{gtype:`AdwStatusPage`,ctor:()=>e.StatusPage,children:{kind:`single`,set:`set_child`}}];export{t as ADW_DESCRIPTORS};
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://Adw?version=1";const t=[{gtype:`AdwToggle`,ctor:()=>e.Toggle,children:{kind:`single`,set:`set_child`}},{gtype:`AdwApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_content`}},{gtype:`AdwWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_content`}},{gtype:`AdwBin`,ctor:()=>e.Bin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToolbarView`,ctor:()=>e.ToolbarView,children:{kind:`slotted`,slots:{top:`add_top_bar`,bottom:`add_bottom_bar`,content:`set_content`},defaultSlot:`content`,remove:`remove`}},{gtype:`AdwHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}},{gtype:`AdwPreferencesGroup`,ctor:()=>e.PreferencesGroup,children:{kind:`ordered`,append:`add`,remove:`remove`,reorder:`remove-all`}},{gtype:`AdwPreferencesPage`,ctor:()=>e.PreferencesPage,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:null}},{gtype:`AdwActionRow`,ctor:()=>e.ActionRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`},defaultSlot:`suffix`,remove:`remove`}},{gtype:`AdwStatusPage`,ctor:()=>e.StatusPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationView`,ctor:()=>e.NavigationView,children:{kind:`keyed`,add:`add`,remove:`remove`,nameFrom:`tag`,titled:!1}},{gtype:`AdwNavigationPage`,ctor:()=>e.NavigationPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwViewStack`,ctor:()=>e.ViewStack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0}},{gtype:`AdwClamp`,ctor:()=>e.Clamp,children:{kind:`single`,set:`set_child`}},{gtype:`AdwClampScrollable`,ctor:()=>e.ClampScrollable,children:{kind:`single`,set:`set_child`}},{gtype:`AdwBreakpointBin`,ctor:()=>e.BreakpointBin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationSplitView`,ctor:()=>e.NavigationSplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}},{gtype:`AdwOverlaySplitView`,ctor:()=>e.OverlaySplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}}];export{t as ADW_DESCRIPTORS};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";const t=[{gtype:`GtkBox`,ctor:()=>e.Box,children:{kind:`ordered`,append:`append`,after:`insert_child_after`,remove:`remove`,reorder:`native`}},{gtype:`GtkWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_child`}},{gtype:`GtkApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkScrolledWindow`,ctor:()=>e.ScrolledWindow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkFrame`,ctor:()=>e.Frame,children:{kind:`single`,set:`set_child`}},{gtype:`GtkLabel`,ctor:()=>e.Label,children:{kind:`none`},textSink:`label`},{gtype:`GtkButton`,ctor:()=>e.Button,children:{kind:`single`,set:`set_child`},textSink:`label`},{gtype:`GtkToggleButton`,ctor:()=>e.ToggleButton,children:{kind:`single`,set:`set_child`},textSink:`label`},{gtype:`GtkImage`,ctor:()=>e.Image,children:{kind:`none`}},{gtype:`GtkSwitch`,ctor:()=>e.Switch,children:{kind:`none`}},{gtype:`GtkEntry`,ctor:()=>e.Entry,children:{kind:`none`},textSink:`text`},{gtype:`GtkListBox`,ctor:()=>e.ListBox,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:`list-box-row`}},{gtype:`GtkFlowBox`,ctor:()=>e.FlowBox,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:`flow-box-child`}},{gtype:`GtkListBoxRow`,ctor:()=>e.ListBoxRow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkStack`,ctor:()=>e.Stack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0}},{gtype:`GtkGrid`,ctor:()=>e.Grid,children:{kind:`coords`,attach:`attach`,remove:`remove`}},{gtype:`GtkHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}}];export{t as GTK_DESCRIPTORS};
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";const t=[{gtype:`GtkBox`,ctor:()=>e.Box,children:{kind:`ordered`,append:`append`,after:`insert_child_after`,remove:`remove`,reorder:`native`}},{gtype:`GtkWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_child`}},{gtype:`GtkApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkScrolledWindow`,ctor:()=>e.ScrolledWindow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkFrame`,ctor:()=>e.Frame,children:{kind:`single`,set:`set_child`}},{gtype:`GtkOverlay`,ctor:()=>e.Overlay,children:{kind:`slotted`,slots:{child:`set_child`,overlay:`add_overlay`},defaultSlot:`child`,remove:`remove_overlay`}},{gtype:`GtkLabel`,ctor:()=>e.Label,children:{kind:`none`},textSink:`label`},{gtype:`GtkButton`,ctor:()=>e.Button,children:{kind:`single`,set:`set_child`},textSink:`label`},{gtype:`GtkToggleButton`,ctor:()=>e.ToggleButton,children:{kind:`single`,set:`set_child`},textSink:`label`},{gtype:`GtkImage`,ctor:()=>e.Image,children:{kind:`none`}},{gtype:`GtkSwitch`,ctor:()=>e.Switch,children:{kind:`none`}},{gtype:`GtkEntry`,ctor:()=>e.Entry,children:{kind:`none`},textSink:`text`},{gtype:`GtkListBox`,ctor:()=>e.ListBox,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:`list-box-row`}},{gtype:`GtkFlowBox`,ctor:()=>e.FlowBox,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:`flow-box-child`}},{gtype:`GtkListBoxRow`,ctor:()=>e.ListBoxRow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkListItem`,ctor:()=>e.ListItem,children:{kind:`single`,set:`set_child`}},{gtype:`GtkListHeader`,ctor:()=>e.ListHeader,children:{kind:`single`,set:`set_child`}},{gtype:`GtkColumnViewCell`,ctor:()=>e.ColumnViewCell,children:{kind:`single`,set:`set_child`}},{gtype:`GtkStack`,ctor:()=>e.Stack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0}},{gtype:`GtkGrid`,ctor:()=>e.Grid,children:{kind:`coords`,attach:`attach`,remove:`remove`}},{gtype:`GtkHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}}];export{t as GTK_DESCRIPTORS};
package/lib/esm/errors.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";var GtkHostError=class extends Error{constructor(e,t){super(t),this.code=e,this.name=`GtkHostError`}};const e={unknownTag:e=>new GtkHostError(`unknown-tag`,`No descriptor registered for <${e}>. Register one with registerWidget({ gtype: '${e}', … }). Being a real GType in the installed typelib is not enough on its own.`),missingConstructProp:(e,t)=>new GtkHostError(`missing-construct-prop`,`<${e}> cannot be constructed without ${t}. In the installed library this is not an exception but a g_error(): the process ABORTS (SIGABRT, exit 134, core dump) with no catch and no diagnostic, so the host refuses here while a refusal is still reportable. Author ${t} on the element.`),unknownProp:(e,t)=>new GtkHostError(`unknown-prop`,`<${e}> has no property "${t}". Check the spelling against the installed GTK (camelCase and kebab-case both resolve), or bind it as a signal with on${t[0]?.toUpperCase()}${t.slice(1)}.`),readOnlyProp:(e,t)=>new GtkHostError(`read-only-prop`,`<${e}>.${t} is read-only in the installed GTK. Writing it is a silent no-op in GObject, so this host refuses it instead of dropping the value.`),badEnum:(e,t,n,r)=>new GtkHostError(`bad-enum`,`<${e}>.${t} expects ${r}, and "${n}" is not one of its values. Note that GObject accepts the wrong string SILENTLY — the property would have kept its old value.`),unknownSignal:(e,t,n)=>new GtkHostError(`unknown-signal`,`<${e}> emits no signal "${n}" (bound as ${t}). Check the spelling against the installed GTK, or use the escape hatch on:<raw-signal-name> if the name is irregular.`),signalTaken:(e,t,n,r)=>new GtkHostError(`signal-taken`,`<${e}> already binds "${r}" through ${n}, so ${t} would silently replace it — GObject has one handler per connect, and this host keeps one per signal name. Use one spelling, or combine the two callbacks yourself.`),eventModifier:(e,t)=>new GtkHostError(`event-modifier`,`${e} carries the DOM listener modifier ".${t}", which has no GObject meaning: a signal is emitted on one object and does not propagate through a tree, so there is no capture phase and nothing to be passive about. Drop the modifier (${e.slice(0,e.length-t.length)}); for GTK4's own propagation phases set "propagation-phase" on a Gtk.EventController instead.`),badString:(e,t,n)=>new GtkHostError(`bad-string`,`<${e}>.${t} is a string property and got a ${n}. Numbers and booleans are stringified; anything else has no unambiguous spelling, and GObject would have thrown from inside the next rebuild.`),badBoolean:(e,t,n)=>new GtkHostError(`bad-boolean`,`<${e}>.${t} is a boolean and got the string "${n}". JS truthiness would make "false" mean TRUE — the exact silent-wrong-value this host exists to refuse. Pass a real boolean.`),badFlags:(e,t,n,r)=>new GtkHostError(`bad-flags`,`<${e}>.${t} expects the flags type ${r}, and a string ("${n}") cannot be resolved to one. Pass the numeric value (bitwise-or the members). GObject would have dropped the string silently.`),unresolvableEnum:e=>new GtkHostError(`unresolvable-enum`,`Cannot resolve the enum type ${e} to a GI namespace. Pass the numeric value instead, or extend ENUM_NAMESPACES in props.ts.`),textNotAccepted:(e,t)=>new GtkHostError(`text-not-accepted`,`<${e}> has no text sink, so the text ${JSON.stringify(t.slice(0,32))} has nowhere to go. Wrap it in a widget that takes text (<GtkLabel>), or set the property directly.`),unclaimedChild:(e,t)=>new GtkHostError(`unclaimed-child`,`<${e}> declares children: { kind: 'none' }, so it cannot adopt <${t}>. Fix one of three things: give the parent a child policy, wrap the child in a container, or set the child on a property (e.g. a "child" or "content" property).`),unknownSlot:(e,t,n)=>new GtkHostError(`unknown-slot`,`<${e}> has no slot "${t}". Known slots: ${n.join(`, `)}.`),rejectedChild:(e,t,n)=>new GtkHostError(`rejected-child`,`<${e}> refused <${t}>: ${n}. The container accepts only certain child types (e.g. AdwPreferencesPage takes AdwPreferencesGroup); the descriptor cannot know that, GTK does.`),uncuratedPlacement:(e,t)=>new GtkHostError(`uncurated-placement`,`<${e}> comes from the GENERATED table, which knows the tag but not how the widget adopts a child, so it cannot take <${t}>. Guessing is the one thing that is not available here: \`add\`, \`append\` and \`set_child\` all exist somewhere in GTK and calling the wrong one is a warning at exit 0. Add a curated policy for ${e} in descriptors/, or mount into a container that has one.`),siblingCycle:e=>new GtkHostError(`sibling-cycle`,`The child list of <${e}> does not terminate. A renderer linked a node to itself or into a loop; the host refuses to walk it rather than spin. This is a host or adapter bug, not an application one — please report it with the reordering that produced it.`),notAWidget:e=>new GtkHostError(`not-a-widget`,`<${e}> is not a Gtk.Widget, so it cannot be placed as a child. Non-widget GObjects (controllers, filters, models) attach to a property, not to a parent.`),occupiedSlot:(e,t,n)=>new GtkHostError(`occupied-slot`,`<${e}> already holds a child the application put there, and ${n}() takes only ONE — placing <${t}> would unparent it. GTK does that silently: no throw, no warning, exit 0, and the application's own widget is simply gone. Mount into a container of your own inside <${e}>, or clear the existing child first (${n}(null)) if replacing it is the intent.`),notAnElement:e=>new GtkHostError(`not-an-element`,`Only an element node owns a widget, and this node is a ${e}. A text node's content lives in its PARENT's text sink and an anchor owns nothing at all — neither has a widget to hand back. Ask the parent element instead.`),destroyedNode:e=>new GtkHostError(`destroyed-node`,`<${e}> was destroyed, so its widget is gone. Asking again would MATERIALISE a fresh, propertyless, unparented widget — \`destroy\` clears props and layout precisely so a destroyed element cannot look re-materialisable — and a caller holding that widget would be looking at nothing on screen.`),notAHostParent:e=>new GtkHostError(`not-a-host-parent`,`insert() needs a host element as the parent and got ${e}. A raw widget cannot be one: the shadow tree lives in the host's own fields, so writing them onto a GObject wrapper renders nothing and reports nothing — Vue's <Teleport to="someWidget"> hands the widget through verbatim and landed exactly here. Wrap it with adopt(widget) first, which is what mountRoot() does.`)};export{GtkHostError,e as err};
1
+ import"./_virtual/_rolldown/runtime.js";var GtkHostError=class extends Error{constructor(e,t){super(t),this.code=e,this.name=`GtkHostError`}};const e={unknownTag:e=>new GtkHostError(`unknown-tag`,`No descriptor registered for <${e}>. Register one with registerWidget({ gtype: '${e}', … }). Being a real GType in the installed typelib is not enough on its own.`),missingConstructProp:(e,t)=>new GtkHostError(`missing-construct-prop`,`<${e}> cannot be constructed without ${t}. In the installed library this is not an exception but a g_error(): the process ABORTS (SIGABRT, exit 134, core dump) with no catch and no diagnostic, so the host refuses here while a refusal is still reportable. Author ${t} on the element.`),unknownProp:(e,t)=>new GtkHostError(`unknown-prop`,`<${e}> has no property "${t}". Check the spelling against the installed GTK (camelCase and kebab-case both resolve), or bind it as a signal with on${t[0]?.toUpperCase()}${t.slice(1)}.`),readOnlyProp:(e,t)=>new GtkHostError(`read-only-prop`,`<${e}>.${t} is read-only in the installed GTK. Writing it is a silent no-op in GObject, so this host refuses it instead of dropping the value.`),badEnum:(e,t,n,r)=>new GtkHostError(`bad-enum`,`<${e}>.${t} expects ${r}, and "${n}" is not one of its values. Note that GObject accepts the wrong string SILENTLY — the property would have kept its old value.`),unknownSignal:(e,t,n)=>new GtkHostError(`unknown-signal`,`<${e}> emits no signal "${n}" (bound as ${t}). Check the spelling against the installed GTK, or use the escape hatch on:<raw-signal-name> if the name is irregular.`),signalTaken:(e,t,n,r)=>new GtkHostError(`signal-taken`,`<${e}> already binds "${r}" through ${n}, so ${t} would silently replace it — GObject has one handler per connect, and this host keeps one per signal name. Use one spelling, or combine the two callbacks yourself.`),eventModifier:(e,t)=>new GtkHostError(`event-modifier`,`${e} carries the DOM listener modifier ".${t}", which has no GObject meaning: a signal is emitted on one object and does not propagate through a tree, so there is no capture phase and nothing to be passive about. Drop the modifier (${e.slice(0,e.length-t.length)}); for GTK4's own propagation phases set "propagation-phase" on a Gtk.EventController instead.`),badString:(e,t,n)=>new GtkHostError(`bad-string`,`<${e}>.${t} is a string property and got a ${n}. Numbers and booleans are stringified; anything else has no unambiguous spelling, and GObject would have thrown from inside the next rebuild.`),badBoolean:(e,t,n)=>new GtkHostError(`bad-boolean`,`<${e}>.${t} is a boolean and got the string "${n}". JS truthiness would make "false" mean TRUE — the exact silent-wrong-value this host exists to refuse. Pass a real boolean.`),badFlags:(e,t,n,r)=>new GtkHostError(`bad-flags`,`<${e}>.${t} expects the flags type ${r}, and a string ("${n}") cannot be resolved to one. Pass the numeric value (bitwise-or the members). GObject would have dropped the string silently.`),unresolvableEnum:e=>new GtkHostError(`unresolvable-enum`,`Cannot resolve the enum type ${e} to a GI namespace. Pass the numeric value instead, or extend ENUM_NAMESPACES in props.ts.`),textNotAccepted:(e,t)=>new GtkHostError(`text-not-accepted`,`<${e}> has no text sink, so the text ${JSON.stringify(t.slice(0,32))} has nowhere to go. Wrap it in a widget that takes text (<GtkLabel>), or set the property directly.`),unclaimedChild:(e,t)=>new GtkHostError(`unclaimed-child`,`<${e}> declares children: { kind: 'none' }, so it cannot adopt <${t}>. Fix one of three things: give the parent a child policy, wrap the child in a container, or set the child on a property (e.g. a "child" or "content" property).`),unknownSlot:(e,t,n)=>new GtkHostError(`unknown-slot`,`<${e}> has no slot "${t}". Known slots: ${n.join(`, `)}.`),slotNeedsRemove:(e,t,n)=>new GtkHostError(`slot-needs-remove`,`<${e}> puts children into slot "${t}" with ${n}() and its policy names no "remove" method, so this child cannot be taken out again. A set_-prefixed slot is emptied by writing null back through the setter and needs nothing; an adder-backed one needs children.remove. Add it to the descriptor.`),rejectedChild:(e,t,n)=>new GtkHostError(`rejected-child`,`<${e}> refused <${t}>: ${n}. The container accepts only certain child types (e.g. AdwPreferencesPage takes AdwPreferencesGroup); the descriptor cannot know that, GTK does.`),uncuratedPlacement:(e,t)=>new GtkHostError(`uncurated-placement`,`<${e}> comes from the GENERATED table, which knows the tag but not how the widget adopts a child, so it cannot take <${t}>. Guessing is the one thing that is not available here: \`add\`, \`append\` and \`set_child\` all exist somewhere in GTK and calling the wrong one is a warning at exit 0. Add a curated policy for ${e} in descriptors/, or mount into a container that has one.`),siblingCycle:e=>new GtkHostError(`sibling-cycle`,`The child list of <${e}> does not terminate. A renderer linked a node to itself or into a loop; the host refuses to walk it rather than spin. This is a host or adapter bug, not an application one — please report it with the reordering that produced it.`),notAWidget:e=>new GtkHostError(`not-a-widget`,`<${e}> is not a Gtk.Widget, so it cannot be placed as a child. Non-widget GObjects (controllers, filters, models) attach to a property, not to a parent.`),occupiedSlot:(e,t,n)=>new GtkHostError(`occupied-slot`,`<${e}> already holds a child the application put there, and ${n}() takes only ONE — placing <${t}> would unparent it. GTK does that silently: no throw, no warning, exit 0, and the application's own widget is simply gone. Mount into a container of your own inside <${e}>, or clear the existing child first (${n}(null)) if replacing it is the intent.`),notAnElement:e=>new GtkHostError(`not-an-element`,`Only an element node owns a widget, and this node is a ${e}. A text node's content lives in its PARENT's text sink and an anchor owns nothing at all — neither has a widget to hand back. Ask the parent element instead.`),destroyedNode:e=>new GtkHostError(`destroyed-node`,`<${e}> was destroyed, so its widget is gone. Asking again would MATERIALISE a fresh, propertyless, unparented widget — \`destroy\` clears props and layout precisely so a destroyed element cannot look re-materialisable — and a caller holding that widget would be looking at nothing on screen.`),notAHostParent:e=>new GtkHostError(`not-a-host-parent`,`insert() needs a host element as the parent and got ${e}. A raw widget cannot be one: the shadow tree lives in the host's own fields, so writing them onto a GObject wrapper renders nothing and reports nothing — Vue's <Teleport to="someWidget"> hands the widget through verbatim and landed exactly here. Wrap it with adopt(widget) first, which is what mountRoot() does.`)};export{GtkHostError,e as err};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Adw?version=1";const n=`Gtk-4.0 Adw-1`,r=[{gtype:`AdwAboutDialog`,tag:`adw-about-dialog`,ctor:()=>t.AboutDialog},{gtype:`AdwAboutWindow`,tag:`adw-about-window`,ctor:()=>t.AboutWindow},{gtype:`AdwActionRow`,tag:`adw-action-row`,ctor:()=>t.ActionRow},{gtype:`AdwAlertDialog`,tag:`adw-alert-dialog`,ctor:()=>t.AlertDialog},{gtype:`AdwApplicationWindow`,tag:`adw-application-window`,ctor:()=>t.ApplicationWindow},{gtype:`AdwAvatar`,tag:`adw-avatar`,ctor:()=>t.Avatar},{gtype:`AdwBanner`,tag:`adw-banner`,ctor:()=>t.Banner},{gtype:`AdwBin`,tag:`adw-bin`,ctor:()=>t.Bin},{gtype:`AdwBottomSheet`,tag:`adw-bottom-sheet`,ctor:()=>t.BottomSheet},{gtype:`AdwBreakpointBin`,tag:`adw-breakpoint-bin`,ctor:()=>t.BreakpointBin},{gtype:`AdwButtonContent`,tag:`adw-button-content`,ctor:()=>t.ButtonContent},{gtype:`AdwButtonRow`,tag:`adw-button-row`,ctor:()=>t.ButtonRow},{gtype:`AdwCarousel`,tag:`adw-carousel`,ctor:()=>t.Carousel},{gtype:`AdwCarouselIndicatorDots`,tag:`adw-carousel-indicator-dots`,ctor:()=>t.CarouselIndicatorDots},{gtype:`AdwCarouselIndicatorLines`,tag:`adw-carousel-indicator-lines`,ctor:()=>t.CarouselIndicatorLines},{gtype:`AdwClamp`,tag:`adw-clamp`,ctor:()=>t.Clamp},{gtype:`AdwClampScrollable`,tag:`adw-clamp-scrollable`,ctor:()=>t.ClampScrollable},{gtype:`AdwComboRow`,tag:`adw-combo-row`,ctor:()=>t.ComboRow},{gtype:`AdwDialog`,tag:`adw-dialog`,ctor:()=>t.Dialog},{gtype:`AdwEntryRow`,tag:`adw-entry-row`,ctor:()=>t.EntryRow},{gtype:`AdwExpanderRow`,tag:`adw-expander-row`,ctor:()=>t.ExpanderRow},{gtype:`AdwFlap`,tag:`adw-flap`,ctor:()=>t.Flap},{gtype:`AdwHeaderBar`,tag:`adw-header-bar`,ctor:()=>t.HeaderBar},{gtype:`AdwInlineViewSwitcher`,tag:`adw-inline-view-switcher`,ctor:()=>t.InlineViewSwitcher},{gtype:`AdwLayoutSlot`,tag:`adw-layout-slot`,ctor:()=>t.LayoutSlot},{gtype:`AdwLeaflet`,tag:`adw-leaflet`,ctor:()=>t.Leaflet},{gtype:`AdwMessageDialog`,tag:`adw-message-dialog`,ctor:()=>t.MessageDialog},{gtype:`AdwMultiLayoutView`,tag:`adw-multi-layout-view`,ctor:()=>t.MultiLayoutView},{gtype:`AdwNavigationPage`,tag:`adw-navigation-page`,ctor:()=>t.NavigationPage},{gtype:`AdwNavigationSplitView`,tag:`adw-navigation-split-view`,ctor:()=>t.NavigationSplitView},{gtype:`AdwNavigationView`,tag:`adw-navigation-view`,ctor:()=>t.NavigationView},{gtype:`AdwOverlaySplitView`,tag:`adw-overlay-split-view`,ctor:()=>t.OverlaySplitView},{gtype:`AdwPasswordEntryRow`,tag:`adw-password-entry-row`,ctor:()=>t.PasswordEntryRow},{gtype:`AdwPreferencesDialog`,tag:`adw-preferences-dialog`,ctor:()=>t.PreferencesDialog},{gtype:`AdwPreferencesGroup`,tag:`adw-preferences-group`,ctor:()=>t.PreferencesGroup},{gtype:`AdwPreferencesPage`,tag:`adw-preferences-page`,ctor:()=>t.PreferencesPage},{gtype:`AdwPreferencesRow`,tag:`adw-preferences-row`,ctor:()=>t.PreferencesRow},{gtype:`AdwPreferencesWindow`,tag:`adw-preferences-window`,ctor:()=>t.PreferencesWindow},{gtype:`AdwShortcutLabel`,tag:`adw-shortcut-label`,ctor:()=>t.ShortcutLabel},{gtype:`AdwShortcutsDialog`,tag:`adw-shortcuts-dialog`,ctor:()=>t.ShortcutsDialog},{gtype:`AdwSidebar`,tag:`adw-sidebar`,ctor:()=>t.Sidebar},{gtype:`AdwSpinRow`,tag:`adw-spin-row`,ctor:()=>t.SpinRow},{gtype:`AdwSpinner`,tag:`adw-spinner`,ctor:()=>t.Spinner},{gtype:`AdwSplitButton`,tag:`adw-split-button`,ctor:()=>t.SplitButton},{gtype:`AdwSqueezer`,tag:`adw-squeezer`,ctor:()=>t.Squeezer},{gtype:`AdwStatusPage`,tag:`adw-status-page`,ctor:()=>t.StatusPage},{gtype:`AdwSwitchRow`,tag:`adw-switch-row`,ctor:()=>t.SwitchRow},{gtype:`AdwTabBar`,tag:`adw-tab-bar`,ctor:()=>t.TabBar},{gtype:`AdwTabButton`,tag:`adw-tab-button`,ctor:()=>t.TabButton},{gtype:`AdwTabOverview`,tag:`adw-tab-overview`,ctor:()=>t.TabOverview},{gtype:`AdwTabView`,tag:`adw-tab-view`,ctor:()=>t.TabView},{gtype:`AdwToastOverlay`,tag:`adw-toast-overlay`,ctor:()=>t.ToastOverlay},{gtype:`AdwToggleGroup`,tag:`adw-toggle-group`,ctor:()=>t.ToggleGroup},{gtype:`AdwToolbarView`,tag:`adw-toolbar-view`,ctor:()=>t.ToolbarView},{gtype:`AdwViewStack`,tag:`adw-view-stack`,ctor:()=>t.ViewStack},{gtype:`AdwViewSwitcher`,tag:`adw-view-switcher`,ctor:()=>t.ViewSwitcher},{gtype:`AdwViewSwitcherBar`,tag:`adw-view-switcher-bar`,ctor:()=>t.ViewSwitcherBar},{gtype:`AdwViewSwitcherSidebar`,tag:`adw-view-switcher-sidebar`,ctor:()=>t.ViewSwitcherSidebar},{gtype:`AdwViewSwitcherTitle`,tag:`adw-view-switcher-title`,ctor:()=>t.ViewSwitcherTitle},{gtype:`AdwWindow`,tag:`adw-window`,ctor:()=>t.Window},{gtype:`AdwWindowTitle`,tag:`adw-window-title`,ctor:()=>t.WindowTitle},{gtype:`AdwWrapBox`,tag:`adw-wrap-box`,ctor:()=>t.WrapBox},{gtype:`GtkAboutDialog`,tag:`gtk-about-dialog`,ctor:()=>e.AboutDialog},{gtype:`GtkActionBar`,tag:`gtk-action-bar`,ctor:()=>e.ActionBar},{gtype:`GtkAppChooserButton`,tag:`gtk-app-chooser-button`,ctor:()=>e.AppChooserButton},{gtype:`GtkAppChooserDialog`,tag:`gtk-app-chooser-dialog`,ctor:()=>e.AppChooserDialog},{gtype:`GtkAppChooserWidget`,tag:`gtk-app-chooser-widget`,ctor:()=>e.AppChooserWidget},{gtype:`GtkApplicationWindow`,tag:`gtk-application-window`,ctor:()=>e.ApplicationWindow},{gtype:`GtkAspectFrame`,tag:`gtk-aspect-frame`,ctor:()=>e.AspectFrame},{gtype:`GtkAssistant`,tag:`gtk-assistant`,ctor:()=>e.Assistant},{gtype:`GtkBox`,tag:`gtk-box`,ctor:()=>e.Box},{gtype:`GtkButton`,tag:`gtk-button`,ctor:()=>e.Button},{gtype:`GtkCalendar`,tag:`gtk-calendar`,ctor:()=>e.Calendar},{gtype:`GtkCellView`,tag:`gtk-cell-view`,ctor:()=>e.CellView},{gtype:`GtkCenterBox`,tag:`gtk-center-box`,ctor:()=>e.CenterBox},{gtype:`GtkCheckButton`,tag:`gtk-check-button`,ctor:()=>e.CheckButton},{gtype:`GtkColorButton`,tag:`gtk-color-button`,ctor:()=>e.ColorButton},{gtype:`GtkColorChooserDialog`,tag:`gtk-color-chooser-dialog`,ctor:()=>e.ColorChooserDialog},{gtype:`GtkColorChooserWidget`,tag:`gtk-color-chooser-widget`,ctor:()=>e.ColorChooserWidget},{gtype:`GtkColorDialogButton`,tag:`gtk-color-dialog-button`,ctor:()=>e.ColorDialogButton},{gtype:`GtkColumnView`,tag:`gtk-column-view`,ctor:()=>e.ColumnView},{gtype:`GtkComboBox`,tag:`gtk-combo-box`,ctor:()=>e.ComboBox},{gtype:`GtkComboBoxText`,tag:`gtk-combo-box-text`,ctor:()=>e.ComboBoxText},{gtype:`GtkDialog`,tag:`gtk-dialog`,ctor:()=>e.Dialog},{gtype:`GtkDragIcon`,tag:`gtk-drag-icon`,ctor:()=>e.DragIcon},{gtype:`GtkDrawingArea`,tag:`gtk-drawing-area`,ctor:()=>e.DrawingArea},{gtype:`GtkDropDown`,tag:`gtk-drop-down`,ctor:()=>e.DropDown},{gtype:`GtkEditableLabel`,tag:`gtk-editable-label`,ctor:()=>e.EditableLabel},{gtype:`GtkEmojiChooser`,tag:`gtk-emoji-chooser`,ctor:()=>e.EmojiChooser},{gtype:`GtkEntry`,tag:`gtk-entry`,ctor:()=>e.Entry},{gtype:`GtkExpander`,tag:`gtk-expander`,ctor:()=>e.Expander},{gtype:`GtkFileChooserDialog`,tag:`gtk-file-chooser-dialog`,ctor:()=>e.FileChooserDialog},{gtype:`GtkFileChooserWidget`,tag:`gtk-file-chooser-widget`,ctor:()=>e.FileChooserWidget},{gtype:`GtkFixed`,tag:`gtk-fixed`,ctor:()=>e.Fixed},{gtype:`GtkFlowBox`,tag:`gtk-flow-box`,ctor:()=>e.FlowBox},{gtype:`GtkFlowBoxChild`,tag:`gtk-flow-box-child`,ctor:()=>e.FlowBoxChild},{gtype:`GtkFontButton`,tag:`gtk-font-button`,ctor:()=>e.FontButton},{gtype:`GtkFontChooserDialog`,tag:`gtk-font-chooser-dialog`,ctor:()=>e.FontChooserDialog},{gtype:`GtkFontChooserWidget`,tag:`gtk-font-chooser-widget`,ctor:()=>e.FontChooserWidget},{gtype:`GtkFontDialogButton`,tag:`gtk-font-dialog-button`,ctor:()=>e.FontDialogButton},{gtype:`GtkFrame`,tag:`gtk-frame`,ctor:()=>e.Frame},{gtype:`GtkGLArea`,tag:`gtk-gl-area`,ctor:()=>e.GLArea},{gtype:`GtkGraphicsOffload`,tag:`gtk-graphics-offload`,ctor:()=>e.GraphicsOffload},{gtype:`GtkGrid`,tag:`gtk-grid`,ctor:()=>e.Grid},{gtype:`GtkGridView`,tag:`gtk-grid-view`,ctor:()=>e.GridView},{gtype:`GtkHeaderBar`,tag:`gtk-header-bar`,ctor:()=>e.HeaderBar},{gtype:`GtkIconView`,tag:`gtk-icon-view`,ctor:()=>e.IconView},{gtype:`GtkImage`,tag:`gtk-image`,ctor:()=>e.Image},{gtype:`GtkInfoBar`,tag:`gtk-info-bar`,ctor:()=>e.InfoBar},{gtype:`GtkInscription`,tag:`gtk-inscription`,ctor:()=>e.Inscription},{gtype:`GtkLabel`,tag:`gtk-label`,ctor:()=>e.Label},{gtype:`GtkLevelBar`,tag:`gtk-level-bar`,ctor:()=>e.LevelBar},{gtype:`GtkLinkButton`,tag:`gtk-link-button`,ctor:()=>e.LinkButton},{gtype:`GtkListBox`,tag:`gtk-list-box`,ctor:()=>e.ListBox},{gtype:`GtkListBoxRow`,tag:`gtk-list-box-row`,ctor:()=>e.ListBoxRow},{gtype:`GtkListView`,tag:`gtk-list-view`,ctor:()=>e.ListView},{gtype:`GtkLockButton`,tag:`gtk-lock-button`,ctor:()=>e.LockButton},{gtype:`GtkMediaControls`,tag:`gtk-media-controls`,ctor:()=>e.MediaControls},{gtype:`GtkMenuButton`,tag:`gtk-menu-button`,ctor:()=>e.MenuButton},{gtype:`GtkMessageDialog`,tag:`gtk-message-dialog`,ctor:()=>e.MessageDialog},{gtype:`GtkNotebook`,tag:`gtk-notebook`,ctor:()=>e.Notebook},{gtype:`GtkOverlay`,tag:`gtk-overlay`,ctor:()=>e.Overlay},{gtype:`GtkPageSetupUnixDialog`,tag:`gtk-page-setup-unix-dialog`,ctor:()=>e.PageSetupUnixDialog},{gtype:`GtkPaned`,tag:`gtk-paned`,ctor:()=>e.Paned},{gtype:`GtkPasswordEntry`,tag:`gtk-password-entry`,ctor:()=>e.PasswordEntry},{gtype:`GtkPicture`,tag:`gtk-picture`,ctor:()=>e.Picture},{gtype:`GtkPopover`,tag:`gtk-popover`,ctor:()=>e.Popover},{gtype:`GtkPopoverBin`,tag:`gtk-popover-bin`,ctor:()=>e.PopoverBin},{gtype:`GtkPopoverMenu`,tag:`gtk-popover-menu`,ctor:()=>e.PopoverMenu},{gtype:`GtkPopoverMenuBar`,tag:`gtk-popover-menu-bar`,ctor:()=>e.PopoverMenuBar},{gtype:`GtkPrintUnixDialog`,tag:`gtk-print-unix-dialog`,ctor:()=>e.PrintUnixDialog},{gtype:`GtkProgressBar`,tag:`gtk-progress-bar`,ctor:()=>e.ProgressBar},{gtype:`GtkRange`,tag:`gtk-range`,ctor:()=>e.Range},{gtype:`GtkRevealer`,tag:`gtk-revealer`,ctor:()=>e.Revealer},{gtype:`GtkScale`,tag:`gtk-scale`,ctor:()=>e.Scale},{gtype:`GtkScaleButton`,tag:`gtk-scale-button`,ctor:()=>e.ScaleButton},{gtype:`GtkScrollbar`,tag:`gtk-scrollbar`,ctor:()=>e.Scrollbar},{gtype:`GtkScrolledWindow`,tag:`gtk-scrolled-window`,ctor:()=>e.ScrolledWindow},{gtype:`GtkSearchBar`,tag:`gtk-search-bar`,ctor:()=>e.SearchBar},{gtype:`GtkSearchEntry`,tag:`gtk-search-entry`,ctor:()=>e.SearchEntry},{gtype:`GtkSeparator`,tag:`gtk-separator`,ctor:()=>e.Separator},{gtype:`GtkShortcutLabel`,tag:`gtk-shortcut-label`,ctor:()=>e.ShortcutLabel},{gtype:`GtkShortcutsGroup`,tag:`gtk-shortcuts-group`,ctor:()=>e.ShortcutsGroup},{gtype:`GtkShortcutsSection`,tag:`gtk-shortcuts-section`,ctor:()=>e.ShortcutsSection},{gtype:`GtkShortcutsShortcut`,tag:`gtk-shortcuts-shortcut`,ctor:()=>e.ShortcutsShortcut},{gtype:`GtkShortcutsWindow`,tag:`gtk-shortcuts-window`,ctor:()=>e.ShortcutsWindow},{gtype:`GtkSpinButton`,tag:`gtk-spin-button`,ctor:()=>e.SpinButton},{gtype:`GtkSpinner`,tag:`gtk-spinner`,ctor:()=>e.Spinner},{gtype:`GtkStack`,tag:`gtk-stack`,ctor:()=>e.Stack},{gtype:`GtkStackSidebar`,tag:`gtk-stack-sidebar`,ctor:()=>e.StackSidebar},{gtype:`GtkStackSwitcher`,tag:`gtk-stack-switcher`,ctor:()=>e.StackSwitcher},{gtype:`GtkStatusbar`,tag:`gtk-statusbar`,ctor:()=>e.Statusbar},{gtype:`GtkSwitch`,tag:`gtk-switch`,ctor:()=>e.Switch},{gtype:`GtkText`,tag:`gtk-text`,ctor:()=>e.Text},{gtype:`GtkTextView`,tag:`gtk-text-view`,ctor:()=>e.TextView},{gtype:`GtkToggleButton`,tag:`gtk-toggle-button`,ctor:()=>e.ToggleButton},{gtype:`GtkTreeExpander`,tag:`gtk-tree-expander`,ctor:()=>e.TreeExpander},{gtype:`GtkTreeView`,tag:`gtk-tree-view`,ctor:()=>e.TreeView},{gtype:`GtkVideo`,tag:`gtk-video`,ctor:()=>e.Video},{gtype:`GtkViewport`,tag:`gtk-viewport`,ctor:()=>e.Viewport},{gtype:`GtkVolumeButton`,tag:`gtk-volume-button`,ctor:()=>e.VolumeButton},{gtype:`GtkWindow`,tag:`gtk-window`,ctor:()=>e.Window},{gtype:`GtkWindowControls`,tag:`gtk-window-controls`,ctor:()=>e.WindowControls},{gtype:`GtkWindowHandle`,tag:`gtk-window-handle`,ctor:()=>e.WindowHandle}];export{n as GENERATED_PROVENANCE,r as GENERATED_WIDGETS};
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Adw?version=1";const n=`Gtk-4.0 Adw-1`,r=[{gtype:`AdwAboutDialog`,tag:`adw-about-dialog`,ctor:()=>t.AboutDialog},{gtype:`AdwAboutWindow`,tag:`adw-about-window`,ctor:()=>t.AboutWindow},{gtype:`AdwActionRow`,tag:`adw-action-row`,ctor:()=>t.ActionRow},{gtype:`AdwAlertDialog`,tag:`adw-alert-dialog`,ctor:()=>t.AlertDialog},{gtype:`AdwApplicationWindow`,tag:`adw-application-window`,ctor:()=>t.ApplicationWindow},{gtype:`AdwAvatar`,tag:`adw-avatar`,ctor:()=>t.Avatar},{gtype:`AdwBanner`,tag:`adw-banner`,ctor:()=>t.Banner},{gtype:`AdwBin`,tag:`adw-bin`,ctor:()=>t.Bin},{gtype:`AdwBottomSheet`,tag:`adw-bottom-sheet`,ctor:()=>t.BottomSheet},{gtype:`AdwBreakpointBin`,tag:`adw-breakpoint-bin`,ctor:()=>t.BreakpointBin},{gtype:`AdwButtonContent`,tag:`adw-button-content`,ctor:()=>t.ButtonContent},{gtype:`AdwButtonRow`,tag:`adw-button-row`,ctor:()=>t.ButtonRow},{gtype:`AdwCarousel`,tag:`adw-carousel`,ctor:()=>t.Carousel},{gtype:`AdwCarouselIndicatorDots`,tag:`adw-carousel-indicator-dots`,ctor:()=>t.CarouselIndicatorDots},{gtype:`AdwCarouselIndicatorLines`,tag:`adw-carousel-indicator-lines`,ctor:()=>t.CarouselIndicatorLines},{gtype:`AdwClamp`,tag:`adw-clamp`,ctor:()=>t.Clamp},{gtype:`AdwClampScrollable`,tag:`adw-clamp-scrollable`,ctor:()=>t.ClampScrollable},{gtype:`AdwComboRow`,tag:`adw-combo-row`,ctor:()=>t.ComboRow},{gtype:`AdwDialog`,tag:`adw-dialog`,ctor:()=>t.Dialog},{gtype:`AdwEntryRow`,tag:`adw-entry-row`,ctor:()=>t.EntryRow},{gtype:`AdwExpanderRow`,tag:`adw-expander-row`,ctor:()=>t.ExpanderRow},{gtype:`AdwFlap`,tag:`adw-flap`,ctor:()=>t.Flap},{gtype:`AdwHeaderBar`,tag:`adw-header-bar`,ctor:()=>t.HeaderBar},{gtype:`AdwInlineViewSwitcher`,tag:`adw-inline-view-switcher`,ctor:()=>t.InlineViewSwitcher},{gtype:`AdwLayoutSlot`,tag:`adw-layout-slot`,ctor:()=>t.LayoutSlot},{gtype:`AdwLeaflet`,tag:`adw-leaflet`,ctor:()=>t.Leaflet},{gtype:`AdwMessageDialog`,tag:`adw-message-dialog`,ctor:()=>t.MessageDialog},{gtype:`AdwMultiLayoutView`,tag:`adw-multi-layout-view`,ctor:()=>t.MultiLayoutView},{gtype:`AdwNavigationPage`,tag:`adw-navigation-page`,ctor:()=>t.NavigationPage},{gtype:`AdwNavigationSplitView`,tag:`adw-navigation-split-view`,ctor:()=>t.NavigationSplitView},{gtype:`AdwNavigationView`,tag:`adw-navigation-view`,ctor:()=>t.NavigationView},{gtype:`AdwOverlaySplitView`,tag:`adw-overlay-split-view`,ctor:()=>t.OverlaySplitView},{gtype:`AdwPasswordEntryRow`,tag:`adw-password-entry-row`,ctor:()=>t.PasswordEntryRow},{gtype:`AdwPreferencesDialog`,tag:`adw-preferences-dialog`,ctor:()=>t.PreferencesDialog},{gtype:`AdwPreferencesGroup`,tag:`adw-preferences-group`,ctor:()=>t.PreferencesGroup},{gtype:`AdwPreferencesPage`,tag:`adw-preferences-page`,ctor:()=>t.PreferencesPage},{gtype:`AdwPreferencesRow`,tag:`adw-preferences-row`,ctor:()=>t.PreferencesRow},{gtype:`AdwPreferencesWindow`,tag:`adw-preferences-window`,ctor:()=>t.PreferencesWindow},{gtype:`AdwShortcutLabel`,tag:`adw-shortcut-label`,ctor:()=>t.ShortcutLabel},{gtype:`AdwShortcutsDialog`,tag:`adw-shortcuts-dialog`,ctor:()=>t.ShortcutsDialog},{gtype:`AdwSidebar`,tag:`adw-sidebar`,ctor:()=>t.Sidebar},{gtype:`AdwSpinRow`,tag:`adw-spin-row`,ctor:()=>t.SpinRow},{gtype:`AdwSpinner`,tag:`adw-spinner`,ctor:()=>t.Spinner},{gtype:`AdwSplitButton`,tag:`adw-split-button`,ctor:()=>t.SplitButton},{gtype:`AdwSqueezer`,tag:`adw-squeezer`,ctor:()=>t.Squeezer},{gtype:`AdwStatusPage`,tag:`adw-status-page`,ctor:()=>t.StatusPage},{gtype:`AdwSwitchRow`,tag:`adw-switch-row`,ctor:()=>t.SwitchRow},{gtype:`AdwTabBar`,tag:`adw-tab-bar`,ctor:()=>t.TabBar},{gtype:`AdwTabButton`,tag:`adw-tab-button`,ctor:()=>t.TabButton},{gtype:`AdwTabOverview`,tag:`adw-tab-overview`,ctor:()=>t.TabOverview},{gtype:`AdwTabView`,tag:`adw-tab-view`,ctor:()=>t.TabView},{gtype:`AdwToastOverlay`,tag:`adw-toast-overlay`,ctor:()=>t.ToastOverlay},{gtype:`AdwToggle`,tag:`adw-toggle`,ctor:()=>t.Toggle},{gtype:`AdwToggleGroup`,tag:`adw-toggle-group`,ctor:()=>t.ToggleGroup},{gtype:`AdwToolbarView`,tag:`adw-toolbar-view`,ctor:()=>t.ToolbarView},{gtype:`AdwViewStack`,tag:`adw-view-stack`,ctor:()=>t.ViewStack},{gtype:`AdwViewSwitcher`,tag:`adw-view-switcher`,ctor:()=>t.ViewSwitcher},{gtype:`AdwViewSwitcherBar`,tag:`adw-view-switcher-bar`,ctor:()=>t.ViewSwitcherBar},{gtype:`AdwViewSwitcherSidebar`,tag:`adw-view-switcher-sidebar`,ctor:()=>t.ViewSwitcherSidebar},{gtype:`AdwViewSwitcherTitle`,tag:`adw-view-switcher-title`,ctor:()=>t.ViewSwitcherTitle},{gtype:`AdwWindow`,tag:`adw-window`,ctor:()=>t.Window},{gtype:`AdwWindowTitle`,tag:`adw-window-title`,ctor:()=>t.WindowTitle},{gtype:`AdwWrapBox`,tag:`adw-wrap-box`,ctor:()=>t.WrapBox},{gtype:`GtkAboutDialog`,tag:`gtk-about-dialog`,ctor:()=>e.AboutDialog},{gtype:`GtkActionBar`,tag:`gtk-action-bar`,ctor:()=>e.ActionBar},{gtype:`GtkAppChooserButton`,tag:`gtk-app-chooser-button`,ctor:()=>e.AppChooserButton},{gtype:`GtkAppChooserDialog`,tag:`gtk-app-chooser-dialog`,ctor:()=>e.AppChooserDialog},{gtype:`GtkAppChooserWidget`,tag:`gtk-app-chooser-widget`,ctor:()=>e.AppChooserWidget},{gtype:`GtkApplicationWindow`,tag:`gtk-application-window`,ctor:()=>e.ApplicationWindow},{gtype:`GtkAspectFrame`,tag:`gtk-aspect-frame`,ctor:()=>e.AspectFrame},{gtype:`GtkAssistant`,tag:`gtk-assistant`,ctor:()=>e.Assistant},{gtype:`GtkBox`,tag:`gtk-box`,ctor:()=>e.Box},{gtype:`GtkButton`,tag:`gtk-button`,ctor:()=>e.Button},{gtype:`GtkCalendar`,tag:`gtk-calendar`,ctor:()=>e.Calendar},{gtype:`GtkCellView`,tag:`gtk-cell-view`,ctor:()=>e.CellView},{gtype:`GtkCenterBox`,tag:`gtk-center-box`,ctor:()=>e.CenterBox},{gtype:`GtkCheckButton`,tag:`gtk-check-button`,ctor:()=>e.CheckButton},{gtype:`GtkColorButton`,tag:`gtk-color-button`,ctor:()=>e.ColorButton},{gtype:`GtkColorChooserDialog`,tag:`gtk-color-chooser-dialog`,ctor:()=>e.ColorChooserDialog},{gtype:`GtkColorChooserWidget`,tag:`gtk-color-chooser-widget`,ctor:()=>e.ColorChooserWidget},{gtype:`GtkColorDialogButton`,tag:`gtk-color-dialog-button`,ctor:()=>e.ColorDialogButton},{gtype:`GtkColumnView`,tag:`gtk-column-view`,ctor:()=>e.ColumnView},{gtype:`GtkColumnViewCell`,tag:`gtk-column-view-cell`,ctor:()=>e.ColumnViewCell},{gtype:`GtkComboBox`,tag:`gtk-combo-box`,ctor:()=>e.ComboBox},{gtype:`GtkComboBoxText`,tag:`gtk-combo-box-text`,ctor:()=>e.ComboBoxText},{gtype:`GtkDialog`,tag:`gtk-dialog`,ctor:()=>e.Dialog},{gtype:`GtkDragIcon`,tag:`gtk-drag-icon`,ctor:()=>e.DragIcon},{gtype:`GtkDrawingArea`,tag:`gtk-drawing-area`,ctor:()=>e.DrawingArea},{gtype:`GtkDropDown`,tag:`gtk-drop-down`,ctor:()=>e.DropDown},{gtype:`GtkEditableLabel`,tag:`gtk-editable-label`,ctor:()=>e.EditableLabel},{gtype:`GtkEmojiChooser`,tag:`gtk-emoji-chooser`,ctor:()=>e.EmojiChooser},{gtype:`GtkEntry`,tag:`gtk-entry`,ctor:()=>e.Entry},{gtype:`GtkExpander`,tag:`gtk-expander`,ctor:()=>e.Expander},{gtype:`GtkFileChooserDialog`,tag:`gtk-file-chooser-dialog`,ctor:()=>e.FileChooserDialog},{gtype:`GtkFileChooserWidget`,tag:`gtk-file-chooser-widget`,ctor:()=>e.FileChooserWidget},{gtype:`GtkFixed`,tag:`gtk-fixed`,ctor:()=>e.Fixed},{gtype:`GtkFlowBox`,tag:`gtk-flow-box`,ctor:()=>e.FlowBox},{gtype:`GtkFlowBoxChild`,tag:`gtk-flow-box-child`,ctor:()=>e.FlowBoxChild},{gtype:`GtkFontButton`,tag:`gtk-font-button`,ctor:()=>e.FontButton},{gtype:`GtkFontChooserDialog`,tag:`gtk-font-chooser-dialog`,ctor:()=>e.FontChooserDialog},{gtype:`GtkFontChooserWidget`,tag:`gtk-font-chooser-widget`,ctor:()=>e.FontChooserWidget},{gtype:`GtkFontDialogButton`,tag:`gtk-font-dialog-button`,ctor:()=>e.FontDialogButton},{gtype:`GtkFrame`,tag:`gtk-frame`,ctor:()=>e.Frame},{gtype:`GtkGLArea`,tag:`gtk-gl-area`,ctor:()=>e.GLArea},{gtype:`GtkGraphicsOffload`,tag:`gtk-graphics-offload`,ctor:()=>e.GraphicsOffload},{gtype:`GtkGrid`,tag:`gtk-grid`,ctor:()=>e.Grid},{gtype:`GtkGridView`,tag:`gtk-grid-view`,ctor:()=>e.GridView},{gtype:`GtkHeaderBar`,tag:`gtk-header-bar`,ctor:()=>e.HeaderBar},{gtype:`GtkIconView`,tag:`gtk-icon-view`,ctor:()=>e.IconView},{gtype:`GtkImage`,tag:`gtk-image`,ctor:()=>e.Image},{gtype:`GtkInfoBar`,tag:`gtk-info-bar`,ctor:()=>e.InfoBar},{gtype:`GtkInscription`,tag:`gtk-inscription`,ctor:()=>e.Inscription},{gtype:`GtkLabel`,tag:`gtk-label`,ctor:()=>e.Label},{gtype:`GtkLevelBar`,tag:`gtk-level-bar`,ctor:()=>e.LevelBar},{gtype:`GtkLinkButton`,tag:`gtk-link-button`,ctor:()=>e.LinkButton},{gtype:`GtkListBox`,tag:`gtk-list-box`,ctor:()=>e.ListBox},{gtype:`GtkListBoxRow`,tag:`gtk-list-box-row`,ctor:()=>e.ListBoxRow},{gtype:`GtkListHeader`,tag:`gtk-list-header`,ctor:()=>e.ListHeader},{gtype:`GtkListItem`,tag:`gtk-list-item`,ctor:()=>e.ListItem},{gtype:`GtkListView`,tag:`gtk-list-view`,ctor:()=>e.ListView},{gtype:`GtkLockButton`,tag:`gtk-lock-button`,ctor:()=>e.LockButton},{gtype:`GtkMediaControls`,tag:`gtk-media-controls`,ctor:()=>e.MediaControls},{gtype:`GtkMenuButton`,tag:`gtk-menu-button`,ctor:()=>e.MenuButton},{gtype:`GtkMessageDialog`,tag:`gtk-message-dialog`,ctor:()=>e.MessageDialog},{gtype:`GtkNotebook`,tag:`gtk-notebook`,ctor:()=>e.Notebook},{gtype:`GtkOverlay`,tag:`gtk-overlay`,ctor:()=>e.Overlay},{gtype:`GtkPageSetupUnixDialog`,tag:`gtk-page-setup-unix-dialog`,ctor:()=>e.PageSetupUnixDialog},{gtype:`GtkPaned`,tag:`gtk-paned`,ctor:()=>e.Paned},{gtype:`GtkPasswordEntry`,tag:`gtk-password-entry`,ctor:()=>e.PasswordEntry},{gtype:`GtkPicture`,tag:`gtk-picture`,ctor:()=>e.Picture},{gtype:`GtkPopover`,tag:`gtk-popover`,ctor:()=>e.Popover},{gtype:`GtkPopoverBin`,tag:`gtk-popover-bin`,ctor:()=>e.PopoverBin},{gtype:`GtkPopoverMenu`,tag:`gtk-popover-menu`,ctor:()=>e.PopoverMenu},{gtype:`GtkPopoverMenuBar`,tag:`gtk-popover-menu-bar`,ctor:()=>e.PopoverMenuBar},{gtype:`GtkPrintUnixDialog`,tag:`gtk-print-unix-dialog`,ctor:()=>e.PrintUnixDialog},{gtype:`GtkProgressBar`,tag:`gtk-progress-bar`,ctor:()=>e.ProgressBar},{gtype:`GtkRange`,tag:`gtk-range`,ctor:()=>e.Range},{gtype:`GtkRevealer`,tag:`gtk-revealer`,ctor:()=>e.Revealer},{gtype:`GtkScale`,tag:`gtk-scale`,ctor:()=>e.Scale},{gtype:`GtkScaleButton`,tag:`gtk-scale-button`,ctor:()=>e.ScaleButton},{gtype:`GtkScrollbar`,tag:`gtk-scrollbar`,ctor:()=>e.Scrollbar},{gtype:`GtkScrolledWindow`,tag:`gtk-scrolled-window`,ctor:()=>e.ScrolledWindow},{gtype:`GtkSearchBar`,tag:`gtk-search-bar`,ctor:()=>e.SearchBar},{gtype:`GtkSearchEntry`,tag:`gtk-search-entry`,ctor:()=>e.SearchEntry},{gtype:`GtkSeparator`,tag:`gtk-separator`,ctor:()=>e.Separator},{gtype:`GtkShortcutLabel`,tag:`gtk-shortcut-label`,ctor:()=>e.ShortcutLabel},{gtype:`GtkShortcutsGroup`,tag:`gtk-shortcuts-group`,ctor:()=>e.ShortcutsGroup},{gtype:`GtkShortcutsSection`,tag:`gtk-shortcuts-section`,ctor:()=>e.ShortcutsSection},{gtype:`GtkShortcutsShortcut`,tag:`gtk-shortcuts-shortcut`,ctor:()=>e.ShortcutsShortcut},{gtype:`GtkShortcutsWindow`,tag:`gtk-shortcuts-window`,ctor:()=>e.ShortcutsWindow},{gtype:`GtkSpinButton`,tag:`gtk-spin-button`,ctor:()=>e.SpinButton},{gtype:`GtkSpinner`,tag:`gtk-spinner`,ctor:()=>e.Spinner},{gtype:`GtkStack`,tag:`gtk-stack`,ctor:()=>e.Stack},{gtype:`GtkStackSidebar`,tag:`gtk-stack-sidebar`,ctor:()=>e.StackSidebar},{gtype:`GtkStackSwitcher`,tag:`gtk-stack-switcher`,ctor:()=>e.StackSwitcher},{gtype:`GtkStatusbar`,tag:`gtk-statusbar`,ctor:()=>e.Statusbar},{gtype:`GtkSwitch`,tag:`gtk-switch`,ctor:()=>e.Switch},{gtype:`GtkText`,tag:`gtk-text`,ctor:()=>e.Text},{gtype:`GtkTextView`,tag:`gtk-text-view`,ctor:()=>e.TextView},{gtype:`GtkToggleButton`,tag:`gtk-toggle-button`,ctor:()=>e.ToggleButton},{gtype:`GtkTreeExpander`,tag:`gtk-tree-expander`,ctor:()=>e.TreeExpander},{gtype:`GtkTreeView`,tag:`gtk-tree-view`,ctor:()=>e.TreeView},{gtype:`GtkVideo`,tag:`gtk-video`,ctor:()=>e.Video},{gtype:`GtkViewport`,tag:`gtk-viewport`,ctor:()=>e.Viewport},{gtype:`GtkVolumeButton`,tag:`gtk-volume-button`,ctor:()=>e.VolumeButton},{gtype:`GtkWindow`,tag:`gtk-window`,ctor:()=>e.Window},{gtype:`GtkWindowControls`,tag:`gtk-window-controls`,ctor:()=>e.WindowControls},{gtype:`GtkWindowHandle`,tag:`gtk-window-handle`,ctor:()=>e.WindowHandle}];export{n as GENERATED_PROVENANCE,r as GENERATED_WIDGETS};
package/lib/esm/host.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{addressOf as t,insertChild as n,makeDetachedContainer as r,makeWrapper as i,removeChild as a,setterSlotOf as o,setterSlots as s,slotOccupant as c}from"./policies.js";import{beginHostWrite as l,clearHandlers as u,endHostWrite as d,isEventProp as f,setHandler as p,toSignalName as m}from"./signals.js";import{coerce as h,paramSpecs as g,removedValue as _,requireSpec as v,toPropertyName as y}from"./props.js";import{lookupWidget as b,nearestRegistered as x}from"./registry.js";import S from"gi://GObject";function createElement(e,t){let n={kind:`element`,descriptor:b(e),widget:null,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!1,destroyed:!1,foreign:[]};if(t)for(let[e,r]of Object.entries(t))setProp(n,e,r);return n}const createText=e=>({kind:`text`,data:e,parent:null,prev:null,next:null}),createAnchor=(e=``)=>({kind:`anchor`,data:e,parent:null,prev:null,next:null}),isText=e=>e.kind===`text`;function materialize(t){if(t.widget)return t.widget;for(let n of t.descriptor.requiresProps??[])if(!(n in t.props))throw e.missingConstructProp(t.descriptor.gtype,n);let n=t.descriptor.ctor(),r=g(n,t.descriptor.gtype),i={};for(let[e,n]of Object.entries(t.props))i[e]=h(v(r,t.descriptor.gtype,e),n,t.descriptor.gtype);l();try{t.widget=new n(i)}finally{d()}try{replayInto(t)}catch(e){u(t);for(let e of childSnapshot(t))e.kind===`element`&&e.attached&&(a(t,e),e.attached=!1);throw t.widget=null,t.wrapper=null,e}return t.widget}function replayInto(e){for(let[t,n]of e.listeners)p(e,t,n);for(let t of siblingsFrom(e.first,e))t.kind===`element`&&attach(e,t);e.textFromChildren&&flushText(e)}function setProp(e,t,n,r){if(f(t))return setEventHandler(e,t,n);if(t===`slot`)return setSlot(e,n);if(t===`layout`){let t=n,r=e.parent;if(!r||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,r,()=>{e.layout=t},()=>{e.layout=i});return}let i=y(t),a=v(g(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,i),o=n==null,s=o?_(e.descriptor,a):h(a,n,e.descriptor.gtype),c=i in e.props?e.props[i]:void 0;if(o?delete e.props[i]:e.props[i]=n,e.widget){if((a.flags&S.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,i,c);l();try{e.widget.set_property(i,s)}finally{d()}}}function setEventHandler(e,t,n){e.widget?p(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(t,n){let r=m(n,t.descriptor.eventAliases).split(`::`)[0],i=t.descriptor.ctor().$gtype;if(S.signal_lookup(r,i)===0)throw e.unknownSignal(t.descriptor.gtype,n,r)}function setSlot(e,t){if(e.slot===t)return;let n=e.parent;if(!n||!e.widget){e.slot=t;return}let r=e.slot;replaceAt(e,n,()=>{e.slot=t},()=>{e.slot=r})}function replaceAt(e,t,n,r){a(t,e),e.attached=!1,n();try{attach(t,e)}catch(n){r();try{attach(t,e)}catch{}throw n}}function rebuild(e,t,n){let r=e.parent;if(e.widget){u(e);for(let t of childSnapshot(e))t.kind===`element`&&(a(e,t),t.attached=!1);r&&a(r,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(i){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),r&&attach(r,e)}catch{}throw i}r&&attach(r,e)}function setText(e,t){e.data=t,e.kind===`text`&&e.parent&&flushText(e.parent)}function setElementText(e,t){writeTextSink(e,t),e.textFromChildren=!1,destroyChildren(e)}function flushText(e){let t=``,n=!1;for(let r of childNodes(e))r.kind===`text`&&(t+=r.data,n=!0);if(t===``&&!e.textFromChildren)return;let r=e.descriptor.textSink;if(t===``&&r&&holdsElementInSetterSlot(e)){e.textFromChildren=!1,delete e.props[r];return}writeTextSink(e,t),e.textFromChildren=n}function*setterSlotChildren(e){for(let t of siblingsFrom(e.first,e))t.kind===`element`&&t.attached&&o(e,t)&&(yield t)}const holdsElementInSetterSlot=e=>!setterSlotChildren(e).next().done;function writeTextSink(t,n){let r=t.descriptor.textSink;if(!r)throw e.textNotAccepted(t.descriptor.gtype,n);materialize(t);let i=t.descriptor.children,a=i.kind===`single`?i.set:null;if(a&&!holdsOursInSlot(t,null)&&appOccupant(t.widget,t.descriptor,a))throw e.occupiedSlot(t.descriptor.gtype,`text`,a);let o=v(g(t.descriptor.ctor(),t.descriptor.gtype),t.descriptor.gtype,r);l();try{t.widget.set_property(r,h(o,n,t.descriptor.gtype))}finally{d()}t.props[r]=n;for(let e of setterSlotChildren(t))e.attached=!1}function*childNodes(e){yield*siblingsFrom(e.first,e)}function childSnapshot(e){let t=[];for(let n of siblingsFrom(e.first,e))t.push(n);return t}function*siblingsFrom(t,n){let r=0;for(let i=t;i;i=i.next){if(++r>1e5)throw e.siblingCycle(n.descriptor.gtype);yield i}}function link(e,t,n){t.parent=e,n?(t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:e.first=t,n.prev=t):(t.prev=e.last,t.next=null,e.last?e.last.next=t:e.first=t,e.last=t)}function unlink(e){let t=e.parent;t&&(e.prev?e.prev.next=e.next:t.first=e.next,e.next?e.next.prev=e.prev:t.last=e.prev,e.prev=null,e.next=null,e.parent=null)}function attach(e,r){if(!e.widget)return;materialize(r),ensureWrapper(e,r),refuseOccupiedSlot(e,r);let i=e.foreign.length>0?e.foreign.filter(t=>t.get_parent()===e.widget):e.foreign,a=i.length>0?i[i.length-1]:null,o=i.length;for(let n of siblingsFrom(e.first,e)){if(n===r)break;n.kind!==`element`||!n.attached||(a=t(n),o+=1)}let s=[];for(let t of siblingsFrom(r.next,e))t.kind===`element`&&t.attached&&s.push(t);n({parent:e,child:r,prevWidget:a,index:o,following:s}),r.attached=!0}function refuseOccupiedSlot(t,n){let r=o(t,n);if(r&&!holdsOursInSlot(t,n.slot)&&appOccupant(t.widget,t.descriptor,r))throw e.occupiedSlot(t.descriptor.gtype,n.descriptor.gtype,r)}function holdsOursInSlot(e,t){for(let n of siblingsFrom(e.first,e))if(n.kind===`element`&&n.attached&&n.slot===t)return!0;return!1}function ensureWrapper(e,t){if(t.wrapper)return;let n=i(e.descriptor.children,t.widget);n&&(t.wrapper=n)}function insert(e,t,n=null){assertHostParent(t);let r=e.parent,i=e.next,a=n===e?i:n;e.parent&&remove(e),link(t,e,a);try{e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch(t){throw unlink(e),r&&restore(e,r,i),t}}function assertHostParent(t){if(!isHostElement(t))throw e.notAHostParent(describeValue(t))}function isHostElement(e){let t=e;return!!t&&t.kind===`element`&&typeof t.descriptor==`object`}function describeValue(e){if(e==null)return String(e);if(typeof e!=`object`)return`a ${typeof e}`;let t=e.tagName;if(typeof t==`string`)return`a DOM element <${t.toLowerCase()}>`;let n=e.constructor?.$gtype,r=n?S.type_name(n)??`an unnamed GType`:null;if(r!==null&&r!==`JSObject`)return r;let i=e.constructor?.name;return i&&i!==`Object`?`a ${i}`:`a plain object`}function restore(e,t,n){try{link(t,e,n),e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch{unlink(e)}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(a(t,e),e.attached=!1,e.wrapper&&=(e.wrapper.set_child(null),null)),unlink(e),t&&e.kind===`text`&&flushText(t)}function destroyChildren(e){for(let t of childSnapshot(e))destroy(t)}function disconnectHandlers(e){u(e),e.listeners.clear()}function destroy(e){if(e.kind===`element`&&(destroyChildren(e),u(e),e.listeners.clear()),remove(e),e.kind===`element`){let t=e.widget;t&&typeof t.destroy==`function`&&typeof t.get_parent==`function`&&t.get_parent()===null&&t.destroy(),e.widget=null,e.wrapper=null,e.props={},e.layout=null,e.textFromChildren=!1,e.destroyed=!0}}function mountRoot(e,t){materialize(e),insert(e,adopt(t))}function widgetOf(t){if(t.kind!==`element`)throw e.notAnElement(t.kind);if(t.destroyed)throw e.destroyedNode(t.descriptor.gtype);return materialize(t)}const createDetachedContainer=()=>adopt(r());function adopt(t){let n=t.constructor.$gtype,r=x(n);if(!r)throw e.unknownTag(gtypeNameOf(t));return{kind:`element`,descriptor:r,widget:t,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!0,destroyed:!1,foreign:adoptedChildren(t,r)}}function adoptedChildren(e,t){let n=s(t.children);if(n.length===0)return directChildren(e);let r=[];for(let i of n){let n=appOccupant(e,t,i);n&&r.push(n)}return r}function appOccupant(e,t,n){let r=c(e,n);if(!r)return null;let i=t.textSink;if(!i)return r;let a=e[i.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())];return typeof a==`string`&&a!==``?null:r}function directChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtypeNameOf=e=>S.type_name(e.constructor.$gtype),parentNode=e=>e.parent,firstChild=e=>e.first,nextSibling=e=>e.next,prevSibling=e=>e.prev;export{adopt,createAnchor,createDetachedContainer,createElement,createText,describeValue,destroy,destroyChildren,disconnectHandlers,firstChild,insert,isHostElement,isText,materialize,mountRoot,nextSibling,parentNode,prevSibling,remove,setElementText,setEventHandler,setProp,setSlot,setText,widgetOf};
1
+ import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{addressOf as n,insertChild as r,makeDetachedContainer as i,makeWrapper as a,removeChild as o,setterSlotOf as s,setterSlots as c,slotOccupant as l}from"./policies.js";import{beginHostWrite as u,clearHandlers as d,endHostWrite as f,isEventProp as p,setHandler as m,toSignalName as h}from"./signals.js";import{coerce as g,paramSpecs as _,removedValue as v,requireSpec as y,toPropertyName as b}from"./props.js";import{lookupWidget as x,nearestRegistered as S}from"./registry.js";import C from"gi://GObject";function createElement(e,t){let n={kind:`element`,descriptor:x(e),widget:null,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!1,destroyed:!1,foreign:[]};if(t)for(let[e,r]of Object.entries(t))setProp(n,e,r);return n}const createText=e=>({kind:`text`,data:e,parent:null,prev:null,next:null}),createAnchor=(e=``)=>({kind:`anchor`,data:e,parent:null,prev:null,next:null}),isText=e=>e.kind===`text`;function materialize(e){if(e.widget)return e.widget;for(let n of e.descriptor.requiresProps??[])if(!(n in e.props))throw t.missingConstructProp(e.descriptor.gtype,n);let n=e.descriptor.ctor(),r=_(n,e.descriptor.gtype),i={};for(let[t,n]of Object.entries(e.props))i[t]=g(y(r,e.descriptor.gtype,t),n,e.descriptor.gtype);u(null);try{e.widget=new n(i)}finally{f()}try{replayInto(e)}catch(t){d(e);for(let t of childSnapshot(e))t.kind===`element`&&t.attached&&(o(e,t),t.attached=!1);throw e.widget=null,e.wrapper=null,t}return e.widget}function replayInto(e){for(let[t,n]of e.listeners)m(e,t,n);for(let t of siblingsFrom(e.first,e))t.kind===`element`&&attach(e,t);e.textFromChildren&&flushText(e)}function setProp(e,t,n,r){if(p(t))return setEventHandler(e,t,n);if(t===`slot`)return setSlot(e,n);if(t===`layout`){let t=n,r=e.parent;if(!r||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,r,()=>{e.layout=t},()=>{e.layout=i});return}let i=b(t),a=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,i),o=n==null,s=o?v(e.descriptor,a):g(a,n,e.descriptor.gtype),c=i in e.props?e.props[i]:void 0;if(o?delete e.props[i]:e.props[i]=n,e.widget){if((a.flags&C.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,i,c);u(e.widget);try{writeProperty(e.widget,i,s)}finally{f()}}}function writeProperty(e,t,n){if(!Array.isArray(n)){e.set_property(t,n);return}let r=t.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());e[r]=n}function setEventHandler(e,t,n){e.widget?m(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(e,n){let r=h(n,e.descriptor.eventAliases).split(`::`)[0],i=e.descriptor.ctor().$gtype;if(C.signal_lookup(r,i)===0)throw t.unknownSignal(e.descriptor.gtype,n,r)}function setSlot(e,t){if(e.slot===t)return;let n=e.parent;if(!n||!e.widget){e.slot=t;return}let r=e.slot;replaceAt(e,n,()=>{e.slot=t},()=>{e.slot=r})}function replaceAt(e,t,n,r){o(t,e),e.attached=!1,n();try{attach(t,e)}catch(n){r();try{attach(t,e)}catch{}throw n}}function rebuild(e,t,n){let r=e.parent;if(e.widget){d(e);for(let t of childSnapshot(e))t.kind===`element`&&(o(e,t),t.attached=!1);r&&o(r,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(i){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),r&&attach(r,e)}catch{}throw i}r&&attach(r,e)}function setText(e,t){e.data=t,e.kind===`text`&&e.parent&&flushText(e.parent)}function setElementText(e,t){writeTextSink(e,t),e.textFromChildren=!1,destroyChildren(e)}function flushText(e){let t=``,n=!1;for(let r of childNodes(e))r.kind===`text`&&(t+=r.data,n=!0);if(t===``&&!e.textFromChildren)return;let r=e.descriptor.textSink;if(t===``&&r&&holdsElementInSetterSlot(e)){e.textFromChildren=!1,delete e.props[r];return}writeTextSink(e,t),e.textFromChildren=n}function*setterSlotChildren(e){for(let t of siblingsFrom(e.first,e))t.kind===`element`&&t.attached&&s(e,t)&&(yield t)}const holdsElementInSetterSlot=e=>!setterSlotChildren(e).next().done;function writeTextSink(e,n){let r=e.descriptor.textSink;if(!r)throw t.textNotAccepted(e.descriptor.gtype,n);materialize(e);let i=e.descriptor.children,a=i.kind===`single`?i.set:null;if(a&&!holdsOursInSlot(e,null)&&appOccupant(e.widget,e.descriptor,a))throw t.occupiedSlot(e.descriptor.gtype,`text`,a);let o=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,r);u(e.widget);try{e.widget.set_property(r,g(o,n,e.descriptor.gtype))}finally{f()}e.props[r]=n;for(let t of setterSlotChildren(e))t.attached=!1}function*childNodes(e){yield*siblingsFrom(e.first,e)}function childSnapshot(e){let t=[];for(let n of siblingsFrom(e.first,e))t.push(n);return t}function*siblingsFrom(e,n){let r=0;for(let i=e;i;i=i.next){if(++r>1e5)throw t.siblingCycle(n.descriptor.gtype);yield i}}function link(e,t,n){t.parent=e,n?(t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:e.first=t,n.prev=t):(t.prev=e.last,t.next=null,e.last?e.last.next=t:e.first=t,e.last=t)}function unlink(e){let t=e.parent;t&&(e.prev?e.prev.next=e.next:t.first=e.next,e.next?e.next.prev=e.prev:t.last=e.prev,e.prev=null,e.next=null,e.parent=null)}function attach(e,t){if(!e.widget)return;materialize(t),ensureWrapper(e,t),refuseOccupiedSlot(e,t);let i=e.foreign.length>0?e.foreign.filter(t=>t.get_parent()===e.widget):e.foreign,a=i.length>0?i[i.length-1]:null,o=i.length;for(let r of siblingsFrom(e.first,e)){if(r===t)break;r.kind!==`element`||!r.attached||(a=n(r),o+=1)}let s=[];for(let n of siblingsFrom(t.next,e))n.kind===`element`&&n.attached&&s.push(n);r({parent:e,child:t,prevWidget:a,index:o,following:s}),t.attached=!0}function refuseOccupiedSlot(e,n){let r=s(e,n);if(r&&!holdsOursInSlot(e,n.slot)&&appOccupant(e.widget,e.descriptor,r))throw t.occupiedSlot(e.descriptor.gtype,n.descriptor.gtype,r)}function holdsOursInSlot(e,t){for(let n of siblingsFrom(e.first,e))if(n.kind===`element`&&n.attached&&n.slot===t)return!0;return!1}function ensureWrapper(n,r){if(r.wrapper)return;let i;try{i=a(n.descriptor.children,r.widget)}catch(i){throw i instanceof e?i:t.rejectedChild(n.descriptor.gtype,r.descriptor.gtype,i.message)}i&&(r.wrapper=i)}function insert(e,t,n=null){assertHostParent(t);let r=e.parent,i=e.next,a=n===e?i:n;e.parent&&remove(e),link(t,e,a);try{e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch(t){throw unlink(e),r&&restore(e,r,i),t}}function assertHostParent(e){if(!isHostElement(e))throw t.notAHostParent(describeValue(e))}function isHostElement(e){let t=e;return!!t&&t.kind===`element`&&typeof t.descriptor==`object`}function describeValue(e){if(e==null)return String(e);if(typeof e!=`object`)return`a ${typeof e}`;let t=e.tagName;if(typeof t==`string`)return`a DOM element <${t.toLowerCase()}>`;let n=e.constructor?.$gtype,r=n?C.type_name(n)??`an unnamed GType`:null;if(r!==null&&r!==`JSObject`)return r;let i=e.constructor?.name;return i&&i!==`Object`?`a ${i}`:`a plain object`}function restore(e,t,n){try{link(t,e,n),e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch{unlink(e)}}function restoreTextSink(e){let t=e.descriptor.textSink;if(!t||e.destroyed||!e.widget)return;let n=e.descriptor.children;if(n.kind!==`single`||holdsOursInSlot(e,null)||l(e.widget,n.set))return;let r=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),i=e.props[t]??e.props[r];if(typeof i!=`string`||i===``)return;let a=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,t);u(e.widget);try{e.widget.set_property(t,g(a,i,e.descriptor.gtype))}finally{f()}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(o(t,e),e.attached=!1,e.wrapper&&=(e.wrapper.set_child(null),null),restoreTextSink(t)),unlink(e),t&&e.kind===`text`&&flushText(t)}function destroyChildren(e){for(let t of childSnapshot(e))destroy(t)}function disconnectHandlers(e){d(e),e.listeners.clear()}function destroy(e){if(e.kind===`element`&&(destroyChildren(e),d(e),e.listeners.clear()),remove(e),e.kind===`element`){let t=e.widget;t&&typeof t.destroy==`function`&&typeof t.get_parent==`function`&&t.get_parent()===null&&t.destroy(),e.widget=null,e.wrapper=null,e.props={},e.layout=null,e.textFromChildren=!1,e.destroyed=!0}}function mountRoot(e,t){materialize(e),insert(e,adopt(t))}function widgetOf(e){if(e.kind!==`element`)throw t.notAnElement(e.kind);if(e.destroyed)throw t.destroyedNode(e.descriptor.gtype);return materialize(e)}const createDetachedContainer=()=>adopt(i());function adopt(e){let n=e.constructor.$gtype,r=S(n);if(!r)throw t.unknownTag(gtypeNameOf(e));return{kind:`element`,descriptor:r,widget:e,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!0,destroyed:!1,foreign:adoptedChildren(e,r)}}function adoptedChildren(e,t){let n=c(t.children);if(n.length===0)return directChildren(e);let r=[];for(let i of n){let n=appOccupant(e,t,i);n&&r.push(n)}return r}function appOccupant(e,t,n){let r=l(e,n);if(!r)return null;let i=t.textSink;if(!i)return r;let a=e[i.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())];return typeof a==`string`&&a!==``?null:r}function directChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtypeNameOf=e=>C.type_name(e.constructor.$gtype),parentNode=e=>e.parent,firstChild=e=>e.first,nextSibling=e=>e.next,prevSibling=e=>e.prev;export{adopt,createAnchor,createDetachedContainer,createElement,createText,describeValue,destroy,destroyChildren,disconnectHandlers,firstChild,insert,isHostElement,isText,materialize,mountRoot,nextSibling,parentNode,prevSibling,remove,setElementText,setEventHandler,setProp,setSlot,setText,widgetOf};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{GtkHostError as e}from"./errors.js";import{addressOf as t,reorderMode as n}from"./policies.js";import{isEventProp as r,toSignalName as i}from"./signals.js";import{constructOnlyNames as a,isConstructOnly as o,isWritable as s,lookupEnumNick as c,paramSpecs as l,toPropertyName as u}from"./props.js";import{assertInjective as d,tagOf as f}from"./tags.js";import{clearRegistry as p,hasWidget as m,lookupWidget as h,nearestRegistered as g,registerWidget as _,registerWidgets as v,registeredTags as y}from"./registry.js";import{adopt as b,createAnchor as x,createDetachedContainer as S,createElement as C,createText as w,destroy as T,destroyChildren as E,disconnectHandlers as D,firstChild as O,insert as k,isHostElement as A,isText as j,materialize as M,mountRoot as N,nextSibling as P,parentNode as F,prevSibling as I,remove as L,setElementText as R,setEventHandler as z,setProp as B,setSlot as V,setText as H,widgetOf as U}from"./host.js";import{GENERATED_PROVENANCE as W,GENERATED_WIDGETS as G}from"./generated/widgets.js";import{ADW_DESCRIPTORS as K}from"./descriptors/adw.js";import{GTK_DESCRIPTORS as q}from"./descriptors/gtk.js";import{BUILTIN_DESCRIPTORS as J,CURATED_DESCRIPTORS as Y,mergeGenerated as X,registerBuiltinWidgets as Z,tableProvenance as Q}from"./descriptors/index.js";import"./types.js";import{probeEnabled as $,runHostProbe as ee,runHostProbeApp as te}from"./probe.js";export{K as ADW_DESCRIPTORS,J as BUILTIN_DESCRIPTORS,Y as CURATED_DESCRIPTORS,W as GENERATED_PROVENANCE,G as GENERATED_WIDGETS,q as GTK_DESCRIPTORS,e as GtkHostError,t as addressOf,b as adopt,d as assertInjective,p as clearRegistry,a as constructOnlyNames,x as createAnchor,S as createDetachedContainer,C as createElement,w as createText,T as destroy,E as destroyChildren,D as disconnectHandlers,O as firstChild,m as hasWidget,k as insert,o as isConstructOnly,r as isEventProp,A as isHostElement,j as isText,s as isWritable,c as lookupEnumNick,h as lookupWidget,M as materialize,X as mergeGenerated,N as mountRoot,g as nearestRegistered,P as nextSibling,l as paramSpecs,F as parentNode,I as prevSibling,$ as probeEnabled,Z as registerBuiltinWidgets,_ as registerWidget,v as registerWidgets,y as registeredTags,L as remove,n as reorderMode,ee as runHostProbe,te as runHostProbeApp,R as setElementText,z as setEventHandler,B as setProp,V as setSlot,H as setText,Q as tableProvenance,f as tagOf,u as toPropertyName,i as toSignalName,U as widgetOf};
1
+ import{GtkHostError as e}from"./errors.js";import{addressOf as t,reorderMode as n}from"./policies.js";import{isEventProp as r,toSignalName as i}from"./signals.js";import{constructOnlyNames as a,isConstructOnly as o,isWritable as s,lookupEnumNick as c,paramSpecs as l,toPropertyName as u}from"./props.js";import{assertInjective as d,tagOf as f}from"./tags.js";import{clearRegistry as p,hasWidget as m,lookupWidget as h,nearestRegistered as g,registerWidget as _,registerWidgets as v,registeredTags as y}from"./registry.js";import{adopt as b,createAnchor as x,createDetachedContainer as S,createElement as C,createText as w,destroy as T,destroyChildren as E,disconnectHandlers as D,firstChild as O,insert as k,isHostElement as A,isText as j,materialize as M,mountRoot as N,nextSibling as P,parentNode as F,prevSibling as I,remove as L,setElementText as R,setEventHandler as z,setProp as B,setSlot as V,setText as H,widgetOf as U}from"./host.js";import{GENERATED_PROVENANCE as W,GENERATED_WIDGETS as G}from"./generated/widgets.js";import{ADW_DESCRIPTORS as K}from"./descriptors/adw.js";import{GTK_DESCRIPTORS as q}from"./descriptors/gtk.js";import{BUILTIN_DESCRIPTORS as J,CURATED_DESCRIPTORS as Y,mergeGenerated as X,registerBuiltinWidgets as Z,tableProvenance as Q}from"./descriptors/index.js";import"./types.js";import{blankReason as $,checkRendered as ee,probeEnabled as te,runHostProbe as ne,runHostProbeApp as re,shotEvidence as ie}from"./probe.js";export{K as ADW_DESCRIPTORS,J as BUILTIN_DESCRIPTORS,Y as CURATED_DESCRIPTORS,W as GENERATED_PROVENANCE,G as GENERATED_WIDGETS,q as GTK_DESCRIPTORS,e as GtkHostError,t as addressOf,b as adopt,d as assertInjective,$ as blankReason,ee as checkRendered,p as clearRegistry,a as constructOnlyNames,x as createAnchor,S as createDetachedContainer,C as createElement,w as createText,T as destroy,E as destroyChildren,D as disconnectHandlers,O as firstChild,m as hasWidget,k as insert,o as isConstructOnly,r as isEventProp,A as isHostElement,j as isText,s as isWritable,c as lookupEnumNick,h as lookupWidget,M as materialize,X as mergeGenerated,N as mountRoot,g as nearestRegistered,P as nextSibling,l as paramSpecs,F as parentNode,I as prevSibling,te as probeEnabled,Z as registerBuiltinWidgets,_ as registerWidget,v as registerWidgets,y as registeredTags,L as remove,n as reorderMode,ne as runHostProbe,re as runHostProbeApp,R as setElementText,z as setEventHandler,B as setProp,V as setSlot,H as setText,ie as shotEvidence,Q as tableProvenance,f as tagOf,u as toPropertyName,i as toSignalName,U as widgetOf};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://GObject";import t from"gi://Gtk?version=4.0";import n from"gi://Gio";const r=e.registerClass({GTypeName:`GjsifyGtkHostListRow`},class ListRowCarrier extends e.Object{constructor(...e){super(...e),this.row=null}});var ListController=class{#e=n.ListStore.new(r.$gtype);#t=new t.SignalListItemFactory;#n=[];#r=new Map;#i;#a=null;#o=[];#s=!1;constructor(e){this.#i=e,this.#n.push(this.#t.connect(`setup`,(e,t)=>this.#c(t)),this.#t.connect(`bind`,(e,t)=>this.#l(t)),this.#t.connect(`unbind`,(e,t)=>this.#u(t)),this.#t.connect(`teardown`,(e,t)=>this.#d(t)))}attach(e){this.#a=e,e.set_factory(this.#t),e.set_model(t.NoSelection.new(this.#e))}setRows(e){if(this.#s)return;let t=e.map(e=>e.key),n=t.length===this.#o.length&&t.every((e,t)=>e===this.#o[t]);if(this.#o=t,n){for(let t=0;t<e.length;t++){let n=this.#e.get_item(t);n!==null&&(n.row=e[t])}for(let e of this.#r.keys())this.#l(e);return}let i=e.map(e=>{let t=new r;return t.row=e,t});this.#e.splice(0,this.#e.get_n_items(),i)}get liveRows(){return this.#r.size}dispose(){if(this.#s)return;this.#s=!0;for(let e of this.#n)this.#t.disconnect(e);this.#n.length=0,this.#a!==null&&(this.#a.set_factory(null),this.#a.set_model(null),this.#a=null),this.#e.remove_all();let e=[...this.#r.values()];this.#r.clear();for(let t of e)this.#i.disposeRow(t)}#c(e){this.#r.set(e,this.#i.mountRow(e))}#l(e){let t=this.#r.get(e);if(t===void 0)return;let n=e.get_item();this.#i.showRow(t,n?.row??null,e.get_position())}#u(e){let t=this.#r.get(e);t!==void 0&&this.#i.showRow(t,null,e.get_position())}#d(e){let t=this.#r.get(e);t!==void 0&&(this.#r.delete(e),this.#i.disposeRow(t))}};export{ListController};
@@ -0,0 +1 @@
1
+ import{ListController as e}from"./controller.js";import{onScrollNearEnd as t}from"./scroll.js";export{e as ListController,t as onScrollNearEnd};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";function onScrollNearEnd(e,t,n,r){let i=t===`horizontal`?e.get_hadjustment():e.get_vadjustment(),a=!0,check=()=>{let e=i.get_page_size(),t=i.get_upper();if(t<=e){a=!0;return}let o=t-e-i.get_value();if(o>n*e){a=!0;return}a&&(a=!1,r(o))},o=[i.connect(`notify::value`,check),i.connect(`notify::upper`,check),i.connect(`notify::page-size`,check)];return check(),()=>{for(let e of o)i.disconnect(e)}}export{onScrollNearEnd};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import n from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t){if(e.kind!==`indexed`||!e.wrap)return null;if(e.wrap===`list-box-row`){if(t instanceof n.ListBoxRow)return null;let e=new n.ListBoxRow;return e.set_child(t),e}if(t instanceof n.FlowBoxChild)return null;let r=new n.FlowBoxChild;return r.set_child(t),r}const makeDetachedContainer=()=>new n.Box;function unhandledPolicy(e){throw Error(`unhandled child policy: ${JSON.stringify(e)}`)}function setterSlotOf(e,t){let n=e.descriptor.children;if(n.kind===`single`)return n.set;if(n.kind!==`slotted`)return null;let r=n.slots[t.slot??n.defaultSlot];return r?.startsWith(`set_`)===!0?r:null}function setterSlots(e){return e.kind===`single`?[e.set]:e.kind===`slotted`?Object.values(e.slots).filter(e=>e.startsWith(`set_`)):[]}function slotOccupant(e,t){let n=e,r=t.replace(/^set_/,`get_`);if(typeof n[r]==`function`)return n[r]()??null}function insertChild(n){try{placeChild(n)}catch(r){throw r instanceof e?r:t.rejectedChild(n.parent.descriptor.gtype,n.child.descriptor.gtype,r.message)}}function placeChild(e){let{parent:n,child:r}=e,i=n.descriptor.children,a=n.widget,o=addressOf(r);switch(i.kind){case`none`:throw t.unclaimedChild(n.descriptor.gtype,r.descriptor.gtype);case`uncurated`:throw t.uncuratedPlacement(n.descriptor.gtype,r.descriptor.gtype);case`single`:a[i.set](o);return;case`indexed`:a[i.insert](o,e.index);return;case`coords`:appendChild(n,r,a);return;case`ordered`:if(i.after){a[i.after](o,e.prevWidget??null);return}case`slotted`:case`keyed`:appendChild(n,r,a),rotateTail(n,r,e.following,a);return;default:return unhandledPolicy(i)}}function appendChild(e,n,r){let i=e.descriptor.children,a=addressOf(n);switch(i.kind){case`uncurated`:throw t.uncuratedPlacement(e.descriptor.gtype,n.descriptor.gtype);case`ordered`:r[i.append](a);return;case`slotted`:{let o=n.slot??i.defaultSlot,s=i.slots[o];if(!s)throw t.unknownSlot(e.descriptor.gtype,o,Object.keys(i.slots));r[s](a);return}case`keyed`:{let e=n.layout?.[i.nameFrom]??n.slot,t=n.layout?.title;i.titled?r[i.add](a,e??null,t??e??``):r[i.add](a);return}case`coords`:{let e=n.layout??{};r[i.attach](a,e.column??0,e.row??0,e.columnSpan??1,e.rowSpan??1);return}default:throw t.unclaimedChild(e.descriptor.gtype,n.descriptor.gtype)}}function rotateTail(e,t,n,r){let i=e.descriptor.children,a=n;if(i.kind===`slotted`){if(setterSlotOf(e,t))return;let slotOf=e=>e.slot??i.defaultSlot,r=slotOf(t);a=n.filter(e=>slotOf(e)===r)}for(let t of a)detachChild(e,t,r);for(let t of a)appendChild(e,t,r)}function detachChild(e,t,n){let r=e.descriptor.children,i=t.wrapper??t.widget;if(i)switch(r.kind){case`none`:case`uncurated`:return;case`single`:clearIfCurrent(n,r.set,i);return;case`slotted`:{let a=setterSlotOf(e,t);if(a){clearIfCurrent(n,a,i);return}n[r.remove](i);return}case`ordered`:case`indexed`:case`keyed`:case`coords`:n[r.remove](i);return;default:return unhandledPolicy(r)}}function clearIfCurrent(e,t,n){let r=slotOccupant(e,t);(r===void 0||r===n)&&e[t](null)}function removeChild(e,t){let n=e.widget;n&&t.attached&&detachChild(e,t,n)}function reorderMode(e){switch(e.kind){case`uncurated`:return`n/a`;case`ordered`:return e.reorder;case`indexed`:return`native`;case`slotted`:case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`;default:return unhandledPolicy(e)}}export{addressOf,insertChild,makeDetachedContainer,makeWrapper,removeChild,reorderMode,setterSlotOf,setterSlots,slotOccupant,unhandledPolicy};
1
+ import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import n from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t){if(e.kind!==`indexed`||!e.wrap)return null;if(e.wrap===`list-box-row`){if(t instanceof n.ListBoxRow)return null;let e=new n.ListBoxRow;return e.set_child(t),e}if(t instanceof n.FlowBoxChild)return null;let r=new n.FlowBoxChild;return r.set_child(t),r}const makeDetachedContainer=()=>new n.Box;function unhandledPolicy(e){throw Error(`unhandled child policy: ${JSON.stringify(e)}`)}function setterSlotOf(e,t){let n=e.descriptor.children;if(n.kind===`single`)return n.set;if(n.kind!==`slotted`)return null;let r=n.slots[t.slot??n.defaultSlot];return r?.startsWith(`set_`)===!0?r:null}function adderSlots(e){return e.kind===`slotted`?Object.entries(e.slots).filter(([,e])=>!e.startsWith(`set_`)).map(([e])=>e):[]}function setterSlots(e){return e.kind===`single`?[e.set]:e.kind===`slotted`?Object.values(e.slots).filter(e=>e.startsWith(`set_`)):[]}function slotOccupant(e,t){let n=e,r=t.replace(/^set_/,`get_`);if(typeof n[r]==`function`)return n[r]()??null}function insertChild(n){try{placeChild(n)}catch(r){throw r instanceof e?r:t.rejectedChild(n.parent.descriptor.gtype,n.child.descriptor.gtype,r.message)}}function placeChild(e){let{parent:n,child:r}=e,i=n.descriptor.children,a=n.widget,o=addressOf(r);switch(i.kind){case`none`:throw t.unclaimedChild(n.descriptor.gtype,r.descriptor.gtype);case`uncurated`:throw t.uncuratedPlacement(n.descriptor.gtype,r.descriptor.gtype);case`single`:a[i.set](o);return;case`indexed`:a[i.insert](o,e.index);return;case`coords`:appendChild(n,r,a);return;case`ordered`:if(i.after){a[i.after](o,e.prevWidget??null);return}case`slotted`:case`keyed`:appendChild(n,r,a),rotateTail(n,r,e.following,a);return;default:return unhandledPolicy(i)}}function appendChild(e,n,r){let i=e.descriptor.children,a=addressOf(n);switch(i.kind){case`uncurated`:throw t.uncuratedPlacement(e.descriptor.gtype,n.descriptor.gtype);case`ordered`:r[i.append](a);return;case`slotted`:{let o=n.slot??i.defaultSlot,s=i.slots[o];if(!s)throw t.unknownSlot(e.descriptor.gtype,o,Object.keys(i.slots));r[s](a);return}case`keyed`:{let e=n.layout?.[i.nameFrom]??n.slot,t=n.layout?.title;i.titled?r[i.add](a,e??null,t??e??``):r[i.add](a);return}case`coords`:{let e=n.layout??{};r[i.attach](a,e.column??0,e.row??0,e.columnSpan??1,e.rowSpan??1);return}default:throw t.unclaimedChild(e.descriptor.gtype,n.descriptor.gtype)}}function rotateTail(e,t,n,r){let i=e.descriptor.children,a=n;if(i.kind===`slotted`){if(setterSlotOf(e,t))return;let slotOf=e=>e.slot??i.defaultSlot,r=slotOf(t);a=n.filter(e=>slotOf(e)===r)}for(let t of a)detachChild(e,t,r);for(let t of a)appendChild(e,t,r)}function detachChild(e,n,r){let i=e.descriptor.children,a=n.wrapper??n.widget;if(a)switch(i.kind){case`none`:case`uncurated`:return;case`single`:clearIfCurrent(r,i.set,a);return;case`slotted`:{let o=setterSlotOf(e,n);if(o){clearIfCurrent(r,o,a);return}let s=n.slot??i.defaultSlot;if(!i.remove)throw t.slotNeedsRemove(e.descriptor.gtype,s,i.slots[s]??`?`);r[i.remove](a);return}case`ordered`:case`indexed`:case`keyed`:case`coords`:r[i.remove](a);return;default:return unhandledPolicy(i)}}function clearIfCurrent(e,t,n){let r=slotOccupant(e,t);(r===void 0||r===n)&&e[t](null)}function removeChild(e,t){let n=e.widget;n&&t.attached&&detachChild(e,t,n)}function reorderMode(e){switch(e.kind){case`uncurated`:return`n/a`;case`ordered`:return e.reorder;case`indexed`:return`native`;case`slotted`:return adderSlots(e).length>0?`remove-all`:`n/a`;case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`;default:return unhandledPolicy(e)}}export{adderSlots,addressOf,insertChild,makeDetachedContainer,makeWrapper,removeChild,reorderMode,setterSlotOf,setterSlots,slotOccupant,unhandledPolicy};
package/lib/esm/probe.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{installDiagnosticsGate as e}from"./conformance/diagnostics.js";import t from"gi://Gtk?version=4.0";import n from"gi://Adw?version=1";import r from"gi://GLib";import i from"system";function probeEnabled(){let e=r.getenv(`GJSIFY_HOST_PROBE`);if(e===null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const a=`<gtk-host probe: recorder self-check>`;function recorderIsHonest(e,t){let n=t.length;e(a,!1);let r=t.length===n+1&&t[n]===a;t.length=n,e(a,!0);let i=t.length===n;return t.length=n,r&&i?null:r?`the probe recorder records a PASSING check as a failure, so every assertion below is a false alarm`:`the probe recorder did not record a failed check, so every assertion below is unverifiable`}function runHostProbe(t,n=null){let r=t.label??`PROBE`,i=e();i.reset();let a=[],check=(e,t)=>{t||a.push(e)},o=recorderIsHonest(check,a);o!==null&&a.push(o);let s={};try{s=t.assert(t.build(n),check)}catch(e){a.push(`threw: ${e.message}`)}let c=i.seen.length;check(`no GTK diagnostics (saw ${c})`,c===0);let l=JSON.stringify({...a.length>0?{failures:a}:{},diagnostics:c,...s});return print(`${r}: ${a.length>0?`FAIL`:`PASS`} ${l}`),+(a.length>0)}async function runHostProbeApp(e){if(probeEnabled())return t.init(),i.exit(runHostProbe(e,null));let r=new n.Application({application_id:e.applicationId});r.connect(`activate`,()=>{let t=runHostProbe(e,r);t!==0&&i.exit(t),e.present(e.build(r))}),await r.runAsync([])}export{probeEnabled,runHostProbe,runHostProbeApp};
1
+ import"./_virtual/_rolldown/runtime.js";import{installDiagnosticsGate as e}from"./conformance/diagnostics.js";import{descendants as t}from"./conformance/index.js";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://GLib";import a from"system";function probeEnabled(){let e=i.getenv(`GJSIFY_HOST_PROBE`);if(e===null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const o=`<gtk-host probe: recorder self-check>`;function recorderIsHonest(e,t){let n=t.length;e(o,!1);let r=t.length===n+1&&t[n]===o;t.length=n,e(o,!0);let i=t.length===n;return t.length=n,r&&i?null:r?`the probe recorder records a PASSING check as a failure, so every assertion below is a false alarm`:`the probe recorder did not record a failed check, so every assertion below is unverifiable`}async function runHostProbe(t){let n=t.label??`PROBE`,r=e();r.reset();let i=[],check=(e,t)=>{t||i.push(e)},a=recorderIsHonest(check,i);a!==null&&i.push(a);let o={};try{let e=t.build(null);o=await t.assert(e,check),t.teardown?.(e)}catch(e){i.push(`threw: ${e.message}`)}let s=r.seen.length;check(`no GTK diagnostics (saw ${s})`,s===0);let c=JSON.stringify({...i.length>0?{failures:i}:{},diagnostics:s,...o});return print(`${n}: ${i.length>0?`FAIL`:`PASS`} ${c}`),+(i.length>0)}async function runHostProbeApp(e){if(probeEnabled())return n.init(),a.exit(await runHostProbe(e));let t=new r.Application({application_id:e.applicationId});t.connect(`activate`,()=>{t.hold(),(async()=>{try{let n=await runHostProbe(e);if(n!==0)return a.exit(n);e.present(e.build(t))}catch(t){return printerr(`JS ERROR: ${e.applicationId} probe threw: ${String(t)}`),a.exit(1)}finally{t.release()}})()}),await t.runAsync([])}function shotEvidence(e,n){let r=n(e);return{widgets:t(e).length-1,width:e.get_width(),height:e.get_height(),bytes:r?r.length:0}}function blankReason(e){return e.widgets===0?`nothing was rendered into the container: it has no children at all, which is what a refused render, an unmounted root and a component returning null all look like from GTK`:e.width<=0||e.height<=0?`the container is allocated ${e.width}×${e.height}: its ${e.widgets} widget(s) exist and occupy nothing`:e.bytes===0?`the capture produced no PNG: the widget has no renderer yet, so it was measured before it was ever on screen`:null}function checkRendered(e,t,n){let r=blankReason(n);e(r===null?t:`${t} — ${r}`,r===null)}export{blankReason,checkRendered,probeEnabled,runHostProbe,runHostProbeApp,shotEvidence};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";const t=/(?:Once|Passive|Capture)$/;function parseEventProp(n,r){if(r?.[n])return{signal:r[n],once:!1};if(n.startsWith(`on:`))return{signal:n.slice(3),once:!1};let i=n.slice(2),a=!1;for(let r=t.exec(i);r;r=t.exec(i)){let t=r[0];if(t!==`Once`)throw e.eventModifier(n,t.toLowerCase());a=!0,i=i.slice(0,i.length-t.length)}return i===`Notify`?{signal:`notify`,once:a}:i.startsWith(`Notify`)?{signal:`notify::${kebab(i.slice(6))}`,once:a}:{signal:kebab(i),once:a}}const toSignalName=(e,t)=>parseEventProp(e,t).signal,kebab=e=>e.replace(/^./,e=>e.toLowerCase()).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function isEventProp(e){return e.startsWith(`on:`)||e.length>2&&e.startsWith(`on`)&&e[2]===e[2].toUpperCase()&&e[2]!==e[2].toLowerCase()}let n=0;const beginHostWrite=()=>{n+=1},endHostWrite=()=>{--n},inHostWrite=()=>n>0;function setHandler(t,n,r){let{signal:i,once:a}=parseEventProp(n,t.descriptor.eventAliases),o=t.handlers.get(i),s=t.widget;if(o&&o.prop!==n&&r)throw e.signalTaken(t.descriptor.gtype,n,o.prop,i);if(o&&(s.disconnect(o.id),t.handlers.delete(i)),!r)return;let c=i.startsWith(`notify::`),l=s.connect(i,(...e)=>{if(!(c&&inHostWrite()))return a&&t.handlers.get(i)?.id===l&&(s.disconnect(l),t.handlers.delete(i)),r(...e.slice(1))});t.handlers.set(i,{id:l,prop:n})}function clearHandlers(e){if(!e.widget){e.handlers.clear();return}let t=e.widget;for(let{id:n}of e.handlers.values())t.disconnect(n);e.handlers.clear()}export{beginHostWrite,clearHandlers,endHostWrite,inHostWrite,isEventProp,parseEventProp,setHandler,toSignalName};
1
+ import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";const t=/(?:Once|Passive|Capture)$/;function parseEventProp(n,r){if(r?.[n])return{signal:r[n],once:!1};if(n.startsWith(`on:`))return{signal:n.slice(3),once:!1};let i=n.slice(2),a=!1;for(let r=t.exec(i);r;r=t.exec(i)){let t=r[0];if(t!==`Once`)throw e.eventModifier(n,t.toLowerCase());a=!0,i=i.slice(0,i.length-t.length)}return i===`Notify`?{signal:`notify`,once:a}:i.startsWith(`Notify`)?{signal:`notify::${kebab(i.slice(6))}`,once:a}:{signal:kebab(i),once:a}}const toSignalName=(e,t)=>parseEventProp(e,t).signal,kebab=e=>e.replace(/^./,e=>e.toLowerCase()).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function isEventProp(e){return e.startsWith(`on:`)||e.length>2&&e.startsWith(`on`)&&e[2]===e[2].toUpperCase()&&e[2]!==e[2].toLowerCase()}const n=[],beginHostWrite=(e=null)=>{n.push(e)},endHostWrite=()=>{n.pop()},inHostWrite=()=>n.length>0,isHostWriteTarget=e=>n.includes(e);function setHandler(t,n,r){let{signal:i,once:a}=parseEventProp(n,t.descriptor.eventAliases),o=t.handlers.get(i),s=t.widget;if(o&&o.prop!==n&&r)throw e.signalTaken(t.descriptor.gtype,n,o.prop,i);if(o&&(s.disconnect(o.id),t.handlers.delete(i)),!r)return;let c=i===`notify`||i.startsWith(`notify::`),l=s.connect(i,(...e)=>{if(!(inHostWrite()&&(c||isHostWriteTarget(s))))return a&&t.handlers.get(i)?.id===l&&(s.disconnect(l),t.handlers.delete(i)),r(...e.slice(1))});t.handlers.set(i,{id:l,prop:n})}function clearHandlers(e){if(!e.widget){e.handlers.clear();return}let t=e.widget;for(let{id:n}of e.handlers.values())t.disconnect(n);e.handlers.clear()}export{beginHostWrite,clearHandlers,endHostWrite,inHostWrite,isEventProp,isHostWriteTarget,parseEventProp,setHandler,toSignalName};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";var UnknownUtilityError=class extends Error{constructor(e,t){super(`@gjsify/gtk-host/style: "${e}" — ${t}`),this.name=`UnknownUtilityError`,this.utility=e}};export{UnknownUtilityError};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=[[`background-color`,`rgb(255 0 0)`],[`color`,`#112233`],[`opacity`,`0.7`],[`border-radius`,`8px`],[`border-top-left-radius`,`8px`],[`border-top-right-radius`,`8px`],[`border-bottom-left-radius`,`8px`],[`border-bottom-right-radius`,`8px`],[`border-width`,`1px`],[`border-top-width`,`1px`],[`border-right-width`,`1px`],[`border-bottom-width`,`1px`],[`border-left-width`,`1px`],[`border-style`,`solid`],[`border-color`,`#abcdef`],[`border`,`1px solid #abcdef`],[`border-bottom`,`1px solid #abcdef`],[`box-shadow`,`0 1px 2px rgba(0,0,0,0.2)`],[`font-size`,`14px`],[`font-weight`,`700`],[`font-family`,`Cantarell`],[`font-style`,`italic`],[`letter-spacing`,`1px`],[`line-height`,`1.4`],[`text-decoration-line`,`underline`],[`text-transform`,`uppercase`],[`margin`,`8px`],[`margin-top`,`8px`],[`margin-right`,`8px`],[`margin-bottom`,`8px`],[`margin-left`,`8px`],[`padding`,`8px`],[`padding-top`,`8px`],[`padding-right`,`8px`],[`padding-bottom`,`8px`],[`padding-left`,`8px`],[`min-width`,`10px`],[`min-height`,`10px`],[`transform`,`scale(1.1)`],[`transition`,`all 100ms`],[`caret-color`,`#ff0000`],[`outline-style`,`solid`]],t=[[`text-align`,`center`],[`display`,`flex`],[`flex-direction`,`row`],[`gap`,`8px`],[`position`,`absolute`],[`width`,`100px`],[`height`,`100px`],[`justify-content`,`center`],[`align-items`,`center`],[`overflow`,`hidden`],[`z-index`,`1`],[`top`,`0`],[`right`,`0`],[`bottom`,`0`],[`left`,`0`],[`margin-start`,`8px`],[`margin-end`,`8px`],[`padding-start`,`8px`],[`padding-end`,`8px`]],n=new Set(e.map(([e])=>e));export{e as GTK_CSS_PROBES,n as GTK_CSS_PROPERTIES,t as NOT_GTK_CSS};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=[[`GtkWidget`,`margin-top`,`gint`],[`GtkWidget`,`margin-bottom`,`gint`],[`GtkWidget`,`margin-start`,`gint`],[`GtkWidget`,`margin-end`,`gint`],[`GtkWidget`,`halign`,`GtkAlign`],[`GtkWidget`,`valign`,`GtkAlign`],[`GtkWidget`,`hexpand`,`gboolean`],[`GtkWidget`,`vexpand`,`gboolean`],[`GtkWidget`,`width-request`,`gint`],[`GtkWidget`,`height-request`,`gint`],[`GtkWidget`,`overflow`,`GtkOverflow`],[`GtkWidget`,`visible`,`gboolean`],[`GtkBox`,`orientation`,`GtkOrientation`],[`GtkBox`,`spacing`,`gint`],[`GtkLabel`,`xalign`,`gfloat`],[`GtkLabel`,`justify`,`GtkJustification`]],t=[[`GtkWidget`,`margin-left`],[`GtkWidget`,`margin-right`],[`GtkWidget`,`padding`],[`GtkWidget`,`padding-top`],[`GtkBox`,`padding`],[`GtkBox`,`margin-left`],[`GtkWidget`,`gap`],[`GtkBox`,`gap`],[`GtkWidget`,`flex`],[`GtkWidget`,`orientation`],[`GtkWidget`,`spacing`],[`GtkLabel`,`orientation`],[`GtkLabel`,`spacing`],[`GtkCenterBox`,`spacing`],[`GtkFlowBox`,`spacing`],[`GtkWidget`,`xalign`],[`GtkBox`,`xalign`]],n=new Set(e.map(([,e])=>e));export{n as GTK_WIDGET_PROPERTIES,e as GTK_WIDGET_PROPERTY_PROBES,t as NOT_GTK_WIDGET_PROPERTIES};
@@ -0,0 +1 @@
1
+ import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROBES as t,GTK_CSS_PROPERTIES as n,NOT_GTK_CSS as r}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as i,GTK_WIDGET_PROPERTY_PROBES as a,NOT_GTK_WIDGET_PROPERTIES as o}from"./gtk-props.js";import{MINIMAL_TOKENS as s,lookupToken as c,requireToken as l}from"./tokens.js";import{PAINT_PROPERTIES as u,partitionPaint as d,resolvePaintUtility as f}from"./paint.js";import{LAYOUT_PROPERTIES as p,partitionLayout as m,resolveLayoutUtility as h}from"./layout.js";import{partition as g,resolveUtilities as _,resolveUtility as v}from"./resolve.js";import{StyleSheet as y,StyleSheetError as b,VARIANT_PSEUDO as x}from"./sheet.js";export{t as GTK_CSS_PROBES,n as GTK_CSS_PROPERTIES,i as GTK_WIDGET_PROPERTIES,a as GTK_WIDGET_PROPERTY_PROBES,p as LAYOUT_PROPERTIES,s as MINIMAL_TOKENS,r as NOT_GTK_CSS,o as NOT_GTK_WIDGET_PROPERTIES,u as PAINT_PROPERTIES,y as StyleSheet,b as StyleSheetError,e as UnknownUtilityError,x as VARIANT_PSEUDO,c as lookupToken,g as partition,m as partitionLayout,d as partitionPaint,l as requireToken,h as resolveLayoutUtility,f as resolvePaintUtility,_ as resolveUtilities,v as resolveUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as n}from"./gtk-props.js";import{requireToken as r}from"./tokens.js";const i="GTK expresses main-axis growth as the boolean `hexpand`/`vexpand`, so there is no growth factor, no shrink factor and no flex basis to carry. `flex-1` is the only spelling with a GTK meaning",a="GTK's box gives leftover main-axis space to the children that expand; it has no per-gap distribution mode, and `Gtk.CenterBox` has exactly three slots. Unlike `justify-between`, no child count makes this expressible, so it is refused here rather than deferred to the shadow tree",o="scrolling is a WIDGET on GTK, not an overflow mode: wrap the element in a `Gtk.ScrolledWindow` (React Native `ScrollView`). `Gtk.Overflow` has exactly VISIBLE and HIDDEN (measured)",s="GTK has no percentage size: a widget requests a MINIMUM in pixels (`width-request`) or expands to fill what it is given (`hexpand`). `w-full`/`h-full` are the only fractions with an exact GTK meaning",c={m:[`marginTop`,`marginRight`,`marginBottom`,`marginLeft`],mt:[`marginTop`],mr:[`marginRight`],mb:[`marginBottom`],ml:[`marginLeft`],mx:[`marginLeft`,`marginRight`],my:[`marginTop`,`marginBottom`],ms:[`marginStart`],me:[`marginEnd`]},l={p:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],pt:[`paddingTop`],pr:[`paddingRight`],pb:[`paddingBottom`],pl:[`paddingLeft`],px:[`paddingLeft`,`paddingRight`],py:[`paddingTop`,`paddingBottom`]},u={inset:[`top`,`right`,`bottom`,`left`],top:[`top`],right:[`right`],bottom:[`bottom`],left:[`left`]},d={start:`flex-start`,end:`flex-end`,center:`center`,stretch:`stretch`,baseline:`baseline`},f={start:`flex-start`,end:`flex-end`,center:`center`,between:`space-between`,around:`space-around`,evenly:`space-evenly`},fill=(e,t)=>{let n={};for(let r of e)n[r]=t;return n};function requireSize(t,n,r,i){let a=t[n],o=a?.[r]??t.spacing?.[r];if(o!==void 0)return o;let s=[...new Set([...Object.keys(a??{}),...Object.keys(t.spacing??{})])].sort().join(`, `);throw new e(i,`"${r}" is in neither the ${n} nor the spacing scale. Known: ${s===``?`(neither scale is configured)`:s}`)}function resolveLayoutUtility(t,n){switch(t){case`flex-1`:case`grow`:return{flexGrow:`1`};case`flex-row`:return{flexDirection:`row`};case`flex-col`:return{flexDirection:`column`};case`flex-nowrap`:return{};case`flex-wrap`:case`flex-wrap-reverse`:throw new e(t,"a `Gtk.Box` cannot wrap. Wrapping is a different widget — `Gtk.FlowBox` — and swapping the widget under an element is L2 widget selection, not a style property");case`flex-row-reverse`:case`flex-col-reverse`:throw new e(t,"`Gtk.Box` has no reversed orientation (`GtkOrientation` is HORIZONTAL and VERTICAL, measured). Reverse the children instead — the shadow tree is the order");case`absolute`:return{position:`absolute`};case`relative`:return{position:`relative`};case`hidden`:return{display:`none`};case`overflow-hidden`:return{overflow:`hidden`};case`overflow-visible`:return{overflow:`visible`};case`overflow-scroll`:case`overflow-auto`:throw new e(t,o);case`w-full`:return{width:`100%`};case`h-full`:return{height:`100%`}}let p=t.indexOf(`-`),m=p===-1?t:t.slice(0,p),h=p===-1?``:t.slice(p+1),g=c[m];if(g!==void 0)return fill(g,r(n.spacing,h,t,`spacing`));let _=l[m];if(_!==void 0)return fill(_,r(n.spacing,h,t,`spacing`));let v=u[m];if(v!==void 0)return fill(v,r(n.spacing,h,t,`spacing`));switch(m){case`ps`:case`pe`:throw new e(t,"GTK has no logical padding in either mechanism — `padding-start` is not a CSS property (measured) and no GTK class installs a padding property at all — so it cannot be expressed even approximately. Use `pl-*`/`pr-*`");case`flex`:case`grow`:case`shrink`:case`basis`:throw new e(t,i);case`items`:{let e=d[h];if(e===void 0)throw unknownToken(t,h,d);return{alignItems:e}}case`self`:{let n=h===`baseline`?void 0:d[h];if(n===void 0)throw h===`baseline`?new e(t,"a baseline is shared by a whole row, so GTK carries it on the BOX as `baseline-position` (measured on `Gtk.Box`, absent from `Gtk.Widget`) rather than per child. Use `items-baseline` on the parent"):unknownToken(t,h,d);return{alignSelf:n}}case`justify`:{if(h===`around`||h===`evenly`)throw new e(t,a);let n=f[h];if(n===void 0)throw unknownToken(t,h,f);return{justifyContent:n}}case`gap`:return h.startsWith(`x-`)?{columnGap:r(n.spacing,h.slice(2),t,`spacing`)}:h.startsWith(`y-`)?{rowGap:r(n.spacing,h.slice(2),t,`spacing`)}:{gap:r(n.spacing,h,t,`spacing`)};case`w`:case`h`:{if(h.includes(`/`))throw new e(t,s);let r=m===`w`?`width`:`height`;return{[r]:requireSize(n,r,h,t)}}case`text`:if(h===`left`||h===`center`||h===`right`||h===`justify`)return{textAlign:h};if(h===`start`||h===`end`)throw new e(t,"GTK aligns text PHYSICALLY: `Gtk.Label:xalign` is 0 = left, and `GtkJustification` has exactly LEFT, RIGHT, CENTER and FILL (measured). There is no start/end spelling to map onto. Use `text-left`/`text-right`");return null}return null}const unknownToken=(t,n,r)=>new e(t,`"${n}" is not a value of this family. Known: ${Object.keys(r).join(`, `)}`);function emitCss(n,r,i){if(!t.has(r))throw new e(r,`is not a property GTK accepts in a stylesheet — see gtk-css.ts`);n.css.push(`${r}: ${i}`)}function emitProp(t,r,i){if(!n.has(r))throw new e(r,`is not a property any GTK class installs — see gtk-props.ts`);t.props[r]=i}const p=/^(-?\d+(?:\.\d+)?)(?:px)?$/;function pixels(t,n){let r=p.exec(t.trim());if(r===null)throw new e(n,`"${t}" is not a pixel length. GTK's "${n}" is a gint of device pixels (measured, gtk-props.ts) with no unit conversion behind it, so only "12px" and "12" can be stored`);return Math.round(Number(r[1]))}function oneOf(t,n,r){if(n.includes(t))return t;throw new e(r,`"${t}" is not a value this partition routes. Known: ${n.join(`, `)}`)}const edgeRoute=t=>(n,r)=>{let i=r.intent.overlay;if(i===void 0||i.role!==`child`)throw new e(t,"only offsets an element that is absolutely positioned, and this one is not. GTK has no relative offset: add `absolute` (which makes the parent a `Gtk.Overlay`), or express the distance as a margin");i.edges[t]=pixels(n,t)},m={marginTop:(e,t)=>emitProp(t,`margin-top`,pixels(e,`margin-top`)),marginBottom:(e,t)=>emitProp(t,`margin-bottom`,pixels(e,`margin-bottom`)),marginStart:(e,t)=>emitProp(t,`margin-start`,pixels(e,`margin-start`)),marginEnd:(e,t)=>emitProp(t,`margin-end`,pixels(e,`margin-end`)),marginLeft:(e,t)=>emitCss(t,`margin-left`,e),marginRight:(e,t)=>emitCss(t,`margin-right`,e),paddingTop:(e,t)=>emitCss(t,`padding-top`,e),paddingRight:(e,t)=>emitCss(t,`padding-right`,e),paddingBottom:(e,t)=>emitCss(t,`padding-bottom`,e),paddingLeft:(e,t)=>emitCss(t,`padding-left`,e),flexDirection:(e,t)=>emitProp(t,`orientation`,oneOf(e,[`row`,`column`],`flexDirection`)===`row`?`horizontal`:`vertical`),flexGrow:(t,n)=>{if(t!==`1`)throw new e(`flexGrow`,i);n.intent.expand=`main-axis`},alignItems:(e,t)=>{t.intent.alignChildren=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignItems`)},justifyContent:(t,n)=>{if(t===`space-around`||t===`space-evenly`)throw new e(`justifyContent`,a);n.intent.distribute=oneOf(t,[`flex-start`,`flex-end`,`center`,`space-between`],`justifyContent`)},alignSelf:(e,t)=>{t.intent.alignSelf=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignSelf`)},gap:(e,t)=>emitProp(t,`spacing`,pixels(e,`spacing`)),columnGap:(e,t)=>{t.intent.axisSpacing={axis:`horizontal`,pixels:pixels(e,`spacing`)}},rowGap:(e,t)=>{t.intent.axisSpacing={axis:`vertical`,pixels:pixels(e,`spacing`)}},width:(e,t)=>e===`100%`?emitProp(t,`hexpand`,!0):emitProp(t,`width-request`,pixels(percentGuard(e,`width`),`width-request`)),height:(e,t)=>e===`100%`?emitProp(t,`vexpand`,!0):emitProp(t,`height-request`,pixels(percentGuard(e,`height`),`height-request`)),overflow:(t,n)=>{if(t===`scroll`)throw new e(`overflow`,o);emitProp(n,`overflow`,oneOf(t,[`visible`,`hidden`],`overflow`))},display:(e,t)=>emitProp(t,`visible`,oneOf(e,[`flex`,`none`],`display`)===`flex`),position:(e,t)=>{t.intent.overlay=oneOf(e,[`relative`,`absolute`],`position`)===`absolute`?{role:`child`,edges:{}}:{role:`context`}},top:edgeRoute(`top`),right:edgeRoute(`right`),bottom:edgeRoute(`bottom`),left:edgeRoute(`left`),textAlign:(e,t)=>{t.intent.textAlign=oneOf(e,[`left`,`center`,`right`,`justify`],`textAlign`)}},h=new Set(Object.keys(m));function percentGuard(t,n){if(t.endsWith(`%`))throw new e(n,s);return t}function partitionLayout(t){let n=t.marginLeft!==void 0||t.marginRight!==void 0,r=t.marginStart!==void 0||t.marginEnd!==void 0;if(n&&r)throw new e(`margin`,"a physical horizontal margin (`ml-*`/`mr-*`/`mx-*`/`m-*`) becomes GTK CSS and a logical one (`ms-*`/`me-*`) becomes the widget property; GTK applies BOTH and they ADD, where CSS would have let one win. Spell the horizontal margin one way");let i=[`gap`,`columnGap`,`rowGap`].filter(e=>t[e]!==void 0);if(i.length>1)throw new e(i.join(` + `),"a `Gtk.Box` has ONE `spacing` (measured), so two gap spellings on one element ask for two spacings. Keep one");let a={css:[],props:{},intent:{}};for(let e of Object.keys(m)){let n=t[e];n!==void 0&&m[e](n,a)}return a}export{h as LAYOUT_PROPERTIES,partitionLayout,resolveLayoutUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{lookupToken as n,requireToken as r}from"./tokens.js";const i={backgroundColor:`background-color`,color:`color`,opacity:`opacity`,borderRadius:`border-radius`,borderTopLeftRadius:`border-top-left-radius`,borderTopRightRadius:`border-top-right-radius`,borderBottomLeftRadius:`border-bottom-left-radius`,borderBottomRightRadius:`border-bottom-right-radius`,borderWidth:`border-width`,borderTopWidth:`border-top-width`,borderRightWidth:`border-right-width`,borderBottomWidth:`border-bottom-width`,borderLeftWidth:`border-left-width`,borderColor:`border-color`,fontSize:`font-size`,fontWeight:`font-weight`,fontFamily:`font-family`,fontStyle:`font-style`,letterSpacing:`letter-spacing`,lineHeight:`line-height`,textDecorationLine:`text-decoration-line`,textTransform:`text-transform`},withAlpha=(t,n)=>{let r=Number(n);if(!Number.isFinite(r)||r<0||r>100)throw new e(`${t}/${n}`,`the alpha modifier must be 0–100, got "${n}"`);return`alpha(${t}, ${r/100})`};function resolvePaintUtility(t,i){if(t.includes(`:`))throw new e(t,`strip the variant prefix before resolving; this resolves the utility itself`);let c=t.lastIndexOf(`/`),l=c===-1?void 0:t.slice(c+1),u=c===-1?t:t.slice(0,c),colour=e=>l===void 0?e:withAlpha(e,l),noAlpha=()=>{if(l!==void 0)throw new e(t,`an alpha modifier only applies to a colour utility`)};switch(u){case`underline`:return noAlpha(),{textDecorationLine:`underline`};case`line-through`:return noAlpha(),{textDecorationLine:`line-through`};case`no-underline`:return noAlpha(),{textDecorationLine:`none`};case`uppercase`:return noAlpha(),{textTransform:`uppercase`};case`lowercase`:return noAlpha(),{textTransform:`lowercase`};case`capitalize`:return noAlpha(),{textTransform:`capitalize`};case`normal-case`:return noAlpha(),{textTransform:`none`};case`italic`:return noAlpha(),{fontStyle:`italic`};case`not-italic`:return noAlpha(),{fontStyle:`normal`};case`rounded`:return noAlpha(),{borderRadius:r(i.borderRadius,`DEFAULT`,t,`borderRadius`)};case`border`:return noAlpha(),{borderWidth:r(i.borderWidth,`DEFAULT`,t,`borderWidth`)}}let d=u.indexOf(`-`),f=d===-1?u:u.slice(0,d),p=d===-1?``:u.slice(d+1);switch(f){case`bg`:return{backgroundColor:colour(r(i.colors,p,t,`colors`))};case`opacity`:return noAlpha(),{opacity:r(i.opacity,p,t,`opacity`)};case`rounded`:{noAlpha();let e=a[p];return e===void 0?{borderRadius:r(i.borderRadius,p,t,`borderRadius`)}:{[e]:r(i.borderRadius,`DEFAULT`,t,`borderRadius`)}}case`border`:{let a=o[p];if(a!==void 0)return noAlpha(),{[a]:r(i.borderWidth,`DEFAULT`,t,`borderWidth`)};let s=n(i.borderWidth,p),c=n(i.colors,p);if(s!==void 0&&c!==void 0)throw new e(t,`"${p}" is in both the borderWidth and colors scales, so this utility is ambiguous`);if(s!==void 0)return noAlpha(),{borderWidth:s};if(c!==void 0)return{borderColor:colour(c)};throw new e(t,`"${p}" is in neither the borderWidth nor the colors scale`)}case`text`:{if(s.has(p))return null;let r=n(i.fontSize,p),a=n(i.colors,p);if(r!==void 0&&a!==void 0)throw new e(t,`"${p}" is in both the fontSize and colors scales, so this utility is ambiguous`);if(r!==void 0)return noAlpha(),{fontSize:r};if(a!==void 0)return{color:colour(a)};throw new e(t,`"${p}" is in neither the fontSize nor the colors scale`)}case`font`:{noAlpha();let r=n(i.fontWeight,p),a=n(i.fontFamily,p);if(r!==void 0&&a!==void 0)throw new e(t,`"${p}" is in both the fontWeight and fontFamily scales, so this utility is ambiguous`);if(r!==void 0)return{fontWeight:r};if(a!==void 0)return{fontFamily:a};throw new e(t,`"${p}" is in neither the fontWeight nor the fontFamily scale`)}case`tracking`:return noAlpha(),{letterSpacing:r(i.letterSpacing,p,t,`letterSpacing`)};case`leading`:return noAlpha(),{lineHeight:r(i.lineHeight,p,t,`lineHeight`)}}return null}const a={tl:`borderTopLeftRadius`,tr:`borderTopRightRadius`,bl:`borderBottomLeftRadius`,br:`borderBottomRightRadius`},o={t:`borderTopWidth`,r:`borderRightWidth`,b:`borderBottomWidth`,l:`borderLeftWidth`},s=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),c=new Set(Object.keys(i));function partitionPaint(n){let r=[];for(let[a,o]of Object.entries(n)){if(o===void 0)continue;let n=i[a];if(n===void 0)throw new e(a,`is not a property the paint partition routes`);if(!t.has(n))throw new e(a,`maps to "${n}", which GTK does not accept — see gtk-css.ts`);r.push(`${n}: ${o}`)}let a=r.some(e=>/^border(-(top|right|bottom|left))?-width:/.test(e)),o=r.some(e=>/^border(-(top|right|bottom|left))?-style:/.test(e));return a&&!o&&r.push(`border-style: solid`),r}export{i as CSS_NAME,c as PAINT_PROPERTIES,partitionPaint,resolvePaintUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{PAINT_PROPERTIES as t,partitionPaint as n,resolvePaintUtility as r}from"./paint.js";import{LAYOUT_PROPERTIES as i,partitionLayout as a,resolveLayoutUtility as o}from"./layout.js";function resolveUtility(t,n){let i=r(t,n);if(i!==null)return i;let a=o(t,n);if(a!==null)return a;throw new e(t,`is not a utility this vocabulary declares`)}function resolveUtilities(e,t){let n={};for(let r of e)Object.assign(n,resolveUtility(r,t));return n}function partition(r){let o={},s={};for(let[n,a]of Object.entries(r)){if(a===void 0)continue;let r=t.has(n)?o:i.has(n)?s:null;if(r===null)throw new e(n,`is not a property the style partition routes`);r[n]=a}let c=a(s);return{css:[...n(o),...c.css],props:c.props,intent:c.intent}}export{partition,resolveUtilities,resolveUtility};
@@ -0,0 +1,3 @@
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Gdk?version=4.0";const n={active:`:active`,hover:`:hover`,focus:`:focus`,disabled:`:disabled`};var StyleSheetError=class extends Error{constructor(e){super(`@gjsify/gtk-host/style: ${e}`),this.name=`StyleSheetError`}};function hashName(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return`gjsify-s${t.toString(36)}`}const r=`gjsify-probe-8f3a91c4`,i=`.${r} { color: rgb(1 2 3); }`;var StyleSheet=class{#e=new e.CssProvider;#t=new Map;#n=!1;#r=!1;#i;constructor(e={}){this.#i=e}classFor(e,t={}){if(e.length===0&&Object.keys(t).length===0)throw new StyleSheetError(`classFor was given no declarations — an empty class would name nothing`);let r=e.join(`; `),i=[],a=hashName(`${r}|${Object.entries(t).map(([e,t])=>`${e}{${t.join(`; `)}}`).sort().join(``)}`);if(this.#t.get(a)!==void 0)return a;e.length>0&&i.push(`.${a} { ${r}; }`);for(let[e,r]of Object.entries(t)){let t=n[e];if(t===void 0)throw new StyleSheetError(`"${e}:" is not a variant this sheet can express. Known: ${Object.keys(n).sort().join(`, `)}. A variant becomes a GTK CSS pseudo-class, so one without a pseudo-class equivalent needs a different mechanism.`);r.length!==0&&i.push(`.${a}${t} { ${r.join(`; `)}; }`)}let o=i.join(`
2
+ `);return this.#o(o),this.#t.set(a,o),this.#a(),a}toString(){return[...this.#t.values()].join(`
3
+ `)}get size(){return this.#t.size}flush(){if(this.#r=!1,this.#e.load_from_string(this.toString()),this.#n)return;let n=this.#i.display??t.Display.get_default();if(n===null)throw new StyleSheetError(`there is no Gdk display to install the stylesheet on. Construct the sheet after Gtk.init(), or pass one explicitly.`);e.StyleContext.add_provider_for_display(n,this.#e,this.#i.priority??e.STYLE_PROVIDER_PRIORITY_APPLICATION),this.#n=!0}#a(){this.#r||(this.#r=!0,queueMicrotask(()=>{this.#r&&this.flush()}))}#o(t){let n=new e.CssProvider,a=[],o=n.connect(`parsing-error`,(e,t,n)=>{a.push(n.message)});if(n.load_from_string(`${t}\n${i}`),n.disconnect(o),!n.to_string().includes(r))throw new StyleSheetError(`a generated rule would disable every rule after it in the document, so it is refused:\n ${t}\n`+(a.length>0?` GTK said: ${a.join(`; `)}`:` GTK reported no error, which is why this is checked by containment rather than by the error signal.`));if(a.length>0)throw new StyleSheetError(`GTK refused a generated declaration:\n ${t}\n ${a.join(`; `)}`)}};export{StyleSheet,StyleSheetError,n as VARIANT_PSEUDO};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";const t={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,sm:`2px`,DEFAULT:`4px`,md:`6px`,lg:`8px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`},fontSize:{sm:`12px`,base:`14px`,lg:`18px`,xl:`24px`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},opacity:{0:`0`,50:`0.5`,60:`0.6`,70:`0.7`,80:`0.8`,90:`0.9`,100:`1`}},lookupToken=(e,t)=>e?.[t];function requireToken(t,n,r,i){let a=lookupToken(t,n);if(a!==void 0)return a;throw new e(r,`"${n}" is not in the ${i} scale. Known: ${t===void 0?`(the scale is not configured)`:Object.keys(t).sort().join(`, `)}`)}export{t as MINIMAL_TOKENS,lookupToken,requireToken};