@r2digisolutions/components 0.21.0 → 0.21.1

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.
@@ -150,10 +150,9 @@
150
150
  bind:rect
151
151
  minW={layer.kind === 'line' || layer.kind === 'arrow' || layer.kind === 'path' ? 16 : 40}
152
152
  minH={layer.kind === 'line' ? 4 : layer.kind === 'arrow' || layer.kind === 'path' ? 16 : 24}
153
- class={[
154
- 'bg-transparent',
155
- passthrough || readOnly ? 'pointer-events-none' : ''
156
- ].filter(Boolean).join(' ')}
153
+ class={['bg-transparent', passthrough || readOnly ? 'pointer-events-none' : '']
154
+ .filter(Boolean)
155
+ .join(' ')}
157
156
  onchange={(r) => {
158
157
  rect = r;
159
158
  onchange?.(r);
@@ -184,12 +183,12 @@
184
183
  <video src={layer.src} class={['h-full w-full', fitClass]} muted playsinline></video>
185
184
  {:else if layer.kind === 'text' || layer.kind === 'sticky'}
186
185
  <div
187
- class="flex h-full w-full px-2 py-1"
186
+ class="px-2 py-1 flex h-full w-full"
188
187
  style:background={layer.kind === 'sticky'
189
188
  ? (layer.fill ?? '#fef08a')
190
189
  : layer.textBackground}
191
190
  style:color={layer.color ?? (layer.kind === 'sticky' ? '#713f12' : '#0f172a')}
192
- style:font-size="{(layer.fontSize ?? (layer.kind === 'sticky' ? 20 : 32))}px"
191
+ style:font-size="{layer.fontSize ?? (layer.kind === 'sticky' ? 20 : 32)}px"
193
192
  style:font-weight={layer.fontWeight ?? 600}
194
193
  style:font-family={layer.fontFamily}
195
194
  style:font-style={layer.fontStyle ?? 'normal'}
@@ -249,7 +248,7 @@
249
248
  class={[
250
249
  'absolute rounded-full',
251
250
  vertical
252
- ? 'left-1/2 top-0 h-full -translate-x-1/2'
251
+ ? 'top-0 left-1/2 h-full -translate-x-1/2'
253
252
  : 'left-0 top-1/2 w-full -translate-y-1/2'
254
253
  ]}
255
254
  style:background={layer.fill ?? '#94a3b8'}
@@ -264,7 +263,11 @@
264
263
  {@const len = vertical ? bh : bw}
265
264
  {@const thick = vertical ? bw : bh}
266
265
  {@const head = Math.min(Math.max(14, thick * 0.9), len * 0.35, 40)}
267
- <svg class="h-full w-full overflow-visible" viewBox={`0 0 ${bw} ${bh}`} aria-hidden="true">
266
+ <svg
267
+ class="h-full w-full overflow-visible"
268
+ viewBox={`0 0 ${bw} ${bh}`}
269
+ aria-hidden="true"
270
+ >
268
271
  {#if vertical}
269
272
  {@const cx = bw / 2}
270
273
  <line
@@ -303,7 +306,11 @@
303
306
  {@const d = layer.points
304
307
  .map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x * bw} ${p.y * bh}`)
305
308
  .join(' ')}
306
- <svg class="h-full w-full overflow-visible" viewBox={`0 0 ${bw} ${bh}`} aria-hidden="true">
309
+ <svg
310
+ class="h-full w-full overflow-visible"
311
+ viewBox={`0 0 ${bw} ${bh}`}
312
+ aria-hidden="true"
313
+ >
307
314
  <path
308
315
  d={layer.closed ? `${d} Z` : d}
309
316
  fill={layer.closed ? (layer.fill ?? '#0f172a') : 'none'}
@@ -318,7 +325,9 @@
318
325
  <div
319
326
  class="relative h-full w-full"
320
327
  style:overflow={panelClip ? 'hidden' : 'visible'}
321
- style:background={layer.fill && layer.fill !== 'transparent' ? layer.fill : 'transparent'}
328
+ style:background={layer.fill && layer.fill !== 'transparent'
329
+ ? layer.fill
330
+ : 'transparent'}
322
331
  style:border={layer.kind === 'namedSlot'
323
332
  ? '1px dashed color-mix(in oklab, #3b82f6 50%, transparent)'
324
333
  : layer.kind === 'scrollBox'
@@ -332,14 +341,14 @@
332
341
  >
333
342
  {#if layer.kind === 'namedSlot'}
334
343
  <span
335
- class="pointer-events-none absolute left-1.5 top-1.5 rounded bg-brand-500/15 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-brand-600"
344
+ class="left-1.5 top-1.5 rounded bg-brand-500/15 px-1.5 py-0.5 font-semibold tracking-wide text-brand-600 pointer-events-none absolute text-[9px] uppercase"
336
345
  >
337
346
  {layer.slotName || layer.name || 'Slot'}
338
347
  </span>
339
348
  {/if}
340
349
  {#if layer.kind === 'scrollBox'}
341
350
  <span
342
- class="pointer-events-none absolute left-1.5 top-1.5 rounded bg-surface-overlay/90 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted"
351
+ class="left-1.5 top-1.5 rounded bg-surface-overlay/90 px-1.5 py-0.5 font-semibold tracking-wide text-muted pointer-events-none absolute text-[9px] uppercase"
343
352
  >
344
353
  Scroll
345
354
  </span>
@@ -347,7 +356,7 @@
347
356
  </div>
348
357
  {:else}
349
358
  <div
350
- class="flex h-full w-full items-center justify-center gap-2 bg-surface-overlay/80 text-secondary"
359
+ class="gap-2 bg-surface-overlay/80 text-secondary flex h-full w-full items-center justify-center"
351
360
  >
352
361
  <MediaKindIcon kind={layer.kind === 'audio' ? 'audio' : 'image'} />
353
362
  <span class="text-xs">{layer.name}</span>
@@ -91,9 +91,7 @@ export function createWidgetFromSelection(doc, selectedIds, name = 'Widget') {
91
91
  const wasRoot = oldId ? selectedIds.includes(oldId) : false;
92
92
  if (wasRoot) {
93
93
  const abs = oldId ? absMap.get(oldId) : null;
94
- const local = abs
95
- ? { x: abs.x - minX, y: abs.y - minY, w: abs.w, h: abs.h }
96
- : l.rect;
94
+ const local = abs ? { x: abs.x - minX, y: abs.y - minY, w: abs.w, h: abs.h } : l.rect;
97
95
  return {
98
96
  ...l,
99
97
  parentId: null,
@@ -168,9 +166,7 @@ export function placeWidgetInstance(doc, definitionId, opts) {
168
166
  const parentAbs = parentId
169
167
  ? (absMap.get(parentId) ?? { x: 0, y: 0, w: doc.width, h: doc.height })
170
168
  : { x: 0, y: 0, w: doc.width, h: doc.height };
171
- const pad = parentLayer
172
- ? contentPadding(parentLayer)
173
- : { left: 0, top: 0, right: 0, bottom: 0 };
169
+ const pad = parentLayer ? contentPadding(parentLayer) : { left: 0, top: 0, right: 0, bottom: 0 };
174
170
  const contentW = Math.max(1, parentAbs.w - pad.left - pad.right);
175
171
  const contentH = Math.max(1, parentAbs.h - pad.top - pad.bottom);
176
172
  const x = opts?.x ?? (parentId ? Math.round((contentW - def.width) / 2) : 80);
@@ -334,7 +330,7 @@ export function flattenLayersWithWidgets(layers, widgets, depth = 0) {
334
330
  continue;
335
331
  }
336
332
  const resolved = resolveWidgetInstance(layer, def);
337
- let nested = resolved.map((l) => l.parentId === null ? { ...l, parentId: layer.id } : l);
333
+ let nested = resolved.map((l) => (l.parentId === null ? { ...l, parentId: layer.id } : l));
338
334
  const defW = Math.max(1, def.width);
339
335
  const defH = Math.max(1, def.height);
340
336
  const instW = Math.max(1, layer.rect.w);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",