@prismora/elements 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +21 -2
- package/components.json +15600 -0
- package/custom-elements.json +56320 -0
- package/dist/base.d.ts +42 -0
- package/dist/base.js +62 -0
- package/dist/catalog.d.ts +33 -0
- package/dist/catalog.js +803 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +63 -0
- package/dist/components/alert.d.ts +27 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/avatar-group.d.ts +23 -0
- package/dist/components/avatar-group.js +43 -0
- package/dist/components/avatar.d.ts +24 -0
- package/dist/components/avatar.js +43 -0
- package/dist/components/back-to-top.d.ts +32 -0
- package/dist/components/back-to-top.js +50 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +20 -0
- package/dist/components/banner.d.ts +34 -0
- package/dist/components/banner.js +54 -0
- package/dist/components/breadcrumb.d.ts +42 -0
- package/dist/components/breadcrumb.js +63 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +28 -0
- package/dist/components/button.d.ts +59 -0
- package/dist/components/button.js +162 -0
- package/dist/components/calendar.d.ts +48 -0
- package/dist/components/calendar.js +296 -0
- package/dist/components/card.d.ts +23 -0
- package/dist/components/card.js +44 -0
- package/dist/components/carousel.d.ts +41 -0
- package/dist/components/carousel.js +156 -0
- package/dist/components/cascader.d.ts +70 -0
- package/dist/components/cascader.js +220 -0
- package/dist/components/chart.d.ts +59 -0
- package/dist/components/chart.js +267 -0
- package/dist/components/chat.d.ts +98 -0
- package/dist/components/chat.js +134 -0
- package/dist/components/checkbox-group.d.ts +48 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +70 -0
- package/dist/components/code-block.d.ts +46 -0
- package/dist/components/code-block.js +86 -0
- package/dist/components/color-picker.d.ts +46 -0
- package/dist/components/color-picker.js +292 -0
- package/dist/components/combobox.d.ts +89 -0
- package/dist/components/combobox.js +384 -0
- package/dist/components/command.d.ts +96 -0
- package/dist/components/command.js +289 -0
- package/dist/components/context-menu.d.ts +23 -0
- package/dist/components/context-menu.js +110 -0
- package/dist/components/copy-button.d.ts +33 -0
- package/dist/components/copy-button.js +62 -0
- package/dist/components/countdown.d.ts +36 -0
- package/dist/components/countdown.js +56 -0
- package/dist/components/data-table.d.ts +180 -0
- package/dist/components/data-table.js +1060 -0
- package/dist/components/date-picker.d.ts +47 -0
- package/dist/components/date-picker.js +267 -0
- package/dist/components/description-list.d.ts +38 -0
- package/dist/components/description-list.js +41 -0
- package/dist/components/dialog.d.ts +47 -0
- package/dist/components/dialog.js +189 -0
- package/dist/components/divider.d.ts +16 -0
- package/dist/components/divider.js +23 -0
- package/dist/components/drawer.d.ts +19 -0
- package/dist/components/drawer.js +27 -0
- package/dist/components/editor.d.ts +50 -0
- package/dist/components/editor.js +474 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.js +27 -0
- package/dist/components/file-upload.d.ts +56 -0
- package/dist/components/file-upload.js +176 -0
- package/dist/components/form-control.d.ts +69 -0
- package/dist/components/form-control.js +134 -0
- package/dist/components/form.d.ts +38 -0
- package/dist/components/form.js +161 -0
- package/dist/components/format-number.d.ts +37 -0
- package/dist/components/format-number.js +86 -0
- package/dist/components/icon.d.ts +34 -0
- package/dist/components/icon.js +47 -0
- package/dist/components/image.d.ts +44 -0
- package/dist/components/image.js +53 -0
- package/dist/components/indicator.d.ts +41 -0
- package/dist/components/indicator.js +65 -0
- package/dist/components/inline-edit.d.ts +45 -0
- package/dist/components/inline-edit.js +129 -0
- package/dist/components/input.d.ts +55 -0
- package/dist/components/input.js +186 -0
- package/dist/components/kbd.d.ts +15 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/list.d.ts +68 -0
- package/dist/components/list.js +180 -0
- package/dist/components/menu.d.ts +22 -0
- package/dist/components/menu.js +182 -0
- package/dist/components/menubar.d.ts +20 -0
- package/dist/components/menubar.js +120 -0
- package/dist/components/meter.d.ts +38 -0
- package/dist/components/meter.js +48 -0
- package/dist/components/nav.d.ts +91 -0
- package/dist/components/nav.js +228 -0
- package/dist/components/number-input.d.ts +26 -0
- package/dist/components/number-input.js +70 -0
- package/dist/components/pagination.d.ts +44 -0
- package/dist/components/pagination.js +94 -0
- package/dist/components/pin-input.d.ts +25 -0
- package/dist/components/pin-input.js +128 -0
- package/dist/components/popover.d.ts +23 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/progress.d.ts +26 -0
- package/dist/components/progress.js +66 -0
- package/dist/components/pull-refresh.d.ts +41 -0
- package/dist/components/pull-refresh.js +101 -0
- package/dist/components/qr-code.d.ts +33 -0
- package/dist/components/qr-code.js +54 -0
- package/dist/components/radio-group.d.ts +37 -0
- package/dist/components/radio-group.js +82 -0
- package/dist/components/range-slider.d.ts +46 -0
- package/dist/components/range-slider.js +95 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +80 -0
- package/dist/components/relative-time.d.ts +31 -0
- package/dist/components/relative-time.js +51 -0
- package/dist/components/scheduler.d.ts +84 -0
- package/dist/components/scheduler.js +187 -0
- package/dist/components/segmented.d.ts +58 -0
- package/dist/components/segmented.js +129 -0
- package/dist/components/select.d.ts +62 -0
- package/dist/components/select.js +140 -0
- package/dist/components/share-button.d.ts +37 -0
- package/dist/components/share-button.js +60 -0
- package/dist/components/signature.d.ts +54 -0
- package/dist/components/signature.js +152 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.js +26 -0
- package/dist/components/slider.d.ts +31 -0
- package/dist/components/slider.js +80 -0
- package/dist/components/sortable.d.ts +22 -0
- package/dist/components/sortable.js +196 -0
- package/dist/components/sparkline.d.ts +28 -0
- package/dist/components/sparkline.js +46 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/splitter.d.ts +28 -0
- package/dist/components/splitter.js +89 -0
- package/dist/components/stat.d.ts +28 -0
- package/dist/components/stat.js +33 -0
- package/dist/components/steps.d.ts +53 -0
- package/dist/components/steps.js +91 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +18 -0
- package/dist/components/table.d.ts +58 -0
- package/dist/components/table.js +96 -0
- package/dist/components/tabs.d.ts +62 -0
- package/dist/components/tabs.js +310 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/textarea.d.ts +25 -0
- package/dist/components/textarea.js +56 -0
- package/dist/components/theme-switch.d.ts +51 -0
- package/dist/components/theme-switch.js +85 -0
- package/dist/components/time-picker.d.ts +39 -0
- package/dist/components/time-picker.js +257 -0
- package/dist/components/timeline.d.ts +38 -0
- package/dist/components/timeline.js +56 -0
- package/dist/components/toaster.d.ts +25 -0
- package/dist/components/toaster.js +44 -0
- package/dist/components/toggle-group.d.ts +70 -0
- package/dist/components/toggle-group.js +172 -0
- package/dist/components/toolbar.d.ts +23 -0
- package/dist/components/toolbar.js +81 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tour.d.ts +41 -0
- package/dist/components/tour.js +197 -0
- package/dist/components/transfer.d.ts +57 -0
- package/dist/components/transfer.js +161 -0
- package/dist/components/tree-select.d.ts +66 -0
- package/dist/components/tree-select.js +282 -0
- package/dist/components/tree.d.ts +129 -0
- package/dist/components/tree.js +427 -0
- package/dist/components/virtual-list.d.ts +41 -0
- package/dist/components/virtual-list.js +77 -0
- package/dist/confirm.d.ts +21 -0
- package/dist/confirm.js +69 -0
- package/dist/count.d.ts +5 -0
- package/dist/count.js +12 -0
- package/dist/data-table/icons.d.ts +8 -0
- package/dist/data-table/icons.js +10 -0
- package/dist/data-table/logic.d.ts +33 -0
- package/dist/data-table/logic.js +141 -0
- package/dist/data-table/strings.d.ts +37 -0
- package/dist/data-table/strings.js +36 -0
- package/dist/data-table/types.d.ts +76 -0
- package/dist/data-table/types.js +1 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.js +2 -0
- package/dist/field-validity.d.ts +42 -0
- package/dist/field-validity.js +58 -0
- package/dist/floating.d.ts +13 -0
- package/dist/floating.js +65 -0
- package/dist/highlight.d.ts +11 -0
- package/dist/highlight.js +103 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +3 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/manifest.d.ts +51 -0
- package/dist/manifest.js +11 -0
- package/dist/named-icon.d.ts +8 -0
- package/dist/named-icon.js +8 -0
- package/dist/patterns/account.d.ts +6 -0
- package/dist/patterns/account.js +137 -0
- package/dist/patterns/app.d.ts +7 -0
- package/dist/patterns/app.js +351 -0
- package/dist/patterns/commerce.d.ts +4 -0
- package/dist/patterns/commerce.js +200 -0
- package/dist/patterns/flows.d.ts +3 -0
- package/dist/patterns/flows.js +100 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.js +29 -0
- package/dist/patterns/marketing.d.ts +4 -0
- package/dist/patterns/marketing.js +173 -0
- package/dist/patterns/more.d.ts +15 -0
- package/dist/patterns/more.js +581 -0
- package/dist/patterns/shell.d.ts +9 -0
- package/dist/patterns/shell.js +48 -0
- package/dist/patterns/types.d.ts +19 -0
- package/dist/patterns/types.js +1 -0
- package/dist/position.d.ts +2 -0
- package/dist/position.js +33 -0
- package/dist/prismora.standalone.js +5222 -0
- package/dist/prismora.standalone.js.map +199 -0
- package/dist/qr.d.ts +14 -0
- package/dist/qr.js +258 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.js +21 -0
- package/dist/registry.d.ts +203 -0
- package/dist/registry.js +203 -0
- package/dist/remote.d.ts +58 -0
- package/dist/remote.js +130 -0
- package/dist/sheet.d.ts +34 -0
- package/dist/sheet.js +153 -0
- package/dist/styles/accordion.d.ts +2 -0
- package/dist/styles/accordion.js +3 -0
- package/dist/styles/alert.d.ts +2 -0
- package/dist/styles/alert.js +3 -0
- package/dist/styles/avatar.d.ts +2 -0
- package/dist/styles/avatar.js +3 -0
- package/dist/styles/badge.d.ts +2 -0
- package/dist/styles/badge.js +3 -0
- package/dist/styles/banner.d.ts +2 -0
- package/dist/styles/banner.js +3 -0
- package/dist/styles/breadcrumb.d.ts +2 -0
- package/dist/styles/breadcrumb.js +3 -0
- package/dist/styles/button.d.ts +2 -0
- package/dist/styles/button.js +3 -0
- package/dist/styles/calendar.d.ts +2 -0
- package/dist/styles/calendar.js +3 -0
- package/dist/styles/card.d.ts +2 -0
- package/dist/styles/card.js +3 -0
- package/dist/styles/carousel.d.ts +2 -0
- package/dist/styles/carousel.js +3 -0
- package/dist/styles/chart.d.ts +2 -0
- package/dist/styles/chart.js +3 -0
- package/dist/styles/chat.d.ts +2 -0
- package/dist/styles/chat.js +3 -0
- package/dist/styles/checkbox.d.ts +2 -0
- package/dist/styles/checkbox.js +3 -0
- package/dist/styles/color-picker.d.ts +2 -0
- package/dist/styles/color-picker.js +3 -0
- package/dist/styles/combobox.d.ts +2 -0
- package/dist/styles/combobox.js +3 -0
- package/dist/styles/command.d.ts +2 -0
- package/dist/styles/command.js +3 -0
- package/dist/styles/data-table.d.ts +2 -0
- package/dist/styles/data-table.js +3 -0
- package/dist/styles/description-list.d.ts +2 -0
- package/dist/styles/description-list.js +3 -0
- package/dist/styles/dialog.d.ts +2 -0
- package/dist/styles/dialog.js +3 -0
- package/dist/styles/drawer.d.ts +2 -0
- package/dist/styles/drawer.js +3 -0
- package/dist/styles/editor.d.ts +2 -0
- package/dist/styles/editor.js +3 -0
- package/dist/styles/empty-state.d.ts +2 -0
- package/dist/styles/empty-state.js +3 -0
- package/dist/styles/extras.d.ts +2 -0
- package/dist/styles/extras.js +3 -0
- package/dist/styles/field.d.ts +2 -0
- package/dist/styles/field.js +3 -0
- package/dist/styles/file-upload.d.ts +2 -0
- package/dist/styles/file-upload.js +3 -0
- package/dist/styles/foundation.d.ts +2 -0
- package/dist/styles/foundation.js +3 -0
- package/dist/styles/helpers.d.ts +2 -0
- package/dist/styles/helpers.js +3 -0
- package/dist/styles/icon.d.ts +2 -0
- package/dist/styles/icon.js +3 -0
- package/dist/styles/image.d.ts +2 -0
- package/dist/styles/image.js +3 -0
- package/dist/styles/indicator.d.ts +2 -0
- package/dist/styles/indicator.js +3 -0
- package/dist/styles/input.d.ts +2 -0
- package/dist/styles/input.js +3 -0
- package/dist/styles/kbd.d.ts +2 -0
- package/dist/styles/kbd.js +3 -0
- package/dist/styles/list.d.ts +2 -0
- package/dist/styles/list.js +3 -0
- package/dist/styles/listbox.d.ts +2 -0
- package/dist/styles/listbox.js +3 -0
- package/dist/styles/meter.d.ts +2 -0
- package/dist/styles/meter.js +3 -0
- package/dist/styles/nav.d.ts +2 -0
- package/dist/styles/nav.js +3 -0
- package/dist/styles/number-input.d.ts +2 -0
- package/dist/styles/number-input.js +3 -0
- package/dist/styles/overlay.d.ts +2 -0
- package/dist/styles/overlay.js +3 -0
- package/dist/styles/pagination.d.ts +2 -0
- package/dist/styles/pagination.js +3 -0
- package/dist/styles/pickers.d.ts +2 -0
- package/dist/styles/pickers.js +3 -0
- package/dist/styles/pin-input.d.ts +2 -0
- package/dist/styles/pin-input.js +3 -0
- package/dist/styles/popover.d.ts +2 -0
- package/dist/styles/popover.js +3 -0
- package/dist/styles/progress.d.ts +2 -0
- package/dist/styles/progress.js +3 -0
- package/dist/styles/pull-refresh.d.ts +2 -0
- package/dist/styles/pull-refresh.js +3 -0
- package/dist/styles/range-slider.d.ts +2 -0
- package/dist/styles/range-slider.js +3 -0
- package/dist/styles/rating.d.ts +2 -0
- package/dist/styles/rating.js +3 -0
- package/dist/styles/scheduler.d.ts +2 -0
- package/dist/styles/scheduler.js +3 -0
- package/dist/styles/segmented.d.ts +2 -0
- package/dist/styles/segmented.js +3 -0
- package/dist/styles/select.d.ts +2 -0
- package/dist/styles/select.js +3 -0
- package/dist/styles/separator.d.ts +2 -0
- package/dist/styles/separator.js +3 -0
- package/dist/styles/sheet.d.ts +2 -0
- package/dist/styles/sheet.js +3 -0
- package/dist/styles/skeleton.d.ts +2 -0
- package/dist/styles/skeleton.js +3 -0
- package/dist/styles/slider.d.ts +2 -0
- package/dist/styles/slider.js +3 -0
- package/dist/styles/sortable.d.ts +2 -0
- package/dist/styles/sortable.js +3 -0
- package/dist/styles/spinner.d.ts +2 -0
- package/dist/styles/spinner.js +3 -0
- package/dist/styles/splitter.d.ts +2 -0
- package/dist/styles/splitter.js +3 -0
- package/dist/styles/stat.d.ts +2 -0
- package/dist/styles/stat.js +3 -0
- package/dist/styles/steps.d.ts +2 -0
- package/dist/styles/steps.js +3 -0
- package/dist/styles/surface.d.ts +2 -0
- package/dist/styles/surface.js +3 -0
- package/dist/styles/switch.d.ts +2 -0
- package/dist/styles/switch.js +3 -0
- package/dist/styles/table.d.ts +2 -0
- package/dist/styles/table.js +3 -0
- package/dist/styles/tabs.d.ts +2 -0
- package/dist/styles/tabs.js +3 -0
- package/dist/styles/tag.d.ts +2 -0
- package/dist/styles/tag.js +3 -0
- package/dist/styles/time-picker.d.ts +2 -0
- package/dist/styles/time-picker.js +3 -0
- package/dist/styles/timeline.d.ts +2 -0
- package/dist/styles/timeline.js +3 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/toast.js +3 -0
- package/dist/styles/toggle.d.ts +2 -0
- package/dist/styles/toggle.js +3 -0
- package/dist/styles/toolbar.d.ts +2 -0
- package/dist/styles/toolbar.js +3 -0
- package/dist/styles/tooltip.d.ts +2 -0
- package/dist/styles/tooltip.js +3 -0
- package/dist/styles/tree.d.ts +2 -0
- package/dist/styles/tree.js +3 -0
- package/dist/table-core.d.ts +75 -0
- package/dist/table-core.js +205 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +206 -0
- package/dist/top-layer.d.ts +4 -0
- package/dist/top-layer.js +33 -0
- package/package.json +101 -4
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LitElement, type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
export type Tone = 'accent' | 'secondary' | 'neutral' | 'success' | 'warning' | 'danger' | 'info';
|
|
3
|
+
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
export type Variant = 'solid' | 'soft' | 'outline' | 'ghost' | 'link';
|
|
5
|
+
export type Surface = 'flat' | 'outline' | 'gradient' | 'glass' | 'neumorphic';
|
|
6
|
+
export type Radius = 'none' | 'sharp' | 'rounded' | 'soft' | 'pill';
|
|
7
|
+
export type Density = 'compact' | 'comfortable' | 'spacious';
|
|
8
|
+
export type Motion = 'none' | 'reduced' | 'full';
|
|
9
|
+
/**
|
|
10
|
+
* `HTMLElement` that is safe to extend during SSR (Node/Bun have no DOM). Classes are only
|
|
11
|
+
* *declared* on the server; `define()` registers them in the browser.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SafeHTMLElement: typeof HTMLElement;
|
|
14
|
+
/** Layer order, shadow reset, tone context and utilities: shared by every shadow root (one constructable sheet). */
|
|
15
|
+
export declare const sharedStyles: import("lit").CSSResult;
|
|
16
|
+
export { adoptDocumentStyles, defineElement } from './register.js';
|
|
17
|
+
/**
|
|
18
|
+
* Base class for every Prismora element.
|
|
19
|
+
* - `tone`, `surface`, `radius`, `density`, `motion`, `elevation` are mirrored to `data-*` on the host,
|
|
20
|
+
* so the page's theme CSS supplies the right inherited tokens to the shadow tree and to descendants.
|
|
21
|
+
* - Unset props fall back to theme-level defaults: `--pm-default-<component>-<prop>` custom properties.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PmElement extends LitElement {
|
|
24
|
+
static styles: import("lit").CSSResult[];
|
|
25
|
+
/** Component name used for `--pm-default-<name>-<prop>` lookups. */
|
|
26
|
+
static componentName: string;
|
|
27
|
+
static properties: PropertyDeclarations;
|
|
28
|
+
/** Colour role. Inherited by descendants unless they set their own. */
|
|
29
|
+
tone?: Tone;
|
|
30
|
+
/** Surface style override for this component (and its descendants). */
|
|
31
|
+
surface?: Surface;
|
|
32
|
+
radius?: Radius;
|
|
33
|
+
density?: Density;
|
|
34
|
+
motion?: Motion;
|
|
35
|
+
elevation?: '0' | '1' | '2' | '3' | '4' | '5';
|
|
36
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
37
|
+
/** Read a theme-level default, e.g. `defaultFor('variant')` → `--pm-default-button-variant`. */
|
|
38
|
+
protected defaultFor(prop: string, style?: CSSStyleDeclaration): string | undefined;
|
|
39
|
+
/** Dispatch a composed, bubbling custom event. */
|
|
40
|
+
protected emit<T>(name: string, detail?: T, opts?: EventInit): boolean;
|
|
41
|
+
}
|
|
42
|
+
export { nextId } from './id.js';
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { css, LitElement } from 'lit';
|
|
2
|
+
import foundationCss from './styles/foundation.js';
|
|
3
|
+
/**
|
|
4
|
+
* `HTMLElement` that is safe to extend during SSR (Node/Bun have no DOM). Classes are only
|
|
5
|
+
* *declared* on the server; `define()` registers them in the browser.
|
|
6
|
+
*/
|
|
7
|
+
export const SafeHTMLElement = (globalThis.HTMLElement ?? class {
|
|
8
|
+
});
|
|
9
|
+
/** Layer order, shadow reset, tone context and utilities: shared by every shadow root (one constructable sheet). */
|
|
10
|
+
export const sharedStyles = foundationCss;
|
|
11
|
+
export { adoptDocumentStyles, defineElement } from './register.js';
|
|
12
|
+
/** Attributes that establish inherited token context; mirrored to `data-*` on the host. */
|
|
13
|
+
const CONTEXT_ATTRS = ['tone', 'surface', 'radius', 'density', 'motion', 'elevation'];
|
|
14
|
+
/**
|
|
15
|
+
* Base class for every Prismora element.
|
|
16
|
+
* - `tone`, `surface`, `radius`, `density`, `motion`, `elevation` are mirrored to `data-*` on the host,
|
|
17
|
+
* so the page's theme CSS supplies the right inherited tokens to the shadow tree and to descendants.
|
|
18
|
+
* - Unset props fall back to theme-level defaults: `--pm-default-<component>-<prop>` custom properties.
|
|
19
|
+
*/
|
|
20
|
+
export class PmElement extends LitElement {
|
|
21
|
+
// `hidden` must win over each element's own :host display (the browser's [hidden] rule loses to :host styles).
|
|
22
|
+
static { this.styles = [foundationCss, css `:host([hidden]) { display: none !important; }`]; }
|
|
23
|
+
/** Component name used for `--pm-default-<name>-<prop>` lookups. */
|
|
24
|
+
static { this.componentName = ''; }
|
|
25
|
+
static { this.properties = {
|
|
26
|
+
tone: { reflect: true },
|
|
27
|
+
surface: { reflect: true },
|
|
28
|
+
radius: { reflect: true },
|
|
29
|
+
density: { reflect: true },
|
|
30
|
+
motion: { reflect: true },
|
|
31
|
+
elevation: { reflect: true },
|
|
32
|
+
}; }
|
|
33
|
+
willUpdate(changed) {
|
|
34
|
+
super.willUpdate(changed);
|
|
35
|
+
// First render: unset context props fall back to `--pm-default-<component>-<prop>` theme defaults.
|
|
36
|
+
const first = !this.hasUpdated;
|
|
37
|
+
const style = first && this.constructor.componentName && typeof getComputedStyle !== 'undefined'
|
|
38
|
+
? getComputedStyle(this) : undefined;
|
|
39
|
+
for (const key of CONTEXT_ATTRS) {
|
|
40
|
+
if (!first && !changed.has(key))
|
|
41
|
+
continue;
|
|
42
|
+
const value = this[key] ?? (style ? this.defaultFor(key, style) : undefined);
|
|
43
|
+
if (value)
|
|
44
|
+
this.setAttribute(`data-${key}`, String(value));
|
|
45
|
+
else if (!first)
|
|
46
|
+
this.removeAttribute(`data-${key}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Read a theme-level default, e.g. `defaultFor('variant')` → `--pm-default-button-variant`. */
|
|
50
|
+
defaultFor(prop, style) {
|
|
51
|
+
const name = this.constructor.componentName;
|
|
52
|
+
if (!name || typeof getComputedStyle === 'undefined' || !this.isConnected)
|
|
53
|
+
return undefined;
|
|
54
|
+
const v = (style ?? getComputedStyle(this)).getPropertyValue(`--pm-default-${name}-${prop}`).trim();
|
|
55
|
+
return v || undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Dispatch a composed, bubbling custom event. */
|
|
58
|
+
emit(name, detail, opts = {}) {
|
|
59
|
+
return this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true, cancelable: true, ...opts }));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export { nextId } from './id.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-free catalog: categories, canonical demo markup and per-framework snippet generation.
|
|
3
|
+
* Shared by the docs site, llms.txt, the MCP server and the CLI so every surface shows the same examples.
|
|
4
|
+
*/
|
|
5
|
+
import { type ApiAttributeType } from './manifest.js';
|
|
6
|
+
/** Import specifier that registers a tag, e.g. pm-tab → "@prismora/elements/tabs". */
|
|
7
|
+
export declare const moduleFor: (tag: string) => string | undefined;
|
|
8
|
+
/** Declared type of an attribute on a Prismora element (undefined for unknown/native attributes). */
|
|
9
|
+
export declare const attrType: (tag: string, attr: string) => ApiAttributeType | undefined;
|
|
10
|
+
export type Framework = 'html' | 'react' | 'vue' | 'svelte' | 'solid' | 'angular';
|
|
11
|
+
export declare const FRAMEWORKS: Framework[];
|
|
12
|
+
export interface CatalogEntry {
|
|
13
|
+
tag: string;
|
|
14
|
+
category: 'Actions' | 'Forms' | 'Display' | 'Data' | 'Overlays' | 'Navigation';
|
|
15
|
+
/** Child-only element documented with its parent. */
|
|
16
|
+
childOf?: string;
|
|
17
|
+
/** Canonical HTML demo (also valid as the "html" snippet). */
|
|
18
|
+
demo: string;
|
|
19
|
+
/** Props surfaced in the live playground (attribute names). */
|
|
20
|
+
playground?: string[];
|
|
21
|
+
/** Suggested values for free-text playground props (e.g. icon names), shown as a select. */
|
|
22
|
+
choices?: Record<string, readonly string[]>;
|
|
23
|
+
}
|
|
24
|
+
export declare const CATALOG: CatalogEntry[];
|
|
25
|
+
export declare const catalogEntry: (tag: string) => CatalogEntry | undefined;
|
|
26
|
+
/** pm-button-group → ButtonGroup */
|
|
27
|
+
export declare const pascalName: (tag: string) => string;
|
|
28
|
+
/** Convert canonical HTML markup to an idiomatic snippet for a framework. */
|
|
29
|
+
/**
|
|
30
|
+
* Convert canonical HTML to a framework's syntax. React and Solid output is a default-exported component named
|
|
31
|
+
* `name` (default `Demo`), so it works as an imported component and as a route file (Next.js page.tsx).
|
|
32
|
+
*/
|
|
33
|
+
export declare function snippet(html: string, fw: Framework, name?: string): string;
|