@gjsify/gtk-host 0.41.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +481 -6
  2. package/lib/esm/adapters/react.js +1 -0
  3. package/lib/esm/adapters/solid.js +1 -0
  4. package/lib/esm/adapters/vue.js +1 -0
  5. package/lib/esm/attrs.js +0 -0
  6. package/lib/esm/conformance/diagnostics.js +2 -2
  7. package/lib/esm/conformance/index.js +2 -2
  8. package/lib/esm/descriptors/adw.js +1 -1
  9. package/lib/esm/descriptors/gtk.js +1 -1
  10. package/lib/esm/descriptors/index.js +1 -1
  11. package/lib/esm/errors.js +1 -1
  12. package/lib/esm/generated/props.js +0 -0
  13. package/lib/esm/generated/widgets.js +1 -0
  14. package/lib/esm/host.js +1 -1
  15. package/lib/esm/index.js +1 -1
  16. package/lib/esm/jsx-runtime.js +1 -0
  17. package/lib/esm/policies.js +1 -1
  18. package/lib/esm/probe.js +1 -0
  19. package/lib/esm/props.js +1 -1
  20. package/lib/esm/react-jsx-runtime.js +1 -0
  21. package/lib/esm/registry.js +1 -1
  22. package/lib/esm/signals.js +1 -1
  23. package/lib/esm/style/errors.js +1 -0
  24. package/lib/esm/style/gtk-css.js +1 -0
  25. package/lib/esm/style/gtk-props.js +1 -0
  26. package/lib/esm/style/index.js +1 -0
  27. package/lib/esm/style/layout.js +1 -0
  28. package/lib/esm/style/paint.js +1 -0
  29. package/lib/esm/style/resolve.js +1 -0
  30. package/lib/esm/style/sheet.js +3 -0
  31. package/lib/esm/style/tokens.js +1 -0
  32. package/lib/esm/tags.js +2 -0
  33. package/lib/esm/vue-components.js +0 -0
  34. package/lib/types/adapters/react.d.ts +224 -0
  35. package/lib/types/adapters/react.spec.d.ts +2 -0
  36. package/lib/types/adapters/solid.d.ts +78 -0
  37. package/lib/types/adapters/solid.spec.d.ts +2 -0
  38. package/lib/types/adapters/vue.d.ts +24 -0
  39. package/lib/types/adapters/vue.spec.d.ts +2 -0
  40. package/lib/types/attrs.d.ts +102 -0
  41. package/lib/types/buildable.spec.d.ts +2 -0
  42. package/lib/types/conformance/diagnostics.d.ts +26 -2
  43. package/lib/types/conformance/index.d.ts +24 -1
  44. package/lib/types/conformance/vectors.d.mts +34 -0
  45. package/lib/types/descriptors/index.d.ts +52 -1
  46. package/lib/types/errors.d.ts +21 -0
  47. package/lib/types/generated/props.d.ts +5505 -0
  48. package/lib/types/generated/surface-data.d.mts +22 -0
  49. package/lib/types/generated/widgets.d.ts +3 -0
  50. package/lib/types/generated.spec.d.ts +4 -0
  51. package/lib/types/generator/emit-types.d.mts +54 -0
  52. package/lib/types/generator/emit.d.mts +50 -0
  53. package/lib/types/generator/gir.d.mts +164 -0
  54. package/lib/types/generator/main.d.mts +23 -0
  55. package/lib/types/generator/mini.fixture.d.mts +30 -0
  56. package/lib/types/generator/surface.d.mts +62 -0
  57. package/lib/types/generator/tsmap.d.mts +73 -0
  58. package/lib/types/generator.spec.d.ts +2 -0
  59. package/lib/types/host.d.ts +102 -1
  60. package/lib/types/index.d.ts +6 -3
  61. package/lib/types/jsx-runtime.d.ts +70 -0
  62. package/lib/types/policies.d.ts +58 -0
  63. package/lib/types/probe.d.ts +87 -0
  64. package/lib/types/props.d.ts +52 -2
  65. package/lib/types/react-jsx-runtime.d.ts +108 -0
  66. package/lib/types/registry.d.ts +1 -1
  67. package/lib/types/signals.d.ts +16 -1
  68. package/lib/types/style/errors.d.ts +6 -0
  69. package/lib/types/style/gtk-css.d.ts +24 -0
  70. package/lib/types/style/gtk-css.spec.d.ts +2 -0
  71. package/lib/types/style/gtk-props.d.ts +27 -0
  72. package/lib/types/style/gtk-props.spec.d.ts +2 -0
  73. package/lib/types/style/index.d.ts +13 -0
  74. package/lib/types/style/layout.d.ts +163 -0
  75. package/lib/types/style/layout.spec.d.ts +2 -0
  76. package/lib/types/style/paint.d.ts +53 -0
  77. package/lib/types/style/paint.spec.d.ts +2 -0
  78. package/lib/types/style/resolve.d.ts +58 -0
  79. package/lib/types/style/sheet.d.ts +40 -0
  80. package/lib/types/style/sheet.spec.d.ts +2 -0
  81. package/lib/types/style/tokens.d.ts +58 -0
  82. package/lib/types/tags.d.ts +25 -0
  83. package/lib/types/testing/gate.d.mts +25 -0
  84. package/lib/types/types.d.ts +56 -3
  85. package/lib/types/vue-components.d.ts +46 -0
  86. package/package.json +85 -8
