@kubex/zinc 1.1.91 → 1.1.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/custom-elements.json +1738 -110
  2. package/dist/vscode.html-custom-data.json +136 -4
  3. package/dist/web-types.json +307 -4
  4. package/dist/zn.d.ts +298 -2
  5. package/dist/zn.min.js +708 -516
  6. package/docs/pages/components/page-builder.md +22 -0
  7. package/docs/pages/components/schedule-builder.md +345 -0
  8. package/package.json +1 -1
  9. package/src/components/alert/alert.scss +9 -13
  10. package/src/components/chip/chip.scss +1 -1
  11. package/src/components/content-block/content-block.component.ts +3 -2
  12. package/src/components/icon-picker/icon-picker.component.ts +1 -1
  13. package/src/components/linked-select/linked-select.component.ts +22 -5
  14. package/src/components/page/page.scss +13 -7
  15. package/src/components/page-builder/page-builder.component.ts +52 -7
  16. package/src/components/page-builder/page-builder.scss +166 -9
  17. package/src/components/page-builder/page-builder.test.ts +134 -0
  18. package/src/components/page-builder/page.types.ts +23 -3
  19. package/src/components/page-nav/page-nav.scss +9 -1
  20. package/src/components/panel/panel.component.ts +5 -1
  21. package/src/components/priority-list/priority-list.component.ts +1 -0
  22. package/src/components/priority-list/priority-list.scss +2 -1
  23. package/src/components/schedule-builder/index.ts +12 -0
  24. package/src/components/schedule-builder/schedule-builder.component.ts +1543 -0
  25. package/src/components/schedule-builder/schedule-builder.scss +448 -0
  26. package/src/components/schedule-builder/schedule-builder.test.ts +344 -0
  27. package/src/components/toggle/toggle.component.ts +2 -1
  28. package/src/zinc.ts +1 -0
  29. package/docs/superpowers/plans/2026-08-03-theme-editor.md +0 -1536
  30. package/docs/superpowers/specs/2026-08-03-theme-editor-design.md +0 -327
package/dist/zn.d.ts CHANGED
@@ -1316,6 +1316,7 @@ declare module "components/toggle/toggle.component" {
1316
1316
  *
1317
1317
  * @csspart base - The component's base wrapper containing the toggle switch.
1318
1318
  * @csspart control - The toggle switch control (the circular button that slides).
1319
+ * @csspart label - The toggle's label.
1319
1320
  * @csspart description - The container that wraps the toggle's description.
1320
1321
  *
1321
1322
  * @cssproperty --zn-toggle-margin - The margin around the toggle switch. Defaults to `8px 0`.
@@ -7149,7 +7150,7 @@ declare module "components/linked-select/linked-select.component" {
7149
7150
  [key: string]: string;
7150
7151
  }
7151
7152
  interface linkedSelectOptions {
7152
- [key: string]: linkedSelectOption[];
7153
+ [key: string]: linkedSelectOption;
7153
7154
  }
7154
7155
  /**
7155
7156
  * @summary Short summary of the component's intended use.
@@ -7177,6 +7178,8 @@ declare module "components/linked-select/linked-select.component" {
7177
7178
  linkedSelect: string;
7178
7179
  cacheKey: string;
7179
7180
  label: string;
7181
+ /** Automatically select the first option of the linked group when no value is set. */
7182
+ selectFirst: boolean;
7180
7183
  input: ZnSelect;
7181
7184
  private linkedSelectElement;
7182
7185
  private readonly formControlController;
@@ -7193,6 +7196,8 @@ declare module "components/linked-select/linked-select.component" {
7193
7196
  handleLinkedSelectChange: () => void;
7194
7197
  handleChange(e: Event): void;
7195
7198
  handleSelectChange: (e: ZnSelectEvent) => void;
7199
+ /** The options of the group the linked select currently points at. */
7200
+ private currentOptions;
7196
7201
  render(): import("lit-html").TemplateResult<1>;
7197
7202
  }
7198
7203
  }
