ds-one 0.2.0-alpha.2 → 0.2.5-alpha.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.
Files changed (247) hide show
  1. package/DS1/{utils/language.ts → 0-face/i18n.ts} +197 -2
  2. package/DS1/0-face/preferences.ts +23 -0
  3. package/DS1/0-face/pricing.ts +57 -0
  4. package/DS1/1-root/one.css +1 -1
  5. package/DS1/2-core/ds-button.ts +1 -1
  6. package/DS1/2-core/ds-cycle.ts +17 -18
  7. package/DS1/2-core/{ds-year.ts → ds-date.ts} +4 -4
  8. package/DS1/2-core/ds-input.ts +1 -0
  9. package/DS1/2-core/ds-text.ts +1 -1
  10. package/DS1/2-core/ds-tooltip.ts +4 -3
  11. package/DS1/3-unit/doublenav-v1.ts +105 -0
  12. package/DS1/3-unit/{ds-doublenav.ts → ds-portfolio-doublenav.ts} +4 -5
  13. package/DS1/3-unit/ds-portfolio-panel.ts +27 -0
  14. package/DS1/3-unit/ds-portfolio-singlenav.ts +79 -0
  15. package/DS1/3-unit/list-v1.ts +24 -0
  16. package/DS1/3-unit/{ds-panel.ts → panel-v1.ts} +2 -3
  17. package/DS1/3-unit/row-v1.ts +52 -0
  18. package/DS1/3-unit/{ds-singlenav.ts → singlenav-v1.ts} +4 -5
  19. package/DS1/4-page/ds-grid.ts +1 -1
  20. package/DS1/index.ts +39 -37
  21. package/README.md +3 -3
  22. package/dist/0-face/{2025-04-23-device.d.ts → device.d.ts} +1 -1
  23. package/dist/0-face/device.d.ts.map +1 -0
  24. package/dist/{utils/language.d.ts → 0-face/i18n.d.ts} +1 -1
  25. package/dist/0-face/i18n.d.ts.map +1 -0
  26. package/dist/{utils/language.js → 0-face/i18n.js} +141 -2
  27. package/dist/0-face/preferences.d.ts +9 -0
  28. package/dist/0-face/preferences.d.ts.map +1 -0
  29. package/dist/0-face/preferences.js +14 -0
  30. package/dist/0-face/pricing.d.ts +15 -0
  31. package/dist/0-face/pricing.d.ts.map +1 -0
  32. package/dist/0-face/pricing.js +46 -0
  33. package/dist/0-face/theme.d.ts.map +1 -0
  34. package/dist/2-core/ds-button.js +1 -1
  35. package/dist/2-core/ds-cycle.js +15 -15
  36. package/dist/2-core/{ds-year.d.ts → ds-date.d.ts} +4 -4
  37. package/dist/2-core/ds-date.d.ts.map +1 -0
  38. package/dist/2-core/{ds-year.js → ds-date.js} +4 -4
  39. package/dist/2-core/ds-input.d.ts +1 -0
  40. package/dist/2-core/ds-input.d.ts.map +1 -0
  41. package/dist/2-core/ds-input.js +1 -0
  42. package/dist/2-core/ds-text.js +1 -1
  43. package/dist/2-core/ds-tooltip.d.ts.map +1 -1
  44. package/dist/2-core/ds-tooltip.js +4 -2
  45. package/dist/3-unit/{ds-doublenav.d.ts → ds-portfolio-doublenav.d.ts} +4 -4
  46. package/dist/3-unit/ds-portfolio-doublenav.d.ts.map +1 -0
  47. package/dist/3-unit/{ds-doublenav.js → ds-portfolio-doublenav.js} +4 -4
  48. package/dist/3-unit/{ds-panel.d.ts → ds-portfolio-panel.d.ts} +3 -3
  49. package/dist/3-unit/ds-portfolio-panel.d.ts.map +1 -0
  50. package/dist/3-unit/{ds-panel.js → ds-portfolio-panel.js} +3 -3
  51. package/dist/3-unit/{ds-singlenav.d.ts → ds-portfolio-singlenav.d.ts} +4 -4
  52. package/dist/3-unit/ds-portfolio-singlenav.d.ts.map +1 -0
  53. package/dist/3-unit/{ds-singlenav.js → ds-portfolio-singlenav.js} +4 -4
  54. package/dist/4-page/ds-grid.js +1 -1
  55. package/dist/ds-one.bundle.js +2087 -3806
  56. package/dist/ds-one.bundle.js.map +4 -4
  57. package/dist/ds-one.bundle.min.js +74 -740
  58. package/dist/ds-one.bundle.min.js.map +4 -4
  59. package/dist/index.d.ts +16 -26
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +32 -34
  62. package/package.json +2 -2
  63. package/DS1/0-face/2025-04-23-language.ts +0 -4
  64. package/DS1/2-core/ds-article.ts +0 -454
  65. package/DS1/2-core/ds-attributes.ts +0 -155
  66. package/DS1/2-core/ds-downloadcv.ts +0 -146
  67. package/DS1/2-core/ds-header.ts +0 -82
  68. package/DS1/2-core/ds-home.ts +0 -168
  69. package/DS1/2-core/ds-link.ts +0 -121
  70. package/DS1/2-core/ds-markdown.ts +0 -252
  71. package/DS1/2-core/ds-price.ts +0 -108
  72. package/DS1/2-core/ds-squarecircle.ts +0 -155
  73. package/DS1/2-core/ds-title.ts +0 -139
  74. package/DS1/2-core/ds-viewtoggle.ts +0 -83
  75. package/DS1/utils/cdn-loader.ts +0 -232
  76. package/DS1/utils/keys.json +0 -41
  77. package/DS1/utils/pricing.ts +0 -24
  78. package/DS1/utils/scroll.ts +0 -184
  79. package/DS1/utils/settings.ts +0 -23
  80. package/DS1/utils/viewMode.ts +0 -55
  81. package/dist/0-face/2025-04-23-device.d.ts.map +0 -1
  82. package/dist/0-face/2025-04-23-language.d.ts +0 -1
  83. package/dist/0-face/2025-04-23-language.d.ts.map +0 -1
  84. package/dist/0-face/2025-04-23-language.js +0 -3
  85. package/dist/2-core/article-v1.d.ts +0 -129
  86. package/dist/2-core/article-v1.d.ts.map +0 -1
  87. package/dist/2-core/article-v1.js +0 -361
  88. package/dist/2-core/attributes-v1.d.ts +0 -47
  89. package/dist/2-core/attributes-v1.d.ts.map +0 -1
  90. package/dist/2-core/attributes-v1.js +0 -128
  91. package/dist/2-core/cycle-v1.d.ts +0 -66
  92. package/dist/2-core/cycle-v1.d.ts.map +0 -1
  93. package/dist/2-core/cycle-v1.js +0 -586
  94. package/dist/2-core/downloadcv-v1.d.ts +0 -58
  95. package/dist/2-core/downloadcv-v1.d.ts.map +0 -1
  96. package/dist/2-core/downloadcv-v1.js +0 -119
  97. package/dist/2-core/ds-article.d.ts +0 -129
  98. package/dist/2-core/ds-article.d.ts.map +0 -1
  99. package/dist/2-core/ds-article.js +0 -361
  100. package/dist/2-core/ds-attributes.d.ts +0 -47
  101. package/dist/2-core/ds-attributes.d.ts.map +0 -1
  102. package/dist/2-core/ds-attributes.js +0 -128
  103. package/dist/2-core/ds-button.figma.d.ts +0 -2
  104. package/dist/2-core/ds-button.figma.d.ts.map +0 -1
  105. package/dist/2-core/ds-button.figma.js +0 -6
  106. package/dist/2-core/ds-downloadcv.d.ts +0 -58
  107. package/dist/2-core/ds-downloadcv.d.ts.map +0 -1
  108. package/dist/2-core/ds-downloadcv.js +0 -119
  109. package/dist/2-core/ds-header.d.ts +0 -28
  110. package/dist/2-core/ds-header.d.ts.map +0 -1
  111. package/dist/2-core/ds-header.js +0 -66
  112. package/dist/2-core/ds-home.d.ts +0 -26
  113. package/dist/2-core/ds-home.d.ts.map +0 -1
  114. package/dist/2-core/ds-home.js +0 -148
  115. package/dist/2-core/ds-link.d.ts +0 -35
  116. package/dist/2-core/ds-link.d.ts.map +0 -1
  117. package/dist/2-core/ds-link.js +0 -85
  118. package/dist/2-core/ds-markdown.d.ts +0 -7
  119. package/dist/2-core/ds-markdown.d.ts.map +0 -1
  120. package/dist/2-core/ds-markdown.js +0 -240
  121. package/dist/2-core/ds-price.d.ts +0 -46
  122. package/dist/2-core/ds-price.d.ts.map +0 -1
  123. package/dist/2-core/ds-price.js +0 -72
  124. package/dist/2-core/ds-squarecircle.d.ts +0 -50
  125. package/dist/2-core/ds-squarecircle.d.ts.map +0 -1
  126. package/dist/2-core/ds-squarecircle.js +0 -133
  127. package/dist/2-core/ds-title.d.ts +0 -50
  128. package/dist/2-core/ds-title.d.ts.map +0 -1
  129. package/dist/2-core/ds-title.js +0 -103
  130. package/dist/2-core/ds-viewtoggle.d.ts +0 -27
  131. package/dist/2-core/ds-viewtoggle.d.ts.map +0 -1
  132. package/dist/2-core/ds-viewtoggle.js +0 -49
  133. package/dist/2-core/ds-year.d.ts.map +0 -1
  134. package/dist/2-core/header-v1.d.ts +0 -28
  135. package/dist/2-core/header-v1.d.ts.map +0 -1
  136. package/dist/2-core/header-v1.js +0 -66
  137. package/dist/2-core/home-v1.d.ts +0 -26
  138. package/dist/2-core/home-v1.d.ts.map +0 -1
  139. package/dist/2-core/home-v1.js +0 -148
  140. package/dist/2-core/icon-v1.d.ts +0 -28
  141. package/dist/2-core/icon-v1.d.ts.map +0 -1
  142. package/dist/2-core/icon-v1.js +0 -297
  143. package/dist/2-core/link-v1.d.ts +0 -35
  144. package/dist/2-core/link-v1.d.ts.map +0 -1
  145. package/dist/2-core/link-v1.js +0 -85
  146. package/dist/2-core/markdown-v1.d.ts +0 -7
  147. package/dist/2-core/markdown-v1.d.ts.map +0 -1
  148. package/dist/2-core/markdown-v1.js +0 -240
  149. package/dist/2-core/price-v1.d.ts +0 -46
  150. package/dist/2-core/price-v1.d.ts.map +0 -1
  151. package/dist/2-core/price-v1.js +0 -72
  152. package/dist/2-core/squarecircle-v1.d.ts +0 -50
  153. package/dist/2-core/squarecircle-v1.d.ts.map +0 -1
  154. package/dist/2-core/squarecircle-v1.js +0 -133
  155. package/dist/2-core/text-v1.d.ts +0 -48
  156. package/dist/2-core/text-v1.d.ts.map +0 -1
  157. package/dist/2-core/text-v1.js +0 -83
  158. package/dist/2-core/title-v1.d.ts +0 -50
  159. package/dist/2-core/title-v1.d.ts.map +0 -1
  160. package/dist/2-core/title-v1.js +0 -103
  161. package/dist/2-core/tooltip-v1.d.ts +0 -39
  162. package/dist/2-core/tooltip-v1.d.ts.map +0 -1
  163. package/dist/2-core/tooltip-v1.js +0 -145
  164. package/dist/2-core/viewtoggle-v1.d.ts +0 -27
  165. package/dist/2-core/viewtoggle-v1.d.ts.map +0 -1
  166. package/dist/2-core/viewtoggle-v1.js +0 -49
  167. package/dist/2-core/year-v1.d.ts +0 -16
  168. package/dist/2-core/year-v1.d.ts.map +0 -1
  169. package/dist/2-core/year-v1.js +0 -21
  170. package/dist/3-unit/ds-doublenav.d.ts.map +0 -1
  171. package/dist/3-unit/ds-panel.d.ts.map +0 -1
  172. package/dist/3-unit/ds-singlenav.d.ts.map +0 -1
  173. package/dist/utils/cdn-loader.d.ts +0 -19
  174. package/dist/utils/cdn-loader.d.ts.map +0 -1
  175. package/dist/utils/cdn-loader.js +0 -160
  176. package/dist/utils/keys.json +0 -41
  177. package/dist/utils/language.d.ts.map +0 -1
  178. package/dist/utils/pricing.d.ts +0 -8
  179. package/dist/utils/pricing.d.ts.map +0 -1
  180. package/dist/utils/pricing.js +0 -14
  181. package/dist/utils/scroll.d.ts +0 -34
  182. package/dist/utils/scroll.d.ts.map +0 -1
  183. package/dist/utils/scroll.js +0 -140
  184. package/dist/utils/settings.d.ts +0 -9
  185. package/dist/utils/settings.d.ts.map +0 -1
  186. package/dist/utils/settings.js +0 -14
  187. package/dist/utils/theme.d.ts.map +0 -1
  188. package/dist/utils/viewMode.d.ts +0 -14
  189. package/dist/utils/viewMode.d.ts.map +0 -1
  190. package/dist/utils/viewMode.js +0 -46
  191. /package/DS1/0-face/{2025-04-23-device.ts → device.ts} +0 -0
  192. /package/DS1/{utils → 0-face}/theme.ts +0 -0
  193. /package/DS1/{x Icon → x-icon}/1x.svg +0 -0
  194. /package/DS1/{x Icon → x-icon}/1xdots.svg +0 -0
  195. /package/DS1/{x Icon → x-icon}/1xgrid.svg +0 -0
  196. /package/DS1/{x Icon → x-icon}/1xlines.svg +0 -0
  197. /package/DS1/{x Icon → x-icon}/2x.svg +0 -0
  198. /package/DS1/{x Icon → x-icon}/2xdots.svg +0 -0
  199. /package/DS1/{x Icon → x-icon}/2xgrid.svg +0 -0
  200. /package/DS1/{x Icon → x-icon}/2xlines.svg +0 -0
  201. /package/DS1/{x Icon → x-icon}/big.svg +0 -0
  202. /package/DS1/{x Icon → x-icon}/blank.svg +0 -0
  203. /package/DS1/{x Icon → x-icon}/check.svg +0 -0
  204. /package/DS1/{x Icon → x-icon}/close.svg +0 -0
  205. /package/DS1/{x Icon → x-icon}/collapse.svg +0 -0
  206. /package/DS1/{x Icon → x-icon}/color.svg +0 -0
  207. /package/DS1/{x Icon → x-icon}/column.svg +0 -0
  208. /package/DS1/{x Icon → x-icon}/default.svg +0 -0
  209. /package/DS1/{x Icon → x-icon}/delete.svg +0 -0
  210. /package/DS1/{x Icon → x-icon}/do.svg +0 -0
  211. /package/DS1/{x Icon → x-icon}/down.svg +0 -0
  212. /package/DS1/{x Icon → x-icon}/duplicate.svg +0 -0
  213. /package/DS1/{x Icon → x-icon}/email.svg +0 -0
  214. /package/DS1/{x Icon → x-icon}/expand.svg +0 -0
  215. /package/DS1/{x Icon → x-icon}/gallery.svg +0 -0
  216. /package/DS1/{x Icon → x-icon}/group.svg +0 -0
  217. /package/DS1/{x Icon → x-icon}/head.svg +0 -0
  218. /package/DS1/{x Icon → x-icon}/icon.svg +0 -0
  219. /package/DS1/{x Icon → x-icon}/left.svg +0 -0
  220. /package/DS1/{x Icon → x-icon}/lock.svg +0 -0
  221. /package/DS1/{x Icon → x-icon}/mic.svg +0 -0
  222. /package/DS1/{x Icon → x-icon}/minimize.svg +0 -0
  223. /package/DS1/{x Icon → x-icon}/more.svg +0 -0
  224. /package/DS1/{x Icon → x-icon}/note.svg +0 -0
  225. /package/DS1/{x Icon → x-icon}/open.svg +0 -0
  226. /package/DS1/{x Icon → x-icon}/page.svg +0 -0
  227. /package/DS1/{x Icon → x-icon}/plus.svg +0 -0
  228. /package/DS1/{x Icon → x-icon}/rewind.svg +0 -0
  229. /package/DS1/{x Icon → x-icon}/right.svg +0 -0
  230. /package/DS1/{x Icon → x-icon}/row..svg +0 -0
  231. /package/DS1/{x Icon → x-icon}/search.svg +0 -0
  232. /package/DS1/{x Icon → x-icon}/see.svg +0 -0
  233. /package/DS1/{x Icon → x-icon}/star.svg +0 -0
  234. /package/DS1/{x Icon → x-icon}/title.svg +0 -0
  235. /package/DS1/{x Icon → x-icon}/undo.svg +0 -0
  236. /package/DS1/{x Icon → x-icon}/ungroup.svg +0 -0
  237. /package/DS1/{x Icon → x-icon}/unhead.svg +0 -0
  238. /package/DS1/{x Icon → x-icon}/unicon.svg +0 -0
  239. /package/DS1/{x Icon → x-icon}/unlock.svg +0 -0
  240. /package/DS1/{x Icon → x-icon}/unmic.svg +0 -0
  241. /package/DS1/{x Icon → x-icon}/unsee.svg +0 -0
  242. /package/DS1/{x Icon → x-icon}/unstar.svg +0 -0
  243. /package/DS1/{x Icon → x-icon}/untitle.svg +0 -0
  244. /package/DS1/{x Icon → x-icon}/up.svg +0 -0
  245. /package/dist/0-face/{2025-04-23-device.js → device.js} +0 -0
  246. /package/dist/{utils → 0-face}/theme.d.ts +0 -0
  247. /package/dist/{utils → 0-face}/theme.js +0 -0
@@ -1,66 +0,0 @@
1
- import { LitElement } from "lit";
2
- import "./ds-button";
3
- import "./icon-v1";
4
- export declare class Cycle extends LitElement {
5
- static get properties(): {
6
- type: {
7
- type: StringConstructor;
8
- };
9
- values: {
10
- type: ArrayConstructor;
11
- };
12
- label: {
13
- type: StringConstructor;
14
- };
15
- currentValue: {
16
- type: StringConstructor;
17
- state: boolean;
18
- };
19
- translationsReady: {
20
- type: BooleanConstructor;
21
- state: boolean;
22
- };
23
- disabled: {
24
- type: BooleanConstructor;
25
- state: boolean;
26
- };
27
- variant: {
28
- type: StringConstructor;
29
- };
30
- };
31
- static styles: import("lit").CSSResult;
32
- type: string;
33
- values: string[];
34
- label: string;
35
- currentValue: string;
36
- translationsReady: boolean;
37
- disabled: boolean;
38
- variant: string;
39
- private boundHandlers;
40
- constructor();
41
- connectedCallback(): void;
42
- initializeValues(): Promise<void>;
43
- ensureThemeInitialized(): void;
44
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
45
- setupInitialValue(): Promise<void>;
46
- handleSettingsChanges(): void;
47
- disconnectedCallback(): void;
48
- handleButtonClick(e: Event): void;
49
- getValueDisplay(value: string): string | any;
50
- getColorName(colorVar: string): string;
51
- getNotesStyleIcon(style: string): import("lit-html").TemplateResult<1>;
52
- getLabel(): string;
53
- render(): import("lit-html").TemplateResult<1>;
54
- private waitForTranslations;
55
- private handleTranslationsLoaded;
56
- private handleLanguageChanged;
57
- private handleThemeChanged;
58
- private handleAccentColorChanged;
59
- private handleNoteBehaviorChanged;
60
- }
61
- declare global {
62
- interface HTMLElementTagNameMap {
63
- "cycle-v1": Cycle;
64
- }
65
- }
66
- //# sourceMappingURL=cycle-v1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cycle-v1.d.ts","sourceRoot":"","sources":["../../DS1/2-core/cycle-v1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAY5C,OAAO,aAAa,CAAC;AACrB,OAAO,WAAW,CAAC;AAqCnB,qBAAa,KAAM,SAAQ,UAAU;IAEnC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;MAUpB;IAED,MAAM,CAAC,MAAM,0BAWX;IAIM,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,aAAa,CAOnB;;IAyBF,iBAAiB;IA6BX,gBAAgB;IAgFtB,sBAAsB;IAatB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IASnE,iBAAiB;IAuDvB,qBAAqB;IAKrB,oBAAoB;IA0BpB,iBAAiB,CAAC,CAAC,EAAE,KAAK;IAuJ1B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IA+C5C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBtC,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAe/B,QAAQ,IAAI,MAAM;IAgElB,MAAM;YAuCQ,mBAAmB;IAwBjC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,yBAAyB;CAGlC;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
@@ -1,586 +0,0 @@
1
- import { LitElement, html, css } from "lit";
2
- import { translate, currentLanguage, getAvailableLanguagesSync, getLanguageDisplayName, setLanguage, } from "../utils/language";
3
- import { currentTheme, setTheme } from "../utils/theme";
4
- import { saveSettings } from "../utils/settings";
5
- import "./ds-button";
6
- import "./icon-v1";
7
- // Accent color utilities
8
- const saveAccentColor = (color) => {
9
- localStorage.setItem("accentColor", color);
10
- };
11
- const getAccentColor = () => {
12
- return localStorage.getItem("accentColor") || "--blue"; // Default color if none set
13
- };
14
- const applyAccentColor = () => {
15
- const color = getAccentColor();
16
- document.documentElement.style.setProperty("--accent-color", `var(${color})`);
17
- };
18
- // Notes style medium utilities
19
- const saveNotesStyleMedium = (style) => {
20
- localStorage.setItem("notesStyleMedium", style);
21
- };
22
- const getNotesStyleMedium = () => {
23
- return localStorage.getItem("notesStyleMedium") || "note"; // Default to note
24
- };
25
- // Note behavior utilities
26
- const savePageStyle = (style) => {
27
- localStorage.setItem("pageStyle", style);
28
- };
29
- const getPageStyle = () => {
30
- return localStorage.getItem("pageStyle") || "note"; // Default to note
31
- };
32
- // App width utilities removed
33
- // Use a regular class with proper TypeScript type declarations and JSDoc comments
34
- export class Cycle extends LitElement {
35
- // Define reactive properties using Lit's property system
36
- static get properties() {
37
- return {
38
- type: { type: String },
39
- values: { type: Array },
40
- label: { type: String },
41
- currentValue: { type: String, state: true }, // Make this a private state property
42
- translationsReady: { type: Boolean, state: true }, // Track if translations are loaded
43
- disabled: { type: Boolean, state: true },
44
- variant: { type: String },
45
- };
46
- }
47
- constructor() {
48
- super();
49
- // Initialize properties with default values
50
- this.type = "";
51
- this.values = [];
52
- this.label = "";
53
- this.currentValue = "";
54
- this.translationsReady = false;
55
- this.disabled = false;
56
- this.variant = "";
57
- // Bind event handlers to this instance for proper cleanup
58
- this.boundHandlers = {
59
- translationsLoaded: this.handleTranslationsLoaded.bind(this),
60
- languageChanged: this.handleLanguageChanged.bind(this),
61
- handleLanguageChanged: this.handleLanguageChanged.bind(this),
62
- handleThemeChanged: this.handleThemeChanged.bind(this),
63
- handleAccentColorChanged: this.handleAccentColorChanged.bind(this),
64
- handleNoteBehaviorChanged: this.handleNoteBehaviorChanged.bind(this),
65
- };
66
- }
67
- connectedCallback() {
68
- super.connectedCallback();
69
- // Add event listeners
70
- window.addEventListener("translations-loaded", this.boundHandlers.translationsLoaded);
71
- window.addEventListener("language-changed", this.boundHandlers.languageChanged);
72
- window.addEventListener("theme-changed", this.boundHandlers.handleThemeChanged);
73
- window.addEventListener("accent-color-changed", this.boundHandlers.handleAccentColorChanged);
74
- window.addEventListener("page-style-changed", this.boundHandlers.handleNoteBehaviorChanged);
75
- // Initialize the component
76
- this.initializeValues();
77
- }
78
- async initializeValues() {
79
- if (this.type === "language") {
80
- // Dynamically get available languages from translation data
81
- const availableLanguages = getAvailableLanguagesSync();
82
- this.values = availableLanguages;
83
- this.currentValue = currentLanguage.value;
84
- // Set label
85
- this.label = this.getLabel();
86
- }
87
- else if (this.type === "theme") {
88
- // Set up theme cycling
89
- this.values = ["light", "dark"];
90
- // Set initial value based on current theme
91
- const currentThemeValue = currentTheme.get();
92
- this.currentValue = currentThemeValue;
93
- // Set label
94
- this.label = this.getLabel();
95
- }
96
- else if (this.type === "accent-color") {
97
- // Set up accent color cycling
98
- this.values = [
99
- "--light-green",
100
- "--green",
101
- "--light-blue",
102
- "--blue",
103
- "--pink",
104
- "--red",
105
- "--orange",
106
- "--yellow",
107
- ];
108
- // Set initial value based on current accent color
109
- const currentAccentColor = getAccentColor();
110
- this.currentValue = currentAccentColor;
111
- // Apply the accent color to ensure it's active
112
- applyAccentColor();
113
- // Set label
114
- this.label = this.getLabel();
115
- }
116
- else if (this.type === "notes-style-medium") {
117
- // Set up notes style medium cycling
118
- this.values = ["default", "big", "gallery"];
119
- // Set initial value based on current notes style medium
120
- const currentNotesStyle = getNotesStyleMedium();
121
- this.currentValue = currentNotesStyle;
122
- // Check if this should be disabled based on note behavior
123
- const currentPageStyle = getPageStyle();
124
- this.disabled = currentPageStyle === "note";
125
- // Set label
126
- this.label = this.getLabel();
127
- }
128
- else if (this.type === "page-style") {
129
- // Set up page style cycling
130
- this.values = ["note", "page"];
131
- // Set initial value based on current page style
132
- const currentPageStyle = getPageStyle();
133
- this.currentValue = currentPageStyle;
134
- // Set label
135
- this.label = this.getLabel();
136
- }
137
- else if (this.type === "icon-only") {
138
- // Set up icon-only cycling (no label)
139
- this.values = ["note", "page"];
140
- // Set initial value
141
- this.currentValue = this.values[0];
142
- // No label for icon-only type
143
- this.label = "";
144
- }
145
- // Request update to re-render with new values
146
- this.requestUpdate();
147
- }
148
- ensureThemeInitialized() {
149
- // Ensure theme is properly initialized
150
- const savedTheme = localStorage.getItem("theme");
151
- if (!savedTheme) {
152
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
153
- const defaultTheme = prefersDark ? "dark" : "light";
154
- localStorage.setItem("theme", defaultTheme);
155
- document.documentElement.classList.add(`${defaultTheme}-theme`);
156
- }
157
- }
158
- attributeChangedCallback(name, oldValue, newValue) {
159
- super.attributeChangedCallback(name, oldValue, newValue);
160
- if (name === "type" && oldValue !== newValue) {
161
- // Type changed, reinitialize values
162
- this.initializeValues();
163
- }
164
- }
165
- async setupInitialValue() {
166
- if (this.type === "language") {
167
- // Get current language
168
- const currentLang = currentLanguage.value;
169
- this.currentValue = currentLang;
170
- // Update label
171
- this.label = this.getLabel();
172
- }
173
- else if (this.type === "theme") {
174
- // Get current theme
175
- const currentThemeValue = currentTheme.get();
176
- this.currentValue = currentThemeValue;
177
- // Update label
178
- this.label = this.getLabel();
179
- }
180
- else if (this.type === "accent-color") {
181
- // Get current accent color
182
- const currentAccentColor = getAccentColor();
183
- this.currentValue = currentAccentColor;
184
- // Apply the accent color to ensure it's active
185
- applyAccentColor();
186
- // Update label
187
- this.label = this.getLabel();
188
- }
189
- else if (this.type === "notes-style-medium") {
190
- // Get current notes style medium
191
- const currentNotesStyle = getNotesStyleMedium();
192
- this.currentValue = currentNotesStyle;
193
- // Check if this should be disabled based on note behavior
194
- const currentPageStyle = getPageStyle();
195
- this.disabled = currentPageStyle === "note";
196
- // Update label
197
- this.label = this.getLabel();
198
- }
199
- else if (this.type === "page-style") {
200
- // Get current page style
201
- const currentPageStyle = getPageStyle();
202
- this.currentValue = currentPageStyle;
203
- // Update label
204
- this.label = this.getLabel();
205
- }
206
- else if (this.type === "icon-only") {
207
- // Get current page style for icon-only
208
- const currentPageStyle = getPageStyle();
209
- this.currentValue = currentPageStyle;
210
- // Update label
211
- this.label = "";
212
- }
213
- this.requestUpdate();
214
- }
215
- handleSettingsChanges() {
216
- // Handle any settings changes that might affect this component
217
- this.setupInitialValue();
218
- }
219
- disconnectedCallback() {
220
- super.disconnectedCallback();
221
- // Remove event listeners
222
- window.removeEventListener("translations-loaded", this.boundHandlers.translationsLoaded);
223
- window.removeEventListener("language-changed", this.boundHandlers.languageChanged);
224
- window.removeEventListener("theme-changed", this.boundHandlers.handleThemeChanged);
225
- window.removeEventListener("accent-color-changed", this.boundHandlers.handleAccentColorChanged);
226
- window.removeEventListener("page-style-changed", this.boundHandlers.handleNoteBehaviorChanged);
227
- }
228
- handleButtonClick(e) {
229
- e.preventDefault();
230
- e.stopPropagation();
231
- // Don't handle clicks if disabled
232
- if (this.disabled) {
233
- return;
234
- }
235
- if (this.type === "language") {
236
- // Cycle through available languages
237
- const currentIndex = this.values.indexOf(this.currentValue);
238
- const nextIndex = (currentIndex + 1) % this.values.length;
239
- const newLanguage = this.values[nextIndex];
240
- // Update current value
241
- this.currentValue = newLanguage;
242
- // Set the new language with view transition like Portfolio
243
- if (document.startViewTransition) {
244
- document.startViewTransition(() => {
245
- setLanguage(newLanguage);
246
- });
247
- }
248
- else {
249
- setLanguage(newLanguage);
250
- }
251
- // Save settings
252
- saveSettings({ language: newLanguage });
253
- // Dispatch language change event
254
- window.dispatchEvent(new CustomEvent("language-changed", {
255
- detail: { language: newLanguage },
256
- }));
257
- }
258
- else if (this.type === "theme") {
259
- // Cycle through themes
260
- const currentIndex = this.values.indexOf(this.currentValue);
261
- const nextIndex = (currentIndex + 1) % this.values.length;
262
- const newTheme = this.values[nextIndex];
263
- // Update current value
264
- this.currentValue = newTheme;
265
- // Set the new theme using the shared helper
266
- setTheme(newTheme);
267
- // Save settings
268
- saveSettings({ theme: newTheme });
269
- // Theme helper already emits the change event, so no manual dispatch here
270
- }
271
- else if (this.type === "accent-color") {
272
- // Cycle through accent colors
273
- const currentIndex = this.values.indexOf(this.currentValue);
274
- const nextIndex = (currentIndex + 1) % this.values.length;
275
- const newColor = this.values[nextIndex];
276
- // Update current value
277
- this.currentValue = newColor;
278
- // Save the new accent color
279
- saveAccentColor(newColor);
280
- // Apply the new accent color
281
- applyAccentColor();
282
- // Save settings
283
- saveSettings({ accentColor: newColor });
284
- // Dispatch accent color change event
285
- window.dispatchEvent(new CustomEvent("accent-color-changed", {
286
- detail: { color: newColor },
287
- }));
288
- }
289
- else if (this.type === "notes-style-medium") {
290
- // Cycle through notes style medium options
291
- const currentIndex = this.values.indexOf(this.currentValue);
292
- const nextIndex = (currentIndex + 1) % this.values.length;
293
- const newStyle = this.values[nextIndex];
294
- // Update current value
295
- this.currentValue = newStyle;
296
- // Save the new notes style medium
297
- saveNotesStyleMedium(newStyle);
298
- // Save settings
299
- saveSettings({ notesStyleMedium: newStyle });
300
- // Dispatch notes style medium change event
301
- window.dispatchEvent(new CustomEvent("notes-style-medium-changed", {
302
- detail: { style: newStyle },
303
- }));
304
- }
305
- else if (this.type === "page-style") {
306
- // Cycle through note behavior options
307
- const currentIndex = this.values.indexOf(this.currentValue);
308
- const nextIndex = (currentIndex + 1) % this.values.length;
309
- const newBehavior = this.values[nextIndex];
310
- // Update current value
311
- this.currentValue = newBehavior;
312
- // Save the new note behavior
313
- savePageStyle(newBehavior);
314
- // Save settings
315
- saveSettings({ pageStyle: newBehavior });
316
- // Dispatch note behavior change event
317
- window.dispatchEvent(new CustomEvent("page-style-changed", {
318
- detail: { behavior: newBehavior },
319
- }));
320
- }
321
- else if (this.type === "icon-only") {
322
- // Cycle through icon-only options (note/page)
323
- const currentIndex = this.values.indexOf(this.currentValue);
324
- const nextIndex = (currentIndex + 1) % this.values.length;
325
- const newIconOnlyValue = this.values[nextIndex];
326
- // Update current value
327
- this.currentValue = newIconOnlyValue;
328
- // Save the new page style
329
- savePageStyle(newIconOnlyValue);
330
- // Save settings
331
- saveSettings({ pageStyle: newIconOnlyValue });
332
- // No label update for icon-only type
333
- this.label = "";
334
- // Dispatch page style change event
335
- window.dispatchEvent(new CustomEvent("page-style-changed", {
336
- detail: { behavior: newIconOnlyValue },
337
- }));
338
- }
339
- // Update label
340
- this.label = this.getLabel();
341
- // Request update to re-render
342
- this.requestUpdate();
343
- }
344
- getValueDisplay(value) {
345
- if (this.type === "language") {
346
- return getLanguageDisplayName(value, {
347
- locale: currentLanguage.value,
348
- });
349
- }
350
- else if (this.type === "theme") {
351
- // Try to get translated theme name
352
- if (this.translationsReady) {
353
- const translatedName = translate(`themes.${value}`);
354
- if (translatedName && translatedName !== `themes.${value}`) {
355
- return translatedName;
356
- }
357
- }
358
- // Fall back to the theme value itself
359
- return value;
360
- }
361
- else if (this.type === "accent-color") {
362
- // Get color name from CSS variable
363
- return this.getColorName(value);
364
- }
365
- else if (this.type === "notes-style-medium") {
366
- // Return SVG icon for notes style medium
367
- return this.getNotesStyleIcon(value);
368
- }
369
- else if (this.type === "page-style") {
370
- // Return translated text for note behavior
371
- if (this.translationsReady) {
372
- const translatedText = translate(value === "note" ? "note" : "page");
373
- if (translatedText &&
374
- translatedText !== (value === "note" ? "note" : "page")) {
375
- return translatedText;
376
- }
377
- }
378
- return value;
379
- }
380
- else if (this.type === "icon-only") {
381
- // Return SVG icon for icon-only type (note/page icons)
382
- if (value === "note") {
383
- return html `<icon-v1 type="note"></icon-v1>`;
384
- }
385
- else if (value === "page") {
386
- return html `<icon-v1 type="page"></icon-v1>`;
387
- }
388
- return html `<span>${value}</span>`;
389
- }
390
- return value;
391
- }
392
- getColorName(colorVar) {
393
- // Map CSS variables to language keys
394
- const colorMap = {
395
- "--red": "red",
396
- "--orange": "orange",
397
- "--yellow": "yellow",
398
- "--light-green": "lightGreen",
399
- "--green": "green",
400
- "--light-blue": "lightBlue",
401
- "--blue": "blue",
402
- "--pink": "pink",
403
- };
404
- const languageKey = colorMap[colorVar];
405
- if (languageKey && this.translationsReady) {
406
- const translatedName = translate(languageKey);
407
- if (translatedName && translatedName !== languageKey) {
408
- return translatedName;
409
- }
410
- }
411
- // Fallback to simple name conversion
412
- return colorVar.replace("--", "").replace("-", " ");
413
- }
414
- getNotesStyleIcon(style) {
415
- if (style === "page") {
416
- return html `<icon-v1 type="page"></icon-v1>`;
417
- }
418
- else if (style === "note") {
419
- return html `<icon-v1 type="note"></icon-v1>`;
420
- }
421
- else if (style === "default") {
422
- return html `<icon-v1 type="default"></icon-v1>`;
423
- }
424
- else if (style === "big") {
425
- return html `<icon-v1 type="big"></icon-v1>`;
426
- }
427
- else if (style === "gallery") {
428
- return html `<icon-v1 type="gallery"></icon-v1>`;
429
- }
430
- return html `<span>${style}</span>`;
431
- }
432
- getLabel() {
433
- if (this.type === "language") {
434
- // Try to get translated label
435
- if (this.translationsReady) {
436
- const translatedLabel = translate("language");
437
- if (translatedLabel && translatedLabel !== "language") {
438
- return translatedLabel;
439
- }
440
- }
441
- // Fall back to English
442
- return "Language";
443
- }
444
- else if (this.type === "theme") {
445
- // Try to get translated label
446
- if (this.translationsReady) {
447
- const translatedLabel = translate("theme");
448
- if (translatedLabel && translatedLabel !== "theme") {
449
- return translatedLabel;
450
- }
451
- }
452
- // Fall back to English
453
- return "Theme";
454
- }
455
- else if (this.type === "accent-color") {
456
- // Try to get translated label
457
- if (this.translationsReady) {
458
- const translatedLabel = translate("accentColor");
459
- if (translatedLabel && translatedLabel !== "accentColor") {
460
- return translatedLabel;
461
- }
462
- }
463
- // Fall back to English
464
- return "Accent Color";
465
- }
466
- else if (this.type === "notes-style-medium") {
467
- // Try to get translated label
468
- if (this.translationsReady) {
469
- const translatedLabel = translate("notesStyle");
470
- if (translatedLabel && translatedLabel !== "notesStyle") {
471
- return translatedLabel;
472
- }
473
- }
474
- // Fall back to English
475
- return "Notes Style";
476
- }
477
- else if (this.type === "page-style") {
478
- // Try to get translated label
479
- if (this.translationsReady) {
480
- const translatedLabel = translate("clickingItem");
481
- if (translatedLabel && translatedLabel !== "clickingItem") {
482
- return translatedLabel;
483
- }
484
- }
485
- // Fall back to English
486
- return "Clic";
487
- }
488
- else if (this.type === "icon-only") {
489
- // No label for icon-only type
490
- return "";
491
- }
492
- return this.label;
493
- }
494
- render() {
495
- return html `
496
- <div class="cycle-container">
497
- ${this.type !== "icon-only"
498
- ? html `<span class="cycle-label">${this.label}</span>`
499
- : ""}
500
- <div
501
- style="display: flex; align-items: center; ${this.type === "icon-only"
502
- ? "justify-content: center;"
503
- : ""}"
504
- >
505
- <ds-button
506
- variant=${this.variant ||
507
- (this.type === "language" || this.type === "theme"
508
- ? "secondary"
509
- : "primary")}
510
- ?disabled=${this.disabled}
511
- @click=${this.handleButtonClick}
512
- >
513
- ${this.type === "notes-style-medium" || this.type === "icon-only"
514
- ? html `<span
515
- style="display: inline-flex; align-items: center; gap: var(--025)"
516
- >${this.getValueDisplay(this.currentValue)}</span
517
- >`
518
- : html `<span>${this.getValueDisplay(this.currentValue)}</span>`}
519
- </ds-button>
520
- ${this.type === "accent-color"
521
- ? html `
522
- <div
523
- class="color-preview"
524
- style="background-color: var(${this.currentValue})"
525
- ></div>
526
- `
527
- : ""}
528
- </div>
529
- </div>
530
- `;
531
- }
532
- async waitForTranslations() {
533
- return new Promise((resolve) => {
534
- if (this.translationsReady) {
535
- resolve();
536
- return;
537
- }
538
- const handleTranslationsLoaded = () => {
539
- this.translationsReady = true;
540
- resolve();
541
- };
542
- window.addEventListener("translations-loaded", handleTranslationsLoaded, {
543
- once: true,
544
- });
545
- // Timeout after 5 seconds
546
- setTimeout(() => {
547
- this.translationsReady = true;
548
- resolve();
549
- }, 5000);
550
- });
551
- }
552
- handleTranslationsLoaded() {
553
- this.translationsReady = true;
554
- // Refresh language values if this is a language cycle
555
- if (this.type === "language") {
556
- const availableLanguages = getAvailableLanguagesSync();
557
- this.values = availableLanguages;
558
- }
559
- this.setupInitialValue();
560
- }
561
- handleLanguageChanged() {
562
- this.setupInitialValue();
563
- }
564
- handleThemeChanged() {
565
- this.setupInitialValue();
566
- }
567
- handleAccentColorChanged() {
568
- this.setupInitialValue();
569
- }
570
- handleNoteBehaviorChanged() {
571
- this.setupInitialValue();
572
- }
573
- }
574
- Cycle.styles = css `
575
- .cycle-container {
576
- display: flex;
577
- justify-content: space-between;
578
- gap: var(--025);
579
- width: 100%;
580
- }
581
-
582
- .cycle-label {
583
- color: var(--text-color-primary);
584
- }
585
- `;
586
- customElements.define("cycle-v1", Cycle);