sommark 4.5.2 → 4.5.3

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.
@@ -97,5 +97,70 @@ export const HTML_PROPS = new Set([
97
97
  "referrerpolicy",
98
98
  "sizes",
99
99
  "srcset",
100
- "virtualkeyboardpolicy"
100
+ "virtualkeyboardpolicy",
101
+
102
+ // Links & navigation
103
+ "hreflang",
104
+ "ping",
105
+ "accept-charset",
106
+
107
+ // Forms
108
+ "accept",
109
+ "novalidate",
110
+ "dirname",
111
+
112
+ // Tables
113
+ "colspan",
114
+ "rowspan",
115
+ "scope",
116
+ "headers",
117
+ "span",
118
+
119
+ // Lists
120
+ "reversed",
121
+ "start",
122
+
123
+ // Interactive / structural
124
+ "open",
125
+ "size",
126
+ "cite",
127
+ "datetime",
128
+
129
+ // Media & track
130
+ "default",
131
+ "kind",
132
+ "label",
133
+ "srcdoc",
134
+ "srclang",
135
+
136
+ // Images
137
+ "ismap",
138
+ "usemap",
139
+
140
+ // Resource hints
141
+ "as",
142
+ "fetchpriority",
143
+
144
+ // Meta
145
+ "http-equiv",
146
+
147
+ // Meter
148
+ "high",
149
+ "low",
150
+ "optimum",
151
+
152
+ // Deprecated (still valid)
153
+ "align",
154
+ "bgcolor",
155
+ "border",
156
+ "color",
157
+ "coords",
158
+ "shape",
159
+ "summary",
160
+
161
+ // Experimental
162
+ "elementtiming",
163
+ "colorspace",
164
+ "alpha",
165
+ "csp",
101
166
  ]);
@@ -0,0 +1,31 @@
1
+ export const SVG_ELEMENTS = new Set([
2
+ // Basic shapes
3
+ "circle", "ellipse", "line", "path", "polygon", "polyline", "rect",
4
+ // Containers
5
+ "svg", "g", "defs", "symbol", "use", "marker", "mask", "pattern", "switch",
6
+ // Text
7
+ "text", "tspan", "textpath", "tref",
8
+ // Image
9
+ "image",
10
+ // Gradients
11
+ "lineargradient", "radialgradient", "stop", "solidcolor",
12
+ "meshgradient", "meshrow", "meshpatch",
13
+ // Hatch (SVG 2)
14
+ "hatch", "hatchpath",
15
+ // Filter container
16
+ "filter",
17
+ // Filter primitives
18
+ "feblend", "fecolormatrix", "fecomponenttransfer", "fecomposite",
19
+ "feconvolvematrix", "fediffuselighting", "fedisplacementmap", "fedropshadow",
20
+ "feflood", "fefunca", "fefuncb", "fefuncg", "fefuncr",
21
+ "fegaussianblur", "feimage", "femerge", "femergenode",
22
+ "femorphology", "feoffset", "fespecularlighting", "fetile", "feturbulence",
23
+ // Light sources
24
+ "fedistantlight", "fepointlight", "fespotlight",
25
+ // Animation
26
+ "animate", "animatemotion", "animatetransform", "set", "mpath", "discard",
27
+ // Descriptive
28
+ "desc", "title", "metadata",
29
+ // Other
30
+ "clippath", "foreignobject", "view", "cursor",
31
+ ]);
@@ -18,7 +18,7 @@ export function registerHostSettings(settings) {
18
18
  hostSettings = settings || {};
19
19
  }
20
20
 
21
- const version = "4.5.2";
21
+ const version = "4.5.3";
22
22
 