@@ -9020,6 +9025,7 @@ declare module "components/priority-list/priority-list.component" {
9020
9025
  *
9021
9026
  * @cssproperty --zn-priority-list-item-gap - The gap between list items. Defaults to `var(--zn-spacing-2x-small)`.
9022
9027
  * @cssproperty --zn-priority-list-item-padding - The padding inside each item. Defaults to `var(--zn-spacing-small) var(--zn-spacing-medium)`.
9028
+ * @cssproperty --zn-priority-list-actions-gap - The gap between an item's slotted actions. Defaults to `var(--zn-spacing-x-small)`.
9023
9029
  * @cssproperty --zn-priority-list-handle-color - The color of the drag handle. Defaults to `var(--zn-color-neutral-500)`.
9024
9030
  * @cssproperty --zn-priority-list-priority-color - The color of the priority number. Defaults to `var(--zn-color-neutral-600)`.
9025
9031
  */
@@ -10571,7 +10577,11 @@ declare module "components/page-builder/page.types" {
10571
10577
  export function emptyPageState(): PageState;
10572
10578
  /** Unique-enough id for a new section, stable across edits once assigned. */
10573
10579
  export function generateSectionId(): string;
10574
- /** Card summary: the section's first non-empty string value, else the type description. */
10580
+ /**
10581
+ * Card summary: the label of the first value chosen from a select, else the first
10582
+ * non-empty string value, else the type description. Options win over field order
10583
+ * so a tile reads as its linked item however its other fields were filled in.
10584
+ */
10575
10585
  export function sectionSummary(section: PageSection, type?: PageSectionType): string;
10576
10586
  }
10577
10587
  declare module "components/page-builder/page-registry" {
@@ -10727,6 +10737,8 @@ declare module "components/page-builder/page-builder.component" {
10727
10737
  * @csspart palette - The left palette panel.
10728
10738
  * @csspart canvas - The centre section-card canvas.
10729
10739
  * @csspart inspector - The right panel while a section is selected.
10740
+ * @csspart inspector-header - The inspector's fixed header (icon, section name, type, close).
10741
+ * @csspart inspector-body - The inspector's scrolling form area.
10730
10742
  */
10731
10743
  export default class ZnPageBuilder extends ZincElement {
10732
10744
  static styles: CSSResultGroup;
@@ -11362,6 +11374,289 @@ declare module "components/theme-editor/index" {
11362
11374
  }
11363
11375
  }
11364
11376
  }
11377
+ declare module "components/schedule-builder/schedule-builder.component" {
11378
+ import { type CSSResultGroup } from 'lit';
11379
+ import ZincElement from "internal/zinc-element";
11380
+ import ZnIcon from "components/icon/index";
11381
+ import ZnInput from "components/input/index";
11382
+ import ZnOption from "components/option/index";
11383
+ import ZnSelect from "components/select/index";
11384
+ import type { ZincFormControl } from "internal/zinc-element";
11385
+ /** The seven weekday keys used throughout the schedule. */
11386
+ export type ScheduleDay = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
11387
+ /** A single opening period within a day. Times are `HH:MM` in the schedule's own timezone. */
11388
+ export interface ScheduleRange {
11389
+ start: string;
11390
+ end: string;
11391
+ }
11392
+ /**
11393
+ * A dated deviation from the weekly pattern. Exceptions are never edited by the builder, they only
11394
+ * annotate it — the surrounding application owns them.
11395
+ */
11396
+ export interface ScheduleException {
11397
+ id?: string;
11398
+ /** Human readable name, e.g. `Christmas Eve — early close`. */
11399
+ label?: string;
11400
+ /** A single calendar date (`YYYY-MM-DD`). */
11401
+ date?: string;
11402
+ /** Inclusive start of a multi-day exception (`YYYY-MM-DD`). */
11403
+ from?: string;
11404
+ /** Inclusive end of a multi-day exception (`YYYY-MM-DD`). */
11405
+ to?: string;
11406
+ /** Weekdays the exception applies to. Defaults to every weekday inside the date window. */
11407
+ days?: ScheduleDay[];
11408
+ /** When true the affected days close outright and `ranges` is ignored. */
11409
+ closed?: boolean;
11410
+ /** Replacement opening hours for the affected days. */
11411
+ ranges?: ScheduleRange[];
11412
+ }
11413
+ export type ScheduleDayMap = Record<ScheduleDay, ScheduleRange[]>;
11414
+ /** The shape serialised into the form value. */
11415
+ export interface ScheduleValue {
11416
+ timezone?: string;
11417
+ days: ScheduleDayMap;
11418
+ exceptions: ScheduleException[];
11419
+ }
11420
+ export type ScheduleView = 'calendar' | 'form';
11421
+ /** The named sets accepted by `timezones`, alongside explicit IANA names. */
11422
+ export type ScheduleTimezoneSet = 'en' | 'offsets' | 'common' | 'all';
11423
+ /**
11424
+ * @summary Builds a weekly opening-hours schedule as a drag-to-paint calendar or a compact list of
11425
+ * time ranges, and posts the result as JSON.
11426
+ * @documentation https://zinc.style/components/schedule-builder
11427
+ * @status experimental
11428
+ * @since 1.0
11429
+ *
11430
+ * @dependency zn-icon
11431
+ * @dependency zn-input
11432
+ * @dependency zn-option
11433
+ * @dependency zn-select
11434
+ *
11435
+ * @event zn-change - Emitted when the schedule changes.
11436
+ *
11437
+ * @slot label - The schedule's label. Alternatively, use the `label` attribute.
11438
+ * @slot help-text - Text that describes how to use the schedule. Alternatively, use the `help-text` attribute.
11439
+ *
11440
+ * @csspart form-control - The form control that wraps the builder, label and help text.
11441
+ * @csspart base - The component's base wrapper.
11442
+ * @csspart toolbar - The row above the builder holding the hint, legend and view toggle.
11443
+ * @csspart calendar - The calendar view wrapper.
11444
+ * @csspart list - The form (list) view wrapper.
11445
+ * @csspart summary - The summary panel beside the calendar.
11446
+ *
11447
+ * @cssproperty --slot-height - The height of a single time slot in the calendar. Defaults to `18px`.
11448
+ * @cssproperty --gutter-width - The width of the calendar's time gutter. Defaults to `64px`.
11449
+ * @cssproperty --open-color - The fill used for open hours.
11450
+ * @cssproperty --reduced-color - The fill used for hours an exception removes.
11451
+ */
11452
+ export default class ZnScheduleBuilder extends ZincElement implements ZincFormControl {
11453
+ static styles: CSSResultGroup;
11454
+ static formAssociated: boolean;
11455
+ static dependencies: {
11456
+ 'zn-icon': typeof ZnIcon;
11457
+ 'zn-input': typeof ZnInput;
11458
+ 'zn-option': typeof ZnOption;
11459
+ 'zn-select': typeof ZnSelect;
11460
+ };
11461
+ private readonly formControlController;
11462
+ private readonly hasSlotController;
11463
+ private readonly localize;
11464
+ private readonly internals;
11465
+ private canvas;
11466
+ private _days;
11467
+ private _exceptions;
11468
+ private _dragPreview;
11469
+ private _editing;
11470
+ private _dragMode;
11471
+ private _dragAnchor;
11472
+ private _dragPointerId;
11473
+ /** The name of the form control, submitted as a name/value pair with form data. */
11474
+ name: string;
11475
+ /** The schedule as a JSON string. This is what gets posted with the form. */
11476
+ value: string;
11477
+ /** The default value, used when resetting the containing form. */
11478
+ defaultValue: string;
11479
+ /** The schedule's label. If you need to display HTML, use the `label` slot instead. */
11480
+ label: string;
11481
+ /** The schedule's help text. If you need to display HTML, use the `help-text` slot instead. */
11482
+ helpText: string;
11483
+ /** Which view is showing. */
11484
+ view: ScheduleView;
11485
+ /** The word used for hours the schedule covers, in the legend and in labels. */
11486
+ openLabel: string;
11487
+ /** The word used for hours the schedule doesn't cover, in the legend and against empty days. */
11488
+ closedLabel: string;
11489
+ /** Hides the calendar/form view toggle. */
11490
+ noToggle: boolean;
11491
+ /** Hides the summary panel beside the calendar. */
11492
+ hideSummary: boolean;
11493
+ /** The first hour shown in the calendar. */
11494
+ startHour: number;
11495
+ /** The last hour shown in the calendar. */
11496
+ endHour: number;
11497
+ /** The granularity of the calendar grid and the time inputs, in minutes. */
11498
+ interval: number;
11499
+ /** The weekday the week starts on. */
11500
+ weekStart: ScheduleDay;
11501
+ /** Displays times as 12 or 24 hour. The serialised value is always 24 hour `HH:MM`. */
11502
+ timeFormat: '12' | '24';
11503
+ /**
11504
+ * The IANA timezone the hours are shown in. Accepts `auto` for the viewer's own timezone. Defaults
11505
+ * to `save-timezone`, so nothing is converted until you ask for it. Changing this only re-labels
11506
+ * the same underlying hours; the value never moves.
11507
+ */
11508
+ displayTimezone: string;
11509
+ /**
11510
+ * The IANA timezone the value is stored in. Defaults to `UTC` as soon as the schedule is
11511
+ * timezone-aware (a display timezone is set, or the picker is shown), and to no timezone at all
11512
+ * otherwise — in which case the times are stored exactly as they are shown.
11513
+ */
11514
+ saveTimezone: string;
11515
+ /** Shows the timezone picker, letting the user read the schedule in any timezone. */
11516
+ showTimezone: boolean;
11517
+ /**
11518
+ * The timezones offered by the picker, as IANA names or one of the named sets — `en` (the four US
11519
+ * zones, the UK and Australia, under those names), `offsets` (one zone per UTC offset, the
11520
+ * default), `common` (every offset plus the world's major centres) or `all` (the complete IANA
11521
+ * list). Names and sets can be mixed, e.g. `en Asia/Tokyo`.
11522
+ */
11523
+ timezones: string[];
11524
+ /**
11525
+ * The date (`YYYY-MM-DD`) used to resolve timezone offsets. A weekly pattern has no date of its
11526
+ * own, so one has to be picked to know whether daylight saving applies; today is used by default.
11527
+ */
11528
+ referenceDate: string;
11529
+ /** Disables the schedule. */
11530
+ disabled: boolean;
11531
+ /** Renders the schedule without any editing affordances. */
11532
+ readonly: boolean;
11533
+ /** Makes the schedule a required field, invalid until at least one period is open. */
11534
+ required: boolean;
11535
+ /** The id of the form to associate with, when the control sits outside of it. */
11536
+ form: string;
11537
+ constructor();
11538
+ /**
11539
+ * The schedule as a plain object, with `days` in the save timezone. Assigning to it replaces the
11540
+ * whole schedule.
11541
+ */
11542
+ get schedule(): ScheduleValue;
11543
+ set schedule(schedule: ScheduleValue | null | undefined);
11544
+ /** The exceptions annotating the schedule. Also readable from, and written into, the value. */
11545
+ get exceptions(): ScheduleException[];
11546
+ set exceptions(exceptions: ScheduleException[] | null | undefined);
11547
+ /** Gets the validity state object. */
11548
+ get validity(): ValidityState;
11549
+ /** Gets the validation message. */
11550
+ get validationMessage(): string;
11551
+ /** Whether the schedule carries a timezone at all. */
11552
+ private get _isZoned();
11553
+ /** The timezone the value is stored in. Empty means the times are stored exactly as shown. */
11554
+ private get _saveZone();
11555
+ /** The timezone the grid and list are drawn in. */
11556
+ private get _displayZone();
11557
+ /** The moment used to resolve daylight saving for both zones. */
11558
+ private get _reference();
11559
+ /** Minutes to add to a stored time to get the time shown. */
11560
+ private get _offsetDelta();
11561
+ private get _orderedDays();
11562
+ private get _interval();
11563
+ private get _startMinute();
11564
+ private get _endMinute();
11565
+ private get _slotCount();
11566
+ private get _slotsPerHour();
11567
+ private get _isEditable();
11568
+ private get _hasHours();
11569
+ connectedCallback(): void;
11570
+ firstUpdated(): void;
11571
+ handleValueChange(): void;
11572
+ handleValidationStateChange(): void;
11573
+ /** Checks validity but does not show a validation message. */
11574
+ checkValidity(): boolean;
11575
+ /** Gets the associated form, if one exists. */
11576
+ getForm(): HTMLFormElement | null;
11577
+ /** Checks for validity and shows the browser's validation message if the control is invalid. */
11578
+ reportValidity(): boolean;
11579
+ /** Sets a custom validation message. Pass an empty string to restore validity. */
11580
+ setCustomValidity(message: string): void;
11581
+ /** Replaces the hours for a single day, in the save timezone. */
11582
+ setDay(day: ScheduleDay, ranges: ScheduleRange[]): void;
11583
+ /** Reads the hours for a single day, in the save timezone. */
11584
+ getDay(day: ScheduleDay): ScheduleRange[];
11585
+ /** The hours as currently shown, in the display timezone. */
11586
+ get displayedDays(): ScheduleDayMap;
11587
+ /** Replaces the hours for a single day, given in the display timezone. */
11588
+ setDisplayDay(day: ScheduleDay, ranges: ScheduleRange[]): void;
11589
+ formResetCallback(): void;
11590
+ formStateRestoreCallback(restoredValue: string): void;
11591
+ private _customValidity;
11592
+ private _cloneDays;
11593
+ private _serialise;
11594
+ /** Accepts a JSON string, a full `ScheduleValue`, or a bare day map. */
11595
+ private _applySchedule;
11596
+ private _syncFormValue;
11597
+ private _commit;
11598
+ private _formatTime;
11599
+ private _formatRange;
11600
+ private _formatDate;
11601
+ private _summariseDay;
11602
+ /** The stored hours rotated into the display timezone. */
11603
+ private get _storedAsShown();
11604
+ /** The hours as drawn, which is the drag preview while a drag is in flight. */
11605
+ private get _shownDays();
11606
+ /** Stores hours that were edited in display coordinates, rotating them back to the save timezone. */
11607
+ private _commitShownDays;
11608
+ /** The exceptions that touch a given weekday and actually change its hours. */
11609
+ private _exceptionsForDay;
11610
+ /**
11611
+ * The week spans an exception takes away, in display coordinates. Computed as spans rather than
11612
+ * per-day ranges because a timezone rotation can move an exception's hours onto another weekday.
11613
+ */
11614
+ private get _shownReductionSpans();
11615
+ /** The week minute a calendar cell sits on, measured from Monday 00:00. */
11616
+ private _slotMinute;
11617
+ private _slotState;
11618
+ private _pointerPosition;
11619
+ /** Paints the rectangle between the drag anchor and the cursor onto a copy of the shown schedule. */
11620
+ private _buildDragPreview;
11621
+ private _handleCanvasPointerDown;
11622
+ private _handleCanvasPointerMove;
11623
+ private _handleCanvasPointerUp;
11624
+ private _handleCanvasPointerCancel;
11625
+ private _handleViewToggle;
11626
+ /** Picks a sensible slot for a newly added range: the first hour-wide gap in the day. */
11627
+ private _nextFreeRange;
11628
+ private _handleAddRange;
11629
+ private _handleRemoveRange;
11630
+ private _handleRangeEdit;
11631
+ private _handleEditorKeyDown;
11632
+ private _handleEditorFocusOut;
11633
+ private _renderToolbar;
11634
+ /** The picker's options: the configured list plus whatever zones are already in play. */
11635
+ private get _timezoneOptions();
11636
+ private _handleTimezoneChange;
11637
+ private _renderTimezonePicker;
11638
+ private _renderCalendar;
11639
+ private _renderCalendarColumn;
11640
+ private _renderSummary;
11641
+ private _renderList;
11642
+ private _renderListRow;
11643
+ private _renderRangeChip;
11644
+ private _renderRangeEditor;
11645
+ /** The exception annotation shown against a day in the form view. */
11646
+ private _dayNote;
11647
+ render(): import("lit-html").TemplateResult<1>;
11648
+ }
11649
+ }
11650
+ declare module "components/schedule-builder/index" {
11651
+ import ZnScheduleBuilder from "components/schedule-builder/schedule-builder.component";
11652
+ export * from "components/schedule-builder/schedule-builder.component";
11653
+ export default ZnScheduleBuilder;
11654
+ global {
11655
+ interface HTMLElementTagNameMap {
11656
+ 'zn-schedule-builder': ZnScheduleBuilder;
11657
+ }
11658
+ }
11659
+ }
11365
11660
  declare module "utilities/form" {
11366
11661
  export { clearFormStoreValues } from "internal/form";
11367
11662
  }
@@ -11722,6 +12017,7 @@ declare module "zinc" {
11722
12017
  export { default as ThemeEditor } from "components/theme-editor/index";
11723
12018
  export { default as SlashMenu } from "components/slash-menu/index";
11724
12019
  export { default as SlashItem } from "components/slash-item/index";
12020
+ export { default as ScheduleBuilder } from "components/schedule-builder/index";
11725
12021
  export { default as ZincElement } from "internal/zinc-element";
11726
12022
  export * from "utilities/on";
11727
12023
  export * from "utilities/query";