@threadlabs/looma 0.53.7 → 0.53.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.53.7",
3
+ "version": "0.53.8",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -19,6 +19,11 @@
19
19
  :scope:where(:is([component~="ui-image"]:not(template), [data-component~="ui-image"]:not([component])))[data-ui-image-state~="placement=center"] {
20
20
  justify-content: center !important;
21
21
  }
22
+ :scope:where(:is([component~="ui-image"]:not(template), [data-component~="ui-image"]:not([component])))[data-ui-image-state~="placement=inline"] {
23
+ display: inline-flex !important;
24
+ padding: 0 !important;
25
+ vertical-align: baseline;
26
+ }
22
27
  :scope:where(:is([component~="ui-image"]:not(template), [data-component~="ui-image"]:not([component])))[data-ui-image-state~="placement=wrap-left"] {
23
28
  float: left;
24
29
  padding-inline-end: var(--ui-space-4) !important;
@@ -13,7 +13,7 @@ export interface UiImageElement extends HTMLElement {
13
13
  export interface UiImageProps {
14
14
  alt?: string | null;
15
15
  height?: number | null;
16
- placement?: "block" | "center" | "wrap-left" | "wrap-right" | null;
16
+ placement?: "block" | "center" | "wrap-left" | "wrap-right" | "inline" | null;
17
17
  resizable?: boolean | null;
18
18
  selected?: boolean | null;
19
19
  src?: string | null;
@@ -1,24 +1,36 @@
1
1
  // Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
2
- import { attachGeneratedController, buildTemplate, toAttribute, truthy, writeAttribute, writeUrlAttribute, dispatchDeclared, detailCheck, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, checkBoolean, checkConstrained, checkFormat, checkInteger, checkObject, checkString, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
2
+ import { attachGeneratedController, equalValue, buildTemplate, toAttribute, truthy, writeAttribute, writeUrlAttribute, dispatchDeclared, detailCheck, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, armElement, replaceRoot, checkBoolean, checkConstrained, checkFormat, checkInteger, checkObject, checkString, initializeSlot, sharePlainSlots, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
3
3
  import * as controller from "../components/ui-image/ui-image.js";
4
4
  import "../styles/ui-image.css";
5
5
 
6
- const T0 = ["",[],"\n ",["div",["class","frame"],"\n ",4,"\n ",["div",["class","handles"],"\n ",["button",["type","button","class","handle","data-corner","top-left","aria-label","Resize image from top left"]],"\n ",["button",["type","button","class","handle","data-corner","top-right","aria-label","Resize image from top right"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-left","aria-label","Resize image from bottom left"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-right","aria-label","Resize image from bottom right"]],"\n "],"\n ",4,"\n "],"\n "];
6
+ const T0 = ["",[],"\n ",["span",["class","frame"],"\n ",4,"\n ",["span",["class","handles"],"\n ",["button",["type","button","class","handle","data-corner","top-left","aria-label","Resize image from top left"]],"\n ",["button",["type","button","class","handle","data-corner","top-right","aria-label","Resize image from top right"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-left","aria-label","Resize image from bottom left"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-right","aria-label","Resize image from bottom right"]],"\n "],"\n ",4,"\n "],"\n "];
7
7
  const T1 = ["",[],["img",[]]];
8
8
  const T2 = ["",[]];
9
- let P0, P1, P2;
9
+ const T3 = ["",[],"\n ",["div",["class","frame"],"\n ",4,"\n ",["div",["class","handles"],"\n ",["button",["type","button","class","handle","data-corner","top-left","aria-label","Resize image from top left"]],"\n ",["button",["type","button","class","handle","data-corner","top-right","aria-label","Resize image from top right"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-left","aria-label","Resize image from bottom left"]],"\n ",["button",["type","button","class","handle","data-corner","bottom-right","aria-label","Resize image from bottom right"]],"\n "],"\n ",4,"\n "],"\n "];
10
+ const T4 = ["",[],["img",[]]];
11
+ const T5 = ["",[]];
12
+ let P0, P1, P2, P3, P4, P5;
10
13
  const S = { n: [], t: [], f: import.meta.url, g: "ui-image", d: { "resize": [detailCheck(checkObject([["width", checkInteger, false], ["height", checkInteger, false], ["phase", checkConstrained(checkFormat("keyword", keywordFormat), "keyword", {"values":["preview","commit","cancel"]}), false], ["trigger", checkConstrained(checkFormat("keyword", keywordFormat), "keyword", {"values":["pointer","keyboard"]}), false]], false)), true, true, false] }, x: dispatchDeclared, a: (host, I) => C(host, I), b: generatedInputs };
11
- const D = { g: "ui-image", props: { "alt": { "required":false,"default":"", c: checkString, t: "string", j: 0, m: "s" }, "height": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" }, "placement": { "required":false,"values":["block","center","wrap-left","wrap-right"],"default":"block", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "resizable": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "selected": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "src": { "required":false,"default":"", c: checkString, t: "string", j: 0, m: "s" }, "width": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" } } };
14
+ const A = [["span",{},[],"",[],["data-ui-image-state","data-ui-image-prop-alt","data-ui-image-prop-height","data-ui-image-prop-placement","data-ui-image-prop-resizable","data-ui-image-prop-selected","data-ui-image-prop-src","data-ui-image-prop-width"]],["figure",{},[],"",[],["data-ui-image-state","data-ui-image-prop-alt","data-ui-image-prop-height","data-ui-image-prop-placement","data-ui-image-prop-resizable","data-ui-image-prop-selected","data-ui-image-prop-src","data-ui-image-prop-width"]]];
15
+ const Q = [[],[]];
16
+ const D = { g: "ui-image", props: { "alt": { "required":false,"default":"", c: checkString, t: "string", j: 0, m: "s" }, "height": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" }, "placement": { "required":false,"values":["block","center","wrap-left","wrap-right","inline"],"default":"block", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "resizable": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "selected": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "src": { "required":false,"default":"", c: checkString, t: "string", j: 0, m: "s" }, "width": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" } } };
12
17
  const C = (host) => activateModule(controller, host);
13
18
 
14
19
  export function createUiImage(options = {}, html) {
15
20
  const { attributes: authoredAttributes = {}, children = [], slots = {}, ...componentProps } = options;
16
21
  const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => !["alt","height","placement","resizable","selected","src","width"].includes(name)));
17
- const element = document.createElement("figure");
18
- element.setAttribute("component", "ui-image");
19
- element.append((P0 ??= buildTemplate(T0)).cloneNode(true));
20
22
  const v = [null, null, null, null, null, null, null];
21
- const B = acceptProps(element, D, S.n, v, componentProps, [], html);
23
+ let B = acceptProps(undefined, D, S.n, v, componentProps, [], html);
24
+ let a = (truthy(equalValue(v[2], "inline")) ? 0 : 1);
25
+ let element;
26
+ if (a === 0) {
27
+ element = document.createElement("span");
28
+ element.setAttribute("component", "ui-image");
29
+ } else {
30
+ element = document.createElement("figure");
31
+ element.setAttribute("component", "ui-image");
32
+ }
33
+ B = acceptProps(element, D, S.n, v, componentProps, Q[a], html);
22
34
  const m1 = (d) => {
23
35
  const n = (P1 ??= buildTemplate(T1)).cloneNode(true);
24
36
  const t0 = n.firstChild;
@@ -56,6 +68,54 @@ export function createUiImage(options = {}, html) {
56
68
  };
57
69
  const p2 = (r, c, d) => {
58
70
  };
71
+ const m4 = (d) => {
72
+ const n = (P4 ??= buildTemplate(T4)).cloneNode(true);
73
+ const t0 = n.firstChild;
74
+ const r = { n, a0: t0, v0: null, v1: null, v2: null, v3: null };
75
+ p4(r, -1, d);
76
+ return r;
77
+ };
78
+ const p4 = (r, c, d) => {
79
+ if (c & 32) {
80
+ const x0 = v[5];
81
+ const s0 = toAttribute(x0, "src");
82
+ if (s0 !== r.v0) writeUrlAttribute(r.a0, "src", r.v0 = s0);
83
+ }
84
+ if (c & 1) {
85
+ const x1 = v[0];
86
+ const s1 = toAttribute(x1, "alt");
87
+ if (s1 !== r.v1) writeAttribute(r.a0, "alt", r.v1 = s1);
88
+ }
89
+ if (c & 64) {
90
+ const x2 = v[6];
91
+ const s2 = toAttribute(x2, "width");
92
+ if (s2 !== r.v2) writeAttribute(r.a0, "width", r.v2 = s2);
93
+ }
94
+ if (c & 2) {
95
+ const x3 = v[1];
96
+ const s3 = toAttribute(x3, "height");
97
+ if (s3 !== r.v3) writeAttribute(r.a0, "height", r.v3 = s3);
98
+ }
99
+ };
100
+ const m5 = (d) => {
101
+ const n = (P5 ??= buildTemplate(T5)).cloneNode(true);
102
+ const r = { n };
103
+ p5(r, -1, d);
104
+ return r;
105
+ };
106
+ const p5 = (r, c, d) => {
107
+ };
108
+ const m0 = (n, d) => {
109
+ n.append((P0 ??= buildTemplate(T0)).cloneNode(true));
110
+ const t0 = n.firstChild.nextSibling;
111
+ const t1 = t0.firstChild.nextSibling;
112
+ const t2 = t1.nextSibling.nextSibling.nextSibling;
113
+ const t3 = t2.nextSibling.nextSibling;
114
+ const r = { n, a3: t2, v0: undefined, v1: null, v2: undefined, a2: t1, e0: t1.nextSibling, b0: undefined, f0: undefined, a4: t3, e1: t3.nextSibling, b1: undefined, f1: undefined };
115
+ I.r["frame"] = t0;
116
+ p0(r, -1, d);
117
+ return r;
118
+ };
59
119
  const p0 = (r, c, d) => {
60
120
  if (c === -1) {
61
121
  resetForwardedAttributes(r.n, attributes, r.v0);
@@ -71,24 +131,73 @@ export function createUiImage(options = {}, html) {
71
131
  const s2 = x1;
72
132
  if (s2 !== r.v2) writeAttribute(r.n, "data-ui-image-state", (r.v2 = s2) === "" ? null : s2);
73
133
  }
74
- if (r.f0 === undefined) { r.f0 = 1; const at = fillSlot(r.a2, r.e0, "media", J, true, undefined, d, r.z ??= []);
75
- if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m1(d); at.before(r.b0.n); } }
76
- else if (r.b0 !== undefined) p1(r.b0, c, d);
77
- if (r.f1 === undefined) { r.f1 = 1; const at = fillSlot(r.a4, r.e1, "controls", J, false, undefined, d);
78
- if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b1 = m2(d); at.before(r.b1.n); } }
79
- else if (r.b1 !== undefined) p2(r.b1, c, d);
134
+ if (r.f0 === undefined) { r.f0 = 1; const at = initializeSlot(r.a2, r.e0, "media", J, true, undefined, d, r.z ??= []);
135
+ if (typeof at === "function") r.f0 = at(r, (d, at) => m1(d, undefined, r), p1); else if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m1(d); at.before(r.b0.n); } }
136
+ else if (typeof r.f0 === "function") r.f0(c, d); else if (r.b0 !== undefined) p1(r.b0, c, d);
137
+ if (r.f1 === undefined) { r.f1 = 1; const at = initializeSlot(r.a4, r.e1, "controls", J, false, undefined, d);
138
+ if (typeof at === "function") r.f1 = at(r, (d, at) => m2(d, undefined, r), p2); else if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b1 = m2(d); at.before(r.b1.n); } }
139
+ else if (typeof r.f1 === "function") r.f1(c, d); else if (r.b1 !== undefined) p2(r.b1, c, d);
140
+ };
141
+ const m3 = (n, d) => {
142
+ n.append((P3 ??= buildTemplate(T3)).cloneNode(true));
143
+ const t0 = n.firstChild.nextSibling;
144
+ const t1 = t0.firstChild.nextSibling;
145
+ const t2 = t1.nextSibling.nextSibling.nextSibling;
146
+ const t3 = t2.nextSibling.nextSibling;
147
+ const r = { n, a3: t2, v0: undefined, v1: null, v2: undefined, a2: t1, e0: t1.nextSibling, b0: undefined, f0: undefined, a4: t3, e1: t3.nextSibling, b1: undefined, f1: undefined };
148
+ I.r["frame"] = t0;
149
+ p3(r, -1, d);
150
+ return r;
151
+ };
152
+ const p3 = (r, c, d) => {
153
+ if (c === -1) {
154
+ resetForwardedAttributes(r.n, attributes, r.v0);
155
+ r.v0 = forwardAttributes(r.n, attributes);
156
+ }
157
+ if (c & 24) {
158
+ const x0 = !(truthy(v[4]) && truthy(v[3]));
159
+ const s1 = toAttribute(x0, "hidden");
160
+ if (s1 !== r.v1) writeAttribute(r.a3, "hidden", r.v1 = s1);
161
+ }
162
+ if (c & 20) {
163
+ const x1 = hostState(["placement","selected"], [v[2], v[4]]);
164
+ const s2 = x1;
165
+ if (s2 !== r.v2) writeAttribute(r.n, "data-ui-image-state", (r.v2 = s2) === "" ? null : s2);
166
+ }
167
+ if (r.f0 === undefined) { r.f0 = 1; const at = initializeSlot(r.a2, r.e0, "media", J, true, undefined, d, r.z ??= []);
168
+ if (typeof at === "function") r.f0 = at(r, (d, at) => m4(d, undefined, r), p4); else if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m4(d); at.before(r.b0.n); } }
169
+ else if (typeof r.f0 === "function") r.f0(c, d); else if (r.b0 !== undefined) p4(r.b0, c, d);
170
+ if (r.f1 === undefined) { r.f1 = 1; const at = initializeSlot(r.a4, r.e1, "controls", J, false, undefined, d);
171
+ if (typeof at === "function") r.f1 = at(r, (d, at) => m5(d, undefined, r), p5); else if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b1 = m5(d); at.before(r.b1.n); } }
172
+ else if (typeof r.f1 === "function") r.f1(c, d); else if (r.b1 !== undefined) p5(r.b1, c, d);
173
+ };
174
+ const M = [m0, m3], N = [p0, p3];
175
+ let R;
176
+ const p = (c, d) => {
177
+ if (R === null) return;
178
+ if (R === undefined) { R = M[a](element, d); return; }
179
+ if (c & 4) {
180
+ const t = (truthy(equalValue(v[2], "inline")) ? 0 : 1);
181
+ if (t !== a) {
182
+ dispose(R);
183
+ for (const key in I.r) delete I.r[key];
184
+ const previous = I.e, next = armElement(previous, A[a], A[t]);
185
+ I.B.b = Q[t];
186
+ a = t;
187
+ R = null;
188
+ R = M[t](next, d);
189
+ replaceRoot(I, previous, next);
190
+ return;
191
+ }
192
+ }
193
+ N[a](R, c, d);
80
194
  };
81
- const t0 = element.firstChild.nextSibling;
82
- const t1 = t0.firstChild.nextSibling;
83
- const t2 = t1.nextSibling.nextSibling.nextSibling;
84
- const t3 = t2.nextSibling.nextSibling;
85
- const R = { n: element, a3: t2, v0: undefined, v1: null, v2: undefined, a2: t1, e0: t1.nextSibling, b0: undefined, f0: undefined, a4: t3, e1: t3.nextSibling, b1: undefined, f1: undefined };
86
195
  const I = { B };
87
196
  const J = project(I, children, slots);
88
- I.F = { values: attributes, draw: () => ((c, d) => p0(R, c, d))(-1) };
89
- attachGeneratedController(element, S, v, ((c, d) => p0(R, c, d)), undefined, undefined, I);
197
+ sharePlainSlots(I, J, ["media","controls"]);
198
+ I.F = { values: attributes, draw: () => p(-1) };
199
+ attachGeneratedController(element, S, v, p, undefined, undefined, I);
90
200
  manageProps(I);
91
- I.r["frame"] = t0;
92
201
  return element;
93
202
  }
94
203
  defineComponent("ui-image", createUiImage, ["alt","height","placement","resizable","selected","src","width"]);