@gjsify/gtk-host 0.54.0 → 0.55.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/lib/esm/capabilities.js +1 -0
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/shared-tree-builder.js +1 -1
- package/lib/esm/descriptors/gtk.js +1 -1
- package/lib/esm/policies.js +1 -1
- package/lib/types/attrs.d.ts +10 -2
- package/lib/types/capabilities.d.ts +2 -0
- package/lib/types/conformance/shared-tree-builder.d.ts +1 -1
- package/lib/types/construct-vectors.spec.d.ts +2 -0
- package/lib/types/react-jsx-runtime.d.ts +2 -2
- package/lib/types/types.d.ts +18 -1
- package/package.json +9 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={layout:{refused:`gtk-host's host has no door for a layout-manager child object (ADR 0092); load the .blp through Gtk.Builder instead`},strings:{refused:`gtk-host's host builds widgets and a Gtk.StringList is not one (ADR 0072); load the .blp through Gtk.Builder instead`},responses:{refused:`gtk-host's host builds widgets and a dialog's responses have no door in it (ADR 0072); load the .blp through Gtk.Builder instead`},page:`implemented`,extern:{refused:`gtk-host's host resolves a tag against its built-in widget descriptors and has no registry for an application class; load the .blp through Gtk.Builder instead`},signal:{refused:`gtk-host's tree builder resolves no handler names; a GTK app connects signals in code, or loads the .blp through Gtk.Builder with a scope`},bind:{refused:`gtk-host's tree builder resolves no bindings between objects; a GTK app binds properties in code, or loads the .blp through Gtk.Builder`},breakpoint:{refused:`gtk-host's tree builder resolves no setters between objects and has no Adw.Breakpoint; a GTK app loads the .blp through Gtk.Builder, or builds an Adw.Breakpoint in code`}};export{e as capabilities};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{classOf as e}from"../registry.js";import{adderSlots as t,addressOf as n,classPlacementKind as r,isUnparented as i,placementOf as a,unhandledPlacement as o,unhandledPolicy as s}from"../policies.js";import{installAccessibilityBackend as c,withAtContext as l}from"./at-context.js";import{describeLogRecord as u,installDiagnosticsGate as d,isEnvironmentDiagnostic as f}from"./diagnostics.js";import{descendants as p,dumpTree as m,findDescendant as h,gtkChildTypes as g,gtkChildren as _}from"./tree.js";import{windowChromeCensus as v,windowChromeProblems as y}from"./window-chrome.js";import{buildSharedTree as b}from"./shared-tree-builder.js";import{BUILTIN_DESCRIPTORS as x}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 s(e)}}function placementMethodsOf(e){switch(e.kind){case`parented`:return[];case`portal`:case`toplevel`:return[e.present,e.close];default:return o(e)}}function presentArityOf(e){switch(e.kind){case`parented`:return null;case`portal`:return 1;case`toplevel`:return 0;default:return o(e)}}function descriptorProblems(t=x){let n=[];for(let i of t){let t;try{t=e(i)}catch(e){n.push({gtype:i.gtype,problem:`ctor() threw: ${e.message}`});continue}if(!t)continue;let o=S.type_name(t.$gtype);o!==i.gtype&&n.push({gtype:i.gtype,problem:`ctor() is ${o}, not ${i.gtype}`});for(let e of methodsOf(i.children))typeof t.prototype[e]!=`function`&&n.push({gtype:i.gtype,problem:`declares children.${e}(), which ${o} does not have`});let s=a(i);for(let e of placementMethodsOf(s))typeof t.prototype[e]!=`function`&&n.push({gtype:i.gtype,problem:`declares placement.${e}(), which ${o} does not have`});let c=presentArityOf(s);if(c!==null&&s.kind!==`parented`){let e=t.prototype[s.present];typeof e==`function`&&e.length!==c&&n.push({gtype:i.gtype,problem:`placement.${s.present}() takes ${e.length} argument(s) on ${o}, and a ${s.kind} is presented with exactly ${c}`})}let l=t.prototype.present,u=r(t.$gtype,l);if(u&&s.kind===`parented`&&typeof l==`function`&&n.push({gtype:i.gtype,problem:u===`toplevel`?`implements Gtk.Root and declares no placement, so a parent would take it as an ordinary child — which GTK accepts at exit 0, leaving a root with a parent; it needs placement: { kind: 'toplevel', … }`:`has a present() that takes a parent and declares no placement, so a parent would call its adder on it — which is g_error() and aborts the process; it needs placement: { kind: 'portal', … }`}),i.textSink){let e=t.list_properties().find(e=>e.get_name()===i.textSink);e?(e.flags&S.ParamFlags.WRITABLE)===0?n.push({gtype:i.gtype,problem:`declares a READ-ONLY textSink "${i.textSink}"`}):S.type_is_a(e.value_type,S.TYPE_STRING)||n.push({gtype:i.gtype,problem:`declares textSink "${i.textSink}", which is ${S.type_name(e.value_type)}, not a string`}):n.push({gtype:i.gtype,problem:`declares textSink "${i.textSink}", which ${o} does not have`})}if(i.children.kind===`indexed`&&i.children.perLineCap!==void 0){let e=i.children.perLineCap,r=t.list_properties().find(t=>t.get_name()===e);r?(r.flags&S.ParamFlags.WRITABLE)===0?n.push({gtype:i.gtype,problem:`declares a READ-ONLY perLineCap "${e}"`}):S.type_is_a(r.value_type,S.TYPE_UINT)||n.push({gtype:i.gtype,problem:`declares perLineCap "${e}", which is ${S.type_name(r.value_type)}, not a count`}):n.push({gtype:i.gtype,problem:`declares perLineCap "${e}", which ${o} does not have`})}n.push(...policyProblems(i,t,o))}return n}function policyProblems(e,n,r){let i=[],a=n.prototype,o=e.children,requireGetter=(t,n)=>{let o=t.replace(/^set_/,`get_`);typeof a[o]!=`function`&&i.push({gtype:e.gtype,problem:`${n} uses ${t}() 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 t of Object.keys(o.wrapSlots??{}))t in o.slots||i.push({gtype:e.gtype,problem:`wrapSlots names "${t}", which is not one of ${Object.keys(o.slots).join(`, `)}`});o.defaultSlot in o.slots||i.push({gtype:e.gtype,problem:`defaultSlot "${o.defaultSlot}" is not one of ${Object.keys(o.slots).join(`, `)}`});let n=t(o);n.length>0&&!o.remove&&i.push({gtype:e.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:e.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),o.kind===`keyed`){let t=a[o.add],n=o.titled?3:1;typeof t==`function`&&t.length!==n&&i.push({gtype:e.gtype,problem:`titled: ${o.titled} implies ${o.add}() takes ${n} argument(s), but ${r}'s takes ${t.length}`})}return i}function addressesOf(e){let t=[];for(let r=e.first;r;r=r.next)r.kind===`element`&&r.widget&&!i(r)&&t.push(n(r));return t}export{addressesOf,b as buildSharedTree,p as descendants,u as describeLogRecord,descriptorProblems,m as dumpTree,h as findDescendant,g as gtkChildTypes,_ as gtkChildren,c as installAccessibilityBackend,d as installDiagnosticsGate,f as isEnvironmentDiagnostic,methodsOf,placementMethodsOf,presentArityOf,v as windowChromeCensus,y as windowChromeProblems,l as withAtContext};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{classOf as e}from"../registry.js";import{adderSlots as t,addressOf as n,classPlacementKind as r,isUnparented as i,placementOf as a,unhandledPlacement as o,unhandledPolicy as s}from"../policies.js";import{installAccessibilityBackend as c,withAtContext as l}from"./at-context.js";import{describeLogRecord as u,installDiagnosticsGate as d,isEnvironmentDiagnostic as f}from"./diagnostics.js";import{descendants as p,dumpTree as m,findDescendant as h,gtkChildTypes as g,gtkChildren as _}from"./tree.js";import{windowChromeCensus as v,windowChromeProblems as y}from"./window-chrome.js";import{buildSharedTree as b}from"./shared-tree-builder.js";import{BUILTIN_DESCRIPTORS as x}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];case`paged`:return[e.append,e.remove];default:return s(e)}}function placementMethodsOf(e){switch(e.kind){case`parented`:return[];case`portal`:case`toplevel`:return[e.present,e.close];default:return o(e)}}function presentArityOf(e){switch(e.kind){case`parented`:return null;case`portal`:return 1;case`toplevel`:return 0;default:return o(e)}}function descriptorProblems(t=x){let n=[];for(let i of t){let t;try{t=e(i)}catch(e){n.push({gtype:i.gtype,problem:`ctor() threw: ${e.message}`});continue}if(!t)continue;let o=S.type_name(t.$gtype);o!==i.gtype&&n.push({gtype:i.gtype,problem:`ctor() is ${o}, not ${i.gtype}`});for(let e of methodsOf(i.children))typeof t.prototype[e]!=`function`&&n.push({gtype:i.gtype,problem:`declares children.${e}(), which ${o} does not have`});let s=a(i);for(let e of placementMethodsOf(s))typeof t.prototype[e]!=`function`&&n.push({gtype:i.gtype,problem:`declares placement.${e}(), which ${o} does not have`});let c=presentArityOf(s);if(c!==null&&s.kind!==`parented`){let e=t.prototype[s.present];typeof e==`function`&&e.length!==c&&n.push({gtype:i.gtype,problem:`placement.${s.present}() takes ${e.length} argument(s) on ${o}, and a ${s.kind} is presented with exactly ${c}`})}let l=t.prototype.present,u=r(t.$gtype,l);if(u&&s.kind===`parented`&&typeof l==`function`&&n.push({gtype:i.gtype,problem:u===`toplevel`?`implements Gtk.Root and declares no placement, so a parent would take it as an ordinary child — which GTK accepts at exit 0, leaving a root with a parent; it needs placement: { kind: 'toplevel', … }`:`has a present() that takes a parent and declares no placement, so a parent would call its adder on it — which is g_error() and aborts the process; it needs placement: { kind: 'portal', … }`}),i.textSink){let e=t.list_properties().find(e=>e.get_name()===i.textSink);e?(e.flags&S.ParamFlags.WRITABLE)===0?n.push({gtype:i.gtype,problem:`declares a READ-ONLY textSink "${i.textSink}"`}):S.type_is_a(e.value_type,S.TYPE_STRING)||n.push({gtype:i.gtype,problem:`declares textSink "${i.textSink}", which is ${S.type_name(e.value_type)}, not a string`}):n.push({gtype:i.gtype,problem:`declares textSink "${i.textSink}", which ${o} does not have`})}if(i.children.kind===`indexed`&&i.children.perLineCap!==void 0){let e=i.children.perLineCap,r=t.list_properties().find(t=>t.get_name()===e);r?(r.flags&S.ParamFlags.WRITABLE)===0?n.push({gtype:i.gtype,problem:`declares a READ-ONLY perLineCap "${e}"`}):S.type_is_a(r.value_type,S.TYPE_UINT)||n.push({gtype:i.gtype,problem:`declares perLineCap "${e}", which is ${S.type_name(r.value_type)}, not a count`}):n.push({gtype:i.gtype,problem:`declares perLineCap "${e}", which ${o} does not have`})}n.push(...policyProblems(i,t,o))}return n}function policyProblems(e,n,r){let i=[],a=n.prototype,o=e.children,requireGetter=(t,n)=>{let o=t.replace(/^set_/,`get_`);typeof a[o]!=`function`&&i.push({gtype:e.gtype,problem:`${n} uses ${t}() 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 t of Object.keys(o.wrapSlots??{}))t in o.slots||i.push({gtype:e.gtype,problem:`wrapSlots names "${t}", which is not one of ${Object.keys(o.slots).join(`, `)}`});o.defaultSlot in o.slots||i.push({gtype:e.gtype,problem:`defaultSlot "${o.defaultSlot}" is not one of ${Object.keys(o.slots).join(`, `)}`});let n=t(o);n.length>0&&!o.remove&&i.push({gtype:e.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:e.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),o.kind===`keyed`){let t=a[o.add],n=o.titled?3:1;typeof t==`function`&&t.length!==n&&i.push({gtype:e.gtype,problem:`titled: ${o.titled} implies ${o.add}() takes ${n} argument(s), but ${r}'s takes ${t.length}`})}return i}function addressesOf(e){let t=[];for(let r=e.first;r;r=r.next)r.kind===`element`&&r.widget&&!i(r)&&t.push(n(r));return t}export{addressesOf,b as buildSharedTree,p as descendants,u as describeLogRecord,descriptorProblems,m as dumpTree,h as findDescendant,g as gtkChildTypes,_ as gtkChildren,c as installAccessibilityBackend,d as installDiagnosticsGate,f as isEnvironmentDiagnostic,methodsOf,placementMethodsOf,presentArityOf,v as windowChromeCensus,y as windowChromeProblems,l as withAtContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{createElement as e,insert as t,materialize as n,setProp as r}from"../host.js";function buildSharedTree(
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{createElement as e,insert as t,materialize as n,setProp as r}from"../host.js";import{capabilities as i}from"../capabilities.js";import{assertTreeConstructs as a}from"@gjsify/adwaita-core/conformance";function buildSharedTree(e,t=[]){return a(`gtk-host`,i,e),buildNode(e,t)}function buildNode(i,a){let o=e(i.tag,i.props);a.push(o),n(o),i.slot!==void 0&&r(o,`slot`,i.slot);for(let e of i.children??[]){let n=buildNode(e,a);e.page!==void 0&&setPageLayout(o,n,e),t(n,o)}return o}function setPageLayout(e,t,n){let{page:i}=n,a=e.descriptor.gtype;if(a===`GtkNotebook`)r(t,`layout`,i?.label===void 0?{}:{tabLabel:i.label});else if(a===`GtkStack`)r(t,`layout`,{...i?.name===void 0?{}:{name:i.name},...i?.label===void 0?{}:{title:i.label}});else throw Error(`gtk-host's shared-tree builder: \`${n.tag}\` has a page, and ${a} has no pages.`)}export{buildSharedTree};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";const t={kind:`toplevel`,present:`present`,close:`destroy`},n=[{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`},placement:t},{gtype:`GtkApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_child`},placement:t},{gtype:`GtkDialog`,ctor:()=>e.Dialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAboutDialog`,ctor:()=>e.AboutDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkMessageDialog`,ctor:()=>e.MessageDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAssistant`,ctor:()=>e.Assistant,children:{kind:`uncurated`},placement:t},{gtype:`GtkAppChooserDialog`,ctor:()=>e.AppChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkColorChooserDialog`,ctor:()=>e.ColorChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkFileChooserDialog`,ctor:()=>e.FileChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkFontChooserDialog`,ctor:()=>e.FontChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkShortcutsWindow`,ctor:()=>e.ShortcutsWindow,children:{kind:`uncurated`},placement:t},{gtype:`GtkPageSetupUnixDialog`,ctor:()=>e.PageSetupUnixDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkPrintUnixDialog`,ctor:()=>e.PrintUnixDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAspectFrame`,ctor:()=>e.AspectFrame,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`,perLineCap:`max-children-per-line`}},{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{n as GTK_DESCRIPTORS,t as TOPLEVEL};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";const t={kind:`toplevel`,present:`present`,close:`destroy`},n=[{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`},placement:t},{gtype:`GtkApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_child`},placement:t},{gtype:`GtkDialog`,ctor:()=>e.Dialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAboutDialog`,ctor:()=>e.AboutDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkMessageDialog`,ctor:()=>e.MessageDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAssistant`,ctor:()=>e.Assistant,children:{kind:`uncurated`},placement:t},{gtype:`GtkAppChooserDialog`,ctor:()=>e.AppChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkColorChooserDialog`,ctor:()=>e.ColorChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkFileChooserDialog`,ctor:()=>e.FileChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkFontChooserDialog`,ctor:()=>e.FontChooserDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkShortcutsWindow`,ctor:()=>e.ShortcutsWindow,children:{kind:`uncurated`},placement:t},{gtype:`GtkPageSetupUnixDialog`,ctor:()=>e.PageSetupUnixDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkPrintUnixDialog`,ctor:()=>e.PrintUnixDialog,children:{kind:`uncurated`},placement:t},{gtype:`GtkAspectFrame`,ctor:()=>e.AspectFrame,children:{kind:`single`,set:`set_child`}},{gtype:`GtkScrolledWindow`,ctor:()=>e.ScrolledWindow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkViewport`,ctor:()=>e.Viewport,children:{kind:`single`,set:`set_child`}},{gtype:`GtkWindowHandle`,ctor:()=>e.WindowHandle,children:{kind:`single`,set:`set_child`}},{gtype:`GtkScrollbar`,ctor:()=>e.Scrollbar,children:{kind:`none`}},{gtype:`GtkFrame`,ctor:()=>e.Frame,children:{kind:`single`,set:`set_child`}},{gtype:`GtkGraphicsOffload`,ctor:()=>e.GraphicsOffload,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`,perLineCap:`max-children-per-line`}},{gtype:`GtkListBoxRow`,ctor:()=>e.ListBoxRow,children:{kind:`single`,set:`set_child`}},{gtype:`GtkFlowBoxChild`,ctor:()=>e.FlowBoxChild,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:`GtkRevealer`,ctor:()=>e.Revealer,children:{kind:`single`,set:`set_child`}},{gtype:`GtkExpander`,ctor:()=>e.Expander,children:{kind:`slotted`,slots:{child:`set_child`,label:`set_label_widget`},defaultSlot:`child`}},{gtype:`GtkPaned`,ctor:()=>e.Paned,children:{kind:`slotted`,slots:{start:`set_start_child`,end:`set_end_child`},defaultSlot:`start`}},{gtype:`GtkCenterBox`,ctor:()=>e.CenterBox,children:{kind:`slotted`,slots:{start:`set_start_widget`,center:`set_center_widget`,end:`set_end_widget`},defaultSlot:`center`}},{gtype:`GtkStack`,ctor:()=>e.Stack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0}},{gtype:`GtkNotebook`,ctor:()=>e.Notebook,children:{kind:`paged`,append:`append_page`,remove:`detach_tab`,labelFrom:`tabLabel`}},{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{n as GTK_DESCRIPTORS,t as TOPLEVEL};
|
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{beginHostWrite as n,endHostWrite as r}from"./signals.js";import i from"gi://GObject?version=2.0";import a 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 slotPropertyOf(e){return e.startsWith(`set_`)?e.slice(4).replace(/_/g,`-`):null}function slotNames(e){if(e.kind===`single`){let t=slotPropertyOf(e.set);return t===null?[]:[t]}if(e.kind!==`slotted`)return[];let t=[];for(let[n,r]of Object.entries(e.slots)){t.push(n);let e=slotPropertyOf(r);e!==null&&e!==n&&t.push(e)}return t}function slottedSlot(e,n,r){if(n==null){if(e.defaultSlot in e.slots)return e.defaultSlot;throw t.unknownSlot(r,e.defaultSlot,slotNames(e))}if(n in e.slots)return n;for(let[t,r]of Object.entries(e.slots))if(slotPropertyOf(r)===n)return t;throw t.unknownSlot(r,n,slotNames(e))}function refuseUnknownSlot(e,n){let r=n.slot;if(r==null)return;let i=e.descriptor.children;if(i.kind===`slotted`){slottedSlot(i,r,e.descriptor.gtype);return}if(i.kind!==`keyed`&&!(i.kind===`single`&&slotPropertyOf(i.set)===r))throw t.unknownSlot(e.descriptor.gtype,r,slotNames(i))}function makeWrapper(e,t,n){let r=e.children,i=r.kind===`indexed`?r.wrap:r.kind===`slotted`?r.wrapSlots?.[slottedSlot(r,n,e.gtype)]??null:null;if(!i)return null;if(i===`list-box-row`){if(t instanceof a.ListBoxRow)return null;let e=new a.ListBoxRow;return e.set_child(t),e}if(t instanceof a.FlowBoxChild)return null;let o=new a.FlowBoxChild;return o.set_child(t),o}const makeDetachedContainer=()=>new a.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[slottedSlot(n,t.slot,e.descriptor.gtype)];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}const o={kind:`parented`},placementOf=e=>e.placement??o;function outsideParentOf(e){let t=placementOf(e);switch(t.kind){case`parented`:return null;case`portal`:case`toplevel`:return t;default:return unhandledPlacement(t)}}function portalOf(e){let t=outsideParentOf(e);return t?.kind===`portal`?t:null}function unhandledPlacement(e){throw Error(`unhandled node placement: ${JSON.stringify(e)}`)}const isPortal=e=>portalOf(e.descriptor)!==null,isUnparented=e=>outsideParentOf(e.descriptor)!==null;function placementMethod(e,n,r,i){let a=e.widget?.[r];if(typeof a!=`function`)throw t.placementMethodMissing(e.descriptor.gtype,n.kind,r,i);return a}const toplevelOf=e=>{let t=e.get_root();return t instanceof a.Window?t:null};function presentPortal(e,t,n){let r=e.widget;return r?(placementMethod(t,n,n.present,`present`),placementMethod(t,n,n.close,`close`),watchPortalRoot(r,t,n),placeAgainst(r,t,n)):!1}function placeAgainst(e,t,n){let r=t.widget;if(!r)return!1;let i=toplevelOf(e);if(!i)return placementMethod(t,n,n.close,`close`).call(r),!1;if(r.get_parent()){if(toplevelOf(r)===i)return!0;placementMethod(t,n,n.close,`close`).call(r)}return placementMethod(t,n,n.present,`present`).call(r,e),!0}function watchPortalRoot(e,t,n){t.portalWatch?.widget!==e&&(t.portalWatch&&retractPortalWatch(t),t.portalWatch={widget:e,id:e.connect(`notify::root`,()=>{t.attached=placeAgainst(e,t,n)})})}function retractPortalWatch(e){let t=e.portalWatch;t&&(e.portalWatch=null,t.widget.disconnect(t.id))}function retractPortal(e,t){retractPortalWatch(e),e.widget&&placementMethod(e,t,t.close,`close`).call(e.widget)}function presentToplevel(e,t){let n=e.widget;if(!n)return!1;let r=placementMethod(e,t,t.present,`present`);return placementMethod(e,t,t.close,`close`),e.props.visible!==!1&&r.call(n),!0}function closeToplevel(e,t){e.widget&&placementMethod(e,t,t.close,`close`).call(e.widget)}function detachToplevel(e){let t=e.widget;t&&t.set_visible(!1)}function placeOutsideParent(e,t,n){switch(n.kind){case`portal`:return presentPortal(e,t,n);case`toplevel`:return presentToplevel(t,n);default:return unhandledPlacement(n)}}function detachOutsideParent(e,t){switch(t.kind){case`portal`:return retractPortal(e,t);case`toplevel`:return detachToplevel(e);default:return unhandledPlacement(t)}}function closeOutsideParent(e,t){switch(t.kind){case`portal`:return retractPortal(e,t);case`toplevel`:return closeToplevel(e,t);default:return unhandledPlacement(t)}}function classPlacementKind(e,t){return i.type_is_a(e,a.Root.$gtype)?`toplevel`:typeof t==`function`&&t.length===1?`portal`:null}function nodePlacementKind(e){let t=e.constructor?.$gtype;return t?classPlacementKind(t,e.present):null}function refuseUnparentable(e,n){if(n.descriptor.placement!==void 0)return;let r=n.widget;if(!r)return;let i=nodePlacementKind(r);if(i)throw t.unparentableChild(e.descriptor.gtype,n.descriptor.gtype,i,i===`toplevel`?`${n.descriptor.gtype} implements Gtk.Root, so it IS a toplevel and cannot have a parent`:`${n.descriptor.gtype}.present() takes a parent, so it is presented AGAINST one and never placed into one`)}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)}syncPerLineCap(n.parent)}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,
|
|
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://GObject?version=2.0";import a 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 slotPropertyOf(e){return e.startsWith(`set_`)?e.slice(4).replace(/_/g,`-`):null}function slotNames(e){if(e.kind===`single`){let t=slotPropertyOf(e.set);return t===null?[]:[t]}if(e.kind!==`slotted`)return[];let t=[];for(let[n,r]of Object.entries(e.slots)){t.push(n);let e=slotPropertyOf(r);e!==null&&e!==n&&t.push(e)}return t}function slottedSlot(e,n,r){if(n==null){if(e.defaultSlot in e.slots)return e.defaultSlot;throw t.unknownSlot(r,e.defaultSlot,slotNames(e))}if(n in e.slots)return n;for(let[t,r]of Object.entries(e.slots))if(slotPropertyOf(r)===n)return t;throw t.unknownSlot(r,n,slotNames(e))}function refuseUnknownSlot(e,n){let r=n.slot;if(r==null)return;let i=e.descriptor.children;if(i.kind===`slotted`){slottedSlot(i,r,e.descriptor.gtype);return}if(i.kind!==`keyed`&&!(i.kind===`single`&&slotPropertyOf(i.set)===r))throw t.unknownSlot(e.descriptor.gtype,r,slotNames(i))}function makeWrapper(e,t,n){let r=e.children,i=r.kind===`indexed`?r.wrap:r.kind===`slotted`?r.wrapSlots?.[slottedSlot(r,n,e.gtype)]??null:null;if(!i)return null;if(i===`list-box-row`){if(t instanceof a.ListBoxRow)return null;let e=new a.ListBoxRow;return e.set_child(t),e}if(t instanceof a.FlowBoxChild)return null;let o=new a.FlowBoxChild;return o.set_child(t),o}const makeDetachedContainer=()=>new a.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[slottedSlot(n,t.slot,e.descriptor.gtype)];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}const o={kind:`parented`},placementOf=e=>e.placement??o;function outsideParentOf(e){let t=placementOf(e);switch(t.kind){case`parented`:return null;case`portal`:case`toplevel`:return t;default:return unhandledPlacement(t)}}function portalOf(e){let t=outsideParentOf(e);return t?.kind===`portal`?t:null}function unhandledPlacement(e){throw Error(`unhandled node placement: ${JSON.stringify(e)}`)}const isPortal=e=>portalOf(e.descriptor)!==null,isUnparented=e=>outsideParentOf(e.descriptor)!==null;function placementMethod(e,n,r,i){let a=e.widget?.[r];if(typeof a!=`function`)throw t.placementMethodMissing(e.descriptor.gtype,n.kind,r,i);return a}const toplevelOf=e=>{let t=e.get_root();return t instanceof a.Window?t:null};function presentPortal(e,t,n){let r=e.widget;return r?(placementMethod(t,n,n.present,`present`),placementMethod(t,n,n.close,`close`),watchPortalRoot(r,t,n),placeAgainst(r,t,n)):!1}function placeAgainst(e,t,n){let r=t.widget;if(!r)return!1;let i=toplevelOf(e);if(!i)return placementMethod(t,n,n.close,`close`).call(r),!1;if(r.get_parent()){if(toplevelOf(r)===i)return!0;placementMethod(t,n,n.close,`close`).call(r)}return placementMethod(t,n,n.present,`present`).call(r,e),!0}function watchPortalRoot(e,t,n){t.portalWatch?.widget!==e&&(t.portalWatch&&retractPortalWatch(t),t.portalWatch={widget:e,id:e.connect(`notify::root`,()=>{t.attached=placeAgainst(e,t,n)})})}function retractPortalWatch(e){let t=e.portalWatch;t&&(e.portalWatch=null,t.widget.disconnect(t.id))}function retractPortal(e,t){retractPortalWatch(e),e.widget&&placementMethod(e,t,t.close,`close`).call(e.widget)}function presentToplevel(e,t){let n=e.widget;if(!n)return!1;let r=placementMethod(e,t,t.present,`present`);return placementMethod(e,t,t.close,`close`),e.props.visible!==!1&&r.call(n),!0}function closeToplevel(e,t){e.widget&&placementMethod(e,t,t.close,`close`).call(e.widget)}function detachToplevel(e){let t=e.widget;t&&t.set_visible(!1)}function placeOutsideParent(e,t,n){switch(n.kind){case`portal`:return presentPortal(e,t,n);case`toplevel`:return presentToplevel(t,n);default:return unhandledPlacement(n)}}function detachOutsideParent(e,t){switch(t.kind){case`portal`:return retractPortal(e,t);case`toplevel`:return detachToplevel(e);default:return unhandledPlacement(t)}}function closeOutsideParent(e,t){switch(t.kind){case`portal`:return retractPortal(e,t);case`toplevel`:return closeToplevel(e,t);default:return unhandledPlacement(t)}}function classPlacementKind(e,t){return i.type_is_a(e,a.Root.$gtype)?`toplevel`:typeof t==`function`&&t.length===1?`portal`:null}function nodePlacementKind(e){let t=e.constructor?.$gtype;return t?classPlacementKind(t,e.present):null}function refuseUnparentable(e,n){if(n.descriptor.placement!==void 0)return;let r=n.widget;if(!r)return;let i=nodePlacementKind(r);if(i)throw t.unparentableChild(e.descriptor.gtype,n.descriptor.gtype,i,i===`toplevel`?`${n.descriptor.gtype} implements Gtk.Root, so it IS a toplevel and cannot have a parent`:`${n.descriptor.gtype}.present() takes a parent, so it is presented AGAINST one and never placed into one`)}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)}syncPerLineCap(n.parent)}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`:case`paged`: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,o=addressOf(n);switch(i.kind){case`uncurated`:throw t.uncuratedPlacement(e.descriptor.gtype,n.descriptor.gtype);case`ordered`:r[i.append](o);return;case`slotted`:{let t=slottedSlot(i,n.slot,e.descriptor.gtype);r[i.slots[t]](o);return}case`keyed`:{let e=n.layout?.[i.nameFrom]??n.slot,t=n.layout?.title;i.titled?r[i.add](o,e??null,t??e??``):r[i.add](o);return}case`paged`:{let e=n.layout?.[i.labelFrom];r[i.append](o,e===void 0?null:new a.Label({label:e}));return}case`coords`:{let e=n.layout??{};r[i.attach](o,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=t=>slottedSlot(i,t.slot,e.descriptor.gtype),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=slottedSlot(i,n.slot,e.descriptor.gtype);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`:case`paged`: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=outsideParentOf(t.descriptor);if(n)return detachOutsideParent(t,n);let r=e.widget;r&&t.attached&&(detachChild(e,t,r),syncPerLineCap(e))}function syncPerLineCap(e){let t=e.descriptor.children;if(t.kind!==`indexed`||t.perLineCap===void 0||e.props[t.perLineCap]!==void 0)return;let i=e.widget;if(!i)return;let a=0;for(let e=i.get_first_child();e!==null;e=e.get_next_sibling())a+=1;n(null);try{i.set_property(t.perLineCap,Math.min(65535,Math.max(1,a)))}finally{r()}}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`paged`:case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`;default:return unhandledPolicy(e)}}export{adderSlots,addressOf,classPlacementKind,closeOutsideParent,closeToplevel,detachOutsideParent,detachToplevel,insertChild,isPortal,isUnparented,makeDetachedContainer,makeWrapper,nodePlacementKind,outsideParentOf,placeOutsideParent,placementOf,portalOf,presentPortal,presentToplevel,refuseUnknownSlot,refuseUnparentable,removeChild,reorderMode,retractPortal,setterSlotOf,setterSlots,slotNames,slotOccupant,slotPropertyOf,slottedSlot,unhandledPlacement,unhandledPolicy};
|
package/lib/types/attrs.d.ts
CHANGED
|
@@ -57,6 +57,14 @@ export type WithOnce<T> = T & {
|
|
|
57
57
|
export interface SlotAttribute {
|
|
58
58
|
slot?: string | null;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* What this child tells its parent's layout, read by `setProp()` at placement: a grid cell's
|
|
62
|
+
* `row` and `column`, a stack page's `name` and `title`, a notebook page's `tabLabel`. The keys
|
|
63
|
+
* belong to the PARENT's child policy, so the record is open here.
|
|
64
|
+
*/
|
|
65
|
+
export interface LayoutAttribute {
|
|
66
|
+
layout?: Record<string, unknown> | null;
|
|
67
|
+
}
|
|
60
68
|
/**
|
|
61
69
|
* GTK's ARIA surface, on every element of every dialect. Read by `setAccessibility()`.
|
|
62
70
|
*
|
|
@@ -93,7 +101,7 @@ export interface RawSignalAttributes {
|
|
|
93
101
|
* `T` is the widget's own instance type, so `ref={(el) => …}` infers `el` as
|
|
94
102
|
* `Gtk.Box` rather than the `unknown` a DOM renderer settles for.
|
|
95
103
|
*/
|
|
96
|
-
export interface JsxAttributes<T> extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
104
|
+
export interface JsxAttributes<T> extends AccessibilityAttribute, SlotAttribute, LayoutAttribute, RawSignalAttributes {
|
|
97
105
|
children?: ElementChild;
|
|
98
106
|
ref?: T | ((el: T) => void) | undefined;
|
|
99
107
|
}
|
|
@@ -104,7 +112,7 @@ export interface JsxAttributes<T> extends AccessibilityAttribute, SlotAttribute,
|
|
|
104
112
|
* every registered component's props are intersected with. Declaring our own `ref` would intersect
|
|
105
113
|
* two different `ref` types and could leave the property unusable.
|
|
106
114
|
*/
|
|
107
|
-
export interface VueAttributes extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
115
|
+
export interface VueAttributes extends AccessibilityAttribute, SlotAttribute, LayoutAttribute, RawSignalAttributes {
|
|
108
116
|
}
|
|
109
117
|
/**
|
|
110
118
|
* The properties whose GObject type is a `GMenuModel`, in both spellings.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SharedTreeNode } from '@gjsify/adwaita-core/conformance';
|
|
2
2
|
import type { HostElement } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* A `SharedTreeNode`, realised: a tag, its authored properties, its placement, its children,
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import type { Key, ReactElement, ReactNode, Ref } from 'react';
|
|
35
35
|
import type { WidgetClassByTag, WidgetPropsByTag } from './generated/props.js';
|
|
36
|
-
import type { AccessibilityAttribute, RawSignalAttributes, SlotAttribute, WithOnce, WithPortableValues } from './attrs.js';
|
|
36
|
+
import type { AccessibilityAttribute, LayoutAttribute, RawSignalAttributes, SlotAttribute, WithOnce, WithPortableValues } from './attrs.js';
|
|
37
37
|
export { Fragment } from 'react/jsx-runtime';
|
|
38
38
|
/**
|
|
39
39
|
* React's own factories, RE-TYPED over this package's element list.
|
|
@@ -67,7 +67,7 @@ type GtkJsxDevFactory = (type: GtkElementType, props: unknown, key: Key | undefi
|
|
|
67
67
|
* element TS2559. `children` must also be optional, or a self-closing tag is
|
|
68
68
|
* TS2741.
|
|
69
69
|
*/
|
|
70
|
-
export interface ReactWidgetAttributes<T> extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
70
|
+
export interface ReactWidgetAttributes<T> extends AccessibilityAttribute, SlotAttribute, LayoutAttribute, RawSignalAttributes {
|
|
71
71
|
children?: ReactNode;
|
|
72
72
|
ref?: Ref<T> | undefined;
|
|
73
73
|
key?: Key | null | undefined;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -200,7 +200,7 @@ export type NodePlacement =
|
|
|
200
200
|
readonly present: string;
|
|
201
201
|
readonly close: string;
|
|
202
202
|
};
|
|
203
|
-
export type PolicyKind = 'none' | 'single' | 'ordered' | 'indexed' | 'slotted' | 'keyed' | 'coords';
|
|
203
|
+
export type PolicyKind = 'none' | 'single' | 'ordered' | 'indexed' | 'slotted' | 'keyed' | 'coords' | 'paged';
|
|
204
204
|
/**
|
|
205
205
|
* How a parent adopts children. GTK4 deleted `GtkContainer`, so there is no
|
|
206
206
|
* generic `add`. `Gtk.Buildable.add_child` is introspected as a vfunc only
|
|
@@ -390,6 +390,23 @@ export type ChildPolicy = {
|
|
|
390
390
|
attach: string;
|
|
391
391
|
remove: string;
|
|
392
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* `Gtk.Notebook`: a page is a child plus a tab label, and the label is data on the child
|
|
395
|
+
* (`layout.tabLabel`), the way a grid cell is.
|
|
396
|
+
*
|
|
397
|
+
* Not `keyed`: a notebook page has no name to address it by (the notebook speaks
|
|
398
|
+
* positions, `GtkNotebookPage` is a GObject with no tag of its own — gtknotebook.c:423),
|
|
399
|
+
* and `append_page(child, tab_label)` takes a WIDGET for its label. The host builds a
|
|
400
|
+
* `Gtk.Label` from `layout.tabLabel`; with none it passes `null`, which is what makes
|
|
401
|
+
* C number the tab "Page N" rather than draw none (gtknotebook.c:4353-4373).
|
|
402
|
+
* `remove` is `detach_tab`, which takes the child — `remove_page` takes an index.
|
|
403
|
+
*/
|
|
404
|
+
| {
|
|
405
|
+
kind: 'paged';
|
|
406
|
+
append: string;
|
|
407
|
+
remove: string;
|
|
408
|
+
labelFrom: string;
|
|
409
|
+
}
|
|
393
410
|
/**
|
|
394
411
|
* Generated, not curated: the tag exists, its placement rule does not.
|
|
395
412
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/gtk-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "Framework-agnostic GTK4/Adwaita host: the element model UI-framework renderers bind to",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./lib/types/react-jsx-runtime.d.ts",
|
|
43
43
|
"default": "./lib/esm/react-jsx-runtime.js"
|
|
44
44
|
},
|
|
45
|
+
"./capabilities": {
|
|
46
|
+
"types": "./lib/types/capabilities.d.ts",
|
|
47
|
+
"default": "./lib/esm/capabilities.js"
|
|
48
|
+
},
|
|
45
49
|
"./conformance": {
|
|
46
50
|
"types": "./lib/types/conformance/index.d.ts",
|
|
47
51
|
"default": "./lib/esm/conformance/index.js"
|
|
@@ -102,8 +106,8 @@
|
|
|
102
106
|
"@girs/gtk-4.0": "5.4.0",
|
|
103
107
|
"@girs/pango-1.0": "5.4.0",
|
|
104
108
|
"@girs/pangocairo-1.0": "5.4.0",
|
|
105
|
-
"@gjsify/adwaita-core": "^0.
|
|
106
|
-
"@gjsify/utils": "^0.
|
|
109
|
+
"@gjsify/adwaita-core": "^0.55.0",
|
|
110
|
+
"@gjsify/utils": "^0.55.0"
|
|
107
111
|
},
|
|
108
112
|
"peerDependencies": {
|
|
109
113
|
"@vue/runtime-core": "^3.5.0",
|
|
@@ -126,10 +130,10 @@
|
|
|
126
130
|
}
|
|
127
131
|
},
|
|
128
132
|
"devDependencies": {
|
|
129
|
-
"@gjsify/cli": "^0.
|
|
133
|
+
"@gjsify/cli": "^0.55.0",
|
|
130
134
|
"@vue/runtime-core": "^3.5.0",
|
|
131
135
|
"solid-js": "^1.9.0",
|
|
132
|
-
"@gjsify/unit": "^0.
|
|
136
|
+
"@gjsify/unit": "^0.55.0",
|
|
133
137
|
"@types/node": "^25.9.2",
|
|
134
138
|
"typescript": "^6.0.3",
|
|
135
139
|
"@gjsify/node-gi": "file:../../node-gi/node-gi",
|