le-kit 0.1.3 → 0.1.4

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 (61) hide show
  1. package/dist/docs.json +1 -1
  2. package/package.json +3 -54
  3. package/readme.md +2 -35
  4. package/dist/admin/index.d.ts +0 -23
  5. package/dist/admin/index.js +0 -74
  6. package/dist/admin/loader.js +0 -9
  7. package/dist/collection/index-admin.js +0 -27
  8. package/dist/collection/index-admin.js.map +0 -1
  9. package/dist/collection/index-core.js +0 -25
  10. package/dist/collection/index-core.js.map +0 -1
  11. package/dist/core/components/index.d.ts +0 -64
  12. package/dist/core/components/index.js +0 -125
  13. package/dist/core/components/index.js.map +0 -1
  14. package/dist/core/components/le-box.d.ts +0 -11
  15. package/dist/core/components/le-box.js +0 -246
  16. package/dist/core/components/le-box.js.map +0 -1
  17. package/dist/core/components/le-button.d.ts +0 -11
  18. package/dist/core/components/le-button.js +0 -9
  19. package/dist/core/components/le-button.js.map +0 -1
  20. package/dist/core/components/le-button2.js +0 -1358
  21. package/dist/core/components/le-button2.js.map +0 -1
  22. package/dist/core/components/le-card.d.ts +0 -11
  23. package/dist/core/components/le-card.js +0 -73
  24. package/dist/core/components/le-card.js.map +0 -1
  25. package/dist/core/components/le-checkbox.d.ts +0 -11
  26. package/dist/core/components/le-checkbox.js +0 -9
  27. package/dist/core/components/le-checkbox.js.map +0 -1
  28. package/dist/core/components/le-component.js.map +0 -1
  29. package/dist/core/components/le-number-input.d.ts +0 -11
  30. package/dist/core/components/le-number-input.js +0 -261
  31. package/dist/core/components/le-number-input.js.map +0 -1
  32. package/dist/core/components/le-popover.d.ts +0 -11
  33. package/dist/core/components/le-popover.js +0 -9
  34. package/dist/core/components/le-popover.js.map +0 -1
  35. package/dist/core/components/le-popover2.js +0 -382
  36. package/dist/core/components/le-popover2.js.map +0 -1
  37. package/dist/core/components/le-popup.d.ts +0 -11
  38. package/dist/core/components/le-popup.js +0 -269
  39. package/dist/core/components/le-popup.js.map +0 -1
  40. package/dist/core/components/le-round-progress.d.ts +0 -11
  41. package/dist/core/components/le-round-progress.js +0 -135
  42. package/dist/core/components/le-round-progress.js.map +0 -1
  43. package/dist/core/components/le-slot.js.map +0 -1
  44. package/dist/core/components/le-stack.d.ts +0 -11
  45. package/dist/core/components/le-stack.js +0 -188
  46. package/dist/core/components/le-stack.js.map +0 -1
  47. package/dist/core/components/le-string-input.d.ts +0 -11
  48. package/dist/core/components/le-string-input.js +0 -9
  49. package/dist/core/components/le-string-input.js.map +0 -1
  50. package/dist/core/components/le-text.d.ts +0 -11
  51. package/dist/core/components/le-text.js +0 -388
  52. package/dist/core/components/le-text.js.map +0 -1
  53. package/dist/core/components/le-turntable.d.ts +0 -11
  54. package/dist/core/components/le-turntable.js +0 -164
  55. package/dist/core/components/le-turntable.js.map +0 -1
  56. package/dist/core/index.d.ts +0 -21
  57. package/dist/core/index.js +0 -68
  58. package/dist/core/loader.js +0 -9
  59. package/dist/core/stencil-runtime.js +0 -1
  60. package/dist/types/index-admin.d.ts +0 -29
  61. package/dist/types/index-core.d.ts +0 -27
