@gjsify/gtk-host 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/conformance/diagnostics.js +1 -1
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/descriptors/adw.js +1 -1
- package/lib/esm/font-dir.js +1 -0
- package/lib/esm/fonts.js +1 -0
- package/lib/esm/generated/widgets.js +1 -1
- package/lib/esm/host.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/list/controller.js +1 -1
- package/lib/esm/policies.js +1 -1
- package/lib/esm/probe.js +1 -1
- package/lib/esm/props.js +1 -1
- package/lib/esm/registry.js +1 -1
- package/lib/esm/style/document.js +1 -0
- package/lib/esm/style/gtk-props.js +1 -1
- package/lib/esm/style/index.js +1 -1
- package/lib/esm/style/layout.js +1 -1
- package/lib/esm/style/paint.js +1 -1
- package/lib/esm/style/sheet.js +3 -3
- package/lib/esm/style/theme.js +3 -0
- package/lib/esm/style/tokens.js +1 -1
- package/lib/types/descriptors/index.d.ts +1 -1
- package/lib/types/font-dir.d.ts +42 -0
- package/lib/types/font-dir.spec.d.ts +2 -0
- package/lib/types/fonts.d.ts +64 -0
- package/lib/types/fonts.spec.d.ts +2 -0
- package/lib/types/generated/props.d.ts +611 -822
- package/lib/types/generated/widgets.d.ts +1 -1
- package/lib/types/generator/emit-types.d.mts +1 -1
- package/lib/types/generator/emit.d.mts +16 -6
- package/lib/types/generator/girs-vocabulary.d.mts +45 -0
- package/lib/types/generator/main.d.mts +16 -8
- package/lib/types/generator/model.d.mts +95 -0
- package/lib/types/generator/names.d.mts +19 -0
- package/lib/types/generator/vocabulary-dts.d.mts +47 -0
- package/lib/types/host.d.ts +1 -1
- package/lib/types/policies.d.ts +7 -1
- package/lib/types/props.d.ts +13 -1
- package/lib/types/registry.d.ts +1 -1
- package/lib/types/style/document.d.ts +22 -0
- package/lib/types/style/index.d.ts +6 -3
- package/lib/types/style/layout.d.ts +34 -0
- package/lib/types/style/sheet.d.ts +0 -5
- package/lib/types/style/theme.d.ts +158 -0
- package/lib/types/style/theme.spec.d.ts +2 -0
- package/lib/types/style/tokens.d.ts +76 -0
- package/lib/types/style/tokens.spec.d.ts +2 -0
- package/lib/types/types.d.ts +63 -0
- package/package.json +19 -15
- package/lib/types/generator/gir.d.mts +0 -190
- package/lib/types/generator/mini.fixture.d.mts +0 -30
- package/lib/types/generator/surface.d.mts +0 -62
- package/lib/types/generator/tsmap.d.mts +0 -73
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"gi://GLib";const t=[`Vulkan: `];function isEnvironmentDiagnostic(e){return t.some(t=>e.startsWith(t))}let n=null;function describeLogRecord(e,t=new TextDecoder){let text=e=>e instanceof Uint8Array?t.decode(e):String(e),n=e,r=n?.MESSAGE;if(r!=null){let e=text(r);if(e!==``)return e}let i=n?Object.keys(n).filter(e=>e!==`MESSAGE`&&n[e]!==void 0&&n[e]!==null).map(e=>`${e}=${text(n[e])}`):[];return i.length>0?`<no MESSAGE field> ${i.join(` `)}`:`<a log record with no MESSAGE and no other field>`}function installDiagnosticsGate(){if(n)return n;let t=[],r=[],i=new TextDecoder,a=e.getenv(`G_MESSAGES_DEBUG`)!==null;return e.log_set_writer_func((n,o)=>{try{let s=describeLogRecord(o,i),c=n&e.LogLevelFlags.LEVEL_MASK;c<=e.LogLevelFlags.LEVEL_WARNING&&(isEnvironmentDiagnostic(s)?r:t).push(s),(a||c<=e.LogLevelFlags.LEVEL_MESSAGE)&&printerr(s)}catch{printerr(`<gtk-host: a log message could not be decoded>`)}return e.LogWriterOutput.HANDLED}),n={seen:t,environment:r,reset(){t.length=0,r.length=0},assertQuiet(e){let n=r.length;if(r.length=0,t.length===0)return;let i=t.length,a=t.join(`
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://GLib?version=2.0";const t=[`Vulkan: `];function isEnvironmentDiagnostic(e){return t.some(t=>e.startsWith(t))}let n=null;function describeLogRecord(e,t=new TextDecoder){let text=e=>e instanceof Uint8Array?t.decode(e):String(e),n=e,r=n?.MESSAGE;if(r!=null){let e=text(r);if(e!==``)return e}let i=n?Object.keys(n).filter(e=>e!==`MESSAGE`&&n[e]!==void 0&&n[e]!==null).map(e=>`${e}=${text(n[e])}`):[];return i.length>0?`<no MESSAGE field> ${i.join(` `)}`:`<a log record with no MESSAGE and no other field>`}function installDiagnosticsGate(){if(n)return n;let t=[],r=[],i=new TextDecoder,a=e.getenv(`G_MESSAGES_DEBUG`)!==null;return e.log_set_writer_func((n,o)=>{try{let s=describeLogRecord(o,i),c=n&e.LogLevelFlags.LEVEL_MASK;c<=e.LogLevelFlags.LEVEL_WARNING&&(isEnvironmentDiagnostic(s)?r:t).push(s),(a||c<=e.LogLevelFlags.LEVEL_MESSAGE)&&printerr(s)}catch{printerr(`<gtk-host: a log message could not be decoded>`)}return e.LogWriterOutput.HANDLED}),n={seen:t,environment:r,reset(){t.length=0,r.length=0},assertQuiet(e){let n=r.length;if(r.length=0,t.length===0)return;let i=t.length,a=t.join(`
|
|
2
2
|
`);t.length=0;let o=n>0?`\n (plus ${n} diagnostic(s) about the HOST's graphics stack, not the tree — see isEnvironmentDiagnostic)`:``;throw Error(`${e?e+`: `:``}GTK reported ${i} diagnostic(s) that would have passed at exit 0:\n ${a}${o}`)}},n}export{describeLogRecord,installDiagnosticsGate,isEnvironmentDiagnostic};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{adderSlots as e,addressOf as t,unhandledPolicy as n}from"../policies.js";import{describeLogRecord as r,installDiagnosticsGate as i,isEnvironmentDiagnostic as a}from"./diagnostics.js";import{BUILTIN_DESCRIPTORS as o}from"../descriptors/index.js";import s from"gi://GObject";function methodsOf(e){switch(e.kind){case`none`:case`uncurated`:return[];case`single`:return[e.set];case`ordered`:return e.after?[e.append,e.after,e.remove]:[e.append,e.remove];case`indexed`:return[e.insert,e.remove];case`slotted`:return e.remove?[...Object.values(e.slots),e.remove]:Object.values(e.slots);case`keyed`:return[e.add,e.remove];case`coords`:return[e.attach,e.remove];default:return n(e)}}function descriptorProblems(e=o){let t=[];for(let n of e){let e;try{e=n.ctor()}catch(e){t.push({gtype:n.gtype,problem:`ctor() threw: ${e.message}`});continue}let r=s.type_name(e.$gtype);r!==n.gtype&&t.push({gtype:n.gtype,problem:`ctor() is ${r}, not ${n.gtype}`});for(let i of methodsOf(n.children))typeof e.prototype[i]!=`function`&&t.push({gtype:n.gtype,problem:`declares children.${i}(), which ${r} does not have`});if(n.textSink){let i=e.list_properties().find(e=>e.get_name()===n.textSink);i?(i.flags&s.ParamFlags.WRITABLE)===0?t.push({gtype:n.gtype,problem:`declares a READ-ONLY textSink "${n.textSink}"`}):s.type_is_a(i.value_type,s.TYPE_STRING)||t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which is ${s.type_name(i.value_type)}, not a string`}):t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which ${r} does not have`})}t.push(...policyProblems(n,e,r))}return t}function policyProblems(t,n,r){let i=[],a=n.prototype,o=t.children,requireGetter=(e,n)=>{let o=e.replace(/^set_/,`get_`);typeof a[o]!=`function`&&i.push({gtype:t.gtype,problem:`${n} uses ${e}() but ${r} has no ${o}(), so removal cannot check whether this child is still the one in place`})};if(o.kind===`single`&&requireGetter(o.set,`children.set`),o.kind===`slotted`){for(let[e,t]of Object.entries(o.slots))t.startsWith(`set_`)&&requireGetter(t,`slot "${e}"`);o.defaultSlot in o.slots||i.push({gtype:t.gtype,problem:`defaultSlot "${o.defaultSlot}" is not one of ${Object.keys(o.slots).join(`, `)}`});let n=e(o);n.length>0&&!o.remove&&i.push({gtype:t.gtype,problem:`slot(s) ${n.map(e=>`"${e}"`).join(`, `)} are adder-backed, so removal needs a "remove" method and this policy names none`})}if(o.kind===`ordered`&&o.reorder===`native`&&!o.after&&i.push({gtype:t.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),o.kind===`keyed`){let e=a[o.add],n=o.titled?3:1;typeof e==`function`&&e.length!==n&&i.push({gtype:t.gtype,problem:`titled: ${o.titled} implies ${o.add}() takes ${n} argument(s), but ${r}'s takes ${e.length}`})}return i}function gtkChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtkChildTypes=e=>gtkChildren(e).map(e=>s.type_name(e.constructor.$gtype));function addressesOf(e){let n=[];for(let r=e.first;r;r=r.next)r.kind===`element`&&r.widget&&n.push(t(r));return n}function findDescendant(e,t){let n=[e];for(;n.length>0;){let r=n.shift();if(r!==e&&t(r))return r;n.push(...gtkChildren(r))}return null}function descendants(e){let t=[e];for(let n of gtkChildren(e))t.push(...descendants(n));return t}function dumpTree(e,t=0){let n=s.type_name(e.constructor.$gtype),r=[`${` `.repeat(t)}${n}`];for(let n of gtkChildren(e))r.push(dumpTree(n,t+1));return r.join(`
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{adderSlots as e,addressOf as t,unhandledPolicy as n}from"../policies.js";import{describeLogRecord as r,installDiagnosticsGate as i,isEnvironmentDiagnostic as a}from"./diagnostics.js";import{BUILTIN_DESCRIPTORS as o}from"../descriptors/index.js";import s from"gi://GObject?version=2.0";function methodsOf(e){switch(e.kind){case`none`:case`uncurated`:return[];case`single`:return[e.set];case`ordered`:return e.after?[e.append,e.after,e.remove]:[e.append,e.remove];case`indexed`:return[e.insert,e.remove];case`slotted`:return e.remove?[...Object.values(e.slots),e.remove]:Object.values(e.slots);case`keyed`:return[e.add,e.remove];case`coords`:return[e.attach,e.remove];default:return n(e)}}function descriptorProblems(e=o){let t=[];for(let n of e){let e;try{e=n.ctor()}catch(e){t.push({gtype:n.gtype,problem:`ctor() threw: ${e.message}`});continue}if(!e)continue;let r=s.type_name(e.$gtype);r!==n.gtype&&t.push({gtype:n.gtype,problem:`ctor() is ${r}, not ${n.gtype}`});for(let i of methodsOf(n.children))typeof e.prototype[i]!=`function`&&t.push({gtype:n.gtype,problem:`declares children.${i}(), which ${r} does not have`});if(n.textSink){let i=e.list_properties().find(e=>e.get_name()===n.textSink);i?(i.flags&s.ParamFlags.WRITABLE)===0?t.push({gtype:n.gtype,problem:`declares a READ-ONLY textSink "${n.textSink}"`}):s.type_is_a(i.value_type,s.TYPE_STRING)||t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which is ${s.type_name(i.value_type)}, not a string`}):t.push({gtype:n.gtype,problem:`declares textSink "${n.textSink}", which ${r} does not have`})}t.push(...policyProblems(n,e,r))}return t}function policyProblems(t,n,r){let i=[],a=n.prototype,o=t.children,requireGetter=(e,n)=>{let o=e.replace(/^set_/,`get_`);typeof a[o]!=`function`&&i.push({gtype:t.gtype,problem:`${n} uses ${e}() but ${r} has no ${o}(), so removal cannot check whether this child is still the one in place`})};if(o.kind===`single`&&requireGetter(o.set,`children.set`),o.kind===`slotted`){for(let[e,t]of Object.entries(o.slots))t.startsWith(`set_`)&&requireGetter(t,`slot "${e}"`);for(let e of Object.keys(o.wrapSlots??{}))e in o.slots||i.push({gtype:t.gtype,problem:`wrapSlots names "${e}", which is not one of ${Object.keys(o.slots).join(`, `)}`});o.defaultSlot in o.slots||i.push({gtype:t.gtype,problem:`defaultSlot "${o.defaultSlot}" is not one of ${Object.keys(o.slots).join(`, `)}`});let n=e(o);n.length>0&&!o.remove&&i.push({gtype:t.gtype,problem:`slot(s) ${n.map(e=>`"${e}"`).join(`, `)} are adder-backed, so removal needs a "remove" method and this policy names none`})}if(o.kind===`ordered`&&o.reorder===`native`&&!o.after&&i.push({gtype:t.gtype,problem:`claims reorder: 'native' with no "after" method — reorderMode() would tell an adapter the wrong thing`}),o.kind===`keyed`){let e=a[o.add],n=o.titled?3:1;typeof e==`function`&&e.length!==n&&i.push({gtype:t.gtype,problem:`titled: ${o.titled} implies ${o.add}() takes ${n} argument(s), but ${r}'s takes ${e.length}`})}return i}function gtkChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtkChildTypes=e=>gtkChildren(e).map(e=>s.type_name(e.constructor.$gtype));function addressesOf(e){let n=[];for(let r=e.first;r;r=r.next)r.kind===`element`&&r.widget&&n.push(t(r));return n}function findDescendant(e,t){let n=[e];for(;n.length>0;){let r=n.shift();if(r!==e&&t(r))return r;n.push(...gtkChildren(r))}return null}function descendants(e){let t=[e];for(let n of gtkChildren(e))t.push(...descendants(n));return t}function dumpTree(e,t=0){let n=s.type_name(e.constructor.$gtype),r=[`${` `.repeat(t)}${n}`];for(let n of gtkChildren(e))r.push(dumpTree(n,t+1));return r.join(`
|
|
2
2
|
`)}export{addressesOf,descendants,r as describeLogRecord,descriptorProblems,dumpTree,findDescendant,gtkChildTypes,gtkChildren,i as installDiagnosticsGate,a as isEnvironmentDiagnostic,methodsOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"gi://Adw?version=1";const t=[{gtype:`AdwToggle`,ctor:()=>e.Toggle,children:{kind:`single`,set:`set_child`}},{gtype:`AdwApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_content`}},{gtype:`AdwWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_content`}},{gtype:`AdwBin`,ctor:()=>e.Bin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToolbarView`,ctor:()=>e.ToolbarView,children:{kind:`slotted`,slots:{top:`add_top_bar`,bottom:`add_bottom_bar`,content:`set_content`},defaultSlot:`content`,remove:`remove`}},{gtype:`AdwHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}},{gtype:`AdwPreferencesGroup`,ctor:()=>e.PreferencesGroup,children:{kind:`ordered`,append:`add`,remove:`remove`,reorder:`remove-all`}},{gtype:`AdwPreferencesPage`,ctor:()=>e.PreferencesPage,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:null}},{gtype:`AdwActionRow`,ctor:()=>e.ActionRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`},defaultSlot:`suffix`,remove:`remove`}},{gtype:`AdwStatusPage`,ctor:()=>e.StatusPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationView`,ctor:()=>e.NavigationView,children:{kind:`keyed`,add:`add`,remove:`remove`,nameFrom:`tag`,titled:!1}},{gtype:`AdwNavigationPage`,ctor:()=>e.NavigationPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwViewStack`,ctor:()=>e.ViewStack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0}},{gtype:`AdwClamp`,ctor:()=>e.Clamp,children:{kind:`single`,set:`set_child`}},{gtype:`AdwClampScrollable`,ctor:()=>e.ClampScrollable,children:{kind:`single`,set:`set_child`}},{gtype:`AdwBreakpointBin`,ctor:()=>e.BreakpointBin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationSplitView`,ctor:()=>e.NavigationSplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}},{gtype:`AdwOverlaySplitView`,ctor:()=>e.OverlaySplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}}];export{t as ADW_DESCRIPTORS};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://Adw?version=1";const t=[{gtype:`AdwToggle`,ctor:()=>e.Toggle,children:{kind:`single`,set:`set_child`}},{gtype:`AdwApplicationWindow`,ctor:()=>e.ApplicationWindow,children:{kind:`single`,set:`set_content`}},{gtype:`AdwWindow`,ctor:()=>e.Window,children:{kind:`single`,set:`set_content`}},{gtype:`AdwBin`,ctor:()=>e.Bin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToolbarView`,ctor:()=>e.ToolbarView,children:{kind:`slotted`,slots:{top:`add_top_bar`,bottom:`add_bottom_bar`,content:`set_content`},defaultSlot:`content`,remove:`remove`}},{gtype:`AdwHeaderBar`,ctor:()=>e.HeaderBar,children:{kind:`slotted`,slots:{start:`pack_start`,end:`pack_end`,title:`set_title_widget`},defaultSlot:`start`,remove:`remove`}},{gtype:`AdwPreferencesGroup`,ctor:()=>e.PreferencesGroup,children:{kind:`ordered`,append:`add`,remove:`remove`,reorder:`remove-all`}},{gtype:`AdwPreferencesPage`,ctor:()=>e.PreferencesPage,children:{kind:`indexed`,insert:`insert`,remove:`remove`,wrap:null}},{gtype:`AdwActionRow`,ctor:()=>e.ActionRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`},defaultSlot:`suffix`,remove:`remove`}},{gtype:`AdwExpanderRow`,ctor:()=>e.ExpanderRow,children:{kind:`slotted`,slots:{prefix:`add_prefix`,suffix:`add_suffix`,row:`add_row`},defaultSlot:`row`,remove:`remove`,wrapSlots:{row:`list-box-row`}}},{gtype:`AdwStatusPage`,ctor:()=>e.StatusPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationView`,ctor:()=>e.NavigationView,children:{kind:`keyed`,add:`add`,remove:`remove`,nameFrom:`tag`,titled:!1}},{gtype:`AdwNavigationPage`,ctor:()=>e.NavigationPage,children:{kind:`single`,set:`set_child`}},{gtype:`AdwViewStack`,ctor:()=>e.ViewStack,children:{kind:`keyed`,add:`add_titled`,remove:`remove`,nameFrom:`name`,titled:!0,hideBeforeRemove:!0}},{gtype:`AdwClamp`,ctor:()=>e.Clamp,children:{kind:`single`,set:`set_child`}},{gtype:`AdwToastOverlay`,ctor:()=>e.ToastOverlay,children:{kind:`single`,set:`set_child`}},{gtype:`AdwClampScrollable`,ctor:()=>e.ClampScrollable,children:{kind:`single`,set:`set_child`}},{gtype:`AdwBreakpointBin`,ctor:()=>e.BreakpointBin,children:{kind:`single`,set:`set_child`}},{gtype:`AdwNavigationSplitView`,ctor:()=>e.NavigationSplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}},{gtype:`AdwOverlaySplitView`,ctor:()=>e.OverlaySplitView,children:{kind:`slotted`,slots:{sidebar:`set_sidebar`,content:`set_content`},defaultSlot:`content`}},{gtype:`AdwWrapBox`,ctor:()=>e.WrapBox,children:{kind:`ordered`,append:`append`,after:`insert_child_after`,remove:`remove`,reorder:`native`}}];export{t as ADW_DESCRIPTORS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e=[`.ttf`,`.otf`,`.ttc`,`.otc`];function resolveFontDir(e={}){return nonEmpty(e.fontDir)??nonEmpty(e.env?.GJSIFY_FONT_DIR)}function isFontFace(t){let n=t.toLowerCase();return e.some(e=>n.endsWith(e))}function nonEmpty(e){if(e===void 0)return;let t=e.trim();return t===``?void 0:t}export{e as FONT_FACE_EXTENSIONS,isFontFace,resolveFontDir};
|
package/lib/esm/fonts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{isFontFace as e,resolveFontDir as t}from"./font-dir.js";import n from"gi://GLib?version=2.0";import r from"gi://Gio?version=2.0";import i from"gi://PangoCairo?version=1.0";function isUnsupportedByFontMap(e){return e instanceof n.Error&&e.matches(r.io_error_quark(),r.IOErrorEnum.NOT_SUPPORTED)}function initFonts(e={}){let a=t({...e,env:{GJSIFY_FONT_DIR:n.getenv(`GJSIFY_FONT_DIR`)??void 0}}),o=[],s=[],c=[];if(a===void 0)return{dir:a,registered:o,declined:s,failed:c};let l=[];collectFaces(r.File.new_for_path(a),l,c);let u=i.FontMap.get_default();for(let e of l.sort())try{u.add_font_file(e),o.push(e)}catch(t){if(isUnsupportedByFontMap(t)){s.push(e);continue}c.push({path:e,message:messageOf(t)})}for(let e of c)console.warn(`initFonts: ${e.path} could not be read as an application font (${e.message}). Text asking for a family this application ships will render in a substituted one.`);return{dir:a,registered:o,declined:s,failed:c}}function collectFaces(t,n,i){try{let a=t.enumerate_children(`standard::name,standard::type`,r.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);for(let t=a.next_file(null);t!==null;t=a.next_file(null)){let o=a.get_child(t),s=o.get_path();s!==null&&(t.get_file_type()===r.FileType.DIRECTORY?collectFaces(o,n,i):e(t.get_name())&&n.push(s))}}catch(e){i.push({path:t.get_path()??``,message:messageOf(e)})}}function messageOf(e){return e instanceof n.Error||e instanceof Error?e.message:String(e)}export{initFonts,isUnsupportedByFontMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Adw?version=1";const n=`Gtk-4.0 Adw-1`,r=[{gtype:`AdwAboutDialog`,tag:`adw-about-dialog`,ctor:()=>t.AboutDialog},{gtype:`AdwAboutWindow`,tag:`adw-about-window`,ctor:()=>t.AboutWindow},{gtype:`AdwActionRow`,tag:`adw-action-row`,ctor:()=>t.ActionRow},{gtype:`AdwAlertDialog`,tag:`adw-alert-dialog`,ctor:()=>t.AlertDialog},{gtype:`AdwApplicationWindow`,tag:`adw-application-window`,ctor:()=>t.ApplicationWindow},{gtype:`AdwAvatar`,tag:`adw-avatar`,ctor:()=>t.Avatar},{gtype:`AdwBanner`,tag:`adw-banner`,ctor:()=>t.Banner},{gtype:`AdwBin`,tag:`adw-bin`,ctor:()=>t.Bin},{gtype:`AdwBottomSheet`,tag:`adw-bottom-sheet`,ctor:()=>t.BottomSheet},{gtype:`AdwBreakpointBin`,tag:`adw-breakpoint-bin`,ctor:()=>t.BreakpointBin},{gtype:`AdwButtonContent`,tag:`adw-button-content`,ctor:()=>t.ButtonContent},{gtype:`AdwButtonRow`,tag:`adw-button-row`,ctor:()=>t.ButtonRow},{gtype:`AdwCarousel`,tag:`adw-carousel`,ctor:()=>t.Carousel},{gtype:`AdwCarouselIndicatorDots`,tag:`adw-carousel-indicator-dots`,ctor:()=>t.CarouselIndicatorDots},{gtype:`AdwCarouselIndicatorLines`,tag:`adw-carousel-indicator-lines`,ctor:()=>t.CarouselIndicatorLines},{gtype:`AdwClamp`,tag:`adw-clamp`,ctor:()=>t.Clamp},{gtype:`AdwClampScrollable`,tag:`adw-clamp-scrollable`,ctor:()=>t.ClampScrollable},{gtype:`AdwComboRow`,tag:`adw-combo-row`,ctor:()=>t.ComboRow},{gtype:`AdwDialog`,tag:`adw-dialog`,ctor:()=>t.Dialog},{gtype:`AdwEntryRow`,tag:`adw-entry-row`,ctor:()=>t.EntryRow},{gtype:`AdwExpanderRow`,tag:`adw-expander-row`,ctor:()=>t.ExpanderRow},{gtype:`AdwFlap`,tag:`adw-flap`,ctor:()=>t.Flap},{gtype:`AdwHeaderBar`,tag:`adw-header-bar`,ctor:()=>t.HeaderBar},{gtype:`AdwInlineViewSwitcher`,tag:`adw-inline-view-switcher`,ctor:()=>t.InlineViewSwitcher},{gtype:`AdwLayoutSlot`,tag:`adw-layout-slot`,ctor:()=>t.LayoutSlot},{gtype:`AdwLeaflet`,tag:`adw-leaflet`,ctor:()=>t.Leaflet},{gtype:`AdwMessageDialog`,tag:`adw-message-dialog`,ctor:()=>t.MessageDialog},{gtype:`AdwMultiLayoutView`,tag:`adw-multi-layout-view`,ctor:()=>t.MultiLayoutView},{gtype:`AdwNavigationPage`,tag:`adw-navigation-page`,ctor:()=>t.NavigationPage},{gtype:`AdwNavigationSplitView`,tag:`adw-navigation-split-view`,ctor:()=>t.NavigationSplitView},{gtype:`AdwNavigationView`,tag:`adw-navigation-view`,ctor:()=>t.NavigationView},{gtype:`AdwOverlaySplitView`,tag:`adw-overlay-split-view`,ctor:()=>t.OverlaySplitView},{gtype:`AdwPasswordEntryRow`,tag:`adw-password-entry-row`,ctor:()=>t.PasswordEntryRow},{gtype:`AdwPreferencesDialog`,tag:`adw-preferences-dialog`,ctor:()=>t.PreferencesDialog},{gtype:`AdwPreferencesGroup`,tag:`adw-preferences-group`,ctor:()=>t.PreferencesGroup},{gtype:`AdwPreferencesPage`,tag:`adw-preferences-page`,ctor:()=>t.PreferencesPage},{gtype:`AdwPreferencesRow`,tag:`adw-preferences-row`,ctor:()=>t.PreferencesRow},{gtype:`AdwPreferencesWindow`,tag:`adw-preferences-window`,ctor:()=>t.PreferencesWindow},{gtype:`AdwShortcutLabel`,tag:`adw-shortcut-label`,ctor:()=>t.ShortcutLabel},{gtype:`AdwShortcutsDialog`,tag:`adw-shortcuts-dialog`,ctor:()=>t.ShortcutsDialog},{gtype:`AdwSidebar`,tag:`adw-sidebar`,ctor:()=>t.Sidebar},{gtype:`AdwSpinRow`,tag:`adw-spin-row`,ctor:()=>t.SpinRow},{gtype:`AdwSpinner`,tag:`adw-spinner`,ctor:()=>t.Spinner},{gtype:`AdwSplitButton`,tag:`adw-split-button`,ctor:()=>t.SplitButton},{gtype:`AdwSqueezer`,tag:`adw-squeezer`,ctor:()=>t.Squeezer},{gtype:`AdwStatusPage`,tag:`adw-status-page`,ctor:()=>t.StatusPage},{gtype:`AdwSwitchRow`,tag:`adw-switch-row`,ctor:()=>t.SwitchRow},{gtype:`AdwTabBar`,tag:`adw-tab-bar`,ctor:()=>t.TabBar},{gtype:`AdwTabButton`,tag:`adw-tab-button`,ctor:()=>t.TabButton},{gtype:`AdwTabOverview`,tag:`adw-tab-overview`,ctor:()=>t.TabOverview},{gtype:`AdwTabView`,tag:`adw-tab-view`,ctor:()=>t.TabView},{gtype:`AdwToastOverlay`,tag:`adw-toast-overlay`,ctor:()=>t.ToastOverlay},{gtype:`AdwToggle`,tag:`adw-toggle`,ctor:()=>t.Toggle},{gtype:`AdwToggleGroup`,tag:`adw-toggle-group`,ctor:()=>t.ToggleGroup},{gtype:`AdwToolbarView`,tag:`adw-toolbar-view`,ctor:()=>t.ToolbarView},{gtype:`AdwViewStack`,tag:`adw-view-stack`,ctor:()=>t.ViewStack},{gtype:`AdwViewSwitcher`,tag:`adw-view-switcher`,ctor:()=>t.ViewSwitcher},{gtype:`AdwViewSwitcherBar`,tag:`adw-view-switcher-bar`,ctor:()=>t.ViewSwitcherBar},{gtype:`AdwViewSwitcherSidebar`,tag:`adw-view-switcher-sidebar`,ctor:()=>t.ViewSwitcherSidebar},{gtype:`AdwViewSwitcherTitle`,tag:`adw-view-switcher-title`,ctor:()=>t.ViewSwitcherTitle},{gtype:`AdwWindow`,tag:`adw-window`,ctor:()=>t.Window},{gtype:`AdwWindowTitle`,tag:`adw-window-title`,ctor:()=>t.WindowTitle},{gtype:`AdwWrapBox`,tag:`adw-wrap-box`,ctor:()=>t.WrapBox},{gtype:`GtkAboutDialog`,tag:`gtk-about-dialog`,ctor:()=>e.AboutDialog},{gtype:`GtkActionBar`,tag:`gtk-action-bar`,ctor:()=>e.ActionBar},{gtype:`GtkAppChooserButton`,tag:`gtk-app-chooser-button`,ctor:()=>e.AppChooserButton},{gtype:`GtkAppChooserDialog`,tag:`gtk-app-chooser-dialog`,ctor:()=>e.AppChooserDialog},{gtype:`GtkAppChooserWidget`,tag:`gtk-app-chooser-widget`,ctor:()=>e.AppChooserWidget},{gtype:`GtkApplicationWindow`,tag:`gtk-application-window`,ctor:()=>e.ApplicationWindow},{gtype:`GtkAspectFrame`,tag:`gtk-aspect-frame`,ctor:()=>e.AspectFrame},{gtype:`GtkAssistant`,tag:`gtk-assistant`,ctor:()=>e.Assistant},{gtype:`GtkBox`,tag:`gtk-box`,ctor:()=>e.Box},{gtype:`GtkButton`,tag:`gtk-button`,ctor:()=>e.Button},{gtype:`GtkCalendar`,tag:`gtk-calendar`,ctor:()=>e.Calendar},{gtype:`GtkCellView`,tag:`gtk-cell-view`,ctor:()=>e.CellView},{gtype:`GtkCenterBox`,tag:`gtk-center-box`,ctor:()=>e.CenterBox},{gtype:`GtkCheckButton`,tag:`gtk-check-button`,ctor:()=>e.CheckButton},{gtype:`GtkColorButton`,tag:`gtk-color-button`,ctor:()=>e.ColorButton},{gtype:`GtkColorChooserDialog`,tag:`gtk-color-chooser-dialog`,ctor:()=>e.ColorChooserDialog},{gtype:`GtkColorChooserWidget`,tag:`gtk-color-chooser-widget`,ctor:()=>e.ColorChooserWidget},{gtype:`GtkColorDialogButton`,tag:`gtk-color-dialog-button`,ctor:()=>e.ColorDialogButton},{gtype:`GtkColumnView`,tag:`gtk-column-view`,ctor:()=>e.ColumnView},{gtype:`GtkColumnViewCell`,tag:`gtk-column-view-cell`,ctor:()=>e.ColumnViewCell},{gtype:`GtkComboBox`,tag:`gtk-combo-box`,ctor:()=>e.ComboBox},{gtype:`GtkComboBoxText`,tag:`gtk-combo-box-text`,ctor:()=>e.ComboBoxText},{gtype:`GtkDialog`,tag:`gtk-dialog`,ctor:()=>e.Dialog},{gtype:`GtkDragIcon`,tag:`gtk-drag-icon`,ctor:()=>e.DragIcon},{gtype:`GtkDrawingArea`,tag:`gtk-drawing-area`,ctor:()=>e.DrawingArea},{gtype:`GtkDropDown`,tag:`gtk-drop-down`,ctor:()=>e.DropDown},{gtype:`GtkEditableLabel`,tag:`gtk-editable-label`,ctor:()=>e.EditableLabel},{gtype:`GtkEmojiChooser`,tag:`gtk-emoji-chooser`,ctor:()=>e.EmojiChooser},{gtype:`GtkEntry`,tag:`gtk-entry`,ctor:()=>e.Entry},{gtype:`GtkExpander`,tag:`gtk-expander`,ctor:()=>e.Expander},{gtype:`GtkFileChooserDialog`,tag:`gtk-file-chooser-dialog`,ctor:()=>e.FileChooserDialog},{gtype:`GtkFileChooserWidget`,tag:`gtk-file-chooser-widget`,ctor:()=>e.FileChooserWidget},{gtype:`GtkFixed`,tag:`gtk-fixed`,ctor:()=>e.Fixed},{gtype:`GtkFlowBox`,tag:`gtk-flow-box`,ctor:()=>e.FlowBox},{gtype:`GtkFlowBoxChild`,tag:`gtk-flow-box-child`,ctor:()=>e.FlowBoxChild},{gtype:`GtkFontButton`,tag:`gtk-font-button`,ctor:()=>e.FontButton},{gtype:`GtkFontChooserDialog`,tag:`gtk-font-chooser-dialog`,ctor:()=>e.FontChooserDialog},{gtype:`GtkFontChooserWidget`,tag:`gtk-font-chooser-widget`,ctor:()=>e.FontChooserWidget},{gtype:`GtkFontDialogButton`,tag:`gtk-font-dialog-button`,ctor:()=>e.FontDialogButton},{gtype:`GtkFrame`,tag:`gtk-frame`,ctor:()=>e.Frame},{gtype:`GtkGLArea`,tag:`gtk-gl-area`,ctor:()=>e.GLArea},{gtype:`GtkGraphicsOffload`,tag:`gtk-graphics-offload`,ctor:()=>e.GraphicsOffload},{gtype:`GtkGrid`,tag:`gtk-grid`,ctor:()=>e.Grid},{gtype:`GtkGridView`,tag:`gtk-grid-view`,ctor:()=>e.GridView},{gtype:`GtkHeaderBar`,tag:`gtk-header-bar`,ctor:()=>e.HeaderBar},{gtype:`GtkIconView`,tag:`gtk-icon-view`,ctor:()=>e.IconView},{gtype:`GtkImage`,tag:`gtk-image`,ctor:()=>e.Image},{gtype:`GtkInfoBar`,tag:`gtk-info-bar`,ctor:()=>e.InfoBar},{gtype:`GtkInscription`,tag:`gtk-inscription`,ctor:()=>e.Inscription},{gtype:`GtkLabel`,tag:`gtk-label`,ctor:()=>e.Label},{gtype:`GtkLevelBar`,tag:`gtk-level-bar`,ctor:()=>e.LevelBar},{gtype:`GtkLinkButton`,tag:`gtk-link-button`,ctor:()=>e.LinkButton},{gtype:`GtkListBox`,tag:`gtk-list-box`,ctor:()=>e.ListBox},{gtype:`GtkListBoxRow`,tag:`gtk-list-box-row`,ctor:()=>e.ListBoxRow},{gtype:`GtkListHeader`,tag:`gtk-list-header`,ctor:()=>e.ListHeader},{gtype:`GtkListItem`,tag:`gtk-list-item`,ctor:()=>e.ListItem},{gtype:`GtkListView`,tag:`gtk-list-view`,ctor:()=>e.ListView},{gtype:`GtkLockButton`,tag:`gtk-lock-button`,ctor:()=>e.LockButton},{gtype:`GtkMediaControls`,tag:`gtk-media-controls`,ctor:()=>e.MediaControls},{gtype:`GtkMenuButton`,tag:`gtk-menu-button`,ctor:()=>e.MenuButton},{gtype:`GtkMessageDialog`,tag:`gtk-message-dialog`,ctor:()=>e.MessageDialog},{gtype:`GtkNotebook`,tag:`gtk-notebook`,ctor:()=>e.Notebook},{gtype:`GtkOverlay`,tag:`gtk-overlay`,ctor:()=>e.Overlay},{gtype:`GtkPageSetupUnixDialog`,tag:`gtk-page-setup-unix-dialog`,ctor:()=>e.PageSetupUnixDialog},{gtype:`GtkPaned`,tag:`gtk-paned`,ctor:()=>e.Paned},{gtype:`GtkPasswordEntry`,tag:`gtk-password-entry`,ctor:()=>e.PasswordEntry},{gtype:`GtkPicture`,tag:`gtk-picture`,ctor:()=>e.Picture},{gtype:`GtkPopover`,tag:`gtk-popover`,ctor:()=>e.Popover},{gtype:`GtkPopoverBin`,tag:`gtk-popover-bin`,ctor:()=>e.PopoverBin},{gtype:`GtkPopoverMenu`,tag:`gtk-popover-menu`,ctor:()=>e.PopoverMenu},{gtype:`GtkPopoverMenuBar`,tag:`gtk-popover-menu-bar`,ctor:()=>e.PopoverMenuBar},{gtype:`GtkPrintUnixDialog`,tag:`gtk-print-unix-dialog`,ctor:()=>e.PrintUnixDialog},{gtype:`GtkProgressBar`,tag:`gtk-progress-bar`,ctor:()=>e.ProgressBar},{gtype:`GtkRange`,tag:`gtk-range`,ctor:()=>e.Range},{gtype:`GtkRevealer`,tag:`gtk-revealer`,ctor:()=>e.Revealer},{gtype:`GtkScale`,tag:`gtk-scale`,ctor:()=>e.Scale},{gtype:`GtkScaleButton`,tag:`gtk-scale-button`,ctor:()=>e.ScaleButton},{gtype:`GtkScrollbar`,tag:`gtk-scrollbar`,ctor:()=>e.Scrollbar},{gtype:`GtkScrolledWindow`,tag:`gtk-scrolled-window`,ctor:()=>e.ScrolledWindow},{gtype:`GtkSearchBar`,tag:`gtk-search-bar`,ctor:()=>e.SearchBar},{gtype:`GtkSearchEntry`,tag:`gtk-search-entry`,ctor:()=>e.SearchEntry},{gtype:`GtkSeparator`,tag:`gtk-separator`,ctor:()=>e.Separator},{gtype:`GtkShortcutLabel`,tag:`gtk-shortcut-label`,ctor:()=>e.ShortcutLabel},{gtype:`GtkShortcutsGroup`,tag:`gtk-shortcuts-group`,ctor:()=>e.ShortcutsGroup},{gtype:`GtkShortcutsSection`,tag:`gtk-shortcuts-section`,ctor:()=>e.ShortcutsSection},{gtype:`GtkShortcutsShortcut`,tag:`gtk-shortcuts-shortcut`,ctor:()=>e.ShortcutsShortcut},{gtype:`GtkShortcutsWindow`,tag:`gtk-shortcuts-window`,ctor:()=>e.ShortcutsWindow},{gtype:`GtkSpinButton`,tag:`gtk-spin-button`,ctor:()=>e.SpinButton},{gtype:`GtkSpinner`,tag:`gtk-spinner`,ctor:()=>e.Spinner},{gtype:`GtkStack`,tag:`gtk-stack`,ctor:()=>e.Stack},{gtype:`GtkStackSidebar`,tag:`gtk-stack-sidebar`,ctor:()=>e.StackSidebar},{gtype:`GtkStackSwitcher`,tag:`gtk-stack-switcher`,ctor:()=>e.StackSwitcher},{gtype:`GtkStatusbar`,tag:`gtk-statusbar`,ctor:()=>e.Statusbar},{gtype:`GtkSwitch`,tag:`gtk-switch`,ctor:()=>e.Switch},{gtype:`GtkText`,tag:`gtk-text`,ctor:()=>e.Text},{gtype:`GtkTextView`,tag:`gtk-text-view`,ctor:()=>e.TextView},{gtype:`GtkToggleButton`,tag:`gtk-toggle-button`,ctor:()=>e.ToggleButton},{gtype:`GtkTreeExpander`,tag:`gtk-tree-expander`,ctor:()=>e.TreeExpander},{gtype:`GtkTreeView`,tag:`gtk-tree-view`,ctor:()=>e.TreeView},{gtype:`GtkVideo`,tag:`gtk-video`,ctor:()=>e.Video},{gtype:`GtkViewport`,tag:`gtk-viewport`,ctor:()=>e.Viewport},{gtype:`GtkVolumeButton`,tag:`gtk-volume-button`,ctor:()=>e.VolumeButton},{gtype:`GtkWindow`,tag:`gtk-window`,ctor:()=>e.Window},{gtype:`GtkWindowControls`,tag:`gtk-window-controls`,ctor:()=>e.WindowControls},{gtype:`GtkWindowHandle`,tag:`gtk-window-handle`,ctor:()=>e.WindowHandle}];export{n as GENERATED_PROVENANCE,r as GENERATED_WIDGETS};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Adw?version=1";const n=`Gtk-4.0/4.23.3 Adw-1/1.10.0`,r=[{gtype:`AdwAboutDialog`,tag:`adw-about-dialog`,ctor:()=>t.AboutDialog},{gtype:`AdwAboutWindow`,tag:`adw-about-window`,ctor:()=>t.AboutWindow},{gtype:`AdwActionRow`,tag:`adw-action-row`,ctor:()=>t.ActionRow},{gtype:`AdwAlertDialog`,tag:`adw-alert-dialog`,ctor:()=>t.AlertDialog},{gtype:`AdwApplicationWindow`,tag:`adw-application-window`,ctor:()=>t.ApplicationWindow},{gtype:`AdwAvatar`,tag:`adw-avatar`,ctor:()=>t.Avatar},{gtype:`AdwBanner`,tag:`adw-banner`,ctor:()=>t.Banner},{gtype:`AdwBin`,tag:`adw-bin`,ctor:()=>t.Bin},{gtype:`AdwBottomSheet`,tag:`adw-bottom-sheet`,ctor:()=>t.BottomSheet},{gtype:`AdwBreakpointBin`,tag:`adw-breakpoint-bin`,ctor:()=>t.BreakpointBin},{gtype:`AdwButtonContent`,tag:`adw-button-content`,ctor:()=>t.ButtonContent},{gtype:`AdwButtonRow`,tag:`adw-button-row`,ctor:()=>t.ButtonRow},{gtype:`AdwCarousel`,tag:`adw-carousel`,ctor:()=>t.Carousel},{gtype:`AdwCarouselIndicatorDots`,tag:`adw-carousel-indicator-dots`,ctor:()=>t.CarouselIndicatorDots},{gtype:`AdwCarouselIndicatorLines`,tag:`adw-carousel-indicator-lines`,ctor:()=>t.CarouselIndicatorLines},{gtype:`AdwClamp`,tag:`adw-clamp`,ctor:()=>t.Clamp},{gtype:`AdwClampScrollable`,tag:`adw-clamp-scrollable`,ctor:()=>t.ClampScrollable},{gtype:`AdwComboRow`,tag:`adw-combo-row`,ctor:()=>t.ComboRow},{gtype:`AdwDialog`,tag:`adw-dialog`,ctor:()=>t.Dialog},{gtype:`AdwEntryRow`,tag:`adw-entry-row`,ctor:()=>t.EntryRow},{gtype:`AdwExpanderRow`,tag:`adw-expander-row`,ctor:()=>t.ExpanderRow},{gtype:`AdwFlap`,tag:`adw-flap`,ctor:()=>t.Flap},{gtype:`AdwHeaderBar`,tag:`adw-header-bar`,ctor:()=>t.HeaderBar},{gtype:`AdwInlineViewSwitcher`,tag:`adw-inline-view-switcher`,ctor:()=>t.InlineViewSwitcher},{gtype:`AdwLayoutSlot`,tag:`adw-layout-slot`,ctor:()=>t.LayoutSlot},{gtype:`AdwLeaflet`,tag:`adw-leaflet`,ctor:()=>t.Leaflet},{gtype:`AdwMessageDialog`,tag:`adw-message-dialog`,ctor:()=>t.MessageDialog},{gtype:`AdwMultiLayoutView`,tag:`adw-multi-layout-view`,ctor:()=>t.MultiLayoutView},{gtype:`AdwNavigationPage`,tag:`adw-navigation-page`,ctor:()=>t.NavigationPage},{gtype:`AdwNavigationSplitView`,tag:`adw-navigation-split-view`,ctor:()=>t.NavigationSplitView},{gtype:`AdwNavigationView`,tag:`adw-navigation-view`,ctor:()=>t.NavigationView},{gtype:`AdwOverlaySplitView`,tag:`adw-overlay-split-view`,ctor:()=>t.OverlaySplitView},{gtype:`AdwPasswordEntryRow`,tag:`adw-password-entry-row`,ctor:()=>t.PasswordEntryRow},{gtype:`AdwPreferencesDialog`,tag:`adw-preferences-dialog`,ctor:()=>t.PreferencesDialog},{gtype:`AdwPreferencesGroup`,tag:`adw-preferences-group`,ctor:()=>t.PreferencesGroup},{gtype:`AdwPreferencesPage`,tag:`adw-preferences-page`,ctor:()=>t.PreferencesPage},{gtype:`AdwPreferencesRow`,tag:`adw-preferences-row`,ctor:()=>t.PreferencesRow},{gtype:`AdwPreferencesWindow`,tag:`adw-preferences-window`,ctor:()=>t.PreferencesWindow},{gtype:`AdwShortcutLabel`,tag:`adw-shortcut-label`,ctor:()=>t.ShortcutLabel},{gtype:`AdwShortcutsDialog`,tag:`adw-shortcuts-dialog`,ctor:()=>t.ShortcutsDialog},{gtype:`AdwSidebar`,tag:`adw-sidebar`,ctor:()=>t.Sidebar},{gtype:`AdwSpinRow`,tag:`adw-spin-row`,ctor:()=>t.SpinRow},{gtype:`AdwSpinner`,tag:`adw-spinner`,ctor:()=>t.Spinner},{gtype:`AdwSplitButton`,tag:`adw-split-button`,ctor:()=>t.SplitButton},{gtype:`AdwSqueezer`,tag:`adw-squeezer`,ctor:()=>t.Squeezer},{gtype:`AdwStatusPage`,tag:`adw-status-page`,ctor:()=>t.StatusPage},{gtype:`AdwSwitchRow`,tag:`adw-switch-row`,ctor:()=>t.SwitchRow},{gtype:`AdwTabBar`,tag:`adw-tab-bar`,ctor:()=>t.TabBar},{gtype:`AdwTabButton`,tag:`adw-tab-button`,ctor:()=>t.TabButton},{gtype:`AdwTabOverview`,tag:`adw-tab-overview`,ctor:()=>t.TabOverview},{gtype:`AdwTabView`,tag:`adw-tab-view`,ctor:()=>t.TabView},{gtype:`AdwToastOverlay`,tag:`adw-toast-overlay`,ctor:()=>t.ToastOverlay},{gtype:`AdwToggle`,tag:`adw-toggle`,ctor:()=>t.Toggle},{gtype:`AdwToggleGroup`,tag:`adw-toggle-group`,ctor:()=>t.ToggleGroup},{gtype:`AdwToolbarView`,tag:`adw-toolbar-view`,ctor:()=>t.ToolbarView},{gtype:`AdwViewStack`,tag:`adw-view-stack`,ctor:()=>t.ViewStack},{gtype:`AdwViewSwitcher`,tag:`adw-view-switcher`,ctor:()=>t.ViewSwitcher},{gtype:`AdwViewSwitcherBar`,tag:`adw-view-switcher-bar`,ctor:()=>t.ViewSwitcherBar},{gtype:`AdwViewSwitcherSidebar`,tag:`adw-view-switcher-sidebar`,ctor:()=>t.ViewSwitcherSidebar},{gtype:`AdwViewSwitcherTitle`,tag:`adw-view-switcher-title`,ctor:()=>t.ViewSwitcherTitle},{gtype:`AdwWindow`,tag:`adw-window`,ctor:()=>t.Window},{gtype:`AdwWindowTitle`,tag:`adw-window-title`,ctor:()=>t.WindowTitle},{gtype:`AdwWrapBox`,tag:`adw-wrap-box`,ctor:()=>t.WrapBox},{gtype:`GtkAboutDialog`,tag:`gtk-about-dialog`,ctor:()=>e.AboutDialog},{gtype:`GtkActionBar`,tag:`gtk-action-bar`,ctor:()=>e.ActionBar},{gtype:`GtkAppChooserButton`,tag:`gtk-app-chooser-button`,ctor:()=>e.AppChooserButton},{gtype:`GtkAppChooserDialog`,tag:`gtk-app-chooser-dialog`,ctor:()=>e.AppChooserDialog},{gtype:`GtkAppChooserWidget`,tag:`gtk-app-chooser-widget`,ctor:()=>e.AppChooserWidget},{gtype:`GtkApplicationWindow`,tag:`gtk-application-window`,ctor:()=>e.ApplicationWindow},{gtype:`GtkAspectFrame`,tag:`gtk-aspect-frame`,ctor:()=>e.AspectFrame},{gtype:`GtkAssistant`,tag:`gtk-assistant`,ctor:()=>e.Assistant},{gtype:`GtkBox`,tag:`gtk-box`,ctor:()=>e.Box},{gtype:`GtkButton`,tag:`gtk-button`,ctor:()=>e.Button},{gtype:`GtkCalendar`,tag:`gtk-calendar`,ctor:()=>e.Calendar},{gtype:`GtkCellView`,tag:`gtk-cell-view`,ctor:()=>e.CellView},{gtype:`GtkCenterBox`,tag:`gtk-center-box`,ctor:()=>e.CenterBox},{gtype:`GtkCheckButton`,tag:`gtk-check-button`,ctor:()=>e.CheckButton},{gtype:`GtkColorButton`,tag:`gtk-color-button`,ctor:()=>e.ColorButton},{gtype:`GtkColorChooserDialog`,tag:`gtk-color-chooser-dialog`,ctor:()=>e.ColorChooserDialog},{gtype:`GtkColorChooserWidget`,tag:`gtk-color-chooser-widget`,ctor:()=>e.ColorChooserWidget},{gtype:`GtkColorDialogButton`,tag:`gtk-color-dialog-button`,ctor:()=>e.ColorDialogButton},{gtype:`GtkColumnView`,tag:`gtk-column-view`,ctor:()=>e.ColumnView},{gtype:`GtkColumnViewCell`,tag:`gtk-column-view-cell`,ctor:()=>e.ColumnViewCell},{gtype:`GtkComboBox`,tag:`gtk-combo-box`,ctor:()=>e.ComboBox},{gtype:`GtkComboBoxText`,tag:`gtk-combo-box-text`,ctor:()=>e.ComboBoxText},{gtype:`GtkDialog`,tag:`gtk-dialog`,ctor:()=>e.Dialog},{gtype:`GtkDragIcon`,tag:`gtk-drag-icon`,ctor:()=>e.DragIcon},{gtype:`GtkDrawingArea`,tag:`gtk-drawing-area`,ctor:()=>e.DrawingArea},{gtype:`GtkDropDown`,tag:`gtk-drop-down`,ctor:()=>e.DropDown},{gtype:`GtkEditableLabel`,tag:`gtk-editable-label`,ctor:()=>e.EditableLabel},{gtype:`GtkEmojiChooser`,tag:`gtk-emoji-chooser`,ctor:()=>e.EmojiChooser},{gtype:`GtkEntry`,tag:`gtk-entry`,ctor:()=>e.Entry},{gtype:`GtkExpander`,tag:`gtk-expander`,ctor:()=>e.Expander},{gtype:`GtkFileChooserDialog`,tag:`gtk-file-chooser-dialog`,ctor:()=>e.FileChooserDialog},{gtype:`GtkFileChooserWidget`,tag:`gtk-file-chooser-widget`,ctor:()=>e.FileChooserWidget},{gtype:`GtkFixed`,tag:`gtk-fixed`,ctor:()=>e.Fixed},{gtype:`GtkFlowBox`,tag:`gtk-flow-box`,ctor:()=>e.FlowBox},{gtype:`GtkFlowBoxChild`,tag:`gtk-flow-box-child`,ctor:()=>e.FlowBoxChild},{gtype:`GtkFontButton`,tag:`gtk-font-button`,ctor:()=>e.FontButton},{gtype:`GtkFontChooserDialog`,tag:`gtk-font-chooser-dialog`,ctor:()=>e.FontChooserDialog},{gtype:`GtkFontChooserWidget`,tag:`gtk-font-chooser-widget`,ctor:()=>e.FontChooserWidget},{gtype:`GtkFontDialogButton`,tag:`gtk-font-dialog-button`,ctor:()=>e.FontDialogButton},{gtype:`GtkFrame`,tag:`gtk-frame`,ctor:()=>e.Frame},{gtype:`GtkGLArea`,tag:`gtk-gl-area`,ctor:()=>e.GLArea},{gtype:`GtkGraphicsOffload`,tag:`gtk-graphics-offload`,ctor:()=>e.GraphicsOffload},{gtype:`GtkGrid`,tag:`gtk-grid`,ctor:()=>e.Grid},{gtype:`GtkGridView`,tag:`gtk-grid-view`,ctor:()=>e.GridView},{gtype:`GtkHeaderBar`,tag:`gtk-header-bar`,ctor:()=>e.HeaderBar},{gtype:`GtkIconView`,tag:`gtk-icon-view`,ctor:()=>e.IconView},{gtype:`GtkImage`,tag:`gtk-image`,ctor:()=>e.Image},{gtype:`GtkInfoBar`,tag:`gtk-info-bar`,ctor:()=>e.InfoBar},{gtype:`GtkInscription`,tag:`gtk-inscription`,ctor:()=>e.Inscription},{gtype:`GtkLabel`,tag:`gtk-label`,ctor:()=>e.Label},{gtype:`GtkLevelBar`,tag:`gtk-level-bar`,ctor:()=>e.LevelBar},{gtype:`GtkLinkButton`,tag:`gtk-link-button`,ctor:()=>e.LinkButton},{gtype:`GtkListBox`,tag:`gtk-list-box`,ctor:()=>e.ListBox},{gtype:`GtkListBoxRow`,tag:`gtk-list-box-row`,ctor:()=>e.ListBoxRow},{gtype:`GtkListHeader`,tag:`gtk-list-header`,ctor:()=>e.ListHeader},{gtype:`GtkListItem`,tag:`gtk-list-item`,ctor:()=>e.ListItem},{gtype:`GtkListView`,tag:`gtk-list-view`,ctor:()=>e.ListView},{gtype:`GtkLockButton`,tag:`gtk-lock-button`,ctor:()=>e.LockButton},{gtype:`GtkMediaControls`,tag:`gtk-media-controls`,ctor:()=>e.MediaControls},{gtype:`GtkMenuButton`,tag:`gtk-menu-button`,ctor:()=>e.MenuButton},{gtype:`GtkMessageDialog`,tag:`gtk-message-dialog`,ctor:()=>e.MessageDialog},{gtype:`GtkNotebook`,tag:`gtk-notebook`,ctor:()=>e.Notebook},{gtype:`GtkOverlay`,tag:`gtk-overlay`,ctor:()=>e.Overlay},{gtype:`GtkPageSetupUnixDialog`,tag:`gtk-page-setup-unix-dialog`,ctor:()=>e.PageSetupUnixDialog},{gtype:`GtkPaned`,tag:`gtk-paned`,ctor:()=>e.Paned},{gtype:`GtkPasswordEntry`,tag:`gtk-password-entry`,ctor:()=>e.PasswordEntry},{gtype:`GtkPicture`,tag:`gtk-picture`,ctor:()=>e.Picture},{gtype:`GtkPopover`,tag:`gtk-popover`,ctor:()=>e.Popover},{gtype:`GtkPopoverBin`,tag:`gtk-popover-bin`,ctor:()=>e.PopoverBin},{gtype:`GtkPopoverMenu`,tag:`gtk-popover-menu`,ctor:()=>e.PopoverMenu},{gtype:`GtkPopoverMenuBar`,tag:`gtk-popover-menu-bar`,ctor:()=>e.PopoverMenuBar},{gtype:`GtkPrintUnixDialog`,tag:`gtk-print-unix-dialog`,ctor:()=>e.PrintUnixDialog},{gtype:`GtkProgressBar`,tag:`gtk-progress-bar`,ctor:()=>e.ProgressBar},{gtype:`GtkRange`,tag:`gtk-range`,ctor:()=>e.Range},{gtype:`GtkRevealer`,tag:`gtk-revealer`,ctor:()=>e.Revealer},{gtype:`GtkScale`,tag:`gtk-scale`,ctor:()=>e.Scale},{gtype:`GtkScaleButton`,tag:`gtk-scale-button`,ctor:()=>e.ScaleButton},{gtype:`GtkScrollbar`,tag:`gtk-scrollbar`,ctor:()=>e.Scrollbar},{gtype:`GtkScrolledWindow`,tag:`gtk-scrolled-window`,ctor:()=>e.ScrolledWindow},{gtype:`GtkSearchBar`,tag:`gtk-search-bar`,ctor:()=>e.SearchBar},{gtype:`GtkSearchEntry`,tag:`gtk-search-entry`,ctor:()=>e.SearchEntry},{gtype:`GtkSeparator`,tag:`gtk-separator`,ctor:()=>e.Separator},{gtype:`GtkShortcutLabel`,tag:`gtk-shortcut-label`,ctor:()=>e.ShortcutLabel},{gtype:`GtkShortcutsGroup`,tag:`gtk-shortcuts-group`,ctor:()=>e.ShortcutsGroup},{gtype:`GtkShortcutsSection`,tag:`gtk-shortcuts-section`,ctor:()=>e.ShortcutsSection},{gtype:`GtkShortcutsShortcut`,tag:`gtk-shortcuts-shortcut`,ctor:()=>e.ShortcutsShortcut},{gtype:`GtkShortcutsWindow`,tag:`gtk-shortcuts-window`,ctor:()=>e.ShortcutsWindow},{gtype:`GtkSpinButton`,tag:`gtk-spin-button`,ctor:()=>e.SpinButton},{gtype:`GtkSpinner`,tag:`gtk-spinner`,ctor:()=>e.Spinner},{gtype:`GtkStack`,tag:`gtk-stack`,ctor:()=>e.Stack},{gtype:`GtkStackSidebar`,tag:`gtk-stack-sidebar`,ctor:()=>e.StackSidebar},{gtype:`GtkStackSwitcher`,tag:`gtk-stack-switcher`,ctor:()=>e.StackSwitcher},{gtype:`GtkStatusbar`,tag:`gtk-statusbar`,ctor:()=>e.Statusbar},{gtype:`GtkSvgWidget`,tag:`gtk-svg-widget`,ctor:()=>e.SvgWidget},{gtype:`GtkSwitch`,tag:`gtk-switch`,ctor:()=>e.Switch},{gtype:`GtkText`,tag:`gtk-text`,ctor:()=>e.Text},{gtype:`GtkTextView`,tag:`gtk-text-view`,ctor:()=>e.TextView},{gtype:`GtkToggleButton`,tag:`gtk-toggle-button`,ctor:()=>e.ToggleButton},{gtype:`GtkTreeExpander`,tag:`gtk-tree-expander`,ctor:()=>e.TreeExpander},{gtype:`GtkTreeView`,tag:`gtk-tree-view`,ctor:()=>e.TreeView},{gtype:`GtkVideo`,tag:`gtk-video`,ctor:()=>e.Video},{gtype:`GtkViewport`,tag:`gtk-viewport`,ctor:()=>e.Viewport},{gtype:`GtkVolumeButton`,tag:`gtk-volume-button`,ctor:()=>e.VolumeButton},{gtype:`GtkWindow`,tag:`gtk-window`,ctor:()=>e.Window},{gtype:`GtkWindowControls`,tag:`gtk-window-controls`,ctor:()=>e.WindowControls},{gtype:`GtkWindowHandle`,tag:`gtk-window-handle`,ctor:()=>e.WindowHandle}];export{n as GENERATED_PROVENANCE,r as GENERATED_WIDGETS};
|
package/lib/esm/host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{beginHostWrite as n,clearHandlers as r,endHostWrite as i,isEventProp as a,setHandler as o,toSignalName as s}from"./signals.js";import{addressOf as c,insertChild as l,makeDetachedContainer as u,makeWrapper as d,removeChild as f,setterSlotOf as p,setterSlots as m,slotOccupant as h}from"./policies.js";import{coerce as g,paramSpecs as _,removedValue as v,requireSpec as y,toPropertyName as b}from"./props.js";import{lookupWidget as x,nearestRegistered as S}from"./registry.js";import C from"gi://GObject?version=2.0";function createElement(e,t){let n={kind:`element`,descriptor:x(e),widget:null,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!1,destroyed:!1,foreign:[]};if(t)for(let[e,r]of Object.entries(t))setProp(n,e,r);return n}const createText=e=>({kind:`text`,data:e,parent:null,prev:null,next:null}),createAnchor=(e=``)=>({kind:`anchor`,data:e,parent:null,prev:null,next:null}),isText=e=>e.kind===`text`;function materialize(e){if(e.widget)return e.widget;for(let n of e.descriptor.requiresProps??[])if(!(n in e.props))throw t.missingConstructProp(e.descriptor.gtype,n);let a=e.descriptor.ctor(),o=_(a,e.descriptor.gtype),s={};for(let[t,n]of Object.entries(e.props))s[t]=g(y(o,e.descriptor.gtype,t),n,e.descriptor.gtype);n(null);try{e.widget=new a(s)}finally{i()}try{replayInto(e)}catch(t){r(e);for(let t of childSnapshot(e))t.kind===`element`&&t.attached&&(f(e,t),t.attached=!1);throw e.widget=null,e.wrapper=null,t}return e.widget}function replayInto(e){for(let[t,n]of e.listeners)o(e,t,n);for(let t of siblingsFrom(e.first,e))t.kind===`element`&&attach(e,t);e.textFromChildren&&flushText(e)}function setProp(e,t,r,o){if(a(t))return setEventHandler(e,t,r);if(t===`slot`)return setSlot(e,r);if(t===`layout`){let t=r,n=e.parent;if(!n||!e.widget){e.layout=t;return}let i=e.layout;replaceAt(e,n,()=>{e.layout=t},()=>{e.layout=i});return}let s=b(t),c=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,s),l=r==null,u=l?v(e.descriptor,c):g(c,r,e.descriptor.gtype),d=s in e.props?e.props[s]:void 0;if(l?delete e.props[s]:e.props[s]=r,e.widget){if((c.flags&C.ParamFlags.CONSTRUCT_ONLY)!==0)return rebuild(e,s,d);n(e.widget);try{writeProperty(e.widget,s,u)}finally{i()}}}function writeProperty(e,t,n){if(!Array.isArray(n)){e.set_property(t,n);return}let r=t.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());e[r]=n}function setEventHandler(e,t,n){e.widget?o(e,t,n):n&&assertSignalExists(e,t),n?e.listeners.set(t,n):e.listeners.delete(t)}function assertSignalExists(e,n){let r=s(n,e.descriptor.eventAliases).split(`::`)[0],i=e.descriptor.ctor().$gtype;if(C.signal_lookup(r,i)===0)throw t.unknownSignal(e.descriptor.gtype,n,r)}function setSlot(e,t){if(e.slot===t)return;let n=e.parent;if(!n||!e.widget){e.slot=t;return}let r=e.slot;replaceAt(e,n,()=>{e.slot=t},()=>{e.slot=r})}function replaceAt(e,t,n,r){f(t,e),e.attached=!1,n();try{attach(t,e)}catch(n){r();try{attach(t,e)}catch{}throw n}}function rebuild(e,t,n){let i=e.parent;if(e.widget){r(e);for(let t of childSnapshot(e))t.kind===`element`&&(f(e,t),t.attached=!1);i&&f(i,e)}e.widget=null,e.wrapper=null,e.attached=!1;try{materialize(e)}catch(r){t!==void 0&&(n===void 0?delete e.props[t]:e.props[t]=n);try{materialize(e),i&&attach(i,e)}catch{}throw r}i&&attach(i,e)}function setText(e,t){e.data=t,e.kind===`text`&&e.parent&&flushText(e.parent)}function setElementText(e,t){writeTextSink(e,t),e.textFromChildren=!1,destroyChildren(e)}function flushText(e){let t=``,n=!1;for(let r of childNodes(e))r.kind===`text`&&(t+=r.data,n=!0);if(t===``&&!e.textFromChildren)return;let r=e.descriptor.textSink;if(t===``&&r&&holdsElementInSetterSlot(e)){e.textFromChildren=!1,delete e.props[r];return}writeTextSink(e,t),e.textFromChildren=n}function*setterSlotChildren(e){for(let t of siblingsFrom(e.first,e))t.kind===`element`&&t.attached&&p(e,t)&&(yield t)}const holdsElementInSetterSlot=e=>!setterSlotChildren(e).next().done;function writeTextSink(e,r){let a=e.descriptor.textSink;if(!a)throw t.textNotAccepted(e.descriptor.gtype,r);materialize(e);let o=e.descriptor.children,s=o.kind===`single`?o.set:null;if(s&&!holdsOursInSlot(e,null)&&appOccupant(e.widget,e.descriptor,s))throw t.occupiedSlot(e.descriptor.gtype,`text`,s);let c=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,a);n(e.widget);try{e.widget.set_property(a,g(c,r,e.descriptor.gtype))}finally{i()}e.props[a]=r;for(let t of setterSlotChildren(e))t.attached=!1}function*childNodes(e){yield*siblingsFrom(e.first,e)}function childSnapshot(e){let t=[];for(let n of siblingsFrom(e.first,e))t.push(n);return t}function*siblingsFrom(e,n){let r=0;for(let i=e;i;i=i.next){if(++r>1e5)throw t.siblingCycle(n.descriptor.gtype);yield i}}function link(e,t,n){t.parent=e,n?(t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:e.first=t,n.prev=t):(t.prev=e.last,t.next=null,e.last?e.last.next=t:e.first=t,e.last=t)}function unlink(e){let t=e.parent;t&&(e.prev?e.prev.next=e.next:t.first=e.next,e.next?e.next.prev=e.prev:t.last=e.prev,e.prev=null,e.next=null,e.parent=null)}function attach(e,t){if(!e.widget)return;materialize(t),ensureWrapper(e,t),refuseOccupiedSlot(e,t);let n=e.foreign.length>0?e.foreign.filter(t=>t.get_parent()===e.widget):e.foreign,r=n.length>0?n[n.length-1]:null,i=n.length;for(let n of siblingsFrom(e.first,e)){if(n===t)break;n.kind!==`element`||!n.attached||(r=c(n),i+=1)}let a=[];for(let n of siblingsFrom(t.next,e))n.kind===`element`&&n.attached&&a.push(n);l({parent:e,child:t,prevWidget:r,index:i,following:a}),t.attached=!0}function refuseOccupiedSlot(e,n){let r=p(e,n);if(r&&!holdsOursInSlot(e,n.slot)&&appOccupant(e.widget,e.descriptor,r))throw t.occupiedSlot(e.descriptor.gtype,n.descriptor.gtype,r)}function holdsOursInSlot(e,t){for(let n of siblingsFrom(e.first,e))if(n.kind===`element`&&n.attached&&n.slot===t)return!0;return!1}function ensureWrapper(n,r){if(r.wrapper)return;let i;try{i=d(n.descriptor.children,r.widget,r.slot)}catch(i){throw i instanceof e?i:t.rejectedChild(n.descriptor.gtype,r.descriptor.gtype,i.message)}i&&(r.wrapper=i)}function insert(e,t,n=null){assertHostParent(t);let r=e.parent,i=e.next,a=n===e?i:n;e.parent&&remove(e),link(t,e,a);try{e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch(t){throw unlink(e),r&&restore(e,r,i),t}}function assertHostParent(e){if(!isHostElement(e))throw t.notAHostParent(describeValue(e))}function isHostElement(e){let t=e;return!!t&&t.kind===`element`&&typeof t.descriptor==`object`}function describeValue(e){if(e==null)return String(e);if(typeof e!=`object`)return`a ${typeof e}`;let t=e.tagName;if(typeof t==`string`)return`a DOM element <${t.toLowerCase()}>`;let n=e.constructor?.$gtype,r=n?C.type_name(n)??`an unnamed GType`:null;if(r!==null&&r!==`JSObject`)return r;let i=e.constructor?.name;return i&&i!==`Object`?`a ${i}`:`a plain object`}function restore(e,t,n){try{link(t,e,n),e.kind===`element`?attach(t,e):e.kind===`text`&&flushText(t)}catch{unlink(e)}}function restoreTextSink(e){let t=e.descriptor.textSink;if(!t||e.destroyed||!e.widget)return;let r=e.descriptor.children;if(r.kind!==`single`||holdsOursInSlot(e,null)||h(e.widget,r.set))return;let a=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),o=e.props[t]??e.props[a];if(typeof o!=`string`||o===``)return;let s=y(_(e.descriptor.ctor(),e.descriptor.gtype),e.descriptor.gtype,t);n(e.widget);try{e.widget.set_property(t,g(s,o,e.descriptor.gtype))}finally{i()}}function remove(e){let t=e.parent;t&&e.kind===`element`&&(f(t,e),e.attached=!1,e.wrapper&&=(e.wrapper.set_child(null),null),restoreTextSink(t)),unlink(e),t&&e.kind===`text`&&flushText(t)}function destroyChildren(e){for(let t of childSnapshot(e))destroy(t)}function disconnectHandlers(e){r(e),e.listeners.clear()}function destroy(e){if(e.kind===`element`&&(destroyChildren(e),r(e),e.listeners.clear()),remove(e),e.kind===`element`){let t=e.widget;t&&typeof t.destroy==`function`&&typeof t.get_parent==`function`&&t.get_parent()===null&&t.destroy(),e.widget=null,e.wrapper=null,e.props={},e.layout=null,e.textFromChildren=!1,e.destroyed=!0}}function mountRoot(e,t){materialize(e),insert(e,adopt(t))}function widgetOf(e){if(e.kind!==`element`)throw t.notAnElement(e.kind);if(e.destroyed)throw t.destroyedNode(e.descriptor.gtype);return materialize(e)}const createDetachedContainer=()=>adopt(u());function adopt(e){let n=e.constructor.$gtype,r=S(n);if(!r)throw t.unknownTag(gtypeNameOf(e));return{kind:`element`,descriptor:r,widget:e,wrapper:null,slot:null,parent:null,prev:null,next:null,first:null,last:null,handlers:new Map,listeners:new Map,props:{},layout:null,textFromChildren:!1,attached:!0,destroyed:!1,foreign:adoptedChildren(e,r)}}function adoptedChildren(e,t){let n=m(t.children);if(n.length===0)return directChildren(e);let r=[];for(let i of n){let n=appOccupant(e,t,i);n&&r.push(n)}return r}function appOccupant(e,t,n){let r=h(e,n);if(!r)return null;let i=t.textSink;if(!i)return r;let a=e[i.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())];return typeof a==`string`&&a!==``?null:r}function directChildren(e){let t=[],n=e;if(typeof n.get_first_child!=`function`)return t;for(let e=n.get_first_child();e;e=e.get_next_sibling())t.push(e);return t}const gtypeNameOf=e=>C.type_name(e.constructor.$gtype),parentNode=e=>e.parent,firstChild=e=>e.first,nextSibling=e=>e.next,prevSibling=e=>e.prev;export{adopt,createAnchor,createDetachedContainer,createElement,createText,describeValue,destroy,destroyChildren,disconnectHandlers,firstChild,insert,isHostElement,isText,materialize,mountRoot,nextSibling,parentNode,prevSibling,remove,setElementText,setEventHandler,setProp,setSlot,setText,widgetOf};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GtkHostError as e}from"./errors.js";import{
|
|
1
|
+
import{GtkHostError as e}from"./errors.js";import{isEventProp as t,toSignalName as n}from"./signals.js";import{addressOf as r,reorderMode as i}from"./policies.js";import{constructOnlyNames as a,isConstructOnly as o,isWritable as s,lookupEnumNick as c,paramSpecs as l,toPropertyName as u}from"./props.js";import{assertInjective as d,tagOf as f}from"./tags.js";import{clearRegistry as p,hasWidget as m,lookupWidget as h,nearestRegistered as g,registerWidget as _,registerWidgets as v,registeredTags as y}from"./registry.js";import{adopt as b,createAnchor as x,createDetachedContainer as S,createElement as C,createText as w,destroy as T,destroyChildren as E,disconnectHandlers as D,firstChild as O,insert as k,isHostElement as A,isText as j,materialize as M,mountRoot as N,nextSibling as P,parentNode as F,prevSibling as I,remove as L,setElementText as R,setEventHandler as z,setProp as B,setSlot as V,setText as H,widgetOf as U}from"./host.js";import{GENERATED_PROVENANCE as W,GENERATED_WIDGETS as G}from"./generated/widgets.js";import{ADW_DESCRIPTORS as K}from"./descriptors/adw.js";import{GTK_DESCRIPTORS as q}from"./descriptors/gtk.js";import{BUILTIN_DESCRIPTORS as J,CURATED_DESCRIPTORS as Y,mergeGenerated as X,registerBuiltinWidgets as Z,tableProvenance as Q}from"./descriptors/index.js";import"./types.js";import{blankReason as $,checkRendered as ee,probeEnabled as te,runHostProbe as ne,runHostProbeApp as re,shotEvidence as ie}from"./probe.js";export{K as ADW_DESCRIPTORS,J as BUILTIN_DESCRIPTORS,Y as CURATED_DESCRIPTORS,W as GENERATED_PROVENANCE,G as GENERATED_WIDGETS,q as GTK_DESCRIPTORS,e as GtkHostError,r as addressOf,b as adopt,d as assertInjective,$ as blankReason,ee as checkRendered,p as clearRegistry,a as constructOnlyNames,x as createAnchor,S as createDetachedContainer,C as createElement,w as createText,T as destroy,E as destroyChildren,D as disconnectHandlers,O as firstChild,m as hasWidget,k as insert,o as isConstructOnly,t as isEventProp,A as isHostElement,j as isText,s as isWritable,c as lookupEnumNick,h as lookupWidget,M as materialize,X as mergeGenerated,N as mountRoot,g as nearestRegistered,P as nextSibling,l as paramSpecs,F as parentNode,I as prevSibling,te as probeEnabled,Z as registerBuiltinWidgets,_ as registerWidget,v as registerWidgets,y as registeredTags,L as remove,i as reorderMode,ne as runHostProbe,re as runHostProbeApp,R as setElementText,z as setEventHandler,B as setProp,V as setSlot,H as setText,ie as shotEvidence,Q as tableProvenance,f as tagOf,u as toPropertyName,n as toSignalName,U as widgetOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"gi://GObject";import t from"gi://Gtk?version=4.0";import n from"gi://Gio";const r=e.registerClass({GTypeName:`GjsifyGtkHostListRow`},class ListRowCarrier extends e.Object{constructor(...e){super(...e),this.row=null}});var ListController=class{#e=n.ListStore.new(r.$gtype);#t=new t.SignalListItemFactory;#n=[];#r=new Map;#i;#a=null;#o=[];#s=!1;constructor(e){this.#i=e,this.#n.push(this.#t.connect(`setup`,(e,t)=>this.#c(t)),this.#t.connect(`bind`,(e,t)=>this.#l(t)),this.#t.connect(`unbind`,(e,t)=>this.#u(t)),this.#t.connect(`teardown`,(e,t)=>this.#d(t)))}attach(e){this.#a=e,e.set_factory(this.#t),e.set_model(t.NoSelection.new(this.#e))}setRows(e){if(this.#s)return;let t=e.map(e=>e.key),n=t.length===this.#o.length&&t.every((e,t)=>e===this.#o[t]);if(this.#o=t,n){for(let t=0;t<e.length;t++){let n=this.#e.get_item(t);n!==null&&(n.row=e[t])}for(let e of this.#r.keys())this.#l(e);return}let i=e.map(e=>{let t=new r;return t.row=e,t});this.#e.splice(0,this.#e.get_n_items(),i)}get liveRows(){return this.#r.size}dispose(){if(this.#s)return;this.#s=!0;for(let e of this.#n)this.#t.disconnect(e);this.#n.length=0,this.#a!==null&&(this.#a.set_factory(null),this.#a.set_model(null),this.#a=null),this.#e.remove_all();let e=[...this.#r.values()];this.#r.clear();for(let t of e)this.#i.disposeRow(t)}#c(e){this.#r.set(e,this.#i.mountRow(e))}#l(e){let t=this.#r.get(e);if(t===void 0)return;let n=e.get_item();this.#i.showRow(t,n?.row??null,e.get_position())}#u(e){let t=this.#r.get(e);t!==void 0&&this.#i.showRow(t,null,e.get_position())}#d(e){let t=this.#r.get(e);t!==void 0&&(this.#r.delete(e),this.#i.disposeRow(t))}};export{ListController};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://GObject?version=2.0";import t from"gi://Gtk?version=4.0";import n from"gi://Gio?version=2.0";const r=e.registerClass({GTypeName:`GjsifyGtkHostListRow`},class ListRowCarrier extends e.Object{constructor(...e){super(...e),this.row=null}});var ListController=class{#e=n.ListStore.new(r.$gtype);#t=new t.SignalListItemFactory;#n=[];#r=new Map;#i;#a=null;#o=[];#s=!1;constructor(e){this.#i=e,this.#n.push(this.#t.connect(`setup`,(e,t)=>this.#c(t)),this.#t.connect(`bind`,(e,t)=>this.#l(t)),this.#t.connect(`unbind`,(e,t)=>this.#u(t)),this.#t.connect(`teardown`,(e,t)=>this.#d(t)))}attach(e){this.#a=e,e.set_factory(this.#t),e.set_model(t.NoSelection.new(this.#e))}setRows(e){if(this.#s)return;let t=e.map(e=>e.key),n=t.length===this.#o.length&&t.every((e,t)=>e===this.#o[t]);if(this.#o=t,n){for(let t=0;t<e.length;t++){let n=this.#e.get_item(t);n!==null&&(n.row=e[t])}for(let e of this.#r.keys())this.#l(e);return}let i=e.map(e=>{let t=new r;return t.row=e,t});this.#e.splice(0,this.#e.get_n_items(),i)}get liveRows(){return this.#r.size}dispose(){if(this.#s)return;this.#s=!0;for(let e of this.#n)this.#t.disconnect(e);this.#n.length=0,this.#a!==null&&(this.#a.set_factory(null),this.#a.set_model(null),this.#a=null),this.#e.remove_all();let e=[...this.#r.values()];this.#r.clear();for(let t of e)this.#i.disposeRow(t)}#c(e){this.#r.set(e,this.#i.mountRow(e))}#l(e){let t=this.#r.get(e);if(t===void 0)return;let n=e.get_item();this.#i.showRow(t,n?.row??null,e.get_position())}#u(e){let t=this.#r.get(e);t!==void 0&&this.#i.showRow(t,null,e.get_position())}#d(e){let t=this.#r.get(e);t!==void 0&&(this.#r.delete(e),this.#i.disposeRow(t))}};export{ListController};
|
package/lib/esm/policies.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import n from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t){
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{GtkHostError as e,err as t}from"./errors.js";import{beginHostWrite as n,endHostWrite as r}from"./signals.js";import i from"gi://Gtk?version=4.0";function addressOf(e){let n=e.wrapper??e.widget;if(!n)throw t.notAWidget(e.descriptor.gtype);return n}function makeWrapper(e,t,n){let r=e.kind===`indexed`?e.wrap:e.kind===`slotted`?e.wrapSlots?.[n??e.defaultSlot]??null:null;if(!r)return null;if(r===`list-box-row`){if(t instanceof i.ListBoxRow)return null;let e=new i.ListBoxRow;return e.set_child(t),e}if(t instanceof i.FlowBoxChild)return null;let a=new i.FlowBoxChild;return a.set_child(t),a}const makeDetachedContainer=()=>new i.Box;function unhandledPolicy(e){throw Error(`unhandled child policy: ${JSON.stringify(e)}`)}function setterSlotOf(e,t){let n=e.descriptor.children;if(n.kind===`single`)return n.set;if(n.kind!==`slotted`)return null;let r=n.slots[t.slot??n.defaultSlot];return r?.startsWith(`set_`)===!0?r:null}function adderSlots(e){return e.kind===`slotted`?Object.entries(e.slots).filter(([,e])=>!e.startsWith(`set_`)).map(([e])=>e):[]}function setterSlots(e){return e.kind===`single`?[e.set]:e.kind===`slotted`?Object.values(e.slots).filter(e=>e.startsWith(`set_`)):[]}function slotOccupant(e,t){let n=e,r=t.replace(/^set_/,`get_`);if(typeof n[r]==`function`)return n[r]()??null}function insertChild(n){try{placeChild(n)}catch(r){throw r instanceof e?r:t.rejectedChild(n.parent.descriptor.gtype,n.child.descriptor.gtype,r.message)}}function placeChild(e){let{parent:n,child:r}=e,i=n.descriptor.children,a=n.widget,o=addressOf(r);switch(i.kind){case`none`:throw t.unclaimedChild(n.descriptor.gtype,r.descriptor.gtype);case`uncurated`:throw t.uncuratedPlacement(n.descriptor.gtype,r.descriptor.gtype);case`single`:a[i.set](o);return;case`indexed`:a[i.insert](o,e.index);return;case`coords`:appendChild(n,r,a);return;case`ordered`:if(i.after){a[i.after](o,e.prevWidget??null);return}case`slotted`:case`keyed`:appendChild(n,r,a),rotateTail(n,r,e.following,a);return;default:return unhandledPolicy(i)}}function appendChild(e,n,r){let i=e.descriptor.children,a=addressOf(n);switch(i.kind){case`uncurated`:throw t.uncuratedPlacement(e.descriptor.gtype,n.descriptor.gtype);case`ordered`:r[i.append](a);return;case`slotted`:{let o=n.slot??i.defaultSlot,s=i.slots[o];if(!s)throw t.unknownSlot(e.descriptor.gtype,o,Object.keys(i.slots));r[s](a);return}case`keyed`:{let e=n.layout?.[i.nameFrom]??n.slot,t=n.layout?.title;i.titled?r[i.add](a,e??null,t??e??``):r[i.add](a);return}case`coords`:{let e=n.layout??{};r[i.attach](a,e.column??0,e.row??0,e.columnSpan??1,e.rowSpan??1);return}default:throw t.unclaimedChild(e.descriptor.gtype,n.descriptor.gtype)}}function rotateTail(e,t,n,r){let i=e.descriptor.children,a=n;if(i.kind===`slotted`){if(setterSlotOf(e,t))return;let slotOf=e=>e.slot??i.defaultSlot,r=slotOf(t);a=n.filter(e=>slotOf(e)===r)}for(let t of a)detachChild(e,t,r);for(let t of a)appendChild(e,t,r)}function detachChild(e,n,r){let i=e.descriptor.children,a=n.wrapper??n.widget;if(a)switch(i.kind){case`none`:case`uncurated`:return;case`single`:clearIfCurrent(r,i.set,a);return;case`slotted`:{let o=setterSlotOf(e,n);if(o){clearIfCurrent(r,o,a);return}let s=n.slot??i.defaultSlot;if(!i.remove)throw t.slotNeedsRemove(e.descriptor.gtype,s,i.slots[s]??`?`);r[i.remove](a);return}case`keyed`:{let e=i.hideBeforeRemove===!0&&a.get_visible();e&&writeVisible(a,!1),r[i.remove](a),e&&writeVisible(a,!0);return}case`ordered`:case`indexed`:case`coords`:r[i.remove](a);return;default:return unhandledPolicy(i)}}function writeVisible(e,t){n(null);try{e.set_visible(t)}finally{r()}}function clearIfCurrent(e,t,n){let r=slotOccupant(e,t);(r===void 0||r===n)&&e[t](null)}function removeChild(e,t){let n=e.widget;n&&t.attached&&detachChild(e,t,n)}function reorderMode(e){switch(e.kind){case`uncurated`:return`n/a`;case`ordered`:return e.reorder;case`indexed`:return`native`;case`slotted`:return adderSlots(e).length>0?`remove-all`:`n/a`;case`keyed`:return`remove-all`;case`coords`:case`single`:case`none`:return`n/a`;default:return unhandledPolicy(e)}}export{adderSlots,addressOf,insertChild,makeDetachedContainer,makeWrapper,removeChild,reorderMode,setterSlotOf,setterSlots,slotOccupant,unhandledPolicy};
|
package/lib/esm/probe.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{installDiagnosticsGate as e}from"./conformance/diagnostics.js";import{descendants as t}from"./conformance/index.js";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://GLib";import a from"system";function probeEnabled(){let e=i.getenv(`GJSIFY_HOST_PROBE`);if(e===null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const o=`<gtk-host probe: recorder self-check>`;function recorderIsHonest(e,t){let n=t.length;e(o,!1);let r=t.length===n+1&&t[n]===o;t.length=n,e(o,!0);let i=t.length===n;return t.length=n,r&&i?null:r?`the probe recorder records a PASSING check as a failure, so every assertion below is a false alarm`:`the probe recorder did not record a failed check, so every assertion below is unverifiable`}async function runHostProbe(t){let n=t.label??`PROBE`,r=e();r.reset();let i=[],check=(e,t)=>{t||i.push(e)},a=recorderIsHonest(check,i);a!==null&&i.push(a);let o={};try{let e=t.build(null);o=await t.assert(e,check),t.teardown?.(e)}catch(e){i.push(`threw: ${e.message}`)}let s=r.seen.length;check(`no GTK diagnostics (saw ${s})`,s===0);let c=JSON.stringify({...i.length>0?{failures:i}:{},diagnostics:s,...o});return print(`${n}: ${i.length>0?`FAIL`:`PASS`} ${c}`),+(i.length>0)}async function runHostProbeApp(e){if(probeEnabled())return n.init(),a.exit(await runHostProbe(e));let t=new r.Application({application_id:e.applicationId});t.connect(`activate`,()=>{t.hold(),(async()=>{try{let n=await runHostProbe(e);if(n!==0)return a.exit(n);e.present(e.build(t))}catch(t){return printerr(`JS ERROR: ${e.applicationId} probe threw: ${String(t)}`),a.exit(1)}finally{t.release()}})()}),await t.runAsync([])}function shotEvidence(e,n){let r=n(e);return{widgets:t(e).length-1,width:e.get_width(),height:e.get_height(),bytes:r?r.length:0}}function blankReason(e){return e.widgets===0?`nothing was rendered into the container: it has no children at all, which is what a refused render, an unmounted root and a component returning null all look like from GTK`:e.width<=0||e.height<=0?`the container is allocated ${e.width}×${e.height}: its ${e.widgets} widget(s) exist and occupy nothing`:e.bytes===0?`the capture produced no PNG: the widget has no renderer yet, so it was measured before it was ever on screen`:null}function checkRendered(e,t,n){let r=blankReason(n);e(r===null?t:`${t} — ${r}`,r===null)}export{blankReason,checkRendered,probeEnabled,runHostProbe,runHostProbeApp,shotEvidence};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{installDiagnosticsGate as e}from"./conformance/diagnostics.js";import{descendants as t}from"./conformance/index.js";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://GLib?version=2.0";import a from"system";function probeEnabled(){let e=i.getenv(`GJSIFY_HOST_PROBE`);if(e===null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}const o=`<gtk-host probe: recorder self-check>`;function recorderIsHonest(e,t){let n=t.length;e(o,!1);let r=t.length===n+1&&t[n]===o;t.length=n,e(o,!0);let i=t.length===n;return t.length=n,r&&i?null:r?`the probe recorder records a PASSING check as a failure, so every assertion below is a false alarm`:`the probe recorder did not record a failed check, so every assertion below is unverifiable`}async function runHostProbe(t){let n=t.label??`PROBE`,r=e();r.reset();let i=[],check=(e,t)=>{t||i.push(e)},a=recorderIsHonest(check,i);a!==null&&i.push(a);let o={};try{let e=t.build(null);o=await t.assert(e,check),t.teardown?.(e)}catch(e){i.push(`threw: ${e.message}`)}let s=r.seen.length;check(`no GTK diagnostics (saw ${s})`,s===0);let c=JSON.stringify({...i.length>0?{failures:i}:{},diagnostics:s,...o});return print(`${n}: ${i.length>0?`FAIL`:`PASS`} ${c}`),+(i.length>0)}async function runHostProbeApp(e){if(probeEnabled())return n.init(),a.exit(await runHostProbe(e));let t=new r.Application({application_id:e.applicationId});t.connect(`activate`,()=>{t.hold(),(async()=>{try{let n=await runHostProbe(e);if(n!==0)return a.exit(n);e.present(e.build(t))}catch(t){return printerr(`JS ERROR: ${e.applicationId} probe threw: ${String(t)}`),a.exit(1)}finally{t.release()}})()}),await t.runAsync([])}function shotEvidence(e,n){let r=n(e);return{widgets:t(e).length-1,width:e.get_width(),height:e.get_height(),bytes:r?r.length:0}}function blankReason(e){return e.widgets===0?`nothing was rendered into the container: it has no children at all, which is what a refused render, an unmounted root and a component returning null all look like from GTK`:e.width<=0||e.height<=0?`the container is allocated ${e.width}×${e.height}: its ${e.widgets} widget(s) exist and occupy nothing`:e.bytes===0?`the capture produced no PNG: the widget has no renderer yet, so it was measured before it was ever on screen`:null}function checkRendered(e,t,n){let r=blankReason(n);e(r===null?t:`${t} — ${r}`,r===null)}export{blankReason,checkRendered,probeEnabled,runHostProbe,runHostProbeApp,shotEvidence};
|
package/lib/esm/props.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import t from"gi://GObject";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://Gdk?version=4.0";import a from"gi://Pango";const o=[[`Gtk`,n],[`Adw`,r],[`Gdk`,i],[`Pango`,a],[`G`,t]];function toPropertyName(e){return e.includes(`-`)?e:e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function withoutKeys(e,t){if(!e)return;let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n}const s=new Map;function paramSpecs(e,t){let n=s.get(t);if(n)return n;n=new Map;for(let t of e.list_properties())n.set(t.get_name(),t);return s.set(t,n),n}const isFlag=(e,t)=>(e&t)!==0,isWritable=e=>isFlag(e.flags,t.ParamFlags.WRITABLE),isConstructOnly=e=>isFlag(e.flags,t.ParamFlags.CONSTRUCT_ONLY);function constructOnlyNames(e,t){let n=[];for(let[r,i]of paramSpecs(e,t))isConstructOnly(i)&&isWritable(i)&&n.push(r);return n}function resolveEnumValue(e,t){for(let[n,r]of o){if(!e.startsWith(n))continue;let i=r[e.slice(n.length)];if(!i)continue;let a=i[t.toUpperCase().replace(/-/g,`_`)];return typeof a==`number`?{resolved:!0,value:a}:{resolved:!0}}return{resolved:!1}}const lookupEnumNick=(e,t)=>resolveEnumValue(e,t).value;function coerce(n,r,i){if(r==null)return r;let a=n.value_type;if(t.type_is_a(a,t.TYPE_ENUM)&&typeof r==`string`){let o=t.type_name(a),s=resolveEnumValue(o,r);if(s.value!==void 0)return s.value;throw s.resolved?e.badEnum(i,n.get_name(),r,o):e.unresolvableEnum(o)}if(t.type_is_a(a,t.TYPE_FLAGS)&&typeof r==`string`)throw e.badFlags(i,n.get_name(),r,t.type_name(a));if(t.type_is_a(a,t.TYPE_BOOLEAN)){if(typeof r==`boolean`)return r;if(r===`true`)return!0;if(r===`false`)return!1;if(typeof r==`string`)throw e.badBoolean(i,n.get_name(),r);return!!r}if(t.type_is_a(a,t.TYPE_STRING)){if(typeof r==`string`)return r;if(typeof r==`number`||typeof r==`boolean`)return String(r);throw e.badString(i,n.get_name(),typeof r)}return(t.type_is_a(a,t.TYPE_INT)||t.type_is_a(a,t.TYPE_UINT)||t.type_is_a(a,t.TYPE_INT64)||t.type_is_a(a,t.TYPE_UINT64))&&typeof r==`number`?Math.trunc(r):r}const c=[t.TYPE_BOOLEAN,t.TYPE_STRING,t.TYPE_INT,t.TYPE_UINT,t.TYPE_INT64,t.TYPE_UINT64,t.TYPE_DOUBLE,t.TYPE_FLOAT],isScalarSpec=e=>t.type_is_a(e.value_type,t.TYPE_ENUM)||c.some(n=>t.type_is_a(e.value_type,n)),toAccessorName=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),l=new Map;function constructedDefaults(e){let r=l.get(e.gtype);if(r)return r;let i=new Map;l.set(e.gtype,i);let a=e.ctor(),o;try{let t={};for(let n of e.requiresProps??[])t[n]=``;o=new a(t)}catch{return i}for(let[n,r]of paramSpecs(a,e.gtype)){if(!isWritable(r)||isConstructOnly(r)||!isFlag(r.flags,t.ParamFlags.READABLE)||isFlag(r.flags,t.ParamFlags.DEPRECATED)||!isScalarSpec(r))continue;let e=toAccessorName(n);e in o&&i.set(n,o[e])}return o instanceof n.Window&&o.destroy(),i}function removedValue(e,t){let n=constructedDefaults(e),r=t.get_name();return n.has(r)?n.get(r):t.get_default_value()}function requireSpec(t,n,r){let i=t.get(r);if(!i)throw e.unknownProp(n,r);if(!isWritable(i))throw e.readOnlyProp(n,r);return i}export{coerce,constructOnlyNames,isConstructOnly,isWritable,lookupEnumNick,paramSpecs,removedValue,requireSpec,toPropertyName,withoutKeys};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import t from"gi://GObject?version=2.0";import n from"gi://Gtk?version=4.0";import r from"gi://Adw?version=1";import i from"gi://Gdk?version=4.0";import a from"gi://Pango?version=1.0";const o=[[`Gtk`,n],[`Adw`,r],[`Gdk`,i],[`Pango`,a],[`G`,t]];function toPropertyName(e){return e.includes(`-`)?e:e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function withoutKeys(e,t){if(!e)return;let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n}const s=new Map;function paramSpecs(e,t){let n=s.get(t);if(n)return n;n=new Map;for(let t of e.list_properties())n.set(t.get_name(),t);return s.set(t,n),n}const isFlag=(e,t)=>(e&t)!==0,isWritable=e=>isFlag(e.flags,t.ParamFlags.WRITABLE),isConstructOnly=e=>isFlag(e.flags,t.ParamFlags.CONSTRUCT_ONLY);function constructOnlyNames(e,t){let n=[];for(let[r,i]of paramSpecs(e,t))isConstructOnly(i)&&isWritable(i)&&n.push(r);return n}function resolveEnumValue(e,t){for(let[n,r]of o){if(!e.startsWith(n))continue;let i=r[e.slice(n.length)];if(!i)continue;let a=i[t.toUpperCase().replace(/-/g,`_`)];return typeof a==`number`?{resolved:!0,value:a}:{resolved:!0}}return{resolved:!1}}const lookupEnumNick=(e,t)=>resolveEnumValue(e,t).value;function enumMembers(e){for(let[t,n]of o){if(!e.startsWith(t))continue;let r=n[e.slice(t.length)];if(r)return Object.keys(r).filter(e=>e!==`$gtype`&&typeof r[e]==`number`)}}function coerce(n,r,i){if(r==null)return r;let a=n.value_type;if(t.type_is_a(a,t.TYPE_ENUM)&&typeof r==`string`){let o=t.type_name(a),s=resolveEnumValue(o,r);if(s.value!==void 0)return s.value;throw s.resolved?e.badEnum(i,n.get_name(),r,o):e.unresolvableEnum(o)}if(t.type_is_a(a,t.TYPE_FLAGS)&&typeof r==`string`)throw e.badFlags(i,n.get_name(),r,t.type_name(a));if(t.type_is_a(a,t.TYPE_BOOLEAN)){if(typeof r==`boolean`)return r;if(r===`true`)return!0;if(r===`false`)return!1;if(typeof r==`string`)throw e.badBoolean(i,n.get_name(),r);return!!r}if(t.type_is_a(a,t.TYPE_STRING)){if(typeof r==`string`)return r;if(typeof r==`number`||typeof r==`boolean`)return String(r);throw e.badString(i,n.get_name(),typeof r)}return(t.type_is_a(a,t.TYPE_INT)||t.type_is_a(a,t.TYPE_UINT)||t.type_is_a(a,t.TYPE_INT64)||t.type_is_a(a,t.TYPE_UINT64))&&typeof r==`number`?Math.trunc(r):r}const c=[t.TYPE_BOOLEAN,t.TYPE_STRING,t.TYPE_INT,t.TYPE_UINT,t.TYPE_INT64,t.TYPE_UINT64,t.TYPE_DOUBLE,t.TYPE_FLOAT],isScalarSpec=e=>t.type_is_a(e.value_type,t.TYPE_ENUM)||c.some(n=>t.type_is_a(e.value_type,n)),toAccessorName=e=>e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase()),l=new Map;function constructedDefaults(e){let r=l.get(e.gtype);if(r)return r;let i=new Map;l.set(e.gtype,i);let a=e.ctor(),o;try{let t={};for(let n of e.requiresProps??[])t[n]=``;o=new a(t)}catch{return i}for(let[n,r]of paramSpecs(a,e.gtype)){if(!isWritable(r)||isConstructOnly(r)||!isFlag(r.flags,t.ParamFlags.READABLE)||isFlag(r.flags,t.ParamFlags.DEPRECATED)||!isScalarSpec(r))continue;let e=toAccessorName(n);e in o&&i.set(n,o[e])}return o instanceof n.Window&&o.destroy(),i}function removedValue(e,t){let n=constructedDefaults(e),r=t.get_name();return n.has(r)?n.get(r):t.get_default_value()}function requireSpec(t,n,r){let i=t.get(r);if(!i)throw e.unknownProp(n,r);if(!isWritable(i))throw e.readOnlyProp(n,r);return i}export{coerce,constructOnlyNames,enumMembers,isConstructOnly,isWritable,lookupEnumNick,paramSpecs,removedValue,requireSpec,toPropertyName,withoutKeys};
|
package/lib/esm/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{tagOf as t}from"./tags.js";import n from"gi://GObject";const r=new Map,i=new Map;function registerWidget(e){r.set(e.gtype,e);let n=t(e.gtype);n!==e.gtype&&i.set(n,e)}function registerWidgets(e){for(let t of e)registerWidget(t)}function lookupWidget(t){let n=r.get(t)??i.get(t);if(!n)throw e.unknownTag(t);return n}const hasWidget=e=>r.has(e)||i.has(e),registeredTags=()=>[...r.keys()].sort();function nearestRegistered(e){for(let t=e;t;t=n.type_parent(t)){let e=n.type_name(t);if(!e)break;let i=r.get(e);if(i)return i}}function clearRegistry(){r.clear(),i.clear()}export{clearRegistry,hasWidget,lookupWidget,nearestRegistered,registerWidget,registerWidgets,registeredTags};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{err as e}from"./errors.js";import{tagOf as t}from"./tags.js";import n from"gi://GObject?version=2.0";const r=new Map,i=new Map;function registerWidget(e){r.set(e.gtype,e);let n=t(e.gtype);n!==e.gtype&&i.set(n,e)}function registerWidgets(e){for(let t of e)registerWidget(t)}function lookupWidget(t){let n=r.get(t)??i.get(t);if(!n)throw e.unknownTag(t);return n}const hasWidget=e=>r.has(e)||i.has(e),registeredTags=()=>[...r.keys()].sort();function nearestRegistered(e){for(let t=e;t;t=n.type_parent(t)){let e=n.type_name(t);if(!e)break;let i=r.get(e);if(i)return i}}function clearRegistry(){r.clear(),i.clear()}export{clearRegistry,hasWidget,lookupWidget,nearestRegistered,registerWidget,registerWidgets,registeredTags};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import e from"gi://Gtk?version=4.0";import t from"gi://Gdk?version=4.0";var StyleSheetError=class extends Error{constructor(e){super(`@gjsify/gtk-host/style: ${e}`),this.name=`StyleSheetError`}};const n=`gjsify-probe-8f3a91c4`,r=`.${n} { color: rgb(1 2 3); }`;function assertContained(t,i){let a=new e.CssProvider,o=[],s=a.connect(`parsing-error`,(e,t,n)=>{o.push(n.message)});if(a.load_from_string(`${t}\n${r}`),a.disconnect(s),!a.to_string().includes(n))throw new StyleSheetError(`${i} would disable every rule after it in the document, so it is refused:\n ${t}\n`+(o.length>0?` GTK said: ${o.join(`; `)}`:` GTK reported no error, which is why this is checked by containment rather than by the error signal.`));if(o.length>0)throw new StyleSheetError(`GTK refused a declaration in ${i}:\n ${t}\n ${o.join(`; `)}`)}function installProvider(n,r,i,a){let o=i??t.Display.get_default();if(o===null)throw new StyleSheetError(`there is no Gdk display to install ${r} on. Install it after Gtk.init(), or pass one explicitly.`);return e.StyleContext.add_provider_for_display(o,n,a),o}export{StyleSheetError,assertContained,installProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";const e=[[`GtkWidget`,`margin-top`,`gint`],[`GtkWidget`,`margin-bottom`,`gint`],[`GtkWidget`,`margin-start`,`gint`],[`GtkWidget`,`margin-end`,`gint`],[`GtkWidget`,`halign`,`GtkAlign`],[`GtkWidget`,`valign`,`GtkAlign`],[`GtkWidget`,`hexpand`,`gboolean`],[`GtkWidget`,`vexpand`,`gboolean`],[`GtkWidget`,`width-request`,`gint`],[`GtkWidget`,`height-request`,`gint`],[`GtkWidget`,`overflow`,`GtkOverflow`],[`GtkWidget`,`visible`,`gboolean`],[`GtkBox`,`orientation`,`GtkOrientation`],[`GtkBox`,`spacing`,`gint`],[`GtkLabel`,`xalign`,`gfloat`],[`GtkLabel`,`justify`,`GtkJustification`]],t=[[`GtkWidget`,`margin-left`],[`GtkWidget`,`margin-right`],[`GtkWidget`,`padding`],[`GtkWidget`,`padding-top`],[`GtkBox`,`padding`],[`GtkBox`,`margin-left`],[`GtkWidget`,`gap`],[`GtkBox`,`gap`],[`GtkWidget`,`flex`],[`GtkWidget`,`orientation`],[`GtkWidget`,`spacing`],[`GtkLabel`,`orientation`],[`GtkLabel`,`spacing`],[`GtkCenterBox`,`spacing`],[`GtkFlowBox`,`spacing`],[`GtkWidget`,`xalign`],[`GtkBox`,`xalign`]],n=new Set(e.map(([,e])=>e));export{n as GTK_WIDGET_PROPERTIES,e as GTK_WIDGET_PROPERTY_PROBES,t as NOT_GTK_WIDGET_PROPERTIES};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";const e=[[`GtkWidget`,`margin-top`,`gint`],[`GtkWidget`,`margin-bottom`,`gint`],[`GtkWidget`,`margin-start`,`gint`],[`GtkWidget`,`margin-end`,`gint`],[`GtkWidget`,`halign`,`GtkAlign`],[`GtkWidget`,`valign`,`GtkAlign`],[`GtkWidget`,`hexpand`,`gboolean`],[`GtkWidget`,`vexpand`,`gboolean`],[`GtkWidget`,`width-request`,`gint`],[`GtkWidget`,`height-request`,`gint`],[`GtkWidget`,`overflow`,`GtkOverflow`],[`GtkWidget`,`visible`,`gboolean`],[`GtkBox`,`orientation`,`GtkOrientation`],[`GtkBox`,`spacing`,`gint`],[`GtkLabel`,`xalign`,`gfloat`],[`GtkLabel`,`justify`,`GtkJustification`],[`GtkFlowBox`,`row-spacing`,`guint`],[`GtkFlowBox`,`column-spacing`,`guint`],[`GtkFlowBox`,`max-children-per-line`,`guint`],[`GtkFlowBox`,`selection-mode`,`GtkSelectionMode`]],t=[[`GtkWidget`,`margin-left`],[`GtkWidget`,`margin-right`],[`GtkWidget`,`padding`],[`GtkWidget`,`padding-top`],[`GtkBox`,`padding`],[`GtkBox`,`margin-left`],[`GtkWidget`,`gap`],[`GtkBox`,`gap`],[`GtkWidget`,`flex`],[`GtkWidget`,`orientation`],[`GtkWidget`,`spacing`],[`GtkLabel`,`orientation`],[`GtkLabel`,`spacing`],[`GtkCenterBox`,`spacing`],[`GtkFlowBox`,`spacing`],[`GtkWidget`,`xalign`],[`GtkBox`,`xalign`]],n=new Set(e.map(([,e])=>e));export{n as GTK_WIDGET_PROPERTIES,e as GTK_WIDGET_PROPERTY_PROBES,t as NOT_GTK_WIDGET_PROPERTIES};
|
package/lib/esm/style/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{StyleSheetError as e,assertContained as t}from"./document.js";import{UnknownUtilityError as n}from"./errors.js";import{GTK_CSS_PROBES as r,GTK_CSS_PROPERTIES as i,NOT_GTK_CSS as a}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as o,GTK_WIDGET_PROPERTY_PROBES as s,NOT_GTK_WIDGET_PROPERTIES as c}from"./gtk-props.js";import{MINIMAL_TOKENS as l,TAILWIND_DEFAULT_TOKENS as u,lookupToken as d,mergeTokens as f,requireToken as p,tailwindDefaultHint as m}from"./tokens.js";import{PAINT_PROPERTIES as h,partitionPaint as g,resolvePaintUtility as _}from"./paint.js";import{LAYOUT_PROPERTIES as v,partitionLayout as y,resolveLayoutUtility as b}from"./layout.js";import{partition as x,resolveUtilities as S,resolveUtility as C}from"./resolve.js";import{StyleSheet as w,VARIANT_PSEUDO as T}from"./sheet.js";import{ADWAITA_NAMED_COLORS as E,NEUTRAL_THEME as D,NOT_ADWAITA_NAMED_COLORS as O,THEME_PROVIDER_PRIORITY as k,ThemeRegistry as A}from"./theme.js";export{E as ADWAITA_NAMED_COLORS,r as GTK_CSS_PROBES,i as GTK_CSS_PROPERTIES,o as GTK_WIDGET_PROPERTIES,s as GTK_WIDGET_PROPERTY_PROBES,v as LAYOUT_PROPERTIES,l as MINIMAL_TOKENS,D as NEUTRAL_THEME,O as NOT_ADWAITA_NAMED_COLORS,a as NOT_GTK_CSS,c as NOT_GTK_WIDGET_PROPERTIES,h as PAINT_PROPERTIES,w as StyleSheet,e as StyleSheetError,u as TAILWIND_DEFAULT_TOKENS,k as THEME_PROVIDER_PRIORITY,A as ThemeRegistry,n as UnknownUtilityError,T as VARIANT_PSEUDO,t as assertContained,d as lookupToken,f as mergeTokens,x as partition,y as partitionLayout,g as partitionPaint,p as requireToken,b as resolveLayoutUtility,_ as resolvePaintUtility,S as resolveUtilities,C as resolveUtility,m as tailwindDefaultHint};
|
package/lib/esm/style/layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as n}from"./gtk-props.js";import{requireToken as r}from"./tokens.js";const i="GTK expresses main-axis growth as the boolean `hexpand`/`vexpand`, so there is no growth factor, no shrink factor and no flex basis to carry. `flex-1` is the only spelling with a GTK meaning",a="GTK's box gives leftover main-axis space to the children that expand; it has no per-gap distribution mode, and `Gtk.CenterBox` has exactly three slots. Unlike `justify-between`, no child count makes this expressible, so it is refused here rather than deferred to the shadow tree",o="scrolling is a WIDGET on GTK, not an overflow mode: wrap the element in a `Gtk.ScrolledWindow` (React Native `ScrollView`). `Gtk.Overflow` has exactly VISIBLE and HIDDEN (measured)",s="GTK has no percentage size: a widget requests a MINIMUM in pixels (`width-request`) or expands to fill what it is given (`hexpand`). `w-full`/`h-full` are the only fractions with an exact GTK meaning",c={m:[`marginTop`,`marginRight`,`marginBottom`,`marginLeft`],mt:[`marginTop`],mr:[`marginRight`],mb:[`marginBottom`],ml:[`marginLeft`],mx:[`marginLeft`,`marginRight`],my:[`marginTop`,`marginBottom`],ms:[`marginStart`],me:[`marginEnd`]},l={p:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],pt:[`paddingTop`],pr:[`paddingRight`],pb:[`paddingBottom`],pl:[`paddingLeft`],px:[`paddingLeft`,`paddingRight`],py:[`paddingTop`,`paddingBottom`]},u={inset:[`top`,`right`,`bottom`,`left`],top:[`top`],right:[`right`],bottom:[`bottom`],left:[`left`]},d={start:`flex-start`,end:`flex-end`,center:`center`,stretch:`stretch`,baseline:`baseline`},f={start:`flex-start`,end:`flex-end`,center:`center`,between:`space-between`,around:`space-around`,evenly:`space-evenly`},fill=(e,t)=>{let n={};for(let r of e)n[r]=t;return n};function requireSize(t,n,r,i){let a=t[n],o=a?.[r]??t.spacing?.[r];if(o!==void 0)return o;let s=[...new Set([...Object.keys(a??{}),...Object.keys(t.spacing??{})])].sort().join(`, `);throw new e(i,`"${r}" is in neither the ${n} nor the spacing scale. Known: ${s===``?`(neither scale is configured)`:s}`)}function resolveLayoutUtility(t,n){switch(t){case`flex-1`:case`grow`:return{flexGrow:`1`};case`flex-row`:return{flexDirection:`row`};case`flex-col`:return{flexDirection:`column`};case`flex-nowrap`:return{};case`flex-wrap`:case`flex-wrap-reverse`:throw new e(t,"a `Gtk.Box` cannot wrap. Wrapping is a different widget — `Gtk.FlowBox` — and swapping the widget under an element is L2 widget selection, not a style property");case`flex-row-reverse`:case`flex-col-reverse`:throw new e(t,"`Gtk.Box` has no reversed orientation (`GtkOrientation` is HORIZONTAL and VERTICAL, measured). Reverse the children instead — the shadow tree is the order");case`absolute`:return{position:`absolute`};case`relative`:return{position:`relative`};case`hidden`:return{display:`none`};case`overflow-hidden`:return{overflow:`hidden`};case`overflow-visible`:return{overflow:`visible`};case`overflow-scroll`:case`overflow-auto`:throw new e(t,o);case`w-full`:return{width:`100%`};case`h-full`:return{height:`100%`}}let p=t.indexOf(`-`),m=p===-1?t:t.slice(0,p),h=p===-1?``:t.slice(p+1),g=c[m];if(g!==void 0)return fill(g,r(n.spacing,h,t,`spacing`));let _=l[m];if(_!==void 0)return fill(_,r(n.spacing,h,t,`spacing`));let v=u[m];if(v!==void 0)return fill(v,r(n.spacing,h,t,`spacing`));switch(m){case`ps`:case`pe`:throw new e(t,"GTK has no logical padding in either mechanism — `padding-start` is not a CSS property (measured) and no GTK class installs a padding property at all — so it cannot be expressed even approximately. Use `pl-*`/`pr-*`");case`flex`:case`grow`:case`shrink`:case`basis`:throw new e(t,i);case`items`:{let e=d[h];if(e===void 0)throw unknownToken(t,h,d);return{alignItems:e}}case`self`:{let n=h===`baseline`?void 0:d[h];if(n===void 0)throw h===`baseline`?new e(t,"a baseline is shared by a whole row, so GTK carries it on the BOX as `baseline-position` (measured on `Gtk.Box`, absent from `Gtk.Widget`) rather than per child. Use `items-baseline` on the parent"):unknownToken(t,h,d);return{alignSelf:n}}case`justify`:{if(h===`around`||h===`evenly`)throw new e(t,a);let n=f[h];if(n===void 0)throw unknownToken(t,h,f);return{justifyContent:n}}case`gap`:return h.startsWith(`x-`)?{columnGap:r(n.spacing,h.slice(2),t,`spacing`)}:h.startsWith(`y-`)?{rowGap:r(n.spacing,h.slice(2),t,`spacing`)}:{gap:r(n.spacing,h,t,`spacing`)};case`w`:case`h`:{if(h.includes(`/`))throw new e(t,s);let r=m===`w`?`width`:`height`;return{[r]:requireSize(n,r,h,t)}}case`text`:if(h===`left`||h===`center`||h===`right`||h===`justify`)return{textAlign:h};if(h===`start`||h===`end`)throw new e(t,"GTK aligns text PHYSICALLY: `Gtk.Label:xalign` is 0 = left, and `GtkJustification` has exactly LEFT, RIGHT, CENTER and FILL (measured). There is no start/end spelling to map onto. Use `text-left`/`text-right`");return null}return null}const unknownToken=(t,n,r)=>new e(t,`"${n}" is not a value of this family. Known: ${Object.keys(r).join(`, `)}`);function emitCss(n,r,i){if(!t.has(r))throw new e(r,`is not a property GTK accepts in a stylesheet — see gtk-css.ts`);n.css.push(`${r}: ${i}`)}function emitProp(t,r,i){if(!n.has(r))throw new e(r,`is not a property any GTK class installs — see gtk-props.ts`);t.props[r]=i}const p=/^(-?\d+(?:\.\d+)?)(?:px)?$/;function pixels(t,n){let r=p.exec(t.trim());if(r===null)throw new e(n,`"${t}" is not a pixel length. GTK's "${n}" is a gint of device pixels (measured, gtk-props.ts) with no unit conversion behind it, so only "12px" and "12" can be stored`);return Math.round(Number(r[1]))}function oneOf(t,n,r){if(n.includes(t))return t;throw new e(r,`"${t}" is not a value this partition routes. Known: ${n.join(`, `)}`)}const edgeRoute=t=>(n,r)=>{let i=r.intent.overlay;if(i===void 0||i.role!==`child`)throw new e(t,"only offsets an element that is absolutely positioned, and this one is not. GTK has no relative offset: add `absolute` (which makes the parent a `Gtk.Overlay`), or express the distance as a margin");i.edges[t]=pixels(n,t)},m={marginTop:(e,t)=>emitProp(t,`margin-top`,pixels(e,`margin-top`)),marginBottom:(e,t)=>emitProp(t,`margin-bottom`,pixels(e,`margin-bottom`)),marginStart:(e,t)=>emitProp(t,`margin-start`,pixels(e,`margin-start`)),marginEnd:(e,t)=>emitProp(t,`margin-end`,pixels(e,`margin-end`)),marginLeft:(e,t)=>emitCss(t,`margin-left`,e),marginRight:(e,t)=>emitCss(t,`margin-right`,e),paddingTop:(e,t)=>emitCss(t,`padding-top`,e),paddingRight:(e,t)=>emitCss(t,`padding-right`,e),paddingBottom:(e,t)=>emitCss(t,`padding-bottom`,e),paddingLeft:(e,t)=>emitCss(t,`padding-left`,e),flexDirection:(e,t)=>emitProp(t,`orientation`,oneOf(e,[`row`,`column`],`flexDirection`)===`row`?`horizontal`:`vertical`),flexGrow:(t,n)=>{if(t!==`1`)throw new e(`flexGrow`,i);n.intent.expand=`main-axis`},alignItems:(e,t)=>{t.intent.alignChildren=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignItems`)},justifyContent:(t,n)=>{if(t===`space-around`||t===`space-evenly`)throw new e(`justifyContent`,a);n.intent.distribute=oneOf(t,[`flex-start`,`flex-end`,`center`,`space-between`],`justifyContent`)},alignSelf:(e,t)=>{t.intent.alignSelf=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignSelf`)},gap:(e,t)=>emitProp(t,`spacing`,pixels(e,`spacing`)),columnGap:(e,t)=>{t.intent.axisSpacing={axis:`horizontal`,pixels:pixels(e,`spacing`)}},rowGap:(e,t)=>{t.intent.axisSpacing={axis:`vertical`,pixels:pixels(e,`spacing`)}},width:(e,t)=>e===`100%`?emitProp(t,`hexpand`,!0):emitProp(t,`width-request`,pixels(percentGuard(e,`width`),`width-request`)),height:(e,t)=>e===`100%`?emitProp(t,`vexpand`,!0):emitProp(t,`height-request`,pixels(percentGuard(e,`height`),`height-request`)),overflow:(t,n)=>{if(t===`scroll`)throw new e(`overflow`,o);emitProp(n,`overflow`,oneOf(t,[`visible`,`hidden`],`overflow`))},display:(e,t)=>emitProp(t,`visible`,oneOf(e,[`flex`,`none`],`display`)===`flex`),position:(e,t)=>{t.intent.overlay=oneOf(e,[`relative`,`absolute`],`position`)===`absolute`?{role:`child`,edges:{}}:{role:`context`}},top:edgeRoute(`top`),right:edgeRoute(`right`),bottom:edgeRoute(`bottom`),left:edgeRoute(`left`),textAlign:(e,t)=>{t.intent.textAlign=oneOf(e,[`left`,`center`,`right`,`justify`],`textAlign`)}},h=new Set(Object.keys(m));function percentGuard(t,n){if(t.endsWith(`%`))throw new e(n,s);return t}function partitionLayout(t){let n=t.marginLeft!==void 0||t.marginRight!==void 0,r=t.marginStart!==void 0||t.marginEnd!==void 0;if(n&&r)throw new e(`margin`,"a physical horizontal margin (`ml-*`/`mr-*`/`mx-*`/`m-*`) becomes GTK CSS and a logical one (`ms-*`/`me-*`) becomes the widget property; GTK applies BOTH and they ADD, where CSS would have let one win. Spell the horizontal margin one way");let i=[`gap`,`columnGap`,`rowGap`].filter(e=>t[e]!==void 0);if(i.length>1)throw new e(i.join(` + `),"a `Gtk.Box` has ONE `spacing` (measured), so two gap spellings on one element ask for two spacings. Keep one");let a={css:[],props:{},intent:{}};for(let e of Object.keys(m)){let n=t[e];n!==void 0&&m[e](n,a)}return a}export{h as LAYOUT_PROPERTIES,partitionLayout,resolveLayoutUtility};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{GTK_WIDGET_PROPERTIES as n}from"./gtk-props.js";import{requireToken as r,tailwindDefaultHint as i}from"./tokens.js";const a="GTK expresses main-axis growth as the boolean `hexpand`/`vexpand`, so there is no growth factor, no shrink factor and no flex basis to carry. `flex-1` is the only spelling with a GTK meaning",o="GTK's box gives leftover main-axis space to the children that expand; it has no per-gap distribution mode, and `Gtk.CenterBox` has exactly three slots. Unlike `justify-between`, no child count makes this expressible, so it is refused here rather than deferred to the shadow tree",s="scrolling is a WIDGET on GTK, not an overflow mode: wrap the element in a `Gtk.ScrolledWindow` (React Native `ScrollView`). `Gtk.Overflow` has exactly VISIBLE and HIDDEN (measured)",c="GTK has no percentage size: a widget requests a MINIMUM in pixels (`width-request`) or expands to fill what it is given (`hexpand`). `w-full`/`h-full` are the only fractions with an exact GTK meaning",l={m:[`marginTop`,`marginRight`,`marginBottom`,`marginLeft`],mt:[`marginTop`],mr:[`marginRight`],mb:[`marginBottom`],ml:[`marginLeft`],mx:[`marginLeft`,`marginRight`],my:[`marginTop`,`marginBottom`],ms:[`marginStart`],me:[`marginEnd`]},u={p:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],pt:[`paddingTop`],pr:[`paddingRight`],pb:[`paddingBottom`],pl:[`paddingLeft`],px:[`paddingLeft`,`paddingRight`],py:[`paddingTop`,`paddingBottom`]},d={inset:[`top`,`right`,`bottom`,`left`],top:[`top`],right:[`right`],bottom:[`bottom`],left:[`left`]},f={start:`flex-start`,end:`flex-end`,center:`center`,stretch:`stretch`,baseline:`baseline`},p={start:`flex-start`,end:`flex-end`,center:`center`,between:`space-between`,around:`space-around`,evenly:`space-evenly`},fill=(e,t)=>{let n={};for(let r of e)n[r]=t;return n};function requireSize(t,n,r,a){let o=t[n],s=o?.[r]??t.spacing?.[r];if(s!==void 0)return s;let c=[...new Set([...Object.keys(o??{}),...Object.keys(t.spacing??{})])].sort().join(`, `);throw new e(a,`"${r}" is in neither the ${n} nor the spacing scale. Known: ${c===``?`(neither scale is configured)`:c}`+(i(n,r)||i(`spacing`,r)))}function resolveLayoutUtility(t,n){switch(t){case`flex-1`:case`grow`:return{flexGrow:`1`};case`flex-row`:return{flexDirection:`row`};case`flex-col`:return{flexDirection:`column`};case`flex-nowrap`:return{flexWrap:`nowrap`};case`flex-wrap`:return{flexWrap:`wrap`};case`flex-wrap-reverse`:throw new e(t,"`Gtk.FlowBox` — the widget a wrap becomes — lays its lines out in one direction only: it installs `orientation`, `homogeneous`, `row-spacing`, `column-spacing`, `min-children-per-line`, `max-children-per-line` and `selection-mode`, and nothing that reverses the line order (measured). Reverse the children instead — the shadow tree is the order. `flex-wrap` is the spelling that maps");case`flex-row-reverse`:case`flex-col-reverse`:throw new e(t,"`Gtk.Box` has no reversed orientation (`GtkOrientation` is HORIZONTAL and VERTICAL, measured). Reverse the children instead — the shadow tree is the order");case`absolute`:return{position:`absolute`};case`relative`:return{position:`relative`};case`hidden`:return{display:`none`};case`overflow-hidden`:return{overflow:`hidden`};case`overflow-visible`:return{overflow:`visible`};case`overflow-scroll`:case`overflow-auto`:throw new e(t,s);case`w-full`:return{width:`100%`};case`h-full`:return{height:`100%`}}let i=t.indexOf(`-`),m=i===-1?t:t.slice(0,i),h=i===-1?``:t.slice(i+1),g=l[m];if(g!==void 0)return fill(g,r(n.spacing,h,t,`spacing`));let _=u[m];if(_!==void 0)return fill(_,r(n.spacing,h,t,`spacing`));let v=d[m];if(v!==void 0)return fill(v,r(n.spacing,h,t,`spacing`));switch(m){case`ps`:case`pe`:throw new e(t,"GTK has no logical padding in either mechanism — `padding-start` is not a CSS property (measured) and no GTK class installs a padding property at all — so it cannot be expressed even approximately. Use `pl-*`/`pr-*`");case`flex`:case`grow`:case`shrink`:case`basis`:throw new e(t,a);case`items`:{let e=f[h];if(e===void 0)throw unknownToken(t,h,f);return{alignItems:e}}case`self`:{let n=h===`baseline`?void 0:f[h];if(n===void 0)throw h===`baseline`?new e(t,"a baseline is shared by a whole row, so GTK carries it on the BOX as `baseline-position` (measured on `Gtk.Box`, absent from `Gtk.Widget`) rather than per child. Use `items-baseline` on the parent"):unknownToken(t,h,f);return{alignSelf:n}}case`justify`:{if(h===`around`||h===`evenly`)throw new e(t,o);let n=p[h];if(n===void 0)throw unknownToken(t,h,p);return{justifyContent:n}}case`gap`:return h.startsWith(`x-`)?{columnGap:r(n.spacing,h.slice(2),t,`spacing`)}:h.startsWith(`y-`)?{rowGap:r(n.spacing,h.slice(2),t,`spacing`)}:{gap:r(n.spacing,h,t,`spacing`)};case`w`:case`h`:{if(h.includes(`/`))throw new e(t,c);let r=m===`w`?`width`:`height`;return{[r]:requireSize(n,r,h,t)}}case`text`:if(h===`left`||h===`center`||h===`right`||h===`justify`)return{textAlign:h};if(h===`start`||h===`end`)throw new e(t,"GTK aligns text PHYSICALLY: `Gtk.Label:xalign` is 0 = left, and `GtkJustification` has exactly LEFT, RIGHT, CENTER and FILL (measured). There is no start/end spelling to map onto. Use `text-left`/`text-right`");return null}return null}const unknownToken=(t,n,r)=>new e(t,`"${n}" is not a value of this family. Known: ${Object.keys(r).join(`, `)}`);function emitCss(n,r,i){if(!t.has(r))throw new e(r,`is not a property GTK accepts in a stylesheet — see gtk-css.ts`);n.css.push(`${r}: ${i}`)}function emitProp(t,r,i){if(!n.has(r))throw new e(r,`is not a property any GTK class installs — see gtk-props.ts`);t.props[r]=i}const m=/^(-?\d+(?:\.\d+)?)(?:px)?$/;function pixels(t,n){let r=m.exec(t.trim());if(r===null)throw new e(n,`"${t}" is not a pixel length. GTK's "${n}" is a gint of device pixels (measured, gtk-props.ts) with no unit conversion behind it, so only "12px" and "12" can be stored`);return Math.round(Number(r[1]))}function oneOf(t,n,r){if(n.includes(t))return t;throw new e(r,`"${t}" is not a value this partition routes. Known: ${n.join(`, `)}`)}const multiLine=e=>e.intent.wrap?.lines===`multi`,edgeRoute=t=>(n,r)=>{let i=r.intent.overlay;if(i===void 0||i.role!==`child`)throw new e(t,"only offsets an element that is absolutely positioned, and this one is not. GTK has no relative offset: add `absolute` (which makes the parent a `Gtk.Overlay`), or express the distance as a margin");i.edges[t]=pixels(n,t)},h={marginTop:(e,t)=>emitProp(t,`margin-top`,pixels(e,`margin-top`)),marginBottom:(e,t)=>emitProp(t,`margin-bottom`,pixels(e,`margin-bottom`)),marginStart:(e,t)=>emitProp(t,`margin-start`,pixels(e,`margin-start`)),marginEnd:(e,t)=>emitProp(t,`margin-end`,pixels(e,`margin-end`)),marginLeft:(e,t)=>emitCss(t,`margin-left`,e),marginRight:(e,t)=>emitCss(t,`margin-right`,e),paddingTop:(e,t)=>emitCss(t,`padding-top`,e),paddingRight:(e,t)=>emitCss(t,`padding-right`,e),paddingBottom:(e,t)=>emitCss(t,`padding-bottom`,e),paddingLeft:(e,t)=>emitCss(t,`padding-left`,e),flexDirection:(e,t)=>emitProp(t,`orientation`,oneOf(e,[`row`,`column`],`flexDirection`)===`row`?`horizontal`:`vertical`),flexWrap:(e,t)=>{t.intent.wrap=oneOf(e,[`nowrap`,`wrap`],`flexWrap`)===`wrap`?{lines:`multi`}:{lines:`single`}},flexGrow:(t,n)=>{if(t!==`1`)throw new e(`flexGrow`,a);n.intent.expand=`main-axis`},alignItems:(e,t)=>{t.intent.alignChildren=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignItems`)},justifyContent:(t,n)=>{if(t===`space-around`||t===`space-evenly`)throw new e(`justifyContent`,o);n.intent.distribute=oneOf(t,[`flex-start`,`flex-end`,`center`,`space-between`],`justifyContent`)},alignSelf:(e,t)=>{t.intent.alignSelf=oneOf(e,[`flex-start`,`flex-end`,`center`,`stretch`,`baseline`],`alignSelf`)},gap:(e,t)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={lines:`multi`,rowSpacing:n,columnSpacing:n}:emitProp(t,`spacing`,n)},columnGap:(e,t)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={...t.intent.wrap,lines:`multi`,columnSpacing:n}:t.intent.axisSpacing={axis:`horizontal`,pixels:n}},rowGap:(e,t)=>{let n=pixels(e,`spacing`);multiLine(t)?t.intent.wrap={...t.intent.wrap,lines:`multi`,rowSpacing:n}:t.intent.axisSpacing={axis:`vertical`,pixels:n}},width:(e,t)=>e===`100%`?emitProp(t,`hexpand`,!0):emitProp(t,`width-request`,pixels(percentGuard(e,`width`),`width-request`)),height:(e,t)=>e===`100%`?emitProp(t,`vexpand`,!0):emitProp(t,`height-request`,pixels(percentGuard(e,`height`),`height-request`)),overflow:(t,n)=>{if(t===`scroll`)throw new e(`overflow`,s);emitProp(n,`overflow`,oneOf(t,[`visible`,`hidden`],`overflow`))},display:(e,t)=>emitProp(t,`visible`,oneOf(e,[`flex`,`none`],`display`)===`flex`),position:(e,t)=>{t.intent.overlay=oneOf(e,[`relative`,`absolute`],`position`)===`absolute`?{role:`child`,edges:{}}:{role:`context`}},top:edgeRoute(`top`),right:edgeRoute(`right`),bottom:edgeRoute(`bottom`),left:edgeRoute(`left`),textAlign:(e,t)=>{t.intent.textAlign=oneOf(e,[`left`,`center`,`right`,`justify`],`textAlign`)}},g=new Set(Object.keys(h));function percentGuard(t,n){if(t.endsWith(`%`))throw new e(n,c);return t}function partitionLayout(t){let n=t.marginLeft!==void 0||t.marginRight!==void 0,r=t.marginStart!==void 0||t.marginEnd!==void 0;if(n&&r)throw new e(`margin`,"a physical horizontal margin (`ml-*`/`mr-*`/`mx-*`/`m-*`) becomes GTK CSS and a logical one (`ms-*`/`me-*`) becomes the widget property; GTK applies BOTH and they ADD, where CSS would have let one win. Spell the horizontal margin one way");let i=[`gap`,`columnGap`,`rowGap`].filter(e=>t[e]!==void 0);if(i.length>1&&t.flexWrap!==`wrap`)throw new e(i.join(` + `),"a `Gtk.Box` has ONE `spacing` (measured), so two gap spellings on one element ask for two spacings. Keep one, or add `flex-wrap` — a `Gtk.FlowBox` has a row spacing and a column spacing and can carry both");let a={css:[],props:{},intent:{}};for(let e of Object.keys(h)){let n=t[e];n!==void 0&&h[e](n,a)}return a}export{g as LAYOUT_PROPERTIES,partitionLayout,resolveLayoutUtility};
|
package/lib/esm/style/paint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{lookupToken as n,requireToken as r}from"./tokens.js";const
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";import{GTK_CSS_PROPERTIES as t}from"./gtk-css.js";import{lookupToken as n,requireToken as r,tailwindDefaultHint as i}from"./tokens.js";const a={backgroundColor:`background-color`,color:`color`,opacity:`opacity`,borderRadius:`border-radius`,borderTopLeftRadius:`border-top-left-radius`,borderTopRightRadius:`border-top-right-radius`,borderBottomLeftRadius:`border-bottom-left-radius`,borderBottomRightRadius:`border-bottom-right-radius`,borderWidth:`border-width`,borderTopWidth:`border-top-width`,borderRightWidth:`border-right-width`,borderBottomWidth:`border-bottom-width`,borderLeftWidth:`border-left-width`,borderColor:`border-color`,fontSize:`font-size`,fontWeight:`font-weight`,fontFamily:`font-family`,fontStyle:`font-style`,letterSpacing:`letter-spacing`,lineHeight:`line-height`,textDecorationLine:`text-decoration-line`,textTransform:`text-transform`},withAlpha=(t,n)=>{let r=Number(n);if(!Number.isFinite(r)||r<0||r>100)throw new e(`${t}/${n}`,`the alpha modifier must be 0–100, got "${n}"`);return`alpha(${t}, ${r/100})`};function resolvePaintUtility(t,a){if(t.includes(`:`))throw new e(t,`strip the variant prefix before resolving; this resolves the utility itself`);let l=t.lastIndexOf(`/`),u=l===-1?void 0:t.slice(l+1),d=l===-1?t:t.slice(0,l),colour=e=>u===void 0?e:withAlpha(e,u),noAlpha=()=>{if(u!==void 0)throw new e(t,`an alpha modifier only applies to a colour utility`)};switch(d){case`underline`:return noAlpha(),{textDecorationLine:`underline`};case`line-through`:return noAlpha(),{textDecorationLine:`line-through`};case`no-underline`:return noAlpha(),{textDecorationLine:`none`};case`uppercase`:return noAlpha(),{textTransform:`uppercase`};case`lowercase`:return noAlpha(),{textTransform:`lowercase`};case`capitalize`:return noAlpha(),{textTransform:`capitalize`};case`normal-case`:return noAlpha(),{textTransform:`none`};case`italic`:return noAlpha(),{fontStyle:`italic`};case`not-italic`:return noAlpha(),{fontStyle:`normal`};case`rounded`:return noAlpha(),{borderRadius:r(a.borderRadius,`DEFAULT`,t,`borderRadius`)};case`border`:return noAlpha(),{borderWidth:r(a.borderWidth,`DEFAULT`,t,`borderWidth`)}}let f=d.indexOf(`-`),p=f===-1?d:d.slice(0,f),m=f===-1?``:d.slice(f+1);switch(p){case`bg`:return{backgroundColor:colour(r(a.colors,m,t,`colors`))};case`opacity`:return noAlpha(),{opacity:r(a.opacity,m,t,`opacity`)};case`rounded`:{noAlpha();let e=o[m];return e===void 0?{borderRadius:r(a.borderRadius,m,t,`borderRadius`)}:{[e]:r(a.borderRadius,`DEFAULT`,t,`borderRadius`)}}case`border`:{let o=s[m];if(o!==void 0)return noAlpha(),{[o]:r(a.borderWidth,`DEFAULT`,t,`borderWidth`)};let c=n(a.borderWidth,m),l=n(a.colors,m);if(c!==void 0&&l!==void 0)throw new e(t,`"${m}" is in both the borderWidth and colors scales, so this utility is ambiguous`);if(c!==void 0)return noAlpha(),{borderWidth:c};if(l!==void 0)return{borderColor:colour(l)};throw new e(t,`"${m}" is in neither the borderWidth nor the colors scale`+(i(`borderWidth`,m)||i(`colors`,m)))}case`text`:{if(c.has(m))return null;let r=n(a.fontSize,m),o=n(a.colors,m);if(r!==void 0&&o!==void 0)throw new e(t,`"${m}" is in both the fontSize and colors scales, so this utility is ambiguous`);if(r!==void 0)return noAlpha(),{fontSize:r};if(o!==void 0)return{color:colour(o)};throw new e(t,`"${m}" is in neither the fontSize nor the colors scale`+(i(`fontSize`,m)||i(`colors`,m)))}case`font`:{noAlpha();let r=n(a.fontWeight,m),i=n(a.fontFamily,m);if(r!==void 0&&i!==void 0)throw new e(t,`"${m}" is in both the fontWeight and fontFamily scales, so this utility is ambiguous`);if(r!==void 0)return{fontWeight:r};if(i!==void 0)return{fontFamily:i};throw new e(t,`"${m}" is in neither the fontWeight nor the fontFamily scale`)}case`tracking`:return noAlpha(),{letterSpacing:r(a.letterSpacing,m,t,`letterSpacing`)};case`leading`:return noAlpha(),{lineHeight:r(a.lineHeight,m,t,`lineHeight`)}}return null}const o={tl:`borderTopLeftRadius`,tr:`borderTopRightRadius`,bl:`borderBottomLeftRadius`,br:`borderBottomRightRadius`},s={t:`borderTopWidth`,r:`borderRightWidth`,b:`borderBottomWidth`,l:`borderLeftWidth`},c=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),l=new Set(Object.keys(a));function partitionPaint(n){let r=[];for(let[i,o]of Object.entries(n)){if(o===void 0)continue;let n=a[i];if(n===void 0)throw new e(i,`is not a property the paint partition routes`);if(!t.has(n))throw new e(i,`maps to "${n}", which GTK does not accept — see gtk-css.ts`);r.push(`${n}: ${o}`)}let i=r.some(e=>/^border(-(top|right|bottom|left))?-width:/.test(e)),o=r.some(e=>/^border(-(top|right|bottom|left))?-style:/.test(e));return i&&!o&&r.push(`border-style: solid`),r}export{a as CSS_NAME,l as PAINT_PROPERTIES,partitionPaint,resolvePaintUtility};
|
package/lib/esm/style/sheet.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import e from"
|
|
2
|
-
`);return
|
|
3
|
-
`)}get size(){return this.#t.size}flush(){
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{StyleSheetError as e,assertContained as t,installProvider as n}from"./document.js";import r from"gi://Gtk?version=4.0";const i={active:`:active`,hover:`:hover`,focus:`:focus`,disabled:`:disabled`};function hashName(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return`gjsify-s${t.toString(36)}`}var StyleSheet=class{#e=new r.CssProvider;#t=new Map;#n=!1;#r=!1;#i;constructor(e={}){this.#i=e}classFor(n,r={}){if(n.length===0&&Object.keys(r).length===0)throw new e(`classFor was given no declarations — an empty class would name nothing`);let a=n.join(`; `),o=[],s=hashName(`${a}|${Object.entries(r).map(([e,t])=>`${e}{${t.join(`; `)}}`).sort().join(``)}`);if(this.#t.get(s)!==void 0)return s;n.length>0&&o.push(`.${s} { ${a}; }`);for(let[t,n]of Object.entries(r)){let r=i[t];if(r===void 0)throw new e(`"${t}:" is not a variant this sheet can express. Known: ${Object.keys(i).sort().join(`, `)}. A variant becomes a GTK CSS pseudo-class, so one without a pseudo-class equivalent needs a different mechanism.`);n.length!==0&&o.push(`.${s}${r} { ${n.join(`; `)}; }`)}let c=o.join(`
|
|
2
|
+
`);return t(c,`a generated rule`),this.#t.set(s,c),this.#a(),s}toString(){return[...this.#t.values()].join(`
|
|
3
|
+
`)}get size(){return this.#t.size}flush(){this.#r=!1,this.#e.load_from_string(this.toString()),!this.#n&&(n(this.#e,`the generated stylesheet`,this.#i.display,this.#i.priority??r.STYLE_PROVIDER_PRIORITY_APPLICATION),this.#n=!0)}#a(){this.#r||(this.#r=!0,queueMicrotask(()=>{this.#r&&this.flush()}))}};export{StyleSheet,i as VARIANT_PSEUDO};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{StyleSheetError as e,assertContained as t,installProvider as n}from"./document.js";import r from"gi://Gtk?version=4.0";const i=r.STYLE_PROVIDER_PRIORITY_SETTINGS,a=`accent-color.accent-bg-color.accent-fg-color.destructive-color.destructive-bg-color.destructive-fg-color.success-color.success-bg-color.success-fg-color.warning-color.warning-bg-color.warning-fg-color.error-color.error-bg-color.error-fg-color.window-bg-color.window-fg-color.view-bg-color.view-fg-color.headerbar-bg-color.headerbar-fg-color.headerbar-border-color.headerbar-backdrop-color.headerbar-shade-color.headerbar-darker-shade-color.sidebar-bg-color.sidebar-fg-color.sidebar-backdrop-color.sidebar-shade-color.sidebar-border-color.secondary-sidebar-bg-color.secondary-sidebar-fg-color.card-bg-color.card-fg-color.card-shade-color.dialog-bg-color.dialog-fg-color.popover-bg-color.popover-fg-color.popover-shade-color.thumbnail-bg-color.thumbnail-fg-color.shade-color.scrollbar-outline-color.overview-bg-color.overview-fg-color.active-toggle-bg-color.active-toggle-fg-color`.split(`.`),o=[`borders`,`accent_bg_color`,`window_bg_color`,`acccent-bg-color`],s=new Set(a),c={name:`neutral`,defaultOn:[`*`]};var ThemeRegistry=class{#e=new r.CssProvider;#t=new Map;#n;#r=null;#i=null;constructor(e={}){this.#n=e}register(n){if(n.name===``)throw new e(`a theme needs a name — an unnamed one cannot be selected`);if(this.#t.has(n.name))throw new e(`a theme named "${n.name}" is already registered. Re-registering would silently replace it, and a look that changed without the name changing is the hardest kind to attribute`);for(let e of Object.keys(n.namedColors??{}))assertNamedColor(n.name,e);let r=this.documentOf(n);return r!==``&&t(r,`theme "${n.name}"`),this.#t.set(n.name,n),this}get names(){return[...this.#t.keys()]}get current(){return this.#i}documentOf(e){let t=Object.entries(e.namedColors??{}),n=[];return t.length>0&&n.push(`:root {\n${t.map(([e,t])=>` --${e}: ${t};`).join(`
|
|
2
|
+
`)}\n}`),e.css!==void 0&&e.css.trim()!==``&&n.push(e.css.trim()),n.join(`
|
|
3
|
+
`)}select(t){let n=this.#t.get(t);if(n===void 0)throw new e(`"${t}" is not a registered theme. Known: ${this.names.join(`, `)||`(none registered)`}`);this.#e.load_from_string(this.documentOf(n)),this.#i=t,this.#a()}selectDefault(t){let n=null;for(let[e,r]of this.#t)r.defaultOn?.some(e=>e===t||e===`*`)===!0&&(n=e);if(n===null)throw new e(`no registered theme declares itself the default on "${t}". Registered: ${this.names.join(`, `)||`(none)`}. Give one a \`defaultOn\`, or call select() with a name`);this.select(n)}dispose(){this.#r!==null&&(r.StyleContext.remove_provider_for_display(this.#r,this.#e),this.#r=null,this.#i=null)}#a(){this.#r===null&&(this.#r=n(this.#e,`the theme`,this.#n.display,this.#n.priority??i))}};function assertNamedColor(t,n){if(s.has(n))return;let r=n.includes(`_`);throw new e(`theme "${t}" sets "${n}", which libadwaita does not define as a named colour. `+(r?`Underscores are the LEGACY \`@define-color ${n}\` spelling, which is a different mechanism: emitted as a custom property it defines something nothing reads. The current spelling is "${n.replace(/_/g,`-`)}"`:`A custom property nobody reads is a theme that silently does nothing, which is why this is refused rather than emitted`)+`. Known: ${[...a].sort().join(`, `)}`)}export{a as ADWAITA_NAMED_COLORS,c as NEUTRAL_THEME,o as NOT_ADWAITA_NAMED_COLORS,i as THEME_PROVIDER_PRIORITY,ThemeRegistry};
|
package/lib/esm/style/tokens.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";const t={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,sm:`2px`,DEFAULT:`4px`,md:`6px`,lg:`8px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`},fontSize:{sm:`12px`,base:`14px`,lg:`18px`,xl:`24px`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},opacity:{0:`0`,50:`0.5`,60:`0.6`,70:`0.7`,80:`0.8`,90:`0.9`,100:`1`}},lookupToken=(e,t)=>e?.[t];function requireToken(t,n,r,i){let a=lookupToken(t,n);if(a!==void 0)return a;throw new e(r,`"${n}" is not in the ${i} scale. Known: ${t===void 0?`(the scale is not configured)`:Object.keys(t).sort().join(`, `)}`)}export{t as MINIMAL_TOKENS,lookupToken,requireToken};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{UnknownUtilityError as e}from"./errors.js";const t={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,sm:`2px`,DEFAULT:`4px`,md:`6px`,lg:`8px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`},fontSize:{sm:`12px`,base:`14px`,lg:`18px`,xl:`24px`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},opacity:{0:`0`,50:`0.5`,60:`0.6`,70:`0.7`,80:`0.8`,90:`0.9`,100:`1`}},n={spacing:{0:`0px`,px:`1px`},colors:{transparent:`transparent`,current:`currentColor`,black:`rgb(0 0 0)`,white:`rgb(255 255 255)`},borderRadius:{none:`0`,DEFAULT:`4px`,full:`9999px`},borderWidth:{DEFAULT:`1px`,0:`0`,2:`2px`,4:`4px`,8:`8px`},fontWeight:{thin:`100`,extralight:`200`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`700`,extrabold:`800`,black:`900`},opacity:Object.fromEntries(Array.from({length:21},(e,t)=>[`${t*5}`,`${t/20}`]))};function mergeTokens(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n))r!==void 0&&(t[e]={...t[e],...r});return t}function tailwindDefaultHint(e,t){let r=n[e];return r?.[t]===void 0?``:`. Tailwind's own default scale defines "${t}" (${r[t]}) — a project's \`@theme\` has no reason to declare it, so spread TAILWIND_DEFAULT_TOKENS into your tokens with mergeTokens() if you rely on it`}const lookupToken=(e,t)=>e?.[t];function requireToken(t,n,r,i){let a=lookupToken(t,n);if(a!==void 0)return a;throw new e(r,`"${n}" is not in the ${i} scale. Known: ${t===void 0?`(the scale is not configured)`:Object.keys(t).sort().join(`, `)}${tailwindDefaultHint(i,n)}`)}export{t as MINIMAL_TOKENS,n as TAILWIND_DEFAULT_TOKENS,lookupToken,mergeTokens,requireToken,tailwindDefaultHint};
|
|
@@ -49,7 +49,7 @@ export declare const BUILTIN_DESCRIPTORS: readonly WidgetDescriptor[];
|
|
|
49
49
|
export declare function registerBuiltinWidgets(): void;
|
|
50
50
|
/** What the shipped table is made of, for a diagnostic or an about box. */
|
|
51
51
|
export declare const tableProvenance: () => {
|
|
52
|
-
gir: "Gtk-4.0 Adw-1";
|
|
52
|
+
gir: "Gtk-4.0/4.23.3 Adw-1/1.10.0";
|
|
53
53
|
curated: number;
|
|
54
54
|
generated: number;
|
|
55
55
|
total: number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desktop face extensions `gjsify ship` stages, lower-cased.
|
|
3
|
+
*
|
|
4
|
+
* The same four the writing half accepts (`discoverFonts`, ADR 0038), and deliberately not a
|
|
5
|
+
* shared constant: this package cannot depend on `@gjsify/cli` — wrong direction and wrong tier —
|
|
6
|
+
* so the pairing is a specification both ends implement rather than a value one imports.
|
|
7
|
+
*
|
|
8
|
+
* `.woff`/`.woff2`/`.eot` are absent from BOTH ends. The writer refuses them by name because
|
|
9
|
+
* whether FreeType opens one is `FT_CONFIG_OPTION_USE_BROTLI`, a build option of whichever
|
|
10
|
+
* FreeType the SHIPPED artifact loads rather than of the packaging host; a reader that accepted
|
|
11
|
+
* them would hand the font map a file it may decline on the target and nowhere else.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FONT_FACE_EXTENSIONS: readonly string[];
|
|
14
|
+
export interface ResolveFontDirOptions {
|
|
15
|
+
/** Wins over everything — a dev tree (`data/fonts`), or a test fixture. */
|
|
16
|
+
fontDir?: string;
|
|
17
|
+
/** Environment to read `GJSIFY_FONT_DIR` from. */
|
|
18
|
+
env?: Record<string, string | undefined>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the directory holding the application's shipped faces, or `undefined` when none is named.
|
|
22
|
+
*
|
|
23
|
+
* Precedence: explicit option, then `GJSIFY_FONT_DIR` — exported by the `gjsify ship` launcher,
|
|
24
|
+
* which is the only party that knows whether the payload became `/usr`, a `--prefix` tree, `/app`,
|
|
25
|
+
* a bundle's `Contents/Resources` or a Windows program directory.
|
|
26
|
+
*
|
|
27
|
+
* There is NO system fallback, and that is the one place this parts company with
|
|
28
|
+
* `resolveLocaleDir`, whose `/usr/share/locale` default is both correct and free. The analogous
|
|
29
|
+
* `/usr/share/fonts` is neither: fontconfig has already scanned it, so walking it again would add
|
|
30
|
+
* hundreds of `add_font_file` calls to every startup to arrive at families the font map holds
|
|
31
|
+
* anyway. `undefined` therefore means "this application ships no faces of its own" — the ordinary
|
|
32
|
+
* case, and a quiet one, because the launcher exports the variable only when it staged a face.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveFontDir(options?: ResolveFontDirOptions): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Is `name` a face {@link FONT_FACE_EXTENSIONS} covers?
|
|
37
|
+
*
|
|
38
|
+
* Extension-only and case-insensitive: `BRAND.TTF` is an ordinary name on the case-preserving
|
|
39
|
+
* filesystems macOS and Windows have, and a lowercase-only test would drop it into exactly the
|
|
40
|
+
* substituted-family failure this mechanism exists to prevent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isFontFace(name: string): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ResolveFontDirOptions } from './font-dir.js';
|
|
2
|
+
/** Everything {@link resolveFontDir} takes except the environment, which {@link initFonts} reads. */
|
|
3
|
+
export type InitFontsOptions = Omit<ResolveFontDirOptions, 'env'>;
|
|
4
|
+
/** A face the font map would not take, and why. */
|
|
5
|
+
export interface FontFaceFailure {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly message: string;
|
|
8
|
+
}
|
|
9
|
+
/** What {@link initFonts} did, so a caller that cares can assert on it. */
|
|
10
|
+
export interface InitFontsResult {
|
|
11
|
+
/** The directory that was read, or `undefined` when nothing named one. */
|
|
12
|
+
readonly dir: string | undefined;
|
|
13
|
+
/** Faces now on the default font map. */
|
|
14
|
+
readonly registered: readonly string[];
|
|
15
|
+
/** Faces the font map declined as unsupported — see {@link isUnsupportedByFontMap}. */
|
|
16
|
+
readonly declined: readonly string[];
|
|
17
|
+
/** Faces that failed for any other reason. Each was warned about; none threw. */
|
|
18
|
+
readonly failed: readonly FontFaceFailure[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Did the font map decline runtime registration outright?
|
|
22
|
+
*
|
|
23
|
+
* `pango_font_map_add_font_file()` is a vfunc, and the CoreText map implements none — so on macOS
|
|
24
|
+
* the call falls through to the base implementation, which answers `G_IO_ERROR_NOT_SUPPORTED`.
|
|
25
|
+
* That is not a failure to report: macOS is already correct declaratively, because the bundle's
|
|
26
|
+
* `ATSApplicationFontsPath` had the OS activate the staged directory before the process started,
|
|
27
|
+
* and the ordering makes the runtime call the wrong tool there rather than merely a redundant one
|
|
28
|
+
* — `pango_core_text_font_map_changed()` only bumps a serial, there is no
|
|
29
|
+
* `kCTFontManagerRegisteredFontsChangedNotification` observer and no re-scan path in
|
|
30
|
+
* `pangocoretext-fontmap.c`, so a face registered after the map initialises could not be recovered
|
|
31
|
+
* by poking it anyway.
|
|
32
|
+
*
|
|
33
|
+
* Keyed on the ERROR rather than on `process.platform`, which is the difference between a
|
|
34
|
+
* capability test and a guess about who is asking. It costs no `gjsify.os` declaration (this
|
|
35
|
+
* package makes no OS decision, and ADR 0018's candidate set is derived from the code that reads
|
|
36
|
+
* the host), it stays right if a fontconfig-backed Pango is ever selected on darwin — the backend
|
|
37
|
+
* is chosen by what is compiled in, not per platform, and `PANGOCAIRO_BACKEND=fc` selects one — and
|
|
38
|
+
* it stays right for any other map that declines. The OS name was never the thing being asked.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isUnsupportedByFontMap(error: unknown): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Register every face in the application's shipped font directory with the default font map.
|
|
43
|
+
*
|
|
44
|
+
* Call it once at startup, and BEFORE any text is laid out — that ordering is load-bearing on the
|
|
45
|
+
* fontconfig backend rather than tidiness: it caches the FONTSET resolved for a description and
|
|
46
|
+
* `add_font_file` does not invalidate it, so a `Pango.Layout` that measured the family first keeps
|
|
47
|
+
* measuring the fallback for the life of the process even though the family is then in
|
|
48
|
+
* `list_families()`. win32 clears its cache instead and recovers, so registering early is free
|
|
49
|
+
* there and unrecoverable-if-missed on Linux (measured both ways; `fonts.spec.ts`).
|
|
50
|
+
*
|
|
51
|
+
* Nothing here is eager: this
|
|
52
|
+
* package is the element model renderers bind to and owns no application lifecycle, and a
|
|
53
|
+
* module-load side effect would decide an application's initialisation order invisibly — the same
|
|
54
|
+
* reason `gjsify ship` stages the faces and names the directory instead of injecting the call.
|
|
55
|
+
*
|
|
56
|
+
* Total, like `installDevtools`: a face that will not open costs one stderr line and appears in
|
|
57
|
+
* {@link InitFontsResult.failed}, never an exception. Taking an application down over a decorative
|
|
58
|
+
* face would be worse than rendering it in a fallback — but doing so SILENTLY is the defect this
|
|
59
|
+
* exists against, so it is loud and it is reported.
|
|
60
|
+
*
|
|
61
|
+
* Safe to call when the application ships no faces: `GJSIFY_FONT_DIR` is exported only when
|
|
62
|
+
* `gjsify ship` staged one, so an unset variable is the ordinary case and does nothing quietly.
|
|
63
|
+
*/
|
|
64
|
+
export declare function initFonts(options?: InitFontsOptions): InitFontsResult;
|