23
23
  const SomMark = {
24
24
  version,
@@ -9184,7 +9184,7 @@ function registerHostSettings(settings) {
9184
9184
  hostSettings = settings || {};
9185
9185
  }
9186
9186
 
9187
- const version = "4.5.2";
9187
+ const version = "4.5.3";
9188
9188
 
9189
9189
  const SomMark$1 = {
9190
9190
  version,
@@ -11320,7 +11320,72 @@ const HTML_PROPS = new Set([
11320
11320
  "referrerpolicy",
11321
11321
  "sizes",
11322
11322
  "srcset",
11323
- "virtualkeyboardpolicy"
11323
+ "virtualkeyboardpolicy",
11324
+
11325
+ // Links & navigation
11326
+ "hreflang",
11327
+ "ping",
11328
+ "accept-charset",
11329
+
11330
+ // Forms
11331
+ "accept",
11332
+ "novalidate",
11333
+ "dirname",
11334
+
11335
+ // Tables
11336
+ "colspan",
11337
+ "rowspan",
11338
+ "scope",
11339
+ "headers",
11340
+ "span",
11341
+
11342
+ // Lists
11343
+ "reversed",
11344
+ "start",
11345
+
11346
+ // Interactive / structural
11347
+ "open",
11348
+ "size",
11349
+ "cite",
11350
+ "datetime",
11351
+
11352
+ // Media & track
11353
+ "default",
11354
+ "kind",
11355
+ "label",
11356
+ "srcdoc",
11357
+ "srclang",
11358
+
11359
+ // Images
11360
+ "ismap",
11361
+ "usemap",
11362
+
11363
+ // Resource hints
11364
+ "as",
11365
+ "fetchpriority",
11366
+
11367
+ // Meta
11368
+ "http-equiv",
11369
+
11370
+ // Meter
11371
+ "high",
11372
+ "low",
11373
+ "optimum",
11374
+
11375
+ // Deprecated (still valid)
11376
+ "align",
11377
+ "bgcolor",
11378
+ "border",
11379
+ "color",
11380
+ "coords",
11381
+ "shape",
11382
+ "summary",
11383
+
11384
+ // Experimental
11385
+ "elementtiming",
11386
+ "colorspace",
11387
+ "alpha",
11388
+ "csp",
11324
11389
  ]);
11325
11390
 
11326
11391
  const VOID_ELEMENTS = new Set([
@@ -12268,6 +12333,38 @@ function registerSharedOutputs(mapper) {
12268
12333
 
12269
12334
  }
12270
12335
 
12336
+ const SVG_ELEMENTS = new Set([
12337
+ // Basic shapes
12338
+ "circle", "ellipse", "line", "path", "polygon", "polyline", "rect",
12339
+ // Containers
12340
+ "svg", "g", "defs", "symbol", "use", "marker", "mask", "pattern", "switch",
12341
+ // Text
12342
+ "text", "tspan", "textpath", "tref",
12343
+ // Image
12344
+ "image",
12345
+ // Gradients
12346
+ "lineargradient", "radialgradient", "stop", "solidcolor",
12347
+ "meshgradient", "meshrow", "meshpatch",
12348
+ // Hatch (SVG 2)
12349
+ "hatch", "hatchpath",
12350
+ // Filter container
12351
+ "filter",
12352
+ // Filter primitives
12353
+ "feblend", "fecolormatrix", "fecomponenttransfer", "fecomposite",
12354
+ "feconvolvematrix", "fediffuselighting", "fedisplacementmap", "fedropshadow",
12355
+ "feflood", "fefunca", "fefuncb", "fefuncg", "fefuncr",
12356
+ "fegaussianblur", "feimage", "femerge", "femergenode",
12357
+ "femorphology", "feoffset", "fespecularlighting", "fetile", "feturbulence",
12358
+ // Light sources
12359
+ "fedistantlight", "fepointlight", "fespotlight",
12360
+ // Animation
12361
+ "animate", "animatemotion", "animatetransform", "set", "mpath", "discard",
12362
+ // Descriptive
12363
+ "desc", "title", "metadata",
12364
+ // Other
12365
+ "clippath", "foreignobject", "view", "cursor",
12366
+ ]);
12367
+
12271
12368
  /**
12272
12369
  * Helper to format an HTML tag with attributes and content.
12273
12370
  *
@@ -12278,15 +12375,20 @@ function registerSharedOutputs(mapper) {
12278
12375
  */
12279
12376
  const renderHtmlTag = function (id, args, content, isSelfClosing) {
12280
12377
  const element = this.tag(id);
12378
+ const idLower = id.toLowerCase();
12281
12379
 
12282
- element.smartAttributes(args, this.customProps, this.options);
12380
+ if (SVG_ELEMENTS.has(idLower)) {
12381
+ element.attributes(args);
12382
+ } else {
12383
+ element.smartAttributes(args, this.customProps, this.options);
12384
+ }
12283
12385
 
12284
12386
  let finalContent = content;
12285
- if (id.toLowerCase() === "script" && args.scoped === true) {
12387
+ if (idLower === "script" && args.scoped === true) {
12286
12388
  finalContent = `(function(){\n${content}\n})();`;
12287
12389
  }
12288
12390
 
12289
- if (VOID_ELEMENTS.has(id.toLowerCase()) || isSelfClosing) {
12391
+ if (VOID_ELEMENTS.has(idLower) || isSelfClosing) {
12290
12392
  return element.selfClose();
12291
12393
  }
12292
12394
 
@@ -12357,12 +12459,12 @@ const HTML = Mapper.define({
12357
12459
  * @returns {Object} - A virtual id registration for fallback rendering.
12358
12460
  */
12359
12461
  getUnknownTag(node) {
12360
- const id = node.id.toLowerCase();
12361
- const isVoid = VOID_ELEMENTS.has(id);
12362
- const isCodeStyleOrScript = ["code", "style", "script"].includes(id);
12462
+ const idLower = node.id.toLowerCase();
12463
+ const isVoid = VOID_ELEMENTS.has(idLower);
12464
+ const isCodeStyleOrScript = ["code", "style", "script"].includes(idLower);
12363
12465
 
12364
12466
  return {
12365
- render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, id, args, content, isSelfClosing); },
12467
+ render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, node.id, args, content, isSelfClosing); },
12366
12468
  options: {
12367
12469
  type: isCodeStyleOrScript ? ["Block", "AtBlock"] : ["Block", "Inline"],
12368
12470
  escape: !isCodeStyleOrScript,
@@ -10228,7 +10228,72 @@ const HTML_PROPS = new Set([
10228
10228
  "referrerpolicy",
10229
10229
  "sizes",
10230
10230
  "srcset",
10231
- "virtualkeyboardpolicy"
10231
+ "virtualkeyboardpolicy",
10232
+
10233
+ // Links & navigation
10234
+ "hreflang",
10235
+ "ping",
10236
+ "accept-charset",
10237
+
10238
+ // Forms
10239
+ "accept",
10240
+ "novalidate",
10241
+ "dirname",
10242
+
10243
+ // Tables
10244
+ "colspan",
10245
+ "rowspan",
10246
+ "scope",
10247
+ "headers",
10248
+ "span",
10249
+
10250
+ // Lists
10251
+ "reversed",
10252
+ "start",
10253
+
10254
+ // Interactive / structural
10255
+ "open",
10256
+ "size",
10257
+ "cite",
10258
+ "datetime",
10259
+
10260
+ // Media & track
10261
+ "default",
10262
+ "kind",
10263
+ "label",
10264
+ "srcdoc",
10265
+ "srclang",
10266
+
10267
+ // Images
10268
+ "ismap",
10269
+ "usemap",
10270
+
10271
+ // Resource hints
10272
+ "as",
10273
+ "fetchpriority",
10274
+
10275
+ // Meta
10276
+ "http-equiv",
10277
+
10278
+ // Meter
10279
+ "high",
10280
+ "low",
10281
+ "optimum",
10282
+
10283
+ // Deprecated (still valid)
10284
+ "align",
10285
+ "bgcolor",
10286
+ "border",
10287
+ "color",
10288
+ "coords",
10289
+ "shape",
10290
+ "summary",
10291
+
10292
+ // Experimental
10293
+ "elementtiming",
10294
+ "colorspace",
10295
+ "alpha",
10296
+ "csp",
10232
10297
  ]);
10233
10298
 
10234
10299
  const VOID_ELEMENTS = new Set([
@@ -11176,6 +11241,38 @@ function registerSharedOutputs(mapper) {
11176
11241
 
11177
11242
  }
11178
11243
 
11244
+ const SVG_ELEMENTS = new Set([
11245
+ // Basic shapes
11246
+ "circle", "ellipse", "line", "path", "polygon", "polyline", "rect",
11247
+ // Containers
11248
+ "svg", "g", "defs", "symbol", "use", "marker", "mask", "pattern", "switch",
11249
+ // Text
11250
+ "text", "tspan", "textpath", "tref",
11251
+ // Image
11252
+ "image",
11253
+ // Gradients
11254
+ "lineargradient", "radialgradient", "stop", "solidcolor",
11255
+ "meshgradient", "meshrow", "meshpatch",
11256
+ // Hatch (SVG 2)
11257
+ "hatch", "hatchpath",
11258
+ // Filter container
11259
+ "filter",
11260
+ // Filter primitives
11261
+ "feblend", "fecolormatrix", "fecomponenttransfer", "fecomposite",
11262
+ "feconvolvematrix", "fediffuselighting", "fedisplacementmap", "fedropshadow",
11263
+ "feflood", "fefunca", "fefuncb", "fefuncg", "fefuncr",
11264
+ "fegaussianblur", "feimage", "femerge", "femergenode",
11265
+ "femorphology", "feoffset", "fespecularlighting", "fetile", "feturbulence",
11266
+ // Light sources
11267
+ "fedistantlight", "fepointlight", "fespotlight",
11268
+ // Animation
11269
+ "animate", "animatemotion", "animatetransform", "set", "mpath", "discard",
11270
+ // Descriptive
11271
+ "desc", "title", "metadata",
11272
+ // Other
11273
+ "clippath", "foreignobject", "view", "cursor",
11274
+ ]);
11275
+
11179
11276
  /**
11180
11277
  * Helper to format an HTML tag with attributes and content.
11181
11278
  *
@@ -11186,15 +11283,20 @@ function registerSharedOutputs(mapper) {
11186
11283
  */
11187
11284
  const renderHtmlTag = function (id, args, content, isSelfClosing) {
11188
11285
  const element = this.tag(id);
11286
+ const idLower = id.toLowerCase();
11189
11287
 
11190
- element.smartAttributes(args, this.customProps, this.options);
11288
+ if (SVG_ELEMENTS.has(idLower)) {
11289
+ element.attributes(args);
11290
+ } else {
11291
+ element.smartAttributes(args, this.customProps, this.options);
11292
+ }
11191
11293
 
11192
11294
  let finalContent = content;
11193
- if (id.toLowerCase() === "script" && args.scoped === true) {
11295
+ if (idLower === "script" && args.scoped === true) {
11194
11296
  finalContent = `(function(){\n${content}\n})();`;
11195
11297
  }
11196
11298
 
11197
- if (VOID_ELEMENTS.has(id.toLowerCase()) || isSelfClosing) {
11299
+ if (VOID_ELEMENTS.has(idLower) || isSelfClosing) {
11198
11300
  return element.selfClose();
11199
11301
  }
11200
11302
 
@@ -11265,12 +11367,12 @@ const HTML = Mapper.define({
11265
11367
  * @returns {Object} - A virtual id registration for fallback rendering.
11266
11368
  */
11267
11369
  getUnknownTag(node) {
11268
- const id = node.id.toLowerCase();
11269
- const isVoid = VOID_ELEMENTS.has(id);
11270
- const isCodeStyleOrScript = ["code", "style", "script"].includes(id);
11370
+ const idLower = node.id.toLowerCase();
11371
+ const isVoid = VOID_ELEMENTS.has(idLower);
11372
+ const isCodeStyleOrScript = ["code", "style", "script"].includes(idLower);
11271
11373
 
11272
11374
  return {
11273
- render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, id, args, content, isSelfClosing); },
11375
+ render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, node.id, args, content, isSelfClosing); },
11274
11376
  options: {
11275
11377
  type: isCodeStyleOrScript ? ["Block", "AtBlock"] : ["Block", "Inline"],
11276
11378
  escape: !isCodeStyleOrScript,
@@ -1,5 +1,6 @@
1
1
  import Mapper from "../mapper.js";
2
2
  import { VOID_ELEMENTS } from "../../constants/void_elements.js";
3
+ import { SVG_ELEMENTS } from "../../constants/svg_elements.js";
3
4
  import { registerSharedOutputs } from "../shared/index.js";
4
5
  import kebabize from "../../helpers/kebabize.js";
5
6
 
@@ -13,15 +14,20 @@ import kebabize from "../../helpers/kebabize.js";
13
14
  */
14
15
  const renderHtmlTag = function (id, args, content, isSelfClosing) {
15
16
  const element = this.tag(id);
17
+ const idLower = id.toLowerCase();
16
18
 
17
- element.smartAttributes(args, this.customProps, this.options);
19
+ if (SVG_ELEMENTS.has(idLower)) {
20
+ element.attributes(args);
21
+ } else {
22
+ element.smartAttributes(args, this.customProps, this.options);
23
+ }
18
24
 
19
25
  let finalContent = content;
20
- if (id.toLowerCase() === "script" && args.scoped === true) {
26
+ if (idLower === "script" && args.scoped === true) {
21
27
  finalContent = `(function(){\n${content}\n})();`;
22
28
  }
23
29
 
24
- if (VOID_ELEMENTS.has(id.toLowerCase()) || isSelfClosing) {
30
+ if (VOID_ELEMENTS.has(idLower) || isSelfClosing) {
25
31
  return element.selfClose();
26
32
  }
27
33
 
@@ -92,12 +98,12 @@ const HTML = Mapper.define({
92
98
  * @returns {Object} - A virtual id registration for fallback rendering.
93
99
  */
94
100
  getUnknownTag(node) {
95
- const id = node.id.toLowerCase();
96
- const isVoid = VOID_ELEMENTS.has(id);
97
- const isCodeStyleOrScript = ["code", "style", "script"].includes(id);
101
+ const idLower = node.id.toLowerCase();
102
+ const isVoid = VOID_ELEMENTS.has(idLower);
103
+ const isCodeStyleOrScript = ["code", "style", "script"].includes(idLower);
98
104
 
99
105
  return {
100
- render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, id, args, content, isSelfClosing); },
106
+ render: function ({ args, content, isSelfClosing }) { return renderHtmlTag.call(this, node.id, args, content, isSelfClosing); },
101
107
  options: {
102
108
  type: isCodeStyleOrScript ? ["Block", "AtBlock"] : ["Block", "Inline"],
103
109
  escape: !isCodeStyleOrScript,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sommark",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "description": "SomMark is a declarative, extensible markup language for structured content that can be converted to HTML, Markdown, MDX, JSON, XML, and more.",
5
5
  "main": "index.js",
6
6
  "files": [