@@ -1,188 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { e as classnames, f as defineCustomElement$2, h as defineCustomElement$3, j as defineCustomElement$5, k as defineCustomElement$6, l as defineCustomElement$7 } from './le-button2.js';
3
- import { d as defineCustomElement$4 } from './le-popover2.js';
4
-
5
- const leStackDefaultCss = ":host{display:block}:host([hidden]){display:none}.stack{gap:var(--le-stack-gap, var(--le-space-md))}:host(.full-width){width:100%}:host(.full-height){height:100%}:host(.direction-horizontal) .stack{min-height:0}:host(.direction-vertical) .stack{min-width:0}";
6
-
7
- const LeStack$1 = /*@__PURE__*/ proxyCustomElement(class LeStack extends HTMLElement {
8
- constructor(registerHost) {
9
- super();
10
- if (registerHost !== false) {
11
- this.__registerHost();
12
- }
13
- this.__attachShadow();
14
- }
15
- get el() { return this; }
16
- /**
17
- * Direction of the stack layout
18
- * @allowedValues horizontal | vertical
19
- */
20
- direction = 'horizontal';
21
- /**
22
- * Gap between items (CSS value like '8px', '1rem', 'var(--le-space-md)')
23
- */
24
- gap;
25
- /**
26
- * Alignment of items on the cross axis
27
- * @allowedValues start | center | end | stretch | baseline
28
- */
29
- align = 'stretch';
30
- /**
31
- * Distribution of items on the main axis
32
- * @allowedValues start | center | end | space-between | space-around | space-evenly
33
- */
34
- justify = 'start';
35
- /**
36
- * Whether items should wrap to multiple lines
37
- */
38
- wrap = false;
39
- /**
40
- * Alignment of wrapped lines (only applies when wrap is true)
41
- * @allowedValues start | center | end | stretch | space-between | space-around
42
- */
43
- alignContent = 'stretch';
44
- /**
45
- * Whether to reverse the order of items
46
- */
47
- reverse = false;
48
- /**
49
- * Maximum number of items allowed in the stack (for CMS validation)
50
- * @min 1
51
- */
52
- maxItems;
53
- /**
54
- * Whether the stack should take full width of its container
55
- */
56
- fullWidth = false;
57
- /**
58
- * Whether the stack should take full height of its container
59
- */
60
- fullHeight = false;
61
- /**
62
- * Padding inside the stack container (CSS value)
63
- */
64
- padding;
65
- getFlexDirection() {
66
- const base = this.direction === 'vertical' ? 'column' : 'row';
67
- return this.reverse ? `${base}-reverse` : base;
68
- }
69
- getAlignItems() {
70
- const alignMap = {
71
- start: 'flex-start',
72
- center: 'center',
73
- end: 'flex-end',
74
- stretch: 'stretch',
75
- baseline: 'baseline',
76
- };
77
- return alignMap[this.align] || 'stretch';
78
- }
79
- getJustifyContent() {
80
- const justifyMap = {
81
- start: 'flex-start',
82
- center: 'center',
83
- end: 'flex-end',
84
- 'space-between': 'space-between',
85
- 'space-around': 'space-around',
86
- 'space-evenly': 'space-evenly',
87
- };
88
- return justifyMap[this.justify] || 'flex-start';
89
- }
90
- getAlignContent() {
91
- const alignContentMap = {
92
- start: 'flex-start',
93
- center: 'center',
94
- end: 'flex-end',
95
- stretch: 'stretch',
96
- 'space-between': 'space-between',
97
- 'space-around': 'space-around',
98
- };
99
- return alignContentMap[this.alignContent] || 'stretch';
100
- }
101
- render() {
102
- const style = {
103
- display: 'flex',
104
- flexDirection: this.getFlexDirection(),
105
- alignItems: this.getAlignItems(),
106
- justifyContent: this.getJustifyContent(),
107
- flexWrap: this.wrap ? 'wrap' : 'nowrap',
108
- };
109
- if (this.wrap) {
110
- style.alignContent = this.getAlignContent();
111
- }
112
- if (this.gap) {
113
- style.gap = this.gap;
114
- }
115
- if (this.padding) {
116
- style.padding = this.padding;
117
- }
118
- // if (this.fullWidth) {
119
- // style.width = '100%';
120
- // }
121
- // if (this.fullHeight) {
122
- // style.height = '100%';
123
- // }
124
- const hostClass = classnames(`direction-${this.direction}`, {
125
- 'wrap': this.wrap,
126
- 'reverse': this.reverse,
127
- 'full-width': this.fullWidth,
128
- 'full-height': this.fullHeight,
129
- });
130
- // Slot style for admin mode - make items display in the same direction
131
- const slotStyle = `display: flex; flex-direction: ${this.getFlexDirection()}; gap: ${this.gap || 'var(--le-space-md)'}; flex-wrap: ${this.wrap ? 'wrap' : 'nowrap'}; justify-content: ${this.getJustifyContent()}; align-items: ${this.getAlignItems()};`;
132
- return (h(Host, { class: hostClass }, h("div", { key: '61a4fd57c61c56a8abac0ae2348e6e48034efc4d', class: "stack", part: "stack", style: style }, h("slot", { key: 'f41f351d8b6dbdaf20756e9bc317a35a0424fc6c' }))));
133
- }
134
- static get style() { return leStackDefaultCss; }
135
- }, [769, "le-stack", {
136
- "direction": [1],
137
- "gap": [1],
138
- "align": [1],
139
- "justify": [1],
140
- "wrap": [4],
141
- "alignContent": [1, "align-content"],
142
- "reverse": [4],
143
- "maxItems": [2, "max-items"],
144
- "fullWidth": [4, "full-width"],
145
- "fullHeight": [4, "full-height"],
146
- "padding": [1]
147
- }]);
148
- function defineCustomElement$1() {
149
- if (typeof customElements === "undefined") {
150
- return;
151
- }
152
- const components = ["le-stack", "le-button", "le-checkbox", "le-popover", "le-string-input"];
153
- components.forEach(tagName => { switch (tagName) {
154
- case "le-stack":
155
- if (!customElements.get(tagName)) {
156
- customElements.define(tagName, LeStack$1);
157
- }
158
- break;
159
- case "le-button":
160
- if (!customElements.get(tagName)) {
161
- defineCustomElement$7();
162
- }
163
- break;
164
- case "le-checkbox":
165
- if (!customElements.get(tagName)) {
166
- defineCustomElement$6();
167
- }
168
- break;
169
- case "le-popover":
170
- if (!customElements.get(tagName)) {
171
- defineCustomElement$4();
172
- }
173
- break;
174
- case "le-string-input":
175
- if (!customElements.get(tagName)) {
176
- defineCustomElement$2();
177
- }
178
- break;
179
- } });
180
- }
181
-
182
- const LeStack = LeStack$1;
183
- const defineCustomElement = defineCustomElement$1;
184
-
185
- export { LeStack, defineCustomElement };
186
- //# sourceMappingURL=le-stack.js.map
187
-
188
- //# sourceMappingURL=le-stack.js.map
@@ -1 +0,0 @@
1
- {"file":"le-stack.js","mappings":";;;;AAAA,MAAM,iBAAiB,GAAG,mQAAmQ;;MCwBhRA,SAAO,iBAAAC,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;;;;;;;;;AAGlB;;;AAGG;IACK,SAAS,GAA8B,YAAY;AAE3D;;AAEG;AACK,IAAA,GAAG;AAEX;;;AAGG;IACK,KAAK,GAAwD,SAAS;AAE9E;;;AAGG;IACK,OAAO,GAAmF,OAAO;AAEzG;;AAEG;IACK,IAAI,GAAY,KAAK;AAE7B;;;AAGG;IACK,YAAY,GAA8E,SAAS;AAE3G;;AAEG;IACK,OAAO,GAAY,KAAK;AAEhC;;;AAGG;AACK,IAAA,QAAQ;AAEhB;;AAEG;IACK,SAAS,GAAY,KAAK;AAElC;;AAEG;IACK,UAAU,GAAY,KAAK;AAEnC;;AAEG;AACK,IAAA,OAAO;IAEP,gBAAgB,GAAA;AACtB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK;AAC7D,QAAA,OAAO,IAAI,CAAC,OAAO,GAAG,CAAG,EAAA,IAAI,CAAU,QAAA,CAAA,GAAG,IAAI;;IAGxC,aAAa,G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EAAA,2CAA2C,EAC9D,SAAS,EAAE,SAAS,EAAA,EAEpB,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACL,CACN,CACO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["LeStack","__stencil_proxyCustomElement"],"sources":["src/components/le-stack/le-stack.default.css?tag=le-stack&encapsulation=shadow","src/components/le-stack/le-stack.tsx"],"sourcesContent":["/**\n * le-stack default styles\n *\n * The component uses inline styles for flex properties to allow\n * dynamic prop-based configuration. This CSS handles theming.\n */\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/* Base stack container */\n.stack {\n gap: var(--le-stack-gap, var(--le-space-md));\n}\n\n/* Full width/height variants */\n:host(.full-width) {\n width: 100%;\n}\n\n:host(.full-height) {\n height: 100%;\n}\n\n/* Direction-specific defaults */\n:host(.direction-horizontal) .stack {\n min-height: 0;\n}\n\n:host(.direction-vertical) .stack {\n min-width: 0;\n}\n","import { Component, Prop, h, Element } from '@stencil/core';\nimport { classnames } from '../../utils/utils';\n\n/**\n * A flexible stack layout component using CSS flexbox.\n *\n * `le-stack` arranges its children in a row (horizontal) or column (vertical)\n * with configurable spacing, alignment, and wrapping behavior. Perfect for\n * creating responsive layouts.\n *\n * @slot - Default slot for stack items (le-box components recommended)\n *\n * @cssprop --le-stack-gap - Gap between items (defaults to var(--le-space-md))\n *\n * @csspart stack - The main stack container\n *\n * @cmsEditable true\n * @cmsCategory Layout\n */\n@Component({\n tag: 'le-stack',\n styleUrl: 'le-stack.default.css',\n shadow: true,\n})\nexport class LeStack {\n @Element() el: HTMLElement;\n\n /**\n * Direction of the stack layout\n * @allowedValues horizontal | vertical\n */\n @Prop() direction: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Gap between items (CSS value like '8px', '1rem', 'var(--le-space-md)')\n */\n @Prop() gap?: string;\n\n /**\n * Alignment of items on the cross axis\n * @allowedValues start | center | end | stretch | baseline\n */\n @Prop() align: 'start' | 'center' | 'end' | 'stretch' | 'baseline' = 'stretch';\n\n /**\n * Distribution of items on the main axis\n * @allowedValues start | center | end | space-between | space-around | space-evenly\n */\n @Prop() justify: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly' = 'start';\n\n /**\n * Whether items should wrap to multiple lines\n */\n @Prop() wrap: boolean = false;\n\n /**\n * Alignment of wrapped lines (only applies when wrap is true)\n * @allowedValues start | center | end | stretch | space-between | space-around\n */\n @Prop() alignContent: 'start' | 'center' | 'end' | 'stretch' | 'space-between' | 'space-around' = 'stretch';\n\n /**\n * Whether to reverse the order of items\n */\n @Prop() reverse: boolean = false;\n\n /**\n * Maximum number of items allowed in the stack (for CMS validation)\n * @min 1\n */\n @Prop() maxItems?: number;\n\n /**\n * Whether the stack should take full width of its container\n */\n @Prop() fullWidth: boolean = false;\n\n /**\n * Whether the stack should take full height of its container\n */\n @Prop() fullHeight: boolean = false;\n\n /**\n * Padding inside the stack container (CSS value)\n */\n @Prop() padding?: string;\n\n private getFlexDirection(): string {\n const base = this.direction === 'vertical' ? 'column' : 'row';\n return this.reverse ? `${base}-reverse` : base;\n }\n\n private getAlignItems(): string {\n const alignMap: Record<string, string> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n baseline: 'baseline',\n };\n return alignMap[this.align] || 'stretch';\n }\n\n private getJustifyContent(): string {\n const justifyMap: Record<string, string> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n 'space-between': 'space-between',\n 'space-around': 'space-around',\n 'space-evenly': 'space-evenly',\n };\n return justifyMap[this.justify] || 'flex-start';\n }\n\n private getAlignContent(): string {\n const alignContentMap: Record<string, string> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n 'space-between': 'space-between',\n 'space-around': 'space-around',\n };\n return alignContentMap[this.alignContent] || 'stretch';\n }\n\n render() {\n const style: { [key: string]: string } = {\n display: 'flex',\n flexDirection: this.getFlexDirection(),\n alignItems: this.getAlignItems(),\n justifyContent: this.getJustifyContent(),\n flexWrap: this.wrap ? 'wrap' : 'nowrap',\n };\n\n if (this.wrap) {\n style.alignContent = this.getAlignContent();\n }\n\n if (this.gap) {\n style.gap = this.gap;\n }\n\n if (this.padding) {\n style.padding = this.padding;\n }\n\n // if (this.fullWidth) {\n // style.width = '100%';\n // }\n\n // if (this.fullHeight) {\n // style.height = '100%';\n // }\n\n const hostClass = classnames(\n `direction-${this.direction}`,\n {\n 'wrap': this.wrap,\n 'reverse': this.reverse,\n 'full-width': this.fullWidth,\n 'full-height': this.fullHeight,\n }\n );\n\n // Slot style for admin mode - make items display in the same direction\n const slotStyle = `display: flex; flex-direction: ${this.getFlexDirection()}; gap: ${this.gap || 'var(--le-space-md)'}; flex-wrap: ${this.wrap ? 'wrap' : 'nowrap'}; justify-content: ${this.getJustifyContent()}; align-items: ${this.getAlignItems()};`;\n\n return (\n <le-component component=\"le-stack\" hostClass={hostClass}>\n <div class=\"stack\" part=\"stack\" style={style}>\n <le-slot\n name=\"\"\n description={`Items arranged ${this.direction}ly${this.maxItems ? ` (max ${this.maxItems})` : ''}`}\n type=\"slot\"\n allowed-components=\"le-text,le-box,le-card,le-button,le-stack\"\n slotStyle={slotStyle}\n >\n <slot></slot>\n </le-slot>\n </div>\n </le-component>\n );\n }\n}\n"],"version":3}
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface LeStringInput extends Components.LeStringInput, HTMLElement {}
4
- export const LeStringInput: {
5
- prototype: LeStringInput;
6
- new (): LeStringInput;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,9 +0,0 @@
1
- import { q as LeStringInput$1, f as defineCustomElement$1 } from './le-button2.js';
2
-
3
- const LeStringInput = LeStringInput$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { LeStringInput, defineCustomElement };
7
- //# sourceMappingURL=le-string-input.js.map
8
-
9
- //# sourceMappingURL=le-string-input.js.map
@@ -1 +0,0 @@
1
- {"file":"le-string-input.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface LeText extends Components.LeText, HTMLElement {}
4
- export const LeText: {
5
- prototype: LeText;
6
- new (): LeText;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,388 +0,0 @@
1
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { r as observeModeChanges, f as defineCustomElement$2, h as defineCustomElement$3, j as defineCustomElement$5, k as defineCustomElement$6, l as defineCustomElement$7 } from './le-button2.js';
3
- import { d as defineCustomElement$4 } from './le-popover2.js';
4
-
5
- const leTextDefaultCss = ":host{display:block}:host([hidden]){display:none}.le-text{margin:0;color:var(--le-text-color, var(--le-color-text));font-family:var(--le-font-family);line-height:var(--le-text-line-height, 1.5)}.variant-p{font-size:var(--le-font-size-base, 1rem);font-weight:var(--le-font-weight-normal, 400);color:var(--le-color-text)}.variant-h1{font-size:var(--le-font-size-4xl, 2.5rem);font-weight:var(--le-font-weight-bold, 700);line-height:1.2;color:var(--le-color-text);letter-spacing:-0.02em}.variant-h2{font-size:var(--le-font-size-3xl, 2rem);font-weight:var(--le-font-weight-bold, 700);line-height:1.25;color:var(--le-color-text);letter-spacing:-0.01em}.variant-h3{font-size:var(--le-font-size-2xl, 1.5rem);font-weight:var(--le-font-weight-semibold, 600);line-height:1.3;color:var(--le-color-text)}.variant-h4{font-size:var(--le-font-size-xl, 1.25rem);font-weight:var(--le-font-weight-semibold, 600);line-height:1.35;color:var(--le-color-text)}.variant-h5{font-size:var(--le-font-size-lg, 1.125rem);font-weight:var(--le-font-weight-medium, 500);line-height:1.4;color:var(--le-color-text)}.variant-h6{font-size:var(--le-font-size-base, 1rem);font-weight:var(--le-font-weight-medium, 500);line-height:1.45;color:var(--le-color-text);text-transform:uppercase;letter-spacing:0.05em}.variant-code{font-family:var(--le-font-family-mono, 'SF Mono', 'Fira Code', 'Consolas', monospace);font-size:var(--le-font-size-sm, 0.875rem);background:var(--le-color-surface-alt, #f5f5f5);padding:var(--le-space-md);border-radius:var(--le-radius-md);overflow-x:auto;white-space:pre-wrap;color:var(--le-color-text)}.variant-quote{font-size:var(--le-font-size-lg, 1.125rem);font-style:italic;color:var(--le-color-text-secondary);border-left:4px solid var(--le-color-primary);padding-left:var(--le-space-lg);margin-left:0;margin-right:0}.variant-label{font-size:var(--le-font-size-sm, 0.875rem);font-weight:var(--le-font-weight-medium, 500);color:var(--le-color-text-secondary);text-transform:uppercase;letter-spacing:0.05em}.variant-small{font-size:var(--le-font-size-sm, 0.875rem);color:var(--le-color-text-secondary)}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.truncate.max-lines-2,.truncate.max-lines-3,.truncate.max-lines-4,.truncate.max-lines-5{white-space:normal;display:-webkit-box;-webkit-box-orient:vertical}.truncate.max-lines-2{-webkit-line-clamp:2;line-clamp:2}.truncate.max-lines-3{-webkit-line-clamp:3;line-clamp:3}.truncate.max-lines-4{-webkit-line-clamp:4;line-clamp:4}.truncate.max-lines-5{-webkit-line-clamp:5;line-clamp:5}:host([align=\"center\"]) .le-text{text-align:center}:host([align=\"right\"]) .le-text{text-align:right}:host([align=\"justify\"]) .le-text{text-align:justify}.le-text a{color:var(--le-color-primary);text-decoration:underline}.le-text a:hover{color:var(--le-color-primary-dark)}.le-text strong,.le-text b{font-weight:var(--le-font-weight-bold, 700)}.le-text em,.le-text i{font-style:italic}.le-text u{text-decoration:underline}.le-text s,.le-text strike{text-decoration:line-through}";
6
-
7
- const LeText$1 = /*@__PURE__*/ proxyCustomElement(class LeText extends HTMLElement {
8
- constructor(registerHost) {
9
- super();
10
- if (registerHost !== false) {
11
- this.__registerHost();
12
- }
13
- this.__attachShadow();
14
- }
15
- get el() { return this; }
16
- /**
17
- * The semantic variant/type of text element
18
- * @allowedValues p | h1 | h2 | h3 | h4 | h5 | h6 | code | quote | label | small
19
- */
20
- variant = 'p';
21
- /**
22
- * Text alignment
23
- * @allowedValues left | center | right | justify
24
- */
25
- align = 'left';
26
- /**
27
- * Text color (CSS value or theme token)
28
- */
29
- color;
30
- /**
31
- * Whether the text should truncate with ellipsis
32
- */
33
- truncate = false;
34
- /**
35
- * Maximum number of lines before truncating (requires truncate=true)
36
- */
37
- maxLines;
38
- /**
39
- * Internal state to track admin mode
40
- */
41
- adminMode = false;
42
- /**
43
- * The HTML content being edited
44
- */
45
- content = '';
46
- /**
47
- * Whether the editor is focused (shows toolbar)
48
- */
49
- isFocused = false;
50
- /**
51
- * Current selection state for toolbar button highlighting
52
- */
53
- selectionState = {
54
- isBold: false,
55
- isItalic: false,
56
- isUnderline: false,
57
- isStrikethrough: false,
58
- isLink: false,
59
- blockType: 'p',
60
- };
61
- /**
62
- * Reference to the contenteditable element
63
- */
64
- editorRef;
65
- /**
66
- * Reference to the slot element
67
- */
68
- slotRef;
69
- disconnectModeObserver;
70
- connectedCallback() {
71
- this.disconnectModeObserver = observeModeChanges(this.el, (mode) => {
72
- const wasAdmin = this.adminMode;
73
- this.adminMode = mode === 'admin';
74
- if (this.adminMode && !wasAdmin) {
75
- // Entering admin mode - read content from slot
76
- requestAnimationFrame(() => this.readSlottedContent());
77
- }
78
- else if (!this.adminMode && wasAdmin) {
79
- // Leaving admin mode - sync content back to slot
80
- this.syncContentToSlot();
81
- }
82
- });
83
- }
84
- disconnectedCallback() {
85
- this.disconnectModeObserver?.();
86
- }
87
- onVariantChange() {
88
- // When variant changes in admin mode, update the content wrapper
89
- if (this.adminMode && this.editorRef) {
90
- this.syncContentToSlot();
91
- }
92
- }
93
- /**
94
- * Read content from slotted elements
95
- */
96
- readSlottedContent() {
97
- if (!this.slotRef)
98
- return;
99
- const assignedNodes = this.slotRef.assignedNodes({ flatten: true });
100
- // Collect all content from assigned nodes
101
- let html = '';
102
- assignedNodes.forEach(node => {
103
- if (node.nodeType === Node.TEXT_NODE) {
104
- html += node.textContent;
105
- }
106
- else if (node.nodeType === Node.ELEMENT_NODE) {
107
- html += node.innerHTML || node.textContent;
108
- }
109
- });
110
- this.content = html.trim();
111
- }
112
- /**
113
- * Sync edited content back to the slot
114
- */
115
- syncContentToSlot() {
116
- if (!this.editorRef)
117
- return;
118
- const newContent = this.editorRef.innerHTML;
119
- // Update the light DOM content
120
- // We need to update the actual slotted content
121
- const slot = this.slotRef;
122
- if (slot) {
123
- const assignedNodes = slot.assignedNodes({ flatten: true });
124
- if (assignedNodes.length > 0) {
125
- const firstNode = assignedNodes[0];
126
- if (firstNode.nodeType === Node.ELEMENT_NODE) {
127
- firstNode.innerHTML = newContent;
128
- }
129
- else if (firstNode.nodeType === Node.TEXT_NODE) {
130
- // Replace text node with the new content
131
- const parent = firstNode.parentNode;
132
- if (parent) {
133
- // Create a temporary element to parse HTML
134
- const temp = document.createElement('span');
135
- temp.innerHTML = newContent;
136
- // Replace the text node
137
- parent.replaceChild(temp, firstNode);
138
- // Unwrap the span if it only contains text
139
- if (temp.childNodes.length === 1 && temp.firstChild?.nodeType === Node.TEXT_NODE) {
140
- parent.replaceChild(temp.firstChild, temp);
141
- }
142
- }
143
- }
144
- }
145
- else {
146
- // No assigned nodes, set innerHTML on the host's light DOM
147
- this.el.innerHTML = newContent;
148
- }
149
- }
150
- }
151
- /**
152
- * Handle input in the contenteditable
153
- */
154
- handleInput = () => {
155
- if (this.editorRef) {
156
- this.content = this.editorRef.innerHTML;
157
- this.updateSelectionState();
158
- }
159
- };
160
- /**
161
- * Handle focus on the editor
162
- */
163
- handleFocus = () => {
164
- this.isFocused = true;
165
- this.updateSelectionState();
166
- };
167
- /**
168
- * Handle blur on the editor
169
- */
170
- handleBlur = (e) => {
171
- // Check if focus moved to toolbar
172
- const relatedTarget = e.relatedTarget;
173
- const toolbar = this.el.shadowRoot?.querySelector('.le-text-toolbar');
174
- if (toolbar?.contains(relatedTarget)) {
175
- // Focus moved to toolbar, keep it open
176
- return;
177
- }
178
- // Small delay to allow toolbar clicks to register
179
- setTimeout(() => {
180
- if (!this.el.shadowRoot?.activeElement) {
181
- this.isFocused = false;
182
- this.syncContentToSlot();
183
- }
184
- }, 150);
185
- };
186
- /**
187
- * Handle selection change to update toolbar state
188
- */
189
- handleSelectionChange = () => {
190
- this.updateSelectionState();
191
- };
192
- /**
193
- * Update the selection state for toolbar highlighting
194
- */
195
- updateSelectionState() {
196
- const selection = window.getSelection();
197
- if (!selection || selection.rangeCount === 0)
198
- return;
199
- this.selectionState = {
200
- isBold: document.queryCommandState('bold'),
201
- isItalic: document.queryCommandState('italic'),
202
- isUnderline: document.queryCommandState('underline'),
203
- isStrikethrough: document.queryCommandState('strikeThrough'),
204
- isLink: this.isSelectionInLink(selection),
205
- blockType: this.variant,
206
- };
207
- }
208
- /**
209
- * Check if current selection is within a link
210
- */
211
- isSelectionInLink(selection) {
212
- if (!selection.anchorNode)
213
- return false;
214
- let node = selection.anchorNode;
215
- while (node && node !== this.editorRef) {
216
- if (node.nodeName === 'A')
217
- return true;
218
- node = node.parentNode;
219
- }
220
- return false;
221
- }
222
- /**
223
- * Execute a formatting command
224
- */
225
- execCommand(command, value) {
226
- // Focus the editor first
227
- this.editorRef?.focus();
228
- // Execute the command
229
- document.execCommand(command, false, value);
230
- // Update state
231
- this.handleInput();
232
- this.updateSelectionState();
233
- }
234
- /**
235
- * Toggle bold formatting
236
- */
237
- toggleBold = (e) => {
238
- e.preventDefault();
239
- this.execCommand('bold');
240
- };
241
- /**
242
- * Toggle italic formatting
243
- */
244
- toggleItalic = (e) => {
245
- e.preventDefault();
246
- this.execCommand('italic');
247
- };
248
- /**
249
- * Toggle underline formatting
250
- */
251
- toggleUnderline = (e) => {
252
- e.preventDefault();
253
- this.execCommand('underline');
254
- };
255
- /**
256
- * Toggle strikethrough formatting
257
- */
258
- toggleStrikethrough = (e) => {
259
- e.preventDefault();
260
- this.execCommand('strikeThrough');
261
- };
262
- /**
263
- * Add or edit a link
264
- */
265
- toggleLink = (e) => {
266
- e.preventDefault();
267
- if (this.selectionState.isLink) {
268
- // Remove link
269
- this.execCommand('unlink');
270
- }
271
- else {
272
- // Add link
273
- const url = prompt('Enter URL:', 'https://');
274
- if (url) {
275
- this.execCommand('createLink', url);
276
- }
277
- }
278
- };
279
- /**
280
- * Change the block type/variant
281
- */
282
- changeVariant = (e) => {
283
- const select = e.target;
284
- this.variant = select.value;
285
- };
286
- /**
287
- * Render the formatting toolbar
288
- */
289
- renderToolbar() {
290
- return (h("div", { class: "le-text-toolbar" }, h("select", { class: "le-text-toolbar-select", onChange: this.changeVariant, onMouseDown: (e) => e.preventDefault() }, h("option", { value: "p", selected: this.variant === 'p' }, "Paragraph"), h("option", { value: "h1", selected: this.variant === 'h1' }, "Heading 1"), h("option", { value: "h2", selected: this.variant === 'h2' }, "Heading 2"), h("option", { value: "h3", selected: this.variant === 'h3' }, "Heading 3"), h("option", { value: "h4", selected: this.variant === 'h4' }, "Heading 4"), h("option", { value: "h5", selected: this.variant === 'h5' }, "Heading 5"), h("option", { value: "h6", selected: this.variant === 'h6' }, "Heading 6"), h("option", { value: "quote", selected: this.variant === 'quote' }, "Quote"), h("option", { value: "code", selected: this.variant === 'code' }, "Code"), h("option", { value: "label", selected: this.variant === 'label' }, "Label"), h("option", { value: "small", selected: this.variant === 'small' }, "Small")), h("div", { class: "le-text-toolbar-divider" }), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isBold }, onMouseDown: this.toggleBold, title: "Bold (Ctrl+B)" }, h("strong", null, "B")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isItalic }, onMouseDown: this.toggleItalic, title: "Italic (Ctrl+I)" }, h("em", null, "I")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isUnderline }, onMouseDown: this.toggleUnderline, title: "Underline (Ctrl+U)" }, h("span", { style: { textDecoration: 'underline' } }, "U")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isStrikethrough }, onMouseDown: this.toggleStrikethrough, title: "Strikethrough" }, h("span", { style: { textDecoration: 'line-through' } }, "S")), h("div", { class: "le-text-toolbar-divider" }), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isLink }, onMouseDown: this.toggleLink, title: this.selectionState.isLink ? 'Remove link' : 'Add link' }, "\uD83D\uDD17")));
291
- }
292
- /**
293
- * Get the semantic tag for the current variant
294
- */
295
- getTag() {
296
- switch (this.variant) {
297
- case 'quote':
298
- return 'blockquote';
299
- case 'code':
300
- return 'pre';
301
- case 'label':
302
- return 'label';
303
- case 'small':
304
- return 'small';
305
- default:
306
- return this.variant; // h1-h6, p
307
- }
308
- }
309
- render() {
310
- const Tag = this.getTag();
311
- const textStyle = {};
312
- if (this.color) {
313
- textStyle.color = this.color;
314
- }
315
- if (this.align) {
316
- textStyle.textAlign = this.align;
317
- }
318
- const textClass = {
319
- 'le-text': true,
320
- [`variant-${this.variant}`]: true,
321
- 'truncate': this.truncate,
322
- [`max-lines-${this.maxLines}`]: this.truncate && this.maxLines,
323
- };
324
- // Admin mode - show rich text editor
325
- if (this.adminMode) {
326
- return (h(Host, { class: "admin-mode" }, h(Host, { class: "" }, h("div", { class: "le-text-editor-wrapper" }, this.isFocused && this.renderToolbar(), h(Tag, { class: textClass, part: "text", style: textStyle }, h("div", { ref: (el) => this.editorRef = el, class: "le-text-editor", contentEditable: true, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyUp: this.handleSelectionChange, onMouseUp: this.handleSelectionChange, innerHTML: this.content })), h("div", { class: "hidden-slot" }, h("slot", { ref: (el) => this.slotRef = el, onSlotchange: () => this.readSlottedContent() }))))));
327
- }
328
- // Default mode - render semantic element with slotted content
329
- return (h(Host, null, h(Tag, { class: textClass, part: "text", style: textStyle }, h("slot", { ref: (el) => this.slotRef = el }))));
330
- }
331
- static get watchers() { return {
332
- "variant": ["onVariantChange"]
333
- }; }
334
- static get style() { return leTextDefaultCss; }
335
- }, [769, "le-text", {
336
- "variant": [1537],
337
- "align": [513],
338
- "color": [1],
339
- "truncate": [4],
340
- "maxLines": [2, "max-lines"],
341
- "adminMode": [32],
342
- "content": [32],
343
- "isFocused": [32],
344
- "selectionState": [32]
345
- }, undefined, {
346
- "variant": ["onVariantChange"]
347
- }]);
348
- function defineCustomElement$1() {
349
- if (typeof customElements === "undefined") {
350
- return;
351
- }
352
- const components = ["le-text", "le-button", "le-checkbox", "le-popover", "le-string-input"];
353
- components.forEach(tagName => { switch (tagName) {
354
- case "le-text":
355
- if (!customElements.get(tagName)) {
356
- customElements.define(tagName, LeText$1);
357
- }
358
- break;
359
- case "le-button":
360
- if (!customElements.get(tagName)) {
361
- defineCustomElement$7();
362
- }
363
- break;
364
- case "le-checkbox":
365
- if (!customElements.get(tagName)) {
366
- defineCustomElement$6();
367
- }
368
- break;
369
- case "le-popover":
370
- if (!customElements.get(tagName)) {
371
- defineCustomElement$4();
372
- }
373
- break;
374
- case "le-string-input":
375
- if (!customElements.get(tagName)) {
376
- defineCustomElement$2();
377
- }
378
- break;
379
- } });
380
- }
381
-
382
- const LeText = LeText$1;
383
- const defineCustomElement = defineCustomElement$1;
384
-
385
- export { LeText, defineCustomElement };
386
- //# sourceMappingURL=le-text.js.map
387
-
388
- //# sourceMappingURL=le-text.js.map