@gjsify/adwaita-core 0.63.0 → 0.63.1-next.235

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/markup.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import"./_virtual/_rolldown/runtime.js";import{GTK_WIDGET_EXPAND as e,attributeOf as t,hostTagOf as n,isValueBasedBooleanAttr as r,propertyOf as i,widgetLengthStyle as a}from"./tags.js";function element(e,t,n,r,i,a){let o=` `.repeat(e),s=n.map(([e,t])=>t===null?e:`${e}=${r(t)}`),c=i.length===0,l=c?a?` />`:`></${t}>`:`>`,u=`${o}<${[t,...s].join(` `)}${l}`,d=u.length<=80||s.length===0?u:[`${o}<${t}`,...s.map(e=>`${o} ${e}`),`${o}${c?a?`/>`:`></${t}>`:`>`}`].join(`
2
2
  `);return c?d:[d,...i,`${o}</${t}>`].join(`
3
- `)}const htmlText=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`),htmlQuote=e=>{let t=e.includes(`"`)&&!e.includes(`'`)?`'`:`"`;return`${t}${e.replace(/&/g,`&amp;`).replace(t===`"`?/"/g:/'/g,t===`"`?`&quot;`:`&#39;`)}${t}`};function refuseBehaviour(e,t=`sharedTreeHtml`){let n=[e.bindings&&`bindings`,e.breakpoints&&`breakpoints`].filter(Boolean);if(n.length>0)throw Error(`${t} has no markup for \`${e.tag}\`'s ${n.join(` and `)} (ADR 0093); a bound property and a breakpoint are behaviour, and a renderer has to observe them.`)}function htmlElement(i,o){refuseBehaviour(i);let s=[];i.id!==void 0&&s.push([`id`,i.id]);let c=[],l=n(i.tag);for(let[n,o]of Object.entries(i.props??{})){let i=t(n);typeof o==`boolean`?r(l,i)?s.push([i,o?`true`:`false`]):o?s.push([i,null]):e.some(e=>e===i)&&s.push([i,`false`]):s.push([i,String(o)]);let u=a(i,o);u!==void 0&&u[1]!==null&&c.push(`${u[0]}: ${u[1]};`)}c.length>0&&s.push([`style`,c.join(` `)]),i.styleClasses!==void 0&&i.styleClasses.length>0&&s.push([`class`,i.styleClasses.join(` `)]);let u=i.extensions?.strings;u!==void 0&&s.push([`strings`,JSON.stringify(u.map(e=>e.value))]),i.slot!==void 0&&s.push([`slot`,i.slot]);let d=[...(i.extensions?.responses??[]).map(e=>{let t=[`id=${htmlQuote(e.id)}`];e.appearance!==void 0&&t.push(`appearance=${htmlQuote(e.appearance)}`),e.enabled===!1&&t.push(`enabled="false"`);let n=htmlText(e.label);return`${` `.repeat(o+1)}<adw-alert-response ${t.join(` `)}>${n}</adw-alert-response>`}),...(i.children??[]).map(e=>htmlElement(e,o+1))];return element(o,n(i.tag),s,htmlQuote,d,!1)}function sharedTreeHtml(e){return htmlElement(e,0)}function xmlNameOf(e){let t=/^(Adw|Gtk)([A-Z]\w*)$/.exec(e);if(t===null)throw Error(`sharedTreeNativeScriptXml: ${e} is not an Adw or Gtk class name`);return{prefix:t[1].toLowerCase(),member:t[2]}}const xmlQuote=e=>{let t=e.includes(`"`)?`'`:`"`;return`${t}${e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(t===`"`?/"/g:/'/g,t===`"`?`&quot;`:`&apos;`)}${t}`};function prefixesOf(e,t){t.add(xmlNameOf(e.tag).prefix);for(let n of e.children??[])prefixesOf(n,t);return t}function xmlElement(e,t,n){refuseBehaviour(e,`sharedTreeNativeScriptXml`);let{prefix:r,member:a}=xmlNameOf(e.tag),o=`${r}:${a}`,s=[...n];e.id!==void 0&&s.push([`id`,e.id]);for(let[t,n]of Object.entries(e.props??{}))s.push([i(t),String(n)]);e.styleClasses!==void 0&&e.styleClasses.length>0&&s.push([`styleClasses`,e.styleClasses.join(` `)]);let c=e.extensions?.strings;c!==void 0&&s.push([`strings`,JSON.stringify(c.map(e=>e.value))]);let l=(e.children??[]).map(e=>{if(e.slot===void 0)return xmlElement(e,t+1,[]);let n=` `.repeat(t+1),r=`${o}.${e.slot}`;return[`${n}<${r}>`,xmlElement(e,t+2,[]),`${n}</${r}>`].join(`
4
- `)});return element(t,o,s,xmlQuote,l,!0)}function sharedTreeNativeScriptXml(e){return xmlElement(e,0,[[`xmlns`,`http://schemas.nativescript.org/tns.xsd`],...[...prefixesOf(e,new Set)].sort().map(e=>[`xmlns:${e}`,`~/${e}`])])}export{sharedTreeHtml,sharedTreeNativeScriptXml};
3
+ `)}const htmlText=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`),htmlQuote=e=>{let t=e.includes(`"`)&&!e.includes(`'`)?`'`:`"`;return`${t}${e.replace(/&/g,`&amp;`).replace(t===`"`?/"/g:/'/g,t===`"`?`&quot;`:`&#39;`)}${t}`};function refuseBehaviour(e,t=`sharedTreeHtml`){let n=[e.bindings&&`bindings`,e.breakpoints&&`breakpoints`].filter(Boolean);if(n.length>0)throw Error(`${t} has no markup for \`${e.tag}\`'s ${n.join(` and `)} (ADR 0093); a bound property and a breakpoint are behaviour, and a renderer has to observe them.`)}function htmlElement(i,o){refuseBehaviour(i);let s=[];i.id!==void 0&&s.push([`id`,i.id]);let c=[],l=n(i.tag);for(let[n,o]of Object.entries(i.props??{})){let i=t(n);typeof o==`boolean`?r(l,i)?s.push([i,o?`true`:`false`]):o?s.push([i,null]):e.some(e=>e===i)&&s.push([i,`false`]):s.push([i,String(o)]);let u=a(i,o);u!==void 0&&u[1]!==null&&c.push(`${u[0]}: ${u[1]};`)}c.length>0&&s.push([`style`,c.join(` `)]),i.styleClasses!==void 0&&i.styleClasses.length>0&&s.push([`class`,i.styleClasses.join(` `)]);let u=i.extensions?.strings;u!==void 0&&s.push([`strings`,JSON.stringify(u.map(e=>e.value))]),i.slot!==void 0&&s.push([`slot`,i.slot]);let d=[...(i.extensions?.responses??[]).map(e=>{let t=[`id=${htmlQuote(e.id)}`];e.appearance!==void 0&&t.push(`appearance=${htmlQuote(e.appearance)}`),e.enabled===!1&&t.push(`enabled="false"`);let n=htmlText(e.label);return`${` `.repeat(o+1)}<adw-alert-response ${t.join(` `)}>${n}</adw-alert-response>`}),...(i.children??[]).map(e=>htmlElement(e,o+1))];return element(o,n(i.tag),s,htmlQuote,d,!1)}function sharedTreeHtml(e){return htmlElement(e,0)}function xmlNameOf(e){let t=/^(Adw|Gtk)([A-Z]\w*)$/.exec(e);if(t===null)throw Error(`sharedTreeNativeScriptXml: ${e} is not an Adw or Gtk class name`);return{prefix:t[1].toLowerCase(),member:t[2]}}const xmlQuote=e=>{let t=e.includes(`"`)?`'`:`"`;return`${t}${e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(t===`"`?/"/g:/'/g,t===`"`?`&quot;`:`&apos;`)}${t}`};function prefixesOf(e,t){t.add(xmlNameOf(e.tag).prefix);for(let n of e.children??[])prefixesOf(n,t);return t}const o=[`columns`,`cssClasses`,`direction`,`modal`,`rows`,`visibility`];function xmlElement(e,t,n){refuseBehaviour(e,`sharedTreeNativeScriptXml`);let{prefix:r,member:a}=xmlNameOf(e.tag),s=`${r}:${a}`,c=[...n];e.id!==void 0&&c.push([`id`,e.id]);for(let[t,n]of Object.entries(e.props??{})){let r=i(t);if(o.includes(r))throw Error(`sharedTreeNativeScriptXml: \`${e.tag}\`'s '${t}' has no XML spelling — the attribute would reach NativeScript's own \`${r}\` (ADR 0112). Set it from Blueprint, a .ui file or \`set_${t.replace(/-/g,`_`)}()\`.`);c.push([r,String(n)])}e.styleClasses!==void 0&&e.styleClasses.length>0&&c.push([`styleClasses`,e.styleClasses.join(` `)]);let l=e.extensions?.strings;l!==void 0&&c.push([`strings`,JSON.stringify(l.map(e=>e.value))]);let u=(e.children??[]).map(e=>{if(e.slot===void 0)return xmlElement(e,t+1,[]);let n=` `.repeat(t+1),r=`${s}.${e.slot}`;return[`${n}<${r}>`,xmlElement(e,t+2,[]),`${n}</${r}>`].join(`
4
+ `)});return element(t,s,c,xmlQuote,u,!0)}function sharedTreeNativeScriptXml(e){return xmlElement(e,0,[[`xmlns`,`http://schemas.nativescript.org/tns.xsd`],...[...prefixesOf(e,new Set)].sort().map(e=>[`xmlns:${e}`,`~/${e}`])])}export{o as NATIVESCRIPT_HOST_MEMBERS,sharedTreeHtml,sharedTreeNativeScriptXml};
@@ -5,6 +5,15 @@ import type { SharedTreeNode } from './conformance/shared-trees.js';
5
5
  * the same attributes, classes and `slot=` as `mountSharedTree(node)` does.
6
6
  */
7
7
  export declare function sharedTreeHtml(node: SharedTreeNode): string;
8
+ /**
9
+ * GTK property names a `@nativescript/core` base owns as something else (ADR 0112). NativeScript's
10
+ * `Builder` assigns an attribute as `instance[name] = value`, so `modal="true"` would reach
11
+ * `ViewCommon.modal` and never the sheet's `set_modal`. These names have no XML spelling; a tree
12
+ * that sets one is refused, and the author reaches for Blueprint, a `.ui` file or the verb.
13
+ * `scripts/check-gtk-host-member-clashes.mjs` holds this list equal to the keys of
14
+ * `SHADOWED_PROPERTIES` in `adwaita-nativescript/src/widgets/shadowed-properties.ts`.
15
+ */
16
+ export declare const NATIVESCRIPT_HOST_MEMBERS: readonly string[];
8
17
  /**
9
18
  * The tree as a NativeScript XML template: what the port's `build` would build, spelled as
10
19
  * markup NativeScript's `Builder` loads. The root declares NativeScript's default namespace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-core",
3
- "version": "0.63.0",
3
+ "version": "0.63.1-next.235",
4
4
  "description": "Headless Adwaita widget behavior (breakpoint condition grammar + apply/unapply state machine, color-scheme observable, avatar derivation) shared by the web and NativeScript Adwaita renderers — pure TS, no platform imports",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -60,9 +60,9 @@
60
60
  "headless"
61
61
  ],
62
62
  "devDependencies": {
63
- "@gjsify/cli": "^0.63.0",
63
+ "@gjsify/cli": "0.63.1-next.235",
64
64
  "@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
65
- "@gjsify/unit": "^0.63.0",
65
+ "@gjsify/unit": "0.63.1-next.235",
66
66
  "@types/node": "^25.9.2",
67
67
  "typescript": "^6.0.3"
68
68
  },
@@ -85,5 +85,6 @@
85
85
  "bugs": {
86
86
  "url": "https://github.com/gjsify/gjsify/issues"
87
87
  },
88
- "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-core#readme"
88
+ "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-core#readme",
89
+ "gitHead": "9d2cca56170a0215b3e0792e98421ed1f83e7f72"
89
90
  }