@dxtmisha/wiki 0.24.3 → 0.25.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 (230) hide show
  1. package/package.json +7 -7
  2. package/src/classes/WikiStorybookItem.ts +24 -0
  3. package/src/media/descriptions/wikiDescriptions.ts +28 -0
  4. package/src/media/descriptions/wikiDescriptionsAccordion.ts +158 -0
  5. package/src/media/descriptions/wikiDescriptionsActionSheet.ts +211 -0
  6. package/src/media/descriptions/wikiDescriptionsActions.ts +161 -0
  7. package/src/media/descriptions/wikiDescriptionsAnchor.ts +42 -0
  8. package/src/media/descriptions/wikiDescriptionsArrow.ts +181 -0
  9. package/src/media/descriptions/wikiDescriptionsBlock.ts +97 -0
  10. package/src/media/descriptions/wikiDescriptionsButton.ts +0 -1
  11. package/src/media/descriptions/wikiDescriptionsCell.ts +2 -1
  12. package/src/media/descriptions/wikiDescriptionsChipGroup.ts +168 -0
  13. package/src/media/descriptions/wikiDescriptionsDialog.ts +182 -0
  14. package/src/media/descriptions/wikiDescriptionsField.ts +2 -0
  15. package/src/media/descriptions/wikiDescriptionsImage.ts +41 -6
  16. package/src/media/descriptions/wikiDescriptionsInput.ts +257 -0
  17. package/src/media/descriptions/wikiDescriptionsMenu.ts +123 -0
  18. package/src/media/descriptions/wikiDescriptionsModal.ts +145 -0
  19. package/src/media/descriptions/wikiDescriptionsMotionTransform.ts +2 -6
  20. package/src/media/descriptions/wikiDescriptionsSelect.ts +209 -0
  21. package/src/media/descriptions/wikiDescriptionsSelectValue.ts +78 -0
  22. package/src/media/descriptions/wikiDescriptionsTextareaAutosize.ts +50 -0
  23. package/src/media/descriptions/wikiDescriptionsTooltip.ts +89 -0
  24. package/src/media/functional/en/conversions.mdx +67 -0
  25. package/src/media/functional/en/dataUtils.mdx +25 -0
  26. package/src/media/functional/en/datetimeRef.mdx +1 -1
  27. package/src/media/functional/en/eventRef.mdx +1 -1
  28. package/src/media/functional/en/executionUtils.mdx +58 -0
  29. package/src/media/functional/en/geoFlagRef.mdx +1 -1
  30. package/src/media/functional/en/geoIntlRef.mdx +1 -1
  31. package/src/media/functional/en/geoRef.mdx +2 -2
  32. package/src/media/functional/en/meta.mdx +1206 -0
  33. package/src/media/functional/en/metaManager.mdx +376 -0
  34. package/src/media/functional/en/metaOg.mdx +694 -0
  35. package/src/media/functional/en/metaTwitter.mdx +853 -0
  36. package/src/media/functional/en/reactive.mdx +40 -0
  37. package/src/media/functional/en/refTypes.mdx +1 -1
  38. package/src/media/functional/en/useApiRef.mdx +5 -5
  39. package/src/media/functional/en/useMeta.mdx +431 -0
  40. package/src/media/functional/en/validationUtils.mdx +11 -0
  41. package/src/media/functional/ru/conversions.mdx +67 -0
  42. package/src/media/functional/ru/dataUtils.mdx +25 -0
  43. package/src/media/functional/ru/datetimeRef.mdx +2 -2
  44. package/src/media/functional/ru/eventRef.mdx +1 -1
  45. package/src/media/functional/ru/executionUtils.mdx +58 -0
  46. package/src/media/functional/ru/geoFlagRef.mdx +1 -1
  47. package/src/media/functional/ru/geoIntl.mdx +2 -2
  48. package/src/media/functional/ru/geoIntlRef.mdx +1 -1
  49. package/src/media/functional/ru/geoRef.mdx +2 -2
  50. package/src/media/functional/ru/listTypes.mdx +1 -1
  51. package/src/media/functional/ru/meta.mdx +1330 -0
  52. package/src/media/functional/ru/metaManager.mdx +376 -0
  53. package/src/media/functional/ru/metaOg.mdx +694 -0
  54. package/src/media/functional/ru/metaTwitter.mdx +853 -0
  55. package/src/media/functional/ru/reactive.mdx +40 -0
  56. package/src/media/functional/ru/refTypes.mdx +2 -2
  57. package/src/media/functional/ru/useApiRef.mdx +5 -5
  58. package/src/media/functional/ru/useMeta.mdx +431 -0
  59. package/src/media/functional/ru/validationUtils.mdx +11 -0
  60. package/src/media/mdx/Accordion/accordion.en.mdx +59 -0
  61. package/src/media/mdx/Accordion/accordion.ru.mdx +59 -0
  62. package/src/media/mdx/Accordion/slots.en.mdx +6 -0
  63. package/src/media/mdx/Accordion/slots.ru.mdx +6 -0
  64. package/src/media/mdx/Accordion/wikiMdxAccordion.ts +25 -0
  65. package/src/media/mdx/ActionSheet/actionSheet.en.mdx +61 -0
  66. package/src/media/mdx/ActionSheet/actionSheet.ru.mdx +61 -0
  67. package/src/media/mdx/ActionSheet/touchClose.en.mdx +21 -0
  68. package/src/media/mdx/ActionSheet/touchClose.ru.mdx +21 -0
  69. package/src/media/mdx/ActionSheet/wikiMdxActionSheet.ts +25 -0
  70. package/src/media/mdx/Actions/actions.en.mdx +48 -0
  71. package/src/media/mdx/Actions/actions.ru.mdx +48 -0
  72. package/src/media/mdx/Actions/flexible.en.mdx +19 -0
  73. package/src/media/mdx/Actions/flexible.ru.mdx +19 -0
  74. package/src/media/mdx/Actions/list.en.mdx +50 -0
  75. package/src/media/mdx/Actions/list.ru.mdx +50 -0
  76. package/src/media/mdx/Actions/wikiMdxActions.ts +31 -0
  77. package/src/media/mdx/Anchor/anchor.en.mdx +34 -0
  78. package/src/media/mdx/Anchor/anchor.ru.mdx +34 -0
  79. package/src/media/mdx/Anchor/expose.go.en.mdx +6 -0
  80. package/src/media/mdx/Anchor/expose.go.ru.mdx +6 -0
  81. package/src/media/mdx/Anchor/hide.en.mdx +28 -0
  82. package/src/media/mdx/Anchor/hide.ru.mdx +28 -0
  83. package/src/media/mdx/Anchor/isCopy.en.mdx +23 -0
  84. package/src/media/mdx/Anchor/isCopy.ru.mdx +23 -0
  85. package/src/media/mdx/Anchor/scroll.en.mdx +34 -0
  86. package/src/media/mdx/Anchor/scroll.ru.mdx +35 -0
  87. package/src/media/mdx/Anchor/wikiMdxAnchor.ts +43 -0
  88. package/src/media/mdx/Arrow/arrow.en.mdx +33 -0
  89. package/src/media/mdx/Arrow/arrow.ru.mdx +33 -0
  90. package/src/media/mdx/Arrow/wikiMdxArrow.ts +19 -0
  91. package/src/media/mdx/Block/block.en.mdx +42 -0
  92. package/src/media/mdx/Block/block.ru.mdx +42 -0
  93. package/src/media/mdx/Block/wikiMdxBlock.ts +19 -0
  94. package/src/media/mdx/ChipGroup/chipGroup.en.mdx +51 -0
  95. package/src/media/mdx/ChipGroup/chipGroup.ru.mdx +51 -0
  96. package/src/media/mdx/ChipGroup/selected.en.mdx +50 -0
  97. package/src/media/mdx/ChipGroup/selected.ru.mdx +50 -0
  98. package/src/media/mdx/ChipGroup/wikiMdxChipGroup.ts +25 -0
  99. package/src/media/mdx/Dialog/buttons.en.mdx +45 -0
  100. package/src/media/mdx/Dialog/buttons.ru.mdx +45 -0
  101. package/src/media/mdx/Dialog/dialog.en.mdx +66 -0
  102. package/src/media/mdx/Dialog/dialog.ru.mdx +65 -0
  103. package/src/media/mdx/Dialog/events.en.mdx +63 -0
  104. package/src/media/mdx/Dialog/events.ru.mdx +63 -0
  105. package/src/media/mdx/Dialog/states.en.mdx +58 -0
  106. package/src/media/mdx/Dialog/states.ru.mdx +57 -0
  107. package/src/media/mdx/Dialog/wikiMdxDialog.ts +37 -0
  108. package/src/media/mdx/Field/arrows.en.mdx +22 -6
  109. package/src/media/mdx/Field/arrows.ru.mdx +22 -6
  110. package/src/media/mdx/Field/slots.en.mdx +0 -13
  111. package/src/media/mdx/Field/slots.ru.mdx +0 -13
  112. package/src/media/mdx/Image/img-tag.en.mdx +105 -0
  113. package/src/media/mdx/Image/img-tag.ru.mdx +105 -0
  114. package/src/media/mdx/Image/wikiMdxImage.ts +6 -0
  115. package/src/media/mdx/Input/currency.en.mdx +38 -0
  116. package/src/media/mdx/Input/currency.ru.mdx +38 -0
  117. package/src/media/mdx/Input/date.en.mdx +53 -0
  118. package/src/media/mdx/Input/date.ru.mdx +53 -0
  119. package/src/media/mdx/Input/input.en.mdx +143 -0
  120. package/src/media/mdx/Input/input.ru.mdx +71 -0
  121. package/src/media/mdx/Input/mask.en.mdx +30 -0
  122. package/src/media/mdx/Input/mask.ru.mdx +30 -0
  123. package/src/media/mdx/Input/number.en.mdx +41 -0
  124. package/src/media/mdx/Input/number.ru.mdx +41 -0
  125. package/src/media/mdx/Input/type.en.mdx +26 -0
  126. package/src/media/mdx/Input/type.ru.mdx +26 -0
  127. package/src/media/mdx/Input/wikiMdxInput.ts +49 -0
  128. package/src/media/mdx/Menu/event.updateValue.en.mdx +29 -0
  129. package/src/media/mdx/Menu/event.updateValue.ru.mdx +30 -0
  130. package/src/media/mdx/Menu/expose.navigation.en.mdx +12 -0
  131. package/src/media/mdx/Menu/expose.navigation.ru.mdx +12 -0
  132. package/src/media/mdx/Menu/navigation.en.mdx +56 -0
  133. package/src/media/mdx/Menu/navigation.ru.mdx +56 -0
  134. package/src/media/mdx/Menu/slots.control.en.mdx +65 -0
  135. package/src/media/mdx/Menu/slots.control.ru.mdx +65 -0
  136. package/src/media/mdx/Menu/slots.en.mdx +2 -24
  137. package/src/media/mdx/Menu/slots.ru.mdx +2 -24
  138. package/src/media/mdx/Menu/wikiMdxMenu.ts +27 -3
  139. package/src/media/mdx/Modal/differences.en.mdx +130 -0
  140. package/src/media/mdx/Modal/differences.ru.mdx +65 -0
  141. package/src/media/mdx/Modal/modal.en.mdx +63 -0
  142. package/src/media/mdx/Modal/modal.ru.mdx +63 -0
  143. package/src/media/mdx/Modal/wikiMdxModal.ts +25 -0
  144. package/src/media/mdx/MotionTransform/expose.motionTransformElement.en.mdx +13 -0
  145. package/src/media/mdx/MotionTransform/expose.motionTransformElement.ru.mdx +14 -0
  146. package/src/media/mdx/MotionTransform/wikiMdxMotionTransform.ts +6 -0
  147. package/src/media/mdx/Select/select.en.mdx +69 -0
  148. package/src/media/mdx/Select/select.ru.mdx +69 -0
  149. package/src/media/mdx/Select/wikiMdxSelect.ts +19 -0
  150. package/src/media/mdx/SelectValue/selectValue.en.mdx +64 -0
  151. package/src/media/mdx/SelectValue/selectValue.ru.mdx +64 -0
  152. package/src/media/mdx/SelectValue/wikiMdxSelectValue.ts +19 -0
  153. package/src/media/mdx/TextareaAutosize/textarea-autosize.en.mdx +65 -0
  154. package/src/media/mdx/TextareaAutosize/textarea-autosize.ru.mdx +65 -0
  155. package/src/media/mdx/TextareaAutosize/wikiMdxTextareaAutosize.ts +19 -0
  156. package/src/media/mdx/Tooltip/event.tooltip.en.mdx +7 -0
  157. package/src/media/mdx/Tooltip/event.tooltip.ru.mdx +8 -0
  158. package/src/media/mdx/Tooltip/slot.control.en.mdx +14 -0
  159. package/src/media/mdx/Tooltip/slot.control.ru.mdx +14 -0
  160. package/src/media/mdx/Tooltip/tooltip.en.mdx +34 -0
  161. package/src/media/mdx/Tooltip/tooltip.ru.mdx +34 -0
  162. package/src/media/mdx/Tooltip/wikiMdxTooltip.ts +31 -0
  163. package/src/media/mdx/Window/classes.ru.mdx +1 -1
  164. package/src/media/mdx/event/events.actions.en.mdx +44 -0
  165. package/src/media/mdx/event/events.actions.ru.mdx +44 -0
  166. package/src/media/mdx/event/events.inputStandard.en.mdx +6 -0
  167. package/src/media/mdx/event/events.inputStandard.ru.mdx +6 -0
  168. package/src/media/mdx/event/wikiMdxEvent.ts +20 -8
  169. package/src/media/mdx/expose/expose.descriptionId.en.mdx +6 -0
  170. package/src/media/mdx/expose/expose.descriptionId.ru.mdx +6 -0
  171. package/src/media/mdx/expose/expose.id.en.mdx +6 -0
  172. package/src/media/mdx/expose/expose.id.ru.mdx +6 -0
  173. package/src/media/mdx/expose/expose.labelId.en.mdx +6 -0
  174. package/src/media/mdx/expose/expose.labelId.ru.mdx +6 -0
  175. package/src/media/mdx/expose/wikiMdxExpose.ts +18 -0
  176. package/src/media/mdx/slot/body.en.mdx +6 -0
  177. package/src/media/mdx/slot/body.ru.mdx +6 -0
  178. package/src/media/mdx/slot/headline.en.mdx +7 -0
  179. package/src/media/mdx/slot/headline.ru.mdx +6 -0
  180. package/src/media/mdx/slot/leading.en.mdx +7 -0
  181. package/src/media/mdx/slot/leading.ru.mdx +7 -0
  182. package/src/media/mdx/slot/secondary.en.mdx +5 -0
  183. package/src/media/mdx/slot/secondary.ru.mdx +5 -0
  184. package/src/media/mdx/slot/trailing.en.mdx +7 -0
  185. package/src/media/mdx/slot/trailing.ru.mdx +7 -0
  186. package/src/media/mdx/slot/wikiMdxSlot.ts +30 -0
  187. package/src/media/mdx/style/isSkeleton.en.mdx +2 -2
  188. package/src/media/mdx/style/isSkeleton.ru.mdx +2 -2
  189. package/src/media/mdx/value/v-model-selected.en.mdx +28 -0
  190. package/src/media/mdx/value/v-model-selected.ru.mdx +28 -0
  191. package/src/media/mdx/value/v-model.en.mdx +26 -0
  192. package/src/media/mdx/value/v-model.ru.mdx +26 -0
  193. package/src/media/mdx/value/wikiMdxValue.ts +24 -3
  194. package/src/media/mdx/wikiMdx.ts +29 -1
  195. package/src/media/props/wiki.ts +42 -0
  196. package/src/media/props/wikiActions.ts +43 -0
  197. package/src/media/props/wikiActionsInclude.ts +62 -0
  198. package/src/media/props/wikiAnchor.ts +84 -0
  199. package/src/media/props/wikiAria.ts +102 -0
  200. package/src/media/props/wikiArrow.ts +24 -0
  201. package/src/media/props/wikiArrowInclude.ts +45 -0
  202. package/src/media/props/wikiBarsInclude.ts +80 -0
  203. package/src/media/props/wikiChipGroup.ts +39 -0
  204. package/src/media/props/wikiDialog.ts +34 -0
  205. package/src/media/props/wikiField.ts +0 -21
  206. package/src/media/props/wikiFieldCounterInclude.ts +78 -0
  207. package/src/media/props/wikiForm.ts +248 -0
  208. package/src/media/props/wikiHook.ts +20 -0
  209. package/src/media/props/wikiIcon.ts +3 -3
  210. package/src/media/props/wikiIconInclude.ts +319 -0
  211. package/src/media/props/wikiImage.ts +71 -19
  212. package/src/media/props/wikiInformation.ts +160 -0
  213. package/src/media/props/wikiInput.ts +34 -0
  214. package/src/media/props/wikiListItem.ts +20 -0
  215. package/src/media/props/wikiMask.ts +0 -10
  216. package/src/media/props/wikiMaskInclude.ts +54 -0
  217. package/src/media/props/wikiMenu.ts +0 -10
  218. package/src/media/props/wikiMotionTransform.ts +0 -10
  219. package/src/media/props/wikiOption.ts +113 -0
  220. package/src/media/props/wikiSelect.ts +68 -0
  221. package/src/media/props/wikiSelectValue.ts +30 -0
  222. package/src/media/props/wikiStatus.ts +29 -41
  223. package/src/media/props/wikiStyle.ts +154 -243
  224. package/src/media/props/wikiTechnical.ts +65 -0
  225. package/src/media/props/wikiText.ts +57 -0
  226. package/src/media/props/wikiTooltip.ts +53 -0
  227. package/src/media/props/wikiValue.ts +14 -203
  228. package/src/media/props/wikiWindow.ts +0 -31
  229. package/src/styles/storybookStyle.scss +3 -1
  230. package/src/types/storybookTypes.ts +26 -4