@@ -0,0 +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};
package/lib/esm/host.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{lookupWidget as t,nearestRegistered as n}from"./registry.js";import{addressOf as r,insertChild as i,makeWrapper as a,removeChild as o}from"./policies.js";import{beginHostWrite as s,clearHandlers as c,endHostWrite as l,isEventProp as u,setHandler as d,toSignalName as f}from"./signals.js";import{coerce as p,defaultValue as m,paramSpecs as h,requireSpec as g,toPropertyName as _}from"./props.js";import v from"gi://GObject";function createElement(e,n){let r={kind:`element`,descriptor:t(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};if(n)for(let[e,t]of Object.entries(n))setProp(r,e,t);return r}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;let t=e.descriptor.ctor(),n=h(t,e.descriptor.gtype),r={};for(let[t,i]of Object.entries(e.props))r[t]=p(g(n,e.descriptor.gtype,t),i,e.descriptor.gtype);s();try{e.widget=new t(r)}finally{l()}try{replayInto(e)}catch(t){c(e);for(let t of childSnapshot(e))t.kind===`element`&&t.attached&&(o(e,t),t.attached=!1);throw e.widget=null,e.wrapper=null,t}return e.widget}function replayInto(e){for(let[t,n]of e.listeners)d(e,t,n);for(let t=e.first;t;t=t.next)t.kind===`element`&&attach(e,t);e.textFromChildren&&flushText(e)}function setProp(e,t,n,r){if(u(t))return setEventHandler(e,t,n);if(t===`slot`)return setSlot(e,n);if(t===`layout`){let t=n,r=e.parent;if(!r||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,r,()=>{e.layout=t},()=>{e.layout=i});return}let i=_(t),a=g(h(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,i),o=n===void 0?m(a):p(a,n,e.descriptor.gtype),c=i in e.props?e.props[i]:void 0;if(n===void 0?delete e.props[i]:e.props[i]=n,e.widget){if((a.flags&v.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,i,c);s();try{e.widget.set_property(i,o)}finally{l()}}}function setEventHandler(e,t,n){e.widget?d(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(t,n){let r=f(n,t.descriptor.eventAliases).split(`::`)[0],i=t.descriptor.ctor().$gtype;if(v.signal_lookup(r,i)===0)throw e.unknownSignal(t.descriptor.gtype,n,r)}function setSlot(e,t){if(e.slot===t)return;let n=e.parent;if(!n||!e.widget){e.slot=t;return}let r=e.slot;replaceAt(e,n,()=>{e.slot=t},()=>{e.slot=r})}function replaceAt(e,t,n,r){o(t,e),e.attached=!1,n();try{attach(t,e)}catch(n){r();try{attach(t,e)}catch{}throw n}}function rebuild(e,t,n){let r=e.parent;if(e.widget){c(e);for(let t of childSnapshot(e))t.kind===`element`&&(o(e,t),t.attached=!1);r&&o(r,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(i){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),r&&attach(r,e)}catch{}throw i}r&&attach(r,e)}function setText(e,t){e.data=t,e.kind===`text`&&e.parent&&flushText(e.parent)}function setElementText(e,t){writeTextSink(e,t),e.textFromChildren=!1;for(let t of childSnapshot(e))destroy(t)}function flushText(e){let t=``,n=!1;for(let r of childNodes(e))r.kind===`text`&&(t+=r.data,n=!0);t===``&&!e.textFromChildren||(writeTextSink(e,t),e.textFromChildren=n)}function writeTextSink(t,n){let r=t.descriptor.textSink;if(!r)throw e.textNotAccepted(t.descriptor.gtype,n);materialize(t);let i=g(h(t.descriptor.ctor(),t.descriptor.gtype),t.descriptor.gtype,r);s();try{t.widget.set_property(r,p(i,n,t.descriptor.gtype))}finally{l()}t.props[r]=n}function*childNodes(e){for(let t=e.first;t;t=t.next)yield t}function childSnapshot(e){let t=[];for(let n=e.first;n;n=n.next)t.push(n);return t}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);let n=null,a=0;for(let i=e.first;i&&i!==t;i=i.next)i.kind!==`element`||!i.attached||(n=r(i),a+=1);let o=[];for(let e=t.next;e;e=e.next)e.kind===`element`&&e.attached&&o.push(e);i({parent:e,child:t,prevWidget:n,index:a,following:o}),t.attached=!0}function ensureWrapper(e,t){if(t.wrapper)return;let n=a(e.descriptor.children,t.widget);n&&(t.wrapper=n)}function insert(e,t,n=null){let r=e.parent,i=e.next;e.parent&&remove(e),link(t,e,n);try{e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch(t){throw unlink(e),r&&restore(e,r,i),t}}function restore(e,t,n){try{link(t,e,n),e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch{unlink(e)}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(o(t,e),e.attached=!1,e.wrapper&&=(e.wrapper.set_child(null),null)),unlink(e),t&&e.kind===`text`&&flushText(t)}function clearContainer(e){for(;e.first;)remove(e.first)}function destroy(e){if(e.kind===`element`){for(let t of childSnapshot(e))destroy(t);c(e),e.listeners.clear()}if(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}}function mountRoot(t,r){materialize(t);let a=r.constructor.$gtype,o=n(a);if(!o)throw e.unknownTag(gtypeNameOf(r));let s={kind:`element`,descriptor:o,widget:r,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},c=directChildren(r);link(s,t,null);try{ensureWrapper(s,t),i({parent:s,child:t,prevWidget:c.length>0?c[c.length-1]:null,index:c.length,following:[]}),t.attached=!0}catch(e){throw unlink(t),e}}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=>v.type_name(e.constructor.$gtype),parentNode=e=>e.parent,firstChild=e=>e.first,nextSibling=e=>e.next,prevSibling=e=>e.prev;export{clearContainer,createAnchor,createElement,createText,destroy,firstChild,insert,isText,materialize,mountRoot,nextSibling,parentNode,prevSibling,remove,setElementText,setEventHandler,setProp,setSlot,setText};
1
+ import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{addressOf as t,insertChild as n,makeDetachedContainer as r,makeWrapper as i,removeChild as a,setterSlotOf as o,setterSlots as s,slotOccupant as c}from"./policies.js";import{beginHostWrite as l,clearHandlers as u,endHostWrite as d,isEventProp as f,setHandler as p,toSignalName as m}from"./signals.js";import{coerce as h,paramSpecs as g,removedValue as _,requireSpec as v,toPropertyName as y}from"./props.js";import{lookupWidget as b,nearestRegistered as x}from"./registry.js";import S from"gi://GObject";function createElement(e,t){let n={kind:`element`,descriptor:b(e),widget:null,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!1,destroyed:!1,foreign:[]};if(t)for(let[e,r]of Object.entries(t))setProp(n,e,r);return n}const createText=e=>({kind:`text`,data:e,parent:null,prev:null,next:null}),createAnchor=(e=``)=>({kind:`anchor`,data:e,parent:null,prev:null,next:null}),isText=e=>e.kind===`text`;function materialize(t){if(t.widget)return t.widget;for(let n of t.descriptor.requiresProps??[])if(!(n in t.props))throw e.missingConstructProp(t.descriptor.gtype,n);let n=t.descriptor.ctor(),r=g(n,t.descriptor.gtype),i={};for(let[e,n]of Object.entries(t.props))i[e]=h(v(r,t.descriptor.gtype,e),n,t.descriptor.gtype);l();try{t.widget=new n(i)}finally{d()}try{replayInto(t)}catch(e){u(t);for(let e of childSnapshot(t))e.kind===`element`&&e.attached&&(a(t,e),e.attached=!1);throw t.widget=null,t.wrapper=null,e}return t.widget}function replayInto(e){for(let[t,n]of e.listeners)p(e,t,n);for(let t of siblingsFrom(e.first,e))t.kind===`element`&&attach(e,t);e.textFromChildren&&flushText(e)}function setProp(e,t,n,r){if(f(t))return setEventHandler(e,t,n);if(t===`slot`)return setSlot(e,n);if(t===`layout`){let t=n,r=e.parent;if(!r||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,r,()=>{e.layout=t},()=>{e.layout=i});return}let i=y(t),a=v(g(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,i),o=n==null,s=o?_(e.descriptor,a):h(a,n,e.descriptor.gtype),c=i in e.props?e.props[i]:void 0;if(o?delete e.props[i]:e.props[i]=n,e.widget){if((a.flags&S.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,i,c);l();try{writeProperty(e.widget,i,s)}finally{d()}}}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?p(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(t,n){let r=m(n,t.descriptor.eventAliases).split(`::`)[0],i=t.descriptor.ctor().$gtype;if(S.signal_lookup(r,i)===0)throw e.unknownSignal(t.descriptor.gtype,n,r)}function setSlot(e,t){if(e.slot===t)return;let n=e.parent;if(!n||!e.widget){e.slot=t;return}let r=e.slot;replaceAt(e,n,()=>{e.slot=t},()=>{e.slot=r})}function replaceAt(e,t,n,r){a(t,e),e.attached=!1,n();try{attach(t,e)}catch(n){r();try{attach(t,e)}catch{}throw n}}function rebuild(e,t,n){let r=e.parent;if(e.widget){u(e);for(let t of childSnapshot(e))t.kind===`element`&&(a(e,t),t.attached=!1);r&&a(r,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(i){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),r&&attach(r,e)}catch{}throw i}r&&attach(r,e)}function setText(e,t){e.data=t,e.kind===`text`&&e.parent&&flushText(e.parent)}function setElementText(e,t){writeTextSink(e,t),e.textFromChildren=!1,destroyChildren(e)}function flushText(e){let t=``,n=!1;for(let r of childNodes(e))r.kind===`text`&&(t+=r.data,n=!0);if(t===``&&!e.textFromChildren)return;let r=e.descriptor.textSink;if(t===``&&r&&holdsElementInSetterSlot(e)){e.textFromChildren=!1,delete e.props[r];return}writeTextSink(e,t),e.textFromChildren=n}function*setterSlotChildren(e){for(let t of siblingsFrom(e.first,e))t.kind===`element`&&t.attached&&o(e,t)&&(yield t)}const holdsElementInSetterSlot=e=>!setterSlotChildren(e).next().done;function writeTextSink(t,n){let r=t.descriptor.textSink;if(!r)throw e.textNotAccepted(t.descriptor.gtype,n);materialize(t);let i=t.descriptor.children,a=i.kind===`single`?i.set:null;if(a&&!holdsOursInSlot(t,null)&&appOccupant(t.widget,t.descriptor,a))throw e.occupiedSlot(t.descriptor.gtype,`text`,a);let o=v(g(t.descriptor.ctor(),t.descriptor.gtype),t.descriptor.gtype,r);l();try{t.widget.set_property(r,h(o,n,t.descriptor.gtype))}finally{d()}t.props[r]=n;for(let e of setterSlotChildren(t))e.attached=!1}function*childNodes(e){yield*siblingsFrom(e.first,e)}function childSnapshot(e){let t=[];for(let n of siblingsFrom(e.first,e))t.push(n);return t}function*siblingsFrom(t,n){let r=0;for(let i=t;i;i=i.next){if(++r>1e5)throw e.siblingCycle(n.descriptor.gtype);yield i}}function link(e,t,n){t.parent=e,n?(t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:e.first=t,n.prev=t):(t.prev=e.last,t.next=null,e.last?e.last.next=t:e.first=t,e.last=t)}function unlink(e){let t=e.parent;t&&(e.prev?e.prev.next=e.next:t.first=e.next,e.next?e.next.prev=e.prev:t.last=e.prev,e.prev=null,e.next=null,e.parent=null)}function attach(e,r){if(!e.widget)return;materialize(r),ensureWrapper(e,r),refuseOccupiedSlot(e,r);let i=e.foreign.length>0?e.foreign.filter(t=>t.get_parent()===e.widget):e.foreign,a=i.length>0?i[i.length-1]:null,o=i.length;for(let n of siblingsFrom(e.first,e)){if(n===r)break;n.kind!==`element`||!n.attached||(a=t(n),o+=1)}let s=[];for(let t of siblingsFrom(r.next,e))t.kind===`element`&&t.attached&&s.push(t);n({parent:e,child:r,prevWidget:a,index:o,following:s}),r.attached=!0}function refuseOccupiedSlot(t,n){let r=o(t,n);if(r&&!holdsOursInSlot(t,n.slot)&&appOccupant(t.widget,t.descriptor,r))throw e.occupiedSlot(t.descriptor.gtype,n.descriptor.gtype,r)}function holdsOursInSlot(e,t){for(let n of siblingsFrom(e.first,e))if(n.kind===`element`&&n.attached&&n.slot===t)return!0;return!1}function ensureWrapper(e,t){if(t.wrapper)return;let n=i(e.descriptor.children,t.widget);n&&(t.wrapper=n)}function insert(e,t,n=null){assertHostParent(t);let r=e.parent,i=e.next,a=n===e?i:n;e.parent&&remove(e),link(t,e,a);try{e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch(t){throw unlink(e),r&&restore(e,r,i),t}}function assertHostParent(t){if(!isHostElement(t))throw e.notAHostParent(describeValue(t))}function isHostElement(e){let t=e;return!!t&&t.kind===`element`&&typeof t.descriptor==`object`}function describeValue(e){if(e==null)return String(e);if(typeof e!=`object`)return`a ${typeof e}`;let t=e.tagName;if(typeof t==`string`)return`a DOM element <${t.toLowerCase()}>`;let n=e.constructor?.$gtype,r=n?S.type_name(n)??`an unnamed GType`:null;if(r!==null&&r!==`JSObject`)return r;let i=e.constructor?.name;return i&&i!==`Object`?`a ${i}`:`a plain object`}function restore(e,t,n){try{link(t,e,n),e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch{unlink(e)}}function restoreTextSink(e){let t=e.descriptor.textSink;if(!t||e.destroyed||!e.widget)return;let n=e.descriptor.children;if(n.kind!==`single`||holdsOursInSlot(e,null)||c(e.widget,n.set))return;let r=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),i=e.props[t]??e.props[r];if(typeof i!=`string`||i===``)return;let a=v(g(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,t);l();try{e.widget.set_property(t,h(a,i,e.descriptor.gtype))}finally{d()}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(a(t,e),e.attached=!1,e.wrapper&&=(e.wrapper.set_child(null),null),restoreTextSink(t)),unlink(e),t&&e.kind===`text`&&flushText(t)}function destroyChildren(e){for(let t of childSnapshot(e))destroy(t)}function disconnectHandlers(e){u(e),e.listeners.clear()}function destroy(e){if(e.kind===`element`&&(destroyChildren(e),u(e),e.listeners.clear()),remove(e),e.kind===`element`){let t=e.widget;t&&typeof t.destroy==`function`&&typeof t.get_parent==`function`&&t.get_parent()===null&&t.destroy(),e.widget=null,e.wrapper=null,e.props={},e.layout=null,e.textFromChildren=!1,e.destroyed=!0}}function mountRoot(e,t){materialize(e),insert(e,adopt(t))}function widgetOf(t){if(t.kind!==`element`)throw e.notAnElement(t.kind);if(t.destroyed)throw e.destroyedNode(t.descriptor.gtype);return materialize(t)}const createDetachedContainer=()=>adopt(r());function adopt(t){let n=t.constructor.$gtype,r=x(n);if(!r)throw e.unknownTag(gtypeNameOf(t));return{kind:`element`,descriptor:r,widget:t,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!0,destroyed:!1,foreign:adoptedChildren(t,r)}}function adoptedChildren(e,t){let n=s(t.children);if(n.length===0)return directChildren(e);let r=[];for(let i of n){let n=appOccupant(e,t,i);n&&r.push(n)}return r}function appOccupant(e,t,n){let r=c(e,n);if(!r)return null;let i=t.textSink;if(!i)return r;let a=e[i.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())];return typeof a==`string`&&a!==``?null:r}function directChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtypeNameOf=e=>S.type_name(e.constructor.$gtype),parentNode=e=>e.parent,firstChild=e=>e.first,nextSibling=e=>e.next,prevSibling=e=>e.prev;export{adopt,createAnchor,createDetachedContainer,createElement,createText,describeValue,destroy,destroyChildren,disconnectHandlers,firstChild,insert,isHostElement,isText,materialize,mountRoot,nextSibling,parentNode,prevSibling,remove,setElementText,setEventHandler,setProp,setSlot,setText,widgetOf};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{GtkHostError as e}from"./errors.js";import{clearRegistry as t,hasWidget as n,lookupWidget as r,nearestRegistered as i,registerWidget as a,registerWidgets as o,registeredTags as s}from"./registry.js";import{ADW_DESCRIPTORS as c}from"./descriptors/adw.js";import{GTK_DESCRIPTORS as l}from"./descriptors/gtk.js";import{BUILTIN_DESCRIPTORS as u,registerBuiltinWidgets as d}from"./descriptors/index.js";import{addressOf as f,reorderMode as p}from"./policies.js";import{isEventProp as m,toSignalName as h}from"./signals.js";import{constructOnlyNames as g,isConstructOnly as _,isWritable as v,paramSpecs as y,toPropertyName as b}from"./props.js";import{clearContainer as x,createAnchor as S,createElement as C,createText as w,destroy as T,firstChild as E,insert as D,isText as O,materialize as k,mountRoot as A,nextSibling as j,parentNode as M,prevSibling as N,remove as P,setElementText as F,setEventHandler as I,setProp as L,setSlot as R,setText as z}from"./host.js";import"./types.js";export{c as ADW_DESCRIPTORS,u as BUILTIN_DESCRIPTORS,l as GTK_DESCRIPTORS,e as GtkHostError,f as addressOf,x as clearContainer,t as clearRegistry,g as constructOnlyNames,S as createAnchor,C as createElement,w as createText,T as destroy,E as firstChild,n as hasWidget,D as insert,_ as isConstructOnly,m as isEventProp,O as isText,v as isWritable,r as lookupWidget,k as materialize,A as mountRoot,i as nearestRegistered,j as nextSibling,y as paramSpecs,M as parentNode,N as prevSibling,d as registerBuiltinWidgets,a as registerWidget,o as registerWidgets,s as registeredTags,P as remove,p as reorderMode,F as setElementText,I as setEventHandler,L as setProp,R as setSlot,z as setText,b as toPropertyName,h as toSignalName};
1
+ import{GtkHostError as e}from"./errors.js";import{addressOf as t,reorderMode as n}from"./policies.js";import{isEventProp as r,toSignalName as i}from"./signals.js";import{constructOnlyNames as a,isConstructOnly as o,isWritable as s,lookupEnumNick as c,paramSpecs as l,toPropertyName as u}from"./props.js";import{assertInjective as d,tagOf as f}from"./tags.js";import{clearRegistry as p,hasWidget as m,lookupWidget as h,nearestRegistered as g,registerWidget as _,registerWidgets as v,registeredTags as y}from"./registry.js";import{adopt as b,createAnchor as x,createDetachedContainer as S,createElement as C,createText as w,destroy as T,destroyChildren as E,disconnectHandlers as D,firstChild as O,insert as k,isHostElement as A,isText as j,materialize as M,mountRoot as N,nextSibling as P,parentNode as F,prevSibling as I,remove as L,setElementText as R,setEventHandler as z,setProp as B,setSlot as V,setText as H,widgetOf as U}from"./host.js";import{GENERATED_PROVENANCE as W,GENERATED_WIDGETS as G}from"./generated/widgets.js";import{ADW_DESCRIPTORS as K}from"./descriptors/adw.js";import{GTK_DESCRIPTORS as q}from"./descriptors/gtk.js";import{BUILTIN_DESCRIPTORS as J,CURATED_DESCRIPTORS as Y,mergeGenerated as X,registerBuiltinWidgets as Z,tableProvenance as Q}from"./descriptors/index.js";import"./types.js";import{probeEnabled as $,runHostProbe as ee,runHostProbeApp as te}from"./probe.js";export{K as ADW_DESCRIPTORS,J as BUILTIN_DESCRIPTORS,Y as CURATED_DESCRIPTORS,W as GENERATED_PROVENANCE,G as GENERATED_WIDGETS,q as GTK_DESCRIPTORS,e as GtkHostError,t as addressOf,b as adopt,d as assertInjective,p as clearRegistry,a as constructOnlyNames,x as createAnchor,S as createDetachedContainer,C as createElement,w as createText,T as destroy,E as destroyChildren,D as disconnectHandlers,O as firstChild,m as hasWidget,k as insert,o as isConstructOnly,r as isEventProp,A as isHostElement,j as isText,s as isWritable,c as lookupEnumNick,h as lookupWidget,M as materialize,X as mergeGenerated,N as mountRoot,g as nearestRegistered,P as nextSibling,l as paramSpecs,F as parentNode,I as prevSibling,$ as probeEnabled,Z as registerBuiltinWidgets,_ as registerWidget,v as registerWidgets,y as registeredTags,L as remove,n as reorderMode,ee as runHostProbe,te as runHostProbeApp,R as setElementText,z as setEventHandler,B as setProp,V as setSlot,H as setText,Q as tableProvenance,f as tagOf,u as toPropertyName,i as toSignalName,U as widgetOf};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";const e=`@gjsify/gtk-host/jsx-runtime is a TYPE surface, not an automatic JSX runtime. Set "jsx": "preserve" and compile with babel-preset-solid (Solid) or the Vue SFC compiler (Vue) — those emit the renderer calls. With "jsx": "react-jsx" TypeScript emits jsx()/jsxs() calls instead, and no GTK tree can come out of them.`;function jsx(){throw Error(e)}function jsxs(){throw Error(e)}function jsxDEV(){throw Error(e)}function Fragment(){throw Error(e)}export{Fragment,jsx,jsxDEV,jsxs};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import n from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t){if(e.kind!==`indexed`||!e.wrap)return null;if(e.wrap===`list-box-row`){if(t instanceof n.ListBoxRow)return null;let e=new n.ListBoxRow;return e.set_child(t),e}if(t instanceof n.FlowBoxChild)return null;let r=new n.FlowBoxChild;return r.set_child(t),r}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`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}}function appendChild(e,n,r){let i=e.descriptor.children,a=addressOf(n);switch(i.kind){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`){let slotOf=e=>e.slot??i.defaultSlot,e=slotOf(t);if(i.slots[e]?.startsWith(`set_`))return;a=n.filter(t=>slotOf(t)===e)}for(let t of a)detachChild(e,t,r);for(let t of a)appendChild(e,t,r)}function detachChild(e,t,n){let r=e.descriptor.children,i=t.wrapper??t.widget;if(i)switch(r.kind){case`none`:return;case`single`:clearIfCurrent(n,r.set,i);return;case`slotted`:{let e=r.slots[t.slot??r.defaultSlot];if(e?.startsWith(`set_`)){clearIfCurrent(n,e,i);return}n[r.remove](i);return}case`ordered`:case`indexed`:case`keyed`:case`coords`:n[r.remove](i);return}}function clearIfCurrent(e,t,n){let r=t.replace(/^set_/,`get_`),i=typeof e[r]==`function`?e[r]():void 0;(i===void 0||i===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`ordered`:return e.reorder;case`indexed`:return`native`;case`slotted`:case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`}}export{addressOf,insertChild,makeWrapper,removeChild,reorderMode};
1
+ import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import n from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t){if(e.kind!==`indexed`||!e.wrap)return null;if(e.wrap===`list-box-row`){if(t instanceof n.ListBoxRow)return null;let e=new n.ListBoxRow;return e.set_child(t),e}if(t instanceof n.FlowBoxChild)return null;let r=new n.FlowBoxChild;return r.set_child(t),r}const makeDetachedContainer=()=>new n.Box;function unhandledPolicy(e){throw Error(`unhandled child policy: ${JSON.stringify(e)}`)}function setterSlotOf(e,t){let n=e.descriptor.children;if(n.kind===`single`)return n.set;if(n.kind!==`slotted`)return null;let r=n.slots[t.slot??n.defaultSlot];return r?.startsWith(`set_`)===!0?r:null}function setterSlots(e){return e.kind===`single`?[e.set]:e.kind===`slotted`?Object.values(e.slots).filter(e=>e.startsWith(`set_`)):[]}function slotOccupant(e,t){let n=e,r=t.replace(/^set_/,`get_`);if(typeof n[r]==`function`)return n[r]()??null}function insertChild(n){try{placeChild(n)}catch(r){throw r instanceof e?r:t.rejectedChild(n.parent.descriptor.gtype,n.child.descriptor.gtype,r.message)}}function placeChild(e){let{parent:n,child:r}=e,i=n.descriptor.children,a=n.widget,o=addressOf(r);switch(i.kind){case`none`:throw t.unclaimedChild(n.descriptor.gtype,r.descriptor.gtype);case`uncurated`:throw t.uncuratedPlacement(n.descriptor.gtype,r.descriptor.gtype);case`single`:a[i.set](o);return;case`indexed`:a[i.insert](o,e.index);return;case`coords`:appendChild(n,r,a);return;case`ordered`:if(i.after){a[i.after](o,e.prevWidget??null);return}case`slotted`:case`keyed`:appendChild(n,r,a),rotateTail(n,r,e.following,a);return;default:return unhandledPolicy(i)}}function appendChild(e,n,r){let i=e.descriptor.children,a=addressOf(n);switch(i.kind){case`uncurated`:throw t.uncuratedPlacement(e.descriptor.gtype,n.descriptor.gtype);case`ordered`:r[i.append](a);return;case`slotted`:{let o=n.slot??i.defaultSlot,s=i.slots[o];if(!s)throw t.unknownSlot(e.descriptor.gtype,o,Object.keys(i.slots));r[s](a);return}case`keyed`:{let e=n.layout?.[i.nameFrom]??n.slot,t=n.layout?.title;i.titled?r[i.add](a,e??null,t??e??``):r[i.add](a);return}case`coords`:{let e=n.layout??{};r[i.attach](a,e.column??0,e.row??0,e.columnSpan??1,e.rowSpan??1);return}default:throw t.unclaimedChild(e.descriptor.gtype,n.descriptor.gtype)}}function rotateTail(e,t,n,r){let i=e.descriptor.children,a=n;if(i.kind===`slotted`){if(setterSlotOf(e,t))return;let slotOf=e=>e.slot??i.defaultSlot,r=slotOf(t);a=n.filter(e=>slotOf(e)===r)}for(let t of a)detachChild(e,t,r);for(let t of a)appendChild(e,t,r)}function detachChild(e,t,n){let r=e.descriptor.children,i=t.wrapper??t.widget;if(i)switch(r.kind){case`none`:case`uncurated`:return;case`single`:clearIfCurrent(n,r.set,i);return;case`slotted`:{let a=setterSlotOf(e,t);if(a){clearIfCurrent(n,a,i);return}n[r.remove](i);return}case`ordered`:case`indexed`:case`keyed`:case`coords`:n[r.remove](i);return;default:return unhandledPolicy(r)}}function clearIfCurrent(e,t,n){let r=slotOccupant(e,t);(r===void 0||r===n)&&e[t](null)}function removeChild(e,t){let n=e.widget;n&&t.attached&&detachChild(e,t,n)}function reorderMode(e){switch(e.kind){case`uncurated`:return`n/a`;case`ordered`:return e.reorder;case`indexed`:return`native`;case`slotted`:case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`;default:return unhandledPolicy(e)}}export{addressOf,insertChild,makeDetachedContainer,makeWrapper,removeChild,reorderMode,setterSlotOf,setterSlots,slotOccupant,unhandledPolicy};
@@ -0,0 +1 @@
1
+ import"./_virtual/_rolldown/runtime.js";import{installDiagnosticsGate as e}from"./conformance/diagnostics.js";import t from"gi://Gtk?version=4.0";import n from"gi://Adw?version=1";import r from"gi://GLib";import i from"system";function probeEnabled(){let e=r.getenv(`GJSIFY_HOST_PROBE`);if(e===null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const a=`<gtk-host probe: recorder self-check>`;function recorderIsHonest(e,t){let n=t.length;e(a,!1);let r=t.length===n+1&&t[n]===a;t.length=n,e(a,!0);let i=t.length===n;return t.length=n,r&&i?null:r?`the probe recorder records a PASSING check as a failure, so every assertion below is a false alarm`:`the probe recorder did not record a failed check, so every assertion below is unverifiable`}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 t.init(),i.exit(await runHostProbe(e));let r=new n.Application({application_id:e.applicationId});r.connect(`activate`,()=>{r.hold(),(async()=>{try{let t=await runHostProbe(e);if(t!==0)return i.exit(t);e.present(e.build(r))}catch(t){return printerr(`JS ERROR: ${e.applicationId} probe threw: ${String(t)}`),i.exit(1)}finally{r.release()}})()}),await r.runAsync([])}export{probeEnabled,runHostProbe,runHostProbeApp};
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://Adw?version=1";import r from"gi://Gtk?version=4.0";import i from"gi://Gdk?version=4.0";import a from"gi://Pango";const o=[[`Gtk`,r],[`Adw`,n],[`Gdk`,i],[`Pango`,a],[`G`,t]];function toPropertyName(e){return e.includes(`-`)?e:e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}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}}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}function defaultValue(e){return e.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,defaultValue,isConstructOnly,isWritable,paramSpecs,requireSpec,toPropertyName};
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};
@@ -0,0 +1 @@
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{jsxDEV as r}from"react/jsx-dev-runtime";const i=t,a=n,o=r;export{e as Fragment,i as jsx,o as jsxDEV,a as jsxs};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import t from"gi://GObject";const n=new Map;function registerWidget(e){n.set(e.gtype,e)}function registerWidgets(e){for(let t of e)registerWidget(t)}function lookupWidget(t){let r=n.get(t);if(!r)throw e.unknownTag(t);return r}const hasWidget=e=>n.has(e),registeredTags=()=>[...n.keys()].sort();function nearestRegistered(e){let r,i=-1;for(let a of n.values()){let n;try{n=a.ctor().$gtype}catch{continue}if(!t.type_is_a(e,n))continue;let o=depthOf(n);o>i&&(r=a,i=o)}return r}function depthOf(e){let n=0,r=e;for(;r;){let e=t.type_parent(r);if(!e)break;n+=1,r=e}return n}function clearRegistry(){n.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";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 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";function toSignalName(e,t){if(t?.[e])return t[e];if(e.startsWith(`on:`))return e.slice(3);let n=e.slice(2);return n.startsWith(`Notify`)?`notify::${kebab(n.slice(6))}`:kebab(n)}const kebab=e=>e.replace(/^./,e=>e.toLowerCase()).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function isEventProp(e){return e.startsWith(`on:`)||e.length>2&&e.startsWith(`on`)&&e[2]===e[2].toUpperCase()&&e[2]!==e[2].toLowerCase()}let t=0;const beginHostWrite=()=>{t+=1},endHostWrite=()=>{--t},inHostWrite=()=>t>0;function setHandler(t,n,r){let i=toSignalName(n,t.descriptor.eventAliases),a=t.handlers.get(i),o=t.widget;if(a&&a.prop!==n&&r)throw e.signalTaken(t.descriptor.gtype,n,a.prop,i);if(a&&(o.disconnect(a.id),t.handlers.delete(i)),!r)return;let s=i.startsWith(`notify::`),c=o.connect(i,(...e)=>{if(!(s&&inHostWrite()))return r(...e.slice(1))});t.handlers.set(i,{id:c,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,setHandler,toSignalName};
1
+ import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";const t=/(?:Once|Passive|Capture)$/;function parseEventProp(n,r){if(r?.[n])return{signal:r[n],once:!1};if(n.startsWith(`on:`))return{signal:n.slice(3),once:!1};let i=n.slice(2),a=!1;for(let r=t.exec(i);r;r=t.exec(i)){let t=r[0];if(t!==`Once`)throw e.eventModifier(n,t.toLowerCase());a=!0,i=i.slice(0,i.length-t.length)}return i===`Notify`?{signal:`notify`,once:a}:i.startsWith(`Notify`)?{signal:`notify::${kebab(i.slice(6))}`,once:a}:{signal:kebab(i),once:a}}const toSignalName=(e,t)=>parseEventProp(e,t).signal,kebab=e=>e.replace(/^./,e=>e.toLowerCase()).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function isEventProp(e){return e.startsWith(`on:`)||e.length>2&&e.startsWith(`on`)&&e[2]===e[2].toUpperCase()&&e[2]!==e[2].toLowerCase()}let n=0;const beginHostWrite=()=>{n+=1},endHostWrite=()=>{--n},inHostWrite=()=>n>0;function setHandler(t,n,r){let{signal:i,once:a}=parseEventProp(n,t.descriptor.eventAliases),o=t.handlers.get(i),s=t.widget;if(o&&o.prop!==n&&r)throw e.signalTaken(t.descriptor.gtype,n,o.prop,i);if(o&&(s.disconnect(o.id),t.handlers.delete(i)),!r)return;let c=i.startsWith(`notify::`),l=s.connect(i,(...e)=>{if(!(c&&inHostWrite()))return a&&t.handlers.get(i)?.id===l&&(s.disconnect(l),t.handlers.delete(i)),r(...e.slice(1))});t.handlers.set(i,{id:l,prop:n})}function clearHandlers(e){if(!e.widget){e.handlers.clear();return}let t=e.widget;for(let{id:n}of e.handlers.values())t.disconnect(n);e.handlers.clear()}export{beginHostWrite,clearHandlers,endHostWrite,inHostWrite,isEventProp,parseEventProp,setHandler,toSignalName};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";var UnknownUtilityError=class extends Error{constructor(e,t){super(`@gjsify/gtk-host/style: "${e}" — ${t}`),this.name=`UnknownUtilityError`,this.utility=e}};export{UnknownUtilityError};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=[[`background-color`,`rgb(255 0 0)`],[`color`,`#112233`],[`opacity`,`0.7`],[`border-radius`,`8px`],[`border-top-left-radius`,`8px`],[`border-top-right-radius`,`8px`],[`border-bottom-left-radius`,`8px`],[`border-bottom-right-radius`,`8px`],[`border-width`,`1px`],[`border-top-width`,`1px`],[`border-right-width`,`1px`],[`border-bottom-width`,`1px`],[`border-left-width`,`1px`],[`border-style`,`solid`],[`border-color`,`#abcdef`],[`border`,`1px solid #abcdef`],[`border-bottom`,`1px solid #abcdef`],[`box-shadow`,`0 1px 2px rgba(0,0,0,0.2)`],[`font-size`,`14px`],[`font-weight`,`700`],[`font-family`,`Cantarell`],[`font-style`,`italic`],[`letter-spacing`,`1px`],[`line-height`,`1.4`],[`text-decoration-line`,`underline`],[`text-transform`,`uppercase`],[`margin`,`8px`],[`margin-top`,`8px`],[`margin-right`,`8px`],[`margin-bottom`,`8px`],[`margin-left`,`8px`],[`padding`,`8px`],[`padding-top`,`8px`],[`padding-right`,`8px`],[`padding-bottom`,`8px`],[`padding-left`,`8px`],[`min-width`,`10px`],[`min-height`,`10px`],[`transform`,`scale(1.1)`],[`transition`,`all 100ms`],[`caret-color`,`#ff0000`],[`outline-style`,`solid`]],t=[[`text-align`,`center`],[`display`,`flex`],[`flex-direction`,`row`],[`gap`,`8px`],[`position`,`absolute`],[`width`,`100px`],[`height`,`100px`],[`justify-content`,`center`],[`align-items`,`center`],[`overflow`,`hidden`],[`z-index`,`1`],[`top`,`0`],[`right`,`0`],[`bottom`,`0`],[`left`,`0`],[`margin-start`,`8px`],[`margin-end`,`8px`],[`padding-start`,`8px`],[`padding-end`,`8px`]],n=new Set(e.map(([e])=>e));export{e as GTK_CSS_PROBES,n as GTK_CSS_PROPERTIES,t as NOT_GTK_CSS};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e=[[`GtkWidget`,`margin-top`,`gint`],[`GtkWidget`,`margin-bottom`,`gint`],[`GtkWidget`,`margin-start`,`gint`],[`GtkWidget`,`margin-end`,`gint`],[`GtkWidget`,`halign`,`GtkAlign`],[`GtkWidget`,`valign`,`GtkAlign`],[`GtkWidget`,`hexpand`,`gboolean`],[`GtkWidget`,`vexpand`,`gboolean`],[`GtkWidget`,`width-request`,`gint`],[`GtkWidget`,`height-request`,`gint`],[`GtkWidget`,`overflow`,`GtkOverflow`],[`GtkWidget`,`visible`,`gboolean`],[`GtkBox`,`orientation`,`GtkOrientation`],[`GtkBox`,`spacing`,`gint`],[`GtkLabel`,`xalign`,`gfloat`],[`GtkLabel`,`justify`,`GtkJustification`]],t=[[`GtkWidget`,`margin-left`],[`GtkWidget`,`margin-right`],[`GtkWidget`,`padding`],[`GtkWidget`,`padding-top`],[`GtkBox`,`padding`],[`GtkBox`,`margin-left`],[`GtkWidget`,`gap`],[`GtkBox`,`gap`],[`GtkWidget`,`flex`],[`GtkWidget`,`orientation`],[`GtkWidget`,`spacing`],[`GtkLabel`,`orientation`],[`GtkLabel`,`spacing`],[`GtkCenterBox`,`spacing`],[`GtkFlowBox`,`spacing`],[`GtkWidget`,`xalign`],[`GtkBox`,`xalign`]],n=new Set(e.map(([,e])=>e));export{n as GTK_WIDGET_PROPERTIES,e as GTK_WIDGET_PROPERTY_PROBES,t as NOT_GTK_WIDGET_PROPERTIES};
@@ -0,0 +1 @@
1
+ import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROBES as t,GTK_CSS_PROPERTIES as n,NOT_GTK_CSS as r}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as i,GTK_WIDGET_PROPERTY_PROBES as a,NOT_GTK_WIDGET_PROPERTIES as o}from"./gtk-props.js";import{MINIMAL_TOKENS as s,lookupToken as c,requireToken as l}from"./tokens.js";import{PAINT_PROPERTIES as u,partitionPaint as d,resolvePaintUtility as f}from"./paint.js";import{LAYOUT_PROPERTIES as p,partitionLayout as m,resolveLayoutUtility as h}from"./layout.js";import{partition as g,resolveUtilities as _,resolveUtility as v}from"./resolve.js";import{StyleSheet as y,StyleSheetError as b,VARIANT_PSEUDO as x}from"./sheet.js";export{t as GTK_CSS_PROBES,n as GTK_CSS_PROPERTIES,i as GTK_WIDGET_PROPERTIES,a as GTK_WIDGET_PROPERTY_PROBES,p as LAYOUT_PROPERTIES,s as MINIMAL_TOKENS,r as NOT_GTK_CSS,o as NOT_GTK_WIDGET_PROPERTIES,u as PAINT_PROPERTIES,y as StyleSheet,b as StyleSheetError,e as UnknownUtilityError,x as VARIANT_PSEUDO,c as lookupToken,g as partition,m as partitionLayout,d as partitionPaint,l as requireToken,h as resolveLayoutUtility,f as resolvePaintUtility,_ as resolveUtilities,v as resolveUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as n}from"./gtk-props.js";import{requireToken as r}from"./tokens.js";const i="GTK expresses main-axis growth as the boolean `hexpand`/`vexpand`, so there is no growth factor, no shrink factor and no flex basis to carry. `flex-1` is the only spelling with a GTK meaning",a="GTK's box gives leftover main-axis space to the children that expand; it has no per-gap distribution mode, and `Gtk.CenterBox` has exactly three slots. Unlike `justify-between`, no child count makes this expressible, so it is refused here rather than deferred to the shadow tree",o="scrolling is a WIDGET on GTK, not an overflow mode: wrap the element in a `Gtk.ScrolledWindow` (React Native `ScrollView`). `Gtk.Overflow` has exactly VISIBLE and HIDDEN (measured)",s="GTK has no percentage size: a widget requests a MINIMUM in pixels (`width-request`) or expands to fill what it is given (`hexpand`). `w-full`/`h-full` are the only fractions with an exact GTK meaning",c={m:[`marginTop`,`marginRight`,`marginBottom`,`marginLeft`],mt:[`marginTop`],mr:[`marginRight`],mb:[`marginBottom`],ml:[`marginLeft`],mx:[`marginLeft`,`marginRight`],my:[`marginTop`,`marginBottom`],ms:[`marginStart`],me:[`marginEnd`]},l={p:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],pt:[`paddingTop`],pr:[`paddingRight`],pb:[`paddingBottom`],pl:[`paddingLeft`],px:[`paddingLeft`,`paddingRight`],py:[`paddingTop`,`paddingBottom`]},u={inset:[`top`,`right`,`bottom`,`left`],top:[`top`],right:[`right`],bottom:[`bottom`],left:[`left`]},d={start:`flex-start`,end:`flex-end`,center:`center`,stretch:`stretch`,baseline:`baseline`},f={start:`flex-start`,end:`flex-end`,center:`center`,between:`space-between`,around:`space-around`,evenly:`space-evenly`},fill=(e,t)=>{let n={};for(let r of e)n[r]=t;return n};function requireSize(t,n,r,i){let a=t[n],o=a?.[r]??t.spacing?.[r];if(o!==void 0)return o;let s=[...new Set([...Object.keys(a??{}),...Object.keys(t.spacing??{})])].sort().join(`, `);throw new e(i,`"${r}" is in neither the ${n} nor the spacing scale. Known: ${s===``?`(neither scale is configured)`:s}`)}function resolveLayoutUtility(t,n){switch(t){case`flex-1`:case`grow`:return{flexGrow:`1`};case`flex-row`:return{flexDirection:`row`};case`flex-col`:return{flexDirection:`column`};case`flex-nowrap`:return{};case`flex-wrap`:case`flex-wrap-reverse`:throw new e(t,"a `Gtk.Box` cannot wrap. Wrapping is a different widget — `Gtk.FlowBox` — and swapping the widget under an element is L2 widget selection, not a style property");case`flex-row-reverse`:case`flex-col-reverse`:throw new e(t,"`Gtk.Box` has no reversed orientation (`GtkOrientation` is HORIZONTAL and VERTICAL, measured). Reverse the children instead — the shadow tree is the order");case`absolute`:return{position:`absolute`};case`relative`:return{position:`relative`};case`hidden`:return{display:`none`};case`overflow-hidden`:return{overflow:`hidden`};case`overflow-visible`:return{overflow:`visible`};case`overflow-scroll`:case`overflow-auto`:throw new e(t,o);case`w-full`:return{width:`100%`};case`h-full`:return{height:`100%`}}let p=t.indexOf(`-`),m=p===-1?t:t.slice(0,p),h=p===-1?``:t.slice(p+1),g=c[m];if(g!==void 0)return fill(g,r(n.spacing,h,t,`spacing`));let _=l[m];if(_!==void 0)return fill(_,r(n.spacing,h,t,`spacing`));let v=u[m];if(v!==void 0)return fill(v,r(n.spacing,h,t,`spacing`));switch(m){case`ps`:case`pe`:throw new e(t,"GTK has no logical padding in either mechanism — `padding-start` is not a CSS property (measured) and no GTK class installs a padding property at all — so it cannot be expressed even approximately. Use `pl-*`/`pr-*`");case`flex`:case`grow`:case`shrink`:case`basis`:throw new e(t,i);case`items`:{let e=d[h];if(e===void 0)throw unknownToken(t,h,d);return{alignItems:e}}case`self`:{let n=h===`baseline`?void 0:d[h];if(n===void 0)throw h===`baseline`?new e(t,"a baseline is shared by a whole row, so GTK carries it on the BOX as `baseline-position` (measured on `Gtk.Box`, absent from `Gtk.Widget`) rather than per child. Use `items-baseline` on the parent"):unknownToken(t,h,d);return{alignSelf:n}}case`justify`:{if(h===`around`||h===`evenly`)throw new e(t,a);let n=f[h];if(n===void 0)throw unknownToken(t,h,f);return{justifyContent:n}}case`gap`:return h.startsWith(`x-`)?{columnGap:r(n.spacing,h.slice(2),t,`spacing`)}:h.startsWith(`y-`)?{rowGap:r(n.spacing,h.slice(2),t,`spacing`)}:{gap:r(n.spacing,h,t,`spacing`)};case`w`:case`h`:{if(h.includes(`/`))throw new e(t,s);let r=m===`w`?`width`:`height`;return{[r]:requireSize(n,r,h,t)}}case`text`:if(h===`left`||h===`center`||h===`right`||h===`justify`)return{textAlign:h};if(h===`start`||h===`end`)throw new e(t,"GTK aligns text PHYSICALLY: `Gtk.Label:xalign` is 0 = left, and `GtkJustification` has exactly LEFT, RIGHT, CENTER and FILL (measured). There is no start/end spelling to map onto. Use `text-left`/`text-right`");return null}return null}const unknownToken=(t,n,r)=>new e(t,`"${n}" is not a value of this family. Known: ${Object.keys(r).join(`, `)}`);function emitCss(n,r,i){if(!t.has(r))throw new e(r,`is not a property GTK accepts in a stylesheet — see gtk-css.ts`);n.css.push(`${r}: ${i}`)}function emitProp(t,r,i){if(!n.has(r))throw new e(r,`is not a property any GTK class installs — see gtk-props.ts`);t.props[r]=i}const p=/^(-?\d+(?:\.\d+)?)(?:px)?$/;function pixels(t,n){let r=p.exec(t.trim());if(r===null)throw new e(n,`"${t}" is not a pixel length. GTK's "${n}" is a gint of device pixels (measured, gtk-props.ts) with no unit conversion behind it, so only "12px" and "12" can be stored`);return Math.round(Number(r[1]))}function oneOf(t,n,r){if(n.includes(t))return t;throw new e(r,`"${t}" is not a value this partition routes. Known: ${n.join(`, `)}`)}const edgeRoute=t=>(n,r)=>{let i=r.intent.overlay;if(i===void 0||i.role!==`child`)throw new e(t,"only offsets an element that is absolutely positioned, and this one is not. GTK has no relative offset: add `absolute` (which makes the parent a `Gtk.Overlay`), or express the distance as a margin");i.edges[t]=pixels(n,t)},m={marginTop:(e,t)=>emitProp(t,`margin-top`,pixels(e,`margin-top`)),marginBottom:(e,t)=>emitProp(t,`margin-bottom`,pixels(e,`margin-bottom`)),marginStart:(e,t)=>emitProp(t,`margin-start`,pixels(e,`margin-start`)),marginEnd:(e,t)=>emitProp(t,`margin-end`,pixels(e,`margin-end`)),marginLeft:(e,t)=>emitCss(t,`margin-left`,e),marginRight:(e,t)=>emitCss(t,`margin-right`,e),paddingTop:(e,t)=>emitCss(t,`padding-top`,e),paddingRight:(e,t)=>emitCss(t,`padding-right`,e),paddingBottom:(e,t)=>emitCss(t,`padding-bottom`,e),paddingLeft:(e,t)=>emitCss(t,`padding-left`,e),flexDirection:(e,t)=>emitProp(t,`orientation`,oneOf(e,[`row`,`column`],`flexDirection`)===`row`?`horizontal`:`vertical`),flexGrow:(t,n)=>{if(t!==`1`)throw new e(`flexGrow`,i);n.intent.expand=`main-axis`},alignItems:(e,t)=>{t.intent.alignChildren=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignItems`)},justifyContent:(t,n)=>{if(t===`space-around`||t===`space-evenly`)throw new e(`justifyContent`,a);n.intent.distribute=oneOf(t,[`flex-start`,`flex-end`,`center`,`space-between`],`justifyContent`)},alignSelf:(e,t)=>{t.intent.alignSelf=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignSelf`)},gap:(e,t)=>emitProp(t,`spacing`,pixels(e,`spacing`)),columnGap:(e,t)=>{t.intent.axisSpacing={axis:`horizontal`,pixels:pixels(e,`spacing`)}},rowGap:(e,t)=>{t.intent.axisSpacing={axis:`vertical`,pixels:pixels(e,`spacing`)}},width:(e,t)=>e===`100%`?emitProp(t,`hexpand`,!0):emitProp(t,`width-request`,pixels(percentGuard(e,`width`),`width-request`)),height:(e,t)=>e===`100%`?emitProp(t,`vexpand`,!0):emitProp(t,`height-request`,pixels(percentGuard(e,`height`),`height-request`)),overflow:(t,n)=>{if(t===`scroll`)throw new e(`overflow`,o);emitProp(n,`overflow`,oneOf(t,[`visible`,`hidden`],`overflow`))},display:(e,t)=>emitProp(t,`visible`,oneOf(e,[`flex`,`none`],`display`)===`flex`),position:(e,t)=>{t.intent.overlay=oneOf(e,[`relative`,`absolute`],`position`)===`absolute`?{role:`child`,edges:{}}:{role:`context`}},top:edgeRoute(`top`),right:edgeRoute(`right`),bottom:edgeRoute(`bottom`),left:edgeRoute(`left`),textAlign:(e,t)=>{t.intent.textAlign=oneOf(e,[`left`,`center`,`right`,`justify`],`textAlign`)}},h=new Set(Object.keys(m));function percentGuard(t,n){if(t.endsWith(`%`))throw new e(n,s);return t}function partitionLayout(t){let n=t.marginLeft!==void 0||t.marginRight!==void 0,r=t.marginStart!==void 0||t.marginEnd!==void 0;if(n&&r)throw new e(`margin`,"a physical horizontal margin (`ml-*`/`mr-*`/`mx-*`/`m-*`) becomes GTK CSS and a logical one (`ms-*`/`me-*`) becomes the widget property; GTK applies BOTH and they ADD, where CSS would have let one win. Spell the horizontal margin one way");let i=[`gap`,`columnGap`,`rowGap`].filter(e=>t[e]!==void 0);if(i.length>1)throw new e(i.join(` + `),"a `Gtk.Box` has ONE `spacing` (measured), so two gap spellings on one element ask for two spacings. Keep one");let a={css:[],props:{},intent:{}};for(let e of Object.keys(m)){let n=t[e];n!==void 0&&m[e](n,a)}return a}export{h as LAYOUT_PROPERTIES,partitionLayout,resolveLayoutUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{lookupToken as n,requireToken as r}from"./tokens.js";const i={backgroundColor:`background-color`,color:`color`,opacity:`opacity`,borderRadius:`border-radius`,borderTopLeftRadius:`border-top-left-radius`,borderTopRightRadius:`border-top-right-radius`,borderBottomLeftRadius:`border-bottom-left-radius`,borderBottomRightRadius:`border-bottom-right-radius`,borderWidth:`border-width`,borderTopWidth:`border-top-width`,borderRightWidth:`border-right-width`,borderBottomWidth:`border-bottom-width`,borderLeftWidth:`border-left-width`,borderColor:`border-color`,fontSize:`font-size`,fontWeight:`font-weight`,fontFamily:`font-family`,fontStyle:`font-style`,letterSpacing:`letter-spacing`,lineHeight:`line-height`,textDecorationLine:`text-decoration-line`,textTransform:`text-transform`},withAlpha=(t,n)=>{let r=Number(n);if(!Number.isFinite(r)||r<0||r>100)throw new e(`${t}/${n}`,`the alpha modifier must be 0–100, got "${n}"`);return`alpha(${t}, ${r/100})`};function resolvePaintUtility(t,i){if(t.includes(`:`))throw new e(t,`strip the variant prefix before resolving; this resolves the utility itself`);let c=t.lastIndexOf(`/`),l=c===-1?void 0:t.slice(c+1),u=c===-1?t:t.slice(0,c),colour=e=>l===void 0?e:withAlpha(e,l),noAlpha=()=>{if(l!==void 0)throw new e(t,`an alpha modifier only applies to a colour utility`)};switch(u){case`underline`:return noAlpha(),{textDecorationLine:`underline`};case`line-through`:return noAlpha(),{textDecorationLine:`line-through`};case`no-underline`:return noAlpha(),{textDecorationLine:`none`};case`uppercase`:return noAlpha(),{textTransform:`uppercase`};case`lowercase`:return noAlpha(),{textTransform:`lowercase`};case`capitalize`:return noAlpha(),{textTransform:`capitalize`};case`normal-case`:return noAlpha(),{textTransform:`none`};case`italic`:return noAlpha(),{fontStyle:`italic`};case`not-italic`:return noAlpha(),{fontStyle:`normal`};case`rounded`:return noAlpha(),{borderRadius:r(i.borderRadius,`DEFAULT`,t,`borderRadius`)};case`border`:return noAlpha(),{borderWidth:r(i.borderWidth,`DEFAULT`,t,`borderWidth`)}}let d=u.indexOf(`-`),f=d===-1?u:u.slice(0,d),p=d===-1?``:u.slice(d+1);switch(f){case`bg`:return{backgroundColor:colour(r(i.colors,p,t,`colors`))};case`opacity`:return noAlpha(),{opacity:r(i.opacity,p,t,`opacity`)};case`rounded`:{noAlpha();let e=a[p];return e===void 0?{borderRadius:r(i.borderRadius,p,t,`borderRadius`)}:{[e]:r(i.borderRadius,`DEFAULT`,t,`borderRadius`)}}case`border`:{let a=o[p];if(a!==void 0)return noAlpha(),{[a]:r(i.borderWidth,`DEFAULT`,t,`borderWidth`)};let s=n(i.borderWidth,p),c=n(i.colors,p);if(s!==void 0&&c!==void 0)throw new e(t,`"${p}" is in both the borderWidth and colors scales, so this utility is ambiguous`);if(s!==void 0)return noAlpha(),{borderWidth:s};if(c!==void 0)return{borderColor:colour(c)};throw new e(t,`"${p}" is in neither the borderWidth nor the colors scale`)}case`text`:{if(s.has(p))return null;let r=n(i.fontSize,p),a=n(i.colors,p);if(r!==void 0&&a!==void 0)throw new e(t,`"${p}" is in both the fontSize and colors scales, so this utility is ambiguous`);if(r!==void 0)return noAlpha(),{fontSize:r};if(a!==void 0)return{color:colour(a)};throw new e(t,`"${p}" is in neither the fontSize nor the colors scale`)}case`font`:{noAlpha();let r=n(i.fontWeight,p),a=n(i.fontFamily,p);if(r!==void 0&&a!==void 0)throw new e(t,`"${p}" is in both the fontWeight and fontFamily scales, so this utility is ambiguous`);if(r!==void 0)return{fontWeight:r};if(a!==void 0)return{fontFamily:a};throw new e(t,`"${p}" is in neither the fontWeight nor the fontFamily scale`)}case`tracking`:return noAlpha(),{letterSpacing:r(i.letterSpacing,p,t,`letterSpacing`)};case`leading`:return noAlpha(),{lineHeight:r(i.lineHeight,p,t,`lineHeight`)}}return null}const a={tl:`borderTopLeftRadius`,tr:`borderTopRightRadius`,bl:`borderBottomLeftRadius`,br:`borderBottomRightRadius`},o={t:`borderTopWidth`,r:`borderRightWidth`,b:`borderBottomWidth`,l:`borderLeftWidth`},s=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),c=new Set(Object.keys(i));function partitionPaint(n){let r=[];for(let[a,o]of Object.entries(n)){if(o===void 0)continue;let n=i[a];if(n===void 0)throw new e(a,`is not a property the paint partition routes`);if(!t.has(n))throw new e(a,`maps to "${n}", which GTK does not accept — see gtk-css.ts`);r.push(`${n}: ${o}`)}let a=r.some(e=>/^border(-(top|right|bottom|left))?-width:/.test(e)),o=r.some(e=>/^border(-(top|right|bottom|left))?-style:/.test(e));return a&&!o&&r.push(`border-style: solid`),r}export{i as CSS_NAME,c as PAINT_PROPERTIES,partitionPaint,resolvePaintUtility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{PAINT_PROPERTIES as t,partitionPaint as n,resolvePaintUtility as r}from"./paint.js";import{LAYOUT_PROPERTIES as i,partitionLayout as a,resolveLayoutUtility as o}from"./layout.js";function resolveUtility(t,n){let i=r(t,n);if(i!==null)return i;let a=o(t,n);if(a!==null)return a;throw new e(t,`is not a utility this vocabulary declares`)}function resolveUtilities(e,t){let n={};for(let r of e)Object.assign(n,resolveUtility(r,t));return n}function partition(r){let o={},s={};for(let[n,a]of Object.entries(r)){if(a===void 0)continue;let r=t.has(n)?o:i.has(n)?s:null;if(r===null)throw new e(n,`is not a property the style partition routes`);r[n]=a}let c=a(s);return{css:[...n(o),...c.css],props:c.props,intent:c.intent}}export{partition,resolveUtilities,resolveUtility};
@@ -0,0 +1,3 @@
1
+ import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Gdk?version=4.0";const n={active:`:active`,hover:`:hover`,focus:`:focus`,disabled:`:disabled`};var StyleSheetError=class extends Error{constructor(e){super(`@gjsify/gtk-host/style: ${e}`),this.name=`StyleSheetError`}};function hashName(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return`gjsify-s${t.toString(36)}`}const r=`gjsify-probe-8f3a91c4`,i=`.${r} { color: rgb(1 2 3); }`;var StyleSheet=class{#e=new e.CssProvider;#t=new Map;#n=!1;#r=!1;#i;constructor(e={}){this.#i=e}classFor(e,t={}){if(e.length===0&&Object.keys(t).length===0)throw new StyleSheetError(`classFor was given no declarations — an empty class would name nothing`);let r=e.join(`; `),i=[],a=hashName(`${r}|${Object.entries(t).map(([e,t])=>`${e}{${t.join(`; `)}}`).sort().join(``)}`);if(this.#t.get(a)!==void 0)return a;e.length>0&&i.push(`.${a} { ${r}; }`);for(let[e,r]of Object.entries(t)){let t=n[e];if(t===void 0)throw new StyleSheetError(`"${e}:" is not a variant this sheet can express. Known: ${Object.keys(n).sort().join(`, `)}. A variant becomes a GTK CSS pseudo-class, so one without a pseudo-class equivalent needs a different mechanism.`);r.length!==0&&i.push(`.${a}${t} { ${r.join(`; `)}; }`)}let o=i.join(`
2
+ `);return this.#o(o),this.#t.set(a,o),this.#a(),a}toString(){return[...this.#t.values()].join(`
3
+ `)}get size(){return this.#t.size}flush(){if(this.#r=!1,this.#e.load_from_string(this.toString()),this.#n)return;let n=this.#i.display??t.Display.get_default();if(n===null)throw new StyleSheetError(`there is no Gdk display to install the stylesheet on. Construct the sheet after Gtk.init(), or pass one explicitly.`);e.StyleContext.add_provider_for_display(n,this.#e,this.#i.priority??e.STYLE_PROVIDER_PRIORITY_APPLICATION),this.#n=!0}#a(){this.#r||(this.#r=!0,queueMicrotask(()=>{this.#r&&this.flush()}))}#o(t){let n=new e.CssProvider,a=[],o=n.connect(`parsing-error`,(e,t,n)=>{a.push(n.message)});if(n.load_from_string(`${t}\n${i}`),n.disconnect(o),!n.to_string().includes(r))throw new StyleSheetError(`a generated rule would disable every rule after it in the document, so it is refused:\n ${t}\n`+(a.length>0?` GTK said: ${a.join(`; `)}`:` GTK reported no error, which is why this is checked by containment rather than by the error signal.`));if(a.length>0)throw new StyleSheetError(`GTK refused a generated declaration:\n ${t}\n ${a.join(`; `)}`)}};export{StyleSheet,StyleSheetError,n as VARIANT_PSEUDO};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";const t={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,sm:`2px`,DEFAULT:`4px`,md:`6px`,lg:`8px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`},fontSize:{sm:`12px`,base:`14px`,lg:`18px`,xl:`24px`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},opacity:{0:`0`,50:`0.5`,60:`0.6`,70:`0.7`,80:`0.8`,90:`0.9`,100:`1`}},lookupToken=(e,t)=>e?.[t];function requireToken(t,n,r,i){let a=lookupToken(t,n);if(a!==void 0)return a;throw new e(r,`"${n}" is not in the ${i} scale. Known: ${t===void 0?`(the scale is not configured)`:Object.keys(t).sort().join(`, `)}`)}export{t as MINIMAL_TOKENS,lookupToken,requireToken};
@@ -0,0 +1,2 @@
1
+ import"./_virtual/_rolldown/runtime.js";function tagOf(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=n>0?e[n-1]:``,a=n+1<e.length?e[n+1]:``;r>=`A`&&r<=`Z`&&n>0&&(!(i>=`A`&&i<=`Z`)||a!==``&&a>=`a`&&a<=`z`)&&t.push(`-`),t.push(r.toLowerCase())}return t.join(``)}function assertInjective(e){let t=new Map,n=[];for(let r of e){let e=tagOf(r),i=t.get(e);i?n.push(`${e} <- ${i} and ${r}`):t.set(e,r)}if(n.length>0)throw Error(`tag map is not injective:\n ${n.join(`
2
+ `)}`)}export{assertInjective,tagOf};
File without changes
@@ -0,0 +1,224 @@
1
+ import type { ReactNode } from 'react';
2
+ import type Gtk from '@girs/gtk-4.0';
3
+ import { adopt, widgetOf } from '../host.js';
4
+ import type { HostElement, HostNode, HostText } from '../types.js';
5
+ /** What React hands `createInstance`: the vnode props, `children` included. */
6
+ export type ReactProps = Record<string, unknown>;
7
+ /**
8
+ * The HostConfig, exported because it IS the contract.
9
+ *
10
+ * `react.spec.ts` builds a second reconciler over a Proxy of this object to read
11
+ * the member set the INSTALLED `react-reconciler` asks for, so a version that
12
+ * starts asking for something new fails a test instead of returning `undefined`
13
+ * in a commit. It is also the seam for a consumer who needs a differently
14
+ * configured reconciler (a `LegacyRoot`, a different event priority) without
15
+ * restating the mapping.
16
+ */
17
+ export declare const gtkHostConfig: {
18
+ supportsMutation: boolean;
19
+ supportsPersistence: boolean;
20
+ supportsHydration: boolean;
21
+ isPrimaryRenderer: boolean;
22
+ supportsResources: boolean;
23
+ supportsSingletons: boolean;
24
+ noTimeout: -1;
25
+ scheduleTimeout: typeof setTimeout;
26
+ cancelTimeout: typeof clearTimeout;
27
+ createInstance: (type: string, props: ReactProps) => HostElement;
28
+ createTextInstance: (text: string) => HostText;
29
+ appendInitialChild: (parent: HostElement, child: HostNode) => void;
30
+ finalizeInitialChildren: () => boolean;
31
+ /**
32
+ * `false`, always — one text path instead of two.
33
+ *
34
+ * `true` would tell React to skip text instances for this element and leave
35
+ * the string in `props.children` for the adapter to write. The host already
36
+ * owns that translation: a text NODE is concatenated into the descriptor's
37
+ * `textSink`, and a widget without one refuses text BY TAG NAME. Answering
38
+ * `true` would move that decision into the adapter, where it would be a
39
+ * widget-knowledge test — the one thing ADR 0027 § 7 forbids an adapter.
40
+ *
41
+ * It also keeps `resetTextContent` unreachable: React sets the `ContentReset`
42
+ * flag only when `shouldSetTextContent` was true for the PREVIOUS props.
43
+ */
44
+ shouldSetTextContent: () => boolean;
45
+ getRootHostContext: () => object;
46
+ getChildHostContext: (parentHostContext: object) => object;
47
+ /**
48
+ * What a `ref` receives — the author's widget, never the host's wrapper.
49
+ *
50
+ * `<GtkListBox><GtkButton ref={…}/>` puts the button inside a
51
+ * `GtkListBoxRow` the host created. Handing that row back would give the
52
+ * author a widget they never wrote and whose `label` write does nothing.
53
+ */
54
+ getPublicInstance: (instance: HostElement) => Gtk.Widget;
55
+ prepareForCommit: () => null;
56
+ resetAfterCommit: () => void;
57
+ preparePortalMount: () => void;
58
+ getCurrentUpdatePriority: () => number;
59
+ setCurrentUpdatePriority: (priority: number) => void;
60
+ /**
61
+ * The priority an update gets when React is not already inside a lane.
62
+ *
63
+ * React DOM derives this from the DOM event being handled (a click is
64
+ * discrete, a scroll continuous). A GTK signal handler is not a DOM event and
65
+ * there is no ambient event to read, so every update is a default-lane one —
66
+ * the same answer `react-art` and `react-nil` give. Consequence, stated
67
+ * because it is load-bearing: a `setState` from a GTK handler is CONCURRENT,
68
+ * so it lands when `scheduler` next runs, i.e. on the next GLib main-loop
69
+ * iteration. `flushSync` is the escape hatch, and the spec pumps the main
70
+ * context to prove the scheduled path works at all under GJS.
71
+ */
72
+ resolveUpdatePriority: () => number;
73
+ shouldAttemptEagerTransition: () => boolean;
74
+ trackSchedulerEvent: () => void;
75
+ resolveEventType: () => null;
76
+ resolveEventTimeStamp: () => number;
77
+ appendChild: (parent: HostElement, child: HostNode) => void;
78
+ appendChildToContainer: (container: HostElement, child: HostNode) => void;
79
+ insertBefore: (parent: HostElement, child: HostNode, before: HostNode) => void;
80
+ insertInContainerBefore: (container: HostElement, child: HostNode, before: HostNode) => void;
81
+ removeChild: (_parent: HostElement, child: HostNode) => void;
82
+ removeChildFromContainer: (_container: HostElement, child: HostNode) => void;
83
+ /**
84
+ * React clears the root before its FIRST commit — and the application's own
85
+ * chrome must survive it.
86
+ *
87
+ * `updateHostRoot` sets the `Snapshot` flag whenever the previous render
88
+ * produced no child, and `commitBeforeMutationEffects` then calls this on the
89
+ * container. In the DOM that discards leftover markup. Here the container is a
90
+ * widget the application built and filled, so this clears what the HOST put
91
+ * there (the shadow children) and never `el.foreign`, which `adopt` recorded
92
+ * precisely so placement can offset past it.
93
+ *
94
+ * `destroy` rather than `remove`, for the same reason `removeChild` uses it:
95
+ * GJS blocks JS callbacks during GC, so a detached node keeps its handlers
96
+ * for the life of the process.
97
+ */
98
+ clearContainer: (container: HostElement) => void;
99
+ /**
100
+ * Diff AND apply — one phase, because React 19 deleted the other one.
101
+ *
102
+ * The argument list is the change with teeth: React 18 passed
103
+ * `(instance, updatePayload, type, prevProps, nextProps, handle)` and 19 passes
104
+ * `(instance, type, prevProps, nextProps, handle)`. The payload slot was
105
+ * removed from the FRONT, so an adapter that kept the old signature would read
106
+ * the type string as its payload and iterate a string — which is why this is
107
+ * spelled out rather than left to positional luck.
108
+ */
109
+ commitUpdate: (instance: HostElement, _type: string, prevProps: ReactProps, nextProps: ReactProps) => void;
110
+ commitTextUpdate: (textInstance: HostText, _oldText: string, newText: string) => void;
111
+ commitMount: () => void;
112
+ resetTextContent: (instance: HostElement) => void;
113
+ hideInstance: (instance: HostElement) => void;
114
+ unhideInstance: (instance: HostElement) => void;
115
+ /**
116
+ * A text run owns no widget, so hiding it means emptying what it contributes.
117
+ *
118
+ * The parent's text sink is a concatenation of its text children, so writing
119
+ * `''` removes exactly this run and leaves its siblings. Nothing has to be
120
+ * remembered: React hands the text back to `unhideTextInstance` as the fiber's
121
+ * own `memoizedProps`.
122
+ */
123
+ hideTextInstance: (textInstance: HostText) => void;
124
+ unhideTextInstance: (textInstance: HostText, text: string) => void;
125
+ getInstanceFromNode: () => null;
126
+ getInstanceFromScope: () => null;
127
+ prepareScopeUpdate: () => void;
128
+ beforeActiveInstanceBlur: () => void;
129
+ maySuspendCommit: () => boolean;
130
+ maySuspendCommitOnUpdate: () => boolean;
131
+ maySuspendCommitInSyncRender: () => boolean;
132
+ preloadInstance: () => boolean;
133
+ startSuspendingCommit: () => void;
134
+ suspendInstance: () => void;
135
+ waitForCommitToBeReady: () => null;
136
+ requestPostPaintCallback: () => void;
137
+ NotPendingTransition: any;
138
+ HostTransitionContext: import("react").Context<any>;
139
+ resetFormInstance: () => void;
140
+ detachDeletedInstance: () => void;
141
+ };
142
+ export type GtkHostConfig = typeof gtkHostConfig;
143
+ /**
144
+ * Run `fn` and flush every update it schedules before returning.
145
+ *
146
+ * The default lane is concurrent (see `resolveUpdatePriority`), so a `setState`
147
+ * from a GTK signal handler lands on a later main-loop iteration. In an
148
+ * application that is right — GTK is running a main loop. Outside one, and in a
149
+ * test, this is how a change becomes visible without pumping.
150
+ *
151
+ * `reconciler.flushSync` was RENAMED to `flushSyncFromReconciler` in React 19.
152
+ * The rename is the harmless half; see `createRoot` for the half that is not.
153
+ */
154
+ export declare const flushSync: <T>(fn: () => T) => T;
155
+ export interface ReactRoot {
156
+ /** Render (or re-render) this tree. Synchronous — the widgets exist on return. */
157
+ render(element: ReactNode): void;
158
+ /** Unmount the tree, tearing every widget and handler down. */
159
+ unmount(): void;
160
+ /** The host element wrapping the application's container. */
161
+ readonly container: HostElement;
162
+ }
163
+ export interface ReactRootOptions {
164
+ /**
165
+ * What to do with an error React RECOVERED from — a render an error boundary
166
+ * caught and retried, or a commit that had to fall back.
167
+ *
168
+ * The default is `console.error`, which is what `react-dom` does
169
+ * (`reportError`, absent under GJS). Rethrowing is deliberately NOT the
170
+ * default: React calls this from inside the commit, so a throw would break
171
+ * the error boundary that just did its job. A test passes its own recorder
172
+ * and asserts nothing arrived.
173
+ */
174
+ onRecoverableError?(error: Error): void;
175
+ /**
176
+ * An error NO error boundary caught. React 19 split this out of the single
177
+ * callback React 18 had, and it is the one that means the tree is broken.
178
+ *
179
+ * SUPPLYING THIS TURNS OFF THE RETHROW. By default `render()` throws the first
180
+ * uncaught error rather than returning normally, because a host refusal that
181
+ * only reaches a log has bought nothing. An application with its own error
182
+ * surface should not also get a throw — but it then owns reporting entirely.
183
+ */
184
+ onUncaughtError?(error: Error): void;
185
+ /**
186
+ * An error an error boundary DID catch — reported, then handled by the boundary.
187
+ *
188
+ * The default reports through `console.error`, which under GJS routes into the
189
+ * GLib log system at CRITICAL — so `installDiagnosticsGate()` COUNTS it, and a
190
+ * spec that deliberately renders a failing boundary will be told GTK reported a
191
+ * diagnostic. Such a spec should pass its own recorder here. Left as
192
+ * `console.error` because that is the right channel for an application, and a
193
+ * quieter default would be the wrong trade for the common case.
194
+ */
195
+ onCaughtError?(error: Error): void;
196
+ }
197
+ /**
198
+ * A React root over a widget the application owns.
199
+ *
200
+ * `adopt` is the bridge every adapter needs: React's `createContainer` wants a
201
+ * container of the renderer's own type and an application has a `Gtk.Widget`. It
202
+ * also records what the container already held, so the tree renders AFTER the
203
+ * application's own chrome instead of above it.
204
+ *
205
+ * `render` flushes synchronously. React's own `createRoot().render()` does not,
206
+ * and the reason to differ is measured rather than stylistic: without a GLib main
207
+ * loop nothing drives `scheduler`, so an unflushed first render leaves the
208
+ * container empty with no error — the silent-empty-window failure this package
209
+ * exists to refuse. An application that wants concurrent behaviour has
210
+ * `reconciler`-level control through `gtkHostConfig`.
211
+ */
212
+ export declare function createRoot(container: Gtk.Widget, options?: ReactRootOptions): ReactRoot;
213
+ /** `createRoot(container).render(element)`, for the common case. */
214
+ export declare function mount(element: ReactNode, container: Gtk.Widget, options?: ReactRootOptions): ReactRoot;
215
+ /**
216
+ * Re-exported, not re-implemented: the Solid adapter carried the SAME function and
217
+ * Vue carried none. It is a host op now, with coded errors instead of bare ones.
218
+ */
219
+ export { widgetOf };
220
+ /**
221
+ * Re-exported because a React app mounting into a second, hand-held container
222
+ * needs it and importing the host separately is a second module for one function.
223
+ */
224
+ export { adopt };
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,78 @@
1
+ import type Gtk from '@girs/gtk-4.0';
2
+ import { widgetOf } from '../host.js';
3
+ import type { HostNode } from '../types.js';
4
+ export declare const render: (code: () => HostNode, node: HostNode) => () => void, effect: <T>(fn: (prev?: T) => T, init?: T) => void, memo: <T>(fn: () => T, equal: boolean) => () => T, createComponent: <T>(Comp: (props: T) => HostNode, props: T) => HostNode, createElement: (tag: string) => HostNode, createTextNode: (value: string) => HostNode, insertNode: (parent: HostNode, node: HostNode, anchor?: HostNode) => void, insert: <T>(parent: any, accessor: T | (() => T), marker?: any | null, initial?: any) => HostNode, spread: <T>(node: any, accessor: (() => T) | T, skipChildren?: boolean) => void, setProp: <T>(node: HostNode, name: string, value: T, prev?: T) => T, mergeProps: (...sources: unknown[]) => unknown, use: <A, T>(fn: (element: HostNode, arg: A) => T, element: HostNode, arg: A) => T;
5
+ /**
6
+ * Render a Solid component into a widget the application owns.
7
+ *
8
+ * `render` wants a host node as its container; an application has a `Gtk.Widget`.
9
+ * `adopt` bridges that through the same descriptor table every other parent uses,
10
+ * so a `GObject.registerClass` subclass of a known container works unchanged.
11
+ *
12
+ * Returns Solid's disposer. Calling it unmounts the tree — and because the host's
13
+ * `destroy` is eager (GJS blocks JS callbacks during GC), that is also what
14
+ * disconnects the signal handlers.
15
+ */
16
+ export declare function mount(code: () => HostNode, container: Gtk.Widget): () => void;
17
+ /** `<For each={items}>` — keyed by item identity, so a reorder MOVES nodes. */
18
+ export declare const For: <T>(props: {
19
+ each: readonly T[] | undefined | null | false;
20
+ fallback?: HostNode;
21
+ children: (item: T, index: () => number) => HostNode;
22
+ }) => HostNode;
23
+ /** `<Index each={items}>` — keyed by position; the item is an accessor. */
24
+ export declare const Index: <T>(props: {
25
+ each: readonly T[] | undefined | null | false;
26
+ fallback?: HostNode;
27
+ children: (item: () => T, index: number) => HostNode;
28
+ }) => HostNode;
29
+ /**
30
+ * `<Show when={cond}>` — a conditional branch.
31
+ *
32
+ * The child function receives an ACCESSOR, not the value: Solid's runtime passes
33
+ * `keyed ? c : () => …`, so without `keyed` a `(item) => item.name` reads `.name`
34
+ * off a function and renders the function's own name — no type error, no runtime
35
+ * error, wrong string on screen. `keyed: true` opts into the value.
36
+ */
37
+ export declare const Show: {
38
+ <T>(props: {
39
+ when: T | undefined | null | false;
40
+ keyed: true;
41
+ fallback?: HostNode;
42
+ children: HostNode | ((item: NonNullable<T>) => HostNode);
43
+ }): HostNode;
44
+ <T>(props: {
45
+ when: T | undefined | null | false;
46
+ keyed?: false;
47
+ fallback?: HostNode;
48
+ children: HostNode | ((item: () => NonNullable<T>) => HostNode);
49
+ }): HostNode;
50
+ };
51
+ /**
52
+ * `<Dynamic component={…}>` — the one control-flow component Solid does NOT ship
53
+ * renderer-agnostically.
54
+ *
55
+ * `For`, `Index` and `Show` live in `solid-js` and reconcile whatever their
56
+ * children return, so this adapter only re-types them. `Dynamic` lives in
57
+ * `solid-js/web`, and that package IS the DOM renderer: its string branch is
58
+ * `document.createElement(component)` followed by the DOM's `spread`. Under a
59
+ * universal renderer it therefore produces a DOM element nobody here can place —
60
+ * measured as `container: ["GtkBox"]`, box children `[]`, no throw, no
61
+ * diagnostic, exit 0. Re-implementing it over the host ops is four lines and it
62
+ * is the only honest alternative to that silence.
63
+ *
64
+ * A `component` that is neither a tag nor a function is REFUSED, where Solid's
65
+ * own `switch` falls through and returns undefined: `component={registry[key]}`
66
+ * with a key that missed is the single most common way to render nothing by
67
+ * accident, and rendering nothing on purpose is `<Show>`'s job.
68
+ */
69
+ export declare function Dynamic<P extends Record<string, unknown>>(props: P & {
70
+ component: string | ((props: P) => HostNode);
71
+ }): HostNode;
72
+ /**
73
+ * Re-exported, not re-implemented: this and the React adapter carried the SAME
74
+ * function, and Vue carried none — so a Vue app had no supported way to reach a
75
+ * widget at all. It is a host op now (`../host.js`), and its two refusals are
76
+ * coded errors rather than the bare `new Error` they used to be.
77
+ */
78
+ export { widgetOf };
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import type Gtk from '@girs/gtk-4.0';
2
+ import { adopt, widgetOf } from '../host.js';
3
+ import type { HostElement } from '../types.js';
4
+ export declare const render: import("@vue/runtime-core").RootRenderFunction<HostElement>, createApp: import("@vue/runtime-core").CreateAppFunction<HostElement>;
5
+ /**
6
+ * Re-exported because a Vue app needs it and importing the host separately is a
7
+ * second module for one function: `<Teleport :to="adopt(el)">` is the explicit
8
+ * spelling of what `insert` now does implicitly, and it is the one to reach for
9
+ * when the same target is also addressed by hand.
10
+ *
11
+ * `widgetOf` for the same reason — and it is NEW here, not moved: Solid and React
12
+ * each carried their own copy and this adapter carried none, so a Vue app's only
13
+ * route to a widget was `materialize()`, the very call `widgetOf`'s destroyed-node
14
+ * refusal exists to intercept.
15
+ */
16
+ export { adopt, widgetOf };
17
+ /**
18
+ * Mount a Vue app into a widget the application owns.
19
+ *
20
+ * `createApp(...).mount(container)` wants a host element; an application has a
21
+ * `Gtk.Widget`. `adopt` bridges that and records what the container already held,
22
+ * so the app renders AFTER the application's own chrome rather than above it.
23
+ */
24
+ export declare function mount(rootComponent: Parameters<typeof createApp>[0], container: Gtk.Widget): import("@vue/runtime-core").App<HostElement>;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;