@gjsify/gtk-host 0.44.0 → 0.46.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.
- package/README.md +50 -4
- package/lib/esm/adapters/solid.js +1 -1
- package/lib/esm/conformance/diagnostics.js +1 -1
- package/lib/esm/conformance/index.js +2 -2
- package/lib/esm/descriptors/adw.js +1 -1
- package/lib/esm/descriptors/gtk.js +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/generated/widgets.js +1 -1
- package/lib/esm/host.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/list/controller.js +1 -0
- package/lib/esm/list/index.js +1 -0
- package/lib/esm/list/scroll.js +1 -0
- package/lib/esm/policies.js +1 -1
- package/lib/esm/probe.js +1 -1
- package/lib/esm/props.js +1 -1
- package/lib/esm/registry.js +1 -1
- package/lib/esm/signals.js +1 -1
- package/lib/esm/style/document.js +1 -0
- package/lib/esm/style/gtk-props.js +1 -1
- package/lib/esm/style/index.js +1 -1
- package/lib/esm/style/layout.js +1 -1
- package/lib/esm/style/paint.js +1 -1
- package/lib/esm/style/sheet.js +3 -3
- package/lib/esm/style/theme.js +3 -0
- package/lib/esm/style/tokens.js +1 -1
- package/lib/types/adapters/solid.d.ts +35 -0
- package/lib/types/conformance/diagnostics.d.ts +1 -1
- package/lib/types/descriptors/index.d.ts +3 -3
- package/lib/types/errors.d.ts +10 -0
- package/lib/types/generated/props.d.ts +684 -816
- package/lib/types/generated/widgets.d.ts +1 -1
- package/lib/types/generator/emit-types.d.mts +2 -2
- package/lib/types/generator/emit.d.mts +16 -6
- package/lib/types/generator/girs-vocabulary.d.mts +45 -0
- package/lib/types/generator/main.d.mts +16 -8
- package/lib/types/generator/model.d.mts +95 -0
- package/lib/types/generator/names.d.mts +19 -0
- package/lib/types/generator/vocabulary-dts.d.mts +47 -0
- package/lib/types/host.d.ts +3 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/list/controller.d.ts +112 -0
- package/lib/types/list/index.d.ts +2 -0
- package/lib/types/list/list.spec.d.ts +2 -0
- package/lib/types/list/scroll.d.ts +26 -0
- package/lib/types/policies.d.ts +18 -1
- package/lib/types/probe.d.ts +49 -0
- package/lib/types/probe.spec.d.ts +2 -0
- package/lib/types/props.d.ts +13 -1
- package/lib/types/registry.d.ts +1 -1
- package/lib/types/signals.d.ts +3 -1
- package/lib/types/style/document.d.ts +22 -0
- package/lib/types/style/index.d.ts +6 -3
- package/lib/types/style/layout.d.ts +34 -0
- package/lib/types/style/sheet.d.ts +0 -5
- package/lib/types/style/theme.d.ts +158 -0
- package/lib/types/style/theme.spec.d.ts +2 -0
- package/lib/types/style/tokens.d.ts +76 -0
- package/lib/types/style/tokens.spec.d.ts +2 -0
- package/lib/types/types.d.ts +84 -4
- package/package.json +22 -16
- package/lib/types/generator/gir.d.mts +0 -164
- package/lib/types/generator/mini.fixture.d.mts +0 -30
- package/lib/types/generator/surface.d.mts +0 -62
- package/lib/types/generator/tsmap.d.mts +0 -73
package/README.md
CHANGED
|
@@ -117,6 +117,48 @@ attachment point, `layout={{ column, row, columnSpan, rowSpan }}` a `coords` cel
|
|
|
117
117
|
`layout={{ name, title }}` a `keyed` page. Both are read at placement time, so
|
|
118
118
|
changing either RE-PLACES the child rather than doing nothing.
|
|
119
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
|
+
|
|
120
162
|
## Lifetime
|
|
121
163
|
|
|
122
164
|
`remove` detaches and is reversible, because frameworks move nodes. The wrapper
|
|
@@ -486,10 +528,14 @@ contain, and a reader who concludes `@gjsify/gtk-host/testing` exists.
|
|
|
486
528
|
|
|
487
529
|
## The widget table, and the type surfaces
|
|
488
530
|
|
|
489
|
-
The table is **generated from the GIR** and committed
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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
|
|
493
539
|
`children: { kind: 'uncurated' }` — the widget can be created, given properties and
|
|
494
540
|
given handlers, while inserting a child raises an error naming the tag that needs a
|
|
495
541
|
policy. Guessing is not on offer: `add`, `append` and `set_child` all exist
|
|
@@ -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 _,
|
|
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";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(`
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://GLib?version=2.0";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
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{
|
|
2
|
-
`)}export{addressesOf,descendants,
|
|
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?version=2.0";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}if(!e)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}"`);for(let e of Object.keys(o.wrapSlots??{}))e in o.slots||i.push({gtype:t.gtype,problem:`wrapSlots names "${e}", which is not one of ${Object.keys(o.slots).join(`, `)}`});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`}},{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}}];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:`AdwExpanderRow`,ctor:()=>e.ExpanderRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`,row:`add_row`},defaultSlot:`row`,remove:`remove`,wrapSlots:{row:`list-box-row`}}},{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,hideBeforeRemove:!0}},{gtype:`AdwClamp`,ctor:()=>e.Clamp,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToastOverlay`,ctor:()=>e.ToastOverlay,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`}},{gtype:`AdwWrapBox`,ctor:()=>e.WrapBox,children:{kind:`ordered`,append:`append`,after:`insert_child_after`,remove:`remove`,reorder:`native`}}];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:`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:`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/4.23.3 Adw-1/1.10.0`,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:`GtkSvgWidget`,tag:`gtk-svg-widget`,ctor:()=>e.SvgWidget},{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
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{beginHostWrite as n,clearHandlers as r,endHostWrite as i,isEventProp as a,setHandler as o,toSignalName as s}from"./signals.js";import{addressOf as c,insertChild as l,makeDetachedContainer as u,makeWrapper as d,removeChild as f,setterSlotOf as p,setterSlots as m,slotOccupant as h}from"./policies.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?version=2.0";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 a=e.descriptor.ctor(),o=_(a,e.descriptor.gtype),s={};for(let[t,n]of Object.entries(e.props))s[t]=g(y(o,e.descriptor.gtype,t),n,e.descriptor.gtype);n(null);try{e.widget=new a(s)}finally{i()}try{replayInto(e)}catch(t){r(e);for(let t of childSnapshot(e))t.kind===`element`&&t.attached&&(f(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)o(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,r,o){if(a(t))return setEventHandler(e,t,r);if(t===`slot`)return setSlot(e,r);if(t===`layout`){let t=r,n=e.parent;if(!n||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,n,()=>{e.layout=t},()=>{e.layout=i});return}let s=b(t),c=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,s),l=r==null,u=l?v(e.descriptor,c):g(c,r,e.descriptor.gtype),d=s in e.props?e.props[s]:void 0;if(l?delete e.props[s]:e.props[s]=r,e.widget){if((c.flags&C.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,s,d);n(e.widget);try{writeProperty(e.widget,s,u)}finally{i()}}}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?o(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(e,n){let r=s(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){f(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 i=e.parent;if(e.widget){r(e);for(let t of childSnapshot(e))t.kind===`element`&&(f(e,t),t.attached=!1);i&&f(i,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(r){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),i&&attach(i,e)}catch{}throw r}i&&attach(i,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&&p(e,t)&&(yield t)}const holdsElementInSetterSlot=e=>!setterSlotChildren(e).next().done;function writeTextSink(e,r){let a=e.descriptor.textSink;if(!a)throw t.textNotAccepted(e.descriptor.gtype,r);materialize(e);let o=e.descriptor.children,s=o.kind===`single`?o.set:null;if(s&&!holdsOursInSlot(e,null)&&appOccupant(e.widget,e.descriptor,s))throw t.occupiedSlot(e.descriptor.gtype,`text`,s);let c=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,a);n(e.widget);try{e.widget.set_property(a,g(c,r,e.descriptor.gtype))}finally{i()}e.props[a]=r;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 n=e.foreign.length>0?e.foreign.filter(t=>t.get_parent()===e.widget):e.foreign,r=n.length>0?n[n.length-1]:null,i=n.length;for(let n of siblingsFrom(e.first,e)){if(n===t)break;n.kind!==`element`||!n.attached||(r=c(n),i+=1)}let a=[];for(let n of siblingsFrom(t.next,e))n.kind===`element`&&n.attached&&a.push(n);l({parent:e,child:t,prevWidget:r,index:i,following:a}),t.attached=!0}function refuseOccupiedSlot(e,n){let r=p(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=d(n.descriptor.children,r.widget,r.slot)}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 r=e.descriptor.children;if(r.kind!==`single`||holdsOursInSlot(e,null)||h(e.widget,r.set))return;let a=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),o=e.props[t]??e.props[a];if(typeof o!=`string`||o===``)return;let s=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,t);n(e.widget);try{e.widget.set_property(t,g(s,o,e.descriptor.gtype))}finally{i()}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(f(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){r(e),e.listeners.clear()}function destroy(e){if(e.kind===`element`&&(destroyChildren(e),r(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(u());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=m(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=h(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{
|
|
1
|
+
import{GtkHostError as e}from"./errors.js";import{isEventProp as t,toSignalName as n}from"./signals.js";import{addressOf as r,reorderMode as i}from"./policies.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,r 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,t 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,i 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,n as toSignalName,U as widgetOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://GObject?version=2.0";import t from"gi://Gtk?version=4.0";import n from"gi://Gio?version=2.0";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};
|
package/lib/esm/policies.js
CHANGED
|
@@ -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){
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{beginHostWrite as n,endHostWrite as r}from"./signals.js";import i 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,n){let r=e.kind===`indexed`?e.wrap:e.kind===`slotted`?e.wrapSlots?.[n??e.defaultSlot]??null:null;if(!r)return null;if(r===`list-box-row`){if(t instanceof i.ListBoxRow)return null;let e=new i.ListBoxRow;return e.set_child(t),e}if(t instanceof i.FlowBoxChild)return null;let a=new i.FlowBoxChild;return a.set_child(t),a}const makeDetachedContainer=()=>new i.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`keyed`:{let e=i.hideBeforeRemove===!0&&a.get_visible();e&&writeVisible(a,!1),r[i.remove](a),e&&writeVisible(a,!0);return}case`ordered`:case`indexed`:case`coords`:r[i.remove](a);return;default:return unhandledPolicy(i)}}function writeVisible(e,t){n(null);try{e.set_visible(t)}finally{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`: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
|
|
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?version=2.0";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};
|
package/lib/esm/props.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import t from"gi://GObject";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://Gdk?version=4.0";import a from"gi://Pango";const o=[[`Gtk`,n],[`Adw`,r],[`Gdk`,i],[`Pango`,a],[`G`,t]];function toPropertyName(e){return e.includes(`-`)?e:e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function withoutKeys(e,t){if(!e)return;let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n}const s=new Map;function paramSpecs(e,t){let n=s.get(t);if(n)return n;n=new Map;for(let t of e.list_properties())n.set(t.get_name(),t);return s.set(t,n),n}const isFlag=(e,t)=>(e&t)!==0,isWritable=e=>isFlag(e.flags,t.ParamFlags.WRITABLE),isConstructOnly=e=>isFlag(e.flags,t.ParamFlags.CONSTRUCT_ONLY);function constructOnlyNames(e,t){let n=[];for(let[r,i]of paramSpecs(e,t))isConstructOnly(i)&&isWritable(i)&&n.push(r);return n}function resolveEnumValue(e,t){for(let[n,r]of o){if(!e.startsWith(n))continue;let i=r[e.slice(n.length)];if(!i)continue;let a=i[t.toUpperCase().replace(/-/g,`_`)];return typeof a==`number`?{resolved:!0,value:a}:{resolved:!0}}return{resolved:!1}}const lookupEnumNick=(e,t)=>resolveEnumValue(e,t).value;function coerce(n,r,i){if(r==null)return r;let a=n.value_type;if(t.type_is_a(a,t.TYPE_ENUM)&&typeof r==`string`){let o=t.type_name(a),s=resolveEnumValue(o,r);if(s.value!==void 0)return s.value;throw s.resolved?e.badEnum(i,n.get_name(),r,o):e.unresolvableEnum(o)}if(t.type_is_a(a,t.TYPE_FLAGS)&&typeof r==`string`)throw e.badFlags(i,n.get_name(),r,t.type_name(a));if(t.type_is_a(a,t.TYPE_BOOLEAN)){if(typeof r==`boolean`)return r;if(r===`true`)return!0;if(r===`false`)return!1;if(typeof r==`string`)throw e.badBoolean(i,n.get_name(),r);return!!r}if(t.type_is_a(a,t.TYPE_STRING)){if(typeof r==`string`)return r;if(typeof r==`number`||typeof r==`boolean`)return String(r);throw e.badString(i,n.get_name(),typeof r)}return(t.type_is_a(a,t.TYPE_INT)||t.type_is_a(a,t.TYPE_UINT)||t.type_is_a(a,t.TYPE_INT64)||t.type_is_a(a,t.TYPE_UINT64))&&typeof r==`number`?Math.trunc(r):r}const c=[t.TYPE_BOOLEAN,t.TYPE_STRING,t.TYPE_INT,t.TYPE_UINT,t.TYPE_INT64,t.TYPE_UINT64,t.TYPE_DOUBLE,t.TYPE_FLOAT],isScalarSpec=e=>t.type_is_a(e.value_type,t.TYPE_ENUM)||c.some(n=>t.type_is_a(e.value_type,n)),toAccessorName=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),l=new Map;function constructedDefaults(e){let r=l.get(e.gtype);if(r)return r;let i=new Map;l.set(e.gtype,i);let a=e.ctor(),o;try{let t={};for(let n of e.requiresProps??[])t[n]=``;o=new a(t)}catch{return i}for(let[n,r]of paramSpecs(a,e.gtype)){if(!isWritable(r)||isConstructOnly(r)||!isFlag(r.flags,t.ParamFlags.READABLE)||isFlag(r.flags,t.ParamFlags.DEPRECATED)||!isScalarSpec(r))continue;let e=toAccessorName(n);e in o&&i.set(n,o[e])}return o instanceof n.Window&&o.destroy(),i}function removedValue(e,t){let n=constructedDefaults(e),r=t.get_name();return n.has(r)?n.get(r):t.get_default_value()}function requireSpec(t,n,r){let i=t.get(r);if(!i)throw e.unknownProp(n,r);if(!isWritable(i))throw e.readOnlyProp(n,r);return i}export{coerce,constructOnlyNames,isConstructOnly,isWritable,lookupEnumNick,paramSpecs,removedValue,requireSpec,toPropertyName,withoutKeys};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import t from"gi://GObject?version=2.0";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://Gdk?version=4.0";import a from"gi://Pango?version=1.0";const o=[[`Gtk`,n],[`Adw`,r],[`Gdk`,i],[`Pango`,a],[`G`,t]];function toPropertyName(e){return e.includes(`-`)?e:e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function withoutKeys(e,t){if(!e)return;let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n}const s=new Map;function paramSpecs(e,t){let n=s.get(t);if(n)return n;n=new Map;for(let t of e.list_properties())n.set(t.get_name(),t);return s.set(t,n),n}const isFlag=(e,t)=>(e&t)!==0,isWritable=e=>isFlag(e.flags,t.ParamFlags.WRITABLE),isConstructOnly=e=>isFlag(e.flags,t.ParamFlags.CONSTRUCT_ONLY);function constructOnlyNames(e,t){let n=[];for(let[r,i]of paramSpecs(e,t))isConstructOnly(i)&&isWritable(i)&&n.push(r);return n}function resolveEnumValue(e,t){for(let[n,r]of o){if(!e.startsWith(n))continue;let i=r[e.slice(n.length)];if(!i)continue;let a=i[t.toUpperCase().replace(/-/g,`_`)];return typeof a==`number`?{resolved:!0,value:a}:{resolved:!0}}return{resolved:!1}}const lookupEnumNick=(e,t)=>resolveEnumValue(e,t).value;function enumMembers(e){for(let[t,n]of o){if(!e.startsWith(t))continue;let r=n[e.slice(t.length)];if(r)return Object.keys(r).filter(e=>e!==`$gtype`&&typeof r[e]==`number`)}}function coerce(n,r,i){if(r==null)return r;let a=n.value_type;if(t.type_is_a(a,t.TYPE_ENUM)&&typeof r==`string`){let o=t.type_name(a),s=resolveEnumValue(o,r);if(s.value!==void 0)return s.value;throw s.resolved?e.badEnum(i,n.get_name(),r,o):e.unresolvableEnum(o)}if(t.type_is_a(a,t.TYPE_FLAGS)&&typeof r==`string`)throw e.badFlags(i,n.get_name(),r,t.type_name(a));if(t.type_is_a(a,t.TYPE_BOOLEAN)){if(typeof r==`boolean`)return r;if(r===`true`)return!0;if(r===`false`)return!1;if(typeof r==`string`)throw e.badBoolean(i,n.get_name(),r);return!!r}if(t.type_is_a(a,t.TYPE_STRING)){if(typeof r==`string`)return r;if(typeof r==`number`||typeof r==`boolean`)return String(r);throw e.badString(i,n.get_name(),typeof r)}return(t.type_is_a(a,t.TYPE_INT)||t.type_is_a(a,t.TYPE_UINT)||t.type_is_a(a,t.TYPE_INT64)||t.type_is_a(a,t.TYPE_UINT64))&&typeof r==`number`?Math.trunc(r):r}const c=[t.TYPE_BOOLEAN,t.TYPE_STRING,t.TYPE_INT,t.TYPE_UINT,t.TYPE_INT64,t.TYPE_UINT64,t.TYPE_DOUBLE,t.TYPE_FLOAT],isScalarSpec=e=>t.type_is_a(e.value_type,t.TYPE_ENUM)||c.some(n=>t.type_is_a(e.value_type,n)),toAccessorName=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),l=new Map;function constructedDefaults(e){let r=l.get(e.gtype);if(r)return r;let i=new Map;l.set(e.gtype,i);let a=e.ctor(),o;try{let t={};for(let n of e.requiresProps??[])t[n]=``;o=new a(t)}catch{return i}for(let[n,r]of paramSpecs(a,e.gtype)){if(!isWritable(r)||isConstructOnly(r)||!isFlag(r.flags,t.ParamFlags.READABLE)||isFlag(r.flags,t.ParamFlags.DEPRECATED)||!isScalarSpec(r))continue;let e=toAccessorName(n);e in o&&i.set(n,o[e])}return o instanceof n.Window&&o.destroy(),i}function removedValue(e,t){let n=constructedDefaults(e),r=t.get_name();return n.has(r)?n.get(r):t.get_default_value()}function requireSpec(t,n,r){let i=t.get(r);if(!i)throw e.unknownProp(n,r);if(!isWritable(i))throw e.readOnlyProp(n,r);return i}export{coerce,constructOnlyNames,enumMembers,isConstructOnly,isWritable,lookupEnumNick,paramSpecs,removedValue,requireSpec,toPropertyName,withoutKeys};
|
package/lib/esm/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{tagOf as t}from"./tags.js";import n from"gi://GObject";const r=new Map,i=new Map;function registerWidget(e){r.set(e.gtype,e);let n=t(e.gtype);n!==e.gtype&&i.set(n,e)}function registerWidgets(e){for(let t of e)registerWidget(t)}function lookupWidget(t){let n=r.get(t)??i.get(t);if(!n)throw e.unknownTag(t);return n}const hasWidget=e=>r.has(e)||i.has(e),registeredTags=()=>[...r.keys()].sort();function nearestRegistered(e){for(let t=e;t;t=n.type_parent(t)){let e=n.type_name(t);if(!e)break;let i=r.get(e);if(i)return i}}function clearRegistry(){r.clear(),i.clear()}export{clearRegistry,hasWidget,lookupWidget,nearestRegistered,registerWidget,registerWidgets,registeredTags};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{tagOf as t}from"./tags.js";import n from"gi://GObject?version=2.0";const r=new Map,i=new Map;function registerWidget(e){r.set(e.gtype,e);let n=t(e.gtype);n!==e.gtype&&i.set(n,e)}function registerWidgets(e){for(let t of e)registerWidget(t)}function lookupWidget(t){let n=r.get(t)??i.get(t);if(!n)throw e.unknownTag(t);return n}const hasWidget=e=>r.has(e)||i.has(e),registeredTags=()=>[...r.keys()].sort();function nearestRegistered(e){for(let t=e;t;t=n.type_parent(t)){let e=n.type_name(t);if(!e)break;let i=r.get(e);if(i)return i}}function clearRegistry(){r.clear(),i.clear()}export{clearRegistry,hasWidget,lookupWidget,nearestRegistered,registerWidget,registerWidgets,registeredTags};
|
package/lib/esm/signals.js
CHANGED
|
@@ -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()}
|
|
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";import e from"gi://Gtk?version=4.0";import t from"gi://Gdk?version=4.0";var StyleSheetError=class extends Error{constructor(e){super(`@gjsify/gtk-host/style: ${e}`),this.name=`StyleSheetError`}};const n=`gjsify-probe-8f3a91c4`,r=`.${n} { color: rgb(1 2 3); }`;function assertContained(t,i){let a=new e.CssProvider,o=[],s=a.connect(`parsing-error`,(e,t,n)=>{o.push(n.message)});if(a.load_from_string(`${t}\n${r}`),a.disconnect(s),!a.to_string().includes(n))throw new StyleSheetError(`${i} would disable every rule after it in the document, so it is refused:\n ${t}\n`+(o.length>0?` GTK said: ${o.join(`; `)}`:` GTK reported no error, which is why this is checked by containment rather than by the error signal.`));if(o.length>0)throw new StyleSheetError(`GTK refused a declaration in ${i}:\n ${t}\n ${o.join(`; `)}`)}function installProvider(n,r,i,a){let o=i??t.Display.get_default();if(o===null)throw new StyleSheetError(`there is no Gdk display to install ${r} on. Install it after Gtk.init(), or pass one explicitly.`);return e.StyleContext.add_provider_for_display(o,n,a),o}export{StyleSheetError,assertContained,installProvider};
|
|
@@ -1 +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};
|
|
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`],[`GtkFlowBox`,`row-spacing`,`guint`],[`GtkFlowBox`,`column-spacing`,`guint`],[`GtkFlowBox`,`max-children-per-line`,`guint`],[`GtkFlowBox`,`selection-mode`,`GtkSelectionMode`]],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};
|
package/lib/esm/style/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{StyleSheetError as e,assertContained as t}from"./document.js";import{UnknownUtilityError as n}from"./errors.js";import{GTK_CSS_PROBES as r,GTK_CSS_PROPERTIES as i,NOT_GTK_CSS as a}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as o,GTK_WIDGET_PROPERTY_PROBES as s,NOT_GTK_WIDGET_PROPERTIES as c}from"./gtk-props.js";import{MINIMAL_TOKENS as l,TAILWIND_DEFAULT_TOKENS as u,lookupToken as d,mergeTokens as f,requireToken as p,tailwindDefaultHint as m}from"./tokens.js";import{PAINT_PROPERTIES as h,partitionPaint as g,resolvePaintUtility as _}from"./paint.js";import{LAYOUT_PROPERTIES as v,partitionLayout as y,resolveLayoutUtility as b}from"./layout.js";import{partition as x,resolveUtilities as S,resolveUtility as C}from"./resolve.js";import{StyleSheet as w,VARIANT_PSEUDO as T}from"./sheet.js";import{ADWAITA_NAMED_COLORS as E,NEUTRAL_THEME as D,NOT_ADWAITA_NAMED_COLORS as O,THEME_PROVIDER_PRIORITY as k,ThemeRegistry as A}from"./theme.js";export{E as ADWAITA_NAMED_COLORS,r as GTK_CSS_PROBES,i as GTK_CSS_PROPERTIES,o as GTK_WIDGET_PROPERTIES,s as GTK_WIDGET_PROPERTY_PROBES,v as LAYOUT_PROPERTIES,l as MINIMAL_TOKENS,D as NEUTRAL_THEME,O as NOT_ADWAITA_NAMED_COLORS,a as NOT_GTK_CSS,c as NOT_GTK_WIDGET_PROPERTIES,h as PAINT_PROPERTIES,w as StyleSheet,e as StyleSheetError,u as TAILWIND_DEFAULT_TOKENS,k as THEME_PROVIDER_PRIORITY,A as ThemeRegistry,n as UnknownUtilityError,T as VARIANT_PSEUDO,t as assertContained,d as lookupToken,f as mergeTokens,x as partition,y as partitionLayout,g as partitionPaint,p as requireToken,b as resolveLayoutUtility,_ as resolvePaintUtility,S as resolveUtilities,C as resolveUtility,m as tailwindDefaultHint};
|
package/lib/esm/style/layout.js
CHANGED
|
@@ -1 +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};
|
|
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,tailwindDefaultHint as i}from"./tokens.js";const a="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",o="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",s="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)",c="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",l={m:[`marginTop`,`marginRight`,`marginBottom`,`marginLeft`],mt:[`marginTop`],mr:[`marginRight`],mb:[`marginBottom`],ml:[`marginLeft`],mx:[`marginLeft`,`marginRight`],my:[`marginTop`,`marginBottom`],ms:[`marginStart`],me:[`marginEnd`]},u={p:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],pt:[`paddingTop`],pr:[`paddingRight`],pb:[`paddingBottom`],pl:[`paddingLeft`],px:[`paddingLeft`,`paddingRight`],py:[`paddingTop`,`paddingBottom`]},d={inset:[`top`,`right`,`bottom`,`left`],top:[`top`],right:[`right`],bottom:[`bottom`],left:[`left`]},f={start:`flex-start`,end:`flex-end`,center:`center`,stretch:`stretch`,baseline:`baseline`},p={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,a){let o=t[n],s=o?.[r]??t.spacing?.[r];if(s!==void 0)return s;let c=[...new Set([...Object.keys(o??{}),...Object.keys(t.spacing??{})])].sort().join(`, `);throw new e(a,`"${r}" is in neither the ${n} nor the spacing scale. Known: ${c===``?`(neither scale is configured)`:c}`+(i(n,r)||i(`spacing`,r)))}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{flexWrap:`nowrap`};case`flex-wrap`:return{flexWrap:`wrap`};case`flex-wrap-reverse`:throw new e(t,"`Gtk.FlowBox` — the widget a wrap becomes — lays its lines out in one direction only: it installs `orientation`, `homogeneous`, `row-spacing`, `column-spacing`, `min-children-per-line`, `max-children-per-line` and `selection-mode`, and nothing that reverses the line order (measured). Reverse the children instead — the shadow tree is the order. `flex-wrap` is the spelling that maps");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,s);case`w-full`:return{width:`100%`};case`h-full`:return{height:`100%`}}let i=t.indexOf(`-`),m=i===-1?t:t.slice(0,i),h=i===-1?``:t.slice(i+1),g=l[m];if(g!==void 0)return fill(g,r(n.spacing,h,t,`spacing`));let _=u[m];if(_!==void 0)return fill(_,r(n.spacing,h,t,`spacing`));let v=d[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,a);case`items`:{let e=f[h];if(e===void 0)throw unknownToken(t,h,f);return{alignItems:e}}case`self`:{let n=h===`baseline`?void 0:f[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,f);return{alignSelf:n}}case`justify`:{if(h===`around`||h===`evenly`)throw new e(t,o);let n=p[h];if(n===void 0)throw unknownToken(t,h,p);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,c);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 m=/^(-?\d+(?:\.\d+)?)(?:px)?$/;function pixels(t,n){let r=m.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 multiLine=e=>e.intent.wrap?.lines===`multi`,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)},h={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`),flexWrap:(e,t)=>{t.intent.wrap=oneOf(e,[`nowrap`,`wrap`],`flexWrap`)===`wrap`?{lines:`multi`}:{lines:`single`}},flexGrow:(t,n)=>{if(t!==`1`)throw new e(`flexGrow`,a);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`,o);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)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={lines:`multi`,rowSpacing:n,columnSpacing:n}:emitProp(t,`spacing`,n)},columnGap:(e,t)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={...t.intent.wrap,lines:`multi`,columnSpacing:n}:t.intent.axisSpacing={axis:`horizontal`,pixels:n}},rowGap:(e,t)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={...t.intent.wrap,lines:`multi`,rowSpacing:n}:t.intent.axisSpacing={axis:`vertical`,pixels:n}},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`,s);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`)}},g=new Set(Object.keys(h));function percentGuard(t,n){if(t.endsWith(`%`))throw new e(n,c);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&&t.flexWrap!==`wrap`)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, or add `flex-wrap` — a `Gtk.FlowBox` has a row spacing and a column spacing and can carry both");let a={css:[],props:{},intent:{}};for(let e of Object.keys(h)){let n=t[e];n!==void 0&&h[e](n,a)}return a}export{g as LAYOUT_PROPERTIES,partitionLayout,resolveLayoutUtility};
|
package/lib/esm/style/paint.js
CHANGED
|
@@ -1 +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
|
|
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,tailwindDefaultHint as i}from"./tokens.js";const a={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,a){if(t.includes(`:`))throw new e(t,`strip the variant prefix before resolving; this resolves the utility itself`);let l=t.lastIndexOf(`/`),u=l===-1?void 0:t.slice(l+1),d=l===-1?t:t.slice(0,l),colour=e=>u===void 0?e:withAlpha(e,u),noAlpha=()=>{if(u!==void 0)throw new e(t,`an alpha modifier only applies to a colour utility`)};switch(d){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(a.borderRadius,`DEFAULT`,t,`borderRadius`)};case`border`:return noAlpha(),{borderWidth:r(a.borderWidth,`DEFAULT`,t,`borderWidth`)}}let f=d.indexOf(`-`),p=f===-1?d:d.slice(0,f),m=f===-1?``:d.slice(f+1);switch(p){case`bg`:return{backgroundColor:colour(r(a.colors,m,t,`colors`))};case`opacity`:return noAlpha(),{opacity:r(a.opacity,m,t,`opacity`)};case`rounded`:{noAlpha();let e=o[m];return e===void 0?{borderRadius:r(a.borderRadius,m,t,`borderRadius`)}:{[e]:r(a.borderRadius,`DEFAULT`,t,`borderRadius`)}}case`border`:{let o=s[m];if(o!==void 0)return noAlpha(),{[o]:r(a.borderWidth,`DEFAULT`,t,`borderWidth`)};let c=n(a.borderWidth,m),l=n(a.colors,m);if(c!==void 0&&l!==void 0)throw new e(t,`"${m}" is in both the borderWidth and colors scales, so this utility is ambiguous`);if(c!==void 0)return noAlpha(),{borderWidth:c};if(l!==void 0)return{borderColor:colour(l)};throw new e(t,`"${m}" is in neither the borderWidth nor the colors scale`+(i(`borderWidth`,m)||i(`colors`,m)))}case`text`:{if(c.has(m))return null;let r=n(a.fontSize,m),o=n(a.colors,m);if(r!==void 0&&o!==void 0)throw new e(t,`"${m}" is in both the fontSize and colors scales, so this utility is ambiguous`);if(r!==void 0)return noAlpha(),{fontSize:r};if(o!==void 0)return{color:colour(o)};throw new e(t,`"${m}" is in neither the fontSize nor the colors scale`+(i(`fontSize`,m)||i(`colors`,m)))}case`font`:{noAlpha();let r=n(a.fontWeight,m),i=n(a.fontFamily,m);if(r!==void 0&&i!==void 0)throw new e(t,`"${m}" is in both the fontWeight and fontFamily scales, so this utility is ambiguous`);if(r!==void 0)return{fontWeight:r};if(i!==void 0)return{fontFamily:i};throw new e(t,`"${m}" is in neither the fontWeight nor the fontFamily scale`)}case`tracking`:return noAlpha(),{letterSpacing:r(a.letterSpacing,m,t,`letterSpacing`)};case`leading`:return noAlpha(),{lineHeight:r(a.lineHeight,m,t,`lineHeight`)}}return null}const o={tl:`borderTopLeftRadius`,tr:`borderTopRightRadius`,bl:`borderBottomLeftRadius`,br:`borderBottomRightRadius`},s={t:`borderTopWidth`,r:`borderRightWidth`,b:`borderBottomWidth`,l:`borderLeftWidth`},c=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),l=new Set(Object.keys(a));function partitionPaint(n){let r=[];for(let[i,o]of Object.entries(n)){if(o===void 0)continue;let n=a[i];if(n===void 0)throw new e(i,`is not a property the paint partition routes`);if(!t.has(n))throw new e(i,`maps to "${n}", which GTK does not accept — see gtk-css.ts`);r.push(`${n}: ${o}`)}let i=r.some(e=>/^border(-(top|right|bottom|left))?-width:/.test(e)),o=r.some(e=>/^border(-(top|right|bottom|left))?-style:/.test(e));return i&&!o&&r.push(`border-style: solid`),r}export{a as CSS_NAME,l as PAINT_PROPERTIES,partitionPaint,resolvePaintUtility};
|
package/lib/esm/style/sheet.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"
|
|
2
|
-
`);return
|
|
3
|
-
`)}get size(){return this.#t.size}flush(){
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{StyleSheetError as e,assertContained as t,installProvider as n}from"./document.js";import r from"gi://Gtk?version=4.0";const i={active:`:active`,hover:`:hover`,focus:`:focus`,disabled:`:disabled`};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)}`}var StyleSheet=class{#e=new r.CssProvider;#t=new Map;#n=!1;#r=!1;#i;constructor(e={}){this.#i=e}classFor(n,r={}){if(n.length===0&&Object.keys(r).length===0)throw new e(`classFor was given no declarations — an empty class would name nothing`);let a=n.join(`; `),o=[],s=hashName(`${a}|${Object.entries(r).map(([e,t])=>`${e}{${t.join(`; `)}}`).sort().join(``)}`);if(this.#t.get(s)!==void 0)return s;n.length>0&&o.push(`.${s} { ${a}; }`);for(let[t,n]of Object.entries(r)){let r=i[t];if(r===void 0)throw new e(`"${t}:" is not a variant this sheet can express. Known: ${Object.keys(i).sort().join(`, `)}. A variant becomes a GTK CSS pseudo-class, so one without a pseudo-class equivalent needs a different mechanism.`);n.length!==0&&o.push(`.${s}${r} { ${n.join(`; `)}; }`)}let c=o.join(`
|
|
2
|
+
`);return t(c,`a generated rule`),this.#t.set(s,c),this.#a(),s}toString(){return[...this.#t.values()].join(`
|
|
3
|
+
`)}get size(){return this.#t.size}flush(){this.#r=!1,this.#e.load_from_string(this.toString()),!this.#n&&(n(this.#e,`the generated stylesheet`,this.#i.display,this.#i.priority??r.STYLE_PROVIDER_PRIORITY_APPLICATION),this.#n=!0)}#a(){this.#r||(this.#r=!0,queueMicrotask(()=>{this.#r&&this.flush()}))}};export{StyleSheet,i as VARIANT_PSEUDO};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{StyleSheetError as e,assertContained as t,installProvider as n}from"./document.js";import r from"gi://Gtk?version=4.0";const i=r.STYLE_PROVIDER_PRIORITY_SETTINGS,a=`accent-color.accent-bg-color.accent-fg-color.destructive-color.destructive-bg-color.destructive-fg-color.success-color.success-bg-color.success-fg-color.warning-color.warning-bg-color.warning-fg-color.error-color.error-bg-color.error-fg-color.window-bg-color.window-fg-color.view-bg-color.view-fg-color.headerbar-bg-color.headerbar-fg-color.headerbar-border-color.headerbar-backdrop-color.headerbar-shade-color.headerbar-darker-shade-color.sidebar-bg-color.sidebar-fg-color.sidebar-backdrop-color.sidebar-shade-color.sidebar-border-color.secondary-sidebar-bg-color.secondary-sidebar-fg-color.card-bg-color.card-fg-color.card-shade-color.dialog-bg-color.dialog-fg-color.popover-bg-color.popover-fg-color.popover-shade-color.thumbnail-bg-color.thumbnail-fg-color.shade-color.scrollbar-outline-color.overview-bg-color.overview-fg-color.active-toggle-bg-color.active-toggle-fg-color`.split(`.`),o=[`borders`,`accent_bg_color`,`window_bg_color`,`acccent-bg-color`],s=new Set(a),c={name:`neutral`,defaultOn:[`*`]};var ThemeRegistry=class{#e=new r.CssProvider;#t=new Map;#n;#r=null;#i=null;constructor(e={}){this.#n=e}register(n){if(n.name===``)throw new e(`a theme needs a name — an unnamed one cannot be selected`);if(this.#t.has(n.name))throw new e(`a theme named "${n.name}" is already registered. Re-registering would silently replace it, and a look that changed without the name changing is the hardest kind to attribute`);for(let e of Object.keys(n.namedColors??{}))assertNamedColor(n.name,e);let r=this.documentOf(n);return r!==``&&t(r,`theme "${n.name}"`),this.#t.set(n.name,n),this}get names(){return[...this.#t.keys()]}get current(){return this.#i}documentOf(e){let t=Object.entries(e.namedColors??{}),n=[];return t.length>0&&n.push(`:root {\n${t.map(([e,t])=>` --${e}: ${t};`).join(`
|
|
2
|
+
`)}\n}`),e.css!==void 0&&e.css.trim()!==``&&n.push(e.css.trim()),n.join(`
|
|
3
|
+
`)}select(t){let n=this.#t.get(t);if(n===void 0)throw new e(`"${t}" is not a registered theme. Known: ${this.names.join(`, `)||`(none registered)`}`);this.#e.load_from_string(this.documentOf(n)),this.#i=t,this.#a()}selectDefault(t){let n=null;for(let[e,r]of this.#t)r.defaultOn?.some(e=>e===t||e===`*`)===!0&&(n=e);if(n===null)throw new e(`no registered theme declares itself the default on "${t}". Registered: ${this.names.join(`, `)||`(none)`}. Give one a \`defaultOn\`, or call select() with a name`);this.select(n)}dispose(){this.#r!==null&&(r.StyleContext.remove_provider_for_display(this.#r,this.#e),this.#r=null,this.#i=null)}#a(){this.#r===null&&(this.#r=n(this.#e,`the theme`,this.#n.display,this.#n.priority??i))}};function assertNamedColor(t,n){if(s.has(n))return;let r=n.includes(`_`);throw new e(`theme "${t}" sets "${n}", which libadwaita does not define as a named colour. `+(r?`Underscores are the LEGACY \`@define-color ${n}\` spelling, which is a different mechanism: emitted as a custom property it defines something nothing reads. The current spelling is "${n.replace(/_/g,`-`)}"`:`A custom property nobody reads is a theme that silently does nothing, which is why this is refused rather than emitted`)+`. Known: ${[...a].sort().join(`, `)}`)}export{a as ADWAITA_NAMED_COLORS,c as NEUTRAL_THEME,o as NOT_ADWAITA_NAMED_COLORS,i as THEME_PROVIDER_PRIORITY,ThemeRegistry};
|
package/lib/esm/style/tokens.js
CHANGED
|
@@ -1 +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};
|
|
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`}},n={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,current:`currentColor`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,DEFAULT:`4px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`,8:`8px`},fontWeight:{thin:`100`,extralight:`200`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`700`,extrabold:`800`,black:`900`},opacity:Object.fromEntries(Array.from({length:21},(e,t)=>[`${t*5}`,`${t/20}`]))};function mergeTokens(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n))r!==void 0&&(t[e]={...t[e],...r});return t}function tailwindDefaultHint(e,t){let r=n[e];return r?.[t]===void 0?``:`. Tailwind's own default scale defines "${t}" (${r[t]}) — a project's \`@theme\` has no reason to declare it, so spread TAILWIND_DEFAULT_TOKENS into your tokens with mergeTokens() if you rely on it`}const 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(`, `)}${tailwindDefaultHint(i,n)}`)}export{t as MINIMAL_TOKENS,n as TAILWIND_DEFAULT_TOKENS,lookupToken,mergeTokens,requireToken,tailwindDefaultHint};
|