@@ -0,0 +1,376 @@
1
+ import {Meta} from '@storybook/addon-docs/blocks'
2
+
3
+ <Meta title='@dxtmisha/functional/en/Classes/MetaManager'/>
4
+
5
+ # MetaManager Class
6
+
7
+ A class for working with HTML meta tags with automatic DOM synchronization and safe attribute encoding. Provides reading, updating, and generating meta tags for SEO optimization and social media integration (Open Graph, Twitter Cards).
8
+
9
+ ## Key Features
10
+
11
+ - **DOM Synchronization** — automatic meta tag updates in document head
12
+ - **Dual Format Support** — works with both `name` and `property` attributes
13
+ - **HTML Generation** — converts meta tags to HTML strings for server-side rendering
14
+ - **Safe Encoding** — automatic escaping of special characters in attributes
15
+ - **Type Safety** — TypeScript support with generics for type definitions
16
+ - **Flexible API** — chainable methods for convenient usage
17
+ - **SSR Compatible** — works in both browser and server environments
18
+ - **Auto-initialization** — reads existing meta tags from DOM on construction
19
+
20
+ ## Constructor
21
+
22
+ ### `constructor`
23
+
24
+ Creates a MetaManager instance with specified parameters and automatically reads current meta tags from DOM.
25
+
26
+ **Parameters:**
27
+ - `listMeta: string[]` — list of meta tag names to manage
28
+ - `isProperty?: boolean` — use `property` attribute instead of `name` (default: `false`)
29
+
30
+ ```javascript
31
+ import { MetaManager } from '@dxtmisha/functional'
32
+
33
+ // Standard meta tags (name attribute)
34
+ const meta = new MetaManager([
35
+ 'description',
36
+ 'keywords',
37
+ 'author'
38
+ ])
39
+
40
+ // Open Graph meta tags (property attribute)
41
+ const ogMeta = new MetaManager([
42
+ 'og:title',
43
+ 'og:description',
44
+ 'og:image',
45
+ 'og:url'
46
+ ], true)
47
+
48
+ // Twitter Cards
49
+ const twitterMeta = new MetaManager([
50
+ 'twitter:card',
51
+ 'twitter:title',
52
+ 'twitter:description',
53
+ 'twitter:image'
54
+ ])
55
+ ```
56
+
57
+ ## Data Query Methods
58
+
59
+ ### `getListMeta`
60
+
61
+ Returns the list of meta tag names being managed.
62
+
63
+ **Returns:** `string[]` — array of meta tag names
64
+
65
+ ```javascript
66
+ const meta = new MetaManager(['description', 'keywords', 'author'])
67
+
68
+ const names = meta.getListMeta()
69
+ // ['description', 'keywords', 'author']
70
+
71
+ // Check if tag is managed
72
+ const isManaged = names.includes('description') // true
73
+
74
+ // Iterate managed tags
75
+ names.forEach(name => {
76
+ console.log(`Managing: ${name}`)
77
+ })
78
+ ```
79
+
80
+ ### `getItem`
81
+
82
+ Gets the content of a meta tag by name from internal storage.
83
+
84
+ **Parameters:**
85
+ - `name: string` — meta tag name
86
+
87
+ **Returns:** `string` — meta tag content (empty string if not set)
88
+
89
+ ```javascript
90
+ const meta = new MetaManager(['description', 'keywords', 'author'])
91
+
92
+ // Get meta description
93
+ const description = meta.get('description')
94
+
95
+ // Get keywords
96
+ const keywords = meta.get('keywords')
97
+
98
+ // Non-existent tag returns empty string
99
+ const missing = meta.get('non-existent') // ''
100
+
101
+ // Use in conditions
102
+ if (meta.get('description')) {
103
+ console.log('Description is set')
104
+ }
105
+ ```
106
+
107
+ ### `getItems`
108
+
109
+ Returns all meta tags as an object.
110
+
111
+ **Returns:** `Record<string, string | undefined>` — object with all meta tags
112
+
113
+ ```javascript
114
+ const meta = new MetaManager(['description', 'keywords', 'author'])
115
+
116
+ const allMeta = meta.getItems()
117
+ // { description: '...', keywords: '...', author: '...' }
118
+
119
+ // Check all meta tags
120
+ Object.keys(allMeta).forEach(key => {
121
+ console.log(`${key}: ${allMeta[key]}`)
122
+ })
123
+
124
+ // Use in validation
125
+ const hasAllTags = Object.values(allMeta).every(value => value !== '')
126
+
127
+ // Export for logging
128
+ console.log('Current meta state:', allMeta)
129
+ ```
130
+
131
+ ## Data Management Methods
132
+
133
+ ### `set`
134
+
135
+ Sets the content of a meta tag in internal storage and updates or creates the corresponding meta element in DOM.
136
+
137
+ **Parameters:**
138
+ - `name: string` — meta tag name
139
+ - `content: string` — meta tag content
140
+
141
+ **Returns:** `this` — for method chaining
142
+
143
+ ```javascript
144
+ const meta = new MetaManager(['description', 'keywords', 'author'])
145
+
146
+ // Set single meta tag
147
+ meta.set('description', 'Website description')
148
+
149
+ // Chain multiple updates
150
+ meta
151
+ .set('description', 'My awesome website')
152
+ .set('keywords', 'web, development, javascript')
153
+ .set('author', 'John Doe')
154
+
155
+ // Dynamic update
156
+ const updateSEO = (pageData) => {
157
+ meta
158
+ .set('description', pageData.description)
159
+ .set('keywords', pageData.keywords)
160
+ }
161
+
162
+ // Remove meta tag
163
+ meta.set('temporary', '')
164
+ ```
165
+
166
+ ### `setByList`
167
+
168
+ Sets multiple meta tags from an object.
169
+
170
+ **Parameters:**
171
+ - `metaList: Record<string, string | undefined>` — object with meta tag names and content
172
+
173
+ **Returns:** `this` — for method chaining
174
+
175
+ ```javascript
176
+ const meta = new MetaManager(['description', 'keywords', 'author'])
177
+
178
+ // Set multiple tags at once
179
+ meta.setByList({
180
+ description: 'My awesome website',
181
+ keywords: 'web, development, javascript',
182
+ author: 'John Doe'
183
+ })
184
+
185
+ // Dynamic page updates
186
+ const updatePageMeta = (page) => {
187
+ meta.setByList(page.meta)
188
+ }
189
+
190
+ // From API response
191
+ fetch('/api/page-meta')
192
+ .then(res => res.json())
193
+ .then(data => meta.setByList(data))
194
+
195
+ // Partial updates
196
+ meta.setByList({
197
+ description: 'Updated description'
198
+ // Other tags remain unchanged
199
+ })
200
+ ```
201
+
202
+ ### `html`
203
+
204
+ Returns all meta tags as an HTML string with safe attribute encoding. Useful for server-side rendering.
205
+
206
+ **Returns:** `string` — HTML string with meta tags
207
+
208
+ ```javascript
209
+ const meta = new MetaManager(['description', 'keywords', 'author'])
210
+
211
+ meta.setByList({
212
+ description: 'My website with "quotes" & special chars',
213
+ keywords: 'web, javascript',
214
+ author: 'John Doe'
215
+ })
216
+
217
+ const htmlString = meta.html()
218
+ // <meta name="description" content="My website with &quot;quotes&quot; &amp; special chars">
219
+ // <meta name="keywords" content="web, javascript">
220
+ // <meta name="author" content="John Doe">
221
+
222
+ // Use in SSR templates
223
+ const htmlTemplate = `
224
+ <!DOCTYPE html>
225
+ <html>
226
+ <head>
227
+ ${meta.html()}
228
+ <title>Page Title</title>
229
+ </head>
230
+ <body>...</body>
231
+ </html>
232
+ `
233
+
234
+ // Express.js example
235
+ app.get('/page', (req, res) => {
236
+ const meta = new MetaManager(['description', 'keywords'])
237
+ meta.setByList(req.pageData.meta)
238
+
239
+ res.send(`
240
+ <html>
241
+ <head>${meta.html()}</head>
242
+ <body>...</body>
243
+ </html>
244
+ `)
245
+ })
246
+ ```
247
+
248
+ ## Practical Examples
249
+
250
+ ### SEO Management
251
+
252
+ ```javascript
253
+ const seoMeta = new MetaManager([
254
+ 'description',
255
+ 'keywords',
256
+ 'author',
257
+ 'robots',
258
+ 'viewport'
259
+ ])
260
+
261
+ // Set SEO tags
262
+ seoMeta.setByList({
263
+ description: 'Complete guide to web development',
264
+ keywords: 'web, html, css, javascript, tutorial',
265
+ author: 'WebDev Team',
266
+ robots: 'index, follow',
267
+ viewport: 'width=device-width, initial-scale=1.0'
268
+ })
269
+
270
+ // Update on route change
271
+ router.on('change', (route) => {
272
+ seoMeta.setByList(route.meta)
273
+ })
274
+ ```
275
+
276
+ ### Open Graph Integration
277
+
278
+ ```javascript
279
+ const ogMeta = new MetaManager([
280
+ 'og:title',
281
+ 'og:description',
282
+ 'og:image',
283
+ 'og:url',
284
+ 'og:type',
285
+ 'og:site_name'
286
+ ], true)
287
+
288
+ // Set Open Graph data
289
+ ogMeta.setByList({
290
+ 'og:title': 'Amazing Article Title',
291
+ 'og:description': 'This article will blow your mind',
292
+ 'og:image': 'https://example.com/image.jpg',
293
+ 'og:url': 'https://example.com/article',
294
+ 'og:type': 'article',
295
+ 'og:site_name': 'My Website'
296
+ })
297
+
298
+ // For social media sharing
299
+ const shareData = {
300
+ title: ogMeta.get('og:title'),
301
+ description: ogMeta.get('og:description'),
302
+ image: ogMeta.get('og:image')
303
+ }
304
+ ```
305
+
306
+ ### Multi-Platform Meta Management
307
+
308
+ ```javascript
309
+ // Create managers for different platforms
310
+ const standardMeta = new MetaManager(['description', 'keywords'])
311
+ const ogMeta = new MetaManager(['og:title', 'og:description', 'og:image'], true)
312
+ const twitterMeta = new MetaManager(['twitter:card', 'twitter:title', 'twitter:description'])
313
+
314
+ // Update all platforms
315
+ const updateAllMeta = (data) => {
316
+ standardMeta.setByList({
317
+ description: data.description,
318
+ keywords: data.keywords
319
+ })
320
+
321
+ ogMeta.setByList({
322
+ 'og:title': data.title,
323
+ 'og:description': data.description,
324
+ 'og:image': data.image
325
+ })
326
+
327
+ twitterMeta.setByList({
328
+ 'twitter:card': 'summary_large_image',
329
+ 'twitter:title': data.title,
330
+ 'twitter:description': data.description
331
+ })
332
+ }
333
+
334
+ // Generate combined HTML for SSR
335
+ const allMetaHTML = [
336
+ standardMeta.html(),
337
+ ogMeta.html(),
338
+ twitterMeta.html()
339
+ ].join('')
340
+ ```
341
+
342
+ ### Dynamic Page Updates
343
+
344
+ ```javascript
345
+ const meta = new MetaManager(['description', 'keywords'])
346
+
347
+ // Single Page Application
348
+ const loadPage = async (pageId) => {
349
+ const pageData = await fetch(`/api/pages/${pageId}`).then(r => r.json())
350
+
351
+ // Update meta tags
352
+ meta.setByList(pageData.meta)
353
+
354
+ // Update title
355
+ document.title = pageData.title
356
+ }
357
+
358
+ // React/Vue integration
359
+ useEffect(() => {
360
+ meta.set('description', page.description)
361
+ return () => {
362
+ // Cleanup if needed
363
+ meta.set('description', '')
364
+ }
365
+ }, [page])
366
+ ```
367
+
368
+ ## Notes
369
+
370
+ - The constructor automatically reads existing meta tags from DOM using the `update()` method
371
+ - Methods that modify DOM check runtime environment with `isDomRuntime()` before accessing `document`
372
+ - The `html()` method uses `encodeAttribute()` function to prevent XSS issues when injecting into SSR templates
373
+ - Special characters in content are automatically escaped: `"` → `&quot;`, `&` → `&amp;`, etc.
374
+ - When a meta tag doesn't exist in DOM, `set()` creates it in `document.head`
375
+ - Empty strings are valid values and will update the meta tag content to empty
376
+ - The class works seamlessly in both browser and Node.js (SSR